return $result;
}
+ // getActiveTemplates - returns an array of active templates for a group.
+ static function getActiveTemplates()
+ {
+ global $user;
+ $mdb2 = getConnection();
+
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+
+ $sql = "select id, name, description from tt_templates".
+ " where group_id = $group_id and org_id = $org_id and status = 1 order by upper(name)";
+ $res = $mdb2->query($sql);
+ $result = array();
+ if (!is_a($res, 'PEAR_Error')) {
+ while ($val = $res->fetchRow()) {
+ $result[] = $val;
+ }
+ }
+ return $result;
+ }
+
+ // getInactiveTemplates - returns an array of active templates for a group.
+ static function getInactiveTemplates()
+ {
+ global $user;
+ $mdb2 = getConnection();
+
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+
+ $sql = "select id, name, description from tt_templates".
+ " where group_id = $group_id and org_id = $org_id and status = 0 order by upper(name)";
+ $res = $mdb2->query($sql);
+ $result = array();
+ if (!is_a($res, 'PEAR_Error')) {
+ while ($val = $res->fetchRow()) {
+ $result[] = $val;
+ }
+ }
+ return $result;
+ }
+
// validateCheckboxGroupInput - validates user input in a group of checkboxes
// in context of a specific database table.
//
'form.timesheets.active_timesheets' => 'Active Timesheets',
'form.timesheets.inactive_timesheets' => 'Inactive Timesheets',
+ // Templates form. See example at https://timetracker.anuko.com/templates.php
+'form.templates.active_templates' => 'Active Templates',
+'form.templates.inactive_templates' => 'Inactive Templates',
+
// Invoice form. See example at https://timetracker.anuko.com/invoice.php
// (you can get to this form after generating a report).
'form.invoice.number' => 'Invoice number',
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.55.4843 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.55.4844 | 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>
<tr>
<td valign="top">
<table cellspacing="1" cellpadding="3" border="0" width="100%">
+{if $inactive_templates}
+ <tr><td class="sectionHeaderNoBorder">{$i18n.form.templates.active_templates}</td></tr>
+{/if}
<tr>
<td class="tableHeader">{$i18n.label.thing_name}</td>
<td class="tableHeader">{$i18n.label.description}</td>
<td class="tableHeader">{$i18n.label.edit}</td>
<td class="tableHeader">{$i18n.label.delete}</td>
</tr>
- {if $templates}
- {foreach $templates as $template}
+ {if $active_templates}
+ {foreach $active_templates as $template}
<tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
<td>{$template['name']|escape}</td>
<td>{$template['description']|escape}</td>
}
} else {
$form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->get('button.add')));
- $predefinedExpenses = ttGroupHelper::getPredefinedExpenses();
+ $activeTemplates = ttGroupHelper::getActiveTemplates();
+ $inactiveTemplates = ttGroupHelper::getInactiveTemplates();
}
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
-$smarty->assign('predefined_expenses', $predefinedExpenses);
+$smarty->assign('active_templates', $activeTemplates);
+$smarty->assign('inactive_templates', $inactiveTemplates);
$smarty->assign('title', $i18n->get('title.templates'));
$smarty->assign('content_page_name', 'templates.tpl');
$smarty->display('index.tpl');