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;
 }
Exemple #2
0
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    remove database query
$perms =& $AppUI->acl();
if (!canEdit('system')) {
    $AppUI->redirect(ACCESS_DENIED);
}
##
## Activate or move a module entry
##
$cmd = w2PgetParam($_GET, 'cmd', '0');
$mod_id = (int) w2PgetParam($_GET, 'mod_id', '0');
$mod_directory = w2PgetParam($_GET, 'mod_directory', '0');
$obj = new w2p_System_Module();
if ($mod_id) {
    $obj->load($mod_id);
} else {
    $obj->mod_directory = $mod_directory;
}
//check for a setup file
$ok = file_exists(W2P_BASE_DIR . '/modules/' . $obj->mod_directory . '/setup.php');
if (!$ok && $obj->mod_type != 'core') {
    $AppUI->setMsg('Module setup file could not be found', UI_MSG_ERROR);
    if ($cmd == 'remove') {
        $obj->remove();
        $AppUI->setMsg('Module has been removed from the modules list - please check your database for additional tables that may need to be removed', UI_MSG_ERROR);
    }
    $AppUI->redirect('m=system&u=modules');
}
    die('You should not access this file directly.');
}
// @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

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');
<?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 $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 
if (!defined('W2P_BASE_DIR')) {
    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;
?>
<?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();
$history = new CHistory();
$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);
<?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();
Exemple #11
0
		document.frmDelete2.submit();
	}
}
<?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">
<?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();
                <label for="show_empty_date"><?php 
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');
Exemple #15
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    remove database query
// check permissions
$perms =& $AppUI->acl();
$canEdit = canEdit('system');
$canRead = canView('system');
if (!$canRead) {
    $AppUI->redirect(ACCESS_DENIED);
}
$module = new w2p_System_Module();
$hidden_modules = array('public', 'install');
$modules = __extract_from_modules_index($hidden_modules);
// get the modules actually installed on the file system
$loader = new w2p_FileSystem_Loader();
$modFiles = $loader->readDirs('modules');
$titleBlock = new w2p_Theme_TitleBlock('Modules', 'power-management.png', $m);
$titleBlock->addCrumb('?m=system', 'System Admin');
$titleBlock->show();
$fieldList = array('mod_name', 'mod_active', 'mod_customize', 'mod_type', 'mod_version', 'mod_ui_name', 'mod_ui_icon', 'mod_ui_active', 'mod_ui_order');
$fieldNames = array('Module', 'Status', 'Customize', 'Type', 'Version', 'Menu Text', 'Menu Icon', 'Menu Status', 'Order');
$htmlHelper = new w2p_Output_HTMLHelper($AppUI);
?>

<table class="tbl list modules">
    <?php 
echo '<tr><th></th>';
foreach ($fieldNames as $index => $name) {
<?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();
function projects_list_data($user_id = false)
{
    global $AppUI, $addPwOiD, $buffer, $company, $company_id, $company_prefix, $deny, $department, $dept_ids, $orderby, $orderdir, $tasks_problems, $owner, $search_text, $project_type;
    $addProjectsWithAssignedTasks = $AppUI->getState('addProjWithTasks') ? $AppUI->getState('addProjWithTasks') : 0;
    // get any records denied from viewing
    $obj = new CProject();
    $deny = $obj->getDeniedRecords($AppUI->user_id);
    // Let's delete temproary tables
    $q = new w2p_Database_Query();
    $q->setDelete('tasks_problems');
    $q->exec();
    $q->clear();
    $q->setDelete('tasks_users');
    $q->exec();
    $q->clear();
    // support task problem logs
    $q->addInsertSelect('tasks_problems');
    $q->addTable('tasks');
    $q->addQuery('task_project, task_log_problem');
    $q->addJoin('task_log', 'tl', 'tl.task_log_task = task_id', 'inner');
    $q->addWhere('task_log_problem = 1');
    $q->addGroup('task_project');
    $tasks_problems = $q->exec();
    $q->clear();
    if ($addProjectsWithAssignedTasks) {
        // support users tasks
        $q->addInsertSelect('tasks_users');
        $q->addTable('tasks');
        $q->addQuery('task_project');
        $q->addQuery('ut.user_id');
        $q->addJoin('user_tasks', 'ut', 'ut.task_id = tasks.task_id');
        if ($user_id) {
            $q->addWhere('ut.user_id = ' . (int) $user_id);
        }
        $q->addOrder('task_end_date DESC');
        $q->addGroup('task_project');
        $q->exec();
        $q->clear();
    }
    // add Projects where the Project Owner is in the given department
    if ($addPwOiD && isset($department)) {
        $q->addTable('users');
        $q->addQuery('user_id');
        $q->addJoin('contacts', 'c', 'c.contact_id = user_contact', 'inner');
        $q->addWhere('c.contact_department = ' . (int) $department);
        $owner_ids = $q->loadColumn();
        $q->clear();
    }
    if (isset($department)) {
        //If a department is specified, we want to display projects from the department, and all departments under that, so we need to build that list of departments
        $dept_ids = array();
        $q->addTable('departments');
        $q->addQuery('dept_id, dept_parent');
        $q->addOrder('dept_parent,dept_name');
        $rows = $q->loadList();
        addDeptId($rows, $department);
        $dept_ids[] = isset($department->dept_id) ? $department->dept_id : 0;
        $dept_ids[] = $department > 0 ? $department : 0;
    }
    $q->clear();
    // retrieve list of records
    // modified for speed
    // by Pablo Roca (pabloroca@mvps.org)
    // 16 August 2003
    // get the list of permitted companies
    $obj = new CCompany();
    $companies = $obj->getAllowedRecords($AppUI->user_id, 'companies.company_id,companies.company_name', 'companies.company_name');
    if (count($companies) == 0) {
        $companies = array();
    }
    $q->addTable('projects', 'pr');
    $q->addQuery('pr.*, project_scheduled_hours as project_duration,
        project_actual_end_date as project_end_actual,
        company_id, company_name, project_last_task as critical_task,
        tp.task_log_problem, user_username, task_log_problem, u.user_id');
    $fields = w2p_System_Module::getSettings('projects', 'index_list');
    unset($fields['department_list']);
    // added as an alias below
    foreach ($fields as $field => $notUsed) {
        $q->addQuery($field);
    }
    $q->addQuery('ct.contact_display_name AS owner_name');
    $q->addJoin('companies', 'c', 'c.company_id = pr.project_company');
    $q->addJoin('users', 'u', 'pr.project_owner = u.user_id');
    $q->addJoin('contacts', 'ct', 'ct.contact_id = u.user_contact');
    $q->addJoin('tasks_problems', 'tp', 'pr.project_id = tp.task_project');
    if ($addProjectsWithAssignedTasks) {
        $q->addJoin('tasks_users', 'tu', 'pr.project_id = tu.task_project');
    }
    if (!isset($department) && $company_id > 0 && !$addPwOiD) {
        $q->addWhere('pr.project_company = ' . (int) $company_id);
    }
    if ($project_type > -1) {
        $q->addWhere('pr.project_type = ' . (int) $project_type);
    }
    if (isset($department) && !$addPwOiD) {
        $q->addWhere('project_departments.department_id in ( ' . implode(',', $dept_ids) . ' )');
    }
    if ($user_id && $addProjectsWithAssignedTasks) {
        $q->addWhere('(tu.user_id = ' . (int) $user_id . ' OR pr.project_owner = ' . (int) $user_id . ' )');
    } elseif ($user_id) {
        $q->addWhere('pr.project_owner = ' . (int) $user_id);
    }
    if ($owner > 0) {
        $q->addWhere('pr.project_owner = ' . (int) $owner);
    }
    if (mb_trim($search_text)) {
        $q->addWhere('pr.project_name LIKE \'%' . $search_text . '%\' OR pr.project_description LIKE \'%' . $search_text . '%\'');
    }
    // Show Projects where the Project Owner is in the given department
    if ($addPwOiD && !empty($owner_ids)) {
        $q->addWhere('pr.project_owner IN (' . implode(',', $owner_ids) . ')');
    }
    $orderby = 'project_company' == $orderby ? 'company_name' : $orderby;
    $q->addGroup('pr.project_id');
    $q->addOrder($orderby . ' ' . $orderdir);
    $prj = new CProject();
    $q = $prj->setAllowedSQL($AppUI->user_id, $q, null, 'pr');
    $dpt = new CDepartment();
    $projects = $q->loadList();
    // get the list of permitted companies
    $companies = arrayMerge(array('0' => $AppUI->_('All')), $companies);
    $company_array = $companies;
    //get list of all departments, filtered by the list of permitted companies.
    $q->clear();
    $q->addTable('companies');
    $q->addQuery('company_id, company_name, dep.*');
    $q->addJoin('departments', 'dep', 'companies.company_id = dep.dept_company');
    $q->addOrder('company_name,dept_parent,dept_name');
    $q = $obj->setAllowedSQL($AppUI->user_id, $q);
    $q = $dpt->setAllowedSQL($AppUI->user_id, $q);
    $rows = $q->loadList();
    //display the select list
    $buffer = '<select name="department" id="department" onChange="document.pickCompany.submit()" class="text" style="width: 200px;">';
    $company = '';
    foreach ($company_array as $key => $c_name) {
        $buffer .= '<option value="' . $company_prefix . $key . '" style="font-weight:bold;"' . ($company_id == $key ? 'selected="selected"' : '') . '>' . $c_name . '</option>' . "\n";
        foreach ($rows as $row) {
            if ($row['dept_parent'] == 0) {
                if ($key == $row['company_id']) {
                    if ($row['dept_parent'] != null) {
                        findchilddept($rows, $row['dept_id']);
                    }
                }
            }
        }
    }
    $buffer .= '</select>';
    return $projects;
}
Exemple #18
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();
			<td colspan="5" align="left" nowrap="nowrap"><?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;
 public function __construct()
 {
     parent::__construct();
     trigger_error(get_class($this) . " has been deprecated in v3.1 and will be removed by v4.0. Please use " . get_parent_class($this) . " instead.", E_USER_NOTICE);
 }
<?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];
         $row['task_duration'] = floor($row['task_duration']) . ':' . round(60 * ($row['task_duration'] - floor($row['task_duration'])));
     }
     //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">
Exemple #23
0
$module_id = (int) w2PgetParam($_GET, 'module', 0);
// check permissions
$perms = $AppUI->acl();
if (!canEdit('system')) {
    $AppUI->redirect(ACCESS_DENIED);
}
// load the record data
$field = new w2p_Core_CustomFieldManager();
$obj = $AppUI->restoreObject();
if ($obj) {
    $field = $obj;
    $field_id = $field->field_id;
} else {
    $field->load($field_id);
}
$module = new w2p_System_Module();
$module->load($module_id);
$ttl = $field_id ? 'Edit Custom Fields' : 'Add Custom Fields';
$ttl = $AppUI->_($ttl) . ' - ' . $AppUI->_($module->mod_name) . ' ' . $AppUI->_('Module');
$titleBlock = new w2p_Theme_TitleBlock($ttl, 'customfields.png', $m);
$titleBlock->addCrumb('?m=system', 'system admin');
$titleBlock->addCrumb('?m=system&u=customfields', 'custom fields');
$titleBlock->show();
$html_types = $field->getTypes();
$custom_fields = new w2p_Core_CustomFields($module->mod_name, 'addedit', null, 'edit');
if ($field_id) {
    $cf = $custom_fields->fieldWithId($field_id);
    if (is_object($cf)) {
        $field_name = $cf->fieldName();
        $field_description = $cf->fieldDescription();
        $field_htmltype = $cf->fieldHtmlType();
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$perms =& $AppUI->acl();
if (!canEdit('system')) {
    $AppUI->redirect(ACCESS_DENIED);
}
if (isset($_FILES['module_upload'])) {
    $upload = $_FILES['module_upload'];
    $module = new w2p_System_Module();
    $result = $module->deploy($upload);
    if (is_array($result)) {
        $AppUI->setMsg($result, UI_MSG_ERROR, true);
    } else {
        $AppUI->setMsg($AppUI->_('This module was expanded successfully.'), UI_MSG_OK, true);
    }
}
$AppUI->redirect('m=system&u=modules');
<?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, $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();
Exemple #27
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
// @todo    remove database query
global $AppUI, $m;
$display_last_login = !(int) w2PgetParam($_REQUEST, 'tab', 0);
$fieldList = array();
$fieldNames = array();
$fields = w2p_System_Module::getSettings('users', 'index_table');
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('contact_display_name', 'user_username', 'company_name', 'dept_name');
    $fieldNames = array('Real Name', 'Login Name', 'Company', 'Department');
    //TODO: This doesn't save the columns yet as we can't allow customization yet.
}
if ($display_last_login) {
    array_unshift($fieldList, '');
    array_unshift($fieldNames, 'Login History');
}
$fields = array_combine($fieldList, $fieldNames);
$listTable = new w2p_Output_ListTable($AppUI);
echo $listTable->startTable();
$listTable->addBefore(1);