. * * This file is a part of iCalcreator. */ namespace Kigkonsult\Icalcreator\Traits; use Kigkonsult\Icalcreator\Util\Util; /** * DESCRIPTION property functions * * @author Kjell-Inge Gustafsson, kigkonsult * @since 2.22.23 - 2017-02-02 */ trait DESCRIPTIONtrait { /** * @var array component property DESCRIPTION value * @access protected */ protected $description = null; /** * Return formatted output for calendar component property description * * @return string */ public function createDescription() { if( empty( $this->description )) { return null; } $output = null; $lang = $this->getConfig( Util::$LANGUAGE ); foreach( $this->description as $dx => $description ) { if( ! empty( $description[Util::$LCvalue] )) { $output .= Util::createElement( Util::$DESCRIPTION, Util::createParams( $description[Util::$LCparams], Util::$ALTRPLANGARR, $lang ), Util::strrep( $description[Util::$LCvalue] ) ); } elseif( $this->getConfig( Util::$ALLOWEMPTY )) { $output .= Util::createElement( Util::$DESCRIPTION ); } } return $output; } /** * Set calendar component property description * * @param string $value * @param array $params * @param integer $index * @return bool */ public function setDescription( $value, $params = null, $index = null ) { if( empty( $value )) { if( $this->getConfig( Util::$ALLOWEMPTY )) { $value = Util::$SP0; } else { return false; } } if( self::VJOURNAL != $this->compType ) { $index = 1; } Util::setMval( $this->description, $value, $params,false, $index ); return true; } }