Esempio n. 1
0
 function showIndex()
 {
     $pager = new fvPager(PageManager::getInstance());
     $this->__assign('Pages', $pager->paginate(null, "IF (page_parent_id = 0, id*100000, page_parent_id*100000 + id)"));
     $request = fvRequest::getInstance();
     if (!($Page = PageManager::getInstance()->getByPk($request->getRequestParameter('id')))) {
         $Page = new Page();
     }
     $this->__assign(array('Page' => $Page, 'PageManager' => PageManager::getInstance(), 'metaManager' => MetaManager::getInstance()));
     return $this->__display('page_list.tpl');
 }
Esempio n. 2
0
 public function delete()
 {
     if ($this->image) {
         @unlink($this->getImageRealPath());
     }
     $childPages = PageManager::getInstance()->getByPageParentId($this->getPk());
     foreach ($childPages as $childPage) {
         $childPage->page_parent_id = 0;
         $childPage->save();
     }
     return parent::delete();
 }
 function __construct()
 {
     $currentUrl = fvRoute::getInstance()->getModuleName();
     list($p) = (array) PageManager::getInstance()->getByPageUrl($currentUrl);
     if (is_object($p)) {
         $this->_pageInstance = $p;
     } else {
         fvDispatcher::redirect(fvSite::$fvConfig->get('page_404', 0, 404));
     }
     $this->_domInstance = new DOMDocument();
     if (!$this->_domInstance->loadXML($this->_pageInstance->getPageContent())) {
         fvDispatcher::redirect(fvSite::$fvConfig->get('page_error', 0, 302));
     }
     $this->setMeta($this->_pageInstance->getMeta());
     fvSite::$Template->assign("Lang", fvLang::getInstance());
     parent::__construct("main.tpl");
 }
Esempio n. 4
0
 function executeDelete()
 {
     $request = fvRequest::getInstance();
     if (!($Page = PageManager::getInstance()->getByPk($request->getRequestParameter('id')))) {
         $this->setFlash("Ошибка при удалении.", self::$FLASH_ERROR);
     } else {
         $Page->getMeta()->delete();
         $Page->delete();
         $this->setFlash("Данные успешно удалены", self::$FLASH_SUCCESS);
     }
     fvResponce::getInstance()->setHeader('redirect', fvSite::$fvConfig->get('dir_web_root') . $request->getRequestParameter('module') . "/");
     if (fvRequest::getInstance()->isXmlHttpRequest()) {
         return self::$FV_NO_LAYOULT;
     } else {
         return self::$FV_OK;
     }
 }
Esempio n. 5
0
 public function route(Zend_Controller_Request_Abstract $request)
 {
     // Let the Rewrite router route the request first
     $request = parent::route($request);
     logFire("ROUTE", $request->getParam('controller'));
     if ($request->getParam('controller') == '') {
         // If the page param isn't set, route to default page and controller
         $defaultPage = PageManager::getInstance()->getDefaultPage();
         $request->setControllerName($defaultPage->pageType->controller);
         $request->setParam('controller', $defaultPage->page);
         $request->setParam('action', 'index');
     } else {
         // Route to current page's controller
         $controller = PageManager::getInstance()->getPage($request->getParam('controller'));
         $request->setControllerName($controller->pageType->controller);
         $request->setActionName('index');
     }
     $request->setParam('controller', 'search');
     $request->setParam('action', 'search');
     return $request;
 }
Esempio n. 6
0
 /**
  * 
  * @param string $pageHTML
  * @param int $pageNumber
  * @param string $title
  * @param string $backgroundImageUrl
  * @param int $spreadNumber
  * @param array $properties
  * @return Page Page Object
  */
 public function savePageHTML($pageHTML, $pageNumber, $title = null, $backgroundImageUrl = '', $spreadNumber = null, $properties = array())
 {
     // Create page for the book.
     $page = PageManager::getInstance()->createPage($this->bookId, $pageNumber, $backgroundImageUrl);
     if (!is_null($spreadNumber)) {
         $page->setSpreadPageNumber($spreadNumber);
     }
     if (is_null($title)) {
         $page->setTitle("Untitled");
     } else {
         $page->setTitle($title);
         //$page->setTitle($this->book_pub->publication_name);
     }
     if (strpos($pageHTML, "<body") === false) {
         $page->setTextContent($pageHTML, false);
         $pageHTML = $this->applyElementUuids($page->getPageContent());
         $page->setTextContent($pageHTML, true);
     } else {
         $pageHTML = $this->applyElementUuids(trim($pageHTML));
         $page->setTextContent($pageHTML, true);
     }
     $this->epub->importPage($page, $properties);
     return $page;
 }