openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

TitleHistoryAction.class.php (1109B)


      1 <?php
      2 namespace cms\ui\action\title;
      3 use cms\action\Method;
      4 use cms\model\BaseObject;
      5 use cms\ui\action\TitleAction;
      6 use util\Html;
      7 use util\Session;
      8 
      9 class TitleHistoryAction extends TitleAction implements Method {
     10     public function view() {
     11 		$resultList = array();
     12 
     13 		$history = Session::get('history');
     14 		
     15 		if	( is_array($history) )
     16 		{
     17 			foreach( array_reverse($history) as $objectid )
     18 			{
     19 				$o = new BaseObject( $objectid );
     20 				$o->load();
     21 				$resultList[$objectid] = array();
     22 				$resultList[$objectid]['url']  = Html::url($o->getType(),'',$objectid);
     23 				$resultList[$objectid]['type'] = $o->getType();
     24 				$resultList[$objectid]['name'] = $o->getDefaultName()->name;
     25 				$resultList[$objectid]['lastchange_date'] = $o->lastchangeDate;
     26 
     27 				$defaultName = $o->getDefaultName();
     28 				if	( $defaultName->description != '' )
     29 					$resultList[$objectid]['desc'] = $defaultName->description;
     30 				else
     31 					$resultList[$objectid]['desc'] = \cms\base\Language::lang('NO_DESCRIPTION_AVAILABLE');
     32 			}
     33 		}
     34 
     35 		$this->setTemplateVar( 'history',$resultList );		
     36     }
     37     public function post() {
     38     }
     39 }