// \FOR DEVELOPMENT PURPOSES ONLY!!! return array(CONTROLLER_STATUS_OK, "settings_dev.manage?section_id={$section_id}"); } if ($mode == 'manage') { // // OUPUT routines // $descr = fn_settings_descr_query('section_id', 'S', CART_LANGUAGE, 'settings_sections', 'object_string_id'); $sections = db_get_hash_array("SELECT ?:settings_sections.*, ?:settings_descriptions.description FROM ?:settings_sections {$descr} ORDER BY ?:settings_descriptions.description", 'section_id'); $descr = fn_settings_descr_query('subsection_id', 'U', CART_LANGUAGE, 'settings_subsections', 'object_string_id'); $subsections = db_get_hash_array("SELECT ?:settings_subsections.*, ?:settings_descriptions.description FROM ?:settings_subsections {$descr} WHERE ?:settings_subsections.section_id = ?s ORDER BY ?:settings_subsections.position", 'subsection_id', $section_id); $descr = fn_settings_descr_query('option_id', 'O', CART_LANGUAGE, 'settings'); $options = db_get_hash_multi_array("SELECT ?:settings.*, ?:settings_descriptions.description, ?:settings_descriptions.tooltip FROM ?:settings {$descr} WHERE ?:settings.section_id = ?s ORDER BY ?:settings.position", array('subsection_id'), $section_id); $options['main'] = $options['']; unset($options['']); $descr = fn_settings_descr_query('variant_id', 'V', CART_LANGUAGE, 'settings_variants'); fn_get_schema('settings', 'variants', 'php', false, true); fn_get_schema('settings', 'actions', 'php', false, true); foreach ($options as $sid => $sct) { $ssid = $sid == 'main' ? '' : $sid; $elements = db_get_array("SELECT ?:settings_elements.*, ?:settings_descriptions.description FROM ?:settings_elements LEFT JOIN ?:settings_descriptions ON ?:settings_elements.element_id = ?:settings_descriptions.object_id AND ?:settings_descriptions.object_type = 'H' AND ?:settings_descriptions.lang_code = ?s WHERE ?:settings_elements.section_id = ?s AND ?:settings_elements.subsection_id = ?s ORDER BY ?:settings_elements.position", CART_LANGUAGE, $section_id, $ssid); foreach ($elements as $k => $v) { if (!empty($v['handler']) && $v['element_type'] == 'I') { $args = explode(',', $v['handler']); $func = array_shift($args); $elements[$k]['info'] = function_exists($func) ? call_user_func_array($func, $args) : 'Function not exists'; } } foreach ($sct as $k => $v) { // Get variants list $func = 'fn_settings_variants_' . strtolower($v['section_id']) . '_' . (!empty($v['subsection_id']) ? $v['subsection_id'] . '_' : '') . $v['option_name'];
foreach ($vendor['price-sheets'] as $priceSheet) { $elements[] = array('section_id' => 'Vendors', 'subsection_id' => 'main', 'element_type' => 'I', 'info' => $priceSheet['file-name']); $elements[] = array('section_id' => 'Vendors', 'subsection_id' => 'main', 'option_type' => 'K', 'variants' => array('file' => 'Фаил', 'url' => 'Ссылка'), 'value' => $priceSheet['download'], 'position' => '100', 'is_global' => 'Y', 'description' => 'Тип загрузки', 'tooltip' => '', 'object_type' => 'O', 'option_id' => str_replace(".", "_", $priceSheet['file-name'])); $elements[] = array('section_id' => 'Vendors', 'subsection_id' => 'main', 'option_type' => '0', 'value' => $priceSheet['url'], 'position' => '100', 'is_global' => 'Y', 'description' => 'Ссылка', 'tooltip' => '', 'object_type' => 'O', 'option_id' => str_replace(".", "_", $priceSheet['file-name'] . "u")); $elements[] = array('section_id' => 'Vendors', 'subsection_id' => 'main', 'option_type' => 'U', 'position' => '100', 'is_global' => 'Y', 'description' => 'Файл', 'tooltip' => '', 'object_type' => 'O', 'option_id' => str_replace(".", "_", $priceSheet['file-name'])); } } if (isset($_REQUEST['sync'])) { $result = fn_analyse_log(DIR_SYNC_VENDORS . "syncVendor.log"); $message = fn_get_lang_var('sync_vendor_prices_finished') . "\r\n" . $result; fn_set_notification('N', fn_get_lang_var('notice'), $message); } $options['main'] = $elements; } // Set navigation menu $descr = fn_settings_descr_query('section_id', 'S', CART_LANGUAGE, 'settings_sections', 'object_string_id'); $sections = db_get_hash_array("SELECT ?:settings_sections.section_id, ?:settings_descriptions.description as title, CONCAT(?s, ?:settings_sections.section_id) as href, ?:settings_descriptions.object_type FROM ?:settings_sections ?p ORDER BY ?:settings_descriptions.description", 'section_id', "settings.manage?section_id=", $descr); fn_update_lang_objects('sections', $sections); Registry::set('navigation.dynamic.sections', $sections); Registry::set('navigation.dynamic.active_section', $section_id); $view->assign('options', $options); $view->assign('subsections', $subsections); $view->assign('section_id', $section_id); $view->assign('settings_title', $sections[$section_id]['title']); } //----------------------------------------------------------------------- // // Settings related functions // // Return part of SQL query to get object description from settings_descriptions table; function fn_settings_descr_query($object_id, $object_type, $lang_code = CART_LANGUAGE, $table, $oid_name = 'object_id')