当前位置: 首页>>代码示例>>PHP>>正文


PHP modResource::getMany方法代码示例

本文整理汇总了PHP中modResource::getMany方法的典型用法代码示例。如果您正苦于以下问题:PHP modResource::getMany方法的具体用法?PHP modResource::getMany怎么用?PHP modResource::getMany使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在modResource的用法示例。


在下文中一共展示了modResource::getMany方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 /**
  * {@inheritDoc}
  * @return mixed
  */
 public function process()
 {
     if (!$this->resource->checkPolicy('delete')) {
         return $this->failure($this->modx->lexicon('resource_err_delete'));
     }
     $resources = array($this->resource);
     $ids = array($this->resource->id);
     $this->modx->invokeEvent('OnBeforeEmptyTrash', array('ids' => &$ids, 'resources' => &$resources));
     $this->handleChildren();
     /** @var modResourceGroupResource[] $resourceGroupResources */
     $resourceGroupResources = $this->resource->getMany('ResourceGroupResources');
     /** @var modTemplateVarResource[] $templateVarResources */
     $templateVarResources = $this->resource->getMany('TemplateVarResources');
     foreach ($resourceGroupResources as $resourceGroupResource) {
         $resourceGroupResource->remove();
     }
     foreach ($templateVarResources as $templateVarResource) {
         $templateVarResource->remove();
     }
     $this->modx->removeCollection('CollectionSelection', array('resource' => $this->resource->id));
     if ($this->resource->remove() == false) {
         return $this->failure($this->modx->lexicon('resource_err_delete'));
     }
     $this->modx->invokeEvent('OnEmptyTrash', array('num_deleted' => 1, 'resources' => &$resources, 'ids' => &$ids));
     $this->logManagerAction();
     $skipClearCache = $this->getProperty('skipClearCache', false);
     if ($skipClearCache == false) {
         $this->clearCache();
     }
     return $this->success();
 }
开发者ID:lokamaya,项目名称:Collections,代码行数:35,代码来源:remove.class.php

示例2: modresource_populate_children

function modresource_populate_children(\Teleport\Action\Extract &$extract, modResource &$object, $criteria, $graph, $graphCriteria, $vehicle, &$vehicleCount)
{
    unset($criteria['parent']);
    $children = $object->getMany('Children', null, false);
    if ($children) {
        foreach ($children as &$child) {
            /** @var modResource $child */
            if ($graph !== null) {
                $child->getGraph($graph, $graphCriteria);
            }
            if ($extract->package->put($child, $vehicle['attributes'])) {
                $vehicleCount++;
            }
            modresource_populate_children($extract, $child, $criteria, $graph, $graphCriteria, $vehicle, $vehicleCount);
        }
    }
}
开发者ID:exside,项目名称:teleport,代码行数:17,代码来源:modresourcechildren.php

示例3: array

 /**
  * @param string $alias
  * @param null $criteria
  * @param bool $cacheFlag
  *
  * @return array
  */
 public function &getMany($alias, $criteria = null, $cacheFlag = true)
 {
     if ($alias == 'Files' || $alias == 'Votes') {
         $criteria = array('class' => $this->class_key);
     }
     return parent::getMany($alias, $criteria, $cacheFlag);
 }
开发者ID:soulcreate,项目名称:Tickets,代码行数:14,代码来源:ticket.class.php

示例4: getChildren

 /**
  * Helper method for getChildrenIds for getting Children recursively
  *
  * @see getChildrenIds
  * @param modResource $parent
  * @return void
  */
 protected function getChildren(modResource $parent)
 {
     $childResources = $parent->getMany('Children');
     if (count($childResources) > 0) {
         /** @var modResource $child */
         foreach ($childResources as $child) {
             if ($child->get('id') == $this->modx->getOption('site_start')) {
                 continue;
             }
             if ($child->get('id') == $this->modx->getOption('site_unavailable_page')) {
                 continue;
             }
             $this->children[] = $child;
             /* recursively loop through tree */
             $this->getChildren($child);
         }
     }
 }
开发者ID:e-gob,项目名称:apps.gob.cl,代码行数:25,代码来源:delete.class.php

示例5:

 /**
  * {@inheritdoc}
  * */
 public function &getMany($alias, $criteria = null, $cacheFlag = false)
 {
     if (in_array($alias, $this->dataRelated)) {
         if (!is_object($this->data)) {
             $this->loadData();
         }
         return $this->data->getMany($alias, $criteria, $cacheFlag);
     } else {
         return parent::getMany($alias, $criteria, $cacheFlag);
     }
 }
开发者ID:Vitaliz,项目名称:miniShop2,代码行数:14,代码来源:msproduct.class.php

示例6: duplicateResource

 /**
  * Creates a duplicate of the specified resource in the specified context.
  * 
  * @param modResource $resource
  * @param string $contextKey
  */
 public function duplicateResource(&$resource, $contextKey)
 {
     /* determine parent id of new resource */
     $newParentId = null;
     $parentId = $resource->get('parent');
     if ($parentId != null) {
         $linkedParentResources = $this->getLinkedResources($parentId);
         if (isset($linkedParentResources[$contextKey])) {
             $newParentId = $linkedParentResources[$contextKey];
         }
     }
     /* create new resource */
     $newResource = $this->modx->newObject($resource->get('class_key'));
     $newResource->fromArray($resource->toArray('', true), '', false, true);
     $newResource->set('id', 0);
     $newResource->set('pagetitle', $resource->get('pagetitle') . ' ' . $this->modx->lexicon('babel.translation_pending'));
     $newResource->set('parent', intval($newParentId));
     $newResource->set('createdby', $this->modx->user->get('id'));
     $newResource->set('createdon', time());
     $newResource->set('editedby', 0);
     $newResource->set('editedon', 0);
     $newResource->set('deleted', false);
     $newResource->set('deletedon', 0);
     $newResource->set('deletedby', 0);
     $newResource->set('published', false);
     $newResource->set('publishedon', 0);
     $newResource->set('publishedby', 0);
     $newResource->set('context_key', $contextKey);
     if ($newResource->save()) {
         /* copy all TV values */
         $templateVarResources = $resource->getMany('TemplateVarResources');
         foreach ($templateVarResources as $oldTemplateVarResource) {
             $newTemplateVarResource = $this->modx->newObject('modTemplateVarResource');
             $newTemplateVarResource->set('contentid', $newResource->get('id'));
             $newTemplateVarResource->set('tmplvarid', $oldTemplateVarResource->get('tmplvarid'));
             $newTemplateVarResource->set('value', $oldTemplateVarResource->get('value'));
             $newTemplateVarResource->save();
         }
         /* set parent of duplicate as a folder */
         if ($newParentId) {
             $newParent = $this->modx->getObject('modResource', $newParentId);
             if ($newParent) {
                 $newParent->set('is_folder', 1);
                 $newParent->save();
             }
         }
     } else {
         $this->modx->log(modX::LOG_LEVEL_ERROR, 'Could not duplicate resource: ' . $resource->get('id') . ' in context: ' . $contextKey);
         $newResource = null;
     }
     return $newResource;
 }
开发者ID:rtripault,项目名称:babel,代码行数:58,代码来源:babel.class.php


注:本文中的modResource::getMany方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。