public function __construct($type, $field, $condition, $argument = null) { $this->_argument = $argument; $this->type = $type; $this->registry = App::getRegistry(); if (is_object($condition) && is_subclass_of($condition, 'FormEngine\\Condition')) { $this->_condition = $condition; } else { $this->_srcFunction = $condition; $this->_id = self::$_nextId++; switch ($this->type) { case self::EXCHANGE_OPTIONS: $this->_jsFunction = 'GetOptions_' . $this->_id; $this->registry->xajax->registerFunction(array($this->_jsFunction, $this, 'doAjaxOptionsRequest_' . $this->_id)); break; case self::INVOKE_CUSTOM_FUNCTION: $this->_jsFunction = $condition; break; case self::SUGGEST: $this->_jsFunction = 'GetSuggestions_' . $this->_id; $this->registry->xajax->registerFunction(array($this->_jsFunction, $this, 'doAjaxSuggestionRequest_' . $this->_id)); } } $this->_field = $field; }
public function __construct($errorMsg, $checkFunctionCallback, $params = array()) { parent::__construct($errorMsg); $this->_checkFunction = $checkFunctionCallback; $this->_jsFunction = App::getRegistry()->xajaxInterface->registerFunction(array('CheckCustomRule_' . self::$_nextId++, $this, 'doAjaxCheck')); $this->_params = $params; }
public function __construct($attributes) { parent::__construct($attributes); $this->_attributes['load'] = App::getRegistry()->xajaxInterface->registerFunction(array('ProgressIndicator_OnLoad_' . $this->_id, $this->_attributes['load'][0], $this->_attributes['load'][1])); $this->_attributes['process'] = App::getRegistry()->xajaxInterface->registerFunction(array('ProgressIndicator_OnProcess_' . $this->_id, $this->_attributes['process'][0], $this->_attributes['process'][1])); $this->_attributes['success'] = App::getRegistry()->xajaxInterface->registerFunction(array('ProgressIndicator_OnSuccess_' . $this->_id, $this->_attributes['success'][0], $this->_attributes['success'][1])); }
public function __construct($attributes) { parent::__construct($attributes); if (!isset($this->_attributes['allow_generate'])) { $this->_attributes['allow_generate'] = 1; } $this->_attributes['category_field'] = $this->_attributes['category']->GetName(); $this->_attributes['price_field'] = $this->_attributes['price']->GetName(); $this->_attributes['vat_field_name'] = $this->_attributes['vat_field']->GetName(); $this->_attributes['vat_values'] = App::getModel('vat/vat')->getVATValuesAll(); $this->_attributes['suffixes'] = App::getModel('suffix/suffix')->getSuffixTypes(); $this->_jsGetAttributeSetsForCategories = 'GetAttributeSetsForCategories_' . $this->_id; $this->_jsGetAttributesForSet = 'GetAttributesForSet_' . $this->_id; $this->_jsGetValuesForAttribute = 'GetValuesForAttribute_' . $this->_id; $this->_jsGetCartesian = 'GetCartesian_' . $this->_id; $this->_jsAddAttribute = 'AddAttribute_' . $this->_id; $this->_jsAddValue = 'AddValue_' . $this->_id; $this->_attributes['get_sets_for_categories'] = 'xajax_' . $this->_jsGetAttributeSetsForCategories; $this->_attributes['get_attributes_for_set'] = 'xajax_' . $this->_jsGetAttributesForSet; $this->_attributes['get_values_for_attribute'] = 'xajax_' . $this->_jsGetValuesForAttribute; $this->_attributes['get_cartesian'] = 'xajax_' . $this->_jsGetCartesian; $this->_attributes['add_attribute'] = 'xajax_' . $this->_jsAddAttribute; $this->_attributes['add_value'] = 'xajax_' . $this->_jsAddValue; App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsGetAttributeSetsForCategories, $this, 'getAttributeSetsForCategories')); App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsGetAttributesForSet, $this, 'getAttributesForSet')); App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsGetValuesForAttribute, $this, 'getValuesForAttribute')); App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsGetCartesian, $this, 'getCartesian')); App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsAddAttribute, $this, 'addAttribute')); App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsAddValue, $this, 'addValue')); }
public function __construct($attributes) { parent::__construct($attributes); $this->_attributes['session_name'] = session_name(); $this->_attributes['session_id'] = session_id(); $this->_jsFunction = 'LoadFiles_' . $this->_id; $this->_attributes['load_handler'] = 'xajax_' . $this->_jsFunction; App::getRegistry()->xajax->registerFunction(array($this->_jsFunction, $this, 'doLoadFilesForDatagrid_' . $this->_id)); }
public function __construct($attributes) { parent::__construct($attributes); $this->_jsFunction = 'LoadProducts_' . $this->_id; $this->_attributes['jsfunction'] = 'xajax_' . $this->_jsFunction; App::getRegistry()->xajax->registerFunction(array($this->_jsFunction, $this, 'loadProducts')); $this->_attributes['load_category_children'] = App::getRegistry()->xajaxInterface->registerFunction(array('LoadCategoryChildren_' . $this->_id, $this, 'loadCategoryChildren')); $this->_attributes['datagrid_filter'] = $this->getDatagridFilterData(); }
public function registerFunction($registrationArray) { $name = array_shift($registrationArray); $callback = $registrationArray; $callbackName = '_auto_callback_' . $this->autoId++; $this->registerCallback($callbackName, $callback); App::getRegistry()->xajax->registerFunction(array($name, $this, $callbackName)); return 'xajax_' . $name; }
public function __construct($attributes) { parent::__construct($attributes); $this->_jsFunction = 'LoadClients_' . $this->_id; $this->_jsFunctionDetails = 'LoadClientData_' . $this->_id; $this->_attributes['jsfunction'] = 'xajax_' . $this->_jsFunction; $this->_attributes['jsfunctiondetails'] = 'xajax_' . $this->_jsFunctionDetails; App::getRegistry()->xajax->registerFunction(array($this->_jsFunction, $this, 'loadClients')); App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsFunctionDetails, $this, 'loadClientDetails')); }
public function __construct($errorMsg, $table, $column, $valueProcessFunction = null, $exclude = null) { parent::__construct($errorMsg); $this->_table = $table; $this->_column = $column; $this->_exclude = $exclude; $this->_id = self::$_nextId++; $this->_valueProcessFunction = $valueProcessFunction; $this->_jsFunction = 'CheckUniqueness_' . $this->_id; App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsFunction, $this, 'doAjaxCheck')); }
public function Render_JS($loadJs = true) { $render = ''; if ($loadJs) { if (is_object(App::getRegistry()->router) && App::getRegistry()->router->getMode() == 0 && !in_array(App::getRegistry()->router->getCurrentController(), array('login', 'forgotlogin'))) { $render = '<script type="text/javascript" src="' . DESIGNPATH . '_js_frontend/core/gform.js"></script>'; } } $render .= "\n\t\t\t<form id=\"{$this->_attributes['name']}\" method=\"{$this->_attributes['method']}\" action=\"{$this->_attributes['action']}\">\n\t\t\t\t<input type=\"hidden\" name=\"{$this->_attributes['name']}_submitted\" value=\"1\"/>\n\t\t\t</form>\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\t/*<![CDATA[*/\n\t\t\t\t\tGCore.OnLoad(function() {\n\t\t\t\t\t\t\$('#{$this->_attributes['name']}').GForm({\n\t\t\t\t\t\t\tsFormName: '{$this->_attributes['name']}',\n\t\t\t\t\t\t\tsClass: '{$this->_attributes['class']}',\n\t\t\t\t\t\t\tiTabs: " . ($this->_attributes['tabs'] == self::TABS_VERTICAL ? 'GForm.TABS_VERTICAL' : 'GForm.TABS_HORIZONTAL') . ",\n\t\t\t\t\t\t\taoFields: [\n\t\t\t\t\t\t\t\t{$this->_RenderChildren()}\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\toValues: " . json_encode($this->GetValues()) . ",\n\t\t\t\t\t\t\toErrors: " . json_encode($this->GetErrors()) . "\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t/*]]>*/\n\t\t\t</script>\n\t\t"; return $render; }
protected static function load() { if ((self::$events = App::getRegistry()->cache->load('events')) === FALSE) { $sql = 'SELECT * FROM event'; $stmt = Db::getInstance()->prepare($sql); $stmt->execute(); while ($rs = $stmt->fetch()) { self::$events[] = array('name' => $rs['name'], 'model' => $rs['model'], 'method' => $rs['method'], 'mode' => $rs['mode']); } App::getRegistry()->cache->save('events', self::$events); } }
public function __construct($attributes) { parent::__construct($attributes); if (!isset($this->_attributes['products_source_field']) || !$this->_attributes['products_source_field'] instanceof ProductSelect) { throw new Exception("Source field (attribute: products_source_field) not set for field '{$this->_attributes['name']}'."); } $this->_attributes['products_source_field_name'] = $this->_attributes['products_source_field']->GetName(); $this->_attributes['vat_values'] = App::getModel('vat/vat')->getVATAll(); $this->_attributes['prefixes'] = array(Translation::get('TXT_PRICE_NET'), Translation::get('TXT_PRICE_GROSS')); $this->_jsFunction = 'LoadProductDataForAggregation_' . $this->_id; $this->_attributes['jsfunction'] = 'xajax_' . $this->_jsFunction; App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsFunction, $this, 'loadProductData')); }
public function deleteAttribute($request) { $status = true; $message = ''; $db = App::getRegistry()->db; try { App::getModel('attributegroup')->RemoveAttributeFromGroup($request['id'], $request['set_id']); App::getModel('attributegroup')->DeleteAttribute($request['id']); } catch (Exception $e) { $status = false; $message = $e->getMessage(); } return array('status' => $status, 'message' => $message); }
public function __construct($attributes) { parent::__construct($attributes); $this->_jsFunction = 'LoadProducts_' . $this->_id; $this->_attributes['jsfunction'] = 'xajax_' . $this->_jsFunction; App::getRegistry()->xajax->registerFunction(array($this->_jsFunction, $this, 'loadProducts_' . $this->_id)); $this->_attributes['load_category_children'] = App::getRegistry()->xajaxInterface->registerFunction(array('LoadCategoryChildren_' . $this->_id, $this, 'loadCategoryChildren')); if (isset($this->_attributes['exclude_from'])) { $this->_attributes['exclude_from_field'] = $this->_attributes['exclude_from']->GetName(); } if (!isset($this->_attributes['exclude'])) { $this->_attributes['exclude'] = array(0); } $this->_attributes['datagrid_filter'] = $this->getDatagridFilterData(); }
public function __construct($attributes) { parent::__construct($attributes); if (!isset($this->_attributes['key'])) { throw new Exception("Datagrid key (attribute: key) not set for field '{$this->_attributes['name']}'."); } if (!isset($this->_attributes['columns'])) { throw new Exception("Datagrid columns (attribute: columns) not set for field '{$this->_attributes['name']}'."); } if (!isset($this->_attributes['datagrid_init_function']) || !is_callable($this->_attributes['datagrid_init_function'])) { throw new Exception("Datagrid initialization function not set (attribute: datagrid_init_function) for field '{$this->_attributes['name']}'. Hint: check whether the method you have specified is public."); } $this->_jsFunction = 'LoadRecords_' . $this->_id; $this->_attributes['jsfunction'] = 'xajax_' . $this->_jsFunction; App::getRegistry()->xajax->registerFunction(array($this->_jsFunction, $this, 'loadRecords_' . $this->_id)); }
public function __construct($attributes) { parent::__construct($attributes); $this->_jsGetChildren = 'GetChildren_' . $this->_id; if (isset($this->_attributes['load_children']) && is_callable($this->_attributes['load_children'])) { $this->_attributes['get_children'] = 'xajax_' . $this->_jsGetChildren; App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsGetChildren, $this, 'getChildren')); } if (!isset($this->_attributes['addLabel'])) { $this->_attributes['addLabel'] = \Gekosale\Translation::get('TXT_ADD'); } if (!isset($this->_attributes['retractable'])) { $this->_attributes['retractable'] = true; } $this->_attributes['total'] = count($this->_attributes['items']); }
public function __construct($attributes) { parent::__construct($attributes); $this->_attributes['session_name'] = session_name(); $this->_attributes['session_id'] = session_id(); $this->_attributes['file_types'] = array('jpg', 'png', 'gif', 'swf'); if (!isset($this->_attributes['file_source'])) { $this->_attributes['file_source'] = 'upload/'; } $this->_attributes['file_types_description'] = \Gekosale\Translation::get('TXT_FILE_TYPES_IMAGE'); $this->_attributes['upload_url'] = App::getURLAdressWithAdminPane() . 'files/add/' . base64_encode($this->_attributes['file_source']); $this->_attributes['load_handler'] = 'xajax_LoadFiles_' . $this->_id; App::getRegistry()->xajaxInterface->registerFunction(array('LoadFiles_' . $this->_id, $this, 'LoadFiles')); $this->_attributes['delete_handler'] = 'xajax_DeleteFile_' . $this->_id; App::getRegistry()->xajaxInterface->registerFunction(array('DeleteFile_' . $this->_id, $this, 'DeleteFile')); $this->_attributes['type_icons'] = array('cdup' => DESIGNPATH . '_images_panel/icons/filetypes/cdup.png', 'unknown' => DESIGNPATH . '_images_panel/icons/filetypes/unknown.png', 'directory' => DESIGNPATH . '_images_panel/icons/filetypes/directory.png', 'gif' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'png' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'jpg' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'bmp' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'txt' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'doc' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'rtf' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'odt' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'htm' => DESIGNPATH . '_images_panel/icons/filetypes/document.png', 'html' => DESIGNPATH . '_images_panel/icons/filetypes/document.png', 'php' => DESIGNPATH . '_images_panel/icons/filetypes/document.png'); }
protected function saveError() { $User = array(); $errorText = ''; $message = ''; if (App::getRegistry()->session->getActiveUserid() != NULL) { $User['id'] = App::getRegistry()->session->getActiveUserid(); $User['firstname'] = App::getRegistry()->session->getActiveUserFirstname(); $User['surname'] = App::getRegistry()->session->getActiveUserSurname(); $User['email'] = App::getRegistry()->session->getActiveUserEmail(); } if (count($User) > 0) { $errorText = '>>> User Info: ' . "\n" . 'SystemId: ' . $User['id'] . "\n" . 'Name: ' . $User['firstname'] . ' ' . $User['surname'] . "\n" . 'E-mail: ' . $User['email'] . " <<<\n"; } $errorText .= 'Date: ' . date('Y-m-d H:i:s') . "\n" . 'File: ' . $this->getFile() . ' in line: ' . $this->getLine() . "\n" . 'User error message: ' . $this->getMessage() . "\n" . 'Orginal error message: ' . $this->msgToLogFile . "\n" . 'Trace: ' . "\n" . $this->getTraceAsString() . "\n" . '----------------------------------------END' . "\n"; fwrite($this->fh, $errorText); $this->errorText = $errorText; }
protected function _RegisterXajaxMethod($name, $callback) { $jsName = $name . '_' . $this->_id; $this->_attributes[$name] = 'xajax_' . $jsName; App::getRegistry()->xajaxInterface->registerFunction(array($jsName, $callback[0], $callback[1])); $this->_xajaxMethods[] = $this->_FormatAttribute_JS($name, $name, FE::TYPE_FUNCTION); }
public function killSession() { session_destroy(); $this->__SESSION_ID = session_id(); App::getRegistry()->core->setEnvironmentVariables(); }
protected function getRegistry() { return \Gekosale\App::getRegistry(); }
public function setStaticTemplateVariables() { if ($this->registry->router->getAdministrativeMode() == 0) { $link = $this->_adminPane = ''; } else { $link = $this->_adminPane = __ADMINPANE__ . '/'; } $languageModel = App::getModel('language'); $languages = $languageModel->getLanguages(); $this->layer = $this->registry->loader->getCurrentLayer(); if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { $this->assign('SSLNAME', 'https://'); } else { $this->assign('SSLNAME', 'http://'); } $theme = App::getRegistry()->loader->getParam('theme'); $this->assign('URL', App::getURLAdress() . $link); $this->assign('CURRENT_URL', App::getCurrentURLAdress()); $this->assign('DESIGNPATH', DESIGNPATH); $this->assign('ASSETSPATH', App::getURLForAssetDirectory() . $theme . '/assets/'); $this->assign('THEMESPATH', App::getURLForAssetDirectory()); $this->assign('CURRENT_CONTROLLER', $this->registry->router->getCurrentController()); $this->assign('CURRENT_ACTION', $this->registry->router->getAction()); $this->assign('CURRENT_PARAM', $this->registry->core->getParam()); $this->assign('SHOP_NAME', Session::getActiveShopName()); $templateData = array(); if ($this->registry->router->getAdministrativeMode() == 0) { $cartModel = App::getModel('cart'); $client = App::getModel('client')->getClient(); $productCart = $cartModel->getShortCartList(); $productCart = $cartModel->getProductCartPhotos($productCart); $this->assign('SHOP_LOGO', $this->layer['photoid']); $this->assign('FAVICON', $this->layer['favicon']); $this->assign('enableregistration', $this->layer['enableregistration']); $this->assign('client', $client); $this->assign('clientdata', $client); $this->assign('showtax', $this->layer['showtax']); $this->assign('currencySymbol', Session::getActiveCurrencySymbol()); $this->assign('count', $cartModel->getProductAllCount()); $this->assign('globalPrice', $cartModel->getGlobalPrice()); $this->assign('productCart', $productCart); $this->assign('language', Session::getActiveLanguageId()); $this->assign('languageCode', Session::getActiveLanguage()); $this->assign('languageFlag', $languageModel->getLanguages()); $this->assign('currencies', $languageModel->getAllCurrenciesForView()); $this->assign('breadcrumb', App::getModel('breadcrumb')->getPageLinks()); $this->assign('contentcategory', App::getModel('staticcontent')->getContentCategoriesTree()); $this->assign('defaultcontact', App::getModel('contact')->getContactById($this->layer['contactid'])); $this->assign('newsletterButton', App::getModel('newsletter')->isNewsletterButton()); $this->assign('cartpreview', $cartModel->getCartPreviewTemplate()); if ($this->layer['cartredirect'] != '') { $this->assign('cartredirect', App::getURLAdress() . Seo::getSeo($this->layer['cartredirect'])); } else { $this->assign('cartredirect', ''); } $this->assign('modulesettings', $this->registry->core->getModuleSettingsForView()); $message = Session::getVolatileMessage(); if (isset($message) && !empty($message)) { $this->assign('message', $message[0]); } $this->assign('categories', App::getModel('CategoriesBox')->getCategoriesTree(2)); $methods = $this->getXajaxMethodsForFrontend(); foreach ($methods as $xajaxMethodName => $xajaxMethodParams) { $this->registry->xajax->registerFunction(array($xajaxMethodName, App::getModel($xajaxMethodParams['model']), $xajaxMethodParams['method'])); } $message = Session::getVolatileMessage(); if (isset($message) && !empty($message)) { $this->assign('message', $message[0]); } $this->assign('view', Helper::getViewId()); $this->assign('viewid', Helper::getViewId()); } else { $this->registry->core->setAdminStoreConfig(); $templateData = array('user_name' => App::getModel('users')->getUserFullName(), 'user_id' => App::getModel('users')->getActiveUserid(), 'language' => Session::getActiveLanguageId(), 'languages' => json_encode($languages), 'globalsettings' => Session::getActiveGlobalSettings(), 'views' => App::getModel('view')->getViews(), 'vatvalues' => json_encode(App::getModel('vat/vat')->getVATValuesAll()), 'FRONTEND_URL' => Session::getActiveShopUrl() != '' ? 'http://' . Session::getActiveShopUrl() : App::getURLAdress(), 'appversion' => Session::getActiveAppVersion(), 'view' => Helper::getViewId(), 'viewid' => Helper::getViewId()); $message = Session::getVolatileMessage(); if (isset($message) && !empty($message)) { $templateData['message'] = $message[0]; } $methods = $this->getXajaxMethodsForAdmin(); foreach ($methods as $xajaxMethodName => $xajaxMethodParams) { $this->registry->xajax->registerFunction(array($xajaxMethodName, App::getModel($xajaxMethodParams['model']), $xajaxMethodParams['method'])); } $Data = Event::dispatch($this, 'template.setStaticTemplateVariables', array('data' => $templateData)); foreach ($Data as $param => $value) { $this->assign($param, $value); } $this->assign('view', Helper::getViewId()); $this->assign('viewid', Helper::getViewId()); } }