本文整理汇总了PHP中Checkout::update_pm_sm_currency_settings方法的典型用法代码示例。如果您正苦于以下问题:PHP Checkout::update_pm_sm_currency_settings方法的具体用法?PHP Checkout::update_pm_sm_currency_settings怎么用?PHP Checkout::update_pm_sm_currency_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Checkout
的用法示例。
在下文中一共展示了Checkout::update_pm_sm_currency_settings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setSelectedModules
/**
* Sets up "is_selected" in false, and also "is_active" in false in all
* modules, except the passed in ones. It sets "is_selected" in true in all
* passed modules,that exist in the database. It adds the modules, that don't
* exist in the table. So that it should be specified in the inputted data
* which data should be added as "active", and which of them shouldn't.
*
* Parameters have a complicated structure, because words Selected and Active
* for modules depend: if a module is not Selected, it can't be Active.
* And also because the status Selected/non-Selected is usually changed for
* several modules at once. Administrator choses, which modules should be
* Selected, which of them are non-Selected and then presses the button:
* save the changes.
*/
function setSelectedModules($modules, $modulesType, $b_settings_table_is_empty = false)
{
global $application;
//The list of modules,which should become selected.
$selected_modules_ids = array();
foreach ($modules as $module_id => $module_settings) {
$selected_modules_ids[] = "'" . $module_id . "'";
}
$tables = Checkout::getTables();
$columns = $tables['checkout_pm_sm_settings']['columns'];
$YES = "1";
$NO = "2";
//Sets up "is_selected" in false, and also "is_active" in false in all modules, except the passed in ones.
if (count($selected_modules_ids) != 0) {
$query = new DB_Update('checkout_pm_sm_settings');
$query->addUpdateExpression($columns['status_selected_value_id'], $NO);
$query->addUpdateExpression($columns['status_active_value_id'], $NO);
$query->WhereField($columns['module_id'], DB_NIN, "(" . implode(",", $selected_modules_ids) . ")");
$query->WhereAnd();
$query->WhereValue($columns['module_group'], DB_EQ, $modulesType);
$application->db->getDB_Result($query);
}
//Set "is_selected" in true, and also sort_order in all passed modules that exist in the database.
//It adds the modules, that don't exist in the table. So that it should be specified in the inputted data
//which data should be added as "active", and which of them shouldn't.
//First get the list of modules, entered to the database:
//_print($selected_modules_ids);die("full stop");
if ($b_settings_table_is_empty === true) {
$modules_already_in_db = array();
} else {
$modules_already_in_db = $this->getSelectedModules($modulesType);
}
foreach ($modules as $module_id => $module_settings) {
if (!array_key_exists($module_id, $modules_already_in_db)) {
//The module doesn't exist in the database.
//Add module settings to the database.
// Checkout::getPaymentModuleInfo() ,
// , isActive()
// , checkout_pm_sm_settings.
$mm_info = Checkout::getInstalledModulesListData($modulesType, NULL, true);
$m_name = "";
foreach ($mm_info as $key => $info) {
if ($info->UUID == $module_settings['module_id']) {
$m_name = $info->name;
break;
}
}
$db_insert = new DB_Insert('checkout_pm_sm_settings');
$db_insert->addInsertValue($module_settings['module_id'], $columns['module_id']);
$db_insert->addInsertValue($m_name, $columns['module_class_name']);
$db_insert->addInsertValue($module_settings['module_group'], $columns['module_group']);
$db_insert->addInsertValue($NO, $columns['status_active_value_id']);
$db_insert->addInsertValue($module_settings['b_is_selected'] === true ? $YES : $NO, $columns['status_selected_value_id']);
$db_insert->addInsertValue($module_settings['sort_order'], $columns['sort_order']);
$application->db->PrepareSQL($db_insert);
//_print($modules);_print($module_settings);_print($application->db->QueryString);die;
$application->db->DB_Exec();
Checkout::update_pm_sm_currency_settings($module_settings['module_id'], modApiStaticFunc($m_name, "getInitialCurrencySettings"));
} else {
//The module exists in the database. Update sort_order and is_selected.
$query = new DB_Update('checkout_pm_sm_settings');
$query->addUpdateExpression($columns['status_selected_value_id'], $YES);
$query->addUpdateExpression($columns['sort_order'], $module_settings['sort_order']);
$query->WhereValue($columns['module_id'], DB_EQ, $module_id);
$application->db->getDB_Result($query);
}
}
}