public function loadExtras(array &$storage, w2p_Core_CAppUI $AppUI, $m, $type = 'tabs') { //Set up extra $type if (!isset($storage['all_' . $type][$m])) { // For some reason on some systems if you don't set this up // first you get recursive pointers to the all_$type array, creating // phantom tabs. if (!isset($storage['all_' . $type])) { $storage['all_' . $type] = array(); } $storage['all_' . $type][$m] = array(); $all_items =& $storage['all_' . $type][$m]; foreach ($AppUI->getActiveModules() as $dir => $notUsed) { if (!canAccess($dir)) { continue; } $loader = new w2p_FileSystem_Loader(); $modules_items = $loader->readFiles(W2P_BASE_DIR . '/modules/' . $dir . '/', '^' . $m . '_' . substr($type, 0, -1) . '.*\\.php'); foreach ($modules_items as $item) { // Get the name as the subextension // cut the module_tab. and the .php parts of the filename // (begining and end) $nameparts = explode('.', $item); $filename = substr($item, 0, -4); if (count($nameparts) > 3) { $file = $nameparts[1]; if (!isset($all_items[$file])) { $all_items[$file] = array(); } $tabArray =& $all_items[$file]; $name = $nameparts[2]; } else { $tabArray =& $all_items; $name = $nameparts[1]; } $tabArray[] = array('name' => ucfirst(str_replace('_', ' ', $name)), 'file' => W2P_BASE_DIR . '/modules/' . $dir . '/' . $filename, 'module' => $dir); } } } else { $all_items =& $storage['all_' . $type][$m]; } }
/** @deprecated */ public function readFiles($path, $filter = '.') { trigger_error("AppUI->readFiles() has been deprecated in v3.0 and will be removed by v4.0. Please use w2p_FileSystem_Loader->readFiles() instead.", E_USER_NOTICE); $loader = new w2p_FileSystem_Loader(); return $loader->readFiles($path, $filter); }
<?php if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly'); } ob_start(); $AppUI->user_locale = '' == $AppUI->user_locale ? 'en' : $AppUI->user_locale; if (isset($perms)) { foreach ($AppUI->getActiveModules() as $dir => $module) { if (!canAccess($dir)) { continue; } $loader = new w2p_FileSystem_Loader(); $modules_tabs_crumbs = $loader->readFiles(W2P_BASE_DIR . '/modules/' . $dir . '/', '^' . $m . '_(tab|crumb).*\\.php'); if (count($modules_tabs_crumbs) > 0) { if (file_exists(W2P_BASE_DIR . '/modules/' . $dir . '/locales/' . $AppUI->user_locale . '/' . $dir . '.inc')) { readfile(W2P_BASE_DIR . '/modules/' . $dir . '/locales/' . $AppUI->user_locale . '/' . $dir . '.inc'); } elseif (file_exists(W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/' . $dir . '.inc')) { readfile(W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/' . $dir . '.inc'); } elseif (file_exists(W2P_BASE_DIR . '/modules/' . $dir . '/locales/' . $AppUI->user_locale . '.inc')) { readfile(W2P_BASE_DIR . '/modules/' . $dir . '/locales/' . $AppUI->user_locale . '.inc'); } } } } if (W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/common.inc') { readfile(W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/common.inc'); } /** * language files for specific locales and specific modules (for external modules) should be put in * modules/[the-module]/locales/[the-locale]/[the-module].inc or modules/[the-module]/locales/[the-locale].inc
} $project_list = array('0' => $AppUI->_('All', UI_OUTPUT_RAW)); $projectObj = new CProject(); $projectList = $projectObj->getAllowedProjects($AppUI->user_id, false); $company = new CCompany(); $companyList = $company->loadAll(); foreach ($projectList as $pr) { if ($pr['project_id'] == $project_id) { $display_project_name = '(' . $companyList[$pr['project_company']]['company_name'] . ') ' . $pr['project_name']; } $project_list[$pr['project_id']] = '(' . $companyList[$pr['project_company']]['company_name'] . ') ' . $pr['project_name']; } // get the prefered date format $df = $AppUI->getPref('SHDATEFORMAT'); $loader = new w2p_FileSystem_Loader(); $reports = $loader->readFiles(W2P_BASE_DIR . '/modules/reports/reports', '\\.php$'); // setup the title block if (!$suppressHeaders) { $titleBlock = new w2p_Theme_TitleBlock('Reports', 'icon.png', $m); $titleBlock->addCrumb('?m=projects', 'projects list'); if ($project_id) { $titleBlock->addCrumb('?m=projects&a=view&project_id=' . $project_id, 'view this project'); } if ($report_type) { $titleBlock->addCrumb('?m=reports&project_id=' . $project_id, 'reports index'); } $titleBlock->show(); } $report_type_var = w2PgetParam($_GET, 'report_type', ''); if (!empty($report_type_var)) { $report_type_var = '&report_type=' . $report_type;