Esempio n. 1
0
 public function getRelated($start = 0, $limit = 0, $sort = 'related_name', $order = 'ASC')
 {
     $criteria = new CriteriaCompo();
     $criteria->setSort($sort);
     $criteria->setOrder($order);
     $criteria->setStart($start);
     $criteria->setLimit($limit);
     return parent::getAll($criteria, null, false);
 }
Esempio n. 2
0
 function getCatIds($uids = null)
 {
     if ($uids == null) {
         return false;
     }
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria("uid", "(" . implode(", ", $uids) . ")", "in"), 'AND');
     $cats = parent::getAll($criteria, null, false);
     return $cats;
 }
Esempio n. 3
0
 /**
  * get all rows matching a condition
  *
  * @param  CriteriaElement $criteria  {@link CriteriaElement} to match
  *
  * @return array of row arrays, indexed by field_id
  */
 public function getAllByFieldId(CriteriaElement $criteria = null)
 {
     $rawRows = parent::getAll($criteria, null, false, false);
     usort($rawRows, array($this, 'visibilitySort'));
     $rows = array();
     foreach ($rawRows as $rawRow) {
         $rows[$rawRow['field_id']][] = $rawRow;
     }
     return $rows;
 }
Esempio n. 4
0
 public function getStats($content_id)
 {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('rating_content_id', $content_id));
     $i = 0;
     $total = 0;
     $obj = parent::getAll($criteria);
     foreach ($obj as $k => $v) {
         ++$i;
         $total += $v->getVar('rating_rating');
     }
     return array('voters' => $i, 'average' => $total / $i);
 }
Esempio n. 5
0
 public function getPageTitle($status = null, $sort = 'content_weight ASC, content_title', $order = 'ASC')
 {
     $criteria = new CriteriaCompo();
     if (isset($status)) {
         $criteria->add(new Criteria('content_status', $status));
     }
     $criteria->setSort($sort);
     $criteria->setOrder($order);
     return parent::getAll($criteria, array('content_id', 'content_title'), false);
 }
Esempio n. 6
0
 public function menu_related($content_id)
 {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('link_content_id', $content_id));
     $related = parent::getAll($criteria, null, true, false);
     if (count($related) > 0) {
         $related_Handler = Page::getInstance()->getRelatedHandler();
         $related_arr = $related_Handler->get($related[0]->getVar('link_related_id'));
         $ret = $related_arr->getValues();
         // create button prev / next
         $keys = array_keys($ret['related_links']);
         foreach ($keys as $k => $i) {
             if ($content_id == $ret['related_links'][$i]['content_id']) {
                 if ($k - 1 >= 0) {
                     $ret['prev_id'] = $ret['related_links'][$keys[$k - 1]]['content_id'];
                     $ret['prev_title'] = $ret['related_links'][$keys[$k - 1]]['content_title'];
                 }
                 if ($k + 1 < count($keys)) {
                     $ret['next_id'] = $ret['related_links'][$keys[$k + 1]]['content_id'];
                     $ret['next_title'] = $ret['related_links'][$keys[$k + 1]]['content_title'];
                 }
                 break;
             }
         }
         return $ret;
     }
     return array();
 }
Esempio n. 7
0
 function getBySpotlight($spotlight_id, $limit = 5, $sort = 'page_order', $order = 'ASC')
 {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('sp_id', $spotlight_id));
     $criteria->setLimit($limit);
     $criteria->setSort($sort);
     $criteria->setOrder($order);
     $pages = parent::getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc'), false);
     return $pages;
 }