Exemplo n.º 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;
}