Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * function to display the selected backend page
- * @author MD
- * @date 2017-12-06
- * @param array $data
- * @param Multi_Lang|null $class_multi_lang
- * @return bool|string
- */
- public function showSection($data, Multi_Lang $class_multi_lang = null)
- {
- if(!array_key_exists('section', $data) || !array_key_exists($data['section'], $this->section_mapping))
- {
- return false;
- }
- if(is_null($class_multi_lang))
- {
- $class_multi_lang = new Multi_Lang('backend', $_SESSION['admin_lang'], true);
- }
- $this->class_multi_lang = $class_multi_lang;
- $section_info = $this->section_mapping[$data['section']];
- if(!empty($section_info['class']))
- {
- $section_object = new $section_info['class']($class_multi_lang, $this->shop_settings);
- }
- else
- {
- $section_object = $this;
- }
- if(is_object($section_object))
- {
- $base_function = $section_info['function'];
- if(!empty($data['action']) && isset($section_info['actions'][$data['action']]))
- {
- $base_function = $section_info['actions'][$data['action']];
- }
- if(is_callable(array($section_object, $base_function)))
- {
- if(count($data) == 3) // with the parameters it is the default call so only transmit the id
- {
- $response = $section_object->$base_function($data['id']);
- }
- else
- {
- //first make a copy of the complete data then remove the section and action so only the needed data remains
- $function_data = $data;
- unset($function_data['section']);
- unset($function_data['action']);
- $response = $section_object->$base_function($function_data);
- }
- if($response['status'])
- {
- $wiki_section = $this->wikiReplaces($section_info['wiki'][$_SESSION['admin_lang']]);
- $response['js_files'] = $section_info['js_files'];
- $response['css_files'] = $section_info['css_files'];
- $response['help_section'] = $section_info['handbook'][$_SESSION['admin_lang']];
- $response['help_text'] = $this->getHelpText($wiki_section, $_SESSION['admin_lang'], $this->shop_settings['shop_id']);
- }
- return $response;
- }
- else
- {
- return 'Error function does not exist or is not callable';
- }
- }
- else
- {
- return 'Error while loading module';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement