Пример #1
0
     <div class="control-group row-fluid">
         <label for="course_id" class="form-required span3">Rotation</label>
         <span class="controls span8">
             <?php 
 $courses = $logbook->getLoggingCourses();
 ?>
             <select id="course_id" name="course_id" style="width: 100%" onchange="loadObjectivesList()">
             <option value="0">-- Select Rotation --</option>
             <?php 
 if ($courses) {
     $found_enrolled = false;
     $enrolled_course_ids = groups_get_explicitly_enrolled_course_ids($ENTRADA_USER->getID(), true);
     foreach ($courses as $course) {
         echo "<option value=\"" . (int) $course["course_id"] . "\"" . ($entry->getCourseID() == (int) $course["course_id"] || !$entry->getCourseID() && in_array($course["course_id"], $enrolled_course_ids) && !$found_enrolled ? " selected=\"selected\"" : "") . ">" . $course["course_name"] . "</option>\n";
         if (!$entry->getCourseID() && !$found_enrolled && in_array($course["course_id"], $enrolled_course_ids)) {
             $entry->setCourseID($course["course_id"]);
             $found_enrolled = true;
         }
     }
 }
 ?>
             </select>
         </span>
     </div>
     <div class="control-group row-fluid">
         <label for="institution_id" class="form-required span3">Institution</label>
         <span class="controls span8">
             <select id="institution_id" name="institution_id" style="width: 100%">
             <option value="0">-- Select Institution --</option>
             <?php 
 $institutions = $logbook->getInstitutions();
     $course_id = (int) $_POST["course_id"];
 }
 if (isset($_POST["entry_id"]) && (int) $_POST["entry_id"]) {
     $entry_id = (int) $_POST["entry_id"];
 }
 if (isset($_POST["objective_ids"]) && ($temp_objective_ids = explode(",", $_POST["objective_ids"])) && @count($temp_objective_ids)) {
     $objective_ids = $temp_objective_ids;
 }
 if (isset($course_id) && $course_id) {
     if (!isset($entry)) {
         if (isset($entry_id) && $entry_id) {
             $entry = Models_Logbook_Entry::fetchRow($entry_id);
             $entry->setCourseID($course_id);
         } else {
             $entry = new Models_Logbook_Entry();
             $entry->setCourseID($course_id);
         }
     }
     if (isset($objective_ids) && $objective_ids) {
         foreach ($objective_ids as $objective_id) {
             $entry->addObjective($objective_id);
         }
     }
     $objectives = $entry->getCourseObjectives();
     if (@count($objectives["required"]) || @count($objectives["logged"]) || @count($objectives["disabled"])) {
         ?>
         <select id="objective_id" name="objective_id" onchange="addObjective(this.options[this.selectedIndex].value, 3)">
             <option value="" selected="selected">--- Select an Objective ---</option>
             <?php 
         if (@count($objectives["required"])) {
             echo "<optgroup label=\"Required Objectives\" id=\"objectives-required\">\n";