/**
  * Return singleton
  * @return Application_Model_YoutubeAccountsMapper
  */
 public static function i()
 {
     if (self::$instance === null) {
         self::$instance = new Application_Model_YoutubeAccountsMapper();
     }
     return self::$instance;
 }
 function daccountAction()
 {
     $accountId = $this->getRequest()->getParam('idAccount', false);
     if ($accountId != false && $accountId != null && $accountId != '') {
         $account = new Application_Model_YoutubeAccount();
         Application_Model_YoutubeAccountsMapper::i()->find($accountId, $account);
         if ($accountId == $account->getId()) {
             try {
                 Application_Model_YoutubeAccountsMapper::i()->delete($account);
                 $this->_helper->flashMessenger(array('text' => X_Env::_('p_youtube_delete_completed_account'), 'type' => 'info'));
             } catch (Exception $e) {
                 $this->_helper->flashMessenger(array('text' => X_Env::_('p_youtube_delete_err_dberror') . ": {$e->getMessage()}", 'type' => 'error'));
             }
         } else {
             $this->_helper->flashMessenger(array('text' => X_Env::_('p_youtube_delete_invaliddata'), 'type' => 'error'));
         }
     }
     $this->_helper->redirector('index', 'youtube');
 }
Exemplo n.º 3
0
 protected function activitiesMenu(X_Page_ItemList_PItem $items, $accountId = null, $page = 0)
 {
     if ($accountId != null) {
         $account = new Application_Model_YoutubeAccount();
         Application_Model_YoutubeAccountsMapper::i()->find($accountId, $account);
         /* @var $helper X_VlcShares_Plugins_Helper_Youtube */
         $helper = $this->helpers('youtube');
         $feed = $helper->getActivitiesByUser($account->getLabel(), $page);
         foreach ($feed as $activity) {
             /* @var $activity Zend_Gdata_YouTube_ActivityEntry */
             $vid = $activity->getVideoId();
             if ($vid == null) {
                 continue;
             }
             /* @var $video Zend_Gdata_YouTube_VideoEntry */
             $video = $helper->getVideo($vid);
             $thumb = $video->getVideoThumbnails();
             $thumb = $thumb[0]['url'];
             $item = new X_Page_Item_PItem('youtube-acc-activity-' . $vid, $activity->getTitle() . ": " . $video->getTitle());
             $item->setDescription($video->getVideoDescription())->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setThumbnail($thumb)->setIcon('/images/youtube/icons/activity.png')->setCustom(__CLASS__ . ':location', self::A_ACTIVITIES . "/{$accountId}/0/{$vid}")->setLink(array('action' => 'mode', 'l' => X_Env::encode(self::A_ACTIVITIES . "/{$accountId}/0/{$vid}")), 'default', false)->setGenerator(__CLASS__);
             $items->append($item);
         }
         /*
         if ( $feed->getNextLink() != null ) {
         	$items->append($this->next(self::A_FAVORITES."/$accountId", $page + 1));
         }
         */
     } else {
         $this->accountsMenu($items);
     }
 }