Ejemplo n.º 1
0
 public function beforeroute()
 {
     parent::beforeroute();
     $this->setAJAXLayout();
     $tableMetaObj = \models\meta\Meta::getInstance()->getTableMeta($this->table);
     $this->has_items = $tableMetaObj->hasItems();
     if ($this->has_items) {
         $this->item_model = \models\ContentItem::getInstance($this->table);
     }
     $this->is_moderated = $tableMetaObj->isModerated();
 }
Ejemplo n.º 2
0
 /**
  * Получаем мета-данные связанной таблицы с нодами
  * @param type $rel
  */
 private function setRalatedMeta($rel)
 {
     if (is_string($rel)) {
         // Определяем тип связи
         $rel_table = $rel;
         $this->rel = 'fko_' . $this->table;
         $this->is_fko = true;
     } else {
         $this->rel = $rel;
         $rel_table = $rel['table'];
         $this->is_fko = false;
     }
     $this->relatedMeta = \models\meta\Meta::getInstance()->getTableMeta($rel_table);
     $this->relatedHasItems = $this->relatedMeta->hasItems();
     if ($this->relatedHasItems) {
         $this->relatedItemModel = \models\ContentItem::getInstance($rel_table);
     }
 }
Ejemplo n.º 3
0
 protected function make($crop, $enlarge)
 {
     $model = \models\ContentItem::getInstance($this->table);
     return $model->makeThumbnail($model->getPid($this->id), $this->id, $this->w, $this->h, $crop, $enlarge);
 }
Ejemplo n.º 4
0
 /**
  * Возвращает заданное количество опубликованных нодов,
  * отсортированных в нужном порядке, кроме нода с указанным id
  * @param type $id Какой нод исключить
  * @param type $limit Сколько максимум найти
  * @param type $order Как отсортировать
  * @return array Массив с найденными нодами
  */
 public function getListOther($id, $limit, $order = 'priority DESC')
 {
     $list = $this->mapper->find(array('id!=? AND published=1', $id), array('limit' => $limit, 'order' => $order));
     //		\helpers\Debug::prePrintR($list);
     $nodeitem = \models\ContentItem::getInstance($this->table);
     $nodes = array();
     foreach ($list as $k => $item) {
         //$item->intro = $nodeitem->getIntro($item->id);
         $nodes[$k] = $item->cast();
         $nodes[$k] = array_map('stripslashes', $nodes[$k]);
         //			$nodes[$k]['intro'] = $nodeitem->getIntro($item->id);
         $nodes[$k]['tn'] = $nodeitem->getThumbnailId($item->id);
     }
     //		\helpers\Debug::prePrintR($nodes);
     //		return;
     return $nodes;
 }
Ejemplo n.º 5
0
 /**
  * @todo Выяснить где используется
  */
 public function hasItemsLike($id, $search)
 {
     $items_model = \models\ContentItem::getInstance($this->table);
     $list = $items_model->findLike($id, $search);
     return count($list);
 }