예제 #1
0
파일: VCalendar.php 프로젝트: ephp/cal
 /**
  * creates formatted output for calendar property x-prop, iCal format only
  *
  * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**>
  * @since 2.16.2 - 2012-12-18
  * @return string
  */
 function createXprop()
 {
     if (empty($this->xprop) || !is_array($this->xprop)) {
         return FALSE;
     }
     $output = null;
     $toolbox = new CalendarComponent();
     $toolbox->setConfig($this->getConfig());
     foreach ($this->xprop as $label => $xpropPart) {
         if (!isset($xpropPart['value']) || empty($xpropPart['value']) && !is_numeric($xpropPart['value'])) {
             $output .= $toolbox->_createElement($label);
             continue;
         }
         $attributes = $toolbox->_createParams($xpropPart['params'], array('LANGUAGE'));
         if (is_array($xpropPart['value'])) {
             foreach ($xpropPart['value'] as $pix => $theXpart) {
                 $xpropPart['value'][$pix] = ICalUtilityFunctions::_strrep($theXpart, $this->format, $this->nl);
             }
             $xpropPart['value'] = implode(',', $xpropPart['value']);
         } else {
             $xpropPart['value'] = ICalUtilityFunctions::_strrep($xpropPart['value'], $this->format, $this->nl);
         }
         $output .= $toolbox->_createElement($label, $attributes, $xpropPart['value']);
         if (is_array($toolbox->xcaldecl) && 0 < count($toolbox->xcaldecl)) {
             foreach ($toolbox->xcaldecl as $localxcaldecl) {
                 $this->xcaldecl[] = $localxcaldecl;
             }
         }
     }
     return $output;
 }
예제 #2
0
 /**
  * creates formatted output for calendar component property x-prop
  *
  * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**>
  * @since 2.16.2 - 2012-12-18
  * @return string
  */
 function createXprop()
 {
     if (empty($this->xprop)) {
         return FALSE;
     }
     $output = null;
     foreach ($this->xprop as $label => $xpropPart) {
         if (!isset($xpropPart['value']) || empty($xpropPart['value']) && !is_numeric($xpropPart['value'])) {
             if ($this->getConfig('allowEmpty')) {
                 $output .= $this->_createElement($label);
             }
             continue;
         }
         $attributes = $this->_createParams($xpropPart['params'], array('LANGUAGE'));
         if (is_array($xpropPart['value'])) {
             foreach ($xpropPart['value'] as $pix => $theXpart) {
                 $xpropPart['value'][$pix] = ICalUtilityFunctions::_strrep($theXpart, $this->format, $this->format);
             }
             $xpropPart['value'] = implode(',', $xpropPart['value']);
         } else {
             $xpropPart['value'] = ICalUtilityFunctions::_strrep($xpropPart['value'], $this->format, $this->nl);
         }
         $output .= $this->_createElement($label, $attributes, $xpropPart['value']);
     }
     return $output;
 }