$cell[$i][$w]['firstDay'] = false; $cell[$i][$w]['focus'] = true; } else { $cell[$i][$w]['firstDay'] = false; $cell[$i][$w]['focus'] = false; } if (isset($listevents["$dday"])) { $e = 0; foreach ($listevents["$dday"] as $le) { $nbDaysLeftThisWeek = min(ceil(($le['endTimeStamp'] - $dday)/86400), (7-$w)); if ($calendarViewMode['casedefault'] == 'month') { $endOfCurrentMonth = $tikilib->make_time(23, 59, 59, TikiLib::date_format('m', $dday) + 1, 0, TikiLib::date_format2('Y', $dday)); $nbDaysLeftThisWeek = min(ceil(($endOfCurrentMonth - $dday)/86400), $nbDaysLeftThisWeek); } elseif ($calendarViewMode['casedefault'] == 'year') { $endOfCurrentYear = $tikilib->make_time(23, 59, 59, 12, 31, TikiLib::date_format2('Y', $dday)); $nbDaysLeftThisWeek = min(ceil(($endOfCurrentYear - $dday)/86400), $nbDaysLeftThisWeek); } if (!array_key_exists('nbDaysLeftThisWeek', $le)) { $le['nbDaysLeftThisWeek'] = $nbDaysLeftThisWeek; } $le['modifiable'] = in_array($le['calendarId'], $modifiable)? "y": "n"; $le['visible'] = in_array($le['calendarId'], $visible)? "y": "n"; $lec = $infocals['data']["{$le['calendarId']}"]; $leday["{$le['time']}$e"] = $le; $smarty->assign('allday', $le["result"]["allday"]); $smarty->assign('cellcalendarId', $le["calendarId"]); $smarty->assign('cellhead', $le["head"]); $smarty->assign('cellprio', $le["prio"]); $smarty->assign('cellcalname', $le["calname"]); $smarty->assign('celllocation', $le["location"]);
$save['start'] = $tikilib->make_time(0, 0, 0, $_REQUEST['start_date_Month'], $_REQUEST['start_date_Day'], $_REQUEST['start_date_Year']); } if ($save['end_or_duration'] == 'duration') { $save['duration'] = 86399; $save['end'] = $save['start'] + $save['duration']; } else { $save['end'] = $tikilib->make_time(23, 59, 59, $_REQUEST['end_date_Month'], $_REQUEST['end_date_Day'], $_REQUEST['end_date_Year']); $save['duration'] = max(0, $save['end'] - $save['start']); } } else { //Convert 12-hour clock hours to 24-hour scale to compute time if (!empty($_REQUEST['start_Meridian'])) { $_REQUEST['start_Hour'] = date('H', strtotime($_REQUEST['start_Hour'] . ':00 ' . $_REQUEST['start_Meridian'])); } if (isset($save['start'])) { $itemdate = TikiLib::date_format2('Y/m/d', $save['start']); $itemdate = explode("/", $itemdate); $save['start'] = TikiLib::make_time($_REQUEST['start_Hour'], $_REQUEST['start_Minute'], 0, $itemdate[1], $itemdate[2], $itemdate[0]); } else { $save['start'] = $tikilib->make_time($_REQUEST['start_Hour'], $_REQUEST['start_Minute'], 0, $_REQUEST['start_date_Month'], $_REQUEST['start_date_Day'], $_REQUEST['start_date_Year']); } if ($save['end_or_duration'] == 'duration') { $save['duration'] = max(0, $_REQUEST['duration_Hour'] * 60 * 60 + $_REQUEST['duration_Minute'] * 60); $save['end'] = $save['start'] + $save['duration']; } else { //Convert 12-hour clock hours to 24-hour scale to compute time if (!empty($_REQUEST['end_Meridian'])) { $_REQUEST['end_Hour'] = date('H', strtotime($_REQUEST['end_Hour'] . ':00 ' . $_REQUEST['end_Meridian'])); } $save['end'] = $tikilib->make_time($_REQUEST['end_Hour'], $_REQUEST['end_Minute'], 0, $_REQUEST['end_date_Month'], $_REQUEST['end_date_Day'], $_REQUEST['end_date_Year']); $save['duration'] = max(0, $save['end'] - $save['start']);
/** * @param $evt * @param $oldRec * @return array */ public function compareFieldsOfEvent($evt, $oldRec) { $result = array(); if ($evt['calendarId'] != $oldRec->getCalendarId()) { $result[] = "calendarId"; } if (TikiLib::date_format2('Hi', $evt['start']) != $oldRec->getStart()) { $result[] = "start"; } // checking the end is double check : is it the right hour ? is it the same day ? if (TikiLib::date_format2('Hi', $evt['end']) != $oldRec->getEnd() || TikiLib::date_format2('Ymd', $evt['start']) != TikiLib::date_format2('Ymd', $evt['end'])) { $result[] = "end"; } if ($evt['allday'] != $oldRec->isAllday()) { $result[] = "allday"; } if ($evt['locationId'] != $oldRec->getLocationId()) { $result[] = "locationId"; } if ($evt['categoryId'] != $oldRec->getCategoryId()) { $result[] = "categoryId"; } if ($evt['nlId'] != $oldRec->getNlId()) { $result[] = "nlId"; } if ($evt['priority'] != $oldRec->getPriority()) { $result[] = "priority"; } if ($evt['status'] != $oldRec->getStatus()) { $result[] = "status"; } if ($evt['url'] != $oldRec->getUrl()) { $result[] = "url"; } if ($evt['lang'] != $oldRec->getLang()) { $result[] = "lang"; } if ($evt['name'] != $oldRec->getName()) { $result[] = "name"; } if ($evt['description'] != $oldRec->getDescription()) { $result[] = "description"; } if (TikiLib::date_format2('Hi', $evt['start']) != str_pad($oldRec->getStart(), 4, "0", STR_PAD_LEFT)) { $result[] = "_start"; } if (TikiLib::date_format2('Hi', $evt['end']) != str_pad($oldRec->getEnd(), 4, "0", STR_PAD_LEFT)) { $result[] = "_end"; } if ($oldRec->isWeekly()) { if (TikiLib::date_format2('w', $evt['start']) != $oldRec->getWeekday()) { $result[] = "_weekday"; } } elseif ($oldRec->isMonthly()) { if (TikiLib::date_format2('d', $evt['start']) != $oldRec->getDayOfMonth()) { $result[] = "_dayOfMonth"; } } elseif ($oldRec->isYearly()) { if (TikiLib::date_format2('md', $evt['start']) != $oldRec->getDateOfYear()) { $result[] = "_dateOfYear"; } } return $result; }
function coho_get_unix($itemtimeHM, $itemdateUnix) { $tmp = str_pad($itemtimeHM, 4, "0", STR_PAD_LEFT); $itemhour = substr($tmp, 0, 2); $itemminute = substr($tmp, -2); $itemdate = TikiLib::date_format2('Y/m/d', $itemdateUnix); $itemdate = explode("/", $itemdate); $unixtime = TikiLib::make_time($itemhour, $itemminute, 0, $itemdate[1], $itemdate[2], $itemdate[0]); return $unixtime; }