Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 110 lines (90 sloc) 3.775 kB
d26d1d2 Initial import from contrib CVS
Francois Marier authored
1 <?php
2
dd3dfe5 Fix indentation
Francois Marier authored
3 require_once '../../config.php';
4 require_once 'lib.php';
5
6 $id = required_param('id', PARAM_INT); // Course Module ID
7
8 if (!$course = get_record('course', 'id', $id)) {
9 print_error('error:coursemisconfigured', 'facetoface');
10 }
11
12 require_course_login($course);
13 $context = get_context_instance(CONTEXT_COURSE, $course->id);
14 require_capability('mod/facetoface:view', $context);
15
16 add_to_log($course->id, 'facetoface', 'view all', "index.php?id=$course->id");
17
18 $strfacetofaces = get_string('modulenameplural', 'facetoface');
19 $strfacetoface = get_string('modulename', 'facetoface');
20 $strfacetofacename = get_string('facetofacename', 'facetoface');
21 $strweek = get_string('week');
22 $strtopic = get_string('topic');
23 $strcourse = get_string('course');
24 $strname = get_string('name');
25
26 $pagetitle = format_string($strfacetofaces);
27 $navlinks[] = array('name' => $pagetitle, 'link' => '', 'type' => 'title');
28 $navigation = build_navigation($navlinks);
29 print_header_simple($pagetitle, '', $navigation, '', '', true, '', navmenu($course));
30
31 if (!$facetofaces = get_all_instances_in_course('facetoface', $course)) {
32 notice(get_string('nofacetofaces', 'facetoface'), "../../course/view.php?id=$course->id");
33 die;
34 }
35
36 $timenow = time();
37
38 if ($course->format == 'weeks' && has_capability('mod/facetoface:viewattendees', $context)) {
39 $table->head = array ($strweek, $strfacetofacename, get_string('sign-ups', 'facetoface'));
40 $table->align = array ('center', 'left', 'center');
41 }
42 elseif ($course->format == 'weeks') {
43 $table->head = array ($strweek, $strfacetofacename);
44 $table->align = array ('center', 'left', 'center', 'center');
45 }
46 elseif ($course->format == 'topics' && has_capability('mod/facetoface:viewattendees', $context)) {
47 $table->head = array ($strcourse, $strfacetofacename, get_string('sign-ups', 'facetoface'));
48 $table->align = array ('center', 'left', 'center');
49 }
50 elseif ($course->format == 'topics') {
51 $table->head = array ($strcourse, $strfacetofacename);
52 $table->align = array ('center', 'left', 'center', 'center');
53 }
54 else {
55 $table->head = array ($strfacetofacename);
56 $table->align = array ('left', 'left');
57 }
58
59 $currentsection = '';
60
61 foreach ($facetofaces as $facetoface) {
62
63 $submitted = get_string('no');
64
65 if (!$facetoface->visible) {
66 //Show dimmed if the mod is hidden
67 $link = "<a class=\"dimmed\" href=\"view.php?f=$facetoface->id\">$facetoface->name</a>";
d26d1d2 Initial import from contrib CVS
Francois Marier authored
68 }
dd3dfe5 Fix indentation
Francois Marier authored
69 else {
70 //Show normal if the mod is visible
71 $link = "<a href=\"view.php?f=$facetoface->id\">$facetoface->name</a>";
d26d1d2 Initial import from contrib CVS
Francois Marier authored
72 }
73
dd3dfe5 Fix indentation
Francois Marier authored
74 $printsection = '';
75 if ($facetoface->section !== $currentsection) {
76 if ($facetoface->section) {
77 $printsection = $facetoface->section;
d26d1d2 Initial import from contrib CVS
Francois Marier authored
78 }
dd3dfe5 Fix indentation
Francois Marier authored
79 $currentsection = $facetoface->section;
80 }
d26d1d2 Initial import from contrib CVS
Francois Marier authored
81
dd3dfe5 Fix indentation
Francois Marier authored
82 $totalsignupcount = 0;
83 if ($sessions = facetoface_get_sessions($facetoface->id)) {
84 foreach($sessions as $session) {
85 if (!facetoface_has_session_started($session, $timenow)) {
86 $signupcount = facetoface_get_num_attendees($session->id);
87 $totalsignupcount += $signupcount;
d26d1d2 Initial import from contrib CVS
Francois Marier authored
88 }
89 }
dd3dfe5 Fix indentation
Francois Marier authored
90 }
d26d1d2 Initial import from contrib CVS
Francois Marier authored
91
dd3dfe5 Fix indentation
Francois Marier authored
92 $courselink = '<a title="'.$course->shortname.'" href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a>';
93 if ($course->format == 'weeks' or $course->format == 'topics') {
94 if (has_capability('mod/facetoface:viewattendees', $context)) {
95 $table->data[] = array ($courselink, $link, $totalsignupcount);
96 }
97 else {
98 $table->data[] = array ($courselink, $link);
d26d1d2 Initial import from contrib CVS
Francois Marier authored
99 }
100 }
dd3dfe5 Fix indentation
Francois Marier authored
101 else {
102 $table->data[] = array ($link, $submitted);
103 }
104 }
d26d1d2 Initial import from contrib CVS
Francois Marier authored
105
dd3dfe5 Fix indentation
Francois Marier authored
106 echo "<br />";
d26d1d2 Initial import from contrib CVS
Francois Marier authored
107
dd3dfe5 Fix indentation
Francois Marier authored
108 print_table($table);
109 print_footer($course);
Something went wrong with that request. Please try again.