コード例 #1
0
                     $ERROR++;
                     application_log("error", "Unable to insert a new clinical presentation to the database when editing an evaluation form question. Database said: " . $db->ErrorMsg());
                 }
             }
         }
     }
     header("Location: " . ENTRADA_URL . "/admin/evaluations/forms?section=edit&id=" . $FORM_ID . "&success=" . ($ERROR ? "false" : "true"));
     break;
 case 1:
 default:
     /**
      * Fetch the Clinical Presentation details.
      */
     $clinical_presentations_list = array();
     $clinical_presentations = array();
     $results = Models_Evaluation::getClinicalPresentations();
     if ($results) {
         foreach ($results as $result) {
             $clinical_presentations_list[$result["objective_id"]] = $result["objective_name"];
         }
     }
     if (isset($_POST["clinical_presentations_submit"]) && $_POST["clinical_presentations_submit"]) {
         if (isset($_POST["clinical_presentations"]) && is_array($_POST["clinical_presentations"]) && count($_POST["clinical_presentations"])) {
             foreach ($_POST["clinical_presentations"] as $objective_id) {
                 if ($objective_id = clean_input($objective_id, array("trim", "int"))) {
                     $query = "SELECT a.`objective_id`\n\t\t\t\t\t\t\t\t\t\t\tFROM `global_lu_objectives` AS a\n\t\t\t\t\t\t\t\t\t\t\tJOIN `evaluation_form_question_objectives` AS b\n\t\t\t\t\t\t\t\t\t\t\tON b.`efquestion_id` = " . $db->qstr($EFQUESTION_ID) . "\n\t\t\t\t\t\t\t\t\t\t\tAND a.`objective_id` = b.`objective_id`\n\t\t\t\t\t\t\t\t\t\t\tJOIN `objective_organisation` AS c\n\t\t\t\t\t\t\t\t\t\t\tON a.`objective_id` = c.`objective_id`\n\t\t\t\t\t\t\t\t\t\t\tWHERE a.`objective_id` = " . $db->qstr($objective_id) . "\n\t\t\t\t\t\t\t\t\t\t\tAND c.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n\t\t\t\t\t\t\t\t\t\t\tAND b.`objective_type` = 'event'\n\t\t\t\t\t\t\t\t\t\t\tAND a.`objective_active` = '1'";
                     $result = $db->GetRow($query);
                     if ($result) {
                         $clinical_presentations[$objective_id] = $clinical_presentations_list[$objective_id];
                     }
                 }
コード例 #2
0
 public static function getClinicalPresentations($parent_id = 0, $presentations = array(), $equestion_id = 0, $presentation_ids = false, $org_id = 0)
 {
     global $db, $ENTRADA_USER, $translate;
     $org_id = $org_id == 0 ? $ENTRADA_USER->getActiveOrganisation() : (int) $org_id;
     if ($equestion_id) {
         $presentation_ids = array();
         $query = "\tSELECT `objective_id`\n\t\t\t\t\t\tFROM `evaluation_form_question_objectives`\n\t\t\t\t\t\tWHERE `equestion_id` = " . $db->qstr($equestion_id);
         $allowed_objectives = $db->GetAll($query);
         if ($allowed_objectives) {
             foreach ($allowed_objectives as $presentation) {
                 $presentation_ids[] = $presentation["objective_id"];
             }
         }
     }
     if ($parent_id) {
         $query = "\tSELECT a.*\n\t\t\t\t\t\tFROM `global_lu_objectives` AS a\n\t\t\t\t\t\tJOIN `objective_organisation` AS b\n\t\t\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\t\t\tWHERE `objective_active` = '1'\n\t\t\t\t\t\tAND `objective_parent` = " . $db->qstr($parent_id) . "\n\t\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($org_id);
     } else {
         $objective_name = $translate->_("events_filter_controls");
         $objective_name = $objective_name["cp"]["global_lu_objectives_name"];
         $query = "\tSELECT a.*\n\t\t\t\t\t\tFROM `global_lu_objectives` AS a\n\t\t\t\t\t\tJOIN `objective_organisation` AS b\n\t\t\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\t\t\tWHERE a.`objective_active` = '1'\n\t\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($org_id) . "\n\t\t\t\t\t\tAND a.`objective_name` = " . $db->qstr($objective_name);
     }
     $results = $db->GetAll($query);
     if ($results) {
         foreach ($results as $result) {
             if ($parent_id) {
                 $presentations[] = $result;
             }
             $presentations = Models_Evaluation::getClinicalPresentations($result["objective_id"], $presentations, 0, isset($presentation_ids) && $presentation_ids ? $presentation_ids : array(), $org_id);
         }
     }
     if (!$parent_id && is_array($presentation_ids)) {
         foreach ($presentations as $key => $presentation) {
             if (array_search($presentation["objective_id"], $presentation_ids) === false) {
                 unset($presentations[$key]);
             }
         }
     }
     return $presentations;
 }