/** * Generate content of the block * * @global type $DB * @global type $USER * @return type */ public function get_content() { global $CFG, $DB, $USER; require_once $CFG->dirroot . '/blocks/obu_forms/lib.php'; require_once $CFG->dirroot . '/blocks/obu_forms/dbquery.php'; if ($this->content !== null) { return $this->content; } $this->content = new stdClass(); $this->content->text = ''; $form_list = ''; $authorisations = get_authorisations($USER->id); foreach ($authorisations as $authorisation) { $date = date_create(); date_timestamp_set($date, $authorisation->request_date); $request_date = date_format($date, "d-m-y H:i"); // If the authorisation is overdue, show visual alert (bold text) $elapsed_days = (time() - $authorisation->request_date) / 86400; if ($elapsed_days >= get_config('block_obu_forms', 'alertdays')) { $form_list .= "<span style='font-weight:bold'>" . $request_date . "</span>"; } else { $form_list .= $request_date; } $data = $DB->get_record('local_obu_forms_data', array('id' => $authorisation->data_id), '*', MUST_EXIST); $template = $DB->get_record('local_obu_forms_templates', array('id' => $data->template_id), '*', MUST_EXIST); $form = $DB->get_record('local_obu_forms', array('id' => $template->form_id), '*', MUST_EXIST); $form_list .= ' ' . html_writer::link('/local/obu_forms/process.php?id=' . $authorisation->data_id, $form->formref, array("style" => "color:red")); $form_list .= "<br>"; } if ($form_list) { $form_list = "<p><b>" . get_string('requireauthorisation', 'block_obu_forms') . "</b></p>" . $form_list; $this->content->text .= $form_list; } return $this->content; }
public function __construct($path, $rootPath, $size, $createdAt, $modifiedAt) { $this->path = $path; $this->rootPath = rtrim(is_null($rootPath) ? '' : $rootPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; $this->size = $size; $this->createdAt = is_numeric($createdAt) ? date_timestamp_set(new \DateTime(), $createdAt) : clone $createdAt; $this->modifiedAt = is_numeric($modifiedAt) ? date_timestamp_set(new \DateTime(), $modifiedAt) : clone $modifiedAt; $this->relativePath = null; }
public function __construct($sourceName, $value, $currencyCode, $rateType, $date, $baseCurrencyCode, $createdAt = null, $modifiedAt = null) { $this->sourceName = $sourceName; $this->value = $value; $this->currencyCode = CurrencyCodeUtil::clean($currencyCode); $this->rateType = $rateType; $this->baseCurrencyCode = CurrencyCodeUtil::clean($baseCurrencyCode); $processDate = function ($arg) { $arg = is_null($arg) ? new \DateTime('now') : $arg; return is_numeric($arg) ? date_timestamp_set(new \DateTime(), $arg) : clone $arg; }; $this->date = $processDate($date); $this->createdAt = $processDate($createdAt); $this->modifiedAt = $processDate($modifiedAt); }
static function checkGameDates(&$message) { if (APIHelpers::$FHQSESSION != NULL) { if (!isset(APIHelpers::$FHQSESSION['game'])) { $message = 'Select game please'; return false; } } else { if (!isset($_SESSION['game'])) { $message = 'Select game please'; return false; } } if (APISecurity::isAdmin() || APISecurity::isTester()) { return true; } $date_start = new DateTime(); date_timestamp_set($date_start, strtotime($_SESSION['game']['date_start'])); $date_stop = new DateTime(); date_timestamp_set($date_stop, strtotime($_SESSION['game']['date_stop'])); $date_restart = new DateTime(); date_timestamp_set($date_restart, strtotime($_SESSION['game']['date_restart'])); $date_current = new DateTime(); date_timestamp_set($date_current, time()); $di_start = $date_current->diff($date_start); $di_stop = $date_current->diff($date_stop); $di_restart = $date_current->diff($date_restart); $bWillBeStarted = $di_start->invert == 0; $bWillBeRestarted = $di_stop->invert == 1 && $di_restart->invert == 0; // echo date_diff($date_current, $date_start)."<br>"; if ($bWillBeStarted || $bWillBeRestarted) { $label = $bWillBeStarted ? 'Game will be started after: ' : 'Game will be restarted after: '; $di = $bWillBeStarted ? $di_start : $di_restart; $message = $label . '<br> <div class="fhq_timer" id="days">' . $di->d . '</div> day(s) <div class="fhq_timer" id="hours">' . $di->h . '</div> hour(s) <div class="fhq_timer" id="minutes">' . $di->i . '</div> minute(s) <div class="fhq_timer" id="seconds">' . $di->s . '</div> second(s)<br> <div id="reload_content" onclick="startTimer();"/></div> <br><br> '; return false; } return true; }
function reserve($equipment, $owner, $color, $start, $end) { $message = ''; $eventsPage = wire("pages")->get("name=event"); $startdate = date_create(); date_timestamp_set($startdate, intval($start)); $enddate = date_create(); date_timestamp_set($enddate, intval($end)); if (!validateFormat($startdate, $enddate)) { return; } $startTS = date_timestamp_get($startdate); $endTS = date_timestamp_get($enddate); // Reservation Rules if (!validateAdvanceTime($startTS)) { return; } if (!validateDuration($start, $end)) { return; } if (!validateEventOverlap($equipment, $start, $end)) { return; } if (!validateAccumulatedTime($startTS, $endTS)) { return; } // All rules passed, make event $newevent = new Page(); $newevent->template = wire('templates')->get("name=event"); $newevent->title = $owner . " " . $equipment . " " . $start; $newevent->username = $owner; $newevent->equipment_name = $equipment; $newevent->color = $color; $newevent->start_time = $start; $newevent->end_time = $end; $newevent->parent = $eventsPage; $newevent->save(); $message .= "<p class='message'>Reservation Scheduled</p>"; wire("session")->redirect($page->path); //reload page return; }
public function change($ptime) { $date = date_create(); date_timestamp_set($date, strtotime($ptime)); $a = date_format($date, 'Y-m-d H:i:s'); date_default_timezone_set("Asia/Ulaanbaatar"); $b = date("Y-m-d H:i:s"); $etime = strtotime($b) - strtotime($a); if ($etime < 1) { return '0 seconds'; } $a = array(365 * 24 * 60 * 60 => 'жил', 30 * 24 * 60 * 60 => 'сар', 24 * 60 * 60 => 'өдөр', 60 * 60 => 'цаг', 60 => 'минут', 1 => 'секунт'); $a_plural = array('жил' => 'жилийн', 'сар' => 'сарын', 'өдөр' => 'өдрийн', 'цаг' => 'цагийн', 'минут' => 'минутын', 'секунт' => 'секунтын'); foreach ($a as $secs => $str) { $d = $etime / $secs; if ($d >= 1) { $r = round($d); return $r . ' ' . ($r > 1 ? $a_plural[$str] : $str) . ' өмнө'; } } }
<?php $dftz021 = date_default_timezone_get(); //UTC $dtms021 = array(); date_timestamp_set($dtms021, 123456789);
<script src="../signature-pad/jquery.signaturepad.js"></script> <script src="sample-signature-output.js"></script> <table> <?php $dsn = "mysql:host=localhost;dbname=receipt"; $user = "******"; $pass = "******"; $date = new DateTime(); // 4. Open a connection to the database using PDO $db = new PDO($dsn, $user, $pass); // Make sure we are talking to the database in UTF-8 $db->exec('SET NAMES utf8'); // Create some other pieces of information about the user // to confirm the legitimacy of their signature // 5. Use PDO prepare to insert all the information into the database $sql = 'select id,signature,signator,ip,created from signatures order by created'; foreach ($db->query($sql) as $row) { print "<tr>"; print "<td><a href=signature.php?id=" . $row['id'] . ">" . $row['signator'] . "</td>"; //print "<td>".$row['signator'] . "</td>"; print "<td>" . $row['ip'] . "</td>"; date_timestamp_set($date, $row['created']); print "<td>" . date_format($date, 'Y-m-d H:i:s') . "</td>"; print "</tr>"; } ?> </table> <script src="../assets/json2.min.js"></script> </body>
<?php if (is_array($comments)) { ?> <div class='comments'> <p>Kommentarer</p> <?php foreach ($comments as $id => $comment) { if (!empty($comment['name']) || !empty($comment['content'])) { ?> <?php $date = date_create(); date_timestamp_set($date, $comment['timestamp']); $dateis = date_format($date, 'Y-m-d H:i') . "\n"; ?> <div class='comment'> <p class='name'> <?php if (!empty($comment['web'])) { ?> <a href='http://<?php echo $comment['web']; ?> '><?php echo $comment['name'];
function supplement_display($form, $fields) { $fld_start = '<input '; $fld_start_len = strlen($fld_start); $fld_end = '>'; $fld_end_len = strlen($fld_end); $offset = 0; $date_format = 'd-m-y'; do { $pos = strpos($form->template, $fld_start, $offset); if ($pos === false) { break; } if ($pos > $offset) { $this->_form->addElement('html', substr($form->template, $offset, $pos - $offset)); // output any HTML } $offset = $pos + $fld_start_len; $pos = strpos($form->template, $fld_end, $offset); if ($pos === false) { break; } $element = split_input_field(substr($form->template, $offset, $pos - $offset)); $offset = $pos + $fld_end_len; $text = $fields[$element['id']]; if ($element['type'] == 'checkbox') { // map a checkbox value to a nice character if ($text == '1') { $text = '✔'; } else { $text = ''; } } if ($element['type'] == 'date' && $text) { // map a UNIX date to a nice text string $date = date_create(); date_timestamp_set($date, $text); $text = date_format($date, $date_format); } if ($element['type'] == 'file' && $text) { // map a file pathname hash to a URL for the file $text = get_file_link($text); } $this->_form->addElement('static', $element['id'], $element['value'], $text); } while (true); $this->_form->addElement('html', substr($form->template, $offset)); // output any remaining HTML return; }
<?php session_start(); if (!isset($_SESSION['NAME'])) { header('Location: ../index.php'); echo "Some thing wrong with session"; } $conn = null; require_once '../../../connections/Connection.php'; $UnityId = $_SESSION['NAME']; $checkoutDay = $_REQUEST['checkoutDate']; $from_time = strtotime($checkoutDay); $date = date_create(); date_format($date, 'm-d-Y'); $checkoutDateUSA = date_format(date_timestamp_set($date, $from_time), 'd/M/Y h:i:s A'); $check_if_friday_sql = "SELECT TO_CHAR(CAST('{$checkoutDateUSA}' AS TIMESTAMP),'D') as DAY from dual"; var_dump($check_if_friday_sql); $stid = oci_parse($conn, $check_if_friday_sql); oci_execute($stid); oci_fetch_all($stid, $check_if_friday_result, null, null, OCI_FETCHSTATEMENT_BY_ROW); if ($check_if_friday_result[0]['DAY'] != 6) { echo "Checkouts are allowed only on Fridays. Select the checkout date for a Friday."; echo "<td><a href=\"ReserveCamera.php\">Back to Date Selection</a></td>"; } else { echo "startDateTime " . $checkoutDateUSA . "\n"; echo "<br><br>"; $selectRoomQuery = "SELECT DISTINCT c.\"ID\",c.\"MAKE\",c.\"MODEL\",c.\"LENS_CONFIGURATION\",c.\"MEMORY\",c.\"LOCATION\"\r\n\t\t\t\t\t FROM CAMERA c\r\n\t\t\t\t\t WHERE c.\"ID\" NOT IN \r\n\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\tSELECT cq.\"ID\" FROM CAMERA_QUEUE cq\r\n\t\t\t\t\t\t\t\t\tWHERE cq.\"UnityId\" = '{$UnityId}'\r\n\t\t\t\t\t\t\t\t\tAND cq.\"DateOfQueue\" = '{$checkoutDateUSA}'\r\n\t\t\t\t\t\t\t\t\tUNION\r\n\t\t\t\t\t\t\t\t\tSELECT cc.\"ID\" from CAMERA_CHECKOUT cc\r\n\t\t\t\t\t\t\t\t\tWHERE cc.\"UnityId\" = '{$UnityId}'\r\n\t\t\t\t\t\t\t\t\tAND cc.\"ReturnDate\" > SYSTIMESTAMP\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t"; var_dump($selectRoomQuery); $stid = oci_parse($conn, $selectRoomQuery); $result = oci_execute($stid); echo "<table border='1'>\r\n\t<tr>\r\n\t<th> CAMERA ID </th>\r\n\t<th> MAKE </th>\r\n\t<th> MODEL </th>\r\n\t<th> LENS_CONFIGURATION </th>\r\n\t<th> MEMORY </th>\r\n\t<th> LOCATION </th>\t\t\r\n\t<th> Actions </th>\r\n\t</tr>";
/** * Returns the expiration timestamp. * * @param int $lifetime * * @return int * @codeCoverageIgnore */ public function getExpireTime($lifetime = null, $bypass_control = false) { $expire = parent::getExpireTime($lifetime, $bypass_control); return 0 === $expire ? null : date_timestamp_set(new \DateTime(), $expire); }
public function get_content() { global $CFG, $DB, $USER, $PAGE; $PAGE->requires->yui_module('moodle-block_assignments-assignments', 'M.block_assignments.assignments.init'); $PAGE->requires->string_for_js('hide', 'block_assignments'); $PAGE->requires->string_for_js('more', 'block_assignments'); if ($this->content !== null) { return $this->content; } $this->content = new stdClass(); if ($USER->id == null) { return $this->content; } $this->content->text = ''; $courses = enrol_get_my_courses(); if (count($courses) > 0) { $courseids = array(); $assignments = array(); $gradedassignments = array(); $assignmentpaths = array(); foreach ($courses as $course) { if (block_assignments_course_too_old($course)) { continue; } $assignmentpaths = $assignmentpaths + block_assignments_get_course_modules($course); array_push($courseids, $course->id); } list($insql, $inparams) = $DB->get_in_or_equal($courseids); $sql = 'SELECT * FROM {assign} WHERE course ' . $insql; $assignments = $DB->get_records_sql($sql, $inparams); $sql = 'SELECT * FROM {assign_grades} WHERE userid = ?'; $assigngrades = $DB->get_records_sql($sql, array($USER->id)); } else { $assigngrades = array(); $assignments = array(); } $linkinhead = ''; $gradedassignmentsoutput = ''; $overflow = false; $style = array('style' => 'text-align: right;'); if (empty($assigngrades)) { $gradedassignmentsoutput .= block_assignments_no_data_row(2); } else { usort($assigngrades, 'block_assignments_graded_more_recent'); $counter = 0; $rowcounter = 0; foreach ($assigngrades as $entry) { $counter++; if (!array_key_exists($entry->assignment, $assignments)) { continue; } $assignment = $assignments[$entry->assignment]; array_push($gradedassignments, $assignment->id); $course = $courses[$assignment->course]; $rowcounter++; $displaynone = null; if ($rowcounter > 5) { $displaynone = array('style' => 'display: none;'); $overflow = true; } $href = $assignmentpaths[$course->id][$assignment->id]->out(); $linktext = "[" . $course->fullname . "] " . $assignment->name; $link = html_writer::tag('a', $linktext, array('href' => $href)); $name = html_writer::tag('td', $link, null); $grade = html_writer::tag('td', number_format($entry->grade, 1) . " / " . number_format($assignment->grade, 1), $style); $gradedassignmentsoutput .= html_writer::tag('tr', $name . $grade, $displaynone); } if ($overflow) { $linktext = '<b>' . get_string('more', 'block_assignments') . '</b>'; $href = new moodle_url('/blocks/assignments/view.php'); $class = 'btn-show-all btn-show-all-right'; $linkinhead = html_writer::tag('a', $linktext, array('class' => $class, 'href' => $href)); } } $this->content->text .= html_writer::start_tag('div', array('class' => 'row-fluid')); $this->content->text .= html_writer::start_tag('div', array('class' => 'span6')); $class = 'table table-responsive table-striped table-hover table-bordered'; $this->content->text .= html_writer::start_tag('table', array('id' => 'graded-assign', 'class' => $class)); $thname = html_writer::tag('th', get_string('graded', 'block_assignments') . $linkinhead, array('colspan' => '2')); $this->content->text .= html_writer::tag('thead', $thname); $this->content->text .= $gradedassignmentsoutput; $this->content->text .= html_writer::end_tag('table'); $linkinhead = ''; $openassignmentsoutput = ''; $overflow = false; if (empty($assignments)) { $openassignmentsoutput .= block_assignments_no_data_row(2); } else { usort($assignments, 'block_assignments_due_more_recent'); $counter = 0; $rowcounter = 0; foreach ($assignments as $assignment) { $counter++; $course = $courses[$assignment->course]; if (!in_array($assignment->id, $gradedassignments)) { $datedue = date_create(); date_timestamp_set($datedue, $assignment->duedate); $datenow = date_create('NOW'); $duein = date_diff($datenow, $datedue); $due = $duein->format('%R%a'); if ($due < +0) { if ($counter == count($assignments)) { $openassignmentsoutput .= block_assignments_no_data_row(2); } continue; } else { if ($due == +0) { $due = $duein->format('%H:%I'); if ($due == +1) { $due = substr($due, 1) . " " . get_string('hour', 'block_assignments'); } else { $due = substr($due, 1) . " " . get_string('hours', 'block_assignments'); } } else { if ($due == +1) { $due = substr($due, 1) . " " . get_string('day', 'block_assignments'); } else { $due = substr($due, 1) . " " . get_string('days', 'block_assignments'); } } } $due = get_string('until', 'block_assignments') . " " . $due; $rowcounter++; $course = $courses[$assignment->course]; $displaynone = null; if ($rowcounter > 5) { $displaynone = array('style' => 'display: none;'); $overflow = true; } $href = $assignmentpaths[$course->id][$assignment->id]->out(); $linktext = "[" . $course->fullname . "] " . $assignment->name; $link = html_writer::tag('a', $linktext, array('href' => $href)); $name = html_writer::tag('td', $link, null); $due = html_writer::tag('td', $due, $style); $openassignmentsoutput .= html_writer::tag('tr', $name . $due, $displaynone); } else { if ($rowcounter == 0 and $counter == count($assignments)) { $openassignmentsoutput .= block_assignments_no_data_row(2); } } } if ($overflow) { $linktext = '<b>' . get_string('more', 'block_assignments') . '</b>'; $class = 'btn-show-all btn-show-all-right'; $href = new moodle_url('/blocks/assignments/view.php'); $linkinhead = html_writer::tag('a', $linktext, array('class' => $class, 'href' => $href)); } } $this->content->text .= html_writer::end_tag('div'); $this->content->text .= html_writer::start_tag('div', array('class' => 'span6')); $class = 'table table-responsive table-striped table-hover table-bordered'; $this->content->text .= html_writer::start_tag('table', array('id' => 'open-assign', 'class' => $class)); $thname = html_writer::tag('th', get_string('open_assignments', 'block_assignments') . $linkinhead, array('colspan' => '2')); $this->content->text .= html_writer::tag('thead', $thname); $this->content->text .= $openassignmentsoutput; $this->content->text .= html_writer::end_tag('table'); $this->content->text .= html_writer::end_tag('div'); $this->content->text .= html_writer::end_tag('div'); if ($overflow) { $_SESSION['block_assignments_content'] = $this->content->text; } return $this->content; }
<?php if (isset($_POST['seleksi'])) { include_once 'config/koneksi.php'; date_timestamp_set("Asia/Jakarta"); //proses pemindahan datacalon siswa ke data siswa $tahunsekarang = date('y'); $quota = $mysqli->query("SELECT * FROM mvp_kuota order by kuota_id desc limit 1"); $kuota = $quota->fetch_object(); $query = $mysqli->query("SELECT * From mvp_user, mvp_calon_siswa where mvp_user.user_id=mvp_calon_siswa.user_id and mvp_calon_siswa.nilai_un>={$kuota->passing_grade} and LEFT(mvp_calon_siswa.no_formulir, 2)='{$tahunsekarang}' order by mvp_calon_siswa.nilai_un desc limit {$kuota->kuota}"); $querytidakditerima = $mysqli->query("SELECT * From mvp_user, mvp_calon_siswa where mvp_user.user_id=mvp_calon_siswa.user_id and mvp_calon_siswa.nilai_un<'{$kuota->passing_grade}' and LEFT(mvp_calon_siswa.no_formulir, 2)='{$tahunsekarang}' order by mvp_calon_siswa.nilai_un desc"); while ($data = $query->fetch_object()) { $ubah = $mysqli->query("UPDATE mvp_calon_siswa set diterima='1' where user_id='{$data->user_id}'"); $cari = $mysqli->query("SELECT user_id from mvp_siswa where user_id='{$data->user_id}'"); $ketemu = $cari->num_rows; if ($ketemu == 0) { $proses = $mysqli->query("INSERT INTO mvp_siswa values('','{$data->user_id}','{$data->nisn}','{$data->tempatlahir}','{$data->tanggallahir}','{$data->jk}','{$data->goldar}','{$data->telprumah}','{$data->provinsi}','{$data->kota}','{$data->kecamatan}','{$data->kodepos}','{$data->alamat}','{$data->status}','{$data->tahunkelulusan}','{$data->no_skhun}','{$data->nilai_un}','{$data->no_formulir}','1',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,'0')"); } } //untuk yang tidak diterima while ($data = $querytidakditerima->fetch_object()) { $cari1 = $mysqli->query("SELECT user_id from mvp_siswa where user_id='{$data->user_id}'"); $ketemu1 = $cari->num_rows; if ($ketemu1 == 0) { $proses1 = $mysqli->query("INSERT INTO mvp_siswa values('','{$data->user_id}','{$data->nisn}','{$data->tempatlahir}','{$data->tanggallahir}','{$data->jk}','{$data->goldar}','{$data->telprumah}','{$data->provinsi}','{$data->kota}','{$data->kecamatan}','{$data->kodepos}','{$data->alamat}','{$data->status}','{$data->tahunkelulusan}','{$data->no_skhun}','{$data->nilai_un}','{$data->no_formulir}','0',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,'0')"); } } //akumulasi data yang sudah diterima dan tidak $cariditerima = $mysqli->query("SELECT mvp_user.user_id from mvp_siswa, mvp_user where mvp_siswa.diterima=1 and mvp_user.user_id=mvp_siswa.user_id and LEFT(mvp_siswa.no_formulir, 2)='{$tahunsekarang}'"); $caritidakditerima = $mysqli->query("SELECT mvp_user.user_id from mvp_siswa, mvp_user where mvp_siswa.diterima=0 and mvp_user.user_id=mvp_siswa.user_id and LEFT(mvp_siswa.no_formulir, 2)='{$tahunsekarang}'"); $diterima = $cariditerima->num_rows;
<?php $dftz021 = date_default_timezone_get(); //UTC $dtms021 = new DateTime(); $wrong_parameter = array(); date_timestamp_set($dtms021, $wrong_parameter);
<?php $dftz021 = date_default_timezone_get(); //UTC $dtms021 = date_create(); date_timestamp_set(null, 1234567890);
function videoanalytics_do_ajax_request() { $track = ""; if (isset($_GET['track'])) { $track = $_GET['track']; } $data = va_session_get($_GET['rndk'], $track); ?> {"cols":[ {"id":"","label":"Header","pattern":"","type":"number"}, {"id":"","label":"Time","pattern":"","type":"date"} ],"rows":[ <?php $c = 0; $total = count($data); foreach ($data as $d) { $ts = (new DateTime($d->ta))->getTimestamp(); $date = date_create(); date_timestamp_set($date, $ts); //echo date_format($date, 'U = Y-m-d H:i:s') . "\n"; ?> {"c":[{"v":<?php print $d->params; ?> },{"v":"Date( <?php print date_format($date, "Y,m,d,H,i,s"); ?> )"}]}, <?php //todo si es el final afegir if ($d->act == "pausa") { //si el seguent torna a ser un play del mateix video... if ($c < $total - 1) { if ($data[$c + 1]->act == "play" && $data[$c + 1]->video == $data[$c]->video) { $ts2 = $data[$c + 1]->params; $date2 = date_create(); date_timestamp_set($date2, $ts); ?> {"i":"blah","c":[{"v":<?php print $d->params; ?> },{"v":"Date( <?php print date_format($date2, "Y,m,d,H,i,s"); ?> )"}]}, <?php } else { //print "Ole".intVal($d->params); //$date2=date_add($date, date_interval_create_from_date_string('+'.intVal($d->params).' seconds')); $ts2 = $ts + intVal($d->params); //print "ts2: ".$ts2." ts: ".$ts." dif: ".($ts2-$ts); $date2 = date_create(); date_timestamp_set($date2, $ts); // $date2=$date->add(new DateInterval('PT'.$d->params.'S')); //todo no suma be els segons ?> {"i":"blah","color":"#ff0000","c":[{"v":0},{"v":"Date( <?php print date_format($date2, "Y,m,d,H,i,s"); ?> )"}]}, <?php } } } $c++; } ?> ]} <?php exit; }
/** * Creates a new Sessions for the specified player * * @param Player $player * @return BaseSession */ public function createSession(Player $player) { $spl = spl_object_hash($player); if (!isset($this->sessions[$spl])) { $this->getLogger()->debug("Creating player session file..."); $cfg = $this->getSessionFile($player->getName()); $tValues = $cfg->getAll(); $values = BaseSession::$defaults; foreach ($tValues as $k => $v) { $values[$k] = $v; } $this->getLogger()->debug("Creating virtual session..."); $this->getServer()->getPluginManager()->callEvent($ev = new SessionCreateEvent($this, $player, $values)); $this->getLogger()->debug("Setting up new values..."); $values = $ev->getValues(); $m = BaseSession::$defaults["isMuted"]; $mU = BaseSession::$defaults["mutedUntil"]; if (isset($values["isMuted"])) { if (!isset($values["mutedUntil"])) { $values["mutedUntil"] = null; } $m = $values["isMuted"]; if (is_int($t = $values["mutedUntil"])) { $date = new \DateTime(); $mU = date_timestamp_set($date, $values["mutedUntil"]); } else { $mU = $values["mutedUntil"]; } unset($values["isMuted"]); unset($values["mutedUntil"]); } $n = $player->getName(); if (isset($values["nick"])) { $n = $values["nick"]; $this->getLogger()->info($player->getName() . " is also known as " . $n); unset($values["nick"]); } $v = BaseSession::$defaults["isVanished"]; $vNP = BaseSession::$defaults["noPacket"]; if (isset($values["isVanished"])) { if (!isset($values["noPacket"])) { $values["noPacket"] = false; } $v = $values["isVanished"]; $vNP = $values["noPacket"]; unset($values["isVanished"]); unset($values["noPacket"]); } $this->getLogger()->debug("Setting up final values..."); $this->sessions[$spl] = new BaseSession($this, $player, $cfg, $values); $this->setMute($player, $m, $mU); $this->setNick($player, $n); $this->setVanish($player, $v, $vNP); } return $this->sessions[$spl]; }
public function toLdapDateTimeProvider() { $tz = new DateTimeZone('UTC'); return array(array(array('date' => 0, 'utc' => true), '19700101000000Z'), array(array('date' => new DateTime('2010-05-12 13:14:45+0300', $tz), 'utc' => false), '20100512131445+0300'), array(array('date' => new DateTime('2010-05-12 13:14:45+0300', $tz), 'utc' => true), '20100512101445Z'), array(array('date' => '2010-05-12 13:14:45+0300', 'utc' => false), '20100512131445+0300'), array(array('date' => '2010-05-12 13:14:45+0300', 'utc' => true), '20100512101445Z'), array(array('date' => DateTime::createFromFormat(DateTime::ISO8601, '2010-05-12T13:14:45+0300'), 'utc' => true), '20100512101445Z'), array(array('date' => DateTime::createFromFormat(DateTime::ISO8601, '2010-05-12T13:14:45+0300'), 'utc' => false), '20100512131445+0300'), array(array('date' => date_timestamp_set(new DateTime(), 0), 'utc' => true), '19700101000000Z')); }
//Sunrise if (!empty($json_o->daily->data[0]->sunriseTime)) { //converting the time obtained to the local time zone of the states $sunr = $json_o->daily->data[0]->sunriseTime; $date = date_create("", timezone_open($json_o->timezone)); date_timestamp_set($date, $sunr); $sunrise = date_format($date, 'h:i A'); } else { $sunrise = NULL; } //Sunset if (!empty($json_o->daily->data[0]->sunsetTime)) { //converting the time obtained to the local time zone of the states $suns = $json_o->daily->data[0]->sunsetTime; $date = date_create("", timezone_open($json_o->timezone)); date_timestamp_set($date, $suns); $sunset = date_format($date, 'h:i A'); } else { $sunset = NULL; } //div block to show the results echo "<div id=\"div2\">"; echo "<table class=\"one\">"; echo "<tr><th colspan=\"2\">{$weather_condition}</th></tr>"; echo "<tr><th colspan=\"2\">{$temperature}</th></tr>"; echo "<tr><th colspan=\"2\"><img src='{$icon_img}' alt='Weather Pic' title='{$weather_condition}'></th></tr>"; echo "</table>"; echo "<table class=\"two\""; echo "<tr><td>Precipitation:</td><td>{$precip}</td></tr>"; echo "<tr><td>Chance of Rain:</td><td>{$rain}</td></tr>"; echo "<tr><td>Wind Speed:</td><td>{$wind_speed}</td></tr>";
<?php $dftz021 = date_default_timezone_get(); //UTC $dtms021 = new DateTime(); date_timestamp_set($dtms021, 123456789, 'error');
function logout($ouath_key) { $profile_id = get_profile_id_from_oauth($ouath_key); include 'sql.php'; $sql = "SET foreign_key_checks = 0"; $res = $conn->query($sql); $sql = "DELETE FROM " . $dbname . ".oauth where oauth_key='{$ouath_key}'"; // echo $sql; $res_del = $conn->query($sql); $sql = "SET foreign_key_checks = 1"; $res = $conn->query($sql); if ($res_del) { /* * write to logs */ date_default_timezone_set('Asia/Calcutta'); $date = date_create(); date_timestamp_set($date, time()); $dtm = date_format($date, "Y-m-d H:i:s"); $device = get_device_deatil_from_oauth($ouath_key); $sql = "insert into " . $dbname . ".logs(profile_id,state,mytime,oauth_key,device) value ({$profile_id},'logout','{$dtm}','{$ouath_key}','{$device}')"; $result = $conn->query($sql); // echo $profile_id; // exit; //header("Location: " .$GLOBALS['login_url']); $result_array = array('status' => 'Success', 'message' => 'You are logged out'); print_r(json_encode($result_array)); } else { $result_array = array('status' => 'Error', 'message' => 'Ouath do not exist'); print_r(json_encode($result_array)); } $conn->close(); }
<?php $dftz021 = date_default_timezone_get(); //UTC date_timestamp_set(987654321, 123456789);
function check_this($time, $unitList, $s, $now) { $nowObj = new DateTime(); date_timestamp_set($nowObj, $now); $diff = date_diff($time, $nowObj); $secondsDiff = $time->getTimestamp() - $now; $Year = $s[0] . intval($secondsDiff / 31536000) . " " . $s[1] . "s?," . $s[14] . " "; $Month = $s[2] . intval($secondsDiff / 2628000) . " " . $s[3] . "s?," . $s[14] . " "; $Week = $s[4] . intval($secondsDiff / 2628000) . " " . $s[5] . "s?," . $s[14] . " "; $Day = $s[6] . intval($secondsDiff / 86400) . " " . $s[7] . "s?," . $s[14] . " "; $Hour = $s[8] . intval($secondsDiff / 3600) . " " . $s[9] . "s?," . $s[14] . " "; $Minute = $s[10] . intval($secondsDiff / 60) . " " . $s[11] . "s?," . $s[14] . " "; $Second = $s[12] . $secondsDiff . " " . $s[13] . "(s)?," . $s[14] . " "; $secondFudge = $diff->s; //"(".($diff->s-1)."|".$diff->s."|".($diff->s+1).")"; //Test takes too long! if (get_option("fergcorp_countdownTimer_showYear")) { $Year = $s[0] . $diff->y . " " . $s[1] . "(s)?," . $s[14] . " "; $Month = $s[2] . $diff->m . " " . $s[3] . "s?," . $s[14] . " "; $Day = $s[6] . $diff->d . " " . $s[7] . "s?," . $s[14] . " "; $Hour = $s[8] . $diff->h . " " . $s[9] . "s?," . $s[14] . " "; $Minute = $s[10] . $diff->i . " " . $s[11] . "s?," . $s[14] . " "; $Second = $s[12] . $secondFudge . " " . $s[13] . "s?," . $s[14] . " "; } elseif (get_option("fergcorp_countdownTimer_showMonth")) { $secondsDiff = $secondsDiff - $diff->m * 2628000; $Day = $s[6] . $diff->d . " " . $s[7] . "s?," . $s[14] . " "; $Hour = $s[8] . $diff->h . " " . $s[9] . "s?," . $s[14] . " "; $Minute = $s[10] . $diff->i . " " . $s[11] . "s?," . $s[14] . " "; $Second = $s[12] . $secondFudge . " " . $s[13] . "s?," . $s[14] . " "; } elseif (get_option("fergcorp_countdownTimer_showWeek")) { $Week = $s[4] . intval($diff->days / 7) . " " . $s[5] . "s?," . $s[14] . " "; $Day = $s[6] . $diff->d % 7 . " " . $s[7] . "s?," . $s[14] . " "; $Hour = $s[8] . $diff->h . " " . $s[9] . "s?," . $s[14] . " "; $Minute = $s[10] . $diff->i . " " . $s[11] . "s?," . $s[14] . " "; $Second = $s[12] . $secondFudge . " " . $s[13] . "s?," . $s[14] . " "; } elseif (get_option("fergcorp_countdownTimer_showDay")) { $secondsDiff = $secondsDiff - $diff->d * 86400; $Hour = $s[8] . $diff->h . " " . $s[9] . "s?," . $s[14] . " "; $Minute = $s[10] . $diff->i . " " . $s[11] . "s?," . $s[14] . " "; $Second = $s[12] . $secondFudge . " " . $s[13] . "s?," . $s[14] . " "; } elseif (get_option("fergcorp_countdownTimer_showHour")) { $secondsDiff = $secondsDiff - $diff->h * 3600; $Minute = $s[10] . $diff->i . " " . $s[11] . "s?," . $s[14] . " "; $Second = $s[12] . $secondFudge . " " . $s[13] . "s?," . $s[14] . " "; } elseif (get_option("fergcorp_countdownTimer_showMinute")) { $secondsDiff = $secondsDiff - $diff->s * 60; $Second = $s[12] . $secondFudge . " " . $s[13] . "s?," . $s[14] . " "; } foreach ($unitList as $unit) { if (get_option("fergcorp_countdownTimer_show{$unit}")) { $unitValue[$unit] .= ${$unit}; } } $testOfUnits = ""; foreach ($unitList as $unit) { if (get_option("fergcorp_countdownTimer_show{$unit}")) { $testOfUnits .= ${$unit}; } } //print $testOfUnits."\n\n"; return $testOfUnits; }
function get_form_status($user_id, $form, $data, &$text, &$button) { $text = ''; $button = ''; $context = context_system::instance(); // Get the Student Central ID and relevant name $sc = get_complete_user_data('username', 'csa'); // Student Central (CSA/SC) $sc_id = $sc->id; if ($form->modular) { // Use the SCAT details (UMP) $sc = get_complete_user_data('username', 'scat'); } $sc_name = $sc->alternatename; // Prepare the submission/authorisation trail $date = date_create(); $format = 'd-m-y H:i'; if ($data->authorisation_level > 0) { // Author has submitted the form date_timestamp_set($date, $data->date); $text .= date_format($date, $format) . ' '; if ($data->author == $user_id) { $name = 'you'; } else { if ($data->author == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->author); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } } $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('submitted', 'local_obu_forms'), 'by' => $name)); $text .= '<br />'; // Authorisation level 1 if ($data->authorisation_level == 1 && $data->authorisation_state > 0) { // The workflow ended here date_timestamp_set($date, $data->auth_1_date); $text .= date_format($date, $format) . ' '; if ($data->auth_1_id == $user_id) { $name = 'you'; } else { if ($data->auth_1_id == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->auth_1_id); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } } if ($data->authorisation_state == 1) { $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('rejected', 'local_obu_forms'), 'by' => $name)); } else { $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('authorised', 'local_obu_forms'), 'by' => $name)); } $text .= ' ' . $data->auth_1_notes . '<br />'; } else { if ($data->authorisation_level > 1) { // We've passed this level if ($data->auth_1_id != 0) { // Include level in trail only if it wasn't skipped date_timestamp_set($date, $data->auth_1_date); $text .= date_format($date, $format) . ' '; if ($data->auth_1_id == $user_id) { $name = 'you'; } else { if ($data->auth_1_id == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->auth_1_id); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } } $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('authorised', 'local_obu_forms'), 'by' => $name)); $text .= ' ' . $data->auth_1_notes . '<br />'; } // Authorisation level 2 if ($data->authorisation_level == 2 && $data->authorisation_state > 0) { // The workflow ended here date_timestamp_set($date, $data->auth_2_date); $text .= date_format($date, $format) . ' '; if ($data->auth_2_id == $user_id) { $name = 'you'; } else { if ($data->auth_2_id == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->auth_2_id); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } } if ($data->authorisation_state == 1) { $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('rejected', 'local_obu_forms'), 'by' => $name)); } else { $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('authorised', 'local_obu_forms'), 'by' => $name)); } $text .= ' ' . $data->auth_2_notes . '<br />'; } else { if ($data->authorisation_level > 2) { // We've passed this level if ($data->auth_2_id != 0) { // Include level in trail only if it wasn't skipped date_timestamp_set($date, $data->auth_2_date); $text .= date_format($date, $format) . ' '; if ($data->auth_2_id == $user_id) { $name = 'you'; } else { if ($data->auth_2_id == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->auth_2_id); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } } $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('authorised', 'local_obu_forms'), 'by' => $name)); $text .= ' ' . $data->auth_2_notes . '<br />'; } // Authorisation level 3 if ($data->authorisation_level == 3 && $data->authorisation_state > 0) { // The workflow ended here date_timestamp_set($date, $data->auth_3_date); $text .= date_format($date, $format) . ' '; if ($data->auth_3_id == $user_id) { $name = 'you'; } else { if ($data->auth_3_id == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->auth_3_id); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } } if ($data->authorisation_state == 1) { $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('rejected', 'local_obu_forms'), 'by' => $name)); } else { $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('authorised', 'local_obu_forms'), 'by' => $name)); } $text .= ' ' . $data->auth_3_notes . '<br />'; } else { if ($data->authorisation_level > 3) { // We've passed this level if ($data->auth_3_id != 0) { // Include level in trail only if it wasn't skipped date_timestamp_set($date, $data->auth_3_date); $text .= date_format($date, $format) . ' '; if ($data->auth_3_id == $user_id) { $name = 'you'; } else { if ($data->auth_3_id == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->auth_3_id); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } } $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('authorised', 'local_obu_forms'), 'by' => $name)); $text .= ' ' . $data->auth_3_notes . '<br />'; } // Authorisation level 4 if ($data->authorisation_level == 4 && $data->authorisation_state > 0) { // The workflow ended here date_timestamp_set($date, $data->auth_4_date); $text .= date_format($date, $format) . ' '; if ($data->auth_4_id == $user_id) { $name = 'you'; } else { if ($data->auth_4_id == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->auth_4_id); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } } if ($data->authorisation_state == 1) { $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('rejected', 'local_obu_forms'), 'by' => $name)); } else { $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('authorised', 'local_obu_forms'), 'by' => $name)); } $text .= ' ' . $data->auth_4_notes . '<br />'; } else { if ($data->authorisation_level > 4) { // We've passed this level if ($data->auth_4_id != 0) { // Include level in trail only if it wasn't skipped date_timestamp_set($date, $data->auth_4_date); $text .= date_format($date, $format) . ' '; if ($data->auth_4_id == $user_id) { $name = 'you'; } else { if ($data->auth_4_id == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->auth_4_id); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } } $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('authorised', 'local_obu_forms'), 'by' => $name)); $text .= ' ' . $data->auth_4_notes . '<br />'; } // Authorisation level 5 (the last possible one) if ($data->authorisation_state > 0) { // The workflow ended here date_timestamp_set($date, $data->auth_5_date); $text .= date_format($date, $format) . ' '; if ($data->auth_5_id == $user_id) { $name = 'you'; } else { if ($data->auth_5_id == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->auth_5_id); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } } if ($data->authorisation_state == 1) { $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('rejected', 'local_obu_forms'), 'by' => $name)); } else { $text .= get_string('actioned_by', 'local_obu_forms', array('action' => get_string('authorised', 'local_obu_forms'), 'by' => $name)); } $text .= ' ' . $data->auth_5_notes . '<br />'; } } } } } } } } } } // If the state is zero, display the next action required. Otherwise, the form has already been rejected or processed if ($data->authorisation_state == 0) { // Awaiting submission/rejection/authorisation from someone if ($data->authorisation_level == 0) { // Author hasn't submitted the form if ($data->author == $user_id) { $name = 'you'; $button = 'submit'; } else { if ($data->author == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $data->author); $name = $authoriser->firstname . ' ' . $authoriser->lastname; } $button = 'continue'; } $text .= '<p />' . get_string('awaiting_action', 'local_obu_forms', array('action' => get_string('submission', 'local_obu_forms'), 'by' => $name)); } else { if ($data->authorisation_level == 1) { $authoriser_id = $data->auth_1_id; } else { if ($data->authorisation_level == 2) { $authoriser_id = $data->auth_2_id; } else { if ($data->authorisation_level == 3) { $authoriser_id = $data->auth_3_id; } else { if ($data->authorisation_level == 4) { $authoriser_id = $data->auth_4_id; } else { $authoriser_id = $data->auth_5_id; } } } } if ($authoriser_id == $user_id || $authoriser_id == $sc_id && is_manager($form)) { $name = 'you'; $button = 'authorise'; } else { if ($authoriser_id == $sc_id) { $name = $sc_name; } else { $authoriser = get_complete_user_data('id', $authoriser_id); $name = $authoriser->firstname . ' ' . $authoriser->lastname; if ($authoriser->username == 'csa-tbd') { // Authoriser TBD so highlight $name = "<span style='color:red'>" . $name . "</span>"; } } $button = 'continue'; } $text .= '<p />' . get_string('awaiting_action', 'local_obu_forms', array('action' => get_string('authorisation', 'local_obu_forms'), 'by' => $name)); } } else { // Form processed - nothing more to say... $button = 'continue'; } }
* @var app\modules\yboard\models\YBoardMember $model */ $this->title = YBoard::t('yboard', 'User CP - {name}', ['name' => Html::encode($model->profile->fullname)]); $this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'] = [['label' => YBoard::t('yboard', 'Forums'), 'url' => ['forum/index']], ['label' => YBoard::t('yboard', 'Members List'), 'url' => ['index']], $this->title]; ?> <?php $birthday = $this->context->module->birthdateColumn; $gender = $this->context->module->genderColumn; $regdate = $this->context->module->regdateColumn; $timezone = isset($model->profile->timezone) ? new DateTimeZone($model->profile->timezone) : new DateTimeZone(); ?> <?php $basicInfo = DetailView::widget(['model' => $model, 'options' => ['class' => 'table table-striped detail-view'], 'attributes' => [['label' => YBoard::t('yboard', 'Birthday'), 'value' => $birthday == null ? YBoard::t('yboard', 'None') : $model->profile->{$birthday}], ['label' => YBoard::t('yboard', 'Gender'), 'value' => $model->profile->{$gender} == 1 ? YBoard::t('yboard', 'Male') : YBoard::t('yboard', 'Female')], ['label' => YBoard::t('yboard', 'Joined'), 'value' => $regdate == null ? YBoard::t('yboard', 'None') : date_format(date_timezone_set(date_timestamp_set(date_create(), $model->profile->{$regdate}), $timezone), 'l, d-M-y H:i T')], 'location', 'signature', 'status']]); ?> <?php $foroStatistics = DetailView::widget(['model' => $model, 'options' => ['class' => 'table table-striped detail-view'], 'attributes' => [['label' => YBoard::t('yboard', 'Last Visit'), 'value' => date_format(date_timezone_set(date_create($model->last_visit), $timezone), 'l, d-M-y H:i T')], 'appreciations', 'startedTopics', 'totalReplies', 'recentTopics:html']]); ?> <?php $webInfo = DetailView::widget(['model' => $model, 'options' => ['class' => 'table table-striped detail-view'], 'attributes' => [['attribute' => 'blogger', 'visible' => trim($model->blogger) != ""], ['attribute' => 'contact_email', 'value' => $model->contact_email == 0 ? YBoard::t('yboard', 'Forbidden') : YBoard::t('yboard', 'Allowed')], ['attribute' => 'contact_pm', 'value' => $model->contact_pm == 0 ? YBoard::t('yboard', 'Forbidden') : YBoard::t('yboard', 'Allowed')], ['attribute' => 'facebook', 'visible' => trim($model->facebook) != ""], ['attribute' => 'skype', 'visible' => trim($model->skype) != ""], ['attribute' => 'google', 'visible' => trim($model->google) != ""], ['attribute' => 'linkedin', 'visible' => trim($model->linkedin) != ""], ['attribute' => 'metacafe', 'visible' => trim($model->metacafe) != ""], ['attribute' => 'github', 'visible' => trim($model->github) != ""], ['attribute' => 'orkut', 'visible' => trim($model->github) != ""], ['attribute' => 'orkut', 'visible' => trim($model->orkut) != ""], ['attribute' => 'tumblr', 'visible' => trim($model->tumblr) != ""], ['attribute' => 'twitter', 'visible' => trim($model->twitter) != ""], ['attribute' => 'website', 'visible' => trim($model->website) != ""], ['attribute' => 'wordpress', 'visible' => trim($model->wordpress) != ""], ['attribute' => 'yahoo', 'visible' => trim($model->yahoo) != ""], ['attribute' => 'youtube', 'visible' => trim($model->youtube) != ""]]]); ?>
<?php $view_achieve = mysqli_query($conn, "SELECT * FROM achievements ORDER BY time DESC "); $count = 0; while ($row = mysqli_fetch_array($view_achieve, MYSQLI_BOTH)) { $count++; if ($count == 50) { break; } $sid = $row['sid']; $time = $row['time']; $subject = $row['subject']; $aid = $row['aid']; $details = $row['details']; $aname = mysqli_fetch_array(mysqli_query($conn, "SELECT name FROM users WHERE username = '******' "), MYSQLI_BOTH)['name']; $date = date_create(); date_timestamp_set($date, $time); $original_time = date_format($date, 'M d,Y'); echo '<li> <a href="#"> <div> <strong>' . $aname . '</strong> <span class="pull-right text-muted"> <em>' . $original_time . '</em> </span> </div> <div>' . $subject . '</div> <div>' . $details . '</div> </a> </li> <li class="divider"></li>'; }
// $data = array_slice($value[6],$value[7],$value[8]); $data = substr($value[6], $value[7]); /* 1 : COPIO I DATI RAW IN UN FILE PER SUCCESSIVA ELABORAZIONE */ /* IL FILE GENERATO SARA' SEMPRE "SIG_IDSENSOR_TIMESTAMP.dat" */ $sig1 = fopen("SEGNALI/SIG_" . $value[1] . "_" . $value[2] . ".dat", 'wb'); fwrite($sig1, $data); fclose($sig1); /*2 : Calcolo i valori di noise Logger */ // echo("octave --silent ./OCTAVE/NoiseLogger.m ./SEGNALI/SIG_".$value[1]."_".$value[2].".dat 1 ".$value[5]." > /dev/null"); exec("octave --silent ./OCTAVE/NoiseLogger.m ./SEGNALI/SIG_" . $value[1] . "_" . $value[2] . ".dat 1 " . $value[5] . " > /dev/null"); $new_doc = new stdClass(); $new_doc->type = "misura"; $new_doc->id_cluster = $value[0]; $new_doc->sensor = $value[1]; // date_timestamp_set($date, intval($value[2])/1000); date_timestamp_set($date, intval($value[2])); $new_doc->dataora = date_format($date, 'Y-m-d H:i:s'); $new_doc->timestamp_misura = $value[2] . "000"; $new_doc->timestamp_insert = $value[3] . "000"; $new_doc->num_sample = $value[8]; $new_doc->f_sampling = $value[5]; $sig1 = fopen("./frequenze_max.dat", 'rb'); $singolo = fread($sig1, 4); $new_doc->freq_max = unpack("l", $singolo)[1]; fclose($sig1); /*****************************************************************/ $sig1 = fopen("./minimi_min.dat", 'rb'); $singolo = fread($sig1, 4); $new_doc->minimi_min = unpack("l", $singolo)[1]; fclose($sig1); /*****************************************************************/
echo "differnce in time between {$to_time} , {$from_time}: "; $duration_min = round(abs($to_time - $from_time) / 60, 2) . " minute"; echo "{$duration_min}"; if ($duration_min > 180) { // if duration is more than 3 hrs.. then shouldn't proceed echo "<br><br> Can't reserve a room for more than 3 hrs!!"; echo "<br> <br> Click <a href=\"ReserveRoom.php\">here </a>to go Back to previous Page: Room Reservations"; exit(0); } echo "<br><br>"; echo "DATETIME in USA FORMAT"; echo "<br><br>"; $date = date_create(); date_format($date, 'm-d-Y H:i:s'); $startDateUSA = date_format(date_timestamp_set($date, $from_time), 'd/M/Y h:i:s A'); $endDateUSA = date_format(date_timestamp_set($date, $to_time), 'd/M/Y h:i:s A'); echo "startDateTime " . $startDateUSA . "\n"; echo "<br><br>"; echo "endDateTime " . $endDateUSA . "\n"; echo "<br><br>"; $selectRoomQuery = "SELECT r.\"RoomNumber\",r.\"Location\",r.\"Floor\"\nFROM ROOM r\nWHERE r.\"RoomNumber\" NOT IN (\nSELECT rr.\"RoomNumber\" FROM ROOM_RESERVATION rr\nWHERE NOT (rr.\"EndTime\" < CAST('{$startDateUSA}' AS TIMESTAMP)\nOR\nrr.\"StartTime\" > CAST('{$endDateUSA}' AS TIMESTAMP)))\nAND r.\"Capacity\" >= {$occupancy}\nAND r.\"Type\" = '{$type}'\nORDER BY r.\"RoomNumber\""; var_dump($selectRoomQuery); $stid = oci_parse($conn, $selectRoomQuery); $result = oci_execute($stid); echo "<table border=\"2\">"; echo "<tr>"; echo "<td>"; echo "Room No "; echo "</td>"; echo "<td>"; echo "Location ";
function timestamp_to_datetime($timestamp, $date_format) { $date = date_create(); date_timestamp_set($date, $timestamp); return date_format($date, $date_format); }