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"; foreach ($objectives["required"] as $objective) { echo "<option id=\"objective-item-" . $objective->getID() . "\" value=\"" . $objective->getID() . "\">" . html_encode($objective->getName()) . "</option>\n"; } echo "</optgroup>\n"; }