/** * Build a form to add information to add course sections. * * @return void * @access public * @since 8/29/05 */ function getAddForm($offering) { $harmoni = Harmoni::instance(); $cmm = Services::getService("CourseManagement"); $idManager = Services::getService("Id"); $am = Services::GetService("AgentManager"); ob_start(); $offeringName = $offering->getDisplayName(); $offeringId = $offering->getId(); $offeringIdString = $offeringId->getIdString(); print _("<h3>Course offering: " . $offeringName . "</h3>") . ""; print _("<h4>Please enter the following information to add a course section in " . $offeringName . ".</h4>") . ""; // Search header $self = $harmoni->request->quickURL("coursemanagement", "createcoursesection", array("sectionType", "sectionStatus", "sectionLocation")); $last_type = $harmoni->request->get("sectionType"); $section_type = RequestContext::name("sectionType"); $last_status = $harmoni->request->get("sectionStatus"); $section_status = RequestContext::name("sectionStatus"); $last_location = $harmoni->request->get("sectionLocation"); $section_location = RequestContext::name("sectionLocation"); print "<form action='{$self}' method='post'>\n\t\t\t<div>\n\t\t\t<p>Section Type: <br/><input type='text' name='{$section_type}' value='{$last_type}' /></p>\n\t\t\t<p>Section Status: <br/><input type='text' name='{$section_status}' value='{$last_type}' /></p>\n\t\t\t<p>Section Location: <br/><input type='text' name='{$section_location}' value='{$last_location}' /></p>"; print "\n\t<input type='submit' value='" . _("Add") . "' />"; print "\n\t<a href='" . $harmoni->request->quickURL() . "'>"; print "<input type='button' value='" . _("Clear") . "' /></a>"; print "\n</div>\n</form>\n"; $link = $harmoni->request->quickURL("coursemanagement", "edit_offering_details", array("courseId" => $offeringIdString)); print _("<h4><a href='{$link}'>Click here to return to offering details.</a></h4>") . ""; $output = new Block(ob_get_clean(), STANDARD_BLOCK); return $output; }
/** * Process any changes in the form to remove a section. * * @param object section * @param string agentIdString * @return void * @access public * @since 8/29/05 */ function removeStudent($section, $agentIdString) { $harmoni = Harmoni::instance(); $harmoni->request->startNamespace("polyphony-agents"); $harmoni->request->passthrough("agentId"); $idManager = Services::getService("Id"); $am = Services::GetService("AgentManager"); $agentId = $idManager->getId($agentIdString); $section->removeStudent($agentId); }
function enrollmentIteratorHasStudent($iter, $agent) { //this relies on usage of the HarmoniIterator $iter->_i = -1; while ($iter->hasNext()) { $am = Services::GetService("AgentManager"); $er = $iter->next(); $currAgent = $am->getAgent($er->getStudent()); if ($agent->getDisplayName() == $currAgent->getDisplayName()) { return true; } } return false; }
/** * Prints the list of existing course offerings with the functionality to remove. * * @return void * @access public * @since 8/29/05 */ function getCourses() { $harmoni = Harmoni::instance(); $cmm = Services::getService("CourseManagement"); $idManager = Services::getService("Id"); $am = Services::GetService("AgentManager"); ob_start(); print "\n<h4>Existing course offerings. Please click on a course offering to edit its details (e.g. add a section).</h4>"; $canonicalCourseIterator = $cmm->getCanonicalCourses(); if (!$canonicalCourseIterator->hasNextCanonicalCourse()) { print "<p>No course offerings are present.</p>"; } else { while ($canonicalCourseIterator->hasNextCanonicalCourse()) { $canonicalCourse = $canonicalCourseIterator->nextCanonicalCourse(); $courseOfferingIterator = $canonicalCourse->getCourseOfferings(); while ($courseOfferingIterator->hasNextCourseOffering()) { $courseOffering = $courseOfferingIterator->nextCourseOffering(); $id = $courseOffering->getId(); $idString = $id->getIdString(); $canonicalCourseId = $canonicalCourse->getId(); $canonicalCourseIdString = $canonicalCourseId->getIdString(); $courseName = $courseOffering->getDisplayName(); // Get term $courseTerm = $courseOffering->getTerm(); $courseTermName = $courseTerm->getDisplayName(); $self = $harmoni->request->quickURL("coursemanagement", "createcourse", array("courseIdToRemove" => $idString)); print "<form action='{$self}' method='post'>"; print "\n<a href='" . $harmoni->request->quickURL("coursemanagement", "edit_offering_details", array("courseId" => $idString)) . "'>"; print "\n" . $courseName . "</a> " . $courseTermName . " "; print "\n\t<input type='submit' value='" . _("Remove") . "' />"; print "\n</form>\n"; } } } $output = new Block(ob_get_clean(), STANDARD_BLOCK); return $output; }