Exemplo n.º 1
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $this->initJs();
     $noVideo = OW::getLanguage()->text('attachments', 'attacments_yt_no_video');
     $listHtml = '<div class="yt-empty-result ow_nocontent">' . $noVideo . '</div>';
     $itemsCount = 0;
     if (!empty($this->response)) {
         $response = json_decode($this->response, true);
         if (!empty($response['feed']['entry'])) {
             $list = new ATTACHMENTS_CMP_YoutubeList($response);
             $listHtml = $list->render();
             $itemsCount = $list->getItemsCount();
         }
     }
     $this->assign('window', array('height' => $this->window['height'] - 300));
     $this->assign('list', $listHtml);
     $this->assign('uniqId', $this->uniqId);
     $this->assign('query', $this->query);
     $this->assign('viewMore', $itemsCount == self::ITEMS_COUNT);
 }
Exemplo n.º 2
0
 public function ytMore($query)
 {
     if (empty($query['data']['query'])) {
         return array('viewMore' => false);
     }
     $query['data']['start'] = $query['data']['start'] + $query['data']['offset'];
     $queryUrl = OW::getRequest()->buildUrlQueryString("http://gdata.youtube.com/feeds/api/videos", array('q' => $query['data']['query'], 'alt' => 'json', 'format' => 5, 'v' => 2, 'start-index' => $query['data']['start'], 'max-results' => $query['data']['offset']));
     $response = file_get_contents($queryUrl);
     $response = json_decode($response, true);
     $cmp = new ATTACHMENTS_CMP_YoutubeList($response);
     $markup = array('html' => $cmp->render(), 'js' => '', 'css' => '');
     return array('more' => $markup, 'viewMore' => $cmp->getItemsCount() == $query['data']['offset'], 'data' => $query['data']);
 }