public function configAction() { $zones = Modules_Ad_Services_Zone::getAllZones(true); $this->view->zones = $zones; $this->view->zoneId = $this->getParam('zone_id'); $this->view->moduleName = Gio_Core_Widget::getIntance()->getModuleName(); $this->view->widgetName = Gio_Core_Widget::getIntance()->getWidgetName(); $this->view->widgetIndex = $this->getParam('widget_index'); }
public function listAction() { $request = $this->getRequest(); $lang = $request->getParam('lang'); $this->view->lang = $lang; $paramLang = $lang ? '/' . $lang : null; $perPage = 20; $pageIndex = (int) $request->getParam('page_index'); if (null == $pageIndex || '' == $pageIndex || $pageIndex < 0) { $pageIndex = 1; } $start = ($pageIndex - 1) * $perPage; $this->view->pageIndex = $pageIndex; $zones = Modules_Ad_Services_Zone::getAllZones(true); $this->view->zones = $zones; $pages = Modules_Core_Services_Page::dbPages(); $this->view->pages = $pages; $condition = array(); $json = new Services_JSON(); if ($request->isPost()) { $condition = $request->getPost('condition'); $params = rawurlencode(base64_encode($json->encodeUnsafe($condition))); } else { $params = $request->getParam('q'); $params != null ? $condition = (array) $json->decode(rawurldecode(base64_decode($params))) : ($params = rawurlencode(base64_encode($json->encodeUnsafe($condition)))); } $params = empty($condition) ? null : $params; $this->view->condition = $condition; $banners = Modules_Ad_Services_Banner::find($start, $perPage, $condition); $numBanners = Modules_Ad_Services_Banner::count($condition); $this->view->banners = $banners; // Pager require_once LIB_DIR . DS . 'PEAR' . DS . 'Pager' . DS . 'Sliding.php'; $pagerPath = $this->view->url('ad_banner_list'); $pagerOptions = array('mode' => 'Sliding', 'append' => false, 'perPage' => $perPage, 'delta' => 3, 'urlVar' => 'page', 'path' => $pagerPath, 'fileName' => null == $params ? 'page-%d' . $paramLang : '/page-%d' . $paramLang . '/?q=' . $params, 'separator' => '', 'nextImg' => '<small class="icon arrow_right"></small>', 'prevImg' => '<small class="icon arrow_left"></small>', 'altNext' => '', 'altPrev' => '', 'altPage' => '', 'totalItems' => $numBanners, 'currentPage' => $pageIndex, 'urlSeparator' => '/', 'spacesBeforeSeparator' => 0, 'spacesAfterSeparator' => 0, 'curPageSpanPre' => '<a href="javascript: void();" class="current">', 'curPageSpanPost' => '</a>'); $pager = new Pager_Sliding($pagerOptions); $this->view->pager = $pager; }