ImagePreviewAction.class.php (977B)
1 <?php 2 namespace cms\action\image; 3 use cms\action\ImageAction; 4 use cms\action\Method; 5 use cms\model\Value; 6 use util\exception\SecurityException; 7 use util\Html; 8 9 class ImagePreviewAction extends ImageAction implements Method { 10 11 public function view() { 12 $params = [ 13 'output' => 'preview', 14 ]; 15 16 $valueid = $this->request->getNumber('valueid'); 17 18 if ( $valueid ) { 19 20 $value = new Value(); 21 $value->loadWithId( $valueid ); 22 if ( $value->contentid != $this->image->contentid ) 23 throw new SecurityException('content '.$value->contentid.' does not belong to this file which has content-id '.$this->image->contentid); 24 25 $params[ 'valueid' ] = $valueid; 26 $this->setTemplateVar('lastchange_date', $value->lastchangeTimeStamp); 27 }else { 28 $this->setTemplateVar('lastchange_date', $this->image->lastchangeDate); 29 } 30 31 $this->setTemplateVar('url', Html::url('image','show',$this->image->objectid,$params ) ); 32 } 33 34 35 public function post() { 36 } 37 }