Ejemplo n.º 1
0
 /**
  * Get page title
  * 
  * @return  string
  */
 public function getPageTitle()
 {
     if ($this->get('pageid') == 0) {
         return Lang::txt('COM_GROUPS_PAGES_MODULE_INCLUDED_ON_ALL_PAGES');
     }
     if ($this->get('pageid') == -1) {
         return Lang::txt('COM_GROUPS_PAGES_MODULE_INCLUDED_ON_NO_PAGES');
     }
     // new group page
     $tbl = new Tables\Page($this->_db);
     // load page
     $tbl->load($this->get('pageid'));
     // return page title
     return $tbl->get('title');
 }
Ejemplo n.º 2
0
 /**
  * Get pages in this category
  *
  * @param     string  $rtrn    What do we want back
  * @param     boolean $clear   Fetch an updated list
  * @return    object  \Hubzero\Base\ItemList
  */
 public function getPages($rtrn = 'list', $clear = false)
 {
     // create page jtable
     $tbl = new Tables\Page($this->_db);
     // build array of filters
     $filters = array('gidNumber' => $this->get('gidNumber'), 'category' => $this->get('id'), 'state' => array(0, 1));
     switch (strtolower($rtrn)) {
         case 'count':
             if (!isset($this->_pages_count)) {
                 $this->_pages_count = $tbl->count($filters);
             }
             return (int) $this->_pages_count;
             break;
         case 'list':
         default:
             if (!$this->_pages instanceof ItemList || $clear) {
                 if ($results = $tbl->find($filters)) {
                     foreach ($results as $key => $result) {
                         $results[$key] = new Page($result);
                     }
                 }
                 $this->_pages = new ItemList($results);
             }
             return $this->_pages;
             break;
     }
 }
Ejemplo n.º 3
0
 /**
  * Get a list of group pages
  *
  * @param      string  $rtrn    What data to return
  * @param      array   $filters Filters to apply to data retrieval
  * @param      boolean $boolean Clear cached data?
  * @return     mixed
  */
 public function pages($rtrn = 'list', $filters = array(), $clear = false)
 {
     switch (strtolower($rtrn)) {
         case 'alias':
             $aliases = array();
             if ($results = $this->pages('list', $filters, true)) {
                 foreach ($results as $result) {
                     $aliases[] = $result->get('alias');
                 }
             }
             return $aliases;
             break;
         case 'unapproved':
             $unapproved = array();
             if ($results = $this->pages('list', $filters, true)) {
                 foreach ($results as $k => $result) {
                     // get current version
                     $version = $result->versions()->first();
                     if (!$version) {
                         continue;
                     }
                     // if current version is unapproved return it
                     if ($version->get('approved') == 0) {
                         $unapproved[] = $result;
                     }
                 }
             }
             return new ItemList($unapproved);
             break;
         case 'tree':
             $tree = array();
             if ($results = $this->pages('list', $filters, $clear)) {
                 $tree = $this->_buildTree($results);
             }
             return $tree;
         case 'list':
         default:
             if (!$this->_pages instanceof ItemList || $clear) {
                 $tbl = new Tables\Page($this->_db);
                 if ($results = $tbl->find($filters)) {
                     foreach ($results as $key => $result) {
                         $results[$key] = new Page($result);
                     }
                 }
                 $this->_pages = new ItemList($results);
             }
             return $this->_pages;
             break;
     }
 }