Example #1
0
 /**
  * ページリストを取得する
  * 
  * @param string $categoryId
  * @return mixed boolean / array
  * @access public
  */
 function getPageList($categoryId = null)
 {
     if ($this->Page) {
         $conditions = array('Page.status' => 1);
         if ($categoryId) {
             $conditions['Page.page_category_id'] = $categoryId;
         }
         $this->Page->unbindModel(array('belongsTo' => array('PageCategory')));
         $pages = $this->Page->find('all', array('conditions' => $conditions, 'fields' => array('title', 'url'), 'order' => 'Page.sort'));
         return Set::extract('/Page/.', $pages);
     } else {
         return false;
     }
 }
Example #2
0
 /**
  * 固定ページ機能で作成したページの一覧データを取得する
  *
  * @param string $categoryId 固定ページカテゴリID(初期値 : null)※ 指定しない場合は全ページを取得
  * @param array $options オプション(初期値 : array())
  *	- `conditions` : 検索条件(初期値 : array('Page.status' => 1))
  *	- `fields` : 取得フィールド(初期値 : array('title', 'url'))
  *	- `order` : 並び順(初期値 : array('Page.sort'))
  * @return mixed ページ一覧、または、false
  */
 public function getPageList($categoryId = null, $options = array())
 {
     if (empty($this->_Page)) {
         return false;
     }
     if (!is_array($options)) {
         $options = array();
     }
     $options = array_merge(array('conditions' => array('Page.status' => 1), 'fields' => array('title', 'url'), 'order' => 'Page.sort'), $options);
     if ($categoryId) {
         $options['conditions']['Page.page_category_id'] = $categoryId;
     }
     $this->_Page->unbindModel(array('belongsTo' => array('PageCategory')));
     $pages = $this->_Page->find('all', $options);
     if (empty($pages)) {
         return false;
     }
     foreach ($pages as $key => $page) {
         $pages[$key]['Page']['url'] = $this->_Page->convertViewUrl($page['Page']['url']);
     }
     return Hash::extract($pages, '{n}.Page');
 }