Beispiel #1
0
 $PROCESSED["organisation_id"] = $ORGANISATION_ID;
 $PROCESSED["updated_date"] = time();
 $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
 $PROCESSED["active"] = 1;
 $descriptor->fromArray($PROCESSED);
 if (!has_error()) {
     $existing_descriptors = Models_Evaluation_ResponseDescriptor::fetchAllByOrganisation($ORGANISATION_ID);
     foreach ($existing_descriptors as $existing_descriptor) {
         if ($existing_descriptor->getOrder() >= $PROCESSED["order"] && (!$descriptor->getOrder() || $existing_descriptor->getOrder() < $descriptor->getOrder())) {
             $descriptor_array = $existing_descriptor->toArray();
             $descriptor_array["order"]++;
             $existing_descriptor->fromArray($descriptor_array)->update();
         }
     }
     if (defined("ADD_DESCRIPTOR")) {
         if ($descriptor->insert()) {
             add_success("Successfully added the Evaluation Response Descriptor [<strong>" . $descriptor->getDescriptor() . "</strong>]. You will now be redirected to the Evaluation Response Descriptors index, please <a href=\"" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\">click here</a> if you do not wish to wait.");
         } else {
             $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\\'', 5000)";
             add_error("An error occurred while attempting to add the Evaluation Response Descriptor [<strong>" . $descriptor->getDescriptor() . "</strong>]. A system administrator has been informed, please try again later.<br /><br />You will now be redirected to the Evaluation Response Descriptors index, please <a href=\"" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\">click here</a> if you do not wish to wait.");
         }
     } else {
         if (isset($RECORD_ID)) {
             if ($descriptor->fromArray($PROCESSED)->update()) {
                 add_success("Successfully updated the Evaluation Response Descriptor [<strong>" . $descriptor->getDescriptor(false) . "</strong>]. You will now be redirected to the Evaluation Response Descriptor index, please <a href=\"" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\">click here</a> if you do not wish to wait.");
             } else {
                 $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\\'', 5000)";
                 add_error("An error occurred while attempting to update the Evaluation Response Descriptor [<strong>" . $descriptor->getDescriptor() . "</strong>]. A system administrator has been informed, please try again later.<br /><br />You will now be redirected to the Evaluation Response Descriptors index, please <a href=\"" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\">click here</a> if you do not wish to wait.");
             }
         }
     }