public function renderContactTable($moduleName, array $contactList)
 {
     $module = new w2p_System_Module();
     $fields = $module->loadSettings('contacts', $moduleName . '_view');
     if (0 == count($fields)) {
         $fieldList = array('contact_name', 'contact_email', 'contact_phone', 'dept_name');
         $fieldNames = array('Name', 'Email', 'Phone', 'Department');
         $module->storeSettings('contacts', $moduleName . '_view', $fieldList, $fieldNames);
         $fields = array_combine($fieldList, $fieldNames);
     }
     $listTable = new w2p_Output_ListTable($this->AppUI);
     $output = $listTable->startTable();
     $output .= $listTable->buildHeader($fields);
     $output .= $listTable->buildRows($contactList);
     $output .= $listTable->endTable();
     return $output;
 }
// @todo    convert to template
global $AppUI, $project_id, $task_id, $showProject, $tab, $search_string, $m;
$type_filter = $m == 'links' ? $tab - 1 : -1;
if ($task_id && !$project_id) {
    $task = new CTask();
    $task->load($task_id);
    $project_id = $task->task_project;
}
$page = (int) w2PgetParam($_GET, 'page', 1);
if (!isset($project_id)) {
    $project_id = (int) w2PgetParam($_POST, 'project_id', 0);
}
$link = new CLink();
$items = $link->getProjectTaskLinksByCategory(null, $project_id, $task_id, $type_filter, $search_string);
$module = new w2p_System_Module();
$fields = $module->loadSettings('links', 'index_list');
if (0 == count($fields)) {
    $fieldList = array('link_name', 'link_description', 'link_category', 'link_project', 'link_task', 'link_owner', 'link_date');
    $fieldNames = array('Link Name', 'Description', 'Category', 'Project Task', 'Task Name', 'Owner', 'Date');
    $module->storeSettings('links', 'index_list', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$xpg_pagesize = w2PgetConfig('page_size', 50);
$xpg_min = $xpg_pagesize * ($page - 1);
// This is where we start our record set from
// counts total recs from selection
$xpg_totalrecs = count($items);
$items = array_slice($items, $xpg_min, $xpg_pagesize);
$pageNav = buildPaginationNav($AppUI, $m, $tab, $xpg_totalrecs, $xpg_pagesize, $page);
echo $pageNav;
$link_types = w2PgetSysVal('LinkType');
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $company;
$items = $company->departments($company->company_id);
$module = new w2p_System_Module();
$fields = $module->loadSettings('departments', 'company_view');
if (0 == count($fields)) {
    $fieldList = array('dept_name', 'dept_users');
    $fieldNames = array('Name', 'Users');
    $module->storeSettings('departments', 'company_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
?>
    <a name="departments-company_view"> </a>
<?php 
$dept_types = w2PgetSysVal('DepartmentType');
$customLookups = array('dept_type' => $dept_types);
include $AppUI->getTheme()->resolveTemplate('companies/vw_depts');
     }
     //pull the final task row into array
     $projects[$row['task_project']]['tasks'][] = $row;
 }
 $showEditCheckbox = isset($canEditTasks) && $canEditTasks || canView('admin');
 $durnTypes = w2PgetSysVal('TaskDurationType');
 $tempoTask = new CTask();
 $userAlloc = $tempoTask->getAllocation('user_id');
 global $expanded;
 $expanded = $AppUI->getPref('TASKSEXPANDED');
 $expanded = 1;
 $open_link = w2PtoolTip($m, 'click to expand/collapse all the tasks for this project.') . '<a href="javascript: void(0);"><img onclick="expand_collapse(\'task_proj_' . $project_id . '_\', \'tblProjects\',\'collapse\',0,2);" id="task_proj_' . $project_id . '__collapse" src="' . w2PfindImage('up22.png', $m) . '" border="0" width="22" height="22" align="center" ' . (!$expanded ? 'style="display:none"' : '') . ' /><img onclick="expand_collapse(\'task_proj_' . $project_id . '_\', \'tblProjects\',\'expand\',0,2);" id="task_proj_' . $project_id . '__expand" src="' . w2PfindImage('down22.png', $m) . '" border="0" width="22" height="22" align="center" ' . ($expanded ? 'style="display:none"' : '') . ' alt="" /></a>' . w2PendTip();
 $fieldList = array();
 $fieldNames = array();
 $module = new w2p_System_Module();
 $fields = $module->loadSettings('tasks', 'projectdesigner-view');
 if (count($fields) > 0) {
     $fieldList = array_keys($fields);
     $fieldNames = array_values($fields);
 } else {
     // TODO: This is only in place to provide an pre-upgrade-safe
     //   state for versions earlier than v3.0
     //   At some point at/after v4.0, this should be deprecated
     $fieldList = array('task_percent_complete', 'task_priority', 'user_task_priority', 'task_access', 'task_type', 'task_1', 'task_2', 'task_3', 'task_name', 'task_owner', 'task_start_date', 'task_duration', 'task_end_date', 'task_4');
     $fieldNames = array('Work', 'P', 'U', 'A', 'T', 'R', 'I', 'Log', 'Task Name', 'Task Owner', 'Start', 'Duration', 'Finish', 'Assgined Users');
     $module->storeSettings('tasks', 'projectdesigner-view', $fieldList, $fieldNames);
 }
 $open_link = true;
 /*
  <table id="tblTasksarrow" class="tbl list">
     <tr>
    foreach ($projects as $project) {
        if ($project['project_active']) {
            unset($projects[$key]);
        }
        $key++;
    }
    $key = 0;
    foreach ($projects as $project) {
        $tmp_projects[$key] = $project;
        $key++;
    }
    $projects = $tmp_projects;
    //The Status themselves
}
$module = new w2p_System_Module();
$fields = $module->loadSettings('projects', 'printview');
if (count($fields) > 0) {
    $fieldList = array_keys($fields);
    $fieldNames = array_values($fields);
} else {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v2.3
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('project_color_identifier', 'project_priority', 'project_id', 'project_name', 'company_name', 'project_start_date', 'project_end_date', 'project_actual_end_date', 'user_username', 'project_task_count', 'project_status');
    $fieldNames = array('%', 'P', 'ID', 'Project Name', 'Company', 'Start', 'End', 'Actual', 'Owner', 'Tasks', 'Status');
    $module->storeSettings('projects', 'printview', $fieldList, $fieldNames);
}
?>

<table cellpadding="3" cellspacing="1" class="prjprint">
    <tr>
Exemple #6
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
global $AppUI, $search_string, $owner_filter_id, $tab, $orderby, $orderdir;
$type_filter = $tab - 1;
$dept = new CDepartment();
$items = $dept->getFilteredDepartmentList(null, $type_filter, $search_string, $owner_filter_id, $orderby, $orderdir);
$module = new w2p_System_Module();
$fields = $module->loadSettings('departments', 'index_list');
if (0 == count($fields)) {
    $fieldList = array('dept_name', 'countp', 'inactive', 'dept_type');
    $fieldNames = array('Department Name', 'Active Projects', 'Archived Projects', 'Type');
    $module->storeSettings('departments', 'index_list', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$deptTypes = w2PgetSysVal('DepartmentType');
$customLookups = array('dept_type' => $deptTypes);
$listTable = new w2p_Output_ListTable($AppUI);
echo $listTable->startTable();
echo $listTable->buildHeader($fields);
echo $listTable->buildRows($items, $customLookups);
echo $listTable->endTable();
        $filter = 'project_active = 0';
        break;
    default:
        $filter = 'project_active = 1 AND project_status = ' . ($tab - 2);
}
$filter .= $company_id > 0 ? ' AND project_company = ' . $company_id : '';
$filter .= $owner > 0 ? ' AND project_owner = ' . $owner : '';
$filter .= $project_type > -1 ? ' AND project_type = ' . $project_type : '';
$orderby = property_exists('CProject', $orderby) ? $orderby : 'project_name';
$orderby = $orderby == 'project_company' ? 'company_name' : $orderby;
$projects = $project->loadAll($orderby . ' ' . $orderdir, $filter);
$projects = array_values($projects);
$fieldList = array();
$fieldNames = array();
$module = new w2p_System_Module();
$fields = $module->loadSettings('projects', 'index_list');
if (0 == count($fields)) {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v2.3
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('project_color_identifier', 'project_priority', 'project_name', 'project_company', 'project_start_date', 'project_end_date', 'project_actual_end_date', 'project_owner', 'project_task_count');
    $fieldNames = array('%', 'P', 'Project Name', 'Company', 'Start', 'End', 'Actual', 'Owner', 'Tasks');
    $module->storeSettings('projects', 'index_list', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$fieldList = array_keys($fields);
$fieldNames = array_values($fields);
$page = (int) w2PgetParam($_GET, 'page', 1);
$paginator = new w2p_Utilities_Paginator($projects);
$items = $paginator->getItemsOnPage($page);
?>
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
global $AppUI, $project_id;
$start_date = new w2p_Utilities_Date('2001-01-01 00:00:00');
$end_date = new w2p_Utilities_Date('2100-12-31 23:59:59');
$items = CEvent::getEventsForPeriod($start_date, $end_date, 'all', 0, $project_id);
$module = new w2p_System_Module();
$fields = $module->loadSettings('events', 'project_view');
if (0 == count($fields)) {
    $fieldList = array('event_start_date', 'event_end_date', 'event_type', 'event_name');
    $fieldNames = array('Start Date', 'End Date', 'Type', 'Event');
    $module->storeSettings('events', 'project_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
?>
<a name="events-project_view"> </a><?php 
$event_types = w2PgetSysVal('EventType');
$customLookups = array('event_type' => $event_types);
$listTable = new w2p_Output_ListTable($AppUI);
$listTable->df .= ' ' . $AppUI->getPref('TIMEFORMAT');
// @todo cleanup this hack
echo $listTable->startTable();
echo $listTable->buildHeader($fields);
echo $listTable->buildRows($items, $customLookups);
echo $listTable->endTable();
Exemple #9
0
}
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('Forums', 'icon.png', $m);
$titleBlock->addFilterCell('Filter', 'f', $filters, $f);
if ($canAdd) {
    $titleBlock->addButton('New forum', '?m=forums&a=addedit');
}
//TODO: this is a little hack to make sure the table header gets generated in the show() method below
global $a;
$a = 'list';
// End of little hack
$titleBlock->show();
$tabBox = new CTabBox('?m=forums', W2P_BASE_DIR . '/modules/forums/', $tab);
$tabBox->show();
$module = new w2p_System_Module();
$fields = $module->loadSettings('forums', 'index_list');
if (0 == count($fields)) {
    $fieldList = array('forum_project', 'forum_name', 'forum_description', 'forum_owner', 'forum_topics', 'forum_replies', 'forum_last_date');
    $fieldNames = array('Project', 'Forum Name', 'Description', 'Owner', 'Topics', 'Replies', 'Last Post Info');
    $module->storeSettings('forums', 'index_list', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
?>

<form name="watcher" action="./index.php?m=forums&f=<?php 
echo $f;
?>
" method="post" accept-charset="utf-8">
	<input type="hidden" name="dosql" value="do_watch_forum" />
	<input type="hidden" name="watch" value="forum" />
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $search_string, $owner_filter_id, $tab, $orderby, $orderdir;
$type_filter = $tab - 1;
$company = new CCompany();
$items = $company->getCompanyList(null, $type_filter, $search_string, $owner_filter_id, $orderby, $orderdir);
$module = new w2p_System_Module();
$fields = $module->loadSettings('companies', 'index_list');
if (0 == count($fields)) {
    $fieldList = array('company_name', 'countp', 'inactive', 'company_type');
    $fieldNames = array('Company Name', 'Active Projects', 'Archived Projects', 'Type');
    $module->storeSettings('companies', 'index_list', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$company_types = w2PgetSysVal('CompanyType');
$customLookups = array('company_type' => $company_types);
include $AppUI->getTheme()->resolveTemplate('companies/list');
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
global $a, $addPwT, $AppUI, $buffer, $company_id, $department, $min_view, $m, $priority, $projects, $tab, $user_id, $orderdir, $orderby;
if (isset($_GET['orderby'])) {
    $orderdir = $AppUI->getState('UsrProjIdxOrderDir') ? $AppUI->getState('UsrProjIdxOrderDir') == 'asc' ? 'desc' : 'asc' : 'desc';
    $AppUI->setState('UsrProjIdxOrderBy', w2PgetParam($_GET, 'orderby', null));
    $AppUI->setState('UsrProjIdxOrderDir', $orderdir);
}
$orderby = $AppUI->getState('UsrProjIdxOrderBy') ? $AppUI->getState('UsrProjIdxOrderBy') : 'project_end_date';
$orderdir = $AppUI->getState('UsrProjIdxOrderDir') ? $AppUI->getState('UsrProjIdxOrderDir') : 'asc';
$project = new CProject();
$projects = projects_list_data($user_id);
$items = $projects;
$module = new w2p_System_Module();
$fields = $module->loadSettings('projects', 'admin_view');
if (0 == count($fields)) {
    $fieldList = array('project_color_identifier', 'project_priority', 'project_name', 'company_name', 'project_start_date', 'project_duration', 'project_end_date', 'project_end_actual', 'task_log_problem', 'project_owner', 'project_task_count', 'project_status');
    $fieldNames = array('Color', 'P', 'Project Name', 'Company', 'Start', 'Duration', 'End', 'Actual', 'LP', 'Owner', 'Tasks', 'Status');
    $module->storeSettings('projects', 'admin_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$pstatus = w2PgetSysVal('ProjectStatus');
$customLookups = array('project_status' => $pstatus);
$listHelper = new w2p_Output_ListTable($AppUI);
echo $listHelper->startTable();
echo $listHelper->buildHeader($fields, true, 'admin&a=view&user_id=' . $user_id);
echo $listHelper->buildRows($items, $customLookups);
echo $listHelper->endTable();
echo $AppUI->_('Empty Dates');
?>
</label>
            </td>
            <td>
            <?php 
$types = array('' => '(Task Type Filter)') + w2PgetSysVal('TaskType');
echo arraySelect($types, 'task_type', 'class="text" onchange="document.form_buttons.submit()"', $task_type, true);
?>
            </td>
        </tr>
    </table>
</form>
<?php 
$module = new w2p_System_Module();
$fields = $module->loadSettings('tasks', 'todo');
if (0 == count($fields)) {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v3.0
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('task_percent_complete', 'task_priority', 'user_task_priority', 'task_name', 'task_project', 'task_start_datetime', 'task_duration', 'task_end_datetime', 'task_due_in');
    $fieldNames = array('', 'P', 'U', 'Task Name', 'Project Name', 'Start Date', 'Duration', 'Finish Date', 'Due In');
    $module->storeSettings('tasks', 'todo', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$fieldNames = array_values($fields);
$listTable = new w2p_Output_HTML_TaskTable($AppUI);
$listTable->df .= ' ' . $AppUI->getPref('TIMEFORMAT');
$listTable->addBefore('edit', 'task_id');
$listTable->addBefore('pin', 'task_id');
$listTable->addBefore('log', 'task_id');
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
global $AppUI, $company_id;
$start_date = new w2p_Utilities_Date('1999-12-31 00:00:00');
$end_date = new w2p_Utilities_Date('2036-12-31 00:00:00');
$items = CEvent::getEventsForPeriod($start_date, $end_date, 'all', 0, 0, $company_id);
$module = new w2p_System_Module();
$fields = $module->loadSettings('events', 'company_view');
if (0 == count($fields)) {
    $fieldList = array('event_start_date', 'event_end_date', 'event_type', 'event_name');
    $fieldNames = array('Starting Time', 'Ending Time', 'Type', 'Name');
    $module->storeSettings('events', 'company_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$event_types = w2PgetSysVal('EventType');
$customLookups = array('event_type' => $event_types);
$listTable = new w2p_Output_ListTable($AppUI);
$listTable->df .= ' ' . $AppUI->getPref('TIMEFORMAT');
// @todo cleanup this hack
echo $listTable->startTable();
echo $listTable->buildHeader($fields);
echo $listTable->buildRows($items, $customLookups);
echo $listTable->endTable();
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
global $project;
$projectPriority = w2PgetSysVal('ProjectPriority');
$projectStatus = w2PgetSysVal('ProjectStatus');
$original_project_id = $project->project_original_parent;
$project->project_status = -1;
$st_projects_arr = $project->getStructuredProjects();
$module = new w2p_System_Module();
$fields = $module->loadSettings('projects', 'subproject_list');
if (0 == count($fields)) {
    $fieldList = array('project_name', 'project_company', 'project_start_date', 'project_end_date', 'project_priority', 'project_status');
    $fieldNames = array('Project', 'Company', 'Start', 'End', 'P', 'Status');
    $module->storeSettings('projects', 'subproject_list', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$fieldList = array_keys($fields);
$fieldNames = array_values($fields);
$listTable = new w2p_Output_ListTable($AppUI);
$listTable->addBefore('edit', 'project_id');
echo $listTable->startTable('list subprojects');
echo $listTable->buildHeader($fields);
$s = '';
$customLookups = array('project_status' => $projectStatus, 'project_priority' => $projectPriority);
if (is_array($st_projects_arr)) {
    foreach ($st_projects_arr as $project) {
        $line = $project[0];
Exemple #15
0
	}
}
<?php 
}
?>
</script>
<form name="frmDelete2" action="./index.php?m=tasks" method="post" accept-charset="utf-8">
	<input type="hidden" name="dosql" value="do_updatetask" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="task_log_id" value="0" />
</form>
<?php 
$fieldList = array();
$fieldNames = array();
$module = new w2p_System_Module();
$fields = $module->loadSettings('tasks', 'task_logs_tasks_view');
if (0 == count($fields)) {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v3.0
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('task_log_date', 'task_log_reference', 'task_log_name', 'task_log_related_url', 'task_log_creator', 'task_log_hours', 'task_log_costcode', 'task_log_description');
    $fieldNames = array('Date', 'Ref', 'Summary', 'URL', 'User', 'Hours', 'Cost Code', 'Comments');
    $module->storeSettings('tasks', 'task_logs_tasks_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$fieldList = array_keys($fields);
$fieldNames = array_values($fields);
?>
<a name="task_logs-tasks_view"> </a>
<table class="tbl list">
    <tr>
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $company;
$items = $company->users($company->company_id);
$module = new w2p_System_Module();
$fields = $module->loadSettings('users', 'company_view');
if (0 == count($fields)) {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v3.0
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('user_username', 'contact_name', 'user_type');
    $fieldNames = array('Username', 'Name', 'Type');
    $module->storeSettings('users', 'company_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
?>
    <a name="users-company_view"> </a>
<?php 
$user_types = w2PgetSysVal('UserType');
$customLookups = array('user_type' => $user_types);
include $AppUI->getTheme()->resolveTemplate('companies/vw_users');
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
global $AppUI, $tab;
$obj = new CResource();
$where = $tab ? 'resource_type = ' . $tab : '';
$items = $obj->loadAll('resource_name', $where);
$module = new w2p_System_Module();
$fields = $module->loadSettings('resources', 'index_list');
if (0 == count($fields)) {
    $fieldList = array('resource_key', 'resource_name', 'resource_max_allocation', 'resource_type', 'resource_description');
    $fieldNames = array('Identifier', 'Resource Name', 'Max Alloc %', 'Type', 'Notes');
    $module->storeSettings('resources', 'index_list', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$resource_types = w2PgetSysVal('ResourceTypes');
$customLookups = array('resource_type' => $resource_types);
$listTable = new w2p_Output_ListTable($AppUI);
echo $listTable->startTable();
echo $listTable->buildHeader($fields);
echo $listTable->buildRows($items, $customLookups);
echo $listTable->endTable();
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
global $AppUI, $department;
$items = $department->contacts($department->dept_id);
$module = new w2p_System_Module();
$fields = $module->loadSettings('contacts', 'department_view');
if (0 == count($fields)) {
    $fieldList = array('contact_name', 'contact_job', 'contact_email', 'contact_phone', 'dept_name');
    $fieldNames = array('Name', 'Job Title', 'Email', 'Phone', 'Department');
    $module->storeSettings('contacts', 'department_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
?>
<a name="contacts-department_view"> </a><?php 
$listTable = new w2p_Output_ListTable($AppUI);
echo $listTable->startTable();
echo $listTable->buildHeader($fields);
echo $listTable->buildRows($items, $customLookups);
echo $listTable->endTable();
$where = -1 == $filter_param ? '' : "history_table = '" . $filter_param . "'";
$histories = $history->loadAll('history_date DESC', $where);
$items = array_values($histories);
$display = array();
$perms = $AppUI->acl();
foreach ($items as $item) {
    if (!$perms->checkModuleItem($item['history_table'], 'view', $item['history_item'])) {
        continue;
    }
    // @note this next line is a little hack so our templating can resolve which history_user is which user
    $item['user_id'] = $item['history_user'];
    $display[] = $item;
}
$items = $display;
$module = new w2p_System_Module();
$fields = $module->loadSettings('history', 'index_list');
if (0 == count($fields)) {
    $fieldList = array('history_date', 'history_description', 'history_user');
    $fieldNames = array('Date', 'Description', 'Owner');
    $module->storeSettings('history', 'index_list', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$xpg_pagesize = w2PgetConfig('page_size', 50);
$xpg_min = $xpg_pagesize * ($page - 1);
// This is where we start our record set from
$xpg_totalrecs = count($items);
$items = array_slice($items, $xpg_min, $xpg_pagesize);
$m .= '&filter=' . $filter_param;
// This is a hack to get the pagination to work as expected
$pageNav = buildPaginationNav($AppUI, $m, 0, $xpg_totalrecs, $xpg_pagesize, $page);
$listTable = new w2p_Output_ListTable($AppUI);
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $company;
$items = $company->contacts($company->company_id);
$fieldList = array();
$fieldNames = array();
$module = new w2p_System_Module();
$fields = $module->loadSettings('contacts', 'company_view');
if (0 == count($fields)) {
    $fieldList = array('contact_name', 'contact_job', 'contact_email', 'contact_phone', 'dept_name');
    $fieldNames = array('Name', 'Job Title', 'Email', 'Phone', 'Department');
    $module->storeSettings('contacts', 'company_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
?>
<a name="contacts-company_view"> </a><?php 
include $AppUI->getTheme()->resolveTemplate('companies/vw_contacts');
function displayFiles($AppUI, $folder_id, $task_id, $project_id, $company_id)
{
    global $m, $tab, $xpg_min, $xpg_pagesize, $showProject, $file_types, $company_id, $current_uri, $canEdit;
    // 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, file_owner, user_id');
    $q->addQuery('ff.*, max(file_version) as file_version, f.file_date as file_datetime');
    $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->addJoin('users', 'u', 'u.user_id = file_owner');
    $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);
    }
    //$tab = ($m == 'files') ? $tab-1 : -1;
    $temp_tab = $m == 'files' ? $tab - 1 : -1;
    if ($temp_tab >= 0 and count($file_types) - 1 > $temp_tab) {
        //if ($tab >= 0) {
        $q->addWhere('file_category = ' . (int) $temp_tab);
    }
    $q->setLimit($xpg_pagesize, $xpg_min);
    if ($folder_id > -1) {
        $q->addWhere('file_folder = ' . (int) $folder_id);
    }
    $q->addGroup('file_version_id DESC');
    $q->addOrder('project_name ASC, file_parent ASC, file_id DESC');
    $qv = new w2p_Database_Query();
    $qv->addTable('files');
    $qv->addQuery('file_id, file_version, file_project, file_name, file_task,
        file_description, file_owner, file_size, file_category,
        task_name, file_version_id, file_date as file_datetime, file_checkout, file_co_reason, file_type,
        file_date, cu.user_username as co_user, project_name,
        project_color_identifier, project_owner, u.user_id,
        con.contact_first_name, con.contact_last_name, con.contact_display_name as contact_name,
        co.contact_first_name as co_contact_first_name, co.contact_last_name as co_contact_last_name,
        co.contact_display_name as co_contact_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);
    }
    if ($temp_tab >= 0 and count($file_types) - 1 > $temp_tab) {
        //if ($tab >= 0) {
        $qv->addWhere('file_category = ' . (int) $temp_tab);
    }
    $qv->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
    $qv->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
    if ($folder_id > -1) {
        $qv->addWhere('file_folder = ' . (int) $folder_id);
    }
    $files = $q->loadList();
    $file_versions = $qv->loadHashList('file_id');
    $module = new w2p_System_Module();
    $fields = $module->loadSettings('files', 'index_list');
    if (count($fields) > 0) {
        $fieldList = array_keys($fields);
        $fieldNames = array_values($fields);
    } else {
        // TODO: This is only in place to provide an pre-upgrade-safe
        //   state for versions earlier than v3.0
        //   At some point at/after v4.0, this should be deprecated
        $fieldList = array('file_name', 'file_description', 'file_version', 'file_category', 'file_folder', 'file_task', 'file_owner', 'file_datetime');
        $fieldNames = array('File Name', 'Description', 'Version', 'Category', 'Folder', 'Task Name', 'Owner', 'Date');
        $module->storeSettings('files', 'index_list', $fieldList, $fieldNames);
    }
    $s = '<tr>';
    $s .= '<th></th>';
    $s .= '<th>' . $AppUI->_('co') . '</th>';
    foreach ($fieldNames as $index => $name) {
        $s .= '<th>' . $AppUI->_($fieldNames[$index]) . '</th>';
    }
    $s .= '<th></th>';
    $s .= '</tr>';
    $fp = -1;
    $htmlHelper = new w2p_Output_HTMLHelper($AppUI);
    $htmlHelper->df .= ' ' . $AppUI->getPref('TIMEFORMAT');
    $file_types = w2PgetSysVal('FileType');
    $customLookups = array('file_category' => $file_types);
    foreach ($files as $row) {
        $latest_file = $file_versions[$row['latest_id']];
        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="text-align: left; 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'];
        $row['file_datetime'] = $latest_file['file_datetime'];
        $row['file_id'] = $latest_file['file_id'];
        $htmlHelper->stageRowData($row);
        $s .= '<tr>';
        $s .= '<td class="data">';
        if ($canEdit && (empty($latest_file['file_checkout']) || $latest_file['file_checkout'] == 'final' && ($canEdit || $latest_file['project_owner'] == $AppUI->user_id))) {
            $s .= '<a 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 .= '</td>';
        $s .= '<td class="data">';
        if ($canEdit && empty($latest_file['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>';
        } else {
            if ($latest_file['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_name'] . '<br>(' . $latest_file['co_user'] . ')';
                }
            }
        }
        $version_link = '';
        $hidden_table = '';
        if ($row['file_versions'] > 1) {
            $version_link = '&nbsp<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'] . '" class="tbl list">
                <tr>';
            foreach ($fieldNames as $index => $name) {
                $hidden_table .= '<th nowrap="nowrap">';
                $hidden_table .= $AppUI->_($fieldNames[$index]);
                $hidden_table .= '</th>';
            }
            $hidden_table .= '</tr>';
            $sub_htmlHelper = new w2p_Output_HTMLHelper($AppUI);
            $sub_htmlHelper->df .= ' ' . $AppUI->getPref('TIMEFORMAT');
            foreach ($file_versions as $file) {
                $sub_htmlHelper->stageRowData($file);
                if ($file['file_version_id'] == $latest_file['file_version_id']) {
                    foreach ($fieldList as $index => $column) {
                        $hidden_table .= $sub_htmlHelper->createCell($fieldList[$index], $file[$fieldList[$index]], $customLookups);
                    }
                    if ($canEdit && w2PgetConfig('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>';
        foreach ($fieldList as $index => $column) {
            $cell = $htmlHelper->createCell($fieldList[$index], $row[$fieldList[$index]], $customLookups);
            if ('file_version' == $fieldList[$index]) {
                $cell = str_replace('</td>', $version_link . '</td>', $cell);
            }
            $s .= $cell;
        }
        $s .= '<td>';
        $s .= '<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>';
        $s .= '<a href="javascript: void(0);" onclick="if (confirm(\'' . $AppUI->_('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 .= '</tr>';
        $s .= $hidden_table;
    }
    if (0 == count($files)) {
        $s .= '<tr><td colspan="' . (count($fieldNames) + 3) . '">' . $AppUI->_('No data available') . '</td></tr>';
    }
    return $s;
}
    die('You should not access this file directly.');
}
// @todo    remove database query
// retrieve any state parameters
if (isset($_GET['orderby'])) {
    $orderdir = $AppUI->getState('ForumVwOrderDir') ? $AppUI->getState('ForumVwOrderDir') == 'asc' ? 'desc' : 'asc' : 'desc';
    $AppUI->setState('ForumVwOrderBy', w2PgetParam($_GET, 'orderby', null));
    $AppUI->setState('ForumVwOrderDir', $orderdir);
}
$orderby = $AppUI->getState('ForumVwOrderBy') ? $AppUI->getState('ForumVwOrderBy') : 'latest_reply';
$orderdir = $AppUI->getState('ForumVwOrderDir') ? $AppUI->getState('ForumVwOrderDir') : 'desc';
$items = __extract_from_forums_view_topics($AppUI, $forum_id, $f, $orderby, $orderdir);
$crumbs = array();
$crumbs['?m=forums'] = 'forums list';
$module = new w2p_System_Module();
$fields = $module->loadSettings('forums', 'view_topics');
if (0 == count($fields)) {
    $fieldList = array('message_name', 'message_author', 'replies', 'latest_reply');
    $fieldNames = array('Topics', 'Author', 'Replies', 'Last Post');
    $module->storeSettings('forums', 'view_topics', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
?>
<br />
<?php 
echo $AppUI->getTheme()->styleRenderBoxTop();
?>
<form name="watcher" action="?m=forums&a=viewer&forum_id=<?php 
echo $forum_id;
?>
&f=<?php 
}
$orderby = $AppUI->getState('DeptProjIdxOrderBy') ? $AppUI->getState('DeptProjIdxOrderBy') : 'project_end_date';
$orderdir = $AppUI->getState('DeptProjIdxOrderDir') ? $AppUI->getState('DeptProjIdxOrderDir') : 'asc';
/*
 *  TODO:  This is a *nasty* *nasty* kludge that should be cleaned up.
 * Unfortunately due to the global variables from dotProject, we're stuck with
 * this mess for now.
 * 
 * May God have mercy on our souls for the atrocity we're about to commit.
 */
$tmpDepartments = $department;
$department = $dept_id;
$project = new CProject();
$projects = projects_list_data($user_id);
$department = $tmpDepartments;
$items = $projects;
$module = new w2p_System_Module();
$fields = $module->loadSettings('projects', 'department_view');
if (0 == count($fields)) {
    $fieldList = array('project_color_identifier', 'project_priority', 'project_name', 'company_name', 'project_start_date', 'project_duration', 'project_end_date', 'project_end_actual', 'task_log_problem', 'project_owner', 'project_task_count', 'project_status');
    $fieldNames = array('Color', 'P', 'Project Name', 'Company', 'Start', 'Duration', 'End', 'Actual', 'LP', 'Owner', 'Tasks', 'Status');
    $module->storeSettings('projects', 'department_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$pstatus = w2PgetSysVal('ProjectStatus');
$customLookups = array('project_status' => $pstatus);
$listHelper = new w2p_Output_ListTable($AppUI);
echo $listHelper->startTable();
echo $listHelper->buildHeader($fields, true, 'departments&a=view&dept_id=' . $dept_id);
echo $listHelper->buildRows($items, $customLookups);
echo $listHelper->endTable();
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $project_id;
$project = $obj;
include $AppUI->getTheme()->resolveTemplate('projects/view');
$module = new w2p_System_Module();
$fields = $module->loadSettings('projectdesigner', 'task_list_print');
if (0 == count($fields)) {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v3.0
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('task_name', 'task_percent_complete', 'task_owner', 'task_start_date', 'task_duration', 'task_end_date');
    $fieldNames = array('Task Name', 'Work', 'Owner', 'Start', 'Duration', 'Finish');
    $module->storeSettings('projectdesigner', 'task_list_print', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$taskobj = new CTask();
$taskTree = $taskobj->getTaskTree($project_id);
$listTable = new w2p_Output_HTML_TaskTable($AppUI);
echo $listTable->startTable();
echo $listTable->buildHeader($fields);
echo $listTable->buildRows($taskTree);
echo $listTable->endTable();
?>
<table class="tbl" cellspacing="1" cellpadding="2" border="0" width="100%">
    <tr>
        <td align="center">
            <?php 
echo $AppUI->_('UP') . "&nbsp;=&nbsp;" . $AppUI->_('User specific Task Priority');
?>
</td>
		</tr>
	</table>
	<?php 
echo $AppUI->getTheme()->styleRenderBoxBottom();
?>
</form>
<br />
<?php 
echo $AppUI->getTheme()->styleRenderBoxTop();
$fieldList = array();
$fieldNames = array();
$module = new w2p_System_Module();
$fields = $module->loadSettings('tasks', 'tasksperuser');
if (count($fields) > 0) {
    $fieldList = array_keys($fields);
    $fieldNames = array_values($fields);
} else {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v3.0
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('user task_priority', 'task_name', 'task_project', 'task_duration', 'task_start_date', 'task_end_date');
    $fieldNames = array('UP', 'Task', 'Project', 'Duration', 'Start Date', 'End Date');
    //$module->storeSettings('tasks', 'tasksperuser', $fieldList, $fieldNames);
}
if ($do_report) {
    // Let's figure out which users we have
    $user_list = $active_users;
    $ss = '\'' . $start_date->format(FMT_DATETIME_MYSQL) . '\'';
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $m, $project_id;
$task = new CTask();
$tasks = $task->loadAll('task_start_date, task_end_date', 'task_status = -1 AND task_project = ' . $project_id);
$module = new w2p_System_Module();
$fields = $module->loadSettings($m, 'tasklist');
if (0 == count($fields)) {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v3.0
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('task_percent_complete', 'task_priority', 'user_task_priority', 'task_name', 'task_owner', 'task_assignees', 'task_start_date', 'task_duration', 'task_end_date');
    $fieldNames = array('Percent', 'P', 'U', 'Task Name', 'Owner', 'Assignees', 'Start Date', 'Duration', 'Finish Date');
    $module->storeSettings($m, 'tasklist', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$fieldList = array_keys($fields);
$fieldNames = array_values($fields);
$listTable = new w2p_Output_HTML_TaskTable($AppUI, $task);
$listTable->setFilters($f, $user_id);
$listTable->df .= ' ' . $AppUI->getPref('TIMEFORMAT');
$listTable->addBefore('edit', 'task_id');
$listTable->addBefore('pin', 'task_id');
$listTable->addBefore('log', 'task_id');
echo $listTable->startTable();
echo $listTable->buildHeader($fields, false, $m);
echo $listTable->buildRows($tasks, $customLookups);
echo $listTable->endTable();
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $company, $tab;
$sort = w2PgetParam($_GET, 'sort', 'project_name');
if ($sort == 'project_priority') {
    $sort .= ' DESC';
}
$items = $company->projects($AppUI, $company->company_id, !$tab, $sort);
$module = new w2p_System_Module();
$fields = $module->loadSettings('projects', 'company_view');
if (0 == count($fields)) {
    $fieldList = array('project_priority', 'project_name', 'user_username', 'project_start_date', 'project_status', 'project_target_budget');
    $fieldNames = array('P', 'Name', 'Owner', 'Started', 'Status', 'Budget');
    $module->storeSettings('projects', 'company_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
?>
<a name="projects-company_view"> </a>
<?php 
$pstatus = w2PgetSysVal('ProjectStatus');
$countries = w2PgetSysVal('GlobalCountries');
$company_types = w2PgetSysVal('CompanyType');
$customLookups = array('project_status' => $pstatus, 'company_type' => $company_types, 'company_country' => $countries);
include $AppUI->getTheme()->resolveTemplate('companies/vw_projects');
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
global $AppUI, $project;
$items = $project->getForumList();
$module = new w2p_System_Module();
$fields = $module->loadSettings('forums', 'projects_view');
if (0 == count($fields)) {
    $fieldList = array('forum_name', 'forum_description', 'forum_owner', 'forum_last_date');
    $fieldNames = array('Forum Name', 'Description', 'Owner', 'Last Post Info');
    $module->storeSettings('forums', 'projects_view', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
?>
<a name="forums-projects_view"> </a> <?php 
$listTable = new w2p_Output_ListTable($AppUI);
$listTable->df .= ' ' . $AppUI->getPref('TIMEFORMAT');
echo $listTable->startTable();
echo $listTable->buildHeader($fields);
echo $listTable->buildRows($items);
echo $listTable->endTable();
}
// @todo    convert to template
// Grab a list of the other resources, determine how they are allocated,
// and if there is a clash between this and other tasks.
global $AppUI, $task_id, $obj;
$resource = new CResource();
$resources = $resource->getResourcesByTask($task_id);
// Determine any other clashes.
$resource_tasks = array();
if (count($resources)) {
    $resource_tasks = $resource->getTasksByResources($resources, $obj->task_start_date, $obj->task_end_date);
}
$fieldList = array();
$fieldNames = array();
$module = new w2p_System_Module();
$fields = $module->loadSettings('resources', 'task_view');
if (count($fields) > 0) {
    $fieldList = array_keys($fields);
    $fieldNames = array_values($fields);
} else {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v3.0
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('resource_type', 'resource_name', 'percent_allocated');
    $fieldNames = array('Resource Type', 'Resource', 'Allocation');
    $module->storeSettings('resources', 'task_view', $fieldList, $fieldNames);
}
?>
<table class="tbl list">
    <tr>
        <?php