예제 #1
0
 public function afterIteration(array $list)
 {
     $list = parent::afterIteration($list);
     switch ($this->getProperty('image_url_schema')) {
         case 'base':
             $images_base_url = $this->getSourcePath(19);
             break;
         case 'full':
             $images_base_url = $this->modx->getOption('site_url');
             $images_base_url .= preg_replace("/^\\/*/", "", $this->getSourcePath());
             break;
         default:
             $images_base_url = '';
     }
     foreach ($list as &$l) {
         // Картинка
         #  = '';
         if (!empty($l['author_avatar'])) {
             $l['author_avatar'] = $images_base_url . $l['author_avatar'];
         } else {
             # $l['imageDefault'] = $images_base_url . 'public/images/No-Photo.jpg';
             $l['author_avatar_default'] = $images_base_url . 'avatarDefault.png';
         }
     }
     return $list;
 }
예제 #2
0
 protected function setSelection(xPDOQuery $c)
 {
     $c = parent::setSelection($c);
     $c->leftJoin('modResource', "Parent");
     $c->select(array("Product.id as `product_id`", "Parent.id as category_id", "Parent.uri as category_uri", "Parent.pagetitle as category_title"));
     return $c;
 }
예제 #3
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c = parent::prepareQueryBeforeCount($c);
     $categories = array();
     $where = array('id:in' => $this->getCategories((int) $this->getProperty('category_id'), $categories));
     $c->where($where);
     return $c;
 }
예제 #4
0
 public function outputArray(array $array, $count = false)
 {
     $result = parent::outputArray($array, $count);
     $objects = array(array("id" => 0, "pagetitle" => "Выберите из списка"));
     foreach ((array) $result['object'] as $object) {
         $objects[] = $object;
     }
     return json_encode(array("success" => $result['success'], "total" => count($objects), "results" => $objects));
 }
예제 #5
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c = parent::prepareQueryBeforeCount($c);
     $alias = $c->getAlias();
     $where = array("parent" => 80, "template" => 4);
     // Только для главной
     if ($this->getProperty('show_on_pain_page')) {
         $c->innerJoin('modTemplateVarResource', "tv_main_only", "tv_main_only.contentid = {$alias}.id AND tv_main_only.tmplvarid = 22 AND tv_main_only.value = '1'");
     }
     $c->where($where);
     return $c;
 }
예제 #6
0
 public function initialize()
 {
     $this->setDefaultProperties(array("sort" => "{$this->classKey}.publishedon", "dir" => "DESC", "parent" => 5, "getPage" => true, "limit" => 3, "cache_prefix" => "news/", "summary" => true, "truncLen" => 500));
     return parent::initialize();
 }
예제 #7
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c = parent::prepareQueryBeforeCount($c);
     $c->where(array('class_key' => 'ShopmodxResourceCurrency'));
     return $c;
 }