/** * get the reports menu * * @param string $pid * @param string $famid * * @return WT_Menu the menu item */ public static function getReportsMenu($pid = '', $famid = '') { global $SEARCH_SPIDER; $active_reports = WT_Module::getActiveReports(); if ($SEARCH_SPIDER || !$active_reports) { return null; } $menu = new WT_Menu(WT_I18N::translate('Reports'), 'reportengine.php?ged=' . WT_GEDURL, 'menu-report'); foreach ($active_reports as $report) { foreach ($report->getReportMenus() as $submenu) { $menu->addSubmenu($submenu); } } return $menu; }
} break; default: break; } } } $vars = $newvars; unset($newvars); foreach ($varnames as $name) { if (!isset($vars[$name])) { $vars[$name]['id'] = ''; } } $reports = array(); foreach (WT_Module::getActiveReports() as $rep) { foreach ($rep->getReportMenus() as $menu) { if (preg_match('/report=(' . preg_quote(WT_MODULES_DIR, '/') . '[a-z0-9_]+\\/[a-z0-9_]+\\.xml)/', $menu->link, $match)) { $reports[$match[1]] = $menu->label; } } } if (!empty($report)) { if (!array_key_exists($report, $reports)) { $action = 'choose'; } } //-- choose a report to run if ($action == 'choose') { $controller->setPageTitle(WT_I18N::translate('Choose a report to run')); $controller->pageHeader();
// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', 'admin_module_reports.php'); require 'includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader(); $modules = WT_Module::getActiveReports(WT_GED_ID, WT_PRIV_HIDE); $action = WT_Filter::post('action'); if ($action == 'update_mods' && WT_Filter::checkCsrf()) { foreach ($modules as $module_name => $module) { foreach (WT_Tree::getAll() as $tree) { $value = WT_Filter::post("reportaccess-{$module_name}-{$tree->tree_id}", WT_REGEX_INTEGER, $module->defaultAccessLevel()); WT_DB::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'report', ?)")->execute(array($module_name, $tree->tree_id, $value)); } } } ?> <div id="reports" align="center"> <form method="post" action="<?php echo WT_SCRIPT_NAME; ?> ">