openrat-cms

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

PageAction.class.php (2979B)


      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\Permission;
     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     /**
     36      * @var Page
     37      */
     38 	protected $page;
     39 
     40 
     41 	function __construct()
     42 	{
     43 	    parent::__construct();
     44 
     45     }
     46 
     47 
     48     public function init()
     49     {
     50         $page = new Page( $this->request->getId() );
     51         //$context = new PageContext();
     52         //$context->sourceObjectId = $page->objectid;
     53 
     54 //		if  ( $this->request->hasLanguageId())
     55 //			$context->languageId = $this->request->getLanguageId();
     56 //
     57 //		if  ( $this->request->hasModelId())
     58 //			$context->modelId = $this->request->getModelId();
     59 
     60 		$page->load();
     61 //
     62 //        if  ( !$context->languageId )
     63 //			$context->languageId = $page->getProject()->getDefaultLanguageId();
     64 //
     65 //        if  ( !$context->modelId )
     66 //			$context->modelId = $page->getProject()->getDefaultModelId();
     67 
     68 //        $page->languageid = $context->languageId;
     69 //        $page->modelid    = $context->modelId
     70 //        $page->context = $context;
     71 
     72 		// Hier kann leider nicht das Datum der letzten Änderung verwendet werden,
     73 		// da sich die Seite auch danach ändern kann, z.B. durch Includes anderer
     74 		// Seiten oder Änderung einer Vorlage oder Änderung des Dateinamens einer
     75 		// verlinkten Datei.
     76 		$this->lastModified( time() );
     77 
     78 		$this->setBaseObject($page);
     79     }
     80 
     81 
     82 
     83 	protected function setBaseObject($folder ) {
     84 
     85 		$this->page = $folder;
     86 
     87 		parent::setBaseObject( $folder );
     88 	}
     89 
     90 
     91 
     92     protected function setModelAndLanguage()
     93     {
     94         $this->setTemplateVar('languages' ,$this->page->getProject()->getLanguages());
     95         $this->setTemplateVar('languageid',$this->page->getProject()->getDefaultLanguageId() );
     96 
     97         $this->setTemplateVar('models'    ,$this->page->getProject()->getModels()   );
     98         $this->setTemplateVar('modelid'   ,$this->page->getProject()->getDefaultModelId() );
     99     }
    100 
    101 
    102 
    103     protected function createPageContext( $scheme ) {
    104 
    105 		$context = new PageContext( $this->page->objectid,$scheme );
    106 
    107 		if  ( $this->request->hasLanguageId())
    108 			$context->languageId = $this->request->getLanguageId();
    109 
    110 		if  ( $this->request->hasModelId())
    111 			$context->modelId = $this->request->getModelId();
    112 
    113         if  ( !$context->languageId )
    114 			$context->languageId = $this->page->getProject()->getDefaultLanguageId();
    115 
    116         if  ( !$context->modelId )
    117 			$context->modelId = $this->page->getProject()->getDefaultModelId();
    118 
    119         return $context;
    120 	}
    121 
    122 }