Exemplo n.º 1
0
 /**
  * convert format for input date (UTC) to internal date with parameters
  *
  * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**>
  * @since 2.4.17 - 2008-10-31
  * @param mixed $year
  * @param mixed $month optional
  * @param int $day optional
  * @param int $hour optional
  * @param int $min optional
  * @param int $sec optional
  * @param array $params optional
  * @return array
  */
 public static function _setDate2($year, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $params = FALSE)
 {
     $input = null;
     if (iCal_UtilityFunctions::_isArrayDate($year)) {
         $input['value'] = iCal_UtilityFunctions::_date_time_array($year, 7);
         $input['params'] = iCal_UtilityFunctions::_setParams($month, array('VALUE' => 'DATE-TIME'));
     } elseif (iCal_UtilityFunctions::_isArrayTimestampDate($year)) {
         $input['value'] = iCal_UtilityFunctions::_timestamp2date($year, 7);
         $input['params'] = iCal_UtilityFunctions::_setParams($month, array('VALUE' => 'DATE-TIME'));
     } elseif (8 <= strlen(trim($year))) {
         // ex. 2006-08-03 10:12:18
         $input['value'] = iCal_UtilityFunctions::_date_time_string($year, 7);
         $input['params'] = iCal_UtilityFunctions::_setParams($month, array('VALUE' => 'DATE-TIME'));
     } else {
         $input['value'] = array('year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'min' => $min, 'sec' => $sec);
         $input['params'] = iCal_UtilityFunctions::_setParams($params, array('VALUE' => 'DATE-TIME'));
     }
     $parno = iCal_UtilityFunctions::_existRem($input['params'], 'VALUE', 'DATE-TIME', 7);
     // remove default
     if (!isset($input['value']['hour'])) {
         $input['value']['hour'] = 0;
     }
     if (!isset($input['value']['min'])) {
         $input['value']['min'] = 0;
     }
     if (!isset($input['value']['sec'])) {
         $input['value']['sec'] = 0;
     }
     if (!isset($input['value']['tz']) || !iCal_UtilityFunctions::_isOffset($input['value']['tz'])) {
         $input['value']['tz'] = 'Z';
     }
     return $input;
 }
Exemplo n.º 2
0
 /**
  * set calendar component property related-to
  *
  * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**>
  * @since 2.5.1 - 2008-11-07
  * @param float $relid
  * @param array $params, optional
  * @param index $index, optional
  * @return bool
  */
 function setRelatedTo($value, $params = FALSE, $index = FALSE)
 {
     if (empty($value)) {
         if ($this->getConfig('allowEmpty')) {
             $value = null;
         } else {
             return FALSE;
         }
     }
     if ('<' == substr($value, 0, 1) && '>' == substr($value, -1)) {
         $value = substr($value, 1, strlen($value) - 2);
     }
     iCal_UtilityFunctions::_existRem($params, 'RELTYPE', 'PARENT', TRUE);
     // remove default
     iCal_UtilityFunctions::_setMval($this->relatedto, $value, $params, FALSE, $index);
     return TRUE;
 }