Added custom field controls on user_add.php.
authorNik Okuntseff <support@anuko.com>
Sun, 30 Jun 2019 12:57:20 +0000 (12:57 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 30 Jun 2019 12:57:20 +0000 (12:57 +0000)
WEB-INF/templates/footer.tpl
WEB-INF/templates/user_add.tpl
user_add.php

index 46167ca..ab50afe 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.19.7.5024 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.19.7.5025 | Copyright &copy; <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>
index 155bf11..3f00c35 100644 (file)
@@ -100,6 +100,17 @@ function handleClientControl() {
       <td>{$forms.userForm.quota_percent.control} <a href="https://www.anuko.com/lp/tt_27.htm" target="_blank">{$i18n.label.what_is_it}</a></td>
     </tr>
 {/if}
+{if $custom_fields && $custom_fields->userFields}
+  {foreach $custom_fields->userFields as $userField}
+    <tr>
+      <td align="right">{$userField['label']|escape}{if $userField['required']} (*){/if}:</td>
+      {assign var="control_name" value='user_field_'|cat:$userField['id']}
+      <td>{$forms.userForm.$control_name.control}</td>
+    </tr>
+  {/foreach}
+{/if}
+
+
     <tr>
       <td align="right">{$i18n.form.users.default_rate}&nbsp;(0{$user->getDecimalMark()}00):</td>
       <td>{$forms.userForm.rate.control}</td>
index 56bd69b..a3d956e 100644 (file)
@@ -100,7 +100,17 @@ if ($user->isPluginEnabled('cl'))
 
 // If we have custom fields - add controls for them.
 if ($custom_fields && $custom_fields->userFields) {
-  // Coding in progress...
+  foreach ($custom_fields->userFields as $userField) {
+    $field_name = 'user_field_'.$userField['id'];
+    if ($userField['type'] == CustomFields::TYPE_TEXT) {
+      $form->addInput(array('type'=>'text','name'=>$field_name));
+    } elseif ($userField['type'] == CustomFields::TYPE_DROPDOWN) {
+      $form->addInput(array('type'=>'combobox','name'=>$field_name,
+      'style'=>'width: 250px;',
+      'data'=>CustomFields::getOptions($userField['id']),
+      'empty'=>array(''=>$i18n->get('dropdown.select'))));
+    }
+  }
 }
 
 $form->addInput(array('type'=>'floatfield','maxlength'=>'10','name'=>'rate','format'=>'.2','value'=>$cl_rate));