grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026focus = $focus; $this->module = $module; $this->type = $type; $this->build(); } /** * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead */ public function ListViewFacade($focus, $module, $type = 0) { $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; if (isset($GLOBALS['log'])) { $GLOBALS['log']->deprecated($deprecatedMessage); } else { trigger_error($deprecatedMessage, E_USER_DEPRECATED); } self::__construct($focus, $module, $type); } /** * Retrieves display columns on list view of specified module * * @param string $module * @param array $request * @return array */ public static function getDisplayColumns($module, $request = []) { $metadataFile = null; $foundViewDefs = false; if (file_exists('custom/modules/' . $module. '/metadata/listviewdefs.php')) { $metadataFile = 'custom/modules/' . $module . '/metadata/listviewdefs.php'; $foundViewDefs = true; } else { if (file_exists('custom/modules/'. $module.'/metadata/metafiles.php')) { require_once('custom/modules/'. $module.'/metadata/metafiles.php'); if (!empty($metafiles[$module]['listviewdefs'])) { $metadataFile = $metafiles[$module]['listviewdefs']; $foundViewDefs = true; } } elseif (file_exists('modules/'. $module.'/metadata/metafiles.php')) { require_once('modules/'. $module.'/metadata/metafiles.php'); if (!empty($metafiles[$module]['listviewdefs'])) { $metadataFile = $metafiles[$module]['listviewdefs']; $foundViewDefs = true; } } } if (!$foundViewDefs && file_exists('modules/'. $module.'/metadata/listviewdefs.php')) { $metadataFile = 'modules/'. $module.'/metadata/listviewdefs.php'; } if ($metadataFile) { if (!file_exists($metadataFile)) { throw new Exception("Metadata file '$metadataFile' not found for module '$module'."); } require_once($metadataFile); } $displayColumns = array(); if (!empty($listViewDefs)) { if (!empty($request['displayColumns'])) { foreach (explode('|', $_REQUEST['displayColumns']) as $num => $col) { if (!empty($listViewDefs[$module][$col])) { $displayColumns[$col] = $listViewDefs[$module][$col]; } } } else { foreach ($listViewDefs[$module] as $col => $params) { if (!empty($params['default']) && $params['default']) { $displayColumns[$col] = $params; } } } } else { throw new Exception("List view definition is not found for module '$module'"); } return $displayColumns; } public function build() { //we will assume that if the ListView.html file exists we will want to use that one if (file_exists('modules/'.$this->module.'/ListView.html')) { $this->type = 1; $this->lv = new ListView(); $this->template = 'modules/'.$this->module.'/ListView.html'; } else { $this->lv = new ListViewSmarty(); $this->lv->displayColumns = self::getDisplayColumns($this->module, $_REQUEST); $this->type = 2; $this->template = 'include/ListView/ListViewGeneric.tpl'; } } public function setup($template = '', $where = '', $params = array(), $mod_strings = array(), $offset = 0, $limit = -1, $orderBy = '', $prefix = '', $filter_fields = array(), $id_field = 'id') { if (!empty($template)) { $this->template = $template; } $this->mod_strings = $mod_strings; if ($this->type == 1) { $this->lv->initNewXTemplate($this->template, $this->mod_strings); $this->prefix = $prefix; $this->lv->setQuery($where, $limit, $orderBy, $prefix); $this->lv->show_select_menu = false; $this->lv->show_export_button = false; $this->lv->show_delete_button = false; $this->lv->show_mass_update = false; $this->lv->show_mass_update_form = false; } else { $this->lv->export = false; $this->lv->delete = false; $this->lv->select = false; $this->lv->mailMerge = false; $this->lv->multiSelect = false; $this->lv->setup($this->focus, $this->template, $where, $params, $offset, $limit, $filter_fields, $id_field); } } public function display($title = '', $section = 'main', $return = false) { if ($this->type == 1) { ob_start(); $this->lv->setHeaderTitle($title); $this->lv->processListView($this->focus, $section, $this->prefix); $output = ob_get_contents(); ob_end_clean(); } else { $output = get_form_header($title, '', false) . $this->lv->display(); } if ($return) { return $output; } else { echo $output; } } public function setTitle($title = '') { $this->title = $title; } }