posaune
[timetracker.git] / reports.php
1 <?php
2 // +----------------------------------------------------------------------+
3 // | Anuko Time Tracker
4 // +----------------------------------------------------------------------+
5 // | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
6 // +----------------------------------------------------------------------+
7 // | LIBERAL FREEWARE LICENSE: This source code document may be used
8 // | by anyone for any purpose, and freely redistributed alone or in
9 // | combination with other software, provided that the license is obeyed.
10 // |
11 // | There are only two ways to violate the license:
12 // |
13 // | 1. To redistribute this code in source form, with the copyright
14 // |    notice or license removed or altered. (Distributing in compiled
15 // |    forms without embedded copyright notices is permitted).
16 // |
17 // | 2. To redistribute modified versions of this code in *any* form
18 // |    that bears insufficient indications that the modifications are
19 // |    not the work of the original author(s).
20 // |
21 // | This license applies to this document only, not any other software
22 // | that it may be combined with.
23 // |
24 // +----------------------------------------------------------------------+
25 // | Contributors:
26 // | https://www.anuko.com/time_tracker/credits.htm
27 // +----------------------------------------------------------------------+
28
29 require_once('initialize.php');
30 import('form.Form');
31 import('form.ActionForm');
32 import('DateAndTime');
33 import('ttGroupHelper');
34 import('Period');
35 import('ttProjectHelper');
36 import('ttFavReportHelper');
37 import('ttClientHelper');
38 import('ttReportHelper');
39
40 // Access check.
41 if (!(ttAccessAllowed('view_own_reports') || ttAccessAllowed('view_reports') || ttAccessAllowed('view_all_reports') || ttAccessAllowed('view_client_reports'))) {
42   header('Location: access_denied.php');
43   exit();
44 }
45 if (!$user->exists()) {
46   header('Location: access_denied.php'); // No users in subgroup.
47   exit();
48 }
49 // End of access checks.
50
51 $trackingMode = $user->getTrackingMode();
52
53 // Use custom fields plugin if it is enabled.
54 if ($user->isPluginEnabled('cf')) {
55   require_once('plugins/CustomFields.class.php');
56   $custom_fields = new CustomFields();
57   $smarty->assign('custom_fields', $custom_fields);
58   $showCustomFieldCheckbox = $custom_fields->fields[0];
59   $showCustomFieldDropdown = $custom_fields->fields[0] && $custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN;
60   if ($showCustomFieldDropdown)
61     $showCustomFieldDropdown &= CustomFields::getOptions($custom_fields->fields[0]['id']);
62 }
63
64 $form = new Form('reportForm');
65
66 // Get saved favorite reports for user.
67 $report_list = ttFavReportHelper::getReports();
68 $form->addInput(array('type'=>'combobox',
69   'name'=>'favorite_report',
70   'onchange'=>'this.form.fav_report_changed.value=1;this.form.submit();',
71   'style'=>'width: 250px;',
72   'data'=>$report_list,
73   'datakeys'=>array('id','name'),
74   'empty'=>array('-1'=>$i18n->get('dropdown.no'))));
75 $form->addInput(array('type'=>'hidden','name'=>'fav_report_changed'));
76 // Generate and Delete buttons.
77 $form->addInput(array('type'=>'submit','name'=>'btn_generate','value'=>$i18n->get('button.generate')));
78 $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete'),'onclick'=>"return confirm('".$i18n->get('form.reports.confirm_delete')."')"));
79
80 // Dropdown for clients if the clients plugin is enabled.
81 $showClient = $user->isPluginEnabled('cl') && !$user->isClient();
82 if ($showClient) {
83   if ($user->can('view_reports') || $user->can('view_all_reports')) {
84     $client_list = ttClientHelper::getClients(); // TODO: improve getClients for "view_reports"
85                                                  // by filtering out not relevant clients.
86   } else
87     $client_list = ttClientHelper::getClientsForUser();
88   if (count($client_list) == 0) $showClient = false;
89 }
90 if ($showClient) {
91   $form->addInput(array('type'=>'combobox',
92     'onchange'=>'fillProjectDropdown(this.value);',
93     'name'=>'client',
94     'style'=>'width: 250px;',
95     'data'=>$client_list,
96     'datakeys'=>array('id', 'name'),
97     'empty'=>array(''=>$i18n->get('dropdown.all'))));
98 }
99
100 // If we have a TYPE_DROPDOWN custom field - add a control to select an option.
101 if ($showCustomFieldDropdown) {
102   $form->addInput(array('type'=>'combobox','name'=>'option',
103     'style'=>'width: 250px;',
104     'value'=>$cl_cf_1,
105     'data'=>CustomFields::getOptions($custom_fields->fields[0]['id']),
106     'empty'=>array(''=>$i18n->get('dropdown.all'))));
107 }
108
109 // Add project dropdown.
110 $showProject = MODE_PROJECTS == $trackingMode || MODE_PROJECTS_AND_TASKS == $trackingMode;
111 if ($showProject) {
112   if ($user->can('view_reports') || $user->can('view_all_reports')) {
113     $project_list = ttProjectHelper::getProjects(); // All active and inactive projects.
114   } elseif ($user->isClient()) {
115     $project_list = ttProjectHelper::getProjectsForClient();
116   } else {
117     $project_list = ttProjectHelper::getAssignedProjects($user->getUser());
118   }
119   if (count($project_list) == 0) $showProject = false;
120 }
121 if ($showProject) {
122   $form->addInput(array('type'=>'combobox',
123     'onchange'=>'fillTaskDropdown(this.value);selectAssignedUsers(this.value);',
124     'name'=>'project',
125     'style'=>'width: 250px;',
126     'data'=>$project_list,
127     'datakeys'=>array('id','name'),
128     'empty'=>array(''=>$i18n->get('dropdown.all'))));
129 }
130
131 // Add task dropdown.
132 $showTask = MODE_PROJECTS_AND_TASKS == $trackingMode;
133 if ($showTask) {
134   $task_list = ttGroupHelper::getActiveTasks();
135   if (count($task_list) == 0) $showTask = false;
136 }
137 if ($showTask) {
138   $form->addInput(array('type'=>'combobox',
139     'name'=>'task',
140     'style'=>'width: 250px;',
141     'data'=>$task_list,
142     'datakeys'=>array('id','name'),
143     'empty'=>array(''=>$i18n->get('dropdown.all'))));
144 }
145
146 // Add billable dropdown.
147 $showBillable = $user->isPluginEnabled('iv');
148 if ($showBillable) {
149   $include_options = array('1'=>$i18n->get('form.reports.include_billable'),
150     '2'=>$i18n->get('form.reports.include_not_billable'));
151   $form->addInput(array('type'=>'combobox',
152     'name'=>'include_records', // TODO: how about a better name here?
153     'style'=>'width: 250px;',
154     'data'=>$include_options,
155     'empty'=>array(''=>$i18n->get('dropdown.all'))));
156 }
157
158 // Add invoiced / not invoiced selector.
159 $showInvoiceDropdown = $user->isPluginEnabled('iv') && $user->can('manage_invoices');
160 if ($showInvoiceDropdown) {
161   $invoice_options = array('1'=>$i18n->get('form.reports.include_invoiced'),
162     '2'=>$i18n->get('form.reports.include_not_invoiced'));
163   $form->addInput(array('type'=>'combobox',
164     'name'=>'invoice',
165     'style'=>'width: 250px;',
166     'data'=>$invoice_options,
167     'empty'=>array(''=>$i18n->get('dropdown.all'))));
168 }
169 $showInvoiceCheckbox = $user->isPluginEnabled('iv') && ($user->can('manage_invoices') || $user->isClient());
170
171 // Add paid status selector.
172 $showPaidStatus = $user->isPluginEnabled('ps') && $user->can('manage_invoices');
173 if ($showPaidStatus) {
174   $form->addInput(array('type'=>'combobox',
175    'name'=>'paid_status',
176    'style'=>'width: 250px;',
177    'data'=>array('1'=>$i18n->get('dropdown.paid'),'2'=>$i18n->get('dropdown.not_paid')),
178    'empty'=>array(''=>$i18n->get('dropdown.all'))
179  ));
180 }
181
182 // Add approved / not approved selector.
183 $showApproved = $user->isPluginEnabled('ap') &&
184   ($user->can('view_own_reports') || $user->can('view_reports') ||
185    $user->can('view_all_reports') || ($user->can('view_client_reports') && $user->can('view_client_unapproved')));
186 if ($showApproved) {
187   $form->addInput(array('type'=>'combobox',
188    'name'=>'approved',
189    'style'=>'width: 250px;',
190    'data'=>array('1'=>$i18n->get('dropdown.approved'),'2'=>$i18n->get('dropdown.not_approved')),
191    'empty'=>array(''=>$i18n->get('dropdown.all'))
192   ));
193 }
194
195 // Add timesheet assignment selector.
196 $showTimesheetDropdown = $user->isPluginEnabled('ts');
197 if ($showTimesheetDropdown) {
198   $form->addInput(array('type'=>'combobox',
199    'name'=>'timesheet',
200    'style'=>'width: 250px;',
201    'data'=>array(TIMESHEET_NOT_ASSIGNED=>$i18n->get('form.reports.include_not_assigned'),
202      TIMESHEET_ASSIGNED=>$i18n->get('form.reports.include_assigned'),
203      TIMESHEET_PENDING=>$i18n->get('form.reports.include_pending'),
204      TIMESHEET_APPROVED=>$i18n->get('dropdown.approved'),
205      TIMESHEET_NOT_APPROVED=>$i18n->get('dropdown.not_approved')),
206    'empty'=>array(''=>$i18n->get('dropdown.all'))
207   ));
208 }
209 $showTimesheetCheckbox = $user->isPluginEnabled('ts');
210
211 // Add user table.
212 $showUsers = $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient();
213 $user_list = array();
214 if ($showUsers) {
215   // Prepare user and assigned projects arrays.
216   if ($user->can('view_reports') || $user->can('view_all_reports')) {
217     $rank = $user->getMaxRankForGroup($user->getGroup());
218     if ($user->can('view_all_reports')) $max_rank = MAX_RANK;
219     if ($user->can('view_own_reports')) {
220       $options_active = array('max_rank'=>$max_rank,'include_self'=>true,'status'=>ACTIVE);
221       $options_inactive = array('max_rank'=>$max_rank,'include_self'=>true,'status'=>INACTIVE);
222     } else {
223       $options_active = array('max_rank'=>$max_rank,'status'=>ACTIVE);
224       $options_inactive = array('max_rank'=>$max_rank,'status'=>INACTIVE);
225     }
226     $active_users = $user->getUsers($options_active);
227     $inactive_users = $user->getUsers($options_inactive);
228   }
229   elseif ($user->isClient()) {
230     $options_active = array('status'=>ACTIVE);
231     $options_inactive = array('status'=>INACTIVE);
232     $active_users = ttGroupHelper::getUsersForClient($options_active);
233     $inactive_users = ttGroupHelper::getUsersForClient($options_inactive);
234   }
235
236   foreach ($active_users as $single_user) {
237     $user_list_active[$single_user['id']] = $single_user['name'];
238     $projects = ttProjectHelper::getAssignedProjects($single_user['id']);
239     if ($projects) {
240       foreach ($projects as $single_project) {
241         $assigned_projects[$single_user['id']][] = $single_project['id'];
242       }
243     }
244   }
245   $row_count = ceil(count($user_list_active)/3);
246   $form->addInput(array('type'=>'checkboxgroup',
247     'name'=>'users_active',
248     'data'=>$user_list_active,
249     'layout'=>'V',
250     'groupin'=>$row_count,
251     'style'=>'width: 100%;'));
252
253     foreach ($inactive_users as $single_user) {
254     $user_list_inactive[$single_user['id']] = $single_user['name'];
255     $projects = ttProjectHelper::getAssignedProjects($single_user['id']);
256     if ($projects) {
257       foreach ($projects as $single_project) {
258         $assigned_projects[$single_user['id']][] = $single_project['id'];
259       }
260     }
261   }
262   $row_count = ceil(count($user_list_inactive)/3);
263   $form->addInput(array('type'=>'checkboxgroup',
264     'name'=>'users_inactive',
265     'data'=>$user_list_inactive,
266     'layout'=>'V',
267     'groupin'=>$row_count,
268     'style'=>'width: 100%;'));
269 }
270
271 // Add control for time period.
272 $form->addInput(array('type'=>'combobox',
273   'name'=>'period',
274   'style'=>'width: 250px;',
275   'data'=>array(INTERVAL_THIS_MONTH=>$i18n->get('dropdown.current_month'),
276     INTERVAL_LAST_MONTH=>$i18n->get('dropdown.previous_month'),
277     INTERVAL_THIS_WEEK=>$i18n->get('dropdown.current_week'),
278     INTERVAL_LAST_WEEK=>$i18n->get('dropdown.previous_week'),
279     INTERVAL_THIS_DAY=>$i18n->get('dropdown.current_day'),
280     INTERVAL_LAST_DAY=>$i18n->get('dropdown.previous_day')),
281   'empty'=>array(''=>$i18n->get('dropdown.select'))));
282 // Add controls for start and end dates.
283 $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'start_date'));
284 $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'end_date'));
285
286 // Add checkboxes for "Show fields" block.
287 if ($showClient)
288   $form->addInput(array('type'=>'checkbox','name'=>'chclient'));
289 if ($showProject)
290   $form->addInput(array('type'=>'checkbox','name'=>'chproject'));
291 if ($showTask)
292   $form->addInput(array('type'=>'checkbox','name'=>'chtask'));
293 if ($showCustomFieldCheckbox)
294   $form->addInput(array('type'=>'checkbox','name'=>'chcf_1'));
295 if ($showInvoiceCheckbox)
296   $form->addInput(array('type'=>'checkbox','name'=>'chinvoice'));
297 if ($showPaidStatus)
298   $form->addInput(array('type'=>'checkbox','name'=>'chpaid'));
299 $showIP = $user->can('view_reports') || $user->can('view_all_reports');
300 if ($showIP)
301   $form->addInput(array('type'=>'checkbox','name'=>'chip'));
302 $recordType = $user->getRecordType();
303 $showStart = TYPE_START_FINISH == $recordType || TYPE_ALL == $recordType;
304 $showFinish = $showStart;
305 if ($showStart)
306   $form->addInput(array('type'=>'checkbox','name'=>'chstart'));
307 if ($showFinish)
308   $form->addInput(array('type'=>'checkbox','name'=>'chfinish'));
309 $form->addInput(array('type'=>'checkbox','name'=>'chduration'));
310 $form->addInput(array('type'=>'checkbox','name'=>'chnote'));
311 $form->addInput(array('type'=>'checkbox','name'=>'chcost'));
312 $showWorkUnits = $user->isPluginEnabled('wu');
313 if ($showWorkUnits)
314   $form->addInput(array('type'=>'checkbox','name'=>'chunits'));
315 if ($showTimesheetCheckbox)
316   $form->addInput(array('type'=>'checkbox','name'=>'chtimesheet'));
317 if ($showApproved)
318   $form->addInput(array('type'=>'checkbox','name'=>'chapproved'));
319 $showFiles = $user->isPluginEnabled('at');
320 if ($showFiles)
321   $form->addInput(array('type'=>'checkbox','name'=>'chfiles'));
322
323 // Add a hidden control for timesheet_user_id (who to generate a timesheet for).
324 if ($showTimesheetCheckbox)
325   $form->addInput(array('type'=>'hidden','name'=>'timesheet_user_id'));
326
327 // Add group by control.
328 $group_by_options['no_grouping'] = $i18n->get('form.reports.group_by_no');
329 $group_by_options['date'] = $i18n->get('form.reports.group_by_date');
330 if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient())
331   $group_by_options['user'] = $i18n->get('form.reports.group_by_user');
332 if ($user->isPluginEnabled('cl') && !($user->isClient() && $user->client_id))
333   $group_by_options['client'] = $i18n->get('form.reports.group_by_client');
334 if (MODE_PROJECTS == $trackingMode || MODE_PROJECTS_AND_TASKS == $trackingMode)
335   $group_by_options['project'] = $i18n->get('form.reports.group_by_project');
336 if (MODE_PROJECTS_AND_TASKS == $trackingMode)
337   $group_by_options['task'] = $i18n->get('form.reports.group_by_task');
338 if ($custom_fields && $custom_fields->fields[0] && $custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN) {
339   $group_by_options['cf_1'] = $custom_fields->fields[0]['label'];
340 }
341 $group_by_options_size = sizeof($group_by_options);
342 $form->addInput(array('type'=>'combobox','onchange'=>'handleCheckboxes();','name'=>'group_by1','data'=>$group_by_options));
343 if ($group_by_options_size > 2) $form->addInput(array('type'=>'combobox','onchange'=>'handleCheckboxes();','name'=>'group_by2','data'=>$group_by_options));
344 if ($group_by_options_size > 3) $form->addInput(array('type'=>'combobox','onchange'=>'handleCheckboxes();','name'=>'group_by3','data'=>$group_by_options));
345 $form->addInput(array('type'=>'checkbox','name'=>'chtotalsonly'));
346
347 // Add text field for a new favorite report name.
348 $form->addInput(array('type'=>'text','name'=>'new_fav_report','maxlength'=>'30','style'=>'width: 250px;'));
349 // Save button.
350 $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('button.save')));
351
352 $form->addInput(array('type'=>'submit','name'=>'btn_generate','value'=>$i18n->get('button.generate')));
353
354 // Create a bean (which is a mechanism to remember form values in session).
355 $bean = new ActionForm('reportBean', $form, $request);
356 // At this point form values are obtained from session if they are there.
357
358 if ($request->isGet() && !$bean->isSaved()) {
359   // No previous form data were found in session. Use the following default values.
360   $form->setValueByElement('users_active', array_keys($user_list_active));
361   $period = new Period(INTERVAL_THIS_MONTH, new DateAndTime($user->getDateFormat()));
362   $form->setValueByElement('start_date', $period->getStartDate());
363   $form->setValueByElement('end_date', $period->getEndDate());
364
365   $form->setValueByElement('chclient', '1');
366   $form->setValueByElement('chstart', '1');
367   $form->setValueByElement('chfinish', '1');
368   $form->setValueByElement('chduration', '1');
369
370   $form->setValueByElement('chproject', '1');
371   $form->setValueByElement('chtask', '1');
372   $form->setValueByElement('chnote', '1');
373   $form->setValueByElement('chcost', '0');
374
375   $form->setValueByElement('chtimesheet', '0');
376   $form->setValueByElement('chip', '0');
377   $form->setValueByElement('chapproved', '0');
378   $form->setValueByElement('chpaid', '0');
379
380   $form->setValueByElement('chcf_1', '0');
381   $form->setValueByElement('chunits', '0');
382   $form->setValueByElement('chinvoice', '0');
383   $form->setValueByElement('chfiles', '1');
384
385   $form->setValueByElement('chtotalsonly', '0');
386 }
387
388 $form->setValueByElement('fav_report_changed','');
389
390 // Disable the Delete button when no favorite report is selected.
391 if (!$bean->getAttribute('favorite_report') || ($bean->getAttribute('favorite_report') == -1))
392   $form->getElement('btn_delete')->setEnabled(false);
393
394 if ($request->isPost()) {
395   if((!$bean->getAttribute('btn_generate') && ($request->getParameter('fav_report_changed')))) {
396     // User changed favorite report. We need to load new values into the form.
397     if ($bean->getAttribute('favorite_report')) {
398       // This loads new favorite report options into the bean (into our form).
399       ttFavReportHelper::loadReport($bean);
400
401       // If user selected no favorite report - mark all user checkboxes (most probable scenario).
402       if ($bean->getAttribute('favorite_report') == -1) {
403         $form->setValueByElement('users_active', array_keys($user_list_active));
404         $form->setValueByElement('users_inactive', false);
405       }
406
407       // Save form data in session for future use.
408       $bean->saveBean();
409       header('Location: reports.php');
410       exit();
411     }
412   } elseif ($bean->getAttribute('btn_save')) {
413     // User clicked the Save button. We need to save form options as new favorite report.
414     if (!ttValidString($bean->getAttribute('new_fav_report'))) $err->add($i18n->get('error.field'), $i18n->get('form.reports.save_as_favorite'));
415
416     if ($err->no()) {
417       $id = ttFavReportHelper::saveReport($bean);
418       if (!$id)
419         $err->add($i18n->get('error.db'));
420       if ($err->no()) {
421         $bean->setAttribute('favorite_report', $id);
422         $bean->saveBean();
423         header('Location: reports.php');
424         exit();
425       }
426     }
427   } elseif($bean->getAttribute('btn_delete')) {
428     // Delete button pressed. User wants to delete a favorite report.
429     if ($bean->getAttribute('favorite_report')) {
430       ttFavReportHelper::deleteReport($bean->getAttribute('favorite_report'));
431       // Load default report.
432       $bean->setAttribute('favorite_report','');
433       $bean->setAttribute('new_fav_report', $report_list[0]['name']);
434       ttFavReportHelper::loadReport($bean);
435       $form->setValueByElement('users', array_keys($user_list));
436       $bean->saveBean();
437       header('Location: reports.php');
438       exit();
439     }
440   } else {
441     // Generate button pressed. Check some values.
442     if (!$bean->getAttribute('period')) {
443       $start_date = new DateAndTime($user->getDateFormat(), $bean->getAttribute('start_date'));
444
445       if ($start_date->isError() || !$bean->getAttribute('start_date'))
446         $err->add($i18n->get('error.field'), $i18n->get('label.start_date'));
447
448       $end_date = new DateAndTime($user->getDateFormat(), $bean->getAttribute('end_date'));
449       if ($end_date->isError() || !$bean->getAttribute('end_date'))
450         $err->add($i18n->get('error.field'), $i18n->get('label.end_date'));
451
452       if ($start_date->compare($end_date) > 0)
453         $err->add($i18n->get('error.interval'), $i18n->get('label.end_date'), $i18n->get('label.start_date'));
454     }
455     $group_by1 = $bean->getAttribute('group_by1');
456     $group_by2 = $bean->getAttribute('group_by2');
457     $group_by3 = $bean->getAttribute('group_by3');
458     if (($group_by3 != null && $group_by3 != 'no_grouping') && ($group_by3 == $group_by1 || $group_by3 == $group_by2))
459       $err->add($i18n->get('error.field'), $i18n->get('form.reports.group_by'));
460     if (($group_by2 != null && $group_by2 != 'no_grouping') && ($group_by2 == $group_by1 || $group_by3 == $group_by2))
461       $err->add($i18n->get('error.field'), $i18n->get('form.reports.group_by'));
462     // Check remaining values.
463     if (!ttReportHelper::verifyBean($bean)) $err->add($i18n->get('error.sys'));
464
465     if ($err->no()) {
466       $bean->saveBean();
467       // Now we can go ahead and create a report.
468       header('Location: report.php');
469       exit();
470     }
471   }
472 } // isPost
473
474 $smarty->assign('client_list', $client_list);
475 $smarty->assign('show_client', $showClient);
476 $smarty->assign('show_cf_1_dropdown', $showCustomFieldDropdown);
477 $smarty->assign('show_cf_1_checkbox', $showCustomFieldCheckbox);
478 $smarty->assign('show_project', $showProject);
479 $smarty->assign('show_task', $showTask);
480 $smarty->assign('show_billable', $showBillable);
481 $smarty->assign('show_approved', $showApproved);
482 $smarty->assign('show_invoice_dropdown', $showInvoiceDropdown);
483 $smarty->assign('show_invoice_checkbox', $showInvoiceCheckbox);
484 $smarty->assign('show_paid_status', $showPaidStatus);
485 $smarty->assign('show_timesheet_dropdown', $showTimesheetDropdown);
486 $smarty->assign('show_timesheet_checkbox', $showTimesheetCheckbox);
487 $smarty->assign('show_active_users', $showUsers && $active_users);
488 $smarty->assign('show_inactive_users', $showUsers && $inactive_users);
489 $smarty->assign('show_start', $showStart);
490 $smarty->assign('show_finish', $showFinish);
491 $smarty->assign('show_work_units', $showWorkUnits);
492 $smarty->assign('show_ip', $showIP);
493 $smarty->assign('show_files', $showFiles);
494 $smarty->assign('project_list', $project_list);
495 $smarty->assign('task_list', $task_list);
496 $smarty->assign('assigned_projects', $assigned_projects);
497 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
498 $smarty->assign('onload', 'onLoad="handleCheckboxes()"');
499 $smarty->assign('title', $i18n->get('title.reports'));
500 $smarty->assign('content_page_name', 'reports.tpl');
501 $smarty->display('index.tpl');