function select_locations($selected, $name = 'locations') { $sel = new SelectItem($name); list($list, $values) = getEntitiesSelectableElements(); $sel->setElements($list); $sel->setElementsVal($values); $sel->setSelected($selected); return $sel; }
/* * $_SESSION['report_files'] * Used to store datas for PDF/XLS reports * $_SESSION['report_files'][mmc_plugin_name][report_name] */ if (!isset($_SESSION['report_files'])) { $_SESSION['report_files'] = array(); } // first step, display selectors if (!array_intersect_key($_POST, array('generate_report' => '', 'get_xls' => '', 'get_pdf' => ''))) { $f->push(new Table()); /* Period */ $f->add(new TrFormElement(_T('Period', 'report'), new periodInputTpl(_T('from', 'report'), 'period_from', _T('to', 'report'), 'period_to')), array("value" => $values, "required" => True)); /* Entities */ $entities = new SelectMultiTpl('entities[]'); list($list, $values) = getEntitiesSelectableElements(); $entities->setElements($list); $entities->setElementsVal($values); if (count($list) > 15) { $entities->setHeight(15); } else { $entities->setFullHeight(); } $f->add(new TrFormElement(_T('Entities', 'report'), $entities), array("required" => true)); /* Modules indicators */ foreach ($report as $module_name => $sections) { $moduleObj = $MMCApp->getModule($module_name); if ($moduleObj) { $f->add(new TrFormElement($moduleObj->getDescription(), new ReportModule($module_name, $sections)), array()); } }