Example #1
0
    function definition_after_data() {
        global $DB;
        $mform = $this->_form;

        $hierarchy = new hierarchy();
        //$eid = $this->_customdata['temp'];
        //  if ($eid->id < 0) {
        $school = $mform->getElementValue('schoolid');      

        $tools = array();
        if ($school[0] > 0 || $school>0) {
              $fid = $school[0];
            if(isset($school[0]))
             $schoolid=$school[0];
            else
            $schoolid = $school;
            $hierarchy = new hierarchy();

            $upcomingsemester = $hierarchy->get_upcoming_school_semesters($schoolid);
            //   print_object($upcomingsemester);
            $activesemester = $hierarchy->get_allmyactivesemester(null, $schoolid);
            //     print_object($activesemester);
            $active_upcomingsemester = $upcomingsemester + $activesemester;

            $newel = $mform->createElement('select', 'semesterid', get_string('selectsemester_timetable', 'local_timetable'), $active_upcomingsemester);
            $mform->insertElementBefore($newel, 'addsemesterlisthere');    
            $mform->addRule('semesterid', get_string('selectsemester_timetable', 'local_timetable'), 'required', null, 'client');
            // $formatvalue2 [0];
        }
        //  }
    }
Example #2
0
$users = users::getInstance();
echo $OUTPUT->header();
/* ---Heading of the page--- */
echo $OUTPUT->heading(get_string('mycurriculum', 'local_curriculum'));

/* ---Moodle 2.2 and onwards--- */
$currenttab = 'myplan';
/* ---adding tabs--- */
$exams->studentside_tabs($currenttab);
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('mycurriculumdec', 'local_curriculum'));
}

// -----used get to cuurent active semesterid--------------------------------
$hier = new hierarchy();
$semesterid = $hier->get_allmyactivesemester($USER->id);
foreach ($semesterid as $key => $value)
    $semid_getclass = $key;
//--------------------------------------------------------------------------

//Assume only one curriculum
$query = "SELECT cp.* FROM {local_userdata} u JOIN {local_curriculum} cp ON cp.id=u.curriculumid where u.userid={$USER->id}";
$list = $DB->get_record_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) {
Example #3
0
in_array('M', $availabledate) ? $tool->mon = 1 : $tool->mon = 0;
in_array('TU', $availabledate) ? $tool->tue = 1 : $tool->tue = 0;
in_array('W', $availabledate) ? $tool->wed = 1 : $tool->wed = 0;
in_array('TH', $availabledate) ? $tool->thu = 1 : $tool->thu = 0;
in_array('F', $availabledate) ? $tool->fri = 1 : $tool->fri = 0;
in_array('SA', $availabledate) ? $tool->sat = 1 : $tool->sat = 0;
in_array('SU', $availabledate) ? $tool->sun = 1 : $tool->sun = 0;


$editform->set_data($tool);
if ($editform->is_cancelled()) {
    /* Bug report #297  -  Classes>Enroll Users- Past and Upcoming course offerings
     * @author hemalatha c arun <*****@*****.**>
     * Resolved - Redirected to view page , when class is not belongs to active semester
     */
    $semlist = $hierarchy->get_allmyactivesemester(NULL, $schoid);
    foreach ($semlist as $key => $value) {
        $activesemesterid = $key;
    }
    if ($activesemesterid == $semid)
        $returnurl = new moodle_url('/local/clclasses/enroluser.php', array('semid' => $semid, 'id' => $classid));
    else
        $returnurl = new moodle_url('/local/clclasses/index.php');
    redirect($returnurl);
}
else if ($data = $editform->get_data()) {
    if ($data->id > 0) {
        
        $data->mon ? $availabledates[] = 'M' : null;
        $data->tue ? $availabledates[] = 'TU' : null;
        $data->wed ? $availabledates[] = 'W' : null;
Example #4
0
 public function get_userdetails_accounts($userid)
 {
     global $DB, $OUTPUT;
     $hierarchy = new hierarchy();
     $requests = new requests();
     $help_desk_lib = new user_filtering_accounts();
     $user = $DB->get_record('user', array('id' => $userid));
     $local_user = $DB->get_record('local_users', array('userid' => $userid));
     $local_user_data = $DB->get_record('local_userdata', array('userid' => $userid));
     $fullname = $user->firstname . ' ' . $user->lastname;
     $out = '<div class="userprofilebox clearfix"><div class="profilepicture">';
     $out .= $OUTPUT->user_picture($user, array('size' => 50));
     $out .= '</div>';
     $table = new html_table();
     $table->id = 'accounts_viewmore';
     $table->size = array('20%', '80%');
     $table->align = array('right', 'left');
     $get_alldepartments = $hierarchy->get_alldepartments($user->id);
     $get_allmyactivesemester = $hierarchy->get_allmyactivesemester($user->id);
     $student_semesters = student_semesters($user->id);
     //School with department
     if ($school = $requests->school($user->id)) {
         foreach ($school as $schools) {
             $schoolid = $schools->id;
             $schoolname = $schools->fullname;
             $s1[] = $schoolname;
             $programs = $requests->program($schoolid, $user->id);
             foreach ($programs as $program) {
                 $proid = $program->id;
                 $p[] = $DB->get_field('local_program', 'fullname', array('id' => $proid));
                 if ($serviceid = $requests->service($schoolid, $proid, $user->id)) {
                     $s3[] = $serviceid->serviceid;
                 }
             }
         }
         if ($s1) {
             $s2 = implode(',&nbsp;', $s1);
             $myschools = "<p><b>School: </b>" . $s2 . "</p>";
         }
         if ($p) {
             $pro = implode('&nbsp;', $p);
             $myschools .= "<span style='margin-left: 6%;'><b>Program: </b>" . $pro . "</span>";
         }
     }
     //End of school
     print_object($help_desk_lib->user_enrolled_courses($userid));
     $table->data = array(array(get_string('username'), $user->username), array(get_string('fullname'), $fullname), array(get_string('firstname'), $user->firstname), array(get_string('lastname'), $user->lastname), array(get_string('email'), $user->email), array(get_string('phone'), $user->phone1), array(get_string('phone2'), $user->phone2), array(get_string('dob', 'local_admission'), date('Y-m-d', $local_user->dob)), array(get_string('doj', 'local_users'), date('Y-m-d', $local_user->timecreated)), array(get_string('genderheading', 'local_admission'), $local_user->gender), array(get_string('serviceid', 'local_users'), implode(',&nbsp;', $s3)), array(get_string('idnumber'), $user->idnumber), array(get_string('hschool', 'local_users'), $local_user->primaryschoolname), array(get_string('primaryyear', 'local_admission'), $local_user->primaryyear), array(get_string('score', 'local_admission'), $local_user->primaryscore), array(get_string('pcountry', 'local_admission'), $local_user->primaryplace), array(get_string('contactname', 'local_admission'), $local_user->fathername), array(get_string('hno', 'local_admission'), $local_user->currenthno), array(get_string('pob', 'local_admission'), $local_user->pob), array(get_string('city'), $local_user->region), array(get_string('state'), $local_user->state), array(get_string('icqnumber'), $user->icq), array(get_string('skypeid'), $user->skype), array(get_string('yahooid'), $user->yahoo), array(get_string('aimid'), $user->aim), array(get_string('msnid'), $user->msn), array(get_string('language'), $user->lang), array(get_string('timezone'), usertimezone($user->timezone)), array(get_string('departments', 'local_help_desk'), $hierarchy->get_alldepartments($user->id)), array(get_string('activesemister', 'local_help_desk'), $hierarchy->get_allmyactivesemester($user->id)), array(get_string('studentsemister', 'local_help_desk'), student_semesters($user->id)), array(get_string('myschools', 'local_help_desk'), $myschools));
     //get_string('dob', 'local_admission') . "</b></;" . date("Y-m-d", $local_users->dob) . "
     //get_string('doj', 'local_users') . "</b></td>< date("Y-m-d", $local_users->timecreated)
     //get_string('genderheading', 'local_admission')nbsp;&nbsp;" . $local_users->gender . "</
     //print_object($get_alldepartments);
     //print_object($get_allmyactivesemester);
     //print_object($student_semesters);
     //print_object(date('D M Y', $user->dob));
     $edit_url = new moodle_url('/user/edit.php', array('id' => $userid));
     $out .= html_writer::tag('a', 'EDIT', array('href' => $edit_url, 'id' => 'EDIT'));
     $out .= html_writer::table($table);
     return $out;
 }
Example #5
0
    public function class_view($classlist, $clobject) {
        global $DB, $CFG, $OUTPUT, $USER, $PAGE;
         $hierarchy = new hierarchy();
        $PAGE->requires->js('/local/timetable/js/tmember_toggle.js');
        $semclass = new schoolclasses();
        if ($classlist) {
             $j=0;
            foreach ($classlist as $clas) {
             if($j>0)
             $displaynone = "display:none";
             else
             $displaynone = "";
                $line = array();           

                $first_inner=$this->get_firstpart_ofrow( $clas);

                $status = $clobject->class_status($clas->id);
                // $extrainfo = html_writer::start_tag('div', array('class' => 'myteam_ul'));
                
                $numberofapproved=(isset($status->noapproved)?$status->noapproved:0);
                $numberofpending=(isset($status->nopending)?$status->nopending:0);
                $numberofexams=(isset($status->noexams)?$status->noexams:0); 
                  
                
                $second_inner = "<ul id='second_inner'><li class='color_green'>Approved Enrollments: $numberofapproved " . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/switch'), 'alt' => '', 'class' => 'iconsmall',  'id' => 'tm_switchbutton'), array('title' => '', 'style' => 'cursor:pointer')) . "</li>";
                $second_inner .= "<li class='color_red'>Pending Approvals: $numberofpending</li>";
                $second_inner .= "<li>Number of Exams: $numberofexams</li>";
                $second_inner .= "<li class='color_blue'>".get_string('scheduleinfo','local_timetable'). html_writer::empty_tag('img', array('src' =>  $OUTPUT->pix_url('t/switch'),  'class' => 'iconsmall', 'onclick' => 'teammember_list(' . $clas->id . ')', 'id' => 'tm_switchbutton'), array( 'style' => 'cursor:pointer')) ."</li></ul>";
                //$schedule = $DB->get_field('local_scheduleclass', 'id', array('classid' => $clas->id));
                //if (!$schedule) {
                //    $schedule = -1;
                //}
                $toggle = "<div id = 'dialog$clas->id' class = 'tmem_toggle dialog1' style = '$displaynone;clear:both; '>";              
                $toggle .= $this->toggle_scheduleclassview($clas, $clobject);
                $toggle .="</div>";
                
                
                // fetcing activesemesterid
                $semlist = $hierarchy->get_allmyactivesemester(NULL, $clas->schoolid);
                $this->s_semlist = $semlist;
               
                foreach ($semlist as $key => $value) {
                $activesemesterid = $key;
               
                }
                $activesemesterid   =($activesemesterid?$activesemesterid :0); 

                //   displaying buttons
                $options = array(array('link' => new moodle_url('/local/clclasses/classenrol.php', array('id' => $clas->id, 'semid' => $clas->semesterid, 'activesemid' =>  $activesemesterid)), 'string' => get_string('enrollusers', 'local_clclasses')),
                    array('link' => new moodle_url('/local/clclasses/scheduleclass.php', array('id' => -1, 'classid' => $clas->id, 'semesterid' => $clas->semesterid, 'schoolid' => $clas->schoolid, 'deptid' => $clas->departmentid, 'courseid' => $clas->cobaltcourseid, 'sesskey' => sesskey())), 'string' => get_string('scheduleclass_timetable', 'local_timetable')),
                    array('link' => new moodle_url('/local/clclasses/examsetting.php', array('id' => $clas->id, 'semid' => $clas->semesterid, 'schoolid' => $clas->schoolid, 'sesskey' => sesskey())), 'string' => get_string('criteria', 'local_clclasses')),
                    array('link' => new moodle_url('/local/evaluations/create_evaluation.php', array('clid' => $clas->id, 'sesskey' => sesskey())), 'string' => get_string('evaluation', 'local_clclasses'))
                );
                $menulist = array();
                foreach ($options as $types) {
                    $menulist[] = '<button>' . html_writer::link($types['link'], $types['string']) . '</button>';
                    $menulist[] = '<hr />';
                }
                // Remove the last element (will be an HR)
                array_pop($menulist);
                
                // Display the content as a list
                $third_inner = html_writer::alist($menulist, array('class' => 'third_inner cl_buttonrow'), 'ul');
                $third_inner .= "<span id='classes_thirdinner'>$clas->semestername</span>";
                $cell1 = new html_table_cell();
                $cell1->attributes['class'] = 'colms_cell';
                $cell1->text = $first_inner . $second_inner . $toggle . $third_inner;
                $line[] = $cell1;
                $line[] = $clas->classname;
                $line[] = $clas->semestername;
                $line[] = ($clas->online==1? 'Online':'Offline');
                
                $data[] = $line;
              $j++;
            }// end of  foreach
        }// end of if
           
         
        $PAGE->requires->js('/local/clclasses/filters/classes.js');
        $output = "<div id='filter-box' >";
        $output .=  '<div class="filterarea"></div></div>';

        $table = new html_table();
        $table->head = array('','','');
        $table->id = "classtable";
        $table->size = array('100%');
        $table->align = array('left');
        $table->width = '99%';
        $table->data = $data;

        $output .= html_writer::table($table);
        return $output;
    }
Example #6
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
}