* @copyright 2012-2019 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class HelperModuleMEP { public static function addCSS($css_uri, $css_media_type = 'all', $offset = null, $check_path = true) { Context::getContext()->controller->addCSS( _MODULE_DIR_.ToolsModuleMEP::getModNameForPath(__FILE__) .'/views/css/'.$css_uri, $css_media_type, $offset, $check_path ); } public static function addJS($js_uri, $check_path = true) { Context::getContext()->controller->addJS( _MODULE_DIR_.ToolsModuleMEP::getModNameForPath(__FILE__) .'/views/js/'.$js_uri, $check_path ); } /** * @return string */ public static function getModuleTabAdminLink() { /** * @var $module Module */ $module = Module::getInstanceByName(ToolsModuleMEP::getModNameForPath(__FILE__)); return Context::getContext()->link->getAdminLink( 'AdminModules', true ).'&configure='.ToolsModuleMEP::getModNameForPath(__FILE__) .'&tab_module='.$module->name.'&tab_module='.$module->tab.'&module_name='.$module->name; } public static function createAjaxApiCall($class) { $method = Tools::getValue('method'); $call_method = 'ajaxProcess'.ToolsModuleMEP::toCamelCase($method, 1); if (method_exists($class, $call_method)) { try { $result = call_user_func(array($class, $call_method)); die(Tools::jsonEncode(array( 'hasError' => LoggerMEP::getInstance()->hasError(), 'result' => $result, 'log' => LoggerMEP::getInstance()->getMessages() ))); } catch (Exception $e) { LoggerMEP::getInstance()->exception($e); die(Tools::jsonEncode(array( 'hasError' => LoggerMEP::getInstance()->hasError(), 'log' => LoggerMEP::getInstance()->getMessages() ))); } } } }