예제 #1
0
파일: lib.php 프로젝트: anilch/Personel
    /**
     * @method view_classes
     * @param int $id ClassID
     * @todo To display the table for classes
     */
    public function view_classes($id) {        
        global $DB, $CFG;
        
        
        //   (SELECT MAX(CONCAT(b.shortname,'/',f.shortname,'/',cls.shortname)) 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 = lc.id) AS classroom,
        //     (select Max(concat(FROM_UNIXTIME(lsc.startdate, '%d-%b-%Y'),'  -  ',FROM_UNIXTIME(lsc.enddate, '%d-%b-%Y'))) FROM {local_scheduleclass} as lsc where lsc.classid=lc.id AND lsc.startdate>0 AND enddate>0 ) AS scheduledate,
         //    (select lsc.availableweekdays FROM {local_scheduleclass} as lsc where lsc.classid=lc.id AND lsc.startdate>0 AND enddate>0) as availableweekdays ,
          //s   (select Max(concat(lsc.starttime,' - ',lsc.endtime)) FROM {local_scheduleclass} as lsc where lsc.classid=lc.id AND lsc.startdate>0 AND enddate>0 ) AS scheduletime
        $sql = "SELECT lc.*,
             cc.fullname AS coursename,
             ls.fullname AS semestername,ls.id AS semesterid,
             s.fullname AS schoolname,s.id AS schoolid,
             (select oc.fullname from {course} oc where oc.id=lc.onlinecourseid) AS onlinecoursename         

       FROM {local_clclasses} lc JOIN {local_semester} ls 
       ON lc.semesterid=ls.id JOIN {local_school} s 
       ON lc.schoolid=s.id JOIN {local_cobaltcourses} cc 
       ON lc.cobaltcourseid=cc.id where lc.id={$id}";
        $classes = $DB->get_record_sql($sql);


        $table = new html_table();
        $table->align = array('right', 'left', 'right', 'left');
        $table->size = array('15%', '35%', '15%', '35%');
        $table->width = '100%';

        $clas = new html_table_cell();
        $clas->text = $classes->description;
        $clas->colspan = 3;
        $classmode = ($classes->type == 1) ? get_string('clsmode_1', 'local_clclasses') : get_string('clsmode_2', 'local_clclasses');
        $classtype = ($classes->online == 1) ? get_string('online', 'local_clclasses') : get_string('offline', 'local_clclasses');
        $instructor = array();
        $exams = array();
        $evaluations = array();
        $clastype = array();
        $instructor[] = get_classinst($id);
        $exams[] = $this->get_classexams($id);

        $onlineexams = array();
        $onlineexams[] = $this->get_onlineexams($id);
        $evaluations[] = $this->get_evaluations($id);
        $evaluation = implode('', $evaluations[0]);
        $instruct = implode('', $instructor[0]);
        !empty($classes->availableweekdays) ? $classes->scheduledate = $classes->scheduledate . '(' . $classes->availableweekdays . ')' : null;

        $exams = implode(' ', $exams[0]);
        $onlineexams = implode(' ', $onlineexams[0]);
        $table->data[] = array('<b>' . get_string('classesshortname', 'local_clclasses') . '</b>', $classes->shortname, '<b>' . get_string('semestername', 'local_semesters') . ':</b>', $classes->semestername);
        $table->data[] = array('<b>' . get_string('course', 'local_cobaltcourses') . ':</b>', $classes->coursename, '<b>' . get_string('classmode', 'local_clclasses') . ':</b>', $classmode);
        $table->data[] = array('<b>' . get_string('classlimit', 'local_clclasses') . ':</b>', $classes->classlimit, '<b>' . get_string('instructor', 'local_clclasses') . ':</b>', $instruct);
        $clstype[] = '<b>' . get_string('classtype', 'local_cobaltcourses') . ':</b>';
        $clstype[] = $classtype;
        /*
         * ###Bugreport #184- Class details page
         * @author Naveen Kumar<*****@*****.**>
         * (Resolved) If class is offline not showing onlinecoursename replaced with(--)
         */
        $classes->online == 1 ? $clstype[] = '<b>' . get_string('onlinecourse', 'local_clclasses') . ':</b>' : $clstype[] = '--';
        $classes->online == 1 ? $clstype[] = $classes->onlinecoursename : $clstype[] = '--';
        $table->data[] = $clstype;      
        $table->data[] = array('<b>'.  get_string('schoolid', 'local_collegestructure') . ':</b>', $classes->schoolname,'','','');
        $table->data[] = array('<b>' . get_string('exam', 'local_clclasses') . ':</b>', $exams . $onlineexams, '<b>' . get_string('evaluation', 'local_clclasses') . ':</b>', $evaluation);

        $table->data[] = array('<b>' . get_string('description', 'local_clclasses') . ':</b>', $clas);
        $optionrow = new html_table_row();                 
        $optioncell = new html_table_cell(table_multiplescheduled_view($id));
        $optioncell->colspan = 3;
        $optionrow->cells[] ='<b>'.get_string('scheduledinformation','local_clclasses').'</b>';
        $optionrow->cells[] = $optioncell;
           $table->data[] =  $optionrow->cells;

        echo html_writer::table($table);
    }
예제 #2
0
				    </tr>
				
                                                <tr>
                                                    <td align="right"><b>' . get_string('max_seats', 'local_courseregistration') . ':</b></td><td>' . $list->classlimit . '</td>
                                                </tr>
                                                <tr>
                                                    <td align="right"><b>' . get_string('left_seats', 'local_courseregistration') . ':</b></td><td>' . $existingseats . '</td>
                                                </tr>
                                             
                                            </tbody></table>
                                        </td> ';
    $str .=' <td valign="top" align="right">
                                            <div>';
                                            
					
                         $str .= table_multiplescheduled_view( $list->id);
				   $str .= '</div>
                                        </td>
                                    </tr>';
    $str .=' <tr>
                                        <td valign="top" align="left" style="padding-left:20px;" colspan="3">
                                            <table cellspacing="4" cellpadding="0" border="0" style="width:100%;">
                                                <tbody>';


    $str .=' <tr style="">
                                                    <td style="/*border:1px solid #dddddd;*/">
                                                        <table>
                                                            <tbody><tr>
                                                                <td valign="top" align="left"><b>' . get_string('Pre-Requisite', 'local_courseregistration') . ':</b></td>
                                                                <td valign="top" align="left">' . $precourses . '</td> 
예제 #3
0
파일: lib.php 프로젝트: anilch/Personel
/**
 * @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;
}