Esempio n. 1
0
if (empty($course_exist)) {
    $star = '<b style="color:red;">* &nbsp;&nbsp;' . get_string('outofcurriculum', 'local_courseregistration') . '</b>';
} else {
    $star = '';
}
echo $OUTPUT->header();
/* ---Heading of the page--- */
echo $OUTPUT->heading(get_string('manageregistration', 'local_courseregistration'));

/* ---Moodle 2.2 and onwards--- */

if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('allowframembedding', 'local_courseregistration'));
}
$precourses = prerequisite_courses($cid);
$equcourses = equivalent_courses($cid);
$data = array();

//$query = "SELECT c.*,cc.fullname as coursename,cc.credithours credithours,cc.shortname courseshortname,
//             (SELECT MAX(CONCAT(cls.fullname,':',f.fullname,':',b.fullname)) as classroom FROM {local_scheduleclass} cs JOIN {local_classroom} cls ON cls.id=cs.classroomid JOIN {local_floor} f ON f.id=cls.floorid JOIN {local_building} b ON b.id=cls.buildingid WHERE cs.classid = c.id) AS classroom,
//             (select Max(concat(FROM_UNIXTIME(lsc.startdate, '%d/%b/%Y'),'&nbsp; - &nbsp;',FROM_UNIXTIME(lsc.enddate, '%d/%b/%Y'))) FROM {local_scheduleclass} as lsc where lsc.classid=c.id AND lsc.startdate>0 AND enddate>0 ) AS dates,
//             (select Max(concat(lsc.starttime,'&nbsp;-&nbsp;',lsc.endtime)) FROM {local_scheduleclass} as lsc where lsc.classid=c.id AND lsc.startdate>0 AND enddate>0 ) AS timing,
//             (select lsc.availableweekdays  FROM {local_scheduleclass} as lsc where lsc.classid=c.id AND lsc.startdate>0 AND enddate>0 ) as availableweekdays
//             FROM {local_clclasses} c,
//                  {local_cobaltcourses} cc 
//             where c.semesterid={$semid} AND c.cobaltcourseid={$cid} AND c.cobaltcourseid=cc.id AND c.schoolid={$schoolid}";
//

$query = "SELECT c.*,cc.fullname as coursename,cc.credithours credithours,cc.shortname courseshortname             
             FROM {local_clclasses} c,
                  {local_cobaltcourses} cc 
Esempio n. 2
0
/**
 * @method get_student_class
 * @todo to get class list of a semester and course, student with status
 * @param int $courseid course id, int $semid semester id,string $status
 * @return-- it print class it
 */
function get_student_class($courseid, $semid, $status) {
    global $CFG, $DB, $USER;
    $str = '';

    $precourses = prerequisite_courses($courseid);
    $equcourses = equivalent_courses($courseid);
    /* Bug report #315  -  Student>Curriculum- Credit Hours
     * @author hemalatha c arun <*****@*****.**>
     * Resolved - overided class crdithours with cobaltcourse credithours
     */

    if (strip_tags($status) == 'Enrolled (Inprogress)') {
        $clsqry = "SELECT luc.id,luc.*, lc.*,lcc.fullname as fname,lcc.shortname as sname, lcc.credithours as credithours FROM {local_cobaltcourses} lcc,
         {local_clclasses} lc,
		 {local_user_clclasses} luc 
		 WHERE lcc.id=lc.cobaltcourseid AND 
		 lc.id=classid AND  
		 lc.semesterid={$semid} AND 
		 lc.cobaltcourseid={$courseid} AND 
		 luc.userid={$USER->id} AND luc.registrarapproval = 1";
    } else {
        $clsqry = "SELECT luc.*,lc.*,lcc.fullname as fname,lcc.shortname as sname, lcc.credithours as credithours FROM {local_cobaltcourses} lcc,
         {local_clclasses} lc,
		 {local_user_clclasses} luc 
		 WHERE lcc.id=lc.cobaltcourseid AND 
		 lc.id=classid AND  
		 
		 lc.cobaltcourseid={$courseid} AND 
		 luc.userid={$USER->id} AND luc.registrarapproval = 1";
    }
    /* Bug report #323  -  Student>Course Registration>Enroll>Reject- Status
     * @author hemalatha c arun <*****@*****.**>
     * Resolved- added valid condition to change the status in course registration page and curriculum page
     */


    if (strip_tags($status) == 'Rejected' || strip_tags($status) == 'Waiting') {
        if (strip_tags($status) == 'Rejected')
            $registrar_status = 2;
        else
            $registrar_status = 0;
        $clases = $DB->get_records_sql($clsqry);
        if (empty($clases)) {
            $clsqry = "SELECT lc.*,lcc.fullname as fname,lcc.shortname as sname, lcc.credithours as credithours,luc.* FROM {local_cobaltcourses} lcc,
         {local_clclasses} lc,
		 {local_course_adddrop} luc 
		 WHERE lcc.id=lc.cobaltcourseid AND 
		 lc.id=classid AND  
		  lc.semesterid={$semid} AND 
		 lc.cobaltcourseid={$courseid} AND 
		 luc.userid={$USER->id} AND luc.registrarapproval= $registrar_status AND luc.registrarapproval = 1";
        }
    }// end of if 
    $clases = $DB->get_records_sql($clsqry);   
    //print_object($clases);
    foreach ($clases as $class) {
        $classtype = $class->online == 1 ? 'Online' : 'Offline';
        if (strip_tags($status) == 'Enrolled (Inprogress)') {
            $enrollcount = $DB->count_records('local_user_clclasses', array('classid' => $class->id, 'semesterid' => $semid, 'registrarapproval' => 1));
            $existingseats = $class->classlimit - $enrollcount;
          //  $schedule = $DB->get_record('local_scheduleclass', array('classid' => $class->id, 'semesterid' => $semid));
        } else {
            $enrollcount = $DB->count_records('local_user_clclasses', array('classid' => $class->id, 'semesterid' => $class->semesterid, 'registrarapproval' => 1));
            $existingseats = $class->classlimit - $enrollcount;
         //   $schedule = $DB->get_record('local_scheduleclass', array('classid' => $class->id, 'semesterid' => $class->semesterid));
        }
        if ($status != 'Completed') {

            if ($class->registrarapproval == 1)
                $status = '<span class="inprogress_color" style="color:green;">Enrolled (Inprogress)</span>';
            elseif ($class->registrarapproval == 2)
                $status = '<span class="notenrolled_color" style="color:red;">Rejected</span>';
            elseif ($class->registrarapproval == 5)
                $status = '<span class="notenrolled_color" style="color:red;">'.get_string('unenolled','local_adddrop').'</span>';
            else {
                if ($class->registrarapproval == 0)
                    $status = '<span class="inprogress_color" style="color:orange;">Waiting</span>';
            }
        }


        $str.='<table id="classenroll" cellspacing="0" cellpadding="3" border="0" style="font-size:12px;border:1px solid #cccccc;line-height:24px">
        <tbody><tr>';
        $str .= '<td align="left" style="font-size:12px;background:#dddddd !important;" colspan="1">
                         <b><span style="color:#0088CC;text-decoration:none;cursor:pointer;">' . $class->shortname . ':&nbsp;</span></b> <b>' . $class->fullname . '</b>
                             <span style="color:#333333;" id="spanhonors"></span> 
             </td>';
        $str .='<td align="right" style="font-size:12px;background:#dddddd !important;">';
        $str .= '</td></tr>';
        //$str .='<table id="inner_curtable" cellspacing="0" cellpadding="0" >
        //            <tbody>
        //<tr>
        //    <td align="left"> </td>
        //    <td align="right"> <span style="font-weight:bold;color:black;">' . strtoupper(get_string('class', 'local_clclasses')) . ':</span><span style="font-weight:bold;margin-right:20px;color:#0088CC;">&nbsp;' . $class->fullname . '</span>';
        //$str .= $status;
        //$str.='</td></tr></tbody></table></td> </tr>';

        $str .=' <tr>
                 <td valign="top" align="right" style="padding-left:20px;">';
        $str .='<table cellpadding="1" border="0">
                      <tbody>
                            <tr id="instucttr">
				<td><b>' . get_string('instructor', 'local_cobaltcourses') . ':&nbsp;</b></td>
				<td>';
        $instructor = array();
        $instructor[] = get_classinst($class->id);
        $str .=implode(' ', $instructor[0]);
        $str .='</td> </tr>
                              <tr id="tr1">
					<td><b>' . get_string('credithours', 'local_cobaltcourses') . ':&nbsp;</b></td>
					<td>' . $class->credithours . '</td>
				    </tr>
				
                                                
                              
                              
                               </tbody></table>';
        $str .='</td>';
                                       

        $str .=' <td valign="top" align="right">
                                            <div>';
                                              $str .= table_multiplescheduled_view( $class->id);

		$str .='</div>
                                        </td>
                                    </tr>';

        $str .=' </tbody></table></br>';
    }
    return $str;
}