$group_id = $user->getGroup();
$org_id = $user->org_id;
- $fields = array('site_id' => urlencode($this->site_id),
+ $curl_fields = array('site_id' => urlencode($this->site_id),
'site_key' => urlencode($this->site_key),
'org_id' => urlencode($org_id),
'org_key' => urlencode($this->getOrgKey()),
);
// url-ify the data for the POST.
- foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
+ foreach($curl_fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
$fields_string = rtrim($fields_string, '&');
// Open connection.
$val = $res->fetchRow();
return $val['group_key'];
}
+
+ // getProjectFiles obtains a list of files for a project.
+ function getProjectFiles($project_id) {
+ global $user;
+ $mdb2 = getConnection();
+
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+
+ $result = array();
+ $sql = "select id, remote_id, file_name as name, description from tt_files".
+ " where entity_type = 'project' and entity_id = $project_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')) {
+ while ($val = $res->fetchRow()) {
+ $result[] = $val;
+ }
+ }
+ return $result;
+ }
}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.61.4888 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.61.4889 | 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>
<td valign="top">
<table cellspacing="1" cellpadding="3" border="0" width="100%">
<tr>
- <td width="35%" class="tableHeader">{$i18n.label.image}</td>
+ <td width="35%" class="tableHeader">{$i18n.label.thing_name}</td>
<td width="35%" class="tableHeader">{$i18n.label.description}</td>
{if $can_manage}
<td class="tableHeader">{$i18n.label.edit}</td>
$cl_description = trim($request->getParameter('description'));
}
-$files = null;
-// $files = ttAttachmentHelper::getProjectFiles();
+$fileHelper = new ttFileHelper($err);
+$files = $fileHelper::getProjectFiles($cl_project_id);
$form = new Form('fileUploadForm');
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_project_id));
// Finished validating user input.
if ($err->no()) {
- $fileHelper = new ttFileHelper($err);
$fields = array('entity_type'=>'project',
'entity_id' => $cl_project_id,
'file_name' => $_FILES['newfile']['name'],
'description'=>$cl_description);
- if (!$fileHelper->putFile($fields)) {
+ if ($fileHelper->putFile($fields)) {
+ header('Location: project_files.php?id='.$cl_project_id);
+ exit();
+ } else
$err->add($i18n->get('error.file_storage'));
- }
}
} // isPost