echo "Currently No Plans assigned to this curriculum"; } else { echo '<ul id="programs">'; foreach ($curriculumpaths as $curriculumpath) { $offeredin = $DB->get_record('local_activeplan_batch', array('batchid'=>$list->batchid, 'planid'=>$curriculumpath->id)); $semester = $DB->get_record('local_semester', array('id'=>$offeredin->semesterid)); echo '<li><a class="expanded" style="cursor:pointer; height: 28px; display: block;padding-top: 5px; padding-left:10px;margin-bottom: 5px;margin-top:10px; background-color: #C0C0C0; font-size: 16px; border-radius: 2px;color:black;">' . $curriculumpath->fullname . ' ('.$semester->fullname.')'. '</a>'; echo '<ul id="course">'; $plancourses = diplay_plancourse($curriculumpath->id); //echo '<table>'; echo '<div style="background-color: #E8E8E8; height: 25px; margin-bottom: 5px; padding-top: 5px; padding-left: 8px; font-size: 13px;"><span style="width:50%;display: inline-block;text-align:left;">Course Name</span> <span style="width:30%;display: inline-block;text-align:center;">Status</span> <span style="width:15%;display: inline-block;text-align:center;">Grade</span></div>'; // print_object($plancourses); foreach ($plancourses as $plancourse) { $grd = isset($plancourse->grade) ? $plancourse->grade : '<b>-</b>'; /* $sem=$semid_getclass > 0 ? '<b>'.$DB->get_field('local_semester','fullname',array('id'=>$semid_getclass)).'</b>' : '<b>-</b>'; */
$rws = array(); $grps = array(); $i = 0; $j = 0; $out = '<table id="cur_customplan" width="100%" class="generaltable">'; $out .= '<tr> <th size="40%">' . get_string('course', 'local_cobaltcourses') . 's' . '</th> <th size="20%">' . get_string('status') . '</th> <th size="20%">' . get_string('grades') . '</th> <th size="20%">' . get_string('enrollsem', 'local_curriculum') . '</th> </tr>'; foreach ($curriculumpaths as $plans) { $showdepth = 1; $plancourses = diplay_plancourse($plans->id); $countofrecord = sizeof($plancourses); $out .= '<tr align="center" class="header' . $i . '" onClick="fnslidetoggle(' . $i . ',' . $countofrecord . ')"><td colspan="3">' . display_curriculum_paths($plans, $showdepth) . '</td> <td style="text-align: right;">'; if ($i == 0) $out .= '<img class="smallimg" src="pix/expanded.svg" />'; else $out .= '<img class="smallimg" src="pix/collapsed.svg" />'; $out .= '</td></tr>'; $indicate_depth = true; $itemdepth = ($indicate_depth) ? 'coursedepth' . min(4, $plans->depth) : 'coursedepth1'; $k = 0; $m = 0;
/** * @method display_curriculum_courselist() * @todo used to display list of courses of curriculum associated with user(student) * @param $cid (holds curriculumid), $userid(holds student ,current login student) * @return-- table format output */ function display_curriculum_courselist($cid, $userid) { global $CFG, $USER, $DB; // -----used get to cuurent active semesterid-------------------------------- $hier = new hierarchy(); $semesterid = $hier->get_allmyactivesemester($userid); foreach ($semesterid as $key => $value) $semid_getclass = $key; //-------------------------------------------------------------------------- $query = "SELECT cp.* FROM {local_userdata} u JOIN {local_curriculum} cp ON cp.id=u.curriculumid where u.userid={$userid} and u.curriculumid = {$cid}"; $currlicList = $DB->get_records_sql($query); foreach ($currlicList as $list) { $table = new html_table(); $table->head = array(get_string('course', 'local_cobaltcourses') . 's', get_string('status'), get_string('grades'), get_string('enrollsem', 'local_curriculum')); $table->size = array('40%', '20%', '20%', '20%'); $table->align = array('left', 'center', 'center', 'center'); $data = array(); $out = ''; if ($list->enableplan) { $curriculumpaths = $DB->get_records('local_curriculum_plan', array('curriculumid' => $list->id), $sort = 'sortorder'); $hds = array(); $rws = array(); $grps = array(); $i = 0; $j = 0; $out = '<table id="cur_customplan" width="100%" class="generaltable">'; $out .= '<tr> <th size="40%">' . get_string('course', 'local_cobaltcourses') . 's' . '</th> <th size="20%">' . get_string('status') . '</th> <th size="20%">' . get_string('grades') . '</th> <th size="20%">' . get_string('enrollsem', 'local_curriculum') . '</th> </tr>'; foreach ($curriculumpaths as $plans) { $showdepth = 1; $plancourses = diplay_plancourse($plans->id); $countofrecord = sizeof($plancourses); $out .= '<tr align="center" class="header' . $i . '" onClick="fnslidetoggle(' . $i . ',' . $countofrecord . ')"><td colspan="3">' . display_curriculum_paths($plans, $showdepth) . '</td> <td style="text-align: right;">'; if ($i == 0) $out .= '<img class="smallimg" src="pix/expanded.svg" />'; else $out .= '<img class="smallimg" src="pix/collapsed.svg" />'; $out .= '</td></tr>'; $indicate_depth = true; $itemdepth = ($indicate_depth) ? 'coursedepth' . min(4, $plans->depth) : 'coursedepth1'; $k = 0; $m = 0; foreach ($plancourses as $courses) { $style = $i == 0 ? '' : 'style="display: none;"'; $idname = "innerrow"; $out .= '<tr ' . $style . ' class="row' . $i . '" id="outerrow' . $m . '">'; $out .= '<td size="40%"><div class="' . $itemdepth . '"><a href="' . $CFG->wwwroot . '/local/cobaltcourses/view.php?id=' . $courses->id . '&sesskey=' . sesskey() . '">' . $courses->shortname . ' </a>: ' . $courses->fullname . ' </div></td>'; if (strip_tags($courses->status) == "Not Enrolled" or strip_tags($courses->status) == "waiting") { $sta = strip_tags($courses->status); if ($sta == 'waiting') $course_status = 'Waiting for Approval'; else $course_status = 'Not Enrolled'; $out .= '<td size="20%" onClick="innerslidetoggle(' . $k . ')" class="notenrolled_color" style="cursor:pointer;" >' . $course_status . '<img class="simg' . $k . '" src="pix/collapsed.svg"></img></td>'; } else $out .= '<td size="20%" >' . $courses->status . '</td>'; $grd = isset($courses->grade) ? '<b>' . $courses->grade . '</b>' : '<b>-</b>'; $out .= '<td size="20%" style="text-align: center;">' . $grd . '</td>'; $sem = isset($courses->semester) ? $courses->semester : '-'; $out .= '<td size="20%">' . $sem . '</td>'; $out .= '</tr>'; if (strip_tags($courses->status) == "Not Enrolled" or ( strip_tags($courses->status)) == "waiting") { $out .='<tr style="display: none;" class="custom_row "row' . $i . '" r1 " id="innerrow' . $k . '" >'; if ($semid_getclass) $out .= '<td colspan="4">' . retrieve_listofclclasses_ofcourse($courses->courseid, $semid_getclass) . '</td>'; else $out .= '<td colspan="4">NO Active Semester is Available, To enroll the class. or Add and drop , Registration period is closed </td>'; $out .= '</tr>'; } $k++; $m++; } $i++; } $out .= '</table>'; } else { $ccourses = $DB->get_records('local_curriculum_plancourses', array('curriculumid' => $cid, 'planid' => 0)); $index = 0; foreach ($ccourses as $ccourse) { $flag = 0; $course = $DB->get_record('local_cobaltcourses', array('id' => $ccourse->courseid)); $line = array(); $line[] = '<a href="' . $CFG->wwwroot . '/local/cobaltcourses/view.php?id=' . $course->id . '&sesskey=' . sesskey() . '">' . $course->shortname . ' </a>: ' . $course->fullname; list($course->status, $course->grade) = get_course_enrolledstatus($course->id, $userid); if ($course->status == 'Completed') $course->status = '<span class="completed_color" >' . $course->status . '</span>'; else if (($course->status == 'Not Enrolled') or ( $course->status == 'waiting')) { if ($course->status == 'waiting') $course_status = 'Waiting for Approval'; else $course_status = 'Not Enrolled'; $flag = 1; $idname = 'innerdiv'; $course->status = '<span class="notenrolled_color" id="outerrow' . $index . '" onclick="plantoggle(' . $index . ')" style="cursor:pointer;">' . $course_status . '<img class="simg' . $index . '" src="pix/collapsed.svg"></img></span>'; } else $course->status = '<span class="inprogress_color" >' . $course->status . '</span>'; $line[] = $course->status; if ($course->status != 'Not Enrolled') { $course->semester = $users->get_coursestatus($course->id, $userid, true); } $line[] = isset($course->grade) ? '<b>' . $course->grade . '</b>' : '<b>-</b>'; $line[] = isset($course->semester) ? $course->semester : '-'; $data[] = $line; if ($flag == 1) { if ($semid_getclass) $msg = new html_table_cell(retrieve_listofclclasses_ofcourse($ccourse->courseid, $semid_getclass)); else $msg = new html_table_cell('NO Active Semester is Available, To enroll the class ,or Add and drop , Registration period is closed'); $msg->colspan = 4; $row = new html_table_row(array($msg)); $row->id = "innerdiv$index"; $row->attributes['class'] = "customrow"; $data[] = $row; $index++; } } } // end of else // print_object($data); $table->data = $data; $table->id = "cur_customplan"; echo '<div style="border:0px solid red" id="hierarchy-index">'; echo $out; if ($data) { echo html_writer::table($table); } echo '</div>'; echo '<br/>'; }// end of foreach }