<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.9.16.3425 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.9.16.3426 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
}
$errors->add($i18n->getKey('error.db'));
}
-} // post
+} // POST
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
$smarty->assign('onload', 'onLoad="document.invoiceForm.number.focus()"');
header('Location: invoices.php');
exit();
}
-} // post
+} // POST
$smarty->assign('invoice_to_delete', $invoice_to_delete);
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
else
$errors->add($i18n->getKey('error.mail_send'));
}
-}
+} // POST
$smarty->assign('title', $i18n->getKey('title.send_invoice'));
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
} else
$errors->add($i18n->getKey('error.auth'));
}
-}
+} // POST
if(!isTrue(MULTITEAM_MODE) && !ttTeamHelper::getTeams())
$errors->add($i18n->getKey('error.no_teams'));
$errors->add($i18n->getKey('error.auth'));
}
}
-}
+} // POST
$smarty->assign('forms', array($form->getName() => $form->toArray()));
$smarty->assign('title', $i18n->getKey('title.change_password'));
$smarty->assign('result_message', $res ? $i18n->getKey('form.reset_password.message') : $i18n->getKey('error.mail_send'));
}
}
-}
+} // POST
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
$smarty->assign('onload', 'onLoad="document.resetPasswordForm.login.focus()"');
$cl_password2 = $request->getParameter('password2');
}
$cl_email = trim($request->getParameter('email'));
-
+
if ($user->canManageTeam()) {
- $cl_team = trim($request->getParameter('team_name'));
+ $cl_team = trim($request->getParameter('team_name'));
$cl_address = trim($request->getParameter('address'));
$cl_currency = trim($request->getParameter('currency'));
if (!$cl_currency) $cl_currency = CURRENCY_DEFAULT;
$cl_email = $user->email;
if ($user->canManageTeam()) {
$cl_team = $user->team;
- $cl_address = $user->address;
+ $cl_address = $user->address;
$cl_currency = ($user->currency == ''? CURRENCY_DEFAULT : $user->currency);
$cl_lock_interval = $user->lock_interval;
$cl_lang = $user->lang;
$cl_decimal_mark = $user->decimal_mark;
- $cl_custom_format_date = $user->date_format;
+ $cl_custom_format_date = $user->date_format;
$cl_custom_format_time = $user->time_format;
$cl_start_week = $user->week_start;
$cl_tracking_mode = $user->tracking_mode;
$form->addInput(array('type'=>'text','maxlength'=>'200','name'=>'team_name','value'=>$cl_team));
$form->addInput(array('type'=>'textarea','name'=>'address','maxlength'=>'255','style'=>'width: 350px;','cols'=>'55','rows'=>'4','value'=>$cl_address));
$form->addInput(array('type'=>'text','maxlength'=>'7','name'=>'currency','value'=>$cl_currency));
- $DECIMAL_MARK_OPTIONS = array(
- array('id'=>'.','name'=>'.'),
- array('id'=>',','name'=>','));
+ $DECIMAL_MARK_OPTIONS = array(array('id'=>'.','name'=>'.'),array('id'=>',','name'=>','));
$form->addInput(array('type'=>'combobox','name'=>'decimal_mark','style'=>'width: 150px','data'=>$DECIMAL_MARK_OPTIONS,'datakeys'=>array('id','name'),'value'=>$cl_decimal_mark,
'onchange'=>'adjustDecimalPreview()'));
$form->addInput(array('type'=>'text','maxlength'=>'10','name'=>'lock_interval','value'=>$cl_lock_interval));
- // Prepare an array of available languages.
+ // Prepare an array of available languages.
$lang_files = I18n::getLangFileList();
foreach ($lang_files as $lfile) {
$content = file(RESOURCE_DIR."/".$lfile);
$tracking_mode_options[MODE_PROJECTS] = $i18n->getKey('form.profile.mode_projects');
$tracking_mode_options[MODE_PROJECTS_AND_TASKS] = $i18n->getKey('form.profile.mode_projects_and_tasks');
$form->addInput(array('type'=>'combobox','name'=>'tracking_mode','style'=>'width: 150px;','data'=>$tracking_mode_options,'value'=>$cl_tracking_mode));
-
+
// Prepare record type choices.
$record_type_options = array();
$record_type_options[TYPE_ALL] = $i18n->getKey('form.profile.type_all');
$record_type_options[TYPE_START_FINISH] = $i18n->getKey('form.profile.type_start_finish');
$record_type_options[TYPE_DURATION] = $i18n->getKey('form.profile.type_duration');
$form->addInput(array('type'=>'combobox','name'=>'record_type','style'=>'width: 150px;','data'=>$record_type_options,'value'=>$cl_record_type));
-
+
$form->addInput(array('type'=>'checkbox','name'=>'charts','data'=>1,'value'=>$cl_charts));
$form->addInput(array('type'=>'checkbox','name'=>'clients','data'=>1,'value'=>$cl_clients,'onchange'=>'handlePluginCheckboxes()'));
$form->addInput(array('type'=>'checkbox','name'=>'client_required','data'=>1,'value'=>$cl_client_required));
-
+
$form->addInput(array('type'=>'checkbox','name'=>'invoices','data'=>1,'value'=>$cl_invoices));
$form->addInput(array('type'=>'checkbox','name'=>'custom_fields','data'=>1,'value'=>$cl_custom_fields,'onchange'=>'handlePluginCheckboxes()'));
$form->addInput(array('type'=>'checkbox','name'=>'expenses','data'=>1,'value'=>$cl_expenses,'onchange'=>'handlePluginCheckboxes()'));
// Validate user input.
if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name'));
if ($can_change_login) {
- if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
-
+ if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
+
// New login must be unique.
if ($cl_login != $user->login && ttUserHelper::getUserByLogin($cl_login))
$errors->add($i18n->getKey('error.user_exists'));
}
if (!ttValidEmail($cl_email, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
if ($user->canManageTeam()) {
- if (!ttValidString($cl_team, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
- if (!ttValidString($cl_address, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.address'));
- if (!ttValidString($cl_currency, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.currency'));
- if (!ttValidInteger($cl_lock_interval, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.lock_interval'));
+ if (!ttValidString($cl_team, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
+ if (!ttValidString($cl_address, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.address'));
+ if (!ttValidString($cl_currency, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.currency'));
+ if (!ttValidInteger($cl_lock_interval, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.lock_interval'));
}
// Finished validating user input.
-
+
if ($errors->isEmpty()) {
if ($cl_lock_interval == null || trim($cl_lock_interval) == '')
$cl_lock_interval = 0;
if ($cl_client_required)
$plugins .= ',cm';
if ($cl_invoices)
- $plugins .= ',iv';
+ $plugins .= ',iv';
if ($cl_custom_fields)
$plugins .= ',cf';
if ($cl_expenses)
if ($cl_notifications)
$plugins .= ',no';
$plugins = trim($plugins, ',');
-
+
$update_result = ttTeamHelper::update($user->team_id, array(
'name' => $cl_team,
'address' => $cl_address,
// Validate user input.
if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
if (!ttValidString($cl_description, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
-
+
if ($errors->isEmpty()) {
- if (!ttProjectHelper::getProjectByName($cl_name)) {
+ if (!ttProjectHelper::getProjectByName($cl_name)) {
if (ttProjectHelper::insert(array(
'team_id' => $user->team_id,
'name' => $cl_name,
} else
$errors->add($i18n->getKey('error.project_exists'));
}
-} // post
+} // POST
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
$smarty->assign('onload', 'onLoad="document.projectForm.project_name.focus()"');
if ($request->getMethod() == 'POST') {
if ($request->getParameter('btn_delete')) {
- if(ttProjectHelper::get($cl_project_id)) {
+ if(ttProjectHelper::get($cl_project_id)) {
if (ttProjectHelper::delete($cl_project_id)) {
header('Location: projects.php');
exit();
} else
$errors->add($i18n->getKey('error.db'));
} else if ($request->getParameter('btn_cancel')) {
- header('Location: projects.php');
- exit();
+ header('Location: projects.php');
+ exit();
}
-} // post
-
+} // POST
+
$smarty->assign('project_to_delete', $project_to_delete);
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
$smarty->assign('onload', 'onLoad="document.projectDeleteForm.btn_cancel.focus()"');
$cl_name = $project['name'];
$cl_description = $project['description'];
$cl_status = $project['status'];
-
+
$mdb2 = getConnection();
$sql = "select user_id from tt_user_project_binds where status = 1 and project_id = $cl_project_id";
$res = $mdb2->query($sql);
die($res->getMessage());
while ($row = $res->fetchRow())
$cl_users[] = $row['user_id'];
-
+
$cl_tasks = explode(',', $project['tasks']);
}
$form->addInput(array('type'=>'checkboxgroup','name'=>'tasks','data'=>$all_tasks,'layout'=>'H','value'=>$cl_tasks));
$form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save')));
$form->addInput(array('type'=>'submit','name'=>'btn_copy','value'=>$i18n->getKey('button.copy')));
-
+
if ($request->getMethod() == 'POST') {
// Validate user input.
if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
if (!ttValidString($cl_description, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
-
+
if ($errors->isEmpty()) {
if ($request->getParameter('btn_save')) {
$existing_project = ttProjectHelper::getProjectByName($cl_name);
$errors->add($i18n->getKey('error.project_exists'));
}
}
-} // post
+} // POST
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
$smarty->assign('onload', 'onLoad="document.projectForm.name.focus()"');
$cl_password1 = $request->getParameter('password1');
$cl_password2 = $request->getParameter('password2');
$cl_manager_email = trim($request->getParameter('manager_email'));
-} else
+} else
$cl_currency = CURRENCY_DEFAULT;
$form = new Form('profileForm');
// Create a new team.
$team_id = ttTeamHelper::insert(array('name'=>$cl_team_name,'currency'=>$cl_currency));
if ($team_id) {
- // Team created, now create a team manager.
- $user_id = ttUserHelper::insert(array(
- 'team_id' => $team_id,
- 'role' => ROLE_MANAGER,
+ // Team created, now create a team manager.
+ $user_id = ttUserHelper::insert(array(
+ 'team_id' => $team_id,
+ 'role' => ROLE_MANAGER,
'name' => $cl_manager_name,
'login' => $cl_manager_login,
'password' => $cl_password1,
- 'email' => $cl_manager_email));
+ 'email' => $cl_manager_email));
}
if ($team_id && $user_id) {
if ($auth->doLogin($cl_manager_login, $cl_password1)) {
} else
$errors->add($i18n->getKey('error.user_exists'));
}
-}
+} // POST
$smarty->assign('title', $i18n->getKey('title.create_team'));
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
if ($request->getMethod() == 'POST') {
foreach($_POST as $key => $val) {
- if ('log_id_' == substr($key, 0, 7))
- $time_log_ids[] = substr($key, 7);
+ if ('log_id_' == substr($key, 0, 7))
+ $time_log_ids[] = substr($key, 7);
if ('item_id_' == substr($key, 0, 8))
- $expense_item_ids[] = substr($key, 8);
- if ('recent_invoice' == $key)
- $invoice_id = $val;
+ $expense_item_ids[] = substr($key, 8);
+ if ('recent_invoice' == $key)
+ $invoice_id = $val;
}
if ($time_log_ids || $expense_item_ids) {
- // Some records are checked for invoice editing... Adjust their invoice accordingly.
- ttReportHelper::assignToInvoice($invoice_id, $time_log_ids, $expense_item_ids);
+ // Some records are checked for invoice editing. Adjust their invoice accordingly.
+ ttReportHelper::assignToInvoice($invoice_id, $time_log_ids, $expense_item_ids);
}
// Re-display this form.
header('Location: report.php');
exit();
-} // post
+} // POST
$group_by = $bean->getAttribute('group_by');
if (!ttValidEmailList($cl_cc, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.cc'));
if (!ttValidString($cl_subject)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.subject'));
if (!ttValidString($cl_comment, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.comment'));
-
+
if ($errors->isEmpty()) {
// Save last report emails for future use.
$sc->setValue(SYSC_LAST_REPORT_EMAIL, $cl_receiver);
- $sc->setValue(SYSC_LAST_REPORT_CC, $cl_cc);
-
- // Obtain session bean with report attributes.
- $bean = new ActionForm('reportBean', new Form('reportForm'));
- // Prepare report body.
- $body = ttReportHelper::prepareReportBody($bean, $cl_comment);
-
+ $sc->setValue(SYSC_LAST_REPORT_CC, $cl_cc);
+
+ // Obtain session bean with report attributes.
+ $bean = new ActionForm('reportBean', new Form('reportForm'));
+ // Prepare report body.
+ $body = ttReportHelper::prepareReportBody($bean, $cl_comment);
+
import('mail.Mailer');
$mailer = new Mailer();
$mailer->setCharSet(CHARSET);
'style'=>'width: 250px;',
'data'=>$report_list,
'datakeys'=>array('id','name'),
- 'empty'=>array('-1'=>$i18n->getKey('dropdown.no'))
-));
+ 'empty'=>array('-1'=>$i18n->getKey('dropdown.no'))));
$form->addInput(array('type'=>'hidden','name'=>'fav_report_changed'));
// Generate and Delete buttons.
$form->addInput(array('type'=>'submit','name'=>'btn_generate','value'=>$i18n->getKey('button.generate')));
'style'=>'width: 250px;',
'data'=>$client_list,
'datakeys'=>array('id', 'name'),
- 'empty'=>array(''=>$i18n->getKey('dropdown.all'))
- ));
+ 'empty'=>array(''=>$i18n->getKey('dropdown.all'))));
}
// If we have a TYPE_DROPDOWN custom field - add control to select an option.
'style'=>'width: 250px;',
'value'=>$cl_cf_1,
'data'=>$custom_fields->options,
- 'empty'=>array(''=>$i18n->getKey('dropdown.all'))
- ));
+ 'empty'=>array(''=>$i18n->getKey('dropdown.all'))));
}
// Add controls for projects and tasks.
'style'=>'width: 250px;',
'data'=>$project_list,
'datakeys'=>array('id','name'),
- 'empty'=>array(''=>$i18n->getKey('dropdown.all'))
-));
+ 'empty'=>array(''=>$i18n->getKey('dropdown.all'))));
if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
$task_list = ttTeamHelper::getActiveTasks($user->team_id);
$form->addInput(array('type'=>'combobox',
'style'=>'width: 250px;',
'data'=>$task_list,
'datakeys'=>array('id','name'),
- 'empty'=>array(''=>$i18n->getKey('dropdown.all'))
- ));
+ 'empty'=>array(''=>$i18n->getKey('dropdown.all'))));
}
-// Add include records control.
+// Add include records control.
$include_options = array('1'=>$i18n->getKey('form.reports.include_billable'),
'2'=>$i18n->getKey('form.reports.include_not_billable'));
$form->addInput(array('type'=>'combobox',
'name'=>'include_records',
'style'=>'width: 250px;',
'data'=>$include_options,
- 'empty'=>array(''=>$i18n->getKey('dropdown.all'))
-));
+ 'empty'=>array(''=>$i18n->getKey('dropdown.all'))));
-// Add invoiced / not invoiced selector.
+// Add invoiced / not invoiced selector.
$invoice_options = array('1'=>$i18n->getKey('form.reports.include_invoiced'),
'2'=>$i18n->getKey('form.reports.include_not_invoiced'));
$form->addInput(array('type'=>'combobox',
'name'=>'invoice',
'style'=>'width: 250px;',
'data'=>$invoice_options,
- 'empty'=>array(''=>$i18n->getKey('dropdown.all'))
-));
+ 'empty'=>array(''=>$i18n->getKey('dropdown.all'))));
$user_list = array();
if ($user->canManageTeam() || $user->isClient()) {
'data'=>$user_list,
'layout'=>'V',
'groupin'=>$row_count,
- 'style'=>'width: 100%;'
- ));
+ 'style'=>'width: 100%;'));
}
// Add control for time period.
INTERVAL_LAST_MONTH=>$i18n->getKey('dropdown.last_month'),
INTERVAL_THIS_WEEK=>$i18n->getKey('dropdown.this_week'),
INTERVAL_LAST_WEEK=>$i18n->getKey('dropdown.last_week')),
- 'empty'=>array(''=>$i18n->getKey('dropdown.select'))
-));
+ 'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
// Add controls for start and end dates.
$form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'start_date'));
$form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'end_date'));
// Add checkboxes for fields.
if (in_array('cl', explode(',', $user->plugins)))
- $form->addInput(array('type'=>'checkbox','name'=>'chclient','data'=>1));
+ $form->addInput(array('type'=>'checkbox','name'=>'chclient','data'=>1));
if (($user->canManageTeam() || $user->isClient()) && in_array('iv', explode(',', $user->plugins)))
- $form->addInput(array('type'=>'checkbox','name'=>'chinvoice','data'=>1));
+ $form->addInput(array('type'=>'checkbox','name'=>'chinvoice','data'=>1));
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
$form->addInput(array('type'=>'checkbox','name'=>'chproject','data'=>1));
if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
if ($user->canManageTeam() || $user->isClient())
$group_by_options['user'] = $i18n->getKey('form.reports.group_by_user');
if (in_array('cl', explode(',', $user->plugins)) && !($user->isClient() && $user->client_id))
- $group_by_options['client'] = $i18n->getKey('form.reports.group_by_client');
+ $group_by_options['client'] = $i18n->getKey('form.reports.group_by_client');
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
$group_by_options['project'] = $i18n->getKey('form.reports.group_by_project');
if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
$form->addInput(array('type'=>'text','name'=>'new_fav_report','maxlength'=>'30','style'=>'width: 250px;'));
// Save button.
$form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save')));
-
+
$form->addInput(array('type'=>'submit','name'=>'btn_generate','value'=>$i18n->getKey('button.generate')));
// Create a bean (which is a mechanism to remember form values in session).
$bean = new ActionForm('reportBean', $form, $request);
-// At this point form values are obtained from session if they are there...
+// At this point form values are obtained from session if they are there.
if (($request->getMethod() == 'GET') && !$bean->isSaved()) {
// No previous form data were found in session. Use the following default values.
$form->setValueByElement('chproject', 1);
$form->setValueByElement('chstart', 1);
$form->setValueByElement('chduration', 1);
- $form->setValueByElement('chcost', 0);
+ $form->setValueByElement('chcost', 0);
$form->setValueByElement('chtask', 1);
$form->setValueByElement('chfinish', 1);
$form->setValueByElement('chnote', 1);
if ($bean->getAttribute('favorite_report')) {
// This loads new favorite report options into the bean (into our form).
ttFavReportHelper::loadReport($user->id, $bean);
-
+
// If user selected no favorite report - mark all user checkboxes (most probable scenario).
if ($bean->getAttribute('favorite_report') == -1)
$form->setValueByElement('users', array_keys($user_list));
-
+
// Save form data in session for future use.
$bean->saveBean();
header('Location: reports.php');
- exit();
- }
+ exit();
+ }
} elseif ($bean->getAttribute('btn_save')) {
- // User clicked the Save button. We need to save form options as new favorite report.
- if (!ttValidString($bean->getAttribute('new_fav_report'))) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.reports.save_as_favorite'));
-
+ // User clicked the Save button. We need to save form options as new favorite report.
+ if (!ttValidString($bean->getAttribute('new_fav_report'))) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.reports.save_as_favorite'));
+
if ($errors->isEmpty()) {
$id = ttFavReportHelper::saveReport($user->id, $bean);
if (!$id)
$form->setValueByElement('users', array_keys($user_list));
$bean->saveBean();
header('Location: reports.php');
- exit();
- }
+ exit();
+ }
} else {
// Generate button pressed. Check some values.
if (!$bean->getAttribute('period')) {
$start_date = new DateAndTime($user->date_format, $bean->getAttribute('start_date'));
-
+
if ($start_date->isError() || !$bean->getAttribute('start_date'))
$errors->add($i18n->getKey('error.field'), $i18n->getKey('label.start_date'));
-
+
$end_date = new DateAndTime($user->date_format, $bean->getAttribute('end_date'));
if ($end_date->isError() || !$bean->getAttribute('end_date'))
$errors->add($i18n->getKey('error.field'), $i18n->getKey('label.end_date'));
-
+
if ($start_date->compare($end_date) > 0)
$errors->add($i18n->getKey('error.interval'), $i18n->getKey('label.end_date'), $i18n->getKey('label.start_date'));
}
-
+
$bean->saveBean();
-
+
if ($errors->isEmpty()) {
// Now we can go ahead and create a report.
header('Location: report.php');
exit();
}
}
-}
+} // POST
$smarty->assign('project_list', $project_list);
$smarty->assign('task_list', $task_list);