//print_r($am_type_name); switch($mid){ case 1: section_activities($secid,$cid);break; case 2: set_activity_status($aid);break; case 3: set_activity_completiondate($aid);break; case 4: get_activity_status();break; case 5: get_student_sections($cid);break; case 6: add_student_to_watchlist($cid,$uid);break; case 7: get_loggedin_users_by_section($section);break; case 8: get_user_quiz_grade($aid,$uid);break; case 9: get_user_quiz_instance($aid);break; case 10: get_itemid_from_grade_table($aid,$am_type_name,$cid);break; case 11: get_course_absenties($cid); case 12: set_course_absenties($cid,$aid); case 13: getCntofAbsentActivities($sid,$cid); case 14:getStudentAttandanceofActivity($sid,$aid,$cid); } function section_activities($secid,$cid){ $course=get_course($cid); $modinfo = get_fast_modinfo($course); $mods = $modinfo->get_cms(); $sections = $modinfo->get_section_info_all(); $sec_array = get_sections($sections); $arr = array(); $cnt=0; //preparing an array which contains sections and activities foreach ($mods as $mod) { $arr[$cnt++]=array('secid'=>$mod->section,'modid'=>$mod->id,'modname'=>$mod->name,'modcontent'=>$mod->content);
function getWatchlistByCoursePdf($coursid){ global $DB,$CFG; // Global Variables $context = get_context_instance(CONTEXT_COURSE, $coursid); // Getting Copurse context from courseid $students = get_role_users(5, $context); // Getting students of a course $course = $DB->get_record('course', array('id' => $coursid), '*', MUST_EXIST); // Getting course record $watlist= getAllWatchlistRecordByCourse($coursid,1); // calling lib method to get records of watchlisted $html=''; $html .= "<table class='watchlist-table1'><thead> <tr><th>Roll No</th><th>Full Name</th><th>Rank</th><th>Department</th> <th>Mean Grade</th><th>Todays Grade</th><th>Attendance</th></tr></thead><tbody id='wtbody'>"; $html.= "<input type='hidden' name='couid' value='$coursid'>"; foreach ($watlist as $wlist) { $userobj = get_complete_user_data(id, $wlist->userid); // Getting User Object from userid $t=time(); //to get todays date time $yt=time()-86400; // to get yesterdays date $attandance=getCntofAbsentActivities($wlist->userid,$coursid); $sql="SELECT round(avg(finalgrade),2) as cumulativegrade FROM mdl_grade_grades where itemid in( select id from mdl_course_modules where course=$coursid and `completionexpected`<= $yt) and userid=$wlist->userid"; $res=$DB->get_record_sql($sql); // to get all activies of a course till yesterday //var_dump($res); $sql1="SELECT round(avg(finalgrade),2) as currentgrade , count(*) as reccount FROM mdl_grade_grades where itemid in(select id from mdl_course_modules where course=$coursid and `completionexpected`< $t and completionexpected >$yt) and userid=$wlist->userid "; $res1=$DB->get_record_sql($sql1); // todays completion courses // checking cumulative grade existance $pregrade=round(MeanGrade($coursid,$wlist->userid),2)+0.00; //$pregrade='A'; $pragrade=round(TodaysGrade($coursid,$wlist->userid),2)+0.00;// checking Todays grade existance //$pragrade='B'; $html.= "<tr>"; $html.= "<td> <a href=" . $CFG->wwwroot . '/teacher/student_profile.php?sid=' . $wlist->userid . ">" . $userobj->profile['rollno'] . "</a></td><td><a href=" . $CFG->wwwroot . '/teacher/student_profile.php?sid=' . $wlist->userid . ">" . $userobj->firstname . "</a></td><td> " . $userobj->profile['eamcetrank'] . " </td><td> " . $userobj->profile['dept'] . " </td><td>$pregrade</td><td>$pragrade</td><td>".$attandance."</td></tr>"; } $html .= "</tbody></table>"; return $html; }