Пример #1
0
 function lister()
 {
     $categories =& mosContact::getCategories($this->user);
     $count = count($categories);
     if ($count == 0 or $count == 1 and $categories[0]->numlinks == 1) {
         // No or one category that qualifies
         $this->contact_id = $count == 1 ? $categories[0]->minimum : 0;
         $controller = new contact_view_Controller($this->manager);
         $controller->view();
         if ($this->op == 'sendmail') {
             $this->sendmail();
         }
         return;
     }
     $rows = array();
     $currentcat =& new stdClass();
     // Parameters
     $menuhandler = mosMenuHandler::getInstance();
     $menu =& $menuhandler->getMenuByID($this->Itemid);
     $params =& $this->makeParams($menu->params, $menu->name);
     // page header
     $currentcat->header = $params->get('header');
     // Path to images
     $path = mamboCore::get('mosConfig_live_site') . '/images/stories/';
     $currentcat->descrip = '';
     $currentcat->img = '';
     if ($this->catid) {
         $params->set('type', 'category');
         // url links info for category
         $rows = mosContact::getContacts($this->catid, $this->user);
         // current category info
         foreach ($categories as $category) {
             if ($category->id == $this->catid) {
                 $currentcat =& $category;
                 // show description
                 $currentcat->descrip = $currentcat->description;
                 // page image
                 $currentcat->img = $path . $currentcat->image;
                 $currentcat->align = $currentcat->image_position;
                 // page header
                 if (@$currentcat->name != '') {
                     $currentcat->header .= ' - ' . $currentcat->name;
                 }
                 break;
             }
         }
     } else {
         $params->set('type', 'section');
         // show description
         if ($params->get('description')) {
             $currentcat->descrip = $params->get('description_text');
         }
         // page image
         if ($params->get('image') != -1) {
             $currentcat->img = $path . $params->get('image');
             $currentcat->align = $params->get('image_align');
         }
     }
     // used to show table rows in alternating colours
     $tabclass = array('sectiontableentry1', 'sectiontableentry2');
     HTML_contact::displaylist($categories, $rows, $this->catid, $currentcat, $params, $tabclass);
     if ($this->op == 'sendmail') {
         $this->sendmail();
     }
 }