Added a template selector on time.php.
[timetracker.git] / time.php
index f7b1c12..dd219e8 100644 (file)
--- a/time.php
+++ b/time.php
@@ -249,6 +249,22 @@ if ($custom_fields && $custom_fields->fields[0]) {
   }
 }
 
+// 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')) {