$ERROR++; $ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance."; echo display_error(); application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]"); } else { if ($COURSE_ID) { $PROCESSED = array(); $PROCESSED_NOTICE = array(); $BREADCRUMB[] = array("url" => "", "title" => "Add Assignment Drop Box"); if (isset($_GET["assessment_id"]) && ($tmp_input = clean_input($_GET["assessment_id"], array("nows", "int")))) { $ASSESSMENT_ID = $tmp_input; } else { $ASSESSMENT_ID = 0; } if ($ASSESSMENT_ID) { $assessment_object = Models_Gradebook_Assessment::fetchRowByID($ASSESSMENT_ID); $assessment = $assessment_object->toArray(); if ($assessment) { $query = "SELECT * FROM `assignments`\n WHERE `assessment_id` = " . $db->qstr($ASSESSMENT_ID) . "\n AND `assignment_active` = 1"; $assignment = $db->GetRow($query); if ($assignment) { add_error("In order to add an Assignment to a Gradebook Assessment you must provide a valid assessment identifier. The provided assessment identifier is already has an assignment."); } else { $PROCESSED["assessment_id"] = $assessment["assessment_id"]; } } else { add_error("In order to add an Assignment to a Gradebook Assessment you must provide a valid assessment identifier. The provided assessment identifier does not exist."); } } else { add_error("In order to add an Assignment to a Gradebook Assessment you must provide a valid assessment identifier."); }
if (!@count($ASSESSMENT_IDS)) { $ERROR++; $ERRORSTR[] = "There were no valid assessment identifiers provided to delete. Please ensure that you access this section through the assessment index."; } } if ($ERROR) { $STEP = 1; } break; } // Display Page switch ($STEP) { case 2: $total_removed_assessments = 0; foreach ($ASSESSMENT_IDS as $assessment_id) { $assessment = Models_Gradebook_Assessment::fetchRowByID($assessment_id); if ($assessment) { if ($assessment->fromArray(array("active" => 0))->update()) { $total_removed_assessments++; if (!$db->AutoExecute("assignments", array("assignment_active" => 0), "UPDATE", "`assessment_id` = " . $assessment_id)) { application_log("error", "Successfully removed assessment id: [" . $assessment_id . "] but was unable to remove the assignments pertaining to them."); } } } } if ($total_removed_assessments == count($ASSESSMENT_IDS)) { add_success("You have successfully removed " . $total_removed_assessments . " assessment" . ($total_removed_assessments != 1 ? "s" : "") . " from the system.<br /><br />You will be automatically redirected to the Assessment index in 5 seconds, or you can <strong><a href=\"" . $INDEX_URL . "\">click here</a></strong> to go there now."); echo display_success(); } else { add_error("We were unable to remove the requested assessments from the system. The MEdTech Unit has been informed of this issue and will address it shortly; please try again later."); echo display_error();