} $s = ""; if (isset($qastep)) { // PROCESS POSTED UPDATES.. if (isset($submit) && $submit == "Update") { if ($project->request_id > 0) { // Possible approval type updates.. if ($project->POSTprocess_approval_updates($qastep->qa_step_id)) { $project->get_project(); } // Possible assignment/re-assignment.. if (isset($new_assignment)) { if ($new_assignment != $qastep->responsible_usr) { // First, save the assignment.. $qastep->responsible_usr = $new_assignment != "" ? $new_assignment : NULLVALUE; $qastep->responsible_datetime = timestamp_to_datetime(); $qastep->save(); // Save current phase to project record.. $q = "UPDATE request_project SET"; $q .= " qa_phase='{$qastep->qa_phase}'"; $q .= " WHERE request_id={$qastep->project_id}"; $qry = new PgQuery($q); $ok = $qry->Exec("qams-step-detail.php::assignment"); // Re-read to get new user name and email.. $qastep->get($project->request_id, $qastep->qa_step_id); // If we are assigning someone, then let everyone know. Otherwise a null // assignment is de-assigning somebody, which we keep quiet about.. if ($new_assignment != "") { $qry = new PgQuery("SELECT email, fullname FROM usr WHERE user_no={$new_assignment}"); if ($qry->Exec("qams-step-detail.php::new_assignment") && $qry->rows > 0) { $row = $qry->Fetch();
function update_submit_date() { $query = $this->db->query("SELECT Submission_Date, Timestamp, ID FROM leads WHERE 1"); foreach ($query->result() as $row) { $timestamp = $row->Timestamp; $datetime = timestamp_to_datetime($timestamp, 'Y-m-d H:i:s'); $qry = 'UPDATE leads SET submit_date = DATE_ADD("' . $datetime . '",INTERVAL 330 MINUTE) WHERE ID = ' . $row->ID; $this->db->query($qry); //echo '<br>'.$qry; } }
/** * Conversion: descriptive to datetime. * Converts a descriptive date/time string into a database * compatible 'datetime' field as per Postgres ISO spec. * @param string $displaydate Date in any 'descriptive' format * @return string Datetime string in Postgres YYYY-MM-DD HH:MM:SS format */ function displaydate_to_datetime($displaydate) { return timestamp_to_datetime(displaydate_to_timestamp($displaydate)); }
} } } else { if ($cmd == "update") { if (!isset($_GET["ExamName"]) || !isset($_GET["ExamDesc"]) || !isset($_GET["Duration"]) || !isset($_GET["ExamBeginTime"]) || !isset($_GET["ExamEndTime"])) { echo ERR_INVALID_PARAMETER; return; } $ExamName = $_GET["ExamName"]; $ExamDesc = $_GET["ExamDesc"]; $Duration = $_GET["Duration"]; $ExamBeginTime = $_GET["ExamBeginTime"]; $ExamEndTime = $_GET["ExamEndTime"]; $ExamPassword = $_GET["ExamPassword"]; $from_datetime = timestamp_to_datetime($ExamBeginTime); $end_datetime = timestamp_to_datetime($ExamEndTime); // ID check $str_query = "Select * from exams where ExamId='{$ExamId}'"; if ($result = mysqli_query($link, $str_query)) { $row_number = mysqli_num_rows($result); if ($row_number == 0) { echo ERR_EXAM_NOT_EXIST; return; } } $str_query1 = <<<EOD Update exams set ExamName='{$ExamName}', ExamDesc='{$ExamDesc}', Duration={$Duration}, ExamBegin='{$from_datetime}', ExamPassword = '******', ExamEnd='{$end_datetime}', EditUser={$user_id}, EditTime=now() where ExamId={$ExamId} EOD; if (mysqli_query($link, $str_query1)) {
return; } if (($exam_qualify_percent = check_number($_POST["exam_qualify_percent"])) == SYMBOL_ERROR) { sleep(DELAY_SEC); echo SYMBOL_ERROR; return; } $exam_password = ""; if ($exam_location == ONSITE_TEST) { //$exam_password = get_random_password(); $exam_password = $_POST["exam_pwd"]; } $exam_status = EXAM_INACTIVE; // begin, end $sql_begin_datetime = timestamp_to_datetime($from_timestamp); $sql_end_datetime = timestamp_to_datetime($to_timestamp); // get all function name $functions_name = array(); // exam rule settings $select_problems = array(); if (isset($_POST["select_problems"])) { $select_problems = $_POST["select_problems"]; //print_r($select_problems); } $problem_sets = array(); if (isset($_POST["problem_sets"])) { $problem_sets = $_POST["problem_sets"]; //print_r($problem_sets); } else { sleep(DELAY_SEC); //echo SYMBOL_ERROR;