function indexAction() { if (X_VlcShares_Plugins::helpers()->devices()->isWiimc()) { // everything have to be in plx format $plx = new X_Plx(X_Env::_('p_auth_loginindex_plxtitle'), X_Env::_('p_auth_loginindex_plxdesc')); $plx->addItem(new X_Plx_Item(X_Env::_('p_auth_login_advice'), X_Env::completeUrl($this->_helper->url('index', 'auth')))); $plx->addItem(new X_Plx_Item(X_Env::_('p_auth_login_pressbbutton'), X_Env::completeUrl($this->_helper->url('index', 'auth')))); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $this->getResponse()->setHeader('Content-Type', 'text/plain'); $this->getResponse()->setBody((string) $plx); //echo $plx; return; } //if ( $this->ns->enabled && isset($this->ns->username) ) { //throw new Exception(X_Env::_('p_auth_already_loggedin')); //} if ($this->plugin->isLoggedIn()) { throw new Exception(X_Env::_('p_auth_already_loggedin')); } $form = new Application_Form_AuthLogin(); $form->setAction($this->_helper->url('login', 'auth')); $this->view->form = $form; $this->view->messages = $this->_helper->flashMessenger->getMessages(); }
public function gen_afterPageBuild(X_Page_ItemList_PItem $list, Zend_Controller_Action $controller) { // force Rendering win over everythings /*if ( !$this->_forceRendering ) { if ( !((bool) $this->config('forced.enabled', false)) && !$this->helpers()->devices()->isWiimc() ) return; } */ // new renderer interface if (!$this->isDefaultRenderer()) { return; } X_Debug::i("Plugin triggered"); $request = $controller->getRequest(); $enhanced = $this->helpers()->devices()->isWiimcEnhanced() && $this->config('support.enhanced', true); $plx = new X_Plx(X_Env::_('p_wiimcplxrenderer_plxtitle_' . $request->getControllerName() . '_' . $request->getActionName()), X_Env::_('p_wiimcplxrenderer_plxdescription_' . $request->getControllerName() . '_' . $request->getActionName())); // wiimc plus custom tags if ($enhanced) { $plx->setWiimcplus_generator_name('vlc-shares'); // uses the __call api $plx->setWiimcplus_generator_version(X_VlcShares::VERSION_CLEAN); // uses the __call api if ($request->getControllerName() == 'index' && $request->getActionName() == 'collections') { $plx->setWiimcplus_assert_mainmenu('true'); // uses the __call api } // show the current time as custom playlist header tag if the page is controls/control or browse/stream if ($request->getControllerName() == 'controls' && $request->getActionName() == 'control' || $request->getControllerName() == 'browse' && $request->getActionName() == 'stream') { $vlc = X_Vlc::getLastInstance(); if ($vlc) { // check to be sure that vlc is running right now $currentTime = X_Env::formatTime($vlc->getCurrentTime()); $totalTime = X_Env::formatTime($vlc->getTotalTime()); $plx->setWiimcplus_current_time("{$currentTime}/{$totalTime}"); // uses the __call api } } elseif ($request->getControllerName() == 'browse' && $request->getActionName() == 'selection') { $plx->setWiimcplus_assert_nohistory('true'); // uses the __call api } } foreach ($list->getItems() as $i => $item) { /* @var $item X_Page_Item_PItem */ $plxItemName = ($item->isHighlight() ? '-) ' : '') . $item->getLabel(); $plxItemWiimcplusIcon = null; switch ($item->getType()) { case X_Page_Item_PItem::TYPE_CONTAINER: $plxItemType = X_Plx_Item::TYPE_PLAYLIST; $plxItemWiimcplusIcon = 'folder'; break; case X_Page_Item_PItem::TYPE_ELEMENT: $plxItemType = X_Plx_Item::TYPE_PLAYLIST; if ($request->getControllerName() == 'browse' && $request->getActionName() == 'share') { $plxItemWiimcplusIcon = 'file'; } break; case X_Page_Item_PItem::TYPE_REQUEST: $plxItemType = X_Plx_Item::TYPE_SEARCH; break; case X_Page_Item_PItem::TYPE_PLAYABLE: $plxItemType = X_Plx_Item::TYPE_VIDEO; break; default: $plxItemType = $item->getType(); } /* @var $urlHelper Zend_Controller_Action_Helper_Url */ $urlHelper = $controller->getHelper('url'); $plxItemUrl = $item->isUrl() ? $item->getLink() : X_Env::completeUrl($urlHelper->url($item->getLink(), $item->getRoute(), $item->isReset())); $plxItem = new X_Plx_Item($plxItemName, $plxItemUrl, $plxItemType); if ($item->getThumbnail() != null) { if (X_Env::startWith($item->getThumbnail(), 'http') || X_Env::startWith($item->getThumbnail(), 'https')) { $plxItem->setThumb($item->getThumbnail()); } else { $plxItem->setThumb(X_Env::completeUrl($item->getThumbnail())); } } if ($enhanced) { if ($plxItemWiimcplusIcon !== null) { $plxItem->setWiimcplus_icon($plxItemWiimcplusIcon); } if ($item->getKey() == 'core-separator') { $plxItem->setWiimcplus_assert_separator('true'); } if ($item->getKey() == 'core-directwatch') { $plxItem->setWiimcplus_assert_directwatch('true'); if ($item->getCustom('subtitle') != null) { $plxItem->setWiimcplus_subtitle($item->getCustom('subtitle')); } } if ($item->getKey() == 'core-play') { $plxItem->setWiimcplus_assert_startvlc('true'); } } $plx->addItem($plxItem); } $this->_render($plx, $controller); }