$RESPONSE_NUMBER = $tmp_input;
 } else {
     $RESPONSE_NUMBER = false;
 }
 if (isset($_GET["erdescriptor_id"]) && ($tmp_input = clean_input($_GET["erdescriptor_id"], "int"))) {
     $erdescriptor_id = $tmp_input;
 } else {
     $erdescriptor_id = false;
 }
 if (isset($_GET["organisation_id"]) && ($tmp_input = clean_input($_GET["organisation_id"], "int"))) {
     $ORGANISATION_ID = $tmp_input;
 } else {
     $ORGANISATION_ID = false;
 }
 if ($RESPONSE_NUMBER && $ORGANISATION_ID) {
     $descriptors = Models_Evaluation_ResponseDescriptor::fetchAllByOrganisation($ORGANISATION_ID);
     ?>
     <div class="pull-right cursor-pointer close" style="margin-top: -15px;" onclick="modalDescriptorDialog.close()">&times;</div>
     <div class="row-fluid">
         <span class="span1 offset1">&nbsp;</span
         <span class="span10">
             <strong>
                 Descriptors
             </strong>
         </span>
     </div>
     <?php 
     if ($descriptors && @count($descriptors)) {
         foreach ($descriptors as $descriptor) {
             ?>
             <div class="row-fluid">
    exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
    header("Location: " . ENTRADA_URL);
    exit;
} elseif (!$ENTRADA_ACL->amIAllowed("configuration", "delete", false)) {
    add_error("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"] . "] do not have access to this module [" . $MODULE . "]");
} else {
    $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "&section=delete&id=" . $RECORD_ID, "title" => "Delete Evaluation Response Descriptors");
    echo "<h1>Delete Evaluation Response Descriptors</h1>";
    if (isset($_POST["delete"])) {
        foreach ($_POST["delete"] as $descriptor_id) {
            if ($tmp_input = clean_input($descriptor_id, "numeric")) {
                $PROCESSED["delete"][] = $tmp_input;
                $descriptors[] = Models_Evaluation_ResponseDescriptor::fetchByID($tmp_input);
            }
        }
    }
    switch ($STEP) {
        case 2:
            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 {
Beispiel #3
0
if (!defined("PARENT_INCLUDED") || !defined("IN_DESCRIPTORS")) {
    exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
    header("Location: " . ENTRADA_URL);
    exit;
} elseif (!$ENTRADA_ACL->amIAllowed("configuration", "update", false)) {
    $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "\\'', 15000)";
    $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 (isset($RECORD_ID) && $RECORD_ID) {
        $descriptor = Models_Evaluation_ResponseDescriptor::fetchByID($RECORD_ID);
    } else {
        $descriptor = new Models_Evaluation_ResponseDescriptor();
    }
    switch ($STEP) {
        case 2:
            if (isset($_POST["descriptor"]) && ($tmp_input = clean_input($_POST["descriptor"], array("trim", "striptags")))) {
                if (strlen($tmp_input) <= 256) {
                    $PROCESSED["descriptor"] = $tmp_input;
                } else {
                    add_error("The descriptor too long.  Please specify a descriptor that is 256 characters or less.");
                }
            } else {
                add_error("The descriptor is required.");
            }
            /**
             * Required field "order" / Descriptor Order
             */