Beispiel #1
0
 /**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Beispiel #2
0
 /**
  * Handle tag for displaying user page list
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_PageList($tag_params, $children)
 {
     global $language;
     $manager = UserPageManager::getInstance();
     $admin_manager = UserManager::getInstance();
     $conditions = array();
     // get items from database
     $pages = $manager->getItems($manager->getFieldNames(), $conditions);
     // create template
     $template = $this->loadTemplate($tag_params, 'page_list_item.xml');
     // parse object
     if (count($pages) > 0) {
         foreach ($pages as $page) {
             $timestamp = strtotime($page->timestamp);
             $date = date($this->getLanguageConstant('format_date_short'), $timestamp);
             $time = date($this->getLanguageConstant('format_time_short'), $timestamp);
             $params = array('id' => $page->id, 'timestamp' => $page->timestamp, 'date' => $date, 'time' => $time, 'title' => $page->title, 'content' => $page->content, 'author' => $admin_manager->getItemValue('fullname', array('id' => $page->author)), 'owner' => $admin_manager->getItemValue('fullname', array('id' => $page->owner)), 'visible' => $page->visible, 'editable' => $page->editable, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('user_pages_edit', 730, $this->getLanguageConstant('title_edit_page'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'edit_page'), array('id', $page->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('user_pages_delete', 400, $this->getLanguageConstant('title_delete_page'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'delete_page'), array('id', $page->id)))), 'item_items' => url_MakeHyperlink($this->getLanguageConstant('items'), window_Open('user_pages_items', 400, $page->title[$language] . ': ' . $this->getLanguageConstant('title_page_items'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'page_items'), array('id', $page->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }