$AppUI->setState('CompIdxOrderDir', $orderdir); } $orderby = $AppUI->getState('CompIdxOrderBy') ? $AppUI->getState('CompIdxOrderBy') : 'company_name'; $orderdir = $AppUI->getState('CompIdxOrderDir') ? $AppUI->getState('CompIdxOrderDir') : 'asc'; $owner_filter_id = $AppUI->processIntState('owner_filter_id', $_POST, 'owner_filter_id', 0); $search_string = w2PgetParam($_POST, 'search_string', ''); $search_string = w2PformSafe($search_string, true); $company = new CCompany(); $canCreate = $company->canCreate(); $perms =& $AppUI->acl(); $baseArray = array(0 => $AppUI->_('All', UI_OUTPUT_RAW)); $allowedArray = $perms->getPermittedUsers('companies'); $owner_list = is_array($allowedArray) ? $baseArray + $allowedArray : $baseArray; // setup the title block $titleBlock = new w2p_Theme_TitleBlock('Companies', 'icon.png', $m); $titleBlock->addSearchCell($search_string); $titleBlock->addFilterCell('Owner', 'owner_filter_id', $owner_list, $owner_filter_id); if ($canCreate) { $titleBlock->addButton('new company', '?m=companies&a=addedit'); } $titleBlock->show(); // load the company types $companyTypes = w2PgetSysVal('CompanyType'); $tabBox = new CTabBox('?m=companies', W2P_BASE_DIR . '/modules/companies/', $tab); if ($tabBox->isTabbed()) { array_unshift($companyTypes, $AppUI->_('All Companies', UI_OUTPUT_RAW)); } foreach ($companyTypes as $type_name) { $tabBox->add('vw_companies', $type_name); } $tabBox->show();
} } $AppUI->setState('ProjIdxOrderDir', $orderdir); // collect the full projects list data via function in projects.class.php $search_text = $search_string; // @note this is only because the projects_list_data function takes a bunch of globals //$projects = projects_list_data(); $oCompany = new CCompany(); $allowedCompanies[-1] = $AppUI->_('all'); $allowedCompanies += $oCompany->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name'); $project_types = array(-1 => '(' . $AppUI->_('all') . ')') + w2PgetSysVal('ProjectType'); $user_list = array(0 => '(' . $AppUI->_('all') . ')') + CProject::getOwners(); // setup the title block $titleBlock = new w2p_Theme_TitleBlock('Projects', 'icon.png', $m); //$titleBlock->addSearchCell($search_string); $titleBlock->addFilterCell('Type', 'project_type', $project_types, $project_type); $titleBlock->addFilterCell('Company', 'project_company', $allowedCompanies, $company_id); $titleBlock->addFilterCell('Owner', 'project_owner', $user_list, $owner); if ($canCreate) { $titleBlock->addButton('new project', '?m=projects&a=addedit'); } $titleBlock->addCell('<span title="' . $AppUI->_('Projects') . '::' . $AppUI->_('Print projects list') . '.">' . '<a href="javascript: void(0);" onclick ="window.open(\'index.php?m=projects&a=printprojects&dialog=1&suppressHeaders=1&company_id=' . $company_id . '&project_type=' . $project_type . '&project_owner=' . $owner . '\', \'printprojects\',\'width=1200, height=600, menubar=1, scrollbars=1\')"> <img src="' . w2PfindImage('printer.png') . '" /> </a></span>'); $titleBlock->show(); $project_statuses = array(); $project_statuses = w2PgetSysVal('ProjectStatus'); $project_statuses[-2] = 'All Projects'; $project_statuses[-1] = 'All Active'; $project_statuses[] = 'Archived'; ksort($project_statuses);
} } $folder = (int) w2PgetParam($_GET, 'folder', 0); // to pass to "new file" button // get the list of visible companies $extra = array('from' => 'files', 'where' => 'projects.project_id = file_project', 'join' => 'project_departments', 'on' => 'projects.project_id = project_departments.project_id'); //get "Allowed" projects for filter list ("All" is always allowed when basing permission on projects) $project = new CProject(); $projects = $project->getAllowedRecords($AppUI->user_id, 'projects.project_id,project_name', 'project_name', null, $extra, 'projects'); $projects = arrayMerge(array('0' => $AppUI->_('All', UI_OUTPUT_RAW)), $projects); // get SQL for allowed projects/tasks $task = new CTask(); $allowedTasks = $task->getAllowedSQL($AppUI->user_id, 'file_task'); // setup the title block $titleBlock = new w2p_Theme_TitleBlock('Files', 'icon.png', $m); $titleBlock->addFilterCell('Filter', 'project_id', $projects, $project_id); // override the $canEdit variable passed from the main index.php in order to check folder permissions /** get permitted folders **/ $cfObj = new CFile_Folder(); $allowed_folders_ary = $cfObj->getAllowedRecords($AppUI->user_id); $denied_folders_ary = $cfObj->getDeniedRecords($AppUI->user_id); $limited = count($allowed_folders_ary) < $cfObj->countFolders() ? true : false; if (!$limited) { $canEdit = true; } elseif ($limited and array_key_exists($folder, $allowed_folders_ary)) { $canEdit = true; } else { $canEdit = false; } if ($canEdit) { $titleBlock->addButton('new folder', '?m=files&a=addedit_folder');
// get CCompany() to filter tasks by company $obj = new CCompany(); $companies = $obj->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name'); $filters2 = arrayMerge(array('allcompanies' => $AppUI->_('All Companies', UI_OUTPUT_RAW)), $companies); $filters = array('my' => 'My Tasks', 'myunfinished' => 'My Unfinished Tasks', 'allunfinished' => 'All Unfinished Tasks', 'myproj' => 'My Projects', 'mycomp' => 'All Tasks for my Company', 'unassigned' => 'All Tasks (unassigned)', 'taskowned' => 'All Tasks That I Am Owner', 'taskcreated' => 'All Tasks I Have Created', 'all' => 'All Tasks', 'allfinished7days' => 'All Tasks Finished Last 7 Days', 'myfinished7days' => 'My Tasks Finished Last 7 Days'); $search_string = w2PgetParam($_POST, 'search_string', ''); $AppUI->setState($m . '_search_string', $search_string); $search_string = w2PformSafe($search_string, true); // setup the title block $titleBlock = new w2p_Theme_TitleBlock('Tasks', 'icon.png', $m); $titleBlock->addSearchCell($search_string); // Let's see if this user has admin privileges if (canView('users')) { $user_list = array(0 => ''); $user_list += $perms->getPermittedUsers('tasks'); $titleBlock->addFilterCell('User', 'user_id', $user_list, $user_id); } $titleBlock->addFilterCell('Company', 'f2', $filters2, $f2); if (w2PgetParam($_GET, 'inactive', '') == 'toggle') { $AppUI->setState('inactive', $AppUI->getState('inactive') == -1 ? 0 : -1); } $in = $AppUI->getState('inactive') == -1 ? '' : 'in'; $titleBlock->showhelp = false; $titleBlock->addCell('<form action="?m=tasks" method="post" name="taskFilter" accept-charset="utf-8">' . arraySelect($filters, 'f', 'size="1" class="text" onChange="document.taskFilter.submit();"', $f, true) . '</form>'); $titleBlock->addCell($AppUI->_('Task Filter') . ':'); $titleBlock->addCrumb('?m=tasks&a=todo&user_id=' . $user_id, 'my todo'); if (w2PgetParam($_GET, 'pinned') == 1) { $titleBlock->addCrumb('?m=tasks', 'all tasks'); } else { $titleBlock->addCrumb('?m=tasks&pinned=1', 'my pinned tasks'); }
$ctoday = new w2p_Utilities_Date(); $ctoday->convertTZ($AppUI->getPref('TIMEZONE')); $today = $ctoday->format(FMT_TIMESTAMP_DATE); $date = w2PgetParam($_GET, 'date', $today); // get the list of visible companies $company = new CCompany(); $companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name'); $companies = arrayMerge(array('0' => $AppUI->_('All')), $companies); $event_filter_list = array('my' => 'My Events for selected Company', 'own' => 'Events I Created', 'all' => 'All Events for selected Company'); // setup the title block $titleBlock = new w2p_Theme_TitleBlock('Monthly Calendar', 'icon.png', $m); $titleBlock->addCrumb('?m=events&a=year_view&date=' . $date, 'year view'); $titleBlock->addCrumb('?m=events&date=' . $date, 'month view'); $titleBlock->addCrumb('?m=events&a=week_view&date=' . $date, 'week view'); $titleBlock->addCrumb('?m=events&a=day_view&date=' . $date, 'day view'); $titleBlock->addFilterCell('Company', 'company_id', $companies, $company_id); $titleBlock->addFilterCell('Event Filter', 'event_filter', $event_filter_list, $event_filter); $titleBlock->addButton('New event', '?m=events&a=addedit&date=' . $today); $titleBlock->show(); ?> <script language="javascript" type="text/javascript"> function clickDay( uts, fdate ) { window.location = './index.php?m=events&a=day_view&date='+uts+'&tab=0'; } function clickWeek( uts, fdate ) { window.location = './index.php?m=events&a=week_view&date='+uts; } </script> <table cellspacing="0" cellpadding="0" border="0" width="100%" id="month-view"><tr><td>
$AppUI->setState('ForumIdxOrderBy', w2PgetParam($_GET, 'orderby', null)); $AppUI->setState('ForumIdxOrderDir', $orderdir); } $orderby = $AppUI->getState('ForumIdxOrderBy') ? $AppUI->getState('ForumIdxOrderBy') : 'forum_name'; $orderdir = $AppUI->getState('ForumIdxOrderDir') ? $AppUI->getState('ForumIdxOrderDir') : 'asc'; $f = w2PgetParam($_REQUEST, 'f', 0); $items = $forum->getAllowedForums($AppUI->user_id, $AppUI->user_company, $f, $orderby, $orderdir); $filters = array('- Filters -'); if (isset($a) && $a == 'viewer') { array_push($filters, 'My Watched', 'Last 30 days'); } else { array_push($filters, 'My Forums', 'My Watched', 'My Projects', 'My Company', 'Inactive Projects'); } // 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');
<?php if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } $filter_param = w2PgetParam($_REQUEST, 'filter', ''); $options = array(); $options[-1] = $AppUI->_('Show all'); $options = $options + $AppUI->getActiveModules(); $options['login'] = $AppUI->_('Login/Logouts'); /* * This validates that anything provided via the filter_param is definitely an * active module and not some other crazy garbage. */ if (!isset($options[$filter_param])) { $filter_param = 'projects'; } $titleBlock = new w2p_Theme_TitleBlock('History', 'icon.png', $m); $titleBlock->addFilterCell('Changes to', 'filter', $options, $filter_param); $titleBlock->show(); $tabBox = new CTabBox('?m=history', W2P_BASE_DIR . '/modules/history/'); $tabBox->add('index_table', $AppUI->_('History')); $tabBox->show();