Пример #1
0
     $clinical_presentation_objectives = events_fetch_objectives_structure($cp_objectives["objective_id"], $obj_ids);
     $output_objective_names = events_all_active_objectives($clinical_presentation_objectives);
     $row[$key] = implode("; ", $output_objective_names);
     break;
 case "curriculum_objectives":
     $curriculum_objectives = array();
     $query = "\tSELECT *\n\t\t\t\t\t\t\t\t\tFROM `event_objectives` eo\n\t\t\t\t\t\t\t\t\tJOIN `global_lu_objectives` glo\n\t\t\t\t\t\t\t\t\tON eo.`objective_id` = glo.`objective_id`\n\t\t\t\t\t\t\t\t\tWHERE eo.`event_id` = " . $db->qstr($event["event_id"]);
     $objs = $db->GetAll($query);
     $obj_ids = array();
     if ($objs) {
         foreach ($objs as $o) {
             $obj_ids[] = $o["objective_id"];
         }
     }
     $curriculum_objectives = events_fetch_objectives_structure($curriculum_objective_result["objective_id"], $obj_ids);
     $output_objective_names = events_all_active_objectives($curriculum_objectives);
     $row[$key] = implode("; ", $output_objective_names);
     break;
 case "attached_files":
     $attached_files = array();
     $query = "\tSELECT *\n\t\t\t\t\t\t\t\t\tFROM `event_files` ef\n\t\t\t\t\t\t\t\t\tWHERE ef.`event_id` = " . $db->qstr($event["event_id"]);
     $items = $db->GetAll($query);
     if ($items) {
         foreach ($items as $i) {
             $attached_files[] = $f["file_name"];
         }
     }
     $row[$key] = implode("; ", $attached_files);
     break;
 case "attached_quizzes":
     $attached_quizzes = array();
Пример #2
0
/**
 * This function is used in conjunction with the output of events_fetch_objectives_structure and is used to
 * find all the active objectives by objective name.
 *
 * @param type $objs - an array containing an objective set as produced by events_fetch_objectives_structure.
 * @param type $output - an array of objective names of all the active objectives as accumlated by recursive call.
 * @return type - an array of objective names of all the active objectives.
 */
function events_all_active_objectives($objs, $output = array())
{
    foreach ($objs as $obj_id => $details) {
        if ($details["objective_active"]) {
            $output[] = $details["objective_name"];
        }
        if ($details["children_active"]) {
            $output = events_all_active_objectives($details["children"], $output);
        }
    }
    return $output;
}