// Use custom fields plugin if it is enabled.
if ($user->isPluginEnabled('cf')) {
require_once('plugins/CustomFields.class.php');
// Use custom fields plugin if it is enabled.
if ($user->isPluginEnabled('cf')) {
require_once('plugins/CustomFields.class.php');
$smarty->assign('custom_fields', $custom_fields);
}
$form = new Form('reportForm');
// Get saved favorite reports for user.
$smarty->assign('custom_fields', $custom_fields);
}
$form = new Form('reportForm');
// Get saved favorite reports for user.
$form->addInput(array('type'=>'combobox',
'name'=>'favorite_report',
$form->addInput(array('type'=>'combobox',
'name'=>'favorite_report',
'style'=>'width: 250px;',
'data'=>$report_list,
'datakeys'=>array('id','name'),
'style'=>'width: 250px;',
'data'=>$report_list,
'datakeys'=>array('id','name'),
}
$form->addInput(array('type'=>'combobox',
'onchange'=>'fillTaskDropdown(this.value);selectAssignedUsers(this.value);',
}
$form->addInput(array('type'=>'combobox',
'onchange'=>'fillTaskDropdown(this.value);selectAssignedUsers(this.value);',
'data'=>$project_list,
'datakeys'=>array('id','name'),
'empty'=>array(''=>$i18n->get('dropdown.all'))));
'data'=>$project_list,
'datakeys'=>array('id','name'),
'empty'=>array(''=>$i18n->get('dropdown.all'))));
-if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- $task_list = ttTeamHelper::getActiveTasks($user->group_id);
+if (MODE_PROJECTS_AND_TASKS == $trackingMode) {
+ $task_list = ttGroupHelper::getActiveTasks();
$form->addInput(array('type'=>'combobox',
'name'=>'task',
'style'=>'width: 250px;',
$form->addInput(array('type'=>'combobox',
'name'=>'task',
'style'=>'width: 250px;',
if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) {
// Prepare user and assigned projects arrays.
if ($user->can('view_reports') || $user->can('view_all_reports')) {
if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) {
// Prepare user and assigned projects arrays.
if ($user->can('view_reports') || $user->can('view_all_reports')) {
if ($user->can('view_own_reports'))
$options = array('max_rank'=>$max_rank,'include_self'=>true);
else
if ($user->can('view_own_reports'))
$options = array('max_rank'=>$max_rank,'include_self'=>true);
else
$form->addInput(array('type'=>'checkbox','name'=>'chpaid'));
if ($user->can('view_reports') || $user->can('view_all_reports'))
$form->addInput(array('type'=>'checkbox','name'=>'chip'));
$form->addInput(array('type'=>'checkbox','name'=>'chpaid'));
if ($user->can('view_reports') || $user->can('view_all_reports'))
$form->addInput(array('type'=>'checkbox','name'=>'chip'));
$form->addInput(array('type'=>'checkbox','name'=>'chstart'));
$form->addInput(array('type'=>'checkbox','name'=>'chfinish'));
}
$form->addInput(array('type'=>'checkbox','name'=>'chstart'));
$form->addInput(array('type'=>'checkbox','name'=>'chfinish'));
}
$group_by_options['user'] = $i18n->get('form.reports.group_by_user');
if ($user->isPluginEnabled('cl') && !($user->isClient() && $user->client_id))
$group_by_options['client'] = $i18n->get('form.reports.group_by_client');
$group_by_options['user'] = $i18n->get('form.reports.group_by_user');
if ($user->isPluginEnabled('cl') && !($user->isClient() && $user->client_id))
$group_by_options['client'] = $i18n->get('form.reports.group_by_client');
$group_by_options['task'] = $i18n->get('form.reports.group_by_task');
if ($custom_fields && $custom_fields->fields[0] && $custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN) {
$group_by_options['cf_1'] = $custom_fields->fields[0]['label'];
$group_by_options['task'] = $i18n->get('form.reports.group_by_task');
if ($custom_fields && $custom_fields->fields[0] && $custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN) {
$group_by_options['cf_1'] = $custom_fields->fields[0]['label'];
if ($request->isGet() && !$bean->isSaved()) {
// No previous form data were found in session. Use the following default values.
$form->setValueByElement('users', array_keys($user_list));
if ($request->isGet() && !$bean->isSaved()) {
// No previous form data were found in session. Use the following default values.
$form->setValueByElement('users', array_keys($user_list));
$form->setValueByElement('start_date', $period->getStartDate());
$form->setValueByElement('end_date', $period->getEndDate());
$form->setValueByElement('chclient', '1');
$form->setValueByElement('start_date', $period->getStartDate());
$form->setValueByElement('end_date', $period->getEndDate());
$form->setValueByElement('chclient', '1');
// User changed favorite report. We need to load new values into the form.
if ($bean->getAttribute('favorite_report')) {
// This loads new favorite report options into the bean (into our form).
// User changed favorite report. We need to load new values into the form.
if ($bean->getAttribute('favorite_report')) {
// This loads new favorite report options into the bean (into our form).
// If user selected no favorite report - mark all user checkboxes (most probable scenario).
if ($bean->getAttribute('favorite_report') == -1)
// If user selected no favorite report - mark all user checkboxes (most probable scenario).
if ($bean->getAttribute('favorite_report') == -1)
// Load default report.
$bean->setAttribute('favorite_report','');
$bean->setAttribute('new_fav_report', $report_list[0]['name']);
// Load default report.
$bean->setAttribute('favorite_report','');
$bean->setAttribute('new_fav_report', $report_list[0]['name']);
$form->setValueByElement('users', array_keys($user_list));
$bean->saveBean();
header('Location: reports.php');
$form->setValueByElement('users', array_keys($user_list));
$bean->saveBean();
header('Location: reports.php');
if ($start_date->isError() || !$bean->getAttribute('start_date'))
$err->add($i18n->get('error.field'), $i18n->get('label.start_date'));
if ($start_date->isError() || !$bean->getAttribute('start_date'))
$err->add($i18n->get('error.field'), $i18n->get('label.start_date'));
if ($end_date->isError() || !$bean->getAttribute('end_date'))
$err->add($i18n->get('error.field'), $i18n->get('label.end_date'));
if ($end_date->isError() || !$bean->getAttribute('end_date'))
$err->add($i18n->get('error.field'), $i18n->get('label.end_date'));