function fetchCityXtraDetails($lat, $lon) { $etc = array(); try { if (empty($lat) || empty($lon)) { throw new Exception('lat, lon empty'); } $etc['timezone'] = getdetailsonlatlon($lat, $lon); if (empty($etc['timezone'])) { throw new Exception('empty details'); } if ($etc['timezone']['rawOffset'] != $etc['timezone']['dstOffset']) { $etc['location']['dst'] = 1; } else { $etc['location']['dst'] = 0; } $etc['dd2dms'] = dd2dms($lat, $lon); $etc['location']['lat_h'] = $etc['dd2dms'][2]; $etc['location']['lat_m'] = $etc['dd2dms'][4]; $etc['location']['lat_s'] = $etc['dd2dms'][0] == 'S' ? 1 : 0; $etc['location']['lon_h'] = $etc['dd2dms'][3]; $etc['location']['lon_m'] = $etc['dd2dms'][5]; $etc['location']['lon_e'] = $etc['dd2dms'][1] == 'E' ? 1 : 0; $zones = makeTime(abs($etc['timezone']['rawOffset'])); $etc['location']['zone_h'] = $zones[0]; $etc['location']['zone_m'] = $zones[1]; } catch (Exception $e) { $etc = array(); } return $etc; }
function schoolState($date) { if (schoolDay($date) == 'sat' && $date >= makeTime($date, 9, 0) && $date <= makeTime($date, 12, 20)) { return 'school day'; } elseif (schoolDay($date) == 'week day' && $date >= makeTime($date, 12, 30) && $date <= makeTime($date, 13, 30)) { return 'lunch'; } elseif (schoolDay($date) == 'week day' && $date >= makeTime($date, 9, 15) && $date <= makeTime($date, 15, 40)) { return 'school day'; } else { return 'no school'; } }
public function add() { $this->load->helper('form'); $this->load->library('form_validation'); $this->load->library('session'); if ($this->form_validation->run('goal/add') === FALSE) { $this->load->view("templates/errorForm.php", array("fields" => array('startDate', 'endDate', 'task', 'hour'))); } else { $startDate = $this->input->post("startDate"); $endDate = $this->input->post("endDate"); $taskId = $this->input->post("task"); $val = $this->input->post("hour") * 3600; $description = $this->input->post("description"); $goal = new Goal(); try { $this->load->library("jdf"); if (!checkDateString($startDate) || !checkDateString($endDate)) { show_error("data wrong", 400); return; } $startDate = makeTime($startDate); $endDate = makeTime($endDate); $goal->create($val, $startDate, $endDate, $description)->save(new Task($taskId), new User($this->session->getStudentId())); $this->load->view("goal/goal_created"); } catch (Goal_Start_Greater_Than_End $e) { $this->load->view("goal/goal_error.php"); Goal_Error::Goal_Start_Greater_Than_End(); } catch (UserNotFound $e) { $this->load->view("user/user_error.php"); User_Error::UserNotFound(); } catch (Goal_Overlap $e) { $this->load->view("goal/goal_error.php"); Goal_Error::Goal_Overlap(); } catch (Goal_Value_Invalid $e) { $this->load->view("goal/goal_error.php"); Goal_Error::Goal_Value_Invalid(); } } }
if (IGT_NUMBERING_STYLE_ANSWERS == IGT_NUMBERING_STYLES_LETTERS) { $nQuestionType = getRecordItem($srv_settings['table_prefix'] . 'questions', 'question_type', 'questionid=' . $i_rSet2->fields['questionid']); switch ($nQuestionType) { case QUESTION_TYPE_MULTIPLECHOICE: case QUESTION_TYPE_TRUEFALSE: case QUESTION_TYPE_MULTIPLEANSWER: $strAnswerText = $i_rSet2->fields['result_answer_text']; $arrAnswerText = explode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $strAnswerText); foreach ($arrAnswerText as $key => $val) { $arrAnswerText[$key] = convertNumberToLetter($val); } $strAnswerText = implode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $arrAnswerText); $i_rSet2->fields['result_answer_text'] = $strAnswerText; break; } } echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=right>' . $i_rSet2->fields['result_answerid'] . '</td><td align=right>' . $i_rSet2->fields['test_questionid'] . '</td><td>' . makeTime($i_rSet2->fields['result_answer_timespent']) . '</td><td>' . convertTextValue($i_rSet2->fields['result_answer_text']) . '</td><td align=right>' . $i_rSet2->fields['result_answer_points'] . '</td><td align=center>' . ($i_rSet2->fields['result_answer_timeexceeded'] ? '<img src="images/button-checkbox-2.gif" width=13 height=13 border=0 title="' . $lngstr['label_yes'] . '">' : '<img src="images/button-checkbox-0.gif" width=13 height=13 border=0 title="' . $lngstr['label_no'] . '">') . '</td><td align=center>' . ($i_rSet2->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_UNDEFINED ? '<a href="reports-manager.php?answerid=' . $i_rSet2->fields['result_answerid'] . $i_resultid_addon . '&action=viewa"><img width=13 height=13 border=0 src="images/button-checkbox-3.gif" title="' . $lngstr['label_undefined'] . '"></a>' : ($i_rSet2->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT ? '<img width=13 height=13 border=0 src="images/button-checkbox-2.gif" title="' . $lngstr['label_yes'] . '">' : ($i_rSet2->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_PARTIALLYCORRECT ? '<img width=13 height=13 border=0 src="images/button-checkbox-1.gif" title="' . $lngstr['label_partially'] . '">' : '<img width=13 height=13 border=0 src="images/button-checkbox-0.gif" title="' . $lngstr['label_no'] . '">'))) . '</td>'; echo '<td align=center width=22><a href="reports-manager.php?action=viewa&answerid=' . $i_rSet2->fields['result_answerid'] . $i_resultid_addon . '"><img width=20 height=20 border=0 src="images/button-view.gif" title="' . $lngstr['label_action_view_question_result'] . '"></a></td>'; if ($G_SESSION['access_questionbank'] > 1) { echo '<td align=center width=22><a href="question-bank.php?action=editq&questionid=' . $i_rSet2->fields['questionid'] . $i_resultid_addon . $i_order_addon . '"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_question_edit'] . '"></a></td>'; } echo '</tr>'; $i_counter++; $i_pagewide_id++; $i_rSet2->MoveNext(); } $i_rSet2->Close(); } echo '</table>'; } displayTemplate('_footer');
private function initialize() { $this->endDate = makeTime($this->input->post("endDate")); $this->startDate = makeTime($this->input->post("startDate")); $this->task_id = $this->input->post("task"); }
<?php $entry = $db->selectOneRow($tbl, "*", "`calendarid`=" . $calendarid); $breadcrumbs->addElement(makeDate($day), makeURL($mod, array('day' => $day, 'view' => $view))); $breadcrumbs->addElement($entry['title'], makeURL($mod, array('mode' => 'view', 'day' => $day, 'view' => $view, 'calendarid' => $calendarid))); $entry['start'] = makeDate($entry['start']) . " " . makeTime($entry['start']); $entry['end'] = makeDate($entry['end']) . " " . makeTime($entry['end']); $entry['visible'] = visibilityToString($entry['visible']); $entry['description'] = $bbcode->parse($entry['description']); $smarty->assign('entry', $entry); $smarty->assign('path', $template_dir . "/view_entry.tpl"); if ($entry['userid'] == $login->currentUserID() or $isallowed) { $menu->addSubElement($mod, $lang->get('edit_calendar_entry'), 'edit', array('calendarid' => $calendarid)); }
function getXtraDetails($lat, $lon) { $etc = array(); if (empty($lat) || empty($lon)) { return false; } $etc['timezone'] = getdetailsonlatlon($lat, $lon); if (empty($etc['timezone'])) { return false; } if ($etc['timezone']['rawOffset'] != $etc['timezone']['dstOffset']) { $etc['location']['dst'] = 1; } else { $etc['location']['dst'] = 0; } $etc['dd2dms'] = dd2dms($lat, $lon); $etc['location']['lat_h'] = $etc['dd2dms'][2]; $etc['location']['lat_m'] = $etc['dd2dms'][4]; $etc['location']['lat_s'] = $etc['dd2dms'][0] == 'S' ? 1 : 0; $etc['location']['lon_h'] = $etc['dd2dms'][3]; $etc['location']['lon_m'] = $etc['dd2dms'][5]; $etc['location']['lon_e'] = $etc['dd2dms'][1] == 'E' ? 1 : 0; $zones = makeTime(abs($etc['timezone']['rawOffset'])); $etc['location']['zone_h'] = $zones[0]; $etc['location']['zone_m'] = $zones[1]; return $etc; }
<?php global $current_language; $range = isset($_GET['range']) ? (int) $_GET['range'] : 14; if ($login->currentUser() !== false) { $list = $db->selectList($tbl, "*", "`end`>" . $day . " AND ( (`visible` = 2 ) OR (`visible` = 0 AND `userid` = " . $login->currentUserID() . ") OR ( `visible` = 1) )\r\n\t\t\tAND (`language` = '' OR `language` = '" . $current_language . "')", "`start` ASC", $range); } else { $list = $db->selectList($tbl, "*", "(`end`>" . $day . " AND `visible` = 2)\r\n\t\t\t AND (`language` = '' OR `language` = '" . $current_language . "')", "`start` ASC", "{$range}"); } if (count($list) > 0) { foreach ($list as $i => $l) { $list[$i]['day'] = makeDate($l['start']); $list[$i]['time'] = makeTime($l['start']); $list[$i]['url'] = makeURL($mod, array('day' => $day, 'calendarid' => $l['calendarid'], 'mode' => 'view')); if (date('j', $l['start']) != date('j', $l['end'])) { $list[$i]['day_end'] = makeDate($l['end']); } $list[$i]['time_end'] = makeTime($l['end']); } } $smarty->assign('entries', $list); $smarty->assign('path', $template_dir . "/view_next.tpl");
public function edit($id) { $this->load->library('jdf'); $this->load->helper('form'); $this->load->library('form_validation'); $this->load->library("session"); if ($this->form_validation->run('item/add') === FALSE) { $this->load->view("templates/errorForm.php", array("fields" => array('rating', 'isDone', 'task', 'date', 'endTime', 'startTime'))); } else { $item = new Item($id); $user = new User($this->session->getStudentId()); if ($this->input->post("isDone") == 1) { $state = ITEM_STATE_DONE; } else { $state = ITEM_STATE_UNDONE; } $start = makeTime($this->input->post("date"), $this->input->post("startTime")); $end = makeTime($this->input->post("date"), $this->input->post("endTime")); try { $item->edit($start, $end, $this->input->post("description"), $state, $this->session->getStudentId(), $this->input->post("rating"))->update(); $this->load->view("item/item_created.php", array("item" => $this->setFormat(array($item)))); } catch (Item_Overlap_With_Other_Item $e) { $this->load->view("item/item_error.php"); Item_Error::Item_Overlap_With_Other_Item(); } catch (Item_Create_With_Zero_Duration $e) { $this->load->view("item/item_error.php"); Item_Error::Item_Create_With_Zero_Duration(); } catch (Item_Feedback_Wrong $e) { $this->load->view("item/item_error.php"); Item_Error::Item_Feedback_Wrong(); } catch (Item_Start_Greater_Than_End_Exception $e) { $this->load->view("item/item_error.php"); Item_Error::Item_Start_Greater_Than_End_Exception(); } catch (Task_Not_Found $e) { $this->load->view("task/task_error.php"); Task_Error::Task_Not_Found(); } catch (Item_is_not_owned_to_this_user $e) { $this->load->view("item/item_error.php"); Item_Error::Item_is_not_owned_to_this_user(); } } }
public function makeTime() { $this->load->library("jdf"); echo "<meta charset='utf-8'>"; echo jdate("Y/m/d H:i:s", makeTime("1394/5/18", "11:00")) . "<br>"; echo jdate("Y/m/d H:i:s", jmktime(6, 15, 34, 11, 22, 1389)) . "<br>"; echo jdate("Y/m/d H:i:s", jmktime(11, 0, 0, 5, 18, 1394)) . "<br>"; }