Example #1
0
 /**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #2
0
 /**
  * Handle displaying group memberships
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_GroupVideos($tag_params, $children)
 {
     global $language;
     if (!isset($tag_params['group'])) {
         return;
     }
     $group = fix_id($tag_params['group']);
     $manager = YouTube_VideoManager::getInstance();
     $membership_manager = YouTube_MembershipManager::getInstance();
     $memberships = $membership_manager->getItems(array('video'), array('group' => $group));
     $video_ids = array();
     if (count($memberships) > 0) {
         foreach ($memberships as $membership) {
             $video_ids[] = $membership->video;
         }
     }
     $items = $manager->getItems($manager->getFieldNames(), array(), array('title_' . $language));
     $template = new TemplateHandler('group_videos_item.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'in_group' => in_array($item->id, $video_ids) ? 1 : 0, 'title' => $item->title, 'video_id' => $item->video_id, 'text_id' => $item->text_id);
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }