Пример #1
0
            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);
                    //print_r($mod->name);
                }

            //returns the all activities associated to perticular section in a course
                function get_activities($sectionid,$arr)
                {
                    $cnt=0;
                    $sec_activity_array = array();
                    for($i=0;$i<count($arr);$i++) {
                        if($arr[$i]['secid']==$sectionid){
                            $sec_activity_array[$cnt] = array('modid'=>$arr[$i]['modid'],'modname'=>$arr[$i]['modname'],'modcontent'=>$arr[$i]['modcontent']);
                            $cnt++;
                        }

                    }
                    return $sec_activity_array;
                }

            // Get all course sections in a array
                function get_sections($sections)
                {   $cnt=0;
                    $sec_array = array();
                    foreach ($sections as $sec) {
                        $sec_array[$cnt++] = array('secid'=>$sec->id,'secname'=>$sec->name);
                    }
                    return $sec_array;
                }


                $activities=get_activities($secid,$arr);
                $html='';global $CFG;
                for($i=0;$i<count($activities);$i++) {
                    $html .= '<tr >
                                <td ><span class="mod' . $activities[$i]['modid'] . '">' . ($i + 1) . '</span></td>
                                <td ><span class="mod' . $activities[$i]['modid'] . '">' . $activities[$i]['modname'] . '</span></td>
                                <td ><span class="mod' . $activities[$i]['modid'] . '">' . $activities[$i]['modcontent'] . '</span></td>
                                <td >
                                <button class="showhide" id="show" value=' . $activities[$i]['modid'] . '>
                                <img  alt="start" src="'.$CFG->wwwroot.'/teacher/testcenter/images/start.png" width="16px"/></button>
                                <button class="showhide" id="hide" value=' . $activities[$i]['modid'] . '>
                                <img  alt="stop" src="'.$CFG->wwwroot.'/teacher/testcenter/images/stop.png" width="16px"/></button>
                                </td>
                            </tr>';
                }
                echo $html;
            }//end of section_activities() function
Пример #2
0
include 'includes/overall/header.php';
?>

<html>
	<body>
		<br>
		<div class="row">
			<div class="col-md-2"></div>
			<div class="col-md-8">
				<div class="panel panel-default">
					<div class="panel-body">
						<div class="page-header " style = "margin-top:5px; ">
							<h3> Activities: </h3>
							<br>
						</div>
						<div class="page-body" style = "margin-top:5px; ">
							<?php 
get_activities();
?>
							<br>
						</div>
						<br>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>

<?php 
include 'includes/overall/footer.php';
Пример #3
0
//$currentgroup = groups_get_activity_group($cm, true);
$modinfo = get_fast_modinfo($course);
$mods = $modinfo->get_cms();
$sections = $modinfo->get_section_info_all();
$sec_array = get_sections($sections);
$cm = $modinfo->get_cm($course->id);
$currentgroup = groups_get_activity_group($cm, true);
$context_module = context_course::instance($course->id);
$cid = $course->id;
//var_dump($sec_array);
//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);
    //print_r($mod->name);
}
$activities = get_activities($secid, $arr);
//var_dump($currentgroup);
if (!$currentgroup) {
    $currentgroup = '';
}
$groupmembers = "";
$groupselect = "";
$params = array();
$timetoshowusers = 300;
//Seconds default
if (isset($CFG->block_online_users_timetosee)) {
    $timetoshowusers = $CFG->block_online_users_timetosee * 60;
}
$now = time();
$timefrom = 100 * floor(($now - $timetoshowusers) / 100);
// Round to nearest 100 seconds for better query cache
Пример #4
0
$default_size = 50;
$default_sort = 1;
$columns = array(1 => 'charid', 2 => 'taskid');
switch ($action) {
    case 0:
        // View task info
        if (!$tskid) {
            $body = new Template("templates/tasks/tasks.default.tmpl.php");
        } else {
            $body = new Template("templates/tasks/tasks.tmpl.php");
            $body->set('rewardmethods', $rewardmethods);
            $body->set('yesno', $yesno);
            $body->set('activitytypes', $activitytypes);
            $body->set('tsksetsid', tasksets_id());
            $vars = tasks_info();
            $activity = get_activities();
            if ($vars) {
                foreach ($vars as $key => $value) {
                    $body->set($key, $value);
                }
            }
            if ($activity) {
                foreach ($activity as $key => $value) {
                    $body->set($key, $value);
                }
            }
        }
        break;
    case 1:
        // Edit task info
        check_authorization();
Пример #5
0
function draw_activity_feed($groupnr)
{
    ob_start();
    $activities = get_activities($groupnr);
    $num_act = 0;
    foreach ($activities as $activity) {
        echo '<div class="activity_item" title="' . strftime("%c", $activity->tid) . '">';
        echo draw_activity($activity);
        echo '</div>';
        /* Draw a 'more'-link on the buddy-page if there are more than 3 act. tied to group. */
        $num_act++;
        /* Note: Check for the page-name. */
        if (wp_title(NULL, false) == "  Fadderne" && $num_act >= 3) {
            echo "<a href=\"gruppe/?n={$groupnr}\">mer</a>...";
            break;
        }
    }
    $data = ob_get_contents();
    ob_end_clean();
    return $data;
}
Пример #6
0
function get_courselist($course)
{
    global $CFG;
    $html = "<table class='generaltable search-table' id='cours' width='100%'>
            <thead>
            <tr>
               <th style='width: 10%;'>Select</th>
               <th style='width: 40%;'>Topics</th>
               <th style='width: 50%;'>Activities</th>
            </tr>
            </thead>
            <tbody id='cbody'>";

    $ehtml=$html;
    $modinfo = get_fast_modinfo($course);
    $mods = $modinfo->get_cms();
    $sections = $modinfo->get_section_info_all();

    $arr = array();
    $main_array = get_sections($sections);
    // Activity loop
    $arr = get_activities($mods, $main_array);
    //var_dump($arr);
    $ptop = '';
    $com=0;$tot=0;
    $ht='';
    $count=0;
    $che=0;
    foreach ($mods as $mod) {
        $top = $main_array[$mod->section];
        if ($main_array[$mod->section] == "")
            continue;
        if ($ptop != $mod->section) {
            $activitycounter=0;$completioncounter=0;
            foreach ($arr[$mod->section] as $modsec) {
                $activitycounter++;
                $com+=(int)$modsec['completion'];
                $tot+=(int)$modsec['count'];
                $ht .= "<span  >".$modsec['completion'] .' of ' . $modsec['count']."</span>";
                $src=$CFG->wwwroot.'/pix/'.$modsec['modname'].'.jpeg';
                $ht .="&emsp;<img src=$src alt=".$modsec['modname']." title=".$modsec['modname']." />";
                $ht .= "&emsp;&emsp;&emsp;&emsp;&emsp;";
                if($modsec['completion']==$modsec['count'])
                    $completioncounter++;

            }

            if($completioncounter==$activitycounter){
                $classvar='seccompleted';
                $sta='disabled="true"';
                //print_r("completed");
                $sel='';
            }
            else{
                $classvar='';
                $sta='';
                if($che==0)
                {
                 $sel='checked';
                    $che++;
                }
                else{
                    $sel='';
                }
                //print_r("not completed");
            }
            $html .= html_writer::start_tag('tr', array('class' => $course->id.' '.$classvar));
            $html .= html_writer::start_tag('td');
            $html .= "<input type='radio' name='topics'  class='rdo' $sel $sta value ='$course->id-$mod->section'/>";
            $html .= html_writer::end_tag('td');
            $html .= html_writer::start_tag('td');
            $html .= "<span >".$top."</span>";
            $html .= html_writer::end_tag('td');
            $html .= html_writer::start_tag('td');
            $html .=$ht;
            $ht='';
            $html .= html_writer::end_tag('td');
            $html .= html_writer::end_tag('tr');
            $count++;

        }
        $ptop = $mod->section;
    }

    $html.="</tbody></table>";
    $html.="<p class='tabres'>($count) results found</p>";
    $sta=$com.','.$tot;
    if($count==0){
        $html=$ehtml."<tr><td colspan='3' style='text-align:center'><div class='nores'><h4> No Chapters found for this course</h4></div></td></tr><tr><td colspan='3' style='padding: 15px 0px  !important; '></td></tr><tr><td colspan='3' style='padding: 15px 0px  !important; ' ></td></tr><tr><td colspan='3' style='padding: 15px 0px  !important; ' ></td></tr><tr><td colspan='3' style='padding: 15px 0px  !important; '></td></tr></tbody></table>";
    }
    $html.="<input type='hidden' id='cstatus' value='$sta'/>";
    return $html;

}