/** * Return formated date * * @access public * @param DateTimeValue $value If value is not instance of DateTime object new DateTime * object will be created with $value as its constructor param * @param string $format If $format is NULL default date format will be used * @param float $timezone Timezone, if NULL it will be autodetected (by currently logged user if we have it) * @return string */ function format_date($value = null, $format = null, $timezone = null) { if(is_null($timezone) && function_exists('logged_user') && (logged_user() instanceof Contact)) { $timezone = logged_user()->getTimezone(); } // if $datetime = $value instanceof DateTimeValue ? $value : new DateTimeValue($value); if ($format){ $l = new Localization(); $l->setDateFormat($format); }else $l = Localization::instance(); return $l->formatDate($datetime, $timezone); } // format_date
$alldayevents[$task->getId()] = $task; } $added = true; } } } } if (is_array($birthdays)) { $alldayevents = array_merge($alldayevents, $birthdays); } $alldaygridHeight = count($alldayevents) * PX_HEIGHT / 2 + PX_HEIGHT / 3; if ($alldaygridHeight > 150) { $alldaygridHeight = 150; } $loc = new Localization(); $loc->setDateFormat(lang('view date title', $date_format)); $view_title = $loc->formatDate($dtv); // lang(strtolower(date('l', $dtv))) . date(' j, ', $dtv) . lang('month ' . date('n', $dtv)) . date(' Y', $dtv); $users_array = array(); $companies_array = array(); foreach ($users as $u) { $users_array[] = $u->getArrayInfo(); } foreach ($companies as $company) { $companies_array[] = $company->getArrayInfo(); } ?> <div id="calHiddenFields"> <input type="hidden" id="hfCalUsers" value="<?php echo clean(str_replace('"', "'", escape_character(json_encode($users_array)))); ?>
if ($task->getDueDate() instanceof DateTimeValue && $dtv->getTimestamp() == mktime(0, 0, 0, $task->getDueDate()->getMonth(), $task->getDueDate()->getDay(), $task->getDueDate()->getYear())) { continue; } if ($task->getStartDate() instanceof DateTimeValue && $dtv->getTimestamp() == mktime(0, 0, 0, $task->getStartDate()->getMonth(), $task->getStartDate()->getDay(), $task->getStartDate()->getYear())) { continue; } unset($tmp_tasks[$k]); } $alldayevents = array_merge($alldayevents, $tmp_tasks); } if (is_array($birthdays)) { $alldayevents = array_merge($alldayevents, $birthdays); } $alldaygridHeight = count($alldayevents) * PX_HEIGHT / 2 + PX_HEIGHT / 3; $loc = new Localization(); $loc->setDateFormat(lang('view date title')); $view_title = $loc->formatDate($dtv); // lang(strtolower(date('l', $dtv))) . date(' j, ', $dtv) . lang('month ' . date('n', $dtv)) . date(' Y', $dtv); $users_array = array(); $companies_array = array(); foreach ($users as $u) { $users_array[] = $u->getArrayInfo(); } foreach ($companies as $company) { $companies_array[] = $company->getArrayInfo(); } ?> <div id="calHiddenFields"> <input type="hidden" id="hfCalUsers" value="<?php echo clean(str_replace('"', "'", str_replace("'", "\\'", json_encode($users_array)))); ?>