// 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', 'own' => 'Events I Created', 'all' => 'All Events'); // setup the title block $titleBlock = new w2p_Theme_TitleBlock('Yearly 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->addCell('<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="pickCompany" accept-charset="utf-8">' . arraySelect($companies, 'company_id', 'onChange="document.pickCompany.submit()" class="text"', $company_id) . '</form>'); $titleBlock->addCell($AppUI->_('Company') . ':'); $titleBlock->addCell(arraySelect($event_filter_list, 'event_filter', 'onChange="document.pickFilter.submit()" class="text"', $event_filter, true), '', '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="pickFilter" accept-charset="utf-8">', '</form>'); $titleBlock->addCell($AppUI->_('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; } function clickWeek( uts, fdate ) { window.location = './index.php?m=events&a=week_view&date='+uts; } </script> <?php // establish the focus 'date' if (!$date) {
$orderby = $AppUI->getState('UserIdxOrderby') ? $AppUI->getState('UserIdxOrderby') : 'user_username'; $orderby = $tab == 3 || $orderby != 'date_time_in' && $orderby != 'user_ip' ? $orderby : 'user_username'; // Pull First Letters $letters = CUser::getFirstLetters(); $letters = $letters . CContact::getFirstLetters($AppUI->user_id, true); $a2z = '<a href="./index.php?m=users&stub=0">' . $AppUI->_('All') . '</a> '; for ($c = 65; $c < 91; $c++) { $cu = chr($c); $cell = !(mb_strpos($letters, $cu) === false) ? '<a href="?m=users&stub=' . $cu . '">' . $cu . '</a>' : '<font color="#999999">' . $cu . '</font>'; $a2z .= $cell . ' '; } // setup the title block $titleBlock = new w2p_Theme_TitleBlock('User Management', 'icon.png', $m); $titleBlock->addSearchCell($where); $titleBlock->addCell($a2z); $titleBlock->addButton('New user', '?m=users&a=addedit'); $titleBlock->show(); ?> <script language="javascript" type="text/javascript"> <?php // security improvement: // some javascript functions may not appear on client side in case of user not having write permissions // else users would be able to arbitrarily run 'bad' functions if ($canDelete) { ?> function delMe( x, y ) { if (confirm( "<?php echo $AppUI->_('doDelete', UI_OUTPUT_JS) . ' ' . $AppUI->_('User', UI_OUTPUT_JS); ?> " + y + "?" )) { document.frmDelete.user_id.value = x;
<?php if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } $tab = $AppUI->processIntState('ResourceTypeTab', $_GET, 'tab', 0); $obj = new CResource(); $perms =& $AppUI->acl(); $canEdit = canEdit('resources'); $titleBlock = new w2p_Theme_TitleBlock('Resources', 'icon.png', $m); if ($canEdit) { $titleBlock->addButton('new resource', '?m=resources&a=addedit'); } $titleBlock->show(); $resource_types = w2PgetSysVal('ResourceTypes'); $tabBox = new CTabBox('?m=resources', W2P_BASE_DIR . '/modules/resources/', $tab); if ($tabBox->isTabbed()) { array_unshift($resource_types, $AppUI->_('All Resources', UI_OUTPUT_RAW)); } foreach ($resource_types as $resource_type) { $tabBox->add('vw_resources', $resource_type); } $tabBox->show();
$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); $counts = $project->getProjectsByStatus($company_id); $counts[-2] = count($project->loadAll(null, $company_id > 0 ? 'project_company = ' . $company_id : '')); $counts[-1] = count($project->loadAll(null, 'project_active = 1' . ($company_id > 0 ? ' AND project_company = ' . $company_id : ''))); $counts[count($project_statuses) - 3] = $counts[-2] - $counts[-1];
$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'); $titleBlock->addButton('new file', '?m=files&a=addedit&folder=' . $folder); } $titleBlock->show(); $file_types = w2PgetSysVal('FileType'); if ($tab != -1) { array_unshift($file_types, 'All Files'); } $tabBox = new CTabBox('?m=files', W2P_BASE_DIR . '/modules/files/', $tab); $i = -1; foreach ($file_types as $file_type) { $fileList = CFile::getFileList($AppUI, $company_id, $project_id, $task_id, $i); $tabBox->add('index_table', $file_type . ' (' . count($fileList) . ')'); ++$i; } $tabBox->add('folders_table', 'Folder Explorer');
$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();
die('You should not access this file directly.'); } $tab = $AppUI->processIntState('ContactsIdxTab', $_GET, 'tab', 0); $searchString = w2PgetParam($_POST, 'search_string', ''); $contact = new CContact(); $canCreate = $contact->canCreate(); $canAccess = $contact->canAccess(); if (!$canAccess) { $AppUI->redirect(ACCESS_DENIED); } $titleBlock = new w2p_Theme_TitleBlock('Contacts', 'icon.png', $m); $titleBlock->addCell('<a href="./index.php?m=contacts&tab=0">' . $AppUI->_('Reset search') . '</a>'); $titleBlock->addCell('<form action="index.php?m=contacts&tab=27" method="post" accept-charset="utf-8" name="searchform">' . '<input type="text" class="text" name="search_string" value="' . $searchString . '" /></form>'); $titleBlock->addCell($AppUI->_('Search') . ':'); if ($canCreate) { $titleBlock->addButton('New contact', '?m=contacts&a=addedit'); $titleBlock->addCrumb('?m=contacts&a=csvexport&suppressHeaders=1', 'CSV Download'); $titleBlock->addCrumb('?m=contacts&a=vcardimport&dialog=0', 'Import vCard'); } $titleBlock->show(); $tabBox = new CTabBox('?m=contacts', W2P_BASE_DIR . '/modules/contacts/', $tab); $tabBox->add('vw_idx_contacts', $AppUI->_('Recently Updated')); for ($c = 65; $c < 91; $c++) { $tabBox->add('vw_idx_contacts', $AppUI->_(chr($c))); } $tabBox->add('vw_idx_contacts', $AppUI->_('All Contacts')); $tabBox->show(); // TODO: Check to see that the Edit function is separated. ?> <script language="javascript" type="text/javascript"> // Callback function for the generic selector
$AppUI->redirect(ACCESS_DENIED); } // get critical tasks (criteria: task_end_date) $criticalTasks = $project_id > 0 ? $project->getCriticalTasks($project_id) : null; // create Date objects from the datetime fields $end_date = intval($project->project_end_date) ? new w2p_Utilities_Date($project->project_end_date) : null; $actual_end_date = null; if (isset($criticalTasks)) { $actual_end_date = intval($criticalTasks[0]['task_end_date']) ? new w2p_Utilities_Date($criticalTasks[0]['task_end_date']) : null; } $style = $actual_end_date > $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : ''; // setup the title block $titleBlock = new w2p_Theme_TitleBlock('View Project', 'icon.png', $m); $titleBlock->addCrumb('?m=' . $m, $m . ' list'); if ($canEdit) { $titleBlock->addButton('new link', '?m=links&a=addedit&project_id=' . $project_id); $titleBlock->addButton('new event', '?m=events&a=addedit&project_id=' . $project_id); $titleBlock->addButton('new file', '?m=files&a=addedit&project_id=' . $project_id); $titleBlock->addCrumb('?m=projects&a=addedit&project_id=' . $project_id, 'edit this project'); if ($canDelete) { $titleBlock->addCrumbDelete('delete project', $canDelete); } } if (canAdd('tasks')) { $titleBlock->addButton('new task', '?m=tasks&a=addedit&task_project=' . $project_id); } $titleBlock->show(); $view = new w2p_Controllers_View($AppUI, $project, 'Project'); echo $view->renderDelete(); ?> <script language="javascript" type="text/javascript">
$department_id = (int) w2PgetParam($_GET, 'department_id', 0); $dept_id = max($dept_id, $department_id); $tab = $AppUI->processIntState('DeptVwTab', $_GET, 'tab', 0); $department = new CDepartment(); if (!$department->load($dept_id)) { $AppUI->redirect(ACCESS_DENIED); } $canEdit = $department->canEdit(); $canDelete = $department->canDelete(); $titleBlock = new w2p_Theme_TitleBlock('View Department', 'icon.png', $m); $titleBlock->addCrumb('?m=companies', 'company list'); $titleBlock->addCrumb('?m=companies&a=view&company_id=' . $department->dept_company, 'view this company'); $titleBlock->addCrumb('?m=' . $m, $m . ' list'); if ($canEdit) { $titleBlock->addCell(); $titleBlock->addButton('New department', '?m=departments&a=addedit&company_id=' . $department->dept_company . '&dept_parent=' . $dept_id); $titleBlock->addCrumb('?m=departments&a=addedit&dept_id=' . $dept_id, 'edit this department'); if ($canDelete) { $titleBlock->addCrumbDelete('delete department', $canDelete, $msg); } } $titleBlock->show(); $view = new w2p_Controllers_View($AppUI, $department, 'Department'); $view->setDoSQL('do_dept_aed'); $view->addField('dept_company', $department->dept_company); $view->setKey('dept_id'); echo $view->renderDelete(); $types = w2PgetSysVal('DepartmentType'); include $AppUI->getTheme()->resolveTemplate('departments/view'); // tabbed information boxes $tabBox = new CTabBox('?m=departments&a=' . $a . '&dept_id=' . $dept_id, '', $tab);
*/ $reminded = (int) w2PgetParam($_GET, 'reminded', 0); if ($reminded) { $obj->clearReminder(); } //check permissions for the associated project $canReadProject = canView('projects', $obj->task_project); $users = $obj->assignees($task_id); // setup the title block $titleBlock = new w2p_Theme_TitleBlock('View Task', 'icon.png', $m); $titleBlock->addCell(); if ($canReadProject) { $titleBlock->addCrumb('?m=projects&a=view&project_id=' . $obj->task_project, 'view this project'); } if ($canEdit) { $titleBlock->addButton('new log', '?m=tasks&a=view&task_id=' . $task_id . '&tab=1'); $titleBlock->addButton('new link', '?m=links&a=addedit&task_id=' . $task_id . '&project_id=' . $obj->task_project); $titleBlock->addButton('new file', '?m=files&a=addedit&project_id=' . $obj->task_project . '&file_task=' . $obj->task_id); $titleBlock->addButton('new task', '?m=tasks&a=addedit&task_project=' . $obj->task_project . '&task_parent=' . $task_id); if (!$obj->task_represents_project) { $titleBlock->addCrumb('?m=tasks&a=addedit&task_id=' . $task_id, 'edit this task'); } } if ($obj->task_represents_project) { $titleBlock->addCrumb('?m=projects&a=view&project_id=' . $obj->task_represents_project, 'view subproject'); } if ($canDelete) { $titleBlock->addCrumbDelete('delete task', $canDelete, $msg); } $titleBlock->show(); $view = new w2p_Controllers_View($AppUI, $obj, 'Task');
} $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'); $module->storeSettings('forums', 'index_list', $fieldList, $fieldNames); $fields = array_combine($fieldList, $fieldNames);
$tab = $AppUI->processIntState('CompVwTab', $_GET, 'tab', 0); $company = new CCompany(); if (!$company->load($company_id)) { $AppUI->redirect(ACCESS_DENIED); } $canEdit = $company->canEdit(); $canDelete = $company->canDelete(); $deletable = $canDelete; //TODO: this should be removed once the $deletable variable is removed $contact = new CContact(); $canCreateContacts = $contact->canCreate(); // setup the title block $titleBlock = new w2p_Theme_TitleBlock('View Company', 'icon.png', $m); $titleBlock->addCrumb('?m=' . $m, $m . ' list'); if ($canCreateContacts) { $titleBlock->addButton('New contact', '?m=contacts&a=addedit&company_id=' . $company_id); } if ($canEdit) { if ($AppUI->isActiveModule('departments')) { $titleBlock->addButton('New department', '?m=departments&a=addedit&company_id=' . $company_id); } $titleBlock->addButton('New project', '?m=projects&a=addedit&company_id=' . $company_id); $titleBlock->addCrumb('?m=companies&a=addedit&company_id=' . $company_id, 'edit this company'); if ($canDelete && $deletable) { $titleBlock->addCrumbDelete('delete company', $deletable, $msg); } } $titleBlock->show(); $view = new w2p_Controllers_View($AppUI, $company, 'Company'); echo $view->renderDelete(); $types = w2PgetSysVal('CompanyType');
$link = new CLink(); if (!$link->canAccess()) { $AppUI->redirect(ACCESS_DENIED); } $canCreate = $link->canCreate(); // get the list of visible companies $extra = array('from' => 'links', 'where' => 'projects.project_id = link_project'); $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_JS)), $projects); $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('Links', 'icon.png', $m); $titleBlock->addSearchCell($search_string); $titleBlock->addFilterCell('Filter', 'project_id', $projects, $project_id); if ($canCreate) { $titleBlock->addButton('New link', '?m=links&a=addedit'); } $titleBlock->show(); $linkTypes = w2PgetSysVal('LinkType'); $tabBox = new CTabBox('?m=links', W2P_BASE_DIR . '/modules/links/', $tab); if ($tabBox->isTabbed()) { array_unshift($linkTypes, $AppUI->_('All Links', UI_OUTPUT_RAW)); } foreach ($linkTypes as $link_type) { $tabBox->add('index_table', $link_type); } $showProject = true; $tabBox->show();