public function addField($fieldName, $fieldValue) { if ('' == $fieldValue) { return '-'; } $pieces = explode('_', $fieldName); $suffix = end($pieces); switch ($suffix) { case 'datetime': $myDate = intval($fieldValue) ? new w2p_Utilities_Date($this->AppUI->formatTZAwareTime($fieldValue, '%Y-%m-%d %T')) : null; $output = $myDate ? $myDate->format($this->dtf) : '-'; break; case 'email': $output = w2p_email($fieldValue); break; case 'url': $value = str_replace(array('"', '"', '<', '>'), '', $fieldValue); $output = w2p_url($value); break; case 'owner': if (!$fieldValue) { return '-'; } $obj = new CContact(); $obj->findContactByUserid($fieldValue); $link = '?m=users&a=view&user_id=' . $fieldValue; $output = '<a href="' . $link . '">' . $obj->contact_display_name . '</a>'; break; case 'percent': $output = round($fieldValue) . '%'; break; case 'description': $output = w2p_textarea($fieldValue); break; case 'company': case 'department': case 'project': $class = 'C' . ucfirst($suffix); $obj = new $class(); $obj->load($fieldValue); $link = '?m=' . w2p_pluralize($suffix) . '&a=view&' . $suffix . '_id=' . $fieldValue; $output = '<a href="' . $link . '">' . $obj->{"{$suffix}" . '_name'} . '</a>'; break; default: $output = htmlspecialchars($fieldValue, ENT_QUOTES); } return $output; }
function displayFiles($AppUI, $folder_id, $task_id, $project_id, $company_id) { global $m, $a, $tab, $xpg_min, $xpg_pagesize, $showProject, $file_types, $cfObj, $xpg_totalrecs, $xpg_total_pages, $page, $company_id, $allowed_companies, $current_uri, $w2Pconfig, $canEdit, $canRead; $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); // SETUP FOR FILE LIST $q = new w2p_Database_Query(); $q->addQuery('f.*, max(f.file_id) as latest_id, count(f.file_version) as file_versions, round(max(file_version), 2) as file_lastversion'); $q->addQuery('ff.*'); $q->addTable('files', 'f'); $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder'); $q->addJoin('projects', 'p', 'p.project_id = file_project'); $q->addJoin('tasks', 't', 't.task_id = file_task'); $q->leftJoin('project_departments', 'project_departments', 'p.project_id = project_departments.project_id OR project_departments.project_id IS NULL'); $q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL'); //TODO: apply permissions properly $project = new CProject(); $deny1 = $project->getDeniedRecords($AppUI->user_id); if (count($deny1) > 0) { $q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')'); } //TODO: apply permissions properly $task = new CTask(); $deny2 = $task->getDeniedRecords($AppUI->user_id); if (count($deny2) > 0) { $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')'); } if ($project_id) { $q->addWhere('file_project = ' . (int) $project_id); } if ($task_id) { $q->addWhere('file_task = ' . (int) $task_id); } if ($company_id) { $q->addWhere('project_company = ' . (int) $company_id); } $q->setLimit($xpg_pagesize, $xpg_min); $q->addWhere('file_folder = ' . (int) $folder_id); $q->addGroup('file_version_id DESC'); $qv = new w2p_Database_Query(); $qv->addTable('files'); $qv->addQuery('file_id, file_version, file_project, file_name, file_task, file_description, u.user_username as file_owner, file_size, file_category, task_name, file_version_id, file_checkout, file_co_reason, file_type, file_date, cu.user_username as co_user, project_name, project_color_identifier, project_owner, con.contact_first_name, con.contact_last_name, co.contact_first_name as co_contact_first_name, co.contact_last_name as co_contact_last_name '); $qv->addJoin('projects', 'p', 'p.project_id = file_project'); $qv->addJoin('users', 'u', 'u.user_id = file_owner'); $qv->addJoin('contacts', 'con', 'con.contact_id = u.user_contact'); $qv->addJoin('tasks', 't', 't.task_id = file_task'); $qv->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder'); if ($project_id) { $qv->addWhere('file_project = ' . (int) $project_id); } if ($task_id) { $qv->addWhere('file_task = ' . (int) $task_id); } if ($company_id) { $qv->addWhere('project_company = ' . (int) $company_id); } $qv->leftJoin('users', 'cu', 'cu.user_id = file_checkout'); $qv->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact'); $qv->addWhere('file_folder = ' . (int) $folder_id); $files = array(); $file_versions = array(); $files = $q->loadList(); $file_versions = $qv->loadHashList('file_id'); $q->clear(); $qv->clear(); if ($files === array()) { return 0; } $s = ' <table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"> <tr> <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th> <th>' . $AppUI->_('Description') . '</th> <th>' . $AppUI->_('Versions') . '</th> <th>' . $AppUI->_('Category') . '</th> <th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th> <th>' . $AppUI->_('Owner') . '</th> <th>' . $AppUI->_('Size') . '</th> <th>' . $AppUI->_('Type') . '</a></th> <th>' . $AppUI->_('Date') . '</th> <th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th> <th>' . $AppUI->_('co') . '</th> <th nowrap="nowrap" width="5%"></th> <th nowrap="nowrap" width="1"></th> </tr>'; $fp = -1; $file_date = new w2p_Utilities_Date(); $id = 0; foreach ($files as $row) { $latest_file = $file_versions[$row['latest_id']]; $file_date = new w2p_Utilities_Date($latest_file['file_date']); if ($fp != $latest_file['file_project']) { if (!$latest_file['file_project']) { $latest_file['project_name'] = $AppUI->_('Not attached to a project'); $latest_file['project_color_identifier'] = 'f4efe3'; } if ($showProject) { $style = 'background-color:#' . $latest_file['project_color_identifier'] . ';color:' . bestColor($latest_file['project_color_identifier']); $s .= '<tr>'; $s .= '<td colspan="20" style="border: outset 2px #eeeeee;' . $style . '">'; if ($latest_file['file_project'] > 0) { $href = './index.php?m=projects&a=view&project_id=' . $latest_file['file_project']; } else { $href = './index.php?m=projects'; } $s .= '<a href="' . $href . '">'; $s .= '<span style="' . $style . '">' . $latest_file['project_name'] . '</span></a>'; $s .= '</td></tr>'; } } $fp = $latest_file['file_project']; $s .= '<tr> <td nowrap="8%"> <form name="frm_remove_file_' . $latest_file['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="del" value="1" /> <input type="hidden" name="file_id" value="' . $latest_file['file_id'] . '" /> <input type="hidden" name="redirect" value="' . $current_uri . '" /> </form> <form name="frm_duplicate_file_' . $latest_file['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="duplicate" value="1" /> <input type="hidden" name="file_id" value="' . $latest_file['file_id'] . '" /> <input type="hidden" name="redirect" value="' . $current_uri . '" /> </form> '; $junkFile = new CFile(); // TODO: This is just to get getIcon included.. $file_icon = getIcon($row['file_type']); $s .= '<a href="./fileviewer.php?file_id=' . $latest_file['file_id'] . '"><img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" alt="" /> ' . $latest_file['file_name'] . '</a></td>'; $s .= '<td width="20%">' . w2p_textarea($latest_file['file_description']) . '</td><td width="5%" nowrap="nowrap" align="right">'; $hidden_table = ''; $s .= $row['file_lastversion']; if ($row['file_versions'] > 1) { $s .= ' <a href="javascript: void(0);" onClick="expand(\'versions_' . $latest_file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>'; $hidden_table = '<tr><td colspan="20"> <table style="display: none" id="versions_' . $latest_file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"> <tr> <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th> <th>' . $AppUI->_('Description') . '</th> <th>' . $AppUI->_('Versions') . '</th> <th>' . $AppUI->_('Category') . '</th> <th>' . $AppUI->_('Folder') . '</th> <th>' . $AppUI->_('Task Name') . '</th> <th>' . $AppUI->_('Owner') . '</th> <th>' . $AppUI->_('Size') . '</th> <th>' . $AppUI->_('Type') . '</a></th> <th>' . $AppUI->_('Date') . '</th> </tr>'; foreach ($file_versions as $file) { if ($file['file_version_id'] == $latest_file['file_version_id']) { $file_icon = getIcon($file['file_type']); $hdate = new w2p_Utilities_Date($file['file_date']); $hidden_table .= '<tr><td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file['file_id'] . '" title="' . $file['file_description'] . '">' . '<img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" alt="" /> ' . $file['file_name'] . ' </a></td> <td width="20%">' . $file['file_description'] . '</td> <td width="5%" nowrap="nowrap" align="right">' . $file['file_version'] . '</td> <td nowrap="nowrap" align="left">' . $file_types[$file['file_category']] . '</td> <td nowrap="nowrap" align="left">' . ($file['file_folder_name'] != '' ? '<a href="' . W2P_BASE_URL . '/index.php?m=files&tab=' . (count($file_types) + 1) . '&folder=' . $file['file_folder_id'] . '">' . w2PshowImage('folder5_small.png', '16', '16', 'folder icon', 'show only this folder', 'files') . $file['file_folder_name'] . '</a>' : 'Root') . '</td> <td nowrap="nowrap" align="left"><a href="./index.php?m=tasks&a=view&task_id=' . $file['file_task'] . '">' . $file['task_name'] . '</a></td> <td nowrap="nowrap">' . $file['contact_first_name'] . ' ' . $file['contact_last_name'] . '</td> <td width="5%" nowrap="nowrap" align="right">' . file_size(intval($file['file_size'])) . '</td> <td nowrap="nowrap">' . $file['file_type'] . '</td> <td width="5%" nowrap="nowrap" align="center">' . $AppUI->formatTZAwareTime($file['file_date'], $df . ' ' . $tf) . '</td>'; if ($canEdit && $w2Pconfig['files_show_versions_edit']) { $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file['file_id'] . '">' . w2PshowImage('kedit.png', '16', '16', 'edit file', 'edit file', 'files') . "</a>"; } $hidden_table .= '</td><tr>'; } } $hidden_table .= '</table>'; } $s .= '</td> <td width="10%" nowrap="nowrap" align="left">' . $file_types[$file['file_category']] . '</td> <td nowrap="nowrap" align="left"><a href="./index.php?m=tasks&a=view&task_id=' . $latest_file['file_task'] . '">' . $latest_file['task_name'] . '</a></td> <td nowrap="nowrap">' . $latest_file['contact_first_name'] . ' ' . $latest_file['contact_last_name'] . '</td> <td width="5%" nowrap="nowrap" align="right">' . intval($latest_file['file_size'] / 1024) . ' kb</td> <td nowrap="nowrap">' . $latest_file['file_type'] . '</td> <td nowrap="nowrap" align="center">' . $AppUI->formatTZAwareTime($latest_file['file_date'], $df . ' ' . $tf) . '</td> <td width="10%">' . $latest_file['file_co_reason'] . '</td> <td nowrap="nowrap">'; if (empty($row['file_checkout'])) { $s .= '<a href="?m=files&a=co&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('up.png', '16', '16', 'checkout', 'checkout file', 'files') . '</a>'; } elseif ($row['file_checkout'] == $AppUI->user_id) { $s .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('down.png', '16', '16', 'checkin', 'checkin file', 'files') . '</a>'; } else { if ($latest_file['file_checkout'] == 'final') { $s .= 'final'; } else { $s .= $latest_file['co_contact_first_name'] . ' ' . $latest_file['co_contact_last_name'] . '<br>(' . $latest_file['co_user'] . ')'; } } $s .= '</td><td nowrap="nowrap" width="50">'; if ($canEdit && (empty($latest_file['file_checkout']) || $latest_file['file_checkout'] == 'final' && ($canEdit || $latest_file['project_owner'] == $AppUI->user_id))) { $s .= '<a style="float: left;" href="./index.php?m=files&a=addedit&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('kedit.png', '16', '16', 'edit file', 'edit file', 'files') . '</a>'; $s .= '<a style="float: left;" href="javascript: void(0);" onclick="document.frm_duplicate_file_' . $latest_file['file_id'] . '.submit()">' . w2PshowImage('duplicate.png', '16', '16', 'duplicate file', 'duplicate file', 'files') . '</a>'; $s .= '<a style="float: left;" href="javascript: void(0);" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $latest_file['file_id'] . '.submit()}">' . w2PshowImage('remove.png', '16', '16', 'delete file', 'delete file', 'files') . '</a>'; } $s .= '</td>'; $s .= '<td nowrap="nowrap" align="center" width="1">'; if ($canEdit && (empty($latest_file['file_checkout']) || $latest_file['file_checkout'] == 'final' && ($canEdit || $latest_file['project_owner'] == $AppUI->user_id))) { $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $latest_file['file_id'] . ') : removeBulkComponent(' . $latest_file['file_id'] . ')"'; $s .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $latest_file['file_id'] . '" />'; } $s .= '</td></tr>'; $s .= $hidden_table; $hidden_table = ''; } return $s; }
$start = true; } echo $user; } } ?> </tr> </table> </td> <td width="50%" valign="top"> <strong><?php echo $AppUI->_('Description'); ?> </strong> <table cellspacing="0" cellpadding="2" border="0" width="100%"> <tr> <td class="hilite"> <?php echo w2p_textarea($event->event_description); ?> </td> </tr> </table> <?php $custom_fields = new w2p_Core_CustomFields($m, $a, $event->event_id, 'view'); $custom_fields->printHTML(); ?> </td> </tr> </table>
:</td> <td class="hilite"><?php echo $obj->resource_max_allocation; ?> </td> </table> </td> </tr> <tr> <td width="100%" valign="top"> <strong><?php echo $AppUI->_('Description'); ?> </strong> <table cellspacing="0" cellpadding="2" border="0" width="100%"> <tr> <td class="hilite"> <?php echo w2p_textarea($obj->resource_note); ?> </td> </tr> </table> </td> </tr> </table>
?> :</td> <td class="hilite"><?php echo w2p_url($department->dept_url); ?> </td> </tr> </table> </td> <td width="50%"> <strong><?php echo $AppUI->_('Description'); ?> </strong> <table cellspacing="1" cellpadding="2" border="0" width="100%"> <tr> <td class="hilite" width="100%"><?php echo w2p_textarea($department->dept_desc); ?> </td> </tr> </table> </td> </tr> </table> <?php // tabbed information boxes $tabBox = new CTabBox('?m=departments&a=' . $a . '&dept_id=' . $dept_id, '', $tab); $tabBox->add(W2P_BASE_DIR . '/modules/departments/vw_contacts', 'Contacts'); // include auto-tabs with 'view' explicitly instead of $a, because this view is also included in the main index site $tabBox->show();
<?php $fnamelen = 32; $filename = $latest_file['file_name']; if (strlen($latest_file['file_name']) > $fnamelen + 9) { $ext = substr($filename, strrpos($filename, '.') + 1); $filename = substr($filename, 0, $fnamelen); $filename .= '[...].' . $ext; } $myFile = new CFile(); $file_icon = getIcon($file_row['file_type']); echo '<a href="./fileviewer.php?file_id=' . $latest_file['file_id'] . '"><img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" /> ' . $filename . '</a>'; // {$latest_file['file_name']} ?> </td> <td width="20%"><?php echo w2p_textarea($latest_file['file_description']); ?> </td> <td width="5%" nowrap="nowrap" align="right"> <?php $hidden_table = ''; echo $file_row['file_lastversion']; if ($file_row['file_versions'] > 1) { echo ' <a href="javascript: void(0);" onclick="expand(\'versions_' . $latest_file['file_id'] . '\'); ">(' . $file_row['file_versions'] . ')</a>'; $hidden_table = '<tr><td colspan="20"> <table style="display: none" id="versions_' . $latest_file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"> <tr> <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th> <th nowrap="nowrap">' . $AppUI->_('Description') . '</th> <th nowrap="nowrap">' . $AppUI->_('Versions') . '</th> <th nowrap="nowrap">' . $AppUI->_('Category') . '</th>
echo '<table width="100%" cellspacing="1" bgcolor="black">' . $s . '</table>'; ?> </td> </tr> <tr> <td colspan="3" nowrap="nowrap"> <strong><?php echo $AppUI->_('Description'); ?> </strong><br /> </td> </tr> <tr> <td class="hilite" colspan="3"> <?php echo w2p_textarea($obj->task_description); ?> </td> </tr> <?php $depts = $obj->getTaskDepartments($AppUI, $task_id); if (count($depts)) { ?> <tr> <td><strong><?php echo $AppUI->_('Departments'); ?> </strong></td> </tr> <tr> <td colspan="3" class="hilite">
</a></li> <?php } ?> <li class="info-text"><?php echo w2PshowImage('folder5_small.png', '22', '22', '', '', 'files'); ?> <strong><?php echo isset($cfObj) && $cfObj->file_folder_name ? $cfObj->file_folder_name : "Root"; ?> </strong></li> <?php if (isset($cfObj) && $cfObj->file_folder_description != '') { ?> <li class="info-text"><?php echo w2p_textarea($cfObj->file_folder_description); ?> </li> <?php } ?> </ul> </td> </tr> </tr> <?php if (countFiles($folder) > 0) { echo displayFiles($AppUI, $folder_id, $task_id, $project_id, $company_id); } elseif (!empty($limited) && !$limited or $folder_id != 0) { echo '<tr><td colspan="20">' . $AppUI->_('no files') . '</td></tr>'; }
/** * createColumn is handy because it can take any input $fieldName and use * its suffix to determine how the field should be displayed. * * This allows us to treat project_description, task_description, * company_description, or even some_other_crazy_wacky_description in * exactly the same way without additional lines of code or configuration. * If you want to do your own, feel free... but this is probably easier. * * Examples: _budget, _date, _name, _owner * * This may not work for things like company_type or project_type which are * actually just references to look up tables, ... but should work on * fields like project_company, dept_company because we still have a * common suffix. * * @note I'm kind of annoyed about the complexity and sheer number of * paths of this method but overall I think it's laid out reasonably * well. I think the more important part is that I've been able to * encapsulate it all here instead of spreading it all over the modules * and views. */ public function createCell($fieldName, $value, $custom = array()) { $additional = ''; if ('' == $value) { return '<td>-</td>'; } $pieces = explode('_', $fieldName); $prefix = $pieces[0]; $suffix = '_' . end($pieces); if ($fieldName == 'project_actual_end_date') { $suffix = '_actual'; } switch ($suffix) { //BEGIN: object-based linkings /* * TODO: The following cases are likely to change once we have an approach to * handle module-level objects and their proper mapping/linkings. */ case '_company': case '_contact': case '_task': $module = substr($suffix, 1); $class = 'C' . ucfirst($module); $obj = new $class(); $obj->load($value); $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value; $cell = '<a href="' . $link . '">' . $obj->{"{$module}" . '_name'} . '</a>'; $suffix .= ' _name'; break; case '_department': $module = substr($suffix, 1); $class = 'C' . ucfirst($module); $obj = new $class(); $obj->load($value); /** * This is a branch separate from _company, _contact, etc above because although the module is called * departments, the fields are dept_id and dept_name. :( * ~ caseydk, Dec 11 2013 */ $link = '?m=' . w2p_pluralize($module) . '&a=view&dept_id=' . $value; $cell = '<a href="' . $link . '">' . $obj->dept_name . '</a>'; $suffix .= ' _name'; break; case '_folder': $obj = new CFile_Folder(); $obj->load($value); $foldername = $value ? $obj->file_folder_name : 'Root'; $image = '<img src="' . w2PfindImage('folder5_small.png', 'files') . '" />'; $link = '?m=files&tab=4&folder=' . (int) $value; $cell = '<a href="' . $link . '">' . $image . ' ' . $foldername . '</a>'; $suffix .= ' _name'; break; case '_user': case '_username': $obj = new CContact(); $obj->findContactByUserid($this->tableRowData['user_id']); $link = '?m=users&a=view&user_id=' . $this->tableRowData['user_id']; $cell = '<a href="' . $link . '">' . $obj->user_username . '</a>'; break; //END: object-based linkings /* * TODO: These two prefix adjustments are an ugly hack because our departments * table doesn't follow the same convention as every other table we have. * This needs to be fixed in v4.0 - caseydk 13 Feb 2012 * * TODO: And unfortunately, the forums module is screwy using 'viewer' instead * of our standard 'view' for the page. ~ caseydk 16 Feb 2012 */ //END: object-based linkings /* * TODO: These two prefix adjustments are an ugly hack because our departments * table doesn't follow the same convention as every other table we have. * This needs to be fixed in v4.0 - caseydk 13 Feb 2012 * * TODO: And unfortunately, the forums module is screwy using 'viewer' instead * of our standard 'view' for the page. ~ caseydk 16 Feb 2012 */ case '_name': $prefix = $prefix == 'project_short' ? 'project' : $prefix; $prefix = $prefix == 'dept' ? 'department' : $prefix; $page = $prefix == 'forum' || $prefix == 'message' ? 'viewer' : 'view'; $link = '?m=' . w2p_pluralize($prefix) . '&a=' . $page . '&'; $link = $prefix == 'message' ? '?m=forums&a=' . $page . '&' : $link; $prefix = $prefix == 'department' ? 'dept' : $prefix; $link .= $prefix . '_id=' . $this->tableRowData[$prefix . '_id']; $link .= $prefix == 'task_log' ? '&tab=1&task_id=' . $this->tableRowData['task_id'] : ''; $icon = $fieldName == 'file_name' ? '<img src="' . w2PfindImage(getIcon($this->tableRowData['file_type']), 'files') . '" /> ' : ''; $cell = '<a href="' . $link . '">' . $icon . $value . '</a>'; //TODO: task_logs are another oddball.. $cell = $prefix == 'task_log' ? str_replace('task_logs', 'tasks', $cell) : $cell; break; case '_author': case '_creator': case '_owner': case '_updator': if ((int) $value) { $obj = new CContact(); $obj->findContactByUserid($value); $suffix .= ' nowrap'; $link = '?m=users&a=view&user_id=' . $value; $cell = '<a href="' . $link . '">' . $obj->contact_display_name . '</a>'; } else { $cell = $value; } break; // The above are all contact/user display names, the below are numbers. // The above are all contact/user display names, the below are numbers. case '_count': case '_hours': $cell = $value; break; case '_duration': $durnTypes = w2PgetSysVal('TaskDurationType'); $cell = $value . ' ' . $this->AppUI->_($durnTypes[$this->tableRowData['task_duration_type']]); break; case '_size': $cell = file_size($value); break; case '_budget': $cell = w2PgetConfig('currency_symbol'); $cell .= formatCurrency($value, $this->AppUI->getPref('CURRENCYFORM')); break; case '_url': $value = str_replace(array('"', '"', '<', '>'), '', $value); $cell = w2p_url($value); break; case '_email': $cell = w2p_email($value); break; case '_birthday': case '_date': $myDate = intval($value) ? new w2p_Utilities_Date($value) : null; $cell = $myDate ? $myDate->format($this->df) : '-'; break; case '_actual': $end_date = intval($this->tableRowData['project_end_date']) ? new w2p_Utilities_Date($this->tableRowData['project_end_date']) : null; $actual_end_date = intval($this->tableRowData['project_actual_end_date']) ? new w2p_Utilities_Date($this->tableRowData['project_actual_end_date']) : null; $style = $actual_end_date < $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : ''; if ($actual_end_date) { $cell = '<a href="?m=tasks&a=view&task_id=' . $this->tableRowData['project_last_task'] . '" ' . $style . '>' . $actual_end_date->format($this->df) . '</a>'; } else { $cell = '-'; } break; case '_created': case '_datetime': case '_update': case '_updated': $myDate = intval($value) ? new w2p_Utilities_Date($this->AppUI->formatTZAwareTime($value, '%Y-%m-%d %T')) : null; $cell = $myDate ? $myDate->format($this->dtf) : '-'; break; case '_description': $cell = w2p_textarea($value); break; case '_priority': $mod = $value > 0 ? '+' : '-'; $image = '<img src="' . w2PfindImage('icons/priority' . $mod . abs($value) . '.gif') . '" width="13" height="16" alt="">'; $cell = $value != 0 ? $image : ''; break; case '_complete': case '_assignment': case '_allocated': case '_allocation': $cell = round($value) . '%'; break; case '_password': $cell = '(' . $this->AppUI->_('hidden') . ')'; break; case '_version': $value = (int) (100 * $value); $cell = number_format($value / 100, 2); break; case '_identifier': $additional = 'style="background-color:#' . $value . '; color:' . bestColor($value) . '" '; $cell = $this->tableRowData['project_percent_complete'] . '%'; break; case '_project': $module = substr($suffix, 1); $class = 'C' . ucfirst($module); $obj = new $class(); $obj->load($value); $color = $obj->project_color_identifier; $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value; $cell = '<span style="background-color:#' . $color . '; padding: 3px"><a href="' . $link . '" style="color:' . bestColor($color) . '">' . $obj->{"{$module}" . '_name'} . '</a></span>'; $suffix .= ' _name'; break; case '_assignees': $cell = $value; break; case '_problem': if ($value) { $cell = '<a href="?m=tasks&a=index&f=all&project_id=' . $this->tableRowData['project_id'] . '">'; $cell .= w2PshowImage('icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem'); $cell .= '</a>'; } else { $cell = '-'; } break; default: $value = isset($custom[$fieldName]) ? $custom[$fieldName][$value] : $value; $cell = htmlspecialchars($value, ENT_QUOTES); } $begin = '<td ' . $additional . 'class="' . $suffix . '">'; $end = '</td>'; return $begin . $cell . $end; }
$s .= '<tr>'; $s .= '<td valign="top" style="' . $style . '">'; $s .= $date->format($df . ' ' . $tf) . ' - '; $s .= '<a href="mailto:' . $row['contact_email'] . '">'; $s .= '<font size="2">' . $row['contact_first_name'] . ' ' . $row['contact_last_name'] . '</font></a>'; $s .= '<br />'; if (sizeof($editor) > 0) { $s .= '<br/> <br/>' . $AppUI->_('last edited by'); $s .= ':<br/><a href="mailto:' . $editor[0]['contact_email'] . '">'; $s .= '<font size="1">' . $editor[0]['contact_first_name'] . ' ' . $editor[0]['contact_last_name'] . '</font></a>'; } $s .= '<a href="javascript: void(0);" onclick="toggle(' . $row['message_id'] . ')">'; $s .= '<span size="2"><strong>' . $row['message_title'] . '</strong></span></a>'; $side .= '<div class="message" id="' . $row['message_id'] . '" style="display: none">'; $row['message_body'] = $bbparser->qparse($row['message_body']); $side .= w2p_textarea($row['message_body']); $side .= '</div>'; $s .= '</td>'; if ($first) { $s .= '<td rowspan="' . count($messages) . '" valign="top">'; echo $s; $s = ''; $first = false; } $s .= '</tr>'; } } } if ($viewtype != 'single') { echo $s; }
$custom_fields = new CustomFields($m, $a, $project->project_id, 'view'); $custom_fields->printHTML(); ?> </td> </tr> <tr> <td colspan="2"> <strong><?php echo $AppUI->_('Description'); ?> </strong><br /> <table cellspacing="0" cellpadding="2" border="0" width="100%"> <tr> <td class="hilite"> <?php echo w2p_textarea($project->project_description); ?> </td> </tr> </table> </td> </tr> </table> </td> <td width="50%" rowspan="1" valign="top"> <strong><?php echo $AppUI->_('Summary'); ?> </strong><br /> <table cellspacing="1" cellpadding="2" border="0" width="100%">
$custom_fields->printHTML(); ?> </td> </tr> <?php } ?> </table> </td> <td valign="top" width="50%"> <strong><?php echo $AppUI->_('Contact Notes'); ?> </strong><br /> <?php echo w2p_textarea($contact->contact_notes); ?> </td> </tr> <tr> <td> <input type="button" value="<?php echo $AppUI->_('back'); ?> " class="button" onclick="javascript:window.location='./index.php?m=contacts';" /> </td> </tr> </table> <?php // tabbed information boxes $tabBox = new CTabBox('?m=contacts&a=' . $a . '&contact_id=' . $contact_id, '', $tab);
?> /> </td> <td> <span style="font-size:10pt;font-weight:bold"> <a href="?m=forums&a=viewer&forum_id=<?php echo $row['forum_id']; ?> "><?php echo $row['forum_name']; ?> </a> </span> <br /><?php echo w2p_textarea($row['forum_description']); ?> <br /><font color="#777777"><?php echo $AppUI->_('Owner') . ' ' . $row['owner_name']; ?> , <?php echo $AppUI->_('Started') . ' ' . $create_date->format($df); ?> </font> </td> <td nowrap="nowrap" align="center"><?php echo $row['forum_topics']; ?> </td> <td nowrap="nowrap" align="center"><?php
} elseif (isset($taskLogReference[$row['task_log_reference']])) { $reference_image = $taskLogReference[$row['task_log_reference']]; } } $s .= '<td align="center" valign="middle">' . $reference_image . '</td>'; $s .= '<td width="30%" style="' . $style . '">' . $row['task_log_name'] . '</td>'; $s .= !empty($row['task_log_related_url']) ? '<td><a href="' . $row['task_log_related_url'] . '" title="' . $row['task_log_related_url'] . '">' . $AppUI->_('URL') . '</a></td>' : '<td></td>'; $s .= '<td width="100">' . $row['real_name'] . '</td>'; $s .= '<td width="100" align="right">' . sprintf('%.2f', $row['task_log_hours']) . '<br />('; $minutes = (int) (($row['task_log_hours'] - (int) $row['task_log_hours']) * 60); $minutes = strlen($minutes) == 1 ? '0' . $minutes : $minutes; $s .= (int) $row['task_log_hours'] . ':' . $minutes . ')</td>'; $s .= '<td width="100">' . $row['task_log_costcode'] . '</td><td>' . '<a name="tasklog' . $row['task_log_id'] . '"></a>'; // dylan_cuthbert: auto-transation system in-progress, leave these lines $transbrk = "\n[translation]\n"; $descrip = w2p_textarea($row['task_log_description']); $tranpos = mb_strpos($descrip, mb_str_replace("\n", '<br />', $transbrk)); if ($tranpos === false) { $s .= $descrip; } else { $descrip = mb_substr($descrip, 0, $tranpos); $tranpos = mb_strpos($row['task_log_description'], $transbrk); $transla = mb_substr($row['task_log_description'], $tranpos + mb_strlen($transbrk)); $transla = mb_trim(mb_str_replace("'", '"', $transla)); $s .= $descrip . 'gsd' . '<div style="font-weight: bold; text-align: right"><a title="' . $transla . '" class="hilite">[' . $AppUI->_('translation') . ']</a></div>'; } // end auto-translation code $s .= '</td><td>'; if ($canDelete) { $s .= '<a href="javascript:delIt2(' . $row['task_log_id'] . ');" title="' . $AppUI->_('delete log') . '">' . w2PshowImage('icons/stock_delete-16.png', 16, 16, '') . '</a>'; }
/** * Tests the proper creation of an email link */ public function test_w2p_textarea() { $target = ''; $linkText = w2p_textarea(''); $this->assertEquals($target, $linkText); $target = 'Have you seen this - <a href="http://web2project.net" target="_blank">http://web2project.net</a> ?'; $linkText = w2p_textarea('Have you seen this - http://web2project.net ?'); $this->assertEquals($target, $linkText); $target = '<a href="http://web2project.net" target="_blank">http://web2project.net</a> is a fork of <a href="http://dotproject.net" target="_blank">http://dotproject.net</a>'; $linkText = w2p_textarea('http://web2project.net is a fork of http://dotproject.net'); $this->assertEquals($target, $linkText); $target = '<a href="http://web2project.net" target="_blank">http://web2project.net</a> is a great site'; $linkText = w2p_textarea('http://web2project.net is a great site'); $this->assertEquals($target, $linkText); $target = 'Please check out <a href="http://web2project.net" target="_blank">http://web2project.net</a>'; $linkText = w2p_textarea('Please check out http://web2project.net'); $this->assertEquals($target, $linkText); }
echo $AppUI->_('regenerate feed url'); ?> " /> </form> </td> </tr> <tr> <td colspan="2"><strong><?php echo $AppUI->_('Signature'); ?> :</strong></td> </tr> <tr> <td class="hilite" width="100%" colspan="2"> <?php echo w2p_textarea($user->user_signature); ?> </td> </tr> </table> </td> </tr> </table> <?php // tabbed information boxes $min_view = true; $tabBox = new CTabBox('?m=admin&a=viewuser&user_id=' . $user_id, '', $tab); $tabBox->add(W2P_BASE_DIR . '/modules/admin/vw_usr_log', 'User Log'); $tabBox->add(W2P_BASE_DIR . '/modules/admin/vw_usr_perms', 'Permissions');
echo $AppUI->_($types[$company->company_type]); ?> </td> </tr> </table> </td> <td width="50%" valign="top"> <strong><?php echo $AppUI->_('Description'); ?> </strong> <table cellspacing="0" cellpadding="2" border="0" width="100%"> <tr> <td class="hilite"> <?php echo w2p_textarea($company->company_description); ?> </td> </tr> </table> <?php $custom_fields = new w2p_Core_CustomFields($m, $a, $company->company_id, 'view'); $custom_fields->printHTML(); ?> </td> </tr> </table> <?php // tabbed information boxes $moddir = W2P_BASE_DIR . '/modules/companies/';
function displayFiles($folder) { global $m, $a, $tab, $AppUI, $xpg_min, $xpg_pagesize; global $deny1, $deny2, $project_id, $task_id, $showProject, $file_types, $cfObj; global $xpg_totalrecs, $xpg_total_pages, $page; global $company_id, $allowed_companies, $current_uri, $w2Pconfig, $canEdit, $canRead; $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); // SETUP FOR FILE LIST $q = new DBQuery(); $q->addTable('files'); $q->addQuery('files.*,count(file_version) as file_versions,round(max(file_version), 2) as file_lastversion,file_folder_id, file_folder_name,project_name, project_color_identifier,contact_first_name, contact_last_name,task_name,task_id'); $q->addJoin('projects', 'p', 'p.project_id = file_project'); $q->addJoin('users', 'u', 'u.user_id = file_owner'); $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addJoin('tasks', 't', 't.task_id = file_task'); $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder'); $q->addWhere('file_folder = ' . (int) $folder); if (count($deny1) > 0) { $q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')'); } if (count($deny2) > 0) { $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')'); } if ($project_id) { $q->addWhere('file_project = ' . (int) $project_id); } if ($task_id) { $q->addWhere('file_task = ' . (int) $task_id); } if ($company_id) { $q->innerJoin('companies', 'co', 'co.company_id = p.project_company'); $q->addWhere('company_id = ' . (int) $company_id); $q->addWhere('company_id IN (' . $allowed_companies . ')'); } $q->addGroup('file_folder'); $q->addGroup('project_name'); $q->addGroup('file_version_id'); $q->addOrder('file_folder'); $q->addOrder('project_name'); $q->addOrder('file_name'); $q->setLimit($xpg_pagesize, $xpg_min); $qv = new DBQuery(); $qv->addTable('files'); $qv->addQuery('files.file_id, file_version, file_project, file_name, file_task, file_description, user_username as file_owner, file_size, file_category, file_type, file_date, file_folder_name, file_co_reason, contact_first_name, contact_last_name'); $qv->addJoin('projects', 'p', 'p.project_id = file_project'); $qv->addJoin('users', 'u', 'u.user_id = file_owner'); $qv->addJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $qv->addJoin('tasks', 't', 't.task_id = file_task'); $qv->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder'); $qv->addWhere('file_folder = ' . (int) $folder); if ($project_id) { $qv->addWhere('file_project = ' . (int) $project_id); } if ($task_id) { $qv->addWhere('file_task = ' . (int) $task_id); } if ($company_id) { $qv->innerJoin('companies', 'co', 'co.company_id = p.project_company'); $qv->addWhere('company_id = ' . (int) $company_id); $qv->addWhere('company_id IN (' . $allowed_companies . ')'); } $files = array(); $file_versions = array(); //if ($canRead) { $files = $q->loadList(); $file_versions = $qv->loadList(); $q->clear(); $qv->clear(); //} if ($files === array()) { return 0; } $s = ' <table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"> <tr> <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th> <th>' . $AppUI->_('Description') . '</th> <th>' . $AppUI->_('Versions') . '</th> <th>' . $AppUI->_('Category') . '</th> <th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th> <th>' . $AppUI->_('Owner') . '</th> <th>' . $AppUI->_('Size') . '</th> <th>' . $AppUI->_('Type') . '</a></th> <th>' . $AppUI->_('Date') . '</th> <th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th> <th>' . $AppUI->_('co') . '</th> <th nowrap="nowrap" width="1"></th> <th nowrap="nowrap" width="1"></th> </tr>'; $fp = -1; $file_date = new CDate(); $id = 0; foreach ($files as $row) { $file_date = new CDate($row['file_date']); if ($fp != $row['file_project']) { if (!$row['project_name']) { $row['project_name'] = $AppUI->_('All Projects'); $row['project_color_identifier'] = 'f4efe3'; } if ($showProject) { $s .= '<tr><td colspan="20" style="background-color:#' . $row['project_color_identifier'] . '"><font color="' . bestColor($row['project_color_identifier']) . '">'; if ($row['file_project'] > 0) { $href = './index.php?m=projects&a=view&project_id=' . $row['file_project']; } else { $href = './index.php?m=projects'; } $s .= '<a href="' . $href . '">' . $row['project_name'] . '</a></font></td></tr>'; } } $fp = $row['file_project']; if ($row['file_versions'] > 1) { $file = last_file($file_versions, $row['file_name'], $row['file_project']); } else { $file = $row; } $s .= ' <form name="frm_remove_file_' . $file['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="del" value="1" /> <input type="hidden" name="file_id" value="' . $file['file_id'] . '" /> <input type="hidden" name="redirect" value="' . $current_uri . '" /> </form> <form name="frm_duplicate_file_' . $file['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="duplicate" value="1" /> <input type="hidden" name="file_id" value="' . $file['file_id'] . '" /> <input type="hidden" name="redirect" value="' . $current_uri . '" /> </form> <tr> <td nowrap="8%">'; $file_icon = getIcon($row['file_type']); $s .= '<a href="./fileviewer.php?file_id=' . $file['file_id'] . '"><img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" /> ' . $row['file_name'] . '</a></td><td width="20%">' . w2p_textarea($file['file_description']) . '</td><td width="5%" nowrap="nowrap" align="right">'; $hidden_table = ''; $s .= $row['file_lastversion']; if ($row['file_versions'] > 1) { $s .= ' <a href="javascript: void(0);" onClick="expand(\'versions_' . $file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>'; $hidden_table = '<tr><td colspan="20"> <table style="display: none" id="versions_' . $file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"> <tr> <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th> <th>' . $AppUI->_('Description') . '</th> <th>' . $AppUI->_('Versions') . '</th> <th>' . $AppUI->_('Category') . '</th> <th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th> <th>' . $AppUI->_('Owner') . '</th> <th>' . $AppUI->_('Size') . '</th> <th>' . $AppUI->_('Type') . '</a></th> <th>' . $AppUI->_('Date') . '</th> <th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th> <th>' . $AppUI->_('co') . '</th> <th nowrap width="1"></th> <th nowrap width="1"></th> </tr>'; foreach ($file_versions as $file_row) { if ($file_row['file_name'] == $row['file_name'] && $file_row['file_project'] == $row['file_project']) { $file_icon = getIcon($file_row['file_type']); $file_date = new CDate($file_row['file_date']); $hidden_table .= '<form name="frm_delete_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="del" value="1" /> <input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" /> <input type="hidden" name="redirect" value="' . $current_uri . '" /> </form>'; $hidden_table .= '<form name="frm_duplicate_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="duplicate" value="1" /> <input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" /> <input type="hidden" name="redirect" value="' . $current_uri . '" /> </form>'; $hidden_table .= '<tr> <td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file_row['file_id'] . '" title="' . $file_row['file_description'] . '">' . '<img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" /> ' . $file_row['file_name'] . ' </a></td> <td width="20%">' . $file_row['file_description'] . '</td> <td width="5%" nowrap="nowrap" align="right">' . $file_row['file_version'] . '</td> <td width="10%" nowrap="nowrap" align="left"><a href="./index.php?m=' . $m . '&a=' . $a . '&tab=' . ($file_row['file_category'] + 1) . '">' . $file_types[$file_row['file_category'] + 1] . '</a></td> <td width="5%" align="left"><a href="./index.php?m=tasks&a=view&task_id=' . $file_row['file_task'] . '">' . $row['task_name'] . '</a></td> <td width="15%" nowrap="nowrap">' . $row['contact_first_name'] . ' ' . $row['contact_last_name'] . '</td> <td width="5%" nowrap="nowrap" align="right">' . intval($file_row['file_size'] / 1024) . 'kb </td> <td width="15%" nowrap="nowrap">' . $file_row['file_type'] . '</td> <td width="15%" nowrap="nowrap" align="center">' . $file_date->format($df . ' ' . $tf) . '</td> <td width="10%">' . $row['file_co_reason'] . '</td> <td nowrap="nowrap" align="center">'; if (empty($file_row['file_checkout'])) { $hidden_table .= '<a href="?m=files&a=co&file_id=' . $file_row['file_id'] . '">' . w2PshowImage('up.png', '16', '16', 'checkout', 'checkout file', 'files') . '</a>'; } else { if ($row['file_checkout'] == $AppUI->user_id) { $hidden_table .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $file_row['file_id'] . '">' . w2PshowImage('down.png', '16', '16', 'checkin', 'checkin file', 'files') . '</a>'; } else { if ($file_row['file_checkout'] == 'final') { $hidden_table .= 'final'; } else { $q4 = new DBQuery(); $q4->addQuery('file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name'); $q4->addTable('files'); $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout'); $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact'); $q4->addWhere('file_id = ' . (int) $file_row['file_id']); $co_user = array(); $co_user = $q4->loadList(); $co_user = $co_user[0]; $q4->clear(); $hidden_table .= $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')'; } } } $hidden_table .= '</td><td nowrap="nowrap" align="right" width="52">'; if ($canEdit && (empty($file_row['file_checkout']) || $file_row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) { $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file_row['file_id'] . '">' . w2PshowImage('kedit.png', '16', '16', 'edit file', 'edit file', 'files') . "</a>" . '<a href="javascript: void(0);" onclick="document.frm_duplicate_sub_file_' . $file_row['file_id'] . '.submit()">' . w2PshowImage('duplicate.png', '16', '16', 'duplicate file', 'duplicate file', 'files') . "</a>" . '<a href="javascript: void(0);" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_delete_sub_file_' . $file_row['file_id'] . '.submit()}">' . w2PshowImage('remove.png', '16', '16', 'delete file', 'delete file', 'files') . "</a>"; } $hidden_table .= '</td>'; $hidden_table .= '<td nowrap="nowrap" align="right" width="1">'; if ($canEdit && (empty($row['file_checkout']) || $row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) { $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file_row['file_id'] . ') : removeBulkComponent(' . $file_row['file_id'] . ')"'; $hidden_table .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sub_sel_file_' . $file_row['file_id'] . '" />'; } $hidden_table .= '</td>'; $hidden_table .= '</tr>'; } } $hidden_table .= '</table>'; } $s .= '</td> <td width="10%" nowrap="nowrap" align="left"><a href="./index.php?m=' . $m . '&a=' . $a . '&view=categories&tab=' . $file['file_category'] . '">' . $file_types[$file['file_category']] . '</a></td> <td width="5%" align="left"><a href="./index.php?m=tasks&a=view&task_id=' . $file['task_id'] . '">' . $file['task_name'] . '</a></td> <td width="15%" nowrap="nowrap">' . $file['contact_first_name'] . ' ' . $file['contact_last_name'] . '</td> <td width="5%" nowrap="nowrap" align="right">' . intval($file['file_size'] / 1024) . ' kb</td> <td width="15%" nowrap="nowrap">' . $file['file_type'] . '</td> <td width="15%" nowrap="nowrap" align="center">' . $file_date->format($df . ' ' . $tf) . '</td> <td width="10%">' . $file['file_co_reason'] . '</td> <td nowrap="nowrap" align="center">'; if (empty($row['file_checkout'])) { $s .= '<a href="?m=files&a=co&file_id=' . $file['file_id'] . '">' . w2PshowImage('up.png', '16', '16', 'checkout', 'checkout file', 'files') . '</a>'; } elseif ($row['file_checkout'] == $AppUI->user_id) { $s .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $file['file_id'] . '">' . w2PshowImage('down.png', '16', '16', 'checkin', 'checkin file', 'files') . '</a>'; } else { if ($file['file_checkout'] == 'final') { $s .= 'final'; } else { $q4 = new DBQuery(); $q4->addQuery('file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name'); $q4->addTable('files'); $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout'); $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact'); $q4->addWhere('file_id = ' . (int) $file['file_id']); $co_user = array(); $co_user = $q4->loadList(); $co_user = $co_user[0]; $q4->clear(); $s .= $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')'; } } $s .= '</td><td nowrap="nowrap" align="center" width="52">'; if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) { $s .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file['file_id'] . '">' . w2PshowImage('kedit.png', '16', '16', 'edit file', 'edit file', 'files') . '</a>'; $s .= '<a href="javascript: void(0);" onclick="document.frm_duplicate_file_' . $file['file_id'] . '.submit()">' . w2PshowImage('duplicate.png', '16', '16', 'duplicate file', 'duplicate file', 'files') . '</a>'; $s .= '<a href="javascript: void(0);" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $file['file_id'] . '.submit()}">' . w2PshowImage('remove.png', '16', '16', 'delete file', 'delete file', 'files') . '</a>'; } $s .= '<td nowrap="nowrap" align="center" width="1">'; if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) { $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file['file_id'] . ') : removeBulkComponent(' . $file['file_id'] . ')"'; $s .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $file['file_id'] . '" />'; } $s .= '</td></tr>'; $s .= $hidden_table; $hidden_table = ''; } $s .= '</table>'; $s .= '<br />'; return $s; }