public function save($id = null) { $this->load->helper('memberspace/authorization'); $this->load->helper('flashmessages/flashmessages'); $this->load->model('memberspace/user'); $this->load->helper('form'); $datas = array(); if (isset($_POST) && isset($_POST['save-user'])) { $datas = $_POST; unset($_POST['save-user']); if (isset($_POST['id']) && $_POST['id']) { if (!user_can('update', 'user', $_POST['id'])) { add_error(translate('Vous ne pouvez pas modifier cet utilisateur')); } } else { if (!user_can('add', 'user', $_POST['id'])) { add_error(translate('Vous ne pouvez pas ajouter d\'utilisateur')); } } if ($this->user->fromPost() !== false) { add_success(translate('L\'utilisateur a bien été ajouté')); redirect('bo/users/all'); } else { add_error($this->form_validation->error_string()); } } else { if ($id) { $datas = $this->user->getId($id, 'array'); } } return $datas; }
public function save($userModel = 'memberspace/user', $mailRedirect = 'memberspace/confirmation/confirm', $redirect = null) { $post = $this->input->post(); $modelName = pathinfo($userModel)['filename']; if (!$post || !isset($post['save-' . $modelName])) { return array(); } unset($_POST['save-' . $modelName]); $this->load->library('form_validation'); if (isset($post['id']) && !user_can('update', $userModel, $post['id'])) { return $post; } $this->load->model($userModel); $userId = $this->{$modelName}->fromPost(); if ($userId === false) { add_error($this->form_validation->error_string()); return $post; } if (!isset($post['id'])) { $this->sendMailConfirmation($userId, $mailRedirect); add_success('Vous avez bien été inscrit !'); } else { add_success('Vous avez bien mis à jour vos informations'); } if ($redirect) { redirect($redirect); } return $post; }
function save_class() { //add message to alert array include "../app/student/studentmanager.php"; $connection = db_connect(); //connect to database $class = $_SESSION['class']; $teacherid = $_SESSION['id']; $classname = $class['name'][0]; $query = "INSERT INTO `project`.`class` (`id`, `teacher_id`, `class_group`) VALUES (NULL, '{$teacherid}', '{$classname}')"; $result = mysqli_query($connection, $query); //perform query $classid = mysqli_insert_id($connection); if ($result) { //check if query ran for ($i = 0; $i < count($class['fname']); $i++) { create_student($class['fname'][$i], $class['lname'][$i], $classid); } add_success("Class Created."); clear_class(); } else { add_error("Class not created, Error in SQL"); } db_close($connection); }
public function delete() { global $db; $query = "DELETE FROM `student_leaves_of_absence` where `id`=" . $db->qstr($this->id); if (!$db->Execute($query)) { add_error("Failed to remove leave of absence from database."); application_log("error", "Unable to delete a student_leaves_of_absence record. Database said: " . $db->ErrorMsg()); } else { add_success("Successfully removed Leave of Absence."); } }
public function delete() { global $db; $query = "DELETE FROM `student_formal_remediations` where `id`=" . $db->qstr($this->id); if (!$db->Execute($query)) { add_error("Failed to remove formal remediation from database."); application_log("error", "Unable to delete a student_formal_remediations record. Database said: " . $db->ErrorMsg()); } else { add_success("Successfully removed Formal Remediation."); } }
function login_user($email, $pass) { $pass = sha1($pass); $connection = db_connect(); $query = 'SELECT * FROM `project`.`teacher` WHERE `email` = "' . $email . '" AND pass = "******"'; //create login query $result = mysqli_query($connection, $query); //perform login query if ($result) { //check if query ran if (mysqli_num_rows($result) > 0) { //if any logins are found //session_clear(); //clear current session variables //username details $resultset = mysqli_fetch_assoc($result); //get array of values from database $_SESSION['email'] = $resultset['email']; //Set details as session variables $_SESSION['id'] = $resultset['id']; $_SESSION['firstname'] = $resultset['firstname']; $_SESSION['lastname'] = $resultset['lastname']; $_SESSION['school'] = $resultset['school']; add_success($resultset['firstname'] . " " . $resultset['lastname'] . " Logged in Successfully"); db_close($connection); header('location: dashboard/classview.php'); die; } else { add_error("Login Incorrect"); //add error message db_close($connection); header('location: index.php'); die; } } else { add_error("Login Mysql didnt work."); db_close($connection); header('location: index.php'); die; } }
public function save($mailRedirect = 'memberspace/confirmation/confirm', $redirect = null) { $rules = Modules::load_multiple('form_validation', 'memberspace', 'config/', 'config'); $post = $this->input->post(); if (!$post) { return array(); } $this->load->library('form_validation'); if (!isset($rules['myuser'])) { return $post; } $this->form_validation->set_rules($rules['myuser']); if (!$this->form_validation->run()) { add_error($this->form_validation->error_string()); return $post; } unset($_POST['save-user']); $this->load->model('myuser'); $post = $this->input->post(); if (isset($post['id']) && !user_can('update', 'user', $post['id'])) { return $post; } // It's important to make a call to $this->input->post() again $userId = $this->myuser->save($post); if (!isset($post['id'])) { $this->sendMailConfirmation($userId, $mailRedirect); $this->load->model('memberspace/right'); $this->right->allowUserTo($userId, '*', 'user', $userId); $this->user->addToGroup('users', $userId); add_success('Vous avez bien été inscrit !'); } else { add_success('Vous avez bien mis à jour vos informations'); } if ($redirect) { redirect($redirect); } return $post; }
public function save($id = null, $userModel = 'memberspace/user') { $userModel = $this->filterModel($userModel); $model = pathinfo($userModel)['filename']; $this->load->helper('memberspace/authorization'); $this->load->helper('flashmessages/flashmessages'); $this->load->model($userModel); $this->load->helper('form'); $datas = array(); if (isset($_POST) && isset($_POST['save-user'])) { $datas = $_POST; unset($_POST['save-user']); $is_update = false; if (isset($_POST['id']) && $_POST['id']) { $is_update = true; if (!user_can('update', $userModel, $_POST['id'])) { add_error(translate('Vous ne pouvez pas modifier cet utilisateur')); } } else { if (!user_can('add', $userModel)) { add_error(translate('Vous ne pouvez pas ajouter cet utilisateur')); } } if ($this->{$model}->fromPost()) { add_success(translate('L\'utilisateur a bien été ') . ($is_update ? translate('mis à jour') : translate('ajouté'))); redirect('bo/users/all/' . str_replace('/', '-', $userModel)); } else { add_error($this->form_validation->error_string()); } } else { if ($id) { $datas = $this->{$model}->getId($id, 'array'); } } return $datas; }
public function update(array $input_arr) { extract($input_arr); global $db; $query = "Update `student_clineval_comments` set `comment`=?, `source`=? where `id`=?"; if (!$db->Execute($query, array($text, $source, $this->id))) { add_error("Failed to update a clinical performance evaluation comment."); application_log("error", "Unable to update a student_clineval_comment record. Database said: " . $db->ErrorMsg()); } else { add_success("Successfully updated clinical performance evaluation."); } }
foreach ($_POST["remove_ids"] as $day_id) { if ($tmp_input = clean_input($day_id, "numeric")) { $PROCESSED["delete"][] = $tmp_input; $days[] = Models_RestrictedDays::fetchRow($tmp_input); } } } switch ($STEP) { case 2: foreach ($days as $day) { $day_data = $day->toArray(); $day_data["day_active"] = 0; if ($day->fromArray($day_data)->update()) { add_statistic("restricted_days", "delete", "orday_id", $day->getID(), $ENTRADA_USER->getID()); if (!$ERROR) { add_success("Successfully deleted the restricted day '<strong>" . $day->getName() . "</strong>'. You will now be redirected to the restricted days index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue."); } } else { add_error("Failed to delete the restricted day '<strong>" . $day->getName() . "</strong>', an Administrator has been informed, please try again later. You will now be redirected to the restricted days index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue."); application_log("Failed to delete restricted day, DB said: " . $db->ErrorMsg()); } } break; } switch ($STEP) { case 2: if ($ERROR) { echo display_error(); } if ($SUCCESS) { echo display_success();
} } if ($ERROR) { $STEP = 1; } break; } // Display Page switch ($STEP) { case 2: $query = "UPDATE `reports_aamc_ci` SET `report_active` = '0' WHERE `raci_id` IN (" . implode(", ", $report_ids) . ")"; if ($db->Execute($query)) { $url = ENTRADA_URL . "/admin/reports/aamc"; $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "', 5000)"; if ($total_removed = $db->Affected_Rows()) { add_success("You have successfully deactived " . $total_removed . " AAMC Curriculum Inventory Report" . ($total_removed != 1 ? "s" : "") . ".<br /><br />You will be automatically redirected to the event index in 5 seconds, or you can <a href=\"" . $url . "\">click here</a> if you do not wish to wait."); echo display_success(); application_log("success", "Successfully deactived raci_ids: " . implode(", ", $report_ids)); } else { add_error("We were unable to deactive the requested reports from the system. The system administrator has been informed of this issue and will address it shortly; please try again later."); echo display_error(); application_log("error", "Failed to deactivate any raci_ids: " . implode(", ", $report_ids) . ". Database said: " . $db->ErrorMsg()); } } else { add_error("We were unable to deactive the requested reports from the system. The system administrator has been informed of this issue and will address it shortly; please try again later."); echo display_error(); application_log("error", "Failed to execute deactivate query for raci_ids: " . implode(", ", $report_ids) . ". Database said: " . $db->ErrorMsg()); } break; case 1: default:
public function update(array $input_arr) { extract($input_arr); global $db; $query = "update `student_contributions` set\n\t\t\t\t `role`=?, `org_event`=?,`start_month`=?, `start_year`=?, `end_month`=?,`end_year`=?,`status`=?, `comment`=? \n\t\t\t\t where `id`=?"; if (!$db->Execute($query, array($role, $org_event, $start_month, $start_year, $end_month, $end_year, $status, $comment, $this->id))) { add_error("Failed to update contribution."); application_log("error", "Unable to update a student_contributions record. Database said: " . $db->ErrorMsg()); } else { add_success("Successfully updated contribution."); } }
if ($observership->delete()) { $deleted[] = $title; } else { add_error("An error ocurred while attempting to delete the observership <strong>" . $title . "</strong>. An administrator has been informed, please try again later.\n\t\t\t\t\t\t\t\t\t\t<br />You will be automatically redirected to the My Observerships page in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/profile/observerships\">click here</a>."); } } else { add_error("Unable to delete the observership <strong>" . $title . "</strong>, the status is " . $observership->getStatus() . "."); } } if ($deleted) { $message = "<pre>"; foreach ($deleted as $title) { $message .= " " . $title . "\n"; } $message .= "</pre>"; add_success("Successfully deleted the following observerships:<br />" . $message . "You will be automatically redirected to the My Observerships page in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/profile/observerships\">click here</a>."); } break; } switch ($STEP) { case 2: if ($SUCCESS) { echo display_success(); $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/profile/observerships\\'', 5000)"; } if ($ERROR) { echo display_error(); $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/profile/observerships\\'', 5000)"; } break; case 1:
/** * Remove all records from group_members table. */ $query = "DELETE FROM `course_group_audience` WHERE `cgroup_id` = " . $db->qstr($group_id); $db->Execute($query); $removed[$group_id]["group_name"] = $result["group_name"]; } /** * Remove group_id record from groups table. */ $query = "DELETE FROM `course_groups` WHERE `cgroup_id` = " . $db->qstr($group_id); break; } $db->Execute($query); if ($_POST["coa"] != "delete") { add_success("Successfully " . $_POST["coa"] . "d the course group."); } } } $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/courses/groups?id=" . $COURSE_ID . "\\'', 5000)"; if (!strcmp($_POST["coa"], "delete")) { if ($total_removed = @count($removed)) { $SUCCESS++; $SUCCESSSTR[$SUCCESS] = "You have successfully removed " . $total_removed . " group" . ($total_removed != 1 ? "s" : "") . " from the system:"; $SUCCESSSTR[$SUCCESS] .= "<div style=\"padding-left: 15px; padding-bottom: 15px; font-family: monospace\">\n"; foreach ($removed as $result) { $SUCCESSSTR[$SUCCESS] .= html_encode($result["group_name"]) . "<br />"; } $SUCCESSSTR[$SUCCESS] .= "</div>\n"; $SUCCESSSTR[$SUCCESS] .= "You will be automatically redirected to the group index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/admin/courses/groups?id=" . $COURSE_ID . "\">click here</a> if you do not wish to wait."; application_log("success", "Successfully removed group ids: " . implode(", ", $GROUP_IDS));
?> <h1>Delete Medbiquitous Instructional Methods</h1> <?php $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/settings/manage/medbiqinstructional?section=delete&org=" . $ORGANISATION['organisation_id'], "title" => "Deactivate Medbiquitous Instructional Method"); if (isset($_POST["remove_ids"]) && is_array($_POST["remove_ids"]) && !empty($_POST["remove_ids"])) { foreach ($_POST["remove_ids"] as $id) { $PROCESSED["remove_ids"][] = (int) $id; } } if ($PROCESSED["remove_ids"]) { switch ($STEP) { case 2: foreach ($_POST["remove_ids"] as $id) { $i_m = Models_MedbiqInstructionalMethod::get($id); if ($i_m->fromArray(array("active" => "0"))->update()) { add_success("Successfully deactivated Medbiquitous Instructional Method [" . $i_m->getInstructionalMethod() . "] from your organisation."); } else { add_error("An error occurred while deactivating the Medbiquitous Instructional Method [" . $id . "] from the system. The system administrator has been notified. You will now be redirected to the Medbiquitous Instructional Method index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/medbiqinstructional/?org=" . $ORGANISATION_ID . "\" style=\"font-weight: bold\">click here</a> to continue."); application_log("error", "An error occurred while removing the Medbiquitous Instructional Method [" . $id . "] from the system. "); } } if ($SUCCESS) { echo display_success(); } if ($NOTICE) { echo display_notice(); } $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/settings/manage/medbiqinstructional/?org=" . $ORGANISATION_ID . "\\'', 5000)"; break; case 1: default:
$ERROR++; } } else { application_log("error", "Unable to deactivate organisation_id [" . $id . "], user did not have delete permission."); $ERROR++; } } if (!$ERROR) { $success_string = "<br /><div style=\"padding-left: 15px; padding-bottom: 15px; font-family: monospace\">\n"; foreach ($organisations as $organisation_id => $result) { if (in_array($organisation_id, $PROCESSED["remove_ids"])) { $success_string .= html_encode($result["organisation_title"]) . "<br />"; } } $success_string .= "</div>\n"; add_success("You have successfully removed the following organisations from the system:<br />" . $success_string . "You will be automatically redirected to the event index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/admin/settings\">click here</a> if you do not wish to wait."); echo display_success(); $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/settings\\'', 5000)"; } else { add_error("An error occurred when trying to delete an organisation, a system administrator has been informed."); echo display_error(); $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/settings\\'', 5000)"; } break; default: add_notice("Please review the following organisations to ensure that you wish to <strong>permanently delete</strong> them."); echo display_notice(); ?> <div id="organisations-section"> <form action="<?php echo ENTRADA_URL;
$message .= ENTRADA_URL . "\n\n"; $message .= "Requested By:\t" . $_SERVER["REMOTE_ADDR"] . "\n"; $message .= "Requested At:\t" . date("r", time()) . "\n"; try { $mail = new Zend_Mail(); $mail->addHeader("X-Priority", "3"); $mail->addHeader("Content-Transfer-Encoding", "8bit"); $mail->addHeader("X-Originating-IP", $_SERVER["REMOTE_ADDR"]); $mail->addHeader("X-Section", "Password Reset"); $mail->addTo($email_address, $firstname . " " . $lastname); $mail->setFrom($AGENT_CONTACTS["administrator"]["email"], $AGENT_CONTACTS["administrator"]["name"]); $mail->setSubject("Password Reset - " . APPLICATION_NAME . " Authentication System"); $mail->setReplyTo($AGENT_CONTACTS["administrator"]["email"], $AGENT_CONTACTS["administrator"]["name"]); $mail->setBodyText($message); if ($mail->send()) { add_success("An e-mail has just been sent to <strong>" . html_encode($email_address) . "</strong> that contains further instructions on resetting your " . APPLICATION_NAME . " password. Please check your e-mail in a few minutes to proceed."); application_log("notice", "A password reset e-mail has just been sent for " . $username . " [" . $proxy_id . "]."); $email_address = ""; } else { add_error("We were unable to send you a password reset authorization e-mail at this time due to an unrecoverable error. The administrator has been notified of this error and will investigate the issue shortly.<br /><br />Please try again later, we apologize for any inconvenience this may have caused."); application_log("error", "Unable to send password reset notice as Zend_Mail's send function failed."); } } catch (Zend_Mail_Transport_Exception $e) { add_error("We were unable to send you a password reset authorization e-mail at this time due to an unrecoverable error. The administrator has been notified of this error and will investigate the issue shortly.<br /><br />Please try again later, we apologize for any inconvenience this may have caused."); application_log("error", "Unable to send password reset notice as Zend_Mail's send function failed: " . $e->getMessage()); } $_SESSION = array(); @session_destroy(); } else { add_error("We were unable to reset your password at this time due to an unrecoverable error. The administrator has been notified of this error and will investigate the issue shortly.<br /><br />Please try again later, we apologize for any inconvenience this may have caused."); application_log("error", "Unable to insert password reset query into " . AUTH_DATABASE . ".password_reset table. Database said: " . $db->ErrorMsg());
/** * Insert the target records into the evaluation_evaluators table. */ if (!empty($PROCESSED["evaluation_evaluators"])) { foreach ($PROCESSED["evaluation_evaluators"] as $result) { $record = array("evaluation_id" => $evaluation_id, "evaluator_type" => $result["evaluator_type"], "evaluator_value" => $result["evaluator_value"], "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()); if (!$db->AutoExecute("evaluation_evaluators", $record, "INSERT") || !($eevaluator_id = $db->Insert_Id())) { add_error("Unable to attach an evaluator to this evaluation. The system administrator has been notified of this error, please try again later."); application_log("Unable to attach target_id [" . $evaluation_target_id . "] / target_value [" . $target_value . "] to evaluation_id [" . $evaluation_id . "]. Database said: " . $db->ErrorMsg()); } } } if (!$ERROR) { $url = ENTRADA_URL . "/admin/evaluations"; $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)"; add_success("You have successfully added <strong>" . html_encode($PROCESSED["evaluation_title"]) . "</strong> to the system.<br /><br />You will now be redirected to the evaluation index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue."); application_log("success", "New evaluation [" . $evaluation_id . "] added to the system."); } } else { add_error("Unable to create new evaluation record at this time. The system administrator has been notified of this error, please try again later."); application_log("Unable to create new evaluation record. Database said: " . $db->ErrorMsg()); } /** * If there are errors, remove the already inserted records. */ if ($ERROR && $evaluation_id) { $db->Execute("DELETE FROM `evaluations` WHERE `evaluation_id` = " . $db->qstr($evaluation_id)); $db->Execute("DELETE FROM `evaluation_targets` WHERE `evaluation_id` = " . $db->qstr($evaluation_id)); $db->Execute("DELETE FROM `evaluation_evaluators` WHERE `evaluation_id` = " . $db->qstr($evaluation_id)); } }
public function update($id = false) { global $db; $id = (int) $id ? $id : $this->id; $data = $this->toArray(); if (!$db->AutoExecute("observership_reflections", $data, "UPDATE", "`id` = " . $db->qstr($id))) { add_error("Failed to update Observership Reflection."); application_log("error", "Unable to update a observership_reflections record. Database said: " . $db->ErrorMsg()); } else { add_success("Thank you, your observership reflection has been updated. You will be redirected to your observerships list in 5 seconds. Please <a href=\"" . ENTRADA_URL . "/profile/observerships\">click here</a> if you do not wish to wait."); return true; } }
$STEP = 2; } // Display Page switch ($STEP) { case 2: if ($MEMBERS) { // Delete members foreach ($USER_IDS as $proxy_id) { if ($GROUP_ID) { $db->Execute("DELETE FROM `group_members` WHERE `proxy_id` = " . $db->qstr($proxy_id) . " AND `group_id` = " . $db->qstr($GROUP_ID)); } else { $db->Execute("DELETE FROM `course_audience` WHERE `audience_type` = 'proxy_id' AND `course_id` = " . $db->qstr($COURSE_ID) . " AND `audience_value` = " . $db->qstr($proxy_id)); } } $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/courses/enrolment?id=" . $COURSE_ID . "\\'', 5000)"; add_success("Successfully updated course enrolment. You will be returned to the enrolment page in 5 seconds. To go there now <a href=\"" . ENTRADA_URL . "/admin/courses/enrolment?id=" . $COURSE_ID . "\"> click here</a>."); echo display_success(); } if ($ERROR) { $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/courses/enrolment?id=" . $COURSE_ID . "\\'', 5000)"; echo display_error(); } break; case 1: default: if ($ERROR) { $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/courses/enrolment?id=" . $COURSE_ID . "\\'', 5000)"; echo display_error(); } break; }
case "content": $url = ENTRADA_URL . "/admin/" . $MODULE . "?section=content&id=" . $COURSE_ID; $msg = "You will now be redirected to the course content page; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue."; break; case "new": $url = ENTRADA_URL . "/admin/" . $MODULE . "?section=add"; $msg = "You will now be redirected to add a new course; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue."; break; case "index": default: $url = ENTRADA_URL . "/admin/" . $MODULE; $msg = "You will now be redirected to the course index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue."; break; } $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)"; add_success("You have successfully edited <strong>" . html_encode($PROCESSED["course_name"]) . "</strong> in the system.<br /><br />" . $msg); application_log("success", $module_singular_name . " [" . $COURSE_ID . "] has been modified."); } } else { add_error("There was a problem updating this course in the system. The system administrator was informed of this error; please try again later."); application_log("error", "There was an error updating a course. Database said: " . $db->ErrorMsg()); } } if (has_error()) { $STEP = 1; } break; case 1: default: $PROCESSED = $course_details; break;
<?php include "../app/inc.php"; include "../app/student/studentmanager.php"; if (isset($_POST['student_fname']) && isset($_POST['student_lname']) && isset($_POST['student_id'])) { if (isset($_POST['student_fname']) && trim($_POST['student_fname']) !== '') { //if student fname is set and not empty if (isset($_POST['student_lname']) && trim($_POST['student_lname']) !== '') { //if student lname is set and not empty if (isset($_POST['student_id']) && trim($_POST['student_id']) !== '') { //if student id is set and not empty update_studentname($_POST['student_fname'], $_POST['student_lname'], $_POST['student_id']); add_success("Name Updated"); header('location: classview.php'); die; } } add_error("No Comprende" . $_POST['student_fname'] . " " . $_POST['student_lname'] . " " . $_POST['student_id']); header('location: classview.php'); die; } }
public function delete() { global $db; $query = "DELETE FROM `student_critical_enquiries` where `user_id`=?"; if (!$db->Execute($query, array($this->getID()))) { add_error("Failed to remove Critical Enquiry."); application_log("error", "Unable to delete a student_critical_enquiries record. Database said: " . $db->ErrorMsg()); } else { add_success("Successfully removed Critical Enquiry."); } }
switch (clean_input($_SESSION[APPLICATION_IDENTIFIER]["tmp"]["post_action"], "alpha")) { case "new": $url = ENTRADA_URL . "/admin/" . $MODULE . "?section=add-question&id=" . $RECORD_ID . "&type=" . ((int) clean_input($_SESSION[APPLICATION_IDENTIFIER]["tmp"]["post_action"], "numeric") ? (int) clean_input($_SESSION[APPLICATION_IDENTIFIER]["tmp"]["post_action"], "numeric") : 1); $msg = "You will now be redirected to add another quiz question to this quiz; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue."; break; case "index": $url = ENTRADA_URL . "/admin/" . $MODULE; $msg = "You will now be redirected back to the quiz index page; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue."; break; case "content": default: $url = ENTRADA_URL . "/admin/" . $MODULE . "?section=edit&id=" . $RECORD_ID; $msg = "You will now be redirected back to the quiz; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue."; break; } add_success("You have successfully added this question to your <strong>" . html_encode($quiz_record->getQuizTitle()) . "</strong> quiz.<br /><br />" . $msg); $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)"; /** * Unset the arrays used to construct this error checking. */ unset($PROCESSED); application_log("success", "New quiz question [" . $qquestion_id . "] added to quiz_id [" . $RECORD_ID . "]."); } else { add_error("We were unable to add this question to your quiz at this time.<br /><br />The system administrator was informed of this error; please try again later."); application_log("error", "Failed to receive an Insert_Id() from the question insert to quiz_id [" . $RECORD_ID . "]. Database said: " . $db->ErrorMsg()); } } else { add_error("There was a problem inserting this quiz question. The system administrator was informed of this error; please try again later."); application_log("error", "There was an error inserting a quiz question to quiz_id [" . $RECORD_ID . "]. Database said: " . $db->ErrorMsg()); } } else {
if (!$ERROR) { $PROCESSED["proxy_id"] = $ENTRADA_USER->getID(); $PROCESSED["updated_by"] = $ENTRADA_USER->getID(); $PROCESSED["updated_date"] = time(); if (defined("EDIT_RESTRICTED_DAY") && EDIT_RESTRICTED_DAY) { if ($day->fromArray($PROCESSED)->update()) { add_success("The restricted day has successfully been updated. You will be redirected to the restricted days index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "\">click here</a> if you do not wish to wait."); add_statistic("restricted_day", "update", "orday_id", $PROCESSED["orday_id"], $ENTRADA_USER->getID()); } else { add_error("An error occurred when attempting to update a restricted day [" . $PROCESSED["orday_id"] . "], an administrator has been informed, please try again later."); application_log("error", "Error occurred when updating restricted day, DB said: " . $db->ErrorMsg()); } } else { $PROCESSED["organisation_id"] = $ORGANISATION_ID; if ($day->fromArray($PROCESSED)->insert()) { add_success("The restricted day has successfully been updated. You will be redirected to the restricted days index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "\">click here</a> if you do not wish to wait."); add_statistic("restricted_day", "insert", "orday_id", $db->Insert_ID(), $ENTRADA_USER->getID()); } else { add_error("An error occurred when attempting to create a new restricted day, an administrator has been informed, please try again later."); application_log("error", "Error occurred when updating a restricted day, DB said: " . $db->ErrorMsg()); } } } else { $day = new Models_RestrictedDays(); $day->fromArray($PROCESSED); $STEP = 1; } break; default: break; }
if (is_array($descriptors)) { foreach ($descriptors as $descriptor) { $descriptor_data = $descriptor->toArray(); $descriptor_data["active"] = 0; if ($descriptor->fromArray($descriptor_data)->update()) { add_statistic("evaluation_response_descriptor", "delete", "erdescriptor_id", $descriptor->getID(), $ENTRADA_USER->getID()); if (!$ERROR) { add_success("Successfully deleted a Evaluation Response Descriptor [<strong>" . $descriptor->getDescriptor() . "</strong>]. You will now be redirected to the Evaluation Response Descriptors index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue."); } } else { add_error("Failed to delete a Evaluation Response Descriptor [<strong>" . $descriptor->getDescriptor() . "</strong>], an Administrator has been informed, please try again later. You will now be redirected to the Evaluation Response Descriptors index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue."); application_log("error", "Failed to delete Evaluation Response Descriptor, DB said: " . $db->ErrorMsg()); } } } else { add_success("No Evaluation Response Descriptors were selected, so no Evaluation Response Descriptors were deleted. You will now be redirected to the Evaluation Response Descriptors index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue."); } break; } switch ($STEP) { case 2: if ($ERROR) { echo display_error(); } if ($SUCCESS) { echo display_success(); } $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\\'', 5000)"; break; case 1: default:
add_error("An evaluator must be selected to request an evaluation be completed for you."); } } else { add_error("A valid evaluation must be selected from the drop-down list to request an evaluation be completed for you."); } } else { add_error("A valid evaluation must be selected from the drop-down list to request an evaluation be completed for you."); } } else { add_error("An evaluation must be selected from the drop-down list to request an evaluation be completed for you."); } if (has_error()) { echo display_error(); } if (isset($notifications_sent) && $notifications_sent) { add_success("Successfully requested that " . ($notifications_sent > 1 ? $notifications_sent . " evaluators" : get_account_data("wholename", $associated_evaluator)) . " fill out this evaluation [" . $evaluation_title . "] for you."); echo display_success(); } } $evaluation_requests = Models_Evaluation::getTargetRequests($ENTRADA_USER->GetID(), false, false, true); if ($evaluation_requests) { $notice_msg = "The following Evaluation Request Codes are still active but unused: <br />"; foreach ($evaluation_requests as $evaluation_request) { $requestee = get_account_data("wholename", $evaluation_request["target_proxy_id"]); $notice_msg .= "<br />" . $evaluation_request["evaluation_title"] . " [" . $requestee . "]: <strong>" . $evaluation_request["request_code"] . "</strong>"; } add_notice($notice_msg); echo display_notice(); } if ($evaluations && $view != "review") { ?>
* Delete existing quiz contacts, so we can re-add them. */ Models_Quiz_Contact::deleteContacts($RECORD_ID); /** * Add the updated quiz authors to the quiz_contacts table. */ if (is_array($PROCESSED["associated_proxy_ids"]) && !empty($PROCESSED["associated_proxy_ids"])) { foreach ($PROCESSED["associated_proxy_ids"] as $proxy_id) { $contact = new Models_Quiz_Contact(array("quiz_id" => $RECORD_ID, "proxy_id" => $proxy_id, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getActiveID())); if (!$contact->insert()) { add_error("There was an error while trying to attach a <strong>Quiz Author</strong> to this quiz.<br /><br />The system administrator was informed of this error; please try again later."); application_log("error", "Unable to insert a new quiz_contact record while adding a new quiz. Database said: " . $db->ErrorMsg()); } } } add_success("The <strong>Quiz Information</strong> section has been successfully updated."); application_log("success", "Quiz information for quiz_id [" . $quiz_id . "] was updated."); } else { add_error("There was a problem updating this quiz. The system administrator was informed of this error; please try again later."); application_log("error", "There was an error updating quiz information for quiz_id [" . $quiz_id . "]. Database said: " . $db->ErrorMsg()); } } break; case 1: default: $quiz_contacts = Models_Quiz_Contact::fetchAllRecords($RECORD_ID); if ($quiz_contacts) { foreach ($quiz_contacts as $quiz_contact) { $PROCESSED["associated_proxy_ids"][] = $quiz_contact->getProxyID(); } }
$PROCESSED["grade_id"] = $grades[$proxy_id]["grade_id"]; $db->AutoExecute("assessment_grades", $PROCESSED, "UPDATE", "`grade_id`=" . $db->qstr($PROCESSED["grade_id"])); } else { $db->AutoExecute("assessment_grades", $PROCESSED, "INSERT"); } } unset($PROCESSED); } } if (!$ERROR) { add_success("Successfully imported results from the attached quiz questions into <strong>" . $assessment_name . "</strong>."); } } else { add_error("No students have been found in the cohort assigned to this assessment [<strong>" . $assessment_name . "</strong>]."); } } else { add_error("No quizzes were found to be associated with this assessment [<strong>" . $assessment_name . "</strong>]."); } } else { add_error("The assessment " . $assessment_name . " does not have a quiz attached, results can not be imported."); } if ($ERROR) { add_error("You will now be redirected to the <strong>Grade Assessment</strong> page for <strong>" . $assessment_name . "</strong>. This will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue now."); echo display_error(); } if ($SUCCESS) { add_success("You will now be redirected to the <strong>Grade Assessment</strong> page for <strong>" . $assessment_name . "</strong>. This will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue now."); echo display_success(); } $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)"; }
public function update(array $input_arr) { extract($input_arr); global $db; $query = "update `student_student_run_electives` set\n\t\t\t\t `group_name`=?,`university`=?,`location`=?,`start_month`=?, `start_year`=?, `end_month`=?, `end_year`=?\n\t\t\t\t where `id`=?"; if (!$db->Execute($query, array($group_name, $university, $location, $start_month, $start_year, $end_month, $end_year, $this->id))) { add_error("Failed to update Student-run Elective."); application_log("error", "Unable to update a student_student_run_electives record. Database said: " . $db->ErrorMsg()); } else { add_success("Successfully updated Student-run Elective."); } }