/** * * " ". * * . * * @param unknown_type $uid */ function intstallModule($uid) { global $application; $tables = TransactionTracking::getTables(); // . $table = 'transaction_tracking_modules'; $columns = $tables[$table]['columns']; $obj =& $application->getInstance('MessageResources', modApiFunc("Modules_Manager", "getResFileByShortName", 'TT'), 'AdminZone'); $module_name = $obj->getMessage($uid . '_name'); $query = new DB_Insert($table); $query->addInsertValue($uid, $columns['module_id']); $query->addInsertValue($module_name, $columns['module_name']); $query->addInsertValue(DB_FALSE, $columns['status_active']); $application->db->getDB_Result($query); // $module_default_settings = TransactionTrackingInstaller::getModuleDefaultSettings($uid); $table = 'transaction_tracking_modules_settings'; $columns = $tables[$table]['columns']; foreach ($module_default_settings as $key_name => $value) { $query = new DB_Insert($table); $query->addInsertValue($uid, $columns['module_id']); $query->addInsertValue($key_name, $columns['key_name']); $query->addInsertValue($value, $columns['value']); $application->db->getDB_Result($query); } }
function initQuery($params) { $tables = TransactionTracking::getTables(); $ttm = $tables['transaction_tracking_modules']['columns']; $this->addSelectTable('transaction_tracking_modules'); $this->addSelectField($ttm['module_id'], 'module_id'); $this->addSelectField($ttm['module_name'], 'module_name'); $this->addSelectField($ttm['status_active'], 'status_active'); }
function outputGAsnippet($part) { if ($part == 'header') { $header_template = TransactionTracking::getIncludedFileContents("google_analytics_header.tpl.html"); $settings = TransactionTracking::getModulesSettings(); $GA_ACCOUNT_NUMBER = $settings[MODULE_GOOGLE_ANALYTICS_UID]['GA_ACCOUNT_NUMBER']; $header_snippet = strtr($header_template, array("UA-XXXXX-1" => $GA_ACCOUNT_NUMBER)); return $header_snippet; } else { $footer_snippet = TransactionTracking::getIncludedFileContents("google_analytics_footer.tpl.html"); return $footer_snippet; } }
/** * @ */ function onAction() { global $application; $this->updateGA(); $this->updateClixGalore(); //Set modules active $request = $application->getInstance('Request'); $ActiveModules = $request->getValueByKey('ModuleActive'); $InstalledModules = modApiStaticFunc("TransactionTracking", "getInstalledModules"); foreach ($InstalledModules as $uid => $info) { $new_status = isset($ActiveModules[$uid]) ? DB_TRUE : DB_FALSE; TransactionTracking::updateModuleStatus($uid, $new_status); } modApiFunc('Session', 'set', 'ResultMessage', 'MSG_TRANSACTION_TRACKING_SETTINGS_UPDATED'); }
/** * transaction . * * @return unknown */ function getModulesSettings() { global $application; static $ModulesSettings = NULL; $ModulesSettings = array(); $tables = TransactionTracking::getTables(); $ttm = $tables['transaction_tracking_modules_settings']['columns']; $query = new DB_Select(); $query->addSelectField($ttm['id'], 'id'); $query->addSelectField($ttm['module_id'], 'module_id'); $query->addSelectField($ttm['key_name'], 'key_name'); $query->addSelectField($ttm['value'], 'value'); $result = $application->db->getDB_Result($query); if (!empty($result)) { foreach ($result as $entry) { $m_uid = $entry['module_id']; if (!isset($ModulesSettings[$m_uid])) { $ModulesSettings[$m_uid] = array(); } $ModulesSettings[$m_uid][$entry['key_name']] = $entry['value']; } } return $ModulesSettings; }
function outputClixGalore() { global $application; $last_placed_order_id = modApiFunc("Checkout", "getLastPlacedOrderID"); $currency_id = modApiFunc("Localization", "whichCurrencySendOrderToPaymentShippingGatewayIn", $last_placed_order_id, GET_PAYMENT_MODULE_FROM_ORDER); if ($last_placed_order_id !== NULL) { $settings = TransactionTracking::getModulesSettings(); $CLIXGALORE_AD_ID = $settings[MODULE_CLIXGALORE_UID]['CLIXGALORE_AD_ID']; $container_template = TransactionTracking::getIncludedFileContents("clixgalore_container.tpl.html"); $container_data = array("ADID" => $CLIXGALORE_AD_ID, "AN_ORDER_ID" => $last_placed_order_id, "SALE_AMOUNT_HERE" => modApiFunc("Checkout", "getOrderPrice", "Total", $currency_id)); $value = strtr($container_template, $container_data) . "\n"; return $value; } else { return ""; } }
function outputClixGaloreSettings() { global $application; $settings = TransactionTracking::getModulesSettings(); $this->_Current_Module_Settings = array('CLIXGALORE_AD_ID' => $settings[MODULE_CLIXGALORE_UID]['CLIXGALORE_AD_ID'], 'ClixGaloreUID' => MODULE_CLIXGALORE_UID); $application->registerAttributes($this->_Current_Module_Settings); $this->mTmplFiller = new TmplFiller(dirname(dirname(__FILE__)) . '/templates_az/'); return $this->mTmplFiller->fill("settings/", "settings_clixgalore.tpl.html", array()); }