function execute($finalelements, $data){ global $DB, $CFG; $filter_zone = optional_param('filter_programme', '', PARAM_RAW); if (!$filter_zone) return $finalelements; if($this->report->type != 'sql'){ if(!empty($finalelements)){ //list($usql, $params) = $DB->get_in_or_equal($finalelements); // //$sql ="SELECT * FROM {local_teammanager_employee} WHERE teammanagerid= ?"; //$params = array_merge(array($filter_zone)); $elements = department_wise_course(); $finalelements = array(); if($elements ){ $finalelements = array_keys($elements); } } } return $finalelements; }
$defaultname = $getdept_name->shortname; $options[$getdept_name->shortname]=$getdept_name->fullname; $i++; } //if($dept_name == '') //$dept_name = $defaultname; $sch = new single_select(new moodle_url('/course/activecourses.php'), 'name',$options,$dept_name, null); $sch->set_label('Select Department:    '); echo '<div class="active_select">'.$OUTPUT->render($sch).'</div>'; } } //} $offset1 = $userpage * $perpage; $a=0; $activecourses1=department_wise_course($a,$dept_name); //print_object($activecourses1); $drcourses2=array(); foreach($activecourses1 as $drcourse){ $coursecontext = context_course::instance($drcourse->id); //$enrolcourses = get_enrolled_users($coursecontext); ////print_object($enrolcourses); //if(!empty($enrolcourses)) { if(is_siteadmin()||is_ast_nh()){ if(avialbe_courses($drcourse->id)==1) $drcourses2[$drcourse->id]=$drcourse; }elseif(is_instructor()){ if($DB->record_exists('course', array('id'=>$drcourse->id,'usermodified'=>$USER->id))){ if(avialbe_courses($drcourse->id)==1)
public function assign_courses($id) { global $CFG, $OUTPUT, $DB, $USER; //echo $sql; $output = '<form autocomplete="off" id="assign_course' . $id . '" action="view_sessions.php" method="post" accept-charset="utf-8" class="mform" style="text-align:center;">'; $output.= '<br/><br/>You want to add Test: <input type="checkbox" id="examids' . $id . '" name="examids' . $id . '"/><br/><br/>'; $output.='<select class="assign_selects'.$id.'" name=assign_courses style="width:auto;margin:auto" id="assign_course">'; $output .= '<option value=0>---Select courses---</option>'; $courses=department_wise_course($id); //$courses=$DB->get_records('course'); foreach ($courses as $key => $value) { $output .= '<option value=' . $value->id . '>' . $value->fullname . '</option>'; } $output.='</select>'; $output .='<br/><br/><div id="pjslist' . $id . '"></div>'; $output.= '<input type="hidden" name="batchid" value=' . $id . ' />'; $output.= '<input type="submit" id="movetoid' . $id . '" class="form-submit" value="Assign courses" " style="margin: 4% 25%"/>'; $output.= '</form>'; ?> <script> $('#movetoid<?php echo $id ;?>').prop('disabled', true); $('.assign_selects<?php echo $id ;?>').on('change', function() { if(this.value!=0){ $('#movetoid<?php echo $id ;?>').prop('disabled',false); }else{ $('#movetoid<?php echo $id ;?>').prop('disabled',true); } }) $(".assign_selects<?php echo $id ;?>").on('change', function(e){ var self = $(this); var examcheck=$('input[name=examids<?php echo $id ;?>]:checked').val(); console.log(examcheck); if(self.val() !=0 && examcheck=="on") { $.ajax( { type: "POST", url: "course_quizes.php", data: { id: self.val() }, success: function(response) { $("#pjslist<?php echo $id ;?>").html(response); console.log(response); } }); } }); $("#examids<?php echo $id ;?>").click(function() { if (this.checked) { //alert( $('#assign_course :selected').val()); var self = $('#assign_course<?php echo $id ;?> :selected').val(); var examcheck=$('input[name=examids<?php echo $id ;?>]:checked').val(); console.log(examcheck); if(self !=0 && examcheck=="on") { $.ajax( { type: "POST", url: "course_quizes.php", data: { id: self }, success: function(response) { $("#pjslist<?php echo $id ;?>").html(response); console.log(response); } }); } }else{ //alert("NotChecked!"); $.ajax( { type: "POST", url: "course_quizes.php", data: { id:0}, success: function(response) { $("#pjslist<?php echo $id ;?>").html(response); console.log(response); } }); } }); </script> <?php return $output; }
//<!--rajesh has written this code--> $iconimage=html_writer::empty_tag('img', array('src'=>$CFG->wwwroot.'/theme/clean/pix/small/available_courses_small.png','size'=>'15px')); echo "<h2 class='tmhead2'><span class='iconimage'>".$iconimage."</span>".get_string('courses')."</h2>"; //<!--code end here--> //echo "<h2 class='tmhead2'>".get_string('courses')."</h2>"; $is_manager = $DB->record_exists_sql("select cp.* from {local_userdata} as cp JOIN {role_assignments} as ra ON ra.userid=cp.userid and cp.userid=$USER->id JOIN {role} as r ON r.id=ra.roleid where r.archetype='manager'"); if($is_manager){ $costcenters = $DB->get_fieldset_select('local_userdata','costcenterid','userid='.$USER->id.''); $costcenters_string=implode(',',$costcenters); } $courses=department_wise_course($id=0,$dep=-1); if (has_capability('moodle/course:create', $systemcontext)) { $options = array(); if (!empty($category->id)) { $options['category'] = $category->id; } else { $options['category'] = $CFG->defaultrequestcategory; } echo html_writer::start_tag('div', array('class'=>'addcoursebutton')); //echo $output->single_button(new moodle_url('/course/edit.php', $options), get_string("addnewcourse")); echo $output->single_button(new moodle_url('/course/edit.php', $options), 'Add a new course +'); echo html_writer::end_tag('div'); } $out=""; $table = new html_table(); $head = array('');
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Easy set variables */ /* Array of database columns which should be read and sent back to DataTables. Use a space where * you want to insert a non-database field (for example a counter or static image) */ $aColumns = array( ''); /* Indexed column (used for fast and accurate table cardinality) */ $sIndexColumn = "id"; /* DB table to use */ $sTable = "ajax"; $courses=department_wise_course($id=0,$dep=-1,$requestData); $f2f_records_count =department_wise_course($id=0,$dep=-1,$requestDatacount); //$f2f_records_count =view_session_face2face_sql($userid,$sessiontype,$requestDatacount,$starttime,$endtime,$batchid); //$f2f_records =view_session_face2face_sql($userid,$sessiontype,$requestData,$starttime,$endtime,$batchid); //print_object($f2f_records); $coursecount = 0; $i=0; $out=''; $data=array(); foreach($courses as $course){ $row=array(); $course_statistics = $DB->get_record_sql("SELECT count(ue.userid) as enrolled,count(cc.course) as completed FROM {user_enrolments} as ue JOIN {enrol} as e ON e.id=ue.enrolid RIGHT JOIN {course} as c ON c.id =e.courseid LEFT JOIN {course_completions} cc ON cc.course=e.courseid and ue.userid=cc.userid
function print_filter(&$mform) { global $DB, $CFG,$USER; $filter_zone = optional_param('filter_programme', '', PARAM_RAW); $courses=department_wise_course($id); $output=array(); $output[0]=get_string('filter_all', 'block_cobalt_reports'); //print_object($courses); foreach ($courses as $key => $value) { $output[$value->id]=$value->fullname; } $mform->addElement('select', 'filter_programme', get_string('filteprogramme', 'block_cobalt_reports'), $output); $mform->setType('filter_zone', PARAM_RAW); }