示例#1
0
 /**
  * Gets a collection of objects related by aggregate or composite relations.
  *
  * {@inheritdoc}
  *
  * Includes special handling for related objects with alias {@link
  * modTemplateVar}, respecting framework security unless specific criteria
  * are provided.
  *
  * @todo Refactor to use the new ABAC security model.
  */
 public function & getMany($alias, $criteria= null, $cacheFlag= false) {
     $collection= array ();
     if ($alias === 'TemplateVars' || $alias === 'modTemplateVar' && ($criteria === null || strtolower($criteria) === 'all')) {
         $collection= $this->getTemplateVars();
     } else {
         $collection= parent :: getMany($alias, $criteria, $cacheFlag);
     }
     return $collection;
 }
示例#2
0
 /**
  * Gets a collection of objects related by aggregate or composite relations.
  *
  * {@inheritdoc}
  *
  * Includes special handling for related objects with alias {@link
  * modTemplateVar}, respecting framework security unless specific criteria
  * are provided.
  *
  * @todo Refactor to use the new ABAC security model.
  */
 public function &getMany($alias, $criteria = null, $cacheFlag = false)
 {
     $collection = array();
     if ($alias === 'TemplateVars' || $alias === 'modTemplateVar' && ($criteria === null || strtolower($criteria) === 'all')) {
         $c = $this->xpdo->newQuery('modTemplateVar');
         $c->select('
             DISTINCT modTemplateVar.*,
             IF(ISNULL(tvc.value),modTemplateVar.default_text,tvc.value) AS value,
             IF(ISNULL(tvc.value),0,' . $this->id . ') AS resourceId
         ');
         $c->innerJoin('modTemplateVarTemplate', 'tvtpl', array('`tvtpl`.`tmplvarid` = `modTemplateVar`.`id`', '`tvtpl`.templateid' => $this->template));
         $c->leftJoin('modTemplateVarResource', 'tvc', array('`tvc`.`tmplvarid` = `modTemplateVar`.`id`', '`tvc`.contentid' => $this->id));
         $c->sortby('`tvtpl`.`rank`,`modTemplateVar`.`rank`');
         $collection = $this->xpdo->getCollection('modTemplateVar', $c);
     } else {
         $collection = parent::getMany($alias, $criteria, $cacheFlag);
     }
     return $collection;
 }