예제 #1
0
 public function getAddress($include_http = TRUE)
 {
     PHPWS_Core::initCoreClass('Link.php');
     $link = new PHPWS_Link();
     $link->full_url = $include_http;
     $link->setRewrite();
     $link->setModule('rss');
     $link->addValues(array('mod_title' => $this->module));
     return $link->getAddress();
 }
예제 #2
0
 private function pageLinks(&$tpl)
 {
     $db = new PHPWS_DB('ps_page');
     $db->addWhere('deleted', 0);
     $db->addColumn('id');
     $db->addColumn('page_order');
     $db->setIndexBy('page_order');
     $db->addOrder('page_order asc');
     if ($this->parent_page) {
         $db->addWhere('id', $this->parent_page);
         $db->addWhere('parent_page', $this->parent_page, null, 'or');
     } else {
         $db->addWhere('parent_page', $this->id);
     }
     $pages = $db->select('col');
     if (PHPWS_Error::logIfError($pages) || empty($pages)) {
         return;
     }
     if (!$this->parent_page) {
         array_unshift($pages, $this->id);
     }
     if ($this->page_order) {
         $prev_page = $pages[$this->page_order - 1];
     } else {
         $prev_page = 0;
     }
     foreach ($pages as $page_no => $id) {
         if ($page_no == 0 && $prev_page) {
             $link = new PHPWS_Link('<span>&lt;&lt;</span>&#160;' . dgettext('pagesmith', 'Previous'), 'pagesmith', array('id' => $prev_page));
             $links[] = $link->get();
         }
         if ($id == $this->id) {
             $links[] = $page_no + 1;
             if (isset($pages[$page_no + 1])) {
                 $next_page = $pages[$page_no + 1];
             } else {
                 $next_page = null;
             }
         } else {
             $link = new PHPWS_Link($page_no + 1, 'pagesmith', array('id' => $id));
             $link->setRewrite();
             $links[] = $link->get();
         }
     }
     if ($next_page) {
         $link->setLabel(dgettext('pagesmith', 'Next') . '&#160;<span>&gt;&gt;</span>');
         $link->setValue('id', $next_page);
         $links[] = $link->get();
     }
     $tpl['PAGE_LINKS'] = implode('&#160;|&#160;', $links);
 }