function getaddITSEventPopupTime($starttime, $endtime, $format) { $timearr = array(); list($sthr, $stmin) = explode(":", $starttime); list($edhr, $edmin) = explode(":", $endtime); if ($format == 'am/pm') { $hr = $sthr + 0; $timearr['startfmt'] = $hr >= 12 ? "pm" : "am"; if ($hr == 0) { $hr = 12; } $timearr['starthour'] = twoDigit($hr > 12 ? $hr - 12 : $hr); $timearr['startmin'] = $stmin; $edhr = $edhr + 0; $timearr['endfmt'] = $edhr >= 12 ? "pm" : "am"; if ($edhr == 0) { $edhr = 12; } $timearr['endhour'] = twoDigit($edhr > 12 ? $edhr - 12 : $edhr); $timearr['endmin'] = $edmin; return $timearr; } if ($format == '24') { $timearr['starthour'] = twoDigit($sthr); $timearr['startmin'] = $stmin; $timearr['startfmt'] = ''; $timearr['endhour'] = twoDigit($edhr); $timearr['endmin'] = $edmin; $timearr['endfmt'] = ''; return $timearr; } }
function toTime($seconds) { $hours = floor($seconds / 3600); $seconds -= $hours * 3600; $minutes = floor($seconds / 60); $seconds -= $minutes * 60; if ($hours == 0 && $seconds == 0 && $minutes == 0) { return '00:00:00'; } else { return twoDigit($hours) . ':' . twoDigit($minutes) . ':' . twoDigit($seconds); } }
/** To read and set the events value in Appointment Obj * @param $act_array -- The vtiger_activity array :: Type Array * @param $view -- The calendar view :: Type String */ function readResult($act_array, $view) { global $adb, $current_user, $app_strings; $format_sthour = ''; $format_stmin = ''; $this->description = $act_array["description"]; $this->eventstatus = getRoleBasesdPickList('eventstatus', $act_array["eventstatus"]); $this->priority = getRoleBasesdPickList('taskpriority', $act_array["priority"]); $this->subject = $act_array["subject"]; $this->activity_type = $act_array["activitytype"]; $this->duration_hour = $act_array["duration_hours"]; $this->duration_minute = $act_array["duration_minutes"]; $this->creatorid = $act_array["smcreatorid"]; //$this->creator = getUserName($act_array["smcreatorid"]); $this->assignedto = $act_array["user_name"]; $this->owner = $act_array["user_name"]; if (!is_admin($current_user)) { if ($act_array["smownerid"] != 0 && $act_array["smownerid"] != $current_user->id && $act_array["visibility"] == "Public") { $que = "select * from vtiger_sharedcalendar where sharedid=? and userid=?"; $row = $adb->pquery($que, array($current_user->id, $act_array["smownerid"])); $no = $adb->getRowCount($row); if ($no > 0) { $this->shared = true; } } } $this->image_name = $act_array["activitytype"] . ".gif"; if (!empty($act_array["recurringid"]) && !empty($act_array["recurringtype"])) { $this->recurring = "Recurring.gif"; } $this->record = $act_array["activityid"]; list($styear, $stmonth, $stday) = explode("-", $act_array["date_start"]); if ($act_array["notime"] != 1) { $st_hour = twoDigit($this->temphour); list($sthour, $stmin) = split(":", $act_array["time_start"]); } else { $st_hour = 'notime'; $stmin = '00'; $sthour = '00'; } list($eyear, $emonth, $eday) = explode("-", $act_array["due_date"]); list($end_hour, $end_min) = split(":", $act_array["time_end"]); $start_date_arr = array('min' => $stmin, 'hour' => $sthour, 'day' => $stday, 'month' => $stmonth, 'year' => $styear); $end_date_arr = array('min' => $end_min, 'hour' => $end_hour, 'day' => $eday, 'month' => $emonth, 'year' => $eyear); $this->start_time = new vt_DateTime($start_date_arr, true); $this->end_time = new vt_DateTime($end_date_arr, true); if ($view == 'day' || $view == 'week') { $this->formatted_datetime = $act_array["date_start"] . ":" . $st_hour; } elseif ($view == 'year') { list($year, $month, $date) = explode("-", $act_array["date_start"]); $this->formatted_datetime = $month; } else { $this->formatted_datetime = $act_array["date_start"]; } return; }
/** * * @param type $datetime * @param type $fmt * @return Date */ function formatUserTimeString($datetime, $fmt) { if (is_object($datetime)) { $hr = $datetime->hour; $min = $datetime->minute; } else { $hr = $datetime['hour']; $min = $datetime['minute']; } $timeStr = ""; if ($fmt != 'am/pm') { $timeStr .= twoDigit($hr) . ":" . twoDigit($min); } else { $am_pm = array('AM', 'PM'); $hour = twoDigit($hr % 12); if ($hour == 0) { $hour = 12; } $timeStr = $hour . ':' . twoDigit($min) . $am_pm[$hr / 12 % 2]; } return $timeStr; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php // init db connection include '../lib/lib.php'; opendb(); $datum = getdate(); $today = $datum['year'] . "-" . twoDigit($datum['mon']) . "-" . twoDigit($datum['mday']); if (isset($_GET['date'])) { $selected_date = $_GET['date']; } else { $selected_date = $today; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" media="all" type="text/css" href="style.css" /> <title>Manage RSK Database</title> </head> <body> <?php switcher(); ?> <h4>Log from <?php echo $selected_date; ?> </h4> <form name="show_log" action="log.php" method="get"> Select Date: <?php
function timeString($datetime, $fmt) { if (is_object($datetime)) { $hr = $datetime->hour; $min = $datetime->minute; } else { $hr = $datetime['hour']; $min = $datetime['minute']; } $timeStr = ""; if ($fmt != 'am/pm') { $timeStr .= twoDigit($hr) . ":" . twoDigit($min); } else { $am = $hr >= 12 ? "pm" : "am"; if ($hr == 0) { $hr = 12; } $timeStr .= $hr > 12 ? $hr - 12 : $hr; $timeStr .= ":" . twoDigit($min); $timeStr .= $am; } return $timeStr; }
function convertTdecThms($tdec) { $h = floor($tdec); $m = floor(fmod($tdec, 1) * 60); $s = fmod(floor(fmod($tdec, 1) * 3600), 60); $thms = twoDigit($h) . ":" . twoDigit($m) . ":" . twoDigit($s); return $thms; }