Ejemplo n.º 1
0
 /**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Ejemplo n.º 2
0
 /**
  * Handle group list tag parsing
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_GroupList($tag_params, $children)
 {
     $manager = YouTube_GroupManager::getInstance();
     $conditions = array();
     // gather all the parameters
     if (isset($tag_params['visible_only'])) {
         $conditions['text_id'] = fix_chars($tag_params['text_id']);
     }
     // get items from database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     // create template handler
     if (isset($tag_params['template'])) {
         if (isset($tag_params['local']) && $tag_params['local'] == 1) {
             $template = new TemplateHandler($tag_params['template'], $this->path . 'templates/');
         } else {
             $template = new TemplateHandler($tag_params['template']);
         }
     } else {
         $template = new TemplateHandler('group_item.xml', $this->path . 'templates/');
     }
     $template->setMappedModule($this);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'name' => $item->name, 'description' => $item->description, 'visible' => $item->visible, 'visible_char' => $item->visible == 1 ? CHAR_CHECKED : CHAR_UNCHECKED, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open($this->name . '_group_change', 400, $this->getLanguageConstant('title_group_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'group_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open($this->name . '_group_delete', 300, $this->getLanguageConstant('title_group_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'group_delete'), array('id', $item->id)))), 'item_videos' => url_MakeHyperlink($this->getLanguageConstant('videos'), window_Open($this->name . '_group_videos', 400, $this->getLanguageConstant('title_group_videos'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'group_videos'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }