-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject.php
More file actions
243 lines (224 loc) · 14.2 KB
/
project.php
File metadata and controls
243 lines (224 loc) · 14.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?php
/*
*
* @package mod-project
* @category mod
* @author Yann Ducruy (yann[dot]ducruy[at]gmail[dot]com). Contact me if needed
* @date 12/06/2015
* @version 3.2
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*
*/
if (!defined('MOODLE_INTERNAL')) die ("You cannot enter directly in this script");
///memorizes current page - typical session switch
if (!empty($view)) {
$_SESSION['currentpage'] = $view;
} elseif (empty($_SESSION['currentpage'])) {
$_SESSION['currentpage'] = 'description';
}
$currentpage = $_SESSION['currentpage'];
/// memorizes edit mode - typical session switch
$editmode = optional_param('editmode', '', PARAM_ALPHA);
if (!empty($editmode)) {
$_SESSION['editmode'] = $editmode;
} elseif (empty($_SESSION['editmode'])) {
$_SESSION['editmode'] = 'off';
}
/// get general command name
$work = optional_param('work', '', PARAM_ALPHA);
/*
//Print groupe name. deprecated
if ($currentGroupId) {
$group = $DB->get_record("groups", array("id" => $currentGroupId));
echo "<center><b>". get_string('groupname', 'project') . $group->name . "</b></center><br/>";
}
$typeProject=false;
if((int)$project->typeprojet==0){
$typeProject=true;
}*/
/// Make menu
$tabrequtitle = get_string('requirements', 'project');
//$tabrequlabel = (!has_capability('mod/project:changerequs', $context)) ? $tabrequtitle . " <img src=\"{$CFG->wwwroot}/mod/project/pix/p/lock.gif\" />" : $tabrequtitle ;
$tabrequlabel = $tabrequtitle ;
//$tabspeclabel = (!has_capability('mod/project:changespecs', $context)) ? "<img src=\"".$OUPTUT->pix_url('p/spec', 'project').'" /> ' . $tabspectitle . " <img src=\"{$CFG->wwwroot}/mod/project/pix/p/lock.gif\" />" : $tabspectitle ;
//$tabtasklabel = (!has_capability('mod/project:changetasks', $context)) ? "<img src=\"{$CFG->wwwroot}/mod/project/pix/p/task.gif\" /> " . $tabtasktitle . " <img src=\"{$CFG->wwwroot}/mod/project/pix/p/lock.gif\" />" : $tabtasktitle ;
//$tabmilelabel = (!has_capability('mod/project:changemiles', $context)) ? $tabmiletitle . " <img src=\"{$CFG->wwwroot}/mod/project/pix/p/lock.gif\" />" : $tabmiletitle ;
//$tabdelivlabel = (!has_capability('mod/project:changedelivs', $context)) ? $tabdelivtitle . " <img src=\"{$CFG->wwwroot}/mod/project/pix/p/lock.gif\" />" : $tabdelivtitle ;
//$tabvalidlabel = (!has_capability('mod/project:validate', $context)) ? $tabvalidtitle . " <img src=\"{$CFG->wwwroot}/mod/project/pix/p/lock.gif\" />" : $tabvalidtitle ;
$tabrequlabel = "<img src=\"{$CFG->wwwroot}/mod/project/pix/p/req.gif\" height=\"14\" /> " . $tabrequlabel;
//$tabspeclabel = "<img src=\"{$CFG->wwwroot}/mod/project/pix/p/spec.gif\" height=\"14\" /> " . $tabspeclabel;
//$tabtasklabel = "<img src=\"{$CFG->wwwroot}/mod/project/pix/p/task.gif\" height=\"14\" /> " . $tabtasklabel;
//$tabdelivlabel = "<img src=\"{$CFG->wwwroot}/mod/project/pix/p/deliv.gif\" height=\"14\" /> " . $tabdelivlabel;
$tabEquipePicto = "<img src=\"{$CFG->wwwroot}/mod/project/pix/equipe_16x16.png\" />";
$tabEtapePicto = "<img src=\"{$CFG->wwwroot}/mod/project/pix/etape_16x16.png\" />";
$tabLivrablePicto = "<img src=\"{$CFG->wwwroot}/mod/project/pix/livrable_16x16.png\" />";
$tabRessourcePicto = "<img src=\"{$CFG->wwwroot}/mod/project/pix/ressource_16x16.png\" />";
$tabMessagePicto = "<img src=\"{$CFG->wwwroot}/mod/project/pix/message_16x16.png\" />";
$tabProjectsPicto = "<img src=\"{$CFG->wwwroot}/mod/project/pix/vue-projets_16x16.png\" />";
$tabValidPicto = "<img src=\"{$CFG->wwwroot}/mod/project/pix/vue-projets_16x16.png\" />";
$tabTaskPicto = "<img src=\"{$CFG->wwwroot}/mod/project/pix/calendar_16x16.png\" />";
$tabSpecsPicto = "<img src=\"{$CFG->wwwroot}/mod/project/pix/spec-32x32.png\" style=\"width:16px; height:16px;\"/>";
$tabs = array();
/*
if(has_capability('mod/project:viewpreproductionentities', $context, $USER->id)){
if (@$project->projectusesrequs){
$tabs[0][] = new tabobject('requirements', "view.php?id={$cm->id}&view=requirements", $tabrequlabel, $tabrequtitle);
}
if (@$project->projectusesspecs){
$tabs[0][] = new tabobject('specifications', "view.php?id={$cm->id}&view=specifications", $tabspeclabel, $tabspectitle);
}
}
*/
//
//debug : dump all project data on each page of the activity
//var_dump($project);
$tabs[0][] = new tabobject('description', "view.php?id={$cm->id}&view=description", get_string('description', 'project'));
$tabs[0][] = new tabobject('views', "view.php?id={$cm->id}&view=summary", $tabEquipePicto. get_string('views', 'project'),get_string('views', 'project'));
$tabs[0][] = new tabobject('milestones', "view.php?id={$cm->id}&view=milestones", $tabEtapePicto.get_string('milestones', 'project'), get_string('milestones', 'project'));
if (@$project->projectusesdelivs){
$tabs[0][] = new tabobject('ressources', "view.php?id={$cm->id}&view=ressources", $tabRessourcePicto.get_string('ressource', 'project'), get_string('ressource', 'project'));
}
if (@$project->projectusesdelivs){
$tabs[0][] = new tabobject('deliverables', "view.php?id={$cm->id}&view=deliverables", $tabLivrablePicto.get_string('deliverable', 'project'),get_string('deliverable', 'project'));
}
if (@$project->projectusesvalidations){
$tabs[0][] = new tabobject('validations', "view.php?id={$cm->id}&view=validations", $tabValidPicto.get_string('validations', 'project'), get_string('validations', 'project'));
}
if (@$project->projectusestasks) {
$tabs[0][] = new tabobject('tasks', "view.php?id={$cm->id}&view=tasks", $tabTaskPicto.get_string('tasks', 'project'), get_string('tasks', 'project'));
}
if (@$project->projectusesrequs) {
$tabs[0][] = new tabobject('requirement', "view.php?id={$cm->id}&view=requirements", $tabTaskPicto.get_string('requirements', 'project'), get_string('requirements', 'project'));
}
if (@$project->projectusesspecs) {
$tabs[0][] = new tabobject('specification', "view.php?id={$cm->id}&view=specifications", $tabSpecsPicto.get_string('specifications', 'project'), get_string('specifications', 'project'));
}
$tabs[0][] = new tabobject('messages', "view.php?id={$cm->id}&view=messages", $tabMessagePicto.get_string('messages', 'project'),get_string('messages', 'project'));
if(has_capability('mod/project:addinstance', $context, $USER->id)){
$tabs[0][] = new tabobject('vue projets', "view.php?id={$cm->id}&view=projects", $tabProjectsPicto.get_string('projects', 'project'),get_string('projects', 'project'));
}
/*if (preg_match("/view_/", $currentpage)){
$tabs[1][] = new tabobject('view_summary', "view.php?id={$cm->id}&view=view_summary", get_string('summary', 'project'));
$tabs[1][] = new tabobject('view_byassignee', "view.php?id={$cm->id}&view=view_byassignee", get_string('byassignee', 'project'));
$tabs[1][] = new tabobject('view_bypriority', "view.php?id={$cm->id}&view=view_bypriority", get_string('bypriority', 'project'));
$tabs[1][] = new tabobject('view_byworktype', "view.php?id={$cm->id}&view=view_byworktype", get_string('byworktype', 'project'));
$tabs[1][] = new tabobject('view_detail', "view.php?id={$cm->id}&view=view_detail", get_string('detail', 'project'));
$tabs[1][] = new tabobject('view_todo', "view.php?id={$cm->id}&view=view_todo", get_string('todo', 'project'));
$tabs[1][] = new tabobject('view_gantt', "view.php?id={$cm->id}&view=view_gantt", get_string('gantt', 'project'));
}*/
/*
if (has_capability('mod/project:viewprojectcontrols', $context)){
$tabs[0][] = new tabobject('teacher', "view.php?id={$cm->id}&view=teacher_assess", get_string('teacherstools', 'project'));
if (preg_match("/teacher_/", $currentpage)){
if ($project->grade && has_capability('mod/project:gradeproject', $context)){
$tabs[1][] = new tabobject('teacher_assess', "view.php?id={$cm->id}&view=teacher_assess", get_string('assessments', 'project'));
if ($project->teacherusescriteria && has_capability('mod/project:managecriteria', $context)){
$tabs[1][] = new tabobject('teacher_criteria', "view.php?id={$cm->id}&view=teacher_criteria", get_string('criteria', 'project'));
}
}
if (has_capability('mod/project:manage', $context)){
$tabs[1][] = new tabobject('teacher_projectcopy', "view.php?id={$cm->id}&view=teacher_projectcopy", get_string('projectcopy', 'project'));
}
if ($project->enablecvs && has_capability('mod/project:manageremoterepository', $context)) {
$tabs[1][] = new tabobject('teacher_cvs', "view.php?id={$cm->id}&view=teacher_cvs", get_string('cvscontrol', 'project'));
}
$tabs[1][] = new tabobject('teacher_load', "view.php?id={$cm->id}&view=teacher_load", get_string('load', 'project'));
}
if (has_capability('mod/project:configure', $context)){
$tabs[0][] = new tabobject('domains', $CFG->wwwroot."/mod/project/view.php?view=domains&id={$id}", get_string('domains', 'project'));
if (preg_match("/domains_?/", $currentpage)){
if (!preg_match("/domains_heavyness|domains_complexity|domains_severity|domains_priority|domains_worktype|domains_taskstatus|domains_strength|domains_deliv_status/", $view)) $view = 'domains_complexity';
$tabs[1][] = new tabobject('domains_strength', "view.php?id={$id}&view=domains_strength", get_string('strength', 'project'));
$tabs[1][] = new tabobject('domains_heavyness', "view.php?id={$id}&view=domains_heavyness", get_string('heavyness', 'project'));
$tabs[1][] = new tabobject('domains_complexity', "view.php?id={$id}&view=domains_complexity", get_string('complexity', 'project'));
$tabs[1][] = new tabobject('domains_severity', "view.php?id={$id}&view=domains_severity", get_string('severity', 'project'));
$tabs[1][] = new tabobject('domains_priority', "view.php?id={$id}&view=domains_priority", get_string('priority', 'project'));
$tabs[1][] = new tabobject('domains_worktype', "view.php?id={$id}&view=domains_worktype", get_string('worktype', 'project'));
$tabs[1][] = new tabobject('domains_taskstatus', "view.php?id={$id}&view=domains_taskstatus", get_string('taskstatus', 'project'));
$tabs[1][] = new tabobject('domains_deliv_status', "view.php?id={$id}&view=domains_deliv_status", get_string('deliv_status', 'project'));
$currentpage = $view;
}
}
}
*/
if ($currentpage == 'summary') {
//if (preg_match("/^view_/", $currentpage)) {
$activated[] = 'views';
} elseif (preg_match("/^teacher_/", $currentpage)) {
$activated[] = 'teacher';
} elseif (preg_match("/^domains_/", $currentpage)) {
$activated[] = 'domains';
} else {
$activated = NULL;
}
$pagebuffer .= print_tabs($tabs, $_SESSION['currentpage'], NULL, $activated, true);
$pagebuffer .= '<br/>';
/// Route to detailed screens
if ($currentpage == 'description') {
//$pagebuffer .= project_print_assignement_info($project, true);
include 'description.php';
} elseif ($currentpage == 'requirements') { //CAPA TODO. innacessible ?
include("requirement.php");
} elseif ($currentpage == 'specifications') { //seem deprecated at l 77
include("specification.php");
} elseif ($currentpage == 'tasks') { //TODO
include("task.php");
} elseif ($currentpage == 'milestones') { //RECHECK POUR LE CLEAR ALL ET LE SORT ????
include("milestone.php");
} elseif ($currentpage == 'deliverables') { //DONE, NORMALLY
include("deliverables.php");
} elseif ($currentpage == 'ressources') { //DONE, NORMALLY
include("ressources.php");
} elseif ($currentpage == 'validation') { // NOT USED
include("validation.php");
} elseif ($currentpage == 'validations') { //NOT USED
include("validations.php");
}elseif ($currentpage == 'summary') { // TODO WITH THE EDIT GROUP FUNCTION
include("summary.php");
}elseif ($currentpage == 'messages') { //DONE, NORMALLY. WHY EDITINGTEACHER CANT SEE THIS PAGE ? MAY CHECK LATER
include("messages.php");
}elseif ($currentpage == 'projects') {
include("projects.php");
}
/*elseif (preg_match("/view_/", $currentpage)) {
if ($currentpage == 'view_summary') {
include("summary.php");
} elseif ($currentpage == 'view_byassignee') {
include("byassignee.php");
} elseif ($currentpage == 'view_bypriority') {
include("bypriority.php");
} elseif ($currentpage == 'view_byworktype') {
include("byworktype.php");
} elseif ($currentpage == 'view_detail') {
include("detail.php");
} elseif ($currentpage == 'view_todo') {
include("todo.php");
} elseif ($currentpage == 'view_gantt') {
include("gantt.php");
}
}*/ elseif (preg_match("/teacher_/", $currentpage)) {
// falldown if no grading enabled.
if (!$project->grade && ($currentpage == 'teacher_assess' || $currentpage == 'teacher_criteria')) $currentpage = 'teacher_projectcopy';
if ($currentpage == 'teacher_assess') {
include("assessments.php"); //DONE, NORMALLY
}
if ($currentpage == 'teacher_criteria') {
include("criteria.php"); //OK
}
if ($currentpage == 'teacher_projectcopy') {
include("copy.php"); //OK
}
if ($currentpage == 'teacher_cvs') {
include("cvs.php"); //OK
}
if ($currentpage == 'teacher_load') {
include("imports.php"); //OK
}
} elseif (preg_match("/domains_/", $currentpage)) {
$action = optional_param('what', '', PARAM_RAW);
$domain = str_replace('domains_', '', $currentpage);
include "view_domain.php"; //INTERNAL. DONT NEED CAPABILITIES
} else {
print_error('errorfatalscreen', 'project', $currentpage);
}
?>