function get_link_by_id($obj_id, $page_link, $node_id = null) { static $tree_pathes; if ($tree_path = explode('/', $page_link)) { $this->_tree->recursiveChildCollectFast(1, array('_CATGROUP'), 'ASC', 0, true); if (!$tree_pathes[md5($page_link)]) { $tree_path = XARRAY::clear_empty_items($tree_path); $pages =& Common::module_factory('pages.front'); if (!$node_id) { $node_id = $pages->_tree->IdByBasicPath($tree_path, array('_PAGE', '_GROUP'), true); } if ($node_id) { $module = $pages->_common_obj->get_module_by_action($node_id, 'show_catalog_server'); } $module_id = $tree_pathes[md5($page_link)] = $module['params']['showBasicPointId']; } else { $module_id = $tree_pathes[md5($page_link)]; } $cat_node = $this->_tree->getNodeStruct($obj_id); if ($cat_node['obj_type'] == '_CATOBJ') { $id = $this->_tree->getAncestor($obj_id); $basic = '/' . $cat_node['basic']; } else { $basic = ''; $id = $obj_id; } return $rpath = $page_link . '/' . $this->_tree->calculate_r_path($id, $module_id, array('_CATGROUP'), 2) . $basic; } }
function xroute($data) { if (is_array($data)) { foreach ($data as $modulename => $route_function) { //wake up module if ($module = Common::module_factory($modulename . '.xfront')) { //execute + result context $module->executex($route_function, $this); } } } }
function start() { if ($this->tasks) { foreach ($this->tasks as $taskid => $module_task) { if ($m = Common::module_factory($module_task['module'] . '.cron')) { if ($module_task['status'] != 3) { $method_name = key($module_task['method']); $this->tasks[$taskid]['status'] = $m->{$method_name}($module_task['method'][$method_name], $this->tasks[$taskid]['status']); } } } } }
function render_module($id, $call_dynamic = false) { if (!$call_dynamic) { $module = $this->_tree->getNodeInfo($id); if (!$module['params']['Active']) { return; } } else { $module['params'] = $id; } if (is_object($module_obj =& Common::module_factory($module['params']['type'] . '.front'))) { return $module_obj->execute($module['params'], array('__module_id' => $module['id'])); } }
function restore_it($params) { if (is_array($params['id'])) { foreach ($params['id'] as $id) { if ($rnode = $this->_tree->getNodeInfo($id)) { $m = Common::module_factory($rnode['params']['module'] . '.back'); $m->common_call(); if ($m->_tree->IsNodeExist($rnode['params']['ancestor'])) { $this->_tree->ExportNodes($id, $m->_tree->getBrachOT()); $m->_tree->ImportNodes($rnode['params']['ancestor'], $id, $this->_tree->EXPcache); $this->_tree->DelNode($id); $this->result['isRestor'] = true; } } } } }
function get_cslotz($params) { global $_DB; if (!$params['tpl_name']) { $tpl_name = $this->_tree->ReadNodeParam($params['node_id'], 'Template'); } else { $tpl_name = $params['tpl_name']; } if (!$params['load_all_tpl_slotz']) { $tpl_slotz = $this->_common_obj->get_tpl_slotz($tpl_name); } else { $tpl_slotz = $this->get_tpl_slotz_all(null, true); } if ($params['node_id']) { //для уменьшения объема выборки по модулям $node_slots = $this->_common_obj->get_page_slotz($params['node_id']); $slotz_in_page = array(); $slotz_in_page = array_intersect(XARRAY::askeyval($node_slots, 'basic'), XARRAY::askeyval($tpl_slotz, 'basic')); } if ($tpl_slotz) { $i = 0; //cборка слотов reset($tpl_slotz); while (list($id, $tpl_slot) = each($tpl_slotz)) { $i++; if (!$params['get_modules_only']) { $this->result['slotz'][$i]['basic'] = $tpl_slot['basic']; $this->result['slotz'][$i]['alias'] = $tpl_slot['params']['SlotAlias']; } if (($fkey = array_search($tpl_slot['basic'], $slotz_in_page)) !== false) { //проверка на модули //if ((!$params['tpl_name'])&&(!$params['get_slotz_only'])) // { //$modules=$this->_tree->GetChildsParam($fkey, '%', true); $mk[$fkey] = $tpl_slot['basic']; // $this->result['modules'][$tpl_slot['basic']]=$this->_tree->GetChildsParam($fkey, '%', true); // } } } if ($mk && !$params['tpl_name'] && !$params['get_slotz_only']) { if ($modules_crotch = $this->_tree->get_anc_multiply_childs(array_keys($mk), array('_MODULE'), true)) { foreach ($modules_crotch as $id => $module) { $mi = Common::module_factory($module['params']['type'] . '.front'); $module['params']['RAction'] = $mi->_common_obj->front_action_list[$module['params']['Action']]['front_name']; if (method_exists($mi->_common_obj, $method = $module['params']['Action'] . '_extra')) { $module['params'] = $mi->_common_obj->{$method}($module['params']); } $this->result['modules'][$mk[$module['ancestor']]][$id] = $module; } } } return true; } }
public static function call_module_method($module, $func, $params) { if (!is_object($module)) { $m = Common::module_factory($module); } else { $m = $module; } if (method_exists($m, $func)) { return call_user_func_array(array($m, $func), $params); } }
function call_module($params) { Common::module_factory($params[0]); }
function load_xlist_data($parameters) { $catalog =& Common::module_factory('catalog.back'); $catalog->common_call(); $catalog->load_xlist_data($parameters); $this->result['data_set'] = $catalog->result['data_set']; }
function intialize_trees_roots() { $mod_list = Common::get_module_list(); if ($mod_list) { foreach ($mod_list as $module) { $_module =& Common::module_factory($module['name'] . '.back'); if ($_module) { if (method_exists($_module, 'common_call')) { $_module->common_call(); if ($_module->_tree) { $_module->_tree->WriteNodeParam(1, 'Name', $module['alias'] . '(' . $_SERVER["HTTP_HOST"] . ')'); } $this->result['modules'][] = 'Модуль ' . $module['name'] . " инициализирован\r\n"; } } } } }
function on_module_save($params, $page_id) { $pages = Common::module_factory('pages.back'); $pages->set_routes_to_server($page_id, 'showcontent'); return $params; }