<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
// @todo    remove database query
global $AppUI, $users, $task_id, $task_project, $obj;
global $projTasksWithEndDates, $tab, $loadFromTab;
// Need to get all of the resources that this user is allowed to view
$resource = new CResource();
$resources = $resource->loadAll();
$resource_types = w2PgetSysVal('ResourceTypes');
$all_resources = array();
foreach ($resources as $row) {
    $all_resources[$row['resource_id']] = $resource_types[$row['resource_type']] . ': ' . $row['resource_name'];
}
$assigned_resources = array();
$initResAssignment = '';
$resources = array();
if ($loadFromTab && isset($_SESSION['tasks_subform']['hresource_assign'])) {
    $initResAssignment = '';
    foreach (explode(';', $_SESSION['tasks_subform']['hresource_assign']) as $perc) {
        if ($perc) {
            list($rid, $perc) = explode('=', $perc);
            $assigned_resources[$rid] = $perc;
            $initResAssignment .= $rid . '=' . $perc . ';';
            $resources[$rid] = $all_resources[$rid] . ' [' . $perc . '%]';
        }
    }
} elseif ($task_id == 0) {
Пример #2
0
<?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();