/** * Reset the requires_apartment flag so this person is put back on the Regional Education dashboard. */ if (!$db->AutoExecute(CLERKSHIP_DATABASE . ".events", array("requires_apartment" => 1), "UPDATE", "event_id=" . $db->qstr($ASCHEDULE_INFO["event_id"]))) { $NOTICE++; $NOTICESSTR[] = "We were unable to add this learners event back onto the " . $APARTMENT_INFO["department_title"] . " dashboard as a todo task."; application_log("error", "Unable to set requires_apartment to 1 for event_id [" . $ASCHEDULE_INFO["event_id"] . "] after proxy_id [" . $ASCHEDULE_INFO["proxy_id"] . "] had been removed from aschedule_id [" . $ASCHEDULE_ID . "]. Database said: " . $db->ErrorMsg()); } } if (isset($_POST["notify"]) && (int) $_POST["notify"] == 1) { $apartment_address = ($APARTMENT_INFO["apartment_number"] != "" ? $APARTMENT_INFO["apartment_number"] . "-" : "") . $APARTMENT_INFO["apartment_address"] . "\n"; $apartment_address .= $APARTMENT_INFO["region_name"] . ($APARTMENT_INFO["province"] ? ", " . $APARTMENT_INFO["province"] : "") . "\n"; $apartment_address .= $APARTMENT_INFO["apartment_postcode"] . ", " . $APARTMENT_INFO["country"]; $message_variables = array("to_firstname" => $ASCHEDULE_INFO["firstname"], "to_lastname" => $ASCHEDULE_INFO["lastname"], "from_firstname" => $_SESSION["details"]["firstname"], "from_lastname" => $_SESSION["details"]["lastname"], "region" => $APARTMENT_INFO["region_name"], "apartment_address" => $apartment_address, "inhabiting_start" => date(DEFAULT_DATE_FORMAT, $ASCHEDULE_INFO["inhabiting_start"]), "inhabiting_finish" => date(DEFAULT_DATE_FORMAT, $ASCHEDULE_INFO["inhabiting_finish"]), "application_name" => APPLICATION_NAME, "department_title" => $APARTMENT_INFO["department_title"], "department_id" => $APARTMENT_INFO["department_id"]); $recipient = array("email" => $ASCHEDULE_INFO["email"], "firstname" => $ASCHEDULE_INFO["firstname"], "lastname" => $ASCHEDULE_INFO["lastname"]); regionaled_apartment_notification("delete", $recipient, $message_variables); } } else { $ERROR++; $ERRORSTR[] = "Unable to remove <strong>" . html_encode($ASCHEDULE_INFO["firstname"] . " " . $ASCHEDULE_INFO["lastname"]) . "</strong> from <strong>" . html_encode($APARTMENT_INFO["apartment_title"]) . "</strong> at this time. The system administrator has been notified of this issue, please try again later.<br /><br />You will now be redirected to the apartment schedule; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . $url . "\" style=\"font-weight: bold\">click here</a> to continue."; application_log("error", "Unable to remove proxy_id [" . $ASCHEDULE_INFO["proxy_id"] . "] from apartment_id [" . $APARTMENT_ID . "] / aschedule_id [" . $ASCHEDULE_ID . "]. Database said: " . $db->ErrorMsg()); } } else { $url = "/admin/regionaled/apartments/manage/schedule?id=" . $APARTMENT_ID . "&sid=" . $ASCHEDULE_ID; $ERROR++; $ERRORSTR[] = "You must confirm that you wish to remove <strong>" . html_encode($ASCHEDULE_INFO["firstname"] . " " . $ASCHEDULE_INFO["lastname"]) . "</strong> from <strong>" . html_encode($APARTMENT_INFO["apartment_title"]) . "</strong>.<br /><br />You will now be redirected to the apartment schedule; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . $url . "\" style=\"font-weight: bold\">click here</a> to continue."; application_log("error", "The remove request for proxy_id [" . $ASCHEDULE_INFO["proxy_id"] . "] from apartment_id [" . $APARTMENT_ID . "] / aschedule_id [" . $ASCHEDULE_ID . "] was not confirmed. This step shouldn't have been accessible otherwise."); } $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . $url . "\\'', 5000)"; display_status_messages(); }
} foreach ($updates as $key => $update) { $update['effective_date'] = fmt_date($update['effective_date']); $update['expiry_date'] = fmt_date($update['expiry_date']); $meta_value = MetaDataValue::get($key); $meta_value->update($update); } } if (!has_error()) { echo "<h2>" . $category->getLabel() . "</h2>"; echo "<div class=\"content-small\">for " . $organisation->getTitle() . " > " . ucwords($group) . " > " . ucwords($opts["associated_role"]) . "</div><br />"; echo editMetaDataTable_Category($organisation_id, $group, $role, null, $category); } else { //if there were any errors, return a 500 and display errors header("HTTP/1.0 500 Internal Error"); echo display_status_messages(false); } break; case 'new_value': $cat_id = filter_input(INPUT_POST, "type", FILTER_SANITIZE_NUMBER_INT); $proxy_id = filter_input(INPUT_POST, "proxy_id", FILTER_SANITIZE_NUMBER_INT); $type = MetaDataType::get($cat_id); if ($type) { $user = User::get($proxy_id); $org_id = $user->getOrganisationId(); $group = $user->getGroup(); $role = $user->getRole(); $types = MetaDataTypes::get($org_id, $group, $role, $proxy_id); $value_id = MetaDataValue::create($cat_id, $proxy_id); $value = MetaDataValue::get($value_id); $descendant_type_sets = getDescendentTypesArray($types, $type);
function process_awards_admin() { if (isset($_POST['action'])) { $action = $_POST['action']; switch ($action) { case "add_award_recipient": case "remove_award_recipient": case "edit_award_details": $award_id = isset($_POST['award_id']) ? $_POST['award_id'] : 0; if ($award_id) { $award = InternalAward::get($award_id); process_manage_award_details(); display_status_messages(); echo award_recipients_list($award); } break; case "remove_award": $award_id = isset($_POST['award_id']) ? $_POST['award_id'] : 0; if (!$award_id) { break; } case "new_award": process_manage_award_details(); display_status_messages(); $awards = InternalAwards::get(true); if ($awards) { echo awards_list($awards); } break; } } }
public function process() { $user = $this->_user; $translator = $this->_translator; $type = $this->type; static $valid = array("external_awards" => array("add", "remove", "edit"), "contributions" => array("add", "remove", "edit"), "critical_enquiry" => array("add", "remove", "edit"), "community_based_project" => array("add", "remove", "edit"), "research_citations" => array("add", "remove", "edit", "resequence"), "observerships" => array("add", "remove", "edit", "resequence")); $section = filter_input(INPUT_GET, 'mspr-section', FILTER_CALLBACK, array('options' => 'strtolower')); if ($section) { $params = array('entity_id' => FILTER_VALIDATE_INT, 'action' => array('filter' => FILTER_CALLBACK, 'options' => 'strtolower'), 'user_id' => FILTER_VALIDATE_INT); $inputs = filter_input_array(INPUT_POST, $params); extract($inputs); if (!$action) { add_error($translator->translate("mspr_no_action")); } if (!array_key_exists($section, $valid)) { add_error($translator->translate("mspr_invalid_section")); } else { if (!in_array($action, $valid[$section])) { add_error($translator->translate("mspr_invalid_action")); } } if (!has_error() && in_array($action, array("add", "edit", "resequence"))) { $inputs = get_mspr_inputs($section); process_mspr_inputs($section, $inputs, $translator); //modifies inputs/adds errors } if (!has_error()) { $inputs['user_id'] = $user_id; if ($action == "add") { switch ($section) { case 'external_awards': ExternalAwardReceipt::create($inputs); break; case 'contributions': Contribution::create($inputs); break; case 'critical_enquiry': if (CriticalEnquiry::get($user_id)) { add_error($translator->translate("mspr_too_many_critical_enquiry")); } else { CriticalEnquiry::create($inputs); } break; case 'community_based_project': if (CommunityBasedProject::get($user_id)) { add_error($translator->translate("mspr_too_many_community_based_project")); } else { CommunityBasedProject::create($inputs); } break; case 'research_citations': ResearchCitation::create($inputs); break; case 'observerships': $observership = Observership::create($inputs); break; } } elseif ($action == "resequence") { switch ($section) { case 'research_citations': ResearchCitations::setSequence($user_id, $inputs['research_citations']); break; } } else { //everything else requires an entity if ($entity_id) { $entity = get_mspr_entity($section, $entity_id); if ($entity) { switch ($action) { case "remove": $entity->delete(); break; case "edit": if ($entity instanceof Approvable) { $inputs['comment'] = ""; $inputs['status'] = 0; //set to unapproved. } $entity->update($inputs); //inputs processed above break; } } else { add_error($translator->translate("mspr_invalid_entity")); } } else { add_error($translator->translate("mspr_no_entity")); } } } switch ($section) { case 'external_awards': $external_awards = ExternalAwardReceipts::get($user); display_status_messages(); echo display_external_awards($external_awards, $type); break; case 'contributions': $contributions = Contributions::get($user); display_status_messages(); echo display_contributions($contributions, $type); break; case 'critical_enquiry': $critical_enquiry = CriticalEnquiry::get($user); display_status_messages(); echo display_critical_enquiry($critical_enquiry, $type); break; case 'community_based_project': $community_based_project = CommunityBasedProject::get($user); display_status_messages(); echo display_community_based_project($community_based_project, $type); break; case 'research_citations': $research_citations = ResearchCitations::get($user); display_status_messages(); echo display_research_citations($research_citations, $type); break; case 'observerships': $observerships = Observerships::get($user); display_status_messages(); echo display_observerships($observerships, "public"); break; } } }
function status_redirect($url) { header("refresh:5;url=" . $url); display_status_messages(); }
public function process() { global $ENTRADA_USER; $user = $this->_user; $translator = $this->_translator; $type = $this->type; static $valid = array("studentships" => array("add", "remove", "edit"), "clineval" => array("add", "remove", "edit"), "internal_awards" => array("add", "remove", "edit"), "student_run_electives" => array("add", "remove", "edit"), "observerships" => array("add", "remove", "edit"), "int_acts" => array("add", "remove", "edit"), "external_awards" => array("approve", "unapprove", "reject", "add", "edit"), "contributions" => array("approve", "unapprove", "reject", "add", "edit"), "critical_enquiry" => array("approve", "unapprove", "reject", "add", "edit"), "community_based_project" => array("approve", "unapprove", "reject", "add", "edit"), "research_citations" => array("approve", "unapprove", "reject", "add", "edit", "resequence")); $section = filter_input(INPUT_GET, 'mspr-section', FILTER_CALLBACK, array('options' => 'strtolower')); if ($section) { $params = array('entity_id' => FILTER_VALIDATE_INT, 'action' => array('filter' => FILTER_CALLBACK, 'options' => 'strtolower'), 'comment' => FILTER_SANITIZE_STRING, 'user_id' => FILTER_VALIDATE_INT); $inputs = filter_input_array(INPUT_POST, $params); extract($inputs); if (!$action) { add_error($translator->translate("mspr_no_action")); } if (!array_key_exists($section, $valid)) { add_error($translator->translate("mspr_invalid_section")); } else { if (!in_array($action, $valid[$section])) { add_error($translator->translate("mspr_invalid_action")); } } if ($action == "reject" && MSPR_REJECTION_REASON_REQUIRED) { if (!$comment) { add_error($translator->translate("mspr_no_reject_reason")); } } if (!has_error() && in_array($action, array("add", "edit", "resequence"))) { $inputs = get_mspr_inputs($section); process_mspr_inputs($section, $inputs, $translator); //modifies inputs/adds errors } if (!has_error()) { $inputs['user_id'] = $user_id; if ($action == "add") { if (AUTO_APPROVE_ADMIN_MSPR_SUBMISSIONS) { $inputs['status'] = 1; } switch ($section) { case "clineval": ClinicalPerformanceEvaluation::create($inputs); break; case "observerships": Observership::create($inputs); break; case 'studentships': Studentship::create($inputs); break; case 'internal_awards': InternalAwardReceipt::create($inputs); break; case 'external_awards': ExternalAwardReceipt::create($inputs); break; case 'contributions': Contribution::create($inputs); break; case 'student_run_electives': StudentRunElective::create($inputs); break; case 'int_acts': InternationalActivity::create($inputs); break; case 'critical_enquiry': if (CriticalEnquiry::get($user_id)) { add_error($translator->translate("mspr_too_many_critical_enquiry")); } else { CriticalEnquiry::create($inputs); } break; case 'community_based_project': if (CommunityBasedProject::get($user_id)) { add_error($translator->translate("mspr_too_many_community_based_project")); } else { CommunityBasedProject::create($inputs); } break; case 'research_citations': ResearchCitation::create($inputs); break; } } elseif ($action == "resequence") { switch ($section) { case 'research_citations': ResearchCitations::setSequence($user_id, $inputs['research_citations']); break; } } else { //everything else requires an entity if ($entity_id) { $entity = get_mspr_entity($section, $entity_id); if ($entity) { switch ($action) { case "approve": $entity->approve(); break; case "unapprove": $entity->unapprove(); break; case "remove": $entity->delete(); break; case "edit": if ($entity instanceof Approvable) { if (AUTO_APPROVE_ADMIN_MSPR_EDITS) { $inputs['comment'] = ""; $inputs['status'] = 1; } else { $inputs['comment'] = $entity->getComment(); $inputs['status'] = $entity->getStatus(); } } $entity->update($inputs); //inputs processed above break; case "reject": if (MSPR_REJECTION_SEND_EMAIL) { $sub_info = get_submission_information($entity); $reason_type = !$comment ? "noreason" : "reason"; $active_user = User::get($ENTRADA_USER->getID()); if ($active_user && $type) { submission_rejection_notification($reason_type, array("firstname" => $user->getFirstname(), "lastname" => $user->getLastname(), "email" => $user->getEmail()), array("to_fullname" => $user->getFirstname() . " " . $user->getLastname(), "from_firstname" => $active_user->getFirstname(), "from_lastname" => $active_user->getLastname(), "reason" => clean_input($comment, array("notags", "specialchars")), "submission_details" => $sub_info, "application_name" => APPLICATION_NAME . " MSPR System")); } else { add_error($translator->translate("mspr_email_failed")); } } $entity->reject($comment); break; } } else { add_error($translator->translate("mspr_invalid_entity")); } } else { add_error($translator->translate("mspr_no_entity")); } } } switch ($section) { case 'studentships': $studentships = Studentships::get($user); display_status_messages(); echo display_studentships($studentships, $type); break; case 'clineval': $clinical_evaluation_comments = ClinicalPerformanceEvaluations::get($user); display_status_messages(); echo display_clineval($clinical_evaluation_comments, $type); break; case 'internal_awards': $internal_awards = InternalAwardReceipts::get($user); display_status_messages(); echo display_internal_awards($internal_awards, $type); break; case 'external_awards': $external_awards = ExternalAwardReceipts::get($user); display_status_messages(); echo display_external_awards($external_awards, $type); break; case 'contributions': $contributions = Contributions::get($user); display_status_messages(); echo display_contributions($contributions, $type); break; case 'student_run_electives': $student_run_electives = StudentRunElectives::get($user); display_status_messages(); echo display_student_run_electives($student_run_electives, $type); break; case 'observerships': $observerships = Observerships::get($user); display_status_messages(); echo display_observerships($observerships, $type); break; case 'int_acts': $int_acts = InternationalActivities::get($user); display_status_messages(); echo display_international_activities($int_acts, $type); break; case 'critical_enquiry': $critical_enquiry = CriticalEnquiry::get($user); display_status_messages(); echo display_critical_enquiry($critical_enquiry, $type); break; case 'community_based_project': $community_based_project = CommunityBasedProject::get($user); display_status_messages(); echo display_community_based_project($community_based_project, $type); break; case 'research_citations': $research_citations = ResearchCitations::get($user); display_status_messages(); echo display_research_citations($research_citations, $type); break; } } }