return $val['group_key'];
}
- // getProjectFiles obtains a list of files for a project.
- static function getProjectFiles($project_id) {
+ // getEntityFiles obtains a list of files for an entity.
+ static function getEntityFiles($id, $type) {
global $user;
$mdb2 = getConnection();
$org_id = $user->org_id;
$result = array();
+ $entity_type = $mdb2->quote($type);
$sql = "select id, remote_id, file_name as name, description from tt_files".
- " where entity_type = 'project' and entity_id = $project_id".
+ " where entity_type = $entity_type and entity_id = $id".
" and group_id = $group_id and org_id = $org_id and status = 1 order by id";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
'title.edit_time_record' => 'Modificant l\\\'historial de temps',
'title.delete_time_record' => 'Eliminant l\\\'historial de temps',
// TODO: translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
'title.edit_time_record' => 'Upravit časový záznam',
'title.delete_time_record' => 'Smazat časový záznam',
// TODO: translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
'title.time' => 'Tid',
'title.edit_time_record' => 'Redigér Tidsregistrering',
'title.delete_time_record' => 'Slet Tidsregistrering',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Udgifter',
'title.edit_expense' => 'Redigér Udgift',
'title.delete_expense' => 'Slet Udgift',
'title.time' => 'Zeiten',
'title.edit_time_record' => 'Bearbeiten des Stundeneintrags',
'title.delete_time_record' => 'Eintrag löschen',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Kosten',
'title.edit_expense' => 'Kostenposition ändern',
'title.delete_expense' => 'Kostenposition löschen',
'title.time' => 'Time',
'title.edit_time_record' => 'Editing Time Record',
'title.delete_time_record' => 'Deleting Time Record',
+'title.time_files' => 'Time Record Files',
'title.expenses' => 'Expenses',
'title.edit_expense' => 'Editing Expense Item',
'title.delete_expense' => 'Deleting Expense Item',
'title.time' => 'Tiempo',
'title.edit_time_record' => 'Modificando el historial de tiempo',
'title.delete_time_record' => 'Eliminando el historial de tiempo',
-// TODO: translate the following.
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
'title.time' => 'Ajaarvestus',
'title.edit_time_record' => 'Ajakande muutmine',
'title.delete_time_record' => 'Ajakande kustutamine',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Kulud',
'title.edit_expense' => 'Kulukirje muutmine',
'title.delete_expense' => 'Kulukirje kustutamine',
'title.time' => 'زمان',
'title.edit_time_record' => 'ویرایش رکورد زمان',
'title.delete_time_record' => 'حذف رکورد زمان',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'هزینه ها',
'title.edit_expense' => 'ویرایش آیتم هزینه ها',
'title.delete_expense' => 'حذف آیتم هزینه ها',
'title.time' => 'Tuntien kirjaus',
'title.edit_time_record' => 'Tuntikirjausten muokkaus',
'title.delete_time_record' => 'Tuntikirjausten poisto',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Kulut',
'title.edit_expense' => 'Kulutietojen muokkaus',
'title.delete_expense' => 'Kulutiedon poisto',
'title.time' => 'Temps',
'title.edit_time_record' => 'Modification de l\\\'entrée de temps',
'title.delete_time_record' => 'Suppression de l\\\'entrée de temps',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Dépenses',
'title.edit_expense' => 'Modification d\\\'une dépense',
'title.delete_expense' => 'Suppression d\\\'une dépense',
'title.time' => 'Χρόνος',
'title.edit_time_record' => 'Επεξεργασία χρόνου',
'title.delete_time_record' => 'Διαγραφή χρόνου',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Δαπάνες',
'title.edit_expense' => 'Επεξεργασία δαπάνης',
'title.delete_expense' => 'Διαγραφή δαπάνης',
'title.time' => 'זמן',
'title.edit_time_record' => 'עריכת רשומה',
'title.delete_time_record' => 'מחיקת רשומה',
-// TODO: translate the following.
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
// 'title.time' => 'Time',
// 'title.edit_time_record' => 'Editing Time Record',
// 'title.delete_time_record' => 'Deleting Time Record',
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
'title.time' => 'Tempo',
'title.edit_time_record' => 'Modifica record temporale',
'title.delete_time_record' => 'Eliminazione record temporale',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Spese',
'title.edit_expense' => 'Modifica voce di spesa',
'title.delete_expense' => 'Eliminezione voce di spesa',
'title.time' => '時間',
'title.edit_time_record' => '時間レコードの編集',
'title.delete_time_record' => '時間レコードの削除',
-// TODO: translate the following.
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
'title.time' => '시간',
'title.edit_time_record' => '시간기록을 편집하기',
'title.delete_time_record' => '시간기록을 삭제하기',
-// TODO: translate the following.
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
'title.time' => 'Tijdsregistraties',
'title.edit_time_record' => 'Wijzigen tijdrecord',
'title.delete_time_record' => 'Verwijder tijdrecord',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Kosten',
'title.edit_expense' => 'Bewerk kosten artikel',
'title.delete_expense' => 'Verwijder kosten artikel',
'title.time' => 'Tid',
'title.edit_time_record' => 'Endre tids oppføringen',
'title.delete_time_record' => 'Slett tids oppføringen',
-// TODO: translate the following.
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
'title.time' => 'Wybrana data',
'title.edit_time_record' => 'Edytowanie wpisu',
'title.delete_time_record' => 'Usuwanie wpisu',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Wydatki',
'title.edit_expense' => 'Edytowanie wpisu',
'title.delete_expense' => 'Usuwanie wpisu',
'title.time' => 'Tempo',
'title.edit_time_record' => 'Editando entrada de hora',
'title.delete_time_record' => 'Apagando entrada de hora',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Gastos',
'title.edit_expense' => 'Editando item de gasto',
'title.delete_expense' => 'Apagando item de gasto',
// 'title.time' => 'Time',
// 'title.edit_time_record' => 'Editing Time Record',
// 'title.delete_time_record' => 'Deleting Time Record',
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
'title.time' => 'Timpul',
'title.edit_time_record' => 'Editarea inregistrarii timpului',
'title.delete_time_record' => 'Ștergerea inregistrarii timpului',
-// TODO: translate the following.
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
'title.time' => 'Время',
'title.edit_time_record' => 'Редактирование записи о времени',
'title.delete_time_record' => 'Удаление записи о времени',
+'title.time_files' => 'Файлы записи о времени',
'title.expenses' => 'Расходы',
'title.edit_expense' => 'Редактирование предмета расхода',
'title.delete_expense' => 'Удаление предмета расхода',
'title.time' => 'Časový záznam',
'title.edit_time_record' => 'Upravovanie časového záznamu',
'title.delete_time_record' => 'Vymazávanie časového záznamu',
-// TODO: translate the following.
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
// 'title.time' => 'Time',
// 'title.edit_time_record' => 'Editing Time Record',
// 'title.delete_time_record' => 'Deleting Time Record',
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
'title.time' => 'Vreme',
'title.edit_time_record' => 'Izmeni unos vremena',
'title.delete_time_record' => 'Obriši unos vremena',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Troškovi',
'title.edit_expense' => 'Izmeni stavke troškova',
'title.delete_expense' => 'Obriši stavke troškova',
'title.time' => 'Tider',
'title.edit_time_record' => 'Redigera tidsregistrering',
'title.delete_time_record' => 'Ta bort tidsregistrering',
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
'title.expenses' => 'Kostnader',
'title.edit_expense' => 'Redigera kostnad',
'title.delete_expense' => 'Ta bort kostnad',
'title.time' => 'Zaman',
'title.edit_time_record' => 'Zaman kaydını düzenliyor',
'title.delete_time_record' => 'Zaman kaydını siliyor',
-// TODO: translate the following.
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
// 'title.time' => 'Time',
'title.edit_time_record' => '编辑时间记录',
'title.delete_time_record' => '删除时间记录',
-// TODO: translate the following.
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
// 'title.time' => 'Time',
'title.edit_time_record' => '編輯時間記錄',
'title.delete_time_record' => '刪除時間記錄',
-// TODO: translate the following.
+// TODO: Translate the following.
+// 'title.time_files' => 'Time Record Files',
// 'title.expenses' => 'Expenses',
// 'title.edit_expense' => 'Editing Expense Item',
// 'title.delete_expense' => 'Deleting Expense Item',
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.63.4909 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.63.4910 | 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>
--- /dev/null
+<table cellspacing="0" cellpadding="7" border="0" width="720">
+ <tr>
+ <td valign="top">
+ <table cellspacing="1" cellpadding="3" border="0" width="100%">
+ <tr>
+ <td width="35%" class="tableHeader">{$i18n.label.thing_name}</td>
+ <td width="35%" class="tableHeader">{$i18n.label.description}</td>
+{if $can_edit}
+ <td class="tableHeader">{$i18n.label.edit}</td>
+ <td class="tableHeader">{$i18n.label.delete}</td>
+{/if}
+ </tr>
+{if $files}
+ {foreach $files as $file}
+ <tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
+ <td><a href="file_download.php?id={$file.id}">{$file.name|escape}</a></td>
+ <td>{$file.description|escape}</td>
+ {if $can_edit}
+ <td><a href="file_edit.php?id={$file.id}">{$i18n.label.edit}</a></td>
+ <td><a href="file_delete.php?id={$file.id}">{$i18n.label.delete}</a></td>
+ {/if}
+ </tr>
+ {/foreach}
+{/if}
+ </table>
+ </td>
+ </tr>
+</table>
+
+{if $can_edit}
+{$forms.fileUploadForm.open}
+<table cellspacing="0" cellpadding="7" border="0" width="720">
+ <tr>
+ <td align="center">
+ <table border="0" width="60%">
+ <tr>
+ <td align="right">{$i18n.label.description}:</td>
+ <td>{$forms.fileUploadForm.description.control}</td>
+ <td align="left">{$forms.fileUploadForm.newfile.control}</td>
+ </tr>
+ <tr><td height="50" align="center" colspan="3">{$forms.fileUploadForm.btn_submit.control}</td></tr>
+ </table>
+ </td>
+ </tr>
+</table>
+{$forms.fileUploadForm.close}
+{/if}
}
$fileHelper = new ttFileHelper($err);
-$files = $fileHelper::getProjectFiles($cl_project_id);
+$files = $fileHelper::getEntityFiles($cl_project_id, 'project');
$form = new Form('fileUploadForm');
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_project_id));
}
$fileHelper = new ttFileHelper($err);
-
-
-
-
-die("coding ongoing sown from here...");
$files = $fileHelper::getEntityFiles($cl_id, 'time');
-
-
$form = new Form('fileUploadForm');
-$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_project_id));
+$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
$form->addInput(array('type'=>'upload','name'=>'newfile','value'=>$i18n->get('button.submit'),'maxsize'=>67108864)); // 64 MB file upload limit.
// Note: for the above limit to work make sure to set upload_max_filesize and post_max_size in php.ini to at least 64M.
$form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
// Finished validating user input.
if ($err->no()) {
- $fields = array('entity_type'=>'project',
- 'entity_id' => $cl_project_id,
+ $fields = array('entity_type'=>'time',
+ 'entity_id' => $cl_id,
'file_name' => $_FILES['newfile']['name'],
'description'=>$cl_description);
if ($fileHelper->putFile($fields)) {
- header('Location: project_files.php?id='.$cl_project_id);
+ header('Location: time_files.php?id='.$cl_id);
exit();
}
}
} // isPost
-$smarty->assign('can_manage', $user->can('manage_projects'));
+$canEdit = !($time_rec['approved'] || $time_rec['timesheet_id'] || $time_rec['invoice_id']);
+$smarty->assign('can_edit', $canEdit);
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
$smarty->assign('files', $files);
-$smarty->assign('title', $i18n->get('title.project_files').': '.$project['name']);
-$smarty->assign('content_page_name', 'project_files.tpl');
+$smarty->assign('title', $i18n->get('title.time_files'));
+$smarty->assign('content_page_name', 'time_files.tpl');
$smarty->display('index.tpl');