示例#1
0
文件: Page.php 项目: piratevn/cms-gio
 public function deleteAction()
 {
     $this->disableLayout();
     $this->setNoRender();
     $request = $this->getRequest();
     if (!$request->isPost()) {
         $this->getResponse()->setBody('RESULT_NOT_OK');
     }
     $pageId = $request->getPost('page_id');
     Modules_Core_Services_Page::delete($pageId);
     $this->getResponse()->setBody('RESULT_OK');
 }
示例#2
0
 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;
 }