public function setView(Zend_View_Interface $view) { parent::setView($view); $oid = spl_object_hash($view); if (!isset(self::$_enabledView[$oid])) { $view->addBasePath(dirname(__FILE__) . '/files'); self::$_enabledView[$oid] = true; } }
public function newsWidget($news_limit, $show_thumbnails = false, $side_space = true) { $language_id = Zend_Registry::get('languageId'); $cache = Zend_Registry::get('cache'); if (($widget = $cache->load('widget_news')) === false) { $title = $this->view->translate('recent_news'); $tbl_news = new Model_DbTable_News(); $arr_news = $tbl_news->getLastNews($language_id, $news_limit)->toArray(); $list = "<ul>"; $thumbnails = ''; foreach ($arr_news as $news) { $link = $this->view->baseUrl('news/detail/' . $news['id'] . '/' . $this->view->makeUrlFormat($news['title'])); if ($show_thumbnails) { $source = 'default.jpg'; if (file_exists(UPLOAD_FOLDER . "news/{$news['image']}") && !empty($news['image'])) { $source = "upload/news/{$news['image']}"; } $thumbs = $this->view->imageUrl("timthumb.php?src={$source}&w=50&h=50&q=100"); $thumbnails = "<img src='{$thumbs}' class='thumbnail' alt='{$news['title']}' />"; } $list .= "<li>{$thumbnails}<a href='{$link}'><span class='desc'>{$news['title']}</span></a></li>"; } $list .= "</ul>"; $list .= "<div class='clear'></div>"; if ($side_space) { $side_space_class = 'side-space'; } $widget = <<<HTML <div class="widget-half-list {$side_space_class}"> <h2>{$title}</h2> {$list} </div> HTML; $cache->save($widget); } return $widget; }
public function setView(Zend_View_Interface $view) { parent::setView($view); $this->view->addBasePath(HEAP_PATH . DS . 'Blocks/App/views')->addBasePath(MODULES_PATH . DS . 'Blocks/App/views'); $this->_blockModel = new Modules_Blocks_Model_Blocks(); if ($this->isAdmin()) { $this->view->current_route_id = Zend_Registry::get('RouteCurrentId'); $this->view->headScript()->appendFile($this->view->libUrl('/Blocks/public/js/admin.js'))->prependScript(' var _urlBlockSave = "' . $this->view->url(array('module' => 'blocks', 'controller' => 'admin', 'action' => 'save'), 'mvc', true) . '", _urlBlockInfo = "' . $this->view->url(array('module' => 'blocks', 'controller' => 'admin', 'action' => 'blockinfo'), 'mvc', true) . '", _urlBlockDelete = "' . $this->view->url(array('module' => 'blocks', 'controller' => 'admin', 'action' => 'blockdelete'), 'mvc', true) . '", _currentRouteId = ' . $this->view->current_route_id . '; '); } }
/** * * @return void */ public function save() { return parent::save(); }