openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

PageAction.class.php (3066B)


      1 <?php
      2 
      3 namespace cms\action;
      4 
      5 use cms\base\Configuration;
      6 use cms\generator\PageContext;
      7 use cms\generator\PageGenerator;
      8 use cms\generator\Producer;
      9 use cms\generator\Publisher;
     10 use cms\generator\PublishOrder;
     11 use cms\model\Acl;
     12 use cms\model\BaseObject;
     13 use cms\model\Element;
     14 use cms\model\Folder;
     15 use cms\model\Language;
     16 use cms\model\Page;
     17 use cms\model\Project;
     18 use cms\model\Template;
     19 use cms\model\Value;
     20 use configuration\Config;
     21 use logger\Logger;
     22 use util\Html;
     23 use util\Session;
     24 
     25 
     26 /**
     27  * Action-Klasse zum Bearbeiten einer Seite
     28  * @author $Author$
     29  * @version $Revision$
     30  * @package openrat.actions
     31  */
     32 
     33 class PageAction extends ObjectAction
     34 {
     35 	public $security = Action::SECURITY_USER;
     36 
     37     /**
     38      * @var Page
     39      */
     40 	protected $page;
     41 
     42 
     43 	function __construct()
     44 	{
     45 	    parent::__construct();
     46 
     47     }
     48 
     49 
     50     public function init()
     51     {
     52         $page = new Page( $this->getRequestId() );
     53         //$context = new PageContext();
     54         //$context->sourceObjectId = $page->objectid;
     55 
     56 //		if  ( $this->request->hasLanguageId())
     57 //			$context->languageId = $this->request->getLanguageId();
     58 //
     59 //		if  ( $this->request->hasModelId())
     60 //			$context->modelId = $this->request->getModelId();
     61 
     62 		$page->load();
     63 //
     64 //        if  ( !$context->languageId )
     65 //			$context->languageId = $page->getProject()->getDefaultLanguageId();
     66 //
     67 //        if  ( !$context->modelId )
     68 //			$context->modelId = $page->getProject()->getDefaultModelId();
     69 
     70 //        $page->languageid = $context->languageId;
     71 //        $page->modelid    = $context->modelId
     72 //        $page->context = $context;
     73 
     74 		// Hier kann leider nicht das Datum der letzten Änderung verwendet werden,
     75 		// da sich die Seite auch danach ändern kann, z.B. durch Includes anderer
     76 		// Seiten oder Änderung einer Vorlage oder Änderung des Dateinamens einer
     77 		// verlinkten Datei.
     78 		$this->lastModified( time() );
     79 
     80 		$this->setBaseObject($page);
     81     }
     82 
     83 
     84 
     85 	protected function setBaseObject($folder ) {
     86 
     87 		$this->page = $folder;
     88 
     89 		parent::setBaseObject( $folder );
     90 	}
     91 
     92 
     93 
     94     protected function setModelAndLanguage()
     95     {
     96         $this->setTemplateVar('languages' ,$this->page->getProject()->getLanguages());
     97         $this->setTemplateVar('languageid',$this->page->getProject()->getDefaultLanguageId() );
     98 
     99         $this->setTemplateVar('models'    ,$this->page->getProject()->getModels()   );
    100         $this->setTemplateVar('modelid'   ,$this->page->getProject()->getDefaultModelId() );
    101     }
    102 
    103 
    104 
    105     protected function createPageContext( $scheme ) {
    106 
    107 		$context = new PageContext( $this->page->objectid,$scheme );
    108 		$context->sourceObjectId = $this->page->objectid;
    109 
    110 		if  ( $this->request->hasLanguageId())
    111 			$context->languageId = $this->request->getLanguageId();
    112 
    113 		if  ( $this->request->hasModelId())
    114 			$context->modelId = $this->request->getModelId();
    115 
    116         if  ( !$context->languageId )
    117 			$context->languageId = $this->page->getProject()->getDefaultLanguageId();
    118 
    119         if  ( !$context->modelId )
    120 			$context->modelId = $this->page->getProject()->getDefaultModelId();
    121 
    122         return $context;
    123 	}
    124 
    125 }