本文整理汇总了PHP中SS_List类的典型用法代码示例。如果您正苦于以下问题:PHP SS_List类的具体用法?PHP SS_List怎么用?PHP SS_List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SS_List类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setLists
/**
* The list of TodoLists
*
* @param SS_List $lists
* @return $this
*/
public function setLists($lists)
{
$this->lists = $lists->filterByCallback(function ($item) {
return $item->canView();
});
return $this;
}
开发者ID:muskie9,项目名称:todo-list,代码行数:13,代码来源:ListController.php
示例2: getPhpExcelObject
/**
* Generate a {@link PHPExcel} for the provided DataObject List
* @param SS_List $set List of DataObjects
* @return PHPExcel
*/
public function getPhpExcelObject(SS_List $set)
{
// Get the first object. We'll need it to know what type of objects we
// are dealing with
$first = $set->first();
// Get the Excel object
$excel = $this->setupExcel($first);
$sheet = $excel->setActiveSheetIndex(0);
// Make sure we have at lease on item. If we don't, we'll be returning
// an empty spreadsheet.
if ($first) {
// Set up the header row
$fields = $this->getFieldsForObj($first);
$this->headerRow($sheet, $fields);
// Add a new row for each DataObject
foreach ($set as $item) {
$this->addRow($sheet, $item, $fields);
}
// Freezing the first column and the header row
$sheet->freezePane("B2");
// Auto sizing all the columns
$col = sizeof($fields);
for ($i = 0; $i < $col; $i++) {
$sheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(true);
}
}
return $excel;
}
开发者ID:helpfulrobot,项目名称:firebrandhq-silverstripe-excel-export,代码行数:33,代码来源:ExcelDataFormatter.php
示例3: batchaction
/**
* Helper method for processing batch actions.
* Returns a set of status-updating JavaScript to return to the CMS.
*
* @param $objs The SS_List of objects to perform this batch action
* on.
* @param $helperMethod The method to call on each of those objects.
* @return JSON encoded map in the following format:
* {
* 'modified': {
* 3: {'TreeTitle': 'Page3'},
* 5: {'TreeTitle': 'Page5'}
* },
* 'deleted': {
* // all deleted pages
* }
* }
*/
public function batchaction(SS_List $objs, $helperMethod, $successMessage, $arguments = array()) {
$status = array('modified' => array(), 'error' => array());
foreach($objs as $obj) {
// Perform the action
if (!call_user_func_array(array($obj, $helperMethod), $arguments)) {
$status['error'][$obj->ID] = '';
}
// Now make sure the tree title is appropriately updated
$publishedRecord = DataObject::get_by_id($this->managedClass, $obj->ID);
if ($publishedRecord) {
$status['modified'][$publishedRecord->ID] = array(
'TreeTitle' => $publishedRecord->TreeTitle,
);
}
$obj->destroy();
unset($obj);
}
$response = Controller::curr()->getResponse();
if($response) {
$response->setStatusCode(
200,
sprintf($successMessage, $objs->Count(), count($status['error']))
);
}
return Convert::raw2json($status);
}
开发者ID:redema,项目名称:sapphire,代码行数:49,代码来源:CMSBatchAction.php
示例4: to_autocomplete_array
/**
* @param SS_List $scope the scope to iterate over - handy if you don't want
* to add this extension for a one-off use
* @return array
*/
public static function to_autocomplete_array($scope)
{
$items = $scope->toArray();
foreach ($items as &$item) {
if ($item->hasMethod('toAutocompleteMap')) {
$item = $item->toAutocompleteMap();
} else {
$item = $item->toMap();
}
}
return $items;
}
开发者ID:betterbrief,项目名称:silverstripe-autocompletefield,代码行数:17,代码来源:AutocompleteExtension.php
示例5: __construct
/**
* Usage [e.g. in getCMSFields]
* $field = new PickerField('Authors', 'Selected Authors', $this->Authors(), 'Select Author(s)');
*
* @param string $name - Name of field (typically the relationship method)
* @param string $title - GridField Title
* @param SS_List $dataList - Result of the relationship component method (E.g. $this->Authors())
* @param string $linkExistingTitle - AddExisting Button Title
* @param string $sortField - Field to sort on. Be sure it exists in the $many_many_extraFields static
*/
public function __construct($name, $title = null, SS_List $dataList = null, $linkExistingTitle = null, $sortField = null)
{
$config = GridfieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldToolbarHeader(), new GridFieldDataColumns(), new GridFieldTitleHeader(), new GridFieldPaginator(), new PickerFieldAddExistingSearchButton(), new PickerFieldDeleteAction());
if ($sortField) {
$config->addComponent(new GridFieldOrderableRows($sortField));
}
if (!$linkExistingTitle) {
$linkExistingTitle = $this->isHaveOne() ? 'Select a ' . $dataList->dataClass() : 'Select ' . $dataList->dataClass() . '(s)';
// plural [has_many, many_many]
}
$config->getComponentByType('PickerFieldAddExistingSearchButton')->setTitle($linkExistingTitle);
return parent::__construct($name, $title, $dataList, $config);
}
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-pickerfield,代码行数:23,代码来源:PickerField.php
示例6: getManipulatedData
/**
* Adds the records to the database and returns a new {@link DataList}
*
* @param GridField
* @param SS_List
* @return SS_List
*/
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
$state = $gridField->State->MockDataGenerator;
$count = (string) $state->Count;
if (!$count) {
return $dataList;
}
$generator = new MockDataBuilder($gridField->getModelClass());
$ids = $generator->setCount($count)->setIncludeRelations($state->IncludeRelations)->setDownloadImages($state->DownloadImages === true)->generate();
foreach ($ids as $id) {
$dataList->add($id);
}
return $dataList;
}
开发者ID:helpfulrobot,项目名称:unclecheese-mock-dataobjects,代码行数:21,代码来源:MockDataGenerator.php
示例7: __construct
/**
* @param string $name
* @param string $title
* @param DataObjectInterface $object
* @param string $sort
* @param SS_List $source
* @param string $titleField
*/
public function __construct($name, $title, DataObjectInterface $object, $sort = false, SS_List $source = null, $titleField = 'Title')
{
$this->setSort($sort);
if ($object->many_many($name)) {
$dataSource = $object->{$name}();
// Check if we're dealing with an UnsavedRelationList
$unsaved = $dataSource instanceof UnsavedRelationList;
// Store the relation's class name
$class = $dataSource->dataClass();
$this->dataClass = $class;
// Sort the items
if ($this->getSort()) {
$dataSource = $dataSource->sort($this->getSort());
}
// If we're dealing with an UnsavedRelationList, it'll be empty, so we
// can skip this and just use an array of all available items
if ($unsaved) {
$dataSource = $class::get()->map()->toArray();
} else {
// If we've been given a list source, filter on those IDs only.
if ($source) {
$dataSource = $dataSource->filter('ID', $source->column('ID'));
}
// Start building the data source from scratch. Currently selected items first,
// in the correct sort order
$dataSource = $dataSource->map('ID', $titleField)->toArray();
// Get the other items
$theRest = $class::get();
// Exclude items that we've already found
if (!empty($dataSource)) {
$theRest = $theRest->exclude('ID', array_keys($dataSource));
}
// If we've been given a list source, filter on those IDs only
if ($source) {
$theRest = $theRest->filter('ID', $source->column('ID'));
}
$theRest = $theRest->map('ID', $titleField)->toArray();
// ... we then add the remaining items in whatever order they come
$dataSource = $dataSource + $theRest;
}
} elseif ($source instanceof SS_List) {
$dataSource = $source->map('ID', $titleField)->toArray();
} elseif (is_array($source) && ArrayLib::is_associative($source)) {
$dataSource = $source;
} else {
user_error('MultiSelectField::__construct(): MultiSelectField only supports many-to-many relations');
}
parent::__construct($name, $title, $dataSource, '', null, true);
}
开发者ID:helpfulrobot,项目名称:fullscreeninteractive-silverstripe-multiselectfield,代码行数:57,代码来源:MultiSelectField.php
示例8: getManipulatedData
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
if (!$gridField->State->GridFieldAddRelation) {
return $dataList;
}
$objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
if ($objectID) {
$object = DataObject::get_by_id($dataList->dataclass(), $objectID);
if ($object) {
$dataList->add($object);
}
}
$gridField->State->GridFieldAddRelation = null;
return $dataList;
}
开发者ID:helpfulrobot,项目名称:jonshutt-find-many-many-dropdown,代码行数:15,代码来源:FindManyManyDropdown.php
示例9: getExtraSavedData
/**
* Get the list of extra data from the $record as saved into it by
* {@see Form::saveInto()}
*
* Handles detection of falsey values explicitly saved into the
* DataObject by formfields
*
* @param DataObject $record
* @param SS_List $list
* @return array List of data to write to the relation
*/
protected function getExtraSavedData($record, $list)
{
// Skip extra data if not ManyManyList
if (!$list instanceof ManyManyList) {
return null;
}
$data = array();
foreach ($list->getExtraFields() as $field => $dbSpec) {
$savedField = "ManyMany[{$field}]";
if ($record->hasField($savedField)) {
$data[$field] = $record->getField($savedField);
}
}
return $data;
}
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-pickerfield,代码行数:26,代码来源:PickerFieldEditHandler.php
示例10: run
public function run(SS_List $pages)
{
// Sort pages by depth
$pageArray = $pages->toArray();
// because of https://bugs.php.net/bug.php?id=50688
foreach ($pageArray as $page) {
$page->getPageLevel();
}
usort($pageArray, function ($a, $b) {
return $a->getPageLevel() - $b->getPageLevel();
});
$pages = new ArrayList($pageArray);
// Restore
return $this->batchaction($pages, 'doRestoreToStage', _t('CMSBatchActions.RESTORED_PAGES', 'Restored %d pages'));
}
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:15,代码来源:CMSBatchActions.php
示例11: getItems
/**
* @return SS_List
*/
public function getItems()
{
$name = $this->getName();
if (!$this->items || !$this->items->exists()) {
$record = $this->getRecord();
$this->items = array();
// Try to auto-detect relationship
if ($record && $record->exists()) {
if ($record->has_many($name) || $record->many_many($name)) {
// Ensure relationship is cast to an array, as we can't alter the items of a DataList/RelationList (see below)
$this->items = $record->{$name}()->toArray();
} elseif ($record->has_one($name)) {
$item = $record->{$name}();
if ($item && $item->exists()) {
$this->items = array($record->{$name}());
}
}
}
$this->items = new ArrayList($this->items);
// hack to provide $UploadFieldThumbnailURL, $hasRelation and $UploadFieldEditLink in template for each file
if ($this->items->exists()) {
foreach ($this->items as $i => $file) {
$this->items[$i] = $this->customiseFile($file);
if (!$file->canView()) {
unset($this->items[$i]);
}
// Respect model permissions
}
}
}
return $this->items;
}
开发者ID:prostart,项目名称:cobblestonepath,代码行数:35,代码来源:UploadField.php
示例12: getManipulatedData
/**
* If an object ID is set, add the object to the list
*
* @param GridField $gridField
* @param SS_List $dataList
* @return SS_List
*/
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
if (!$gridField->State->GridFieldAddRelation) {
return $dataList;
}
$objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
if ($objectID) {
$object = DataObject::get_by_id($dataList->dataclass(), $objectID);
if ($object) {
$virtual = new ElementVirtualLinked();
$virtual->LinkedElementID = $object->ID;
$virtual->write();
$dataList->add($virtual);
}
}
$gridField->State->GridFieldAddRelation = null;
return $dataList;
}
开发者ID:nyeholt,项目名称:silverstripe-elemental,代码行数:25,代码来源:ElementalGridFieldAddExistingAutocompleter.php
示例13: merge_owners
/**
* Takes a list of groups and members and return a list of unique member.
*
* @param SS_List $groups
* @param SS_List $members
*
* @return ArrayList
*/
public static function merge_owners(SS_List $groups, SS_List $members)
{
$contentReviewOwners = new ArrayList();
if ($groups->count()) {
$groupIDs = array();
foreach ($groups as $group) {
$familyIDs = $group->collateFamilyIDs();
if (is_array($familyIDs)) {
$groupIDs = array_merge($groupIDs, array_values($familyIDs));
}
}
array_unique($groupIDs);
if (count($groupIDs)) {
$groupMembers = DataObject::get("Member")->where("\"Group\".\"ID\" IN (" . implode(",", $groupIDs) . ")")->leftJoin("Group_Members", "\"Member\".\"ID\" = \"Group_Members\".\"MemberID\"")->leftJoin("Group", "\"Group_Members\".\"GroupID\" = \"Group\".\"ID\"");
$contentReviewOwners->merge($groupMembers);
}
}
$contentReviewOwners->merge($members);
$contentReviewOwners->removeDuplicates();
return $contentReviewOwners;
}
开发者ID:kinglozzer,项目名称:silverstripe-contentreview,代码行数:29,代码来源:SiteTreeContentReview.php
示例14: getManipulatedData
/**
* If an object ID is set, add the object to the list
*
* @param GridField $gridField
* @param SS_List $dataList
* @return SS_List
*/
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
if (!$gridField->State->GridFieldAddRelation) {
return $dataList;
}
$objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
if ($objectID) {
$object = DataObject::get_by_id($dataList->dataclass(), $objectID);
if ($object) {
if ($this->_item_limit > 0 && $dataList->count() + 1 > $this->_item_limit) {
$gridField->getForm()->getController()->getResponse()->addHeader('X-Status', _t('LimitedRelationsGridField.ITEM_LIMIT_REACHED', '_You cannot add any more items, you can only add {count} items. Please remove one then try again.', array('count' => $this->_item_limit)));
} else {
$dataList->add($object);
}
}
}
$gridField->State->GridFieldAddRelation = null;
return $dataList;
}
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-limitedrelationsgridfield,代码行数:26,代码来源:LRGridFieldAddExistingAutocompleter.php
示例15: getManipulatedData
/**
* If an object ID is set, add the object to the list
*
* @param GridField $gridField
* @param SS_List $dataList
* @return SS_List
*/
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
if (!$gridField->State->GridFieldAddRelation) {
return $dataList;
}
$objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
if ($objectID) {
$object = DataObject::get_by_id($dataList->dataclass(), $objectID);
if ($object) {
// if the object is currently not linked to either a page or another list then we want to link to
// the original, otherwise link to a clone
if (!$object->ParentID && !$object->ListID) {
$dataList->add($object);
} else {
$virtual = new ElementVirtualLinked();
$virtual->LinkedElementID = $object->ID;
$virtual->write();
$dataList->add($virtual);
}
}
}
$gridField->State->GridFieldAddRelation = null;
return $dataList;
}
开发者ID:dnadesign,项目名称:silverstripe-elemental,代码行数:31,代码来源:ElementalGridFieldAddExistingAutocompleter.php
示例16: setValue
/**
* Loads the related record values into this field. UploadField can be uploaded
* in one of three ways:
*
* - By passing in a list of file IDs in the $value parameter (an array with a single
* key 'Files', with the value being the actual array of IDs).
* - By passing in an explicit list of File objects in the $record parameter, and
* leaving $value blank.
* - By passing in a dataobject in the $record parameter, from which file objects
* will be extracting using the field name as the relation field.
*
* Each of these methods will update both the items (list of File objects) and the
* field value (list of file ID values).
*
* @param array $value Array of submitted form data, if submitting from a form
* @param array|DataObject|SS_List $record Full source record, either as a DataObject,
* SS_List of items, or an array of submitted form data
* @return UploadField Self reference
*/
public function setValue($value, $record = null)
{
// If we're not passed a value directly, we can attempt to infer the field
// value from the second parameter by inspecting its relations
$items = new ArrayList();
// Determine format of presented data
if (empty($value) && $record) {
// If a record is given as a second parameter, but no submitted values,
// then we should inspect this instead for the form values
if ($record instanceof DataObject && $record->hasMethod($this->getName())) {
// If given a dataobject use reflection to extract details
$data = $record->{$this->getName()}();
if ($data instanceof DataObject) {
// If has_one, add sole item to default list
$items->push($data);
} elseif ($data instanceof SS_List) {
// For many_many and has_many relations we can use the relation list directly
$items = $data;
}
} elseif ($record instanceof SS_List) {
// If directly passing a list then save the items directly
$items = $record;
}
} elseif (!empty($value['Files'])) {
// If value is given as an array (such as a posted form), extract File IDs from this
$class = $this->getRelationAutosetClass();
$items = DataObject::get($class)->byIDs($value['Files']);
}
// If javascript is disabled, direct file upload (non-html5 style) can
// trigger a single or multiple file submission. Note that this may be
// included in addition to re-submitted File IDs as above, so these
// should be added to the list instead of operated on independently.
if ($uploadedFiles = $this->extractUploadedFileData($value)) {
foreach ($uploadedFiles as $tempFile) {
$file = $this->saveTemporaryFile($tempFile, $error);
if ($file) {
$items->add($file);
} else {
throw new ValidationException($error);
}
}
}
// Filter items by what's allowed to be viewed
$filteredItems = new ArrayList();
$fileIDs = array();
foreach ($items as $file) {
if ($file->exists() && $file->canView()) {
$filteredItems->push($file);
$fileIDs[] = $file->ID;
}
}
// Filter and cache updated item list
$this->items = $filteredItems;
// Same format as posted form values for this field. Also ensures that
// $this->setValue($this->getValue()); is non-destructive
$value = $fileIDs ? array('Files' => $fileIDs) : null;
// Set value using parent
return parent::setValue($value, $record);
}
开发者ID:hemant-chakka,项目名称:awss,代码行数:78,代码来源:UploadField.php
示例17: fixSortColumn
/**
* Detects and corrects items with a sort column value of 0, by appending them to the bottom of the list
* @param GridField $gridField Grid Field Reference
* @param SS_List $dataList Data List of items to be checked
*/
protected function fixSortColumn($gridField, SS_List $dataList)
{
if (class_exists('UnsavedRelationList') && $dataList instanceof UnsavedRelationList) {
return;
}
$list = clone $dataList;
$list = $list->alterDataQuery(function ($query, SS_List $tmplist) {
$query->limit(array());
return $query;
});
$many_many = $list instanceof ManyManyList;
if (!$many_many) {
$sng = singleton($gridField->getModelClass());
$fieldType = $sng->db($this->sortColumn);
if (!$fieldType || !($fieldType == 'Int' || is_subclass_of('Int', $fieldType))) {
if (is_array($fieldType)) {
user_error('Sort column ' . $this->sortColumn . ' could not be found in ' . $gridField->getModelClass() . '\'s ancestry', E_USER_ERROR);
} else {
user_error('Sort column ' . $this->sortColumn . ' must be an Int, column is of type ' . $fieldType, E_USER_ERROR);
}
exit;
}
}
$max = $list->Max($this->sortColumn);
$list = $list->filter($this->sortColumn, 0)->sort("Created,ID");
if ($list->Count() > 0) {
$owner = $gridField->Form->getRecord();
$sortColumn = $this->sortColumn;
$i = 1;
if ($many_many) {
list($parentClass, $componentClass, $parentField, $componentField, $table) = $owner->many_many($gridField->getName());
$extraFields = $owner->many_many_extraFields($gridField->getName());
if (!$extraFields || !array_key_exists($this->sortColumn, $extraFields) || !($extraFields[$this->sortColumn] == 'Int' || is_subclass_of('Int', $extraFields[$this->sortColumn]))) {
user_error('Sort column ' . $this->sortColumn . ' must be an Int, column is of type ' . $extraFields[$this->sortColumn], E_USER_ERROR);
exit;
}
} else {
//Find table containing the sort column
$table = false;
$class = $gridField->getModelClass();
$db = Config::inst()->get($class, "db", CONFIG::UNINHERITED);
if (!empty($db) && array_key_exists($sortColumn, $db)) {
$table = $class;
} else {
$classes = ClassInfo::ancestry($class, true);
foreach ($classes as $class) {
$db = Config::inst()->get($class, "db", CONFIG::UNINHERITED);
if (!empty($db) && array_key_exists($sortColumn, $db)) {
$table = $class;
break;
}
}
}
if ($table === false) {
user_error('Sort column ' . $this->sortColumn . ' could not be found in ' . $gridField->getModelClass() . '\'s ancestry', E_USER_ERROR);
exit;
}
$baseDataClass = ClassInfo::baseDataClass($gridField->getModelClass());
}
//Start transaction if supported
if (DB::getConn()->supportsTransactions()) {
DB::getConn()->transactionStart();
}
$idCondition = null;
if ($this->append_to_top && !$list instanceof RelationList) {
$idCondition = '"ID" IN(\'' . implode("','", $dataList->getIDList()) . '\')';
}
if ($this->append_to_top) {
$topIncremented = array();
}
foreach ($list as $obj) {
if ($many_many) {
if ($this->append_to_top) {
//Upgrade all the records (including the last inserted from 0 to 1)
DB::query('UPDATE "' . $table . '" SET "' . $sortColumn . '" = "' . $sortColumn . '"+1' . ' WHERE "' . $parentField . '" = ' . $owner->ID . (!empty($topIncremented) ? ' AND "' . $componentField . '" NOT IN(\'' . implode('\',\'', $topIncremented) . '\')' : ''));
$topIncremented[] = $obj->ID;
} else {
//Append the last record to the bottom
DB::query('UPDATE "' . $table . '" SET "' . $sortColumn . '" = ' . ($max + $i) . ' WHERE "' . $componentField . '" = ' . $obj->ID . ' AND "' . $parentField . '" = ' . $owner->ID);
}
} else {
if ($this->append_to_top) {
//Upgrade all the records (including the last inserted from 0 to 1)
DB::query('UPDATE "' . $table . '" SET "' . $sortColumn . '" = "' . $sortColumn . '"+1' . ' WHERE ' . ($list instanceof RelationList ? '"' . $list->foreignKey . '" = ' . $owner->ID : $idCondition) . (!empty($topIncremented) ? ' AND "ID" NOT IN(\'' . implode('\',\'', $topIncremented) . '\')' : ''));
//LastEdited
DB::query('UPDATE "' . $baseDataClass . '" SET "LastEdited" = \'' . date('Y-m-d H:i:s') . '\'' . ' WHERE ' . ($list instanceof RelationList ? '"' . $list->foreignKey . '" = ' . $owner->ID : $idCondition) . (!empty($topIncremented) ? ' AND "ID" NOT IN(\'' . implode('\',\'', $topIncremented) . '\')' : ''));
$topIncremented[] = $obj->ID;
} else {
//Append the last record to the bottom
DB::query('UPDATE "' . $table . '" SET "' . $sortColumn . '" = ' . ($max + $i) . ' WHERE "ID" = ' . $obj->ID);
//LastEdited
DB::query('UPDATE "' . $baseDataClass . '" SET "LastEdited" = \'' . date('Y-m-d H:i:s') . '\'' . ' WHERE "ID" = ' . $obj->ID);
}
}
$i++;
//.........这里部分代码省略.........
开发者ID:helpfulrobot,项目名称:maldicore-sortablegridfield,代码行数:101,代码来源:GridFieldSortableRows.php
示例18: subtract
/**
* This method returns a copy of this list that does not contain any DataObjects that exists in $list
*
* The $list passed needs to contain the same dataclass as $this
*
* @param SS_List $list
* @return DataList
* @throws BadMethodCallException
*/
public function subtract(SS_List $list)
{
if ($this->dataclass() != $list->dataclass()) {
throw new InvalidArgumentException('The list passed must have the same dataclass as this class');
}
return $this->alterDataQuery(function ($query) use($list) {
$query->subtract($list->dataQuery());
});
}
开发者ID:assertchris,项目名称:silverstripe-framework,代码行数:18,代码来源:DataList.php
示例19: subtract
/**
* This method returns a list does not contain any DataObjects that exists in $list
*
* It does not return the resulting list, it only adds the constraints on the database to exclude
* objects from $list.
* The $list passed needs to contain the same dataclass as $this
*
* @param SS_List $list
* @return DataList
* @throws BadMethodCallException
*/
public function subtract(SS_List $list)
{
if ($this->dataclass() != $list->dataclass()) {
throw new InvalidArgumentException('The list passed must have the same dataclass as this class');
}
$newlist = clone $this;
$newlist->dataQuery->subtract($list->dataQuery());
return $newlist;
}
开发者ID:nomidi,项目名称:sapphire,代码行数:20,代码来源:DataList.php
示例20: getTemplateVariables
/**
* Gets list of safe template variables and their values which can be used
* in both the static and editable templates.
*
* {@see ContentReviewAdminHelp.ss}
*
* @param Member $recipient
* @param SiteConfig $config
* @param SS_List $pages
* @param string $type
*
* @return array
*/
protected function getTemplateVariables($recipient = null, $config, $pages)
{
if ($recipient != null) {
return array('Subject' => $config->ReviewSubject, 'PagesCount' => $pages->count(), 'FromEmail' => $config->ReviewFrom, 'ToFirstName' => $recipient->FirstName, 'ToSurname' => $recipient->Surname, 'ToEmail' => $recipient->Email);
} else {
return array('Subject' => $config->ReviewSubjectReminder, 'FirstReminderPagesCount' => $pages->count(), 'SecondReminderPagesCount' => $pages->count(), 'FromEmail' => $config->ReviewFrom, 'ToEmail' => $config->ReviewReminderEmail);
}
}
开发者ID:GOVTNZ,项目名称:silverstripe-contentreview,代码行数:21,代码来源:ContentReviewEmails.php
注:本文中的SS_List类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论