Beispiel #1
0
function render_cocustommenu() {
    global $CFG, $USER, $DB, $OUTPUT, $PAGE;
    $systemcontext = context_system::instance();
    $usercontext =context_user::instance($USER->id);
    $content = '<ul class="nav">';
    if (has_capability('local/cobaltsettings:manage', $systemcontext)) {
        $content .="<li class='dropdown'>
                                  <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>Organization Settings<b class='caret'></b></a>
                                  <ul class='dropdown-menu'>
                                   <li><a href=$CFG->wwwroot/local/cobaltsettings/category_level.php>CobaltLMS Entity Settings</a></li>
                                   <li><a href=$CFG->wwwroot/local/cobaltsettings/school_settings.php>Organization Settings</a></li>
                                   <li><a href=$CFG->wwwroot/local/cobaltsettings/gpa_settings.php>GPA/CGPA Settings</a></li>
                                   <li><a href=$CFG->wwwroot/local/prefix>Prefix and Suffix</a></li>
                                   </ul></li>";
    }
    if (has_capability('local/collegestructure:manage', $systemcontext)) {
        $content .="<li class='dropdown'>
                                  <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>Hierarchy<b class='caret'></b></a>
                                  <ul class='dropdown-menu'>";
    }
    if (has_capability('local/collegestructure:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/collegestructure>Organizations</a></li>";
    }
    if (has_capability('local/departments:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/departments>Course Libraries</a></li>";
    }
    if (has_capability('local/programs:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/programs>Programs</a></li>";
    }
    if (has_capability('local/semesters:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/semesters>Course Offerings</a></li>";
    }
    if (has_capability('local/curriculum:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/curriculum>Curriculums</a></li>";
    }
    if (has_capability('local/modules:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/modules>Modules</a></li>";
    }
    if (has_capability('local/cobaltcourses:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/cobaltcourses>Courses</a></li>";
    }
    if (has_capability('local/classes:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/classes>Classes Management</a></li>";
    }
    if (has_capability('local/collegestructure:manage', $systemcontext)) {
        $content .="</ul></li>";
    }
    if (has_capability('local/gradeletter:manage', $systemcontext)) {
        $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>Assesments<b class='caret'></b></a>
                            <ul class='dropdown-menu'>";
        if (has_capability('local/gradeletter:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/gradeletter>Grade letters</a></li>";
        }
        if (has_capability('local/examtype:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/examtype>Assesment type</a></li>";
        }
        if (has_capability('local/lecturetype:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/lecturetype>Lecture type</a></li>";
        }
        if (has_capability('local/gradesubmission:manage', $systemcontext) && has_capability('local/lecturetype:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/gradesubmission>Grade Submission</a></li>";
        }
        if (has_capability('local/scheduleexam:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/scheduleexam>Assesments</a></li>";
        }
        $content .="</ul></li>";
        $content .="<li><a href=$CFG->wwwroot/local/helpmanuals/registrar/index.html  target='_blank'>Help Manual</a></li>";
    }
    /*   if(has_capability('local/classroomresources:manage', $systemcontext)){
      $content .="<li class='dropdown'>
      <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>Resourse Management<b class='caret'></b></a>
      <ul class='dropdown-menu'>";
      $content .="<li><a href=$CFG->wwwroot/local/classroomresources/index.php>Manage Buildings</a></li>";
      $content .="<li><a href=$CFG->wwwroot/local/classroomresources/viewfloor.php>Manage Floors</a></li>";
      $content .="<li><a href=$CFG->wwwroot/local/classroomresources/viewclassroom.php>Manage Classrooms</a></li>";
      $content .="<li><a href=$CFG->wwwroot/local/classroomresources/viewresource.php>Manage Resources</a></li>";
      $content .="<li><a href=$CFG->wwwroot/local/classroomresources/view.php>Assign Resources</a></li>";
      $content .="</ul></li>";
      } */

    //   $content .='</ul>';
    //for instructor starts-------------------------------------------------------
    if (has_capability('local/classes:submitgrades', $systemcontext)) {
        if (!is_siteadmin($USER->id)) {
            $content .="<li><a href=$CFG->wwwroot/local/academiccalendar>Events Calendar</a></li>";

            $content .="<li><a href=$CFG->wwwroot/local/classroomresources/timetable.php>Class Schedule</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/scheduleexam>Assesments Schedule</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/helpmanuals/instructor/index.html target='_blank'>Help Manual</a></li>";
        }
    }

    //for instructor ends-------------------------------------------------------
    //For students starts-----------------------------------------------------
    if (isloggedin()) {
        $context = context_user::instance($USER->id);
        if (has_capability('local/classes:enrollclass', $context) && !is_siteadmin()) {
            //----------------------starts of my academics------------------------------
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>My Learning<b class='caret'></b></a>
                            <ul class='dropdown-menu'>";
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/mycur.php>Curriculum</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/myclasses.php>Current Classes</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/scheduleexam>Scheduled Assesments</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/myacademics/transcript.php>Transcript</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/academiccalendar>Events Calender</a></li>";
            $content .="</ul></li>";
            //--------------------------------end of my academics--------------------------------------------------------------------------------
            //--------------------------------course registration--------------------------------------------------------------------------------
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>Course Registration<b class='caret'></b></a>
                            <ul class='dropdown-menu'>";
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/index.php>Register to Course/Class</a></li>";
            $content .="</ul></li>";
            //--------------------end of course registration----------------------------------------------------------------------------------------------
            //--------------------Requests links----------------------------------------------------------------------------------------------------------
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>My Requests<b class='caret'></b></a>
                            <ul class='dropdown-menu'>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_id.php>ID Card</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_profile.php>Profile Change</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_transcript.php>Transcript</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/course_exem.php>Course Exemption</a></li>";
            $content .="</ul></li>";
            //-----------------------------end of requests links-------------------------------------------------------------------------------------------
            $content .="<li><a href=$CFG->wwwroot/local/helpmanuals/student/index.html target='_blank'>Help Manual</a></li>";
        }
    }
    // for mentor starts-------------------------------------------
    if (has_capability('local/classes:approvemystudentclasses', $systemcontext) && !is_siteadmin()) {
        $content .="<li><a href=$CFG->wwwroot/local/mentor>My Students</a></li>";
        $content .="<li><a href=$CFG->wwwroot/local/helpmanuals/mentor/index.html target='_blank'>Help Manual</a></li>";
    }
    // mentor ends
    if (isloggedin() & !isguestuser()) {

        $msgnotification = message_count_unread_messages($USER);
        $heirarchy = new hierarchy();
        $request = new requests();
        $applicationnotice = $heirarchy->count_admissions_from_applicants($USER->id);
        $requestnotice = $request->all_student_requests_count($USER->id);
        $courserequestnotice = $heirarchy->count_course_requests_from_students($USER->id);
        $transcriptnotice = $heirarchy->count_transcript_req_from_student($USER->id);
        $courseexemptionnotice = $heirarchy->count_coureexe_req_from_student($USER->id);
        $profilechangenotice = $heirarchy->count_profilechange_req_from_student($USER->id);
        $idcardnotice = $heirarchy->count_idcard_req_from_student($USER->id);
        $newappnotice = $heirarchy->count_new_admission_req_from_student($USER->id);
        $transferappnotice = $heirarchy->count_transfer_admission_req_from_student($USER->id);
        $totalrequest = $courserequestnotice + $requestnotice;

        $content .="<li><a href=$CFG->wwwroot/message/ title='Messages' id='messages'>
         <sup  id='msgnotice'>$msgnotification</sup></a></li>";
        $context = context_user::instance($USER->id);
        if (has_capability('local/classes:enrollclass', $context) && !is_siteadmin()) {
            $allapprovals = $request->all_approved_requests($USER->id);
            $transcriptapprovals = $heirarchy->count_trasncripts_approve_from_registrar($USER->id);
            $courseexemptionapproval = $heirarchy->count_courseexe_approve_from_registrar($USER->id);
            $idcardapproval = $heirarchy->count_idcard_approve_from_registrar($USER->id);
            $profilechangeapproval = $heirarchy->count_profilechange_approve_from_registrar($USER->id);
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle open'  data-toggle='dropdown' id='allrequests' title='Request Approvals'>
                            <sup id='arequests'>$allapprovals</sup></a>
                            <ul class='dropdown-menu'>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_transcript.php>Transcripts($transcriptapprovals)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/course_exem.php>Coures Exemptions($courseexemptionapproval)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_id.php>ID Card($idcardapproval)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_profile.php>Profile Change($profilechangeapproval)</a></li>";
            $content .="</ul></li>";
        }
        if (has_capability('local/collegestructure:manage', $systemcontext) && !is_siteadmin($USER->id)) {
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown' id='apprequests' title='Applicant Requests'>
                            <sup id='requests'>$applicationnotice</sup></a>
                            <ul class='dropdown-menu'>";
            $content .="<li><a href=$CFG->wwwroot/local/admission/viewapplicant.php>New Application($newappnotice)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/admission/transferapplicant.php>Transfer Application($transferappnotice)</a></li>";
            $content .="</ul></li>";
        }
        if ((has_capability('local/collegestructure:manage', $systemcontext) || has_capability('local/classes:approvemystudentclasses', $systemcontext)) && !is_siteadmin($USER->id)) {
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown' id='allrequests' title='Requests'>
                            
                            <sup id='arequests'>$totalrequest</sup></a>
                            <ul class='dropdown-menu'>";
        }
        if ((has_capability('local/collegestructure:manage', $systemcontext) || has_capability('local/classes:approvemystudentclasses', $systemcontext)) && !is_siteadmin($USER->id)) {
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/registrar.php?current=pending>Approve Course (<b class='counts'>$courserequestnotice </b>)</a></li>";
        }
        if (has_capability('local/collegestructure:manage', $systemcontext) && !is_siteadmin($USER->id)) {
            $content .="<li><a href=$CFG->wwwroot/local/request/approval_transcript.php>Approve Transcripts (<b class='counts'>$transcriptnotice</b>)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/approveexem.php>Approve Coures Exemptions (<b class='counts'>$courseexemptionnotice</b>)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/approval_id.php>Approve ID Card (<b class='counts'>$idcardnotice</b>)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/approval_profile.php>Approve Profile Change (<b class='counts'>$profilechangenotice</b>)</a></li>";
        }
        if ((has_capability('local/collegestructure:manage', $systemcontext) || has_capability('local/classes:approvemystudentclasses', $systemcontext)) && !is_siteadmin($USER->id)) {
            $content .="</ul></li>";
        }
        if (has_capability('local/academiccalendar:manage', $systemcontext)) {
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown' id='quicklinks'><img src= $CFG->wwwroot/theme/colms/pix/quicklinks.png class='dropdown-toggle'  data-toggle='dropdown'/><b class='caret'></b></a>
                            <ul class='dropdown-menu'>";
        }
        if (has_capability('local/academiccalendar:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/academiccalendar>Events Calendar</a></li>";
        }
        if (has_capability('local/admission:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/admission/viewapplicant.php>Online Registrations</a></li>";
        }
        if (has_capability('local/courseregistration:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/registrar.php?current=pending>Course Enrollments</a></li>";
        }
        if (has_capability('local/courseregistration:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/evaluations/index.php>Evaluations</a></li>";
        }
        if (has_capability('local/academiccalendar:manage', $systemcontext)) {
            $content .="</ul></li>";
        }
    }

    $content .="</ul>";

    //For students ends------------------------------------------------------
    return $content;
}
Beispiel #2
0
    /**
     * Outputs the messages menu
     * @return custom_menu object
     */
    public function cobalt_new_requests() {
        global $CFG, $USER;

        if (!isloggedin() || isguestuser()) {
            return false;
        }
        $heirarchy = new hierarchy();
        //$request = new requests();
        $applicationnotice = $heirarchy->count_admissions_from_applicants($USER->id);
        //$requestnotice = $request->all_student_requests_count($USER->id);
        $courserequestnotice = $heirarchy->count_course_requests_from_students($USER->id);
        $transcriptnotice = $heirarchy->count_transcript_req_from_student($USER->id);
        $courseexemptionnotice = $heirarchy->count_coureexe_req_from_student($USER->id);
        $profilechangenotice = $heirarchy->count_profilechange_req_from_student($USER->id);
        $idcardnotice = $heirarchy->count_idcard_req_from_student($USER->id);
        $totalrequest = $courserequestnotice /*+ $requestnotice*/;
        
        $systemcontext = context_system::instance();
        
        $content = '<ul class="nav">';
        if ((has_capability('local/collegestructure:manage', $systemcontext) || has_capability('local/classes:approvemystudentclasses', $systemcontext)) && !is_siteadmin($USER->id)) {
            $content .="<li class='dropdown'>
                            <a class='dropdown-toggle' title='Requests' data-toggle='dropdown' href='#'>
                            <i class='fa fa-envelope-o'></i>
                            <sup id='arequests'>$totalrequest</sup>
                            <i class='fa fa-caret-right'></i>
                            </a>
            
                        <ul class='dropdown-menu'>";
        }
        if ((has_capability('local/collegestructure:manage', $systemcontext) || has_capability('local/classes:approvemystudentclasses', $systemcontext)) && !is_siteadmin($USER->id)) {
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/registrar.php?current=pending>Approve Course (<b class='counts'>$courserequestnotice </b>)</a></li>";
        }
        if (has_capability('local/collegestructure:manage', $systemcontext) && !is_siteadmin($USER->id)) {
            $content .="<li><a href=$CFG->wwwroot/local/request/approval_transcript.php>Approve Transcripts (<b class='counts'>$transcriptnotice</b>)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/approveexem.php>Approve Coures Exemptions (<b class='counts'>$courseexemptionnotice</b>)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/approval_id.php>Approve ID Card (<b class='counts'>$idcardnotice</b>)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/approval_profile.php>Approve Profile Change (<b class='counts'>$profilechangenotice</b>)</a></li>";
        }
        if ((has_capability('local/collegestructure:manage', $systemcontext) || has_capability('local/classes:approvemystudentclasses', $systemcontext)) && !is_siteadmin($USER->id)) {
            $content .="</ul></li>";
        }
        $content .= '</ul>';
        return $content;
        
        
        
        
        
        
        

        $messages = $this->get_user_messages();
        $totalmessages = count($messages['messages']);

        if (empty($totalmessages)) {
            $messagemenuicon = html_writer::tag('i', '', array('class' => 'fa fa-envelope-o'));
            $messagetitle = get_string('nomessagesfound', 'theme_essential');
            $messagemenutext = html_writer::span($messagemenuicon);
            $messagemenu->add(
                $messagemenutext,
                new moodle_url('/message/index.php', array('viewing' => 'recentconversations')),
                $messagetitle,
                9999
            );
        } else {

            if (empty($messages['newmessages'])) {
                $messagemenuicon = html_writer::tag('i', '', array('class' => 'fa fa-envelope-o'));
            } else {
                $messagemenuicon = html_writer::tag('i', '', array('class' => 'fa fa-envelope'));
            }
            $messagetitle = get_string('unreadmessages', 'message', $messages['newmessages']);

            $messagemenutext = html_writer::tag('span', $messages['newmessages']) . $messagemenuicon;
            $messagesubmenu = $messagemenu->add(
                $messagemenutext,
                new moodle_url('/message/index.php', array('viewing' => 'recentconversations')),
                $messagetitle,
                9999
            );

            foreach ($messages['messages'] as $message) {
                $addclass = 'read';
                $iconadd = '-o';

                if ($message->unread) {
                    $addclass = 'unread';
                    $iconadd = '';
                }
                if ($message->type === 'notification') {
                    $messagecontent = html_writer::start_div('notification ' . $addclass);
                    $messagecontent .= html_writer::tag('i', '', array('class' => 'fa fa-info-circle icon'));
                    $messagecontent .= html_writer::start_span('msg-time');
                    $messagecontent .= html_writer::tag('i', '', array('class' => 'fa fa-comment' . $iconadd));
                    $messagecontent .= $this->get_time_difference($message->date);
                    $messagecontent .= html_writer::end_span();
                    $messagecontent .= html_writer::span($message->text, 'notification-text');
                    $messagecontent .= html_writer::end_div();
                } else {
                    if (!is_object($message->from) || !empty($message->from->deleted)) {
                        continue;
                    }
                    $senderpicture = new user_picture($message->from);
                    $senderpicture->link = false;
                    $senderpicture->size = 60;

                    $messagecontent = html_writer::start_div('message ' . $addclass);
                    $messagecontent .= html_writer::start_span('msg-picture') . $this->render($senderpicture) . html_writer::end_span();
                    $messagecontent .= html_writer::start_span('msg-body');
                    $messagecontent .= html_writer::start_span('msg-time');
                    $messagecontent .= html_writer::tag('i', '', array('class' => 'fa fa-comments' . $iconadd));
                    $messagecontent .= $this->get_time_difference($message->date);
                    $messagecontent .= html_writer::end_span();
                    $messagecontent .= html_writer::span($message->from->firstname, 'msg-sender');
                    $messagecontent .= html_writer::span($message->text, 'msg-text');
                    $messagecontent .= html_writer::end_span();
                    $messagecontent .= html_writer::end_div();
                }

                $messagesubmenu->add($messagecontent, $message->url, $message->text);
            }
        }
        return $this->render_custom_menu($messagemenu);
    }