Ejemplo n.º 1
0
    //Setup action for button next to currriculum slot info.
    if ($sectionID > 0) {
        $submitAction = site_url('User/prepareRemoveCourseSection/' . $sectionID);
    } else {
        $submitAction = site_url('User/prepareAddCourseSection/' . $slotID);
    }
    echo '<form action="' . $submitAction . '" method="POST">';
    echo '<input type="hidden" name="sID" value="' . $sID . '" />';
    echo '<tr><td><input type="submit"';
    if ($sectionID > 0) {
        echo 'value="Remove Course" /></tc></td>';
        $student = new User_model();
        $student->loadPropertiesFromPrimaryKey($sID);
        $section = new Course_section_model();
        $section->loadPropertiesFromPrimaryKey($sectionID);
        $quarterName = $section->getAcademicQuarter()->getName();
        $quarterYear = $section->getAcademicQuarter()->getYear();
        $grade = $student->getGradeForCourseSection($section);
        echo '<td>' . $currSlot->getName() . '</td>' . '<td>' . $quarterName . $quarterYear . '</td>' . '<td>' . $section->getSectionName() . '</td>' . '<td>' . $grade . '</td>';
    } else {
        echo 'value="   Add Course   " /></tc></td>';
        // Need Curriculum Slot
        echo '<td>' . $slotName . '</td>' . '<td>' . $unassigned . '</td>' . '<td>' . $unassigned . '</td>' . '<td>' . $unassigned . '</td>';
    }
    echo '</tr></form>';
}
?>
            </table>
            <br/>
            <button type="button">
                <a href="<?php 
Ejemplo n.º 2
0
 private function collectCourseData($curriculumID)
 {
     #get list of all curriculumcourseslots for names of courses
     $curriculum = new Curriculum_model();
     $curriculum->loadPropertiesFromPrimaryKey($curriculumID);
     $currCourseList = $curriculum->getCurriculumCourseSlots();
     #Courses list to grab courseIDs from courseName and course Number
     $course = new Course_model();
     $courseList = $course->getAllCourses();
     #Create a list of CourseIDs to reference courses
     $courseIDList = array();
     #loop through each currCourseListName and grab the matching courseID's
     #with matching CourseNames and CourseNumbers
     foreach ($currCourseList as $currCourse) {
         $currCourseName = $currCourse->getName();
         $nameLength = strlen($currCourseName);
         $cName = preg_split('%[0-9]%', $currCourseName);
         $cName = strtoupper($cName[0]);
         $cNumber = $currCourseName[$nameLength - 3] . $currCourseName[$nameLength - 2] . $currCourseName[$nameLength - 1];
         foreach ($courseList as $course) {
             if ($course->getCourseName() . ' ' . $course->getCourseNumber() == $cName . $cNumber) {
                 array_push($courseIDList, $course->getCourseID());
             }
         }
     }
     #now that we have a list of all courseIDs we need to make a list of
     #courseSectionIDs
     #first make a list of all courseSections
     $courseSections = new Course_section_model();
     $courseSectionList = $courseSections->getAllCourseSections();
     #next make a list to store the courseSectionIDs we need
     $courseSectionIDList = array();
     foreach ($courseIDList as $courseID) {
         foreach ($courseSectionList as $courseSection) {
             if ($courseSection->getCourse()->getCourseID() == $courseID) {
                 array_push($courseSectionIDList, $courseSection->getCourseSectionID());
             }
         }
     }
     $allCourseData = array();
     foreach ($courseSectionIDList as $csID) {
         $courseData = array('sectionID' => null, 'courseName' => null, 'quarterID' => null, 'quarterName' => null, 'quarterYear' => null, 'sectionNum' => null);
         $cSection = new Course_section_model();
         $cSection->loadPropertiesFromPrimaryKey($csID);
         $course = $cSection->getCourse();
         $cName = $course->getCourseName();
         $cNumber = $course->getCourseNumber();
         $courseData['quarterID'] = $cSection->getAcademicQuarter()->getAcademicQuarterID();
         $courseData['quarterName'] = $cSection->getAcademicQuarter()->getName();
         $courseData['quarterYear'] = $cSection->getAcademicQuarter()->getYear();
         $courseData['sectionNum'] = $cSection->getSectionName();
         $courseData['sectionID'] = $csID;
         $courseData['courseName'] = $cName . $cNumber;
         array_push($allCourseData, $courseData);
     }
     return $allCourseData;
 }