$group_id = $user->getGroup();
$org_id = $user->org_id;
- $sql = "select id, name, description from tt_templates".
+ $sql = "select id, name, description, content 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();
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.55.4846 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.55.4847 | 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>
{include file="time_script.tpl"}
+{if $template_dropdown}
+<script>
+var templates = new Array();
+{foreach $templates as $template}
+ templates[{$template.id}] = "{$template.content|escape:'javascript'}";
+{/foreach}
+
+// The fillNote function populates the Note field with a selected template body.
+function fillNote(id) {
+ if (!id) return; // Do nothing.
+ var template_body = templates[id];
+ var note = document.getElementById("note");
+ note.value = template_body;
+}
+</script>
+{/if}
+
<style>
.not_billable td {
color: #ff6666;
<td align="right">{$i18n.label.duration}:</td>
<td>{$forms.timeRecordForm.duration.control} {if $user->getDecimalMark() == ','}{str_replace('.', ',', $i18n.form.time.duration_format)}{else}{$i18n.form.time.duration_format}{/if}</td>
</tr>
+{/if}
+{if $template_dropdown}
+ <tr>
+ <td align="right">{$i18n.label.template}:</td>
+ <td>{$forms.timeRecordForm.template.control}</td>
+ </tr>
{/if}
</table>
</td>
}
}
+// If we have templates, add a dropdown to select one.
+if ($user->isPluginEnabled('tp')){
+ $templates = ttGroupHelper::getActiveTemplates();
+ if (count($templates) >= 1) {
+ $form->addInput(array('type'=>'combobox',
+ 'onchange'=>'fillNote(this.value);',
+ 'name'=>'template',
+ 'style'=>'width: 250px;',
+ 'data'=>$templates,
+ 'datakeys'=>array('id','name'),
+ 'empty'=>array(''=>$i18n->get('dropdown.select'))));
+ $smarty->assign('template_dropdown', 1);
+ $smarty->assign('templates', $templates);
+ }
+}
+
// Submit.
if ($request->isPost()) {
if ($request->getParameter('btn_submit')) {