Exemple #1
0
 function get_last_comments($params)
 {
     global $TDB;
     if ($params['count']) {
         if ($params["cobj"]) {
             $cobjects = $params["cobj"];
         } else {
             if ($params['treads']) {
                 if ($treads = explode(',', $params['treads'])) {
                     $cobjects = array();
                     foreach ($treads as $tread_id) {
                         if ($tchilds = $this->_tree->getChilds($tread_id)) {
                             $cobjects = array_merge($cobjects, XARRAY::askeyval($tchilds, 'id'));
                         }
                     }
                 }
             }
         }
         if ($cobjects) {
             $params["sl"] ? $offset = strval($params["sl"]) : ($offset = "0");
             $params["asc"] == "DSC" ? $order = '-' : ($order = '');
             $query = 'SELECT * FROM comments WHERE Active=1 AND cid in(' . implode(',', $cobjects) . ') ORDER BY ' . $order . 'date desc LIMIT ' . $offset . ', ' . $params['count'] . ';';
             if ($r = $TDB->get_results($query)) {
                 return $r;
             }
         } else {
             return array();
         }
     }
 }
Exemple #2
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_gallery_list':
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = false;
                 $galleries = $this->_tree->GetChilds(1, 'ASC', 0, 0, '_GALLERY');
                 $sel_galleries = array(array("value" => "", "text" => ""));
                 foreach ($galleries as $gallery) {
                     $node = $this->_tree->GetNodeParam($gallery["id"]);
                     $sel_galleries[] = array("value" => $gallery["id"], "text" => $node["Name"]);
                 }
                 $this->result['action_properties_form']['GalleryStartId'] = $sel_galleries;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers(array('show_gallery_server', 'show_selected_gallery')), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_selected_album':
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = true;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $pppp = $pages->get_page_module_servers('show_search_results');
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_search_results'), 'id', 'params', 'Name'), false, true);
                 $albums = $this->_tree->GetChilds();
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_from_folder':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('gallery');
                 $this->result['xlist'] = false;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $pppp = $pages->get_page_module_servers('show_search_results');
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_search_results'), 'id', 'params', 'Name'), false, true);
                 $albums = $this->_tree->GetChilds();
                 $this->result['action_properties_form']['GalleryStart'] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($this->_tree->GetChilds(1), 'id', 'basic'), $category_selected, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_gallery_server':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('gallery');
                 $this->result['xlist'] = null;
                 $this->result['action_properties_form']['MTemplate'] = $this->get_template_list($this->_module_name, array('.show_selected_album.html'));
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_search_results':
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = false;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array(''));
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
         }
     }
 }
Exemple #3
0
 function load_actions($parameters)
 {
     $this->result['tune_actions']['Action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_actions(), 'front_name'), $parameters['selected'], true);
 }
Exemple #4
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         switch ($parameters['Action']) {
             case 'show_subscribe_form':
                 $this->result['xlist'] = true;
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['news_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_news_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('subscriber_page'), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 break;
             case 'subscriber_page':
                 $albums = $this->_tree->GetChilds();
                 $this->result['action_properties_form']['subscribeStart'] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($this->_tree->GetChilds(1), 'id', 'basic'), $category_selected, true);
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = false;
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['aTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 break;
         }
     }
 }
Exemple #5
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_categories':
                 $this->result['xlist'] = true;
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_faq_server'), 'id', 'params', 'Name'), false, true);
                 $root = $this->_tree->GetChildsParam(1);
                 $this->result['action_properties_form']['folder'] = XHTML::arr_select_opt(XARRAY::askeyval($root, 'Name'), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $files = Common::get_module_template_list($this->_module_name, array('.show_categories.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 break;
             case 'show_folder_questions':
                 $this->result['xlist'] = true;
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_faq_server'), 'id', 'params', 'Name'), false, true);
                 $root = $this->_tree->GetChildsParam(1);
                 $this->result['action_properties_form']['folder'] = XHTML::arr_select_opt(XARRAY::askeyval($root, 'Name'), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 break;
             case 'show_faq_server':
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = false;
                 $files = Common::get_module_template_list($this->_module_name, array('.show_question.html'));
                 $this->result['action_properties_form']['qTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.show_category.html'));
                 $this->result['action_properties_form']['cTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 $root = $this->_tree->GetChildsParam(1);
                 $this->result['action_properties_form']['root'] = XHTML::arr_select_opt(XARRAY::askeyval($root, 'Name'), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_selected_category':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_faq_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['xlist'] = true;
                 $files = Common::get_module_template_list($this->_module_name, array('.show_category.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_faq_search':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_faq_search_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['xlist'] = false;
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_faq_search_server':
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = false;
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['MDestination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_faq_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.show_search_results.html'));
                 $this->result['action_properties_form']['MTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
         }
     }
 }
Exemple #6
0
 function getDiscountScheme($id)
 {
     return XARRAY::arr_to_keyarr(XARRAY::askeyval($this->discount_scheme_tree->GetChildsParam($id, '%', true), 'params'), 'catid', 'discount');
 }
Exemple #7
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_news_by_author':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_news_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.show_news_interval.html', '.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 Common::call_common_instance('users');
                 $users =& users_module_common::getInstance();
                 $this->result['action_properties_form']['author_id'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($users->load_users_list(true), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_news_interval':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_news_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->get_categories('action_properties_form', null, true, 'Category');
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_news_archive':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_news_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.show_news_interval.html', '.' . $parameters['Action'] . '.html'));
                 $this->get_categories('action_properties_form', null, true, 'Category');
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_news_categories':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_news_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['TemplateInterval'] = $this->result['action_properties_form']['Template'];
                 $this->result['action_properties_form']['TemplateSingle'] = $this->result['action_properties_form']['Template'];
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_news_server':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list($this->_module_name, array('.show_news_interval.html', '.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 $this->result['action_properties_form']['MTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
         }
     }
 }
Exemple #8
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_last_comments':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $childs = $this->_tree->GetChildsParam(1, array('Alias'));
                 $childs = XARRAY::askeyval($childs, 'Alias');
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), null, true);
                 $this->result['action_properties_form']['treads'] = XHTML::arr_select_opt($childs, null);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
         }
     }
 }
Exemple #9
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_content':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('content', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 //включает xlist
                 $this->result['xlist'] = true;
                 $this->result['action_template'] = true;
                 $this->lct['action_properties'] = $TMS->parseSection('show_content');
                 break;
             case 'show_content_announce':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('content', array('show_content', '.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['aTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['show_category_with_link_contents_list'] = Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('content_server'), 'id', 'params', 'Name'), false, true);
                 //включает xlist
                 $this->result['xlist'] = true;
                 $this->result['action_template'] = true;
                 $this->lct['action_properties'] = $TMS->parseSection('show_content_announce');
                 break;
             case 'show_contents_list':
                 $this->result['action_properties'] = true;
                 $categories = $this->result['Category'] = $files = Common::get_module_template_list('content', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['xTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Category'] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($this->_tree->GetChilds(1), 'id', 'basic'), false, true);
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('content_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['xlist'] = false;
                 $this->result['action_template'] = true;
                 $this->lct['action_properties'] = $TMS->parseSection('show_contents_list');
                 break;
             case 'show_contentgroups_list':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('content', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('content_server'), 'id', 'params', 'Name'), false, true);
                 //$this->result['xlist']                         =true;
                 $this->lct['action_properties'] = $TMS->parseSection('show_contentgroups_list');
                 break;
             case 'content_server':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list($this->_module_name, array('.show_content.html', '.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['xlist'] = false;
                 $this->result['action_template'] = true;
                 $this->lct['action_properties'] = $TMS->parseSection('content_server');
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 break;
         }
     }
 }
Exemple #10
0
 function select_objects($params)
 {
     if ($params['spack']['endleafs']) {
         $params['spack']['ancestors'][$params['spack']['endleafs']][] = $params['spack']['ancestor']['ancestor'];
         unset($params['spack']['ancestor']['ancestor']);
     }
     if (is_array($params['spack'])) {
         foreach ($params['spack'] as $stype => $svalues) {
             switch ($stype) {
                 case 'to':
                     $svalues = XARRAY::clear_empty_items($svalues);
                     while (list($k, $v) = each($svalues)) {
                         $svalues[$k] = XSTRING::date_recognize($v);
                     }
                     if (!empty($svalues)) {
                         $OM = $this->_tree->Search($svalues, false, false, $OM, '<=');
                         if (empty($OM)) {
                             break 2;
                         }
                     }
                     break;
                 case 'from':
                     $svalues = XARRAY::clear_empty_items($svalues);
                     while (list($k, $v) = each($svalues)) {
                         $svalues[$k] = XSTRING::date_recognize($v);
                     }
                     if (!empty($svalues)) {
                         $OM = $this->_tree->Search($svalues, false, false, $OM, '>=');
                         if (empty($OM)) {
                             break 2;
                         }
                     }
                     break;
                 case 'rlike':
                 case 'rwords':
                 case 'lrlike':
                     $svalues = XARRAY::clear_empty_items($svalues);
                     if ($stype == 'rwords') {
                         $or = 1;
                     } else {
                         $or = 0;
                     }
                     if (!empty($svalues)) {
                         $OMR = $this->_tree->Search($svalues, false, false, null, $stype, null, null, $or);
                         if (!$OM) {
                             $OM = $OMR;
                         } else {
                             $OM = array_intersect($OMR, $OM);
                         }
                         if (empty($OM)) {
                             break 2;
                         }
                     }
                     break;
                 case 'equal':
                     $svalues = XARRAY::clear_empty_items($svalues);
                     if (!empty($svalues)) {
                         $OM = $this->_tree->Search($svalues, false, false, $OM, '=');
                         if (empty($OM)) {
                             break 2;
                         }
                     }
                     break;
                 case 'equalor':
                     $svalues = XARRAY::clear_empty_items($svalues);
                     if (!empty($svalues)) {
                         if (XARRAY::array_depth($svalues) > 1) {
                             foreach ($svalues as $v => $qa) {
                                 foreach ($qa as $c) {
                                     $ZM = $this->_tree->Search(array($v => $c), false, false, $ZM, '=', null, null, true);
                                 }
                             }
                         } else {
                             $ZM = $this->_tree->Search($svalues, false, false, $ZM, '=', null, null, true);
                         }
                         if ($ZM && $OM) {
                             $OM = array_intersect($ZM, $OM);
                         } else {
                             $OM = $ZM;
                         }
                         if (empty($OM)) {
                             break 2;
                         }
                     }
                     break;
                 case 'inchildsall':
                     $svalues = XARRAY::clear_empty_items($svalues);
                     if (!empty($svalues)) {
                         foreach ($svalues['id'] as $sv) {
                             if ($childs = $this->_tree->Search(array('id' => $sv), true, false, null, '=')) {
                                 $childs = XARRAY::askeyval($childs, 'ancestor');
                                 if (!$LOM) {
                                     !($LOM = $childs);
                                 }
                                 $LOM = array_intersect($LOM, $childs);
                             } else {
                                 break 1;
                             }
                         }
                         if ($OM) {
                             $OM = array_intersect($LOM, $OM);
                         }
                         if (empty($OM)) {
                             break 1;
                         }
                     }
                     break;
                 case 'inchilds':
                     $svalues = XARRAY::clear_empty_items($svalues);
                     $stop_level = array_keys($svalues);
                     if (!empty($svalues)) {
                         if ($childs = $this->_tree->Search($svalues, true, false, null, '=')) {
                             $a = XARRAY::askeyval($childs, 'ancestor');
                             if ($OM) {
                                 $OM = array_intersect($a, $OM);
                             }
                         } else {
                             break 3;
                         }
                         if (empty($OM)) {
                             break 2;
                         }
                     }
                     break;
                 case 'ancestors':
                     $svalues = XARRAY::clear_empty_items($svalues);
                     $stop_level = array_keys($svalues);
                     $ancestors = array();
                     $this->_tree->EXPcache = null;
                     if (is_array(!$svalues[$stop_level[0]])) {
                         $ancarr[] = trim($svalues[$stop_level[0]]);
                     } else {
                         $ancarr = $svalues[$stop_level[0]];
                     }
                     if (is_array($ancarr)) {
                         foreach ($ancarr as $anc) {
                             if ($anc) {
                                 $a = $this->_tree->recursiveChildCollectFast($anc, array('_CATGROUP'), 'ASC', $stop_level[0]);
                             }
                             if (is_array($a)) {
                                 $ancestors = array_merge($ancestors, $a);
                             }
                         }
                     } else {
                         $ancestors = $ancarr;
                     }
                     if (is_array($params['spack']['ancestor'])) {
                         $se = array('ancestor' => $ancestors) + $params['spack']['ancestor'];
                     } else {
                         $se = array('ancestor' => $ancestors);
                     }
                     if ($se['ancestor']) {
                         if ($params['spack']['endleafs']) {
                             $SOM = array();
                             $childs = $this->_tree->get_anc_multiply_childs2($se['ancestor'], $se['obj_type']);
                             if ($childs) {
                                 $OM = array_intersect($OM, array_keys($childs));
                             } else {
                                 $OM = null;
                             }
                         } else {
                             $OM = $this->_tree->Search(array('Disable' => ''), false, $se, $OM, '=', false, ' order by s.rate ASC');
                         }
                     }
                     if (empty($OM)) {
                         break 2;
                     }
                     break;
                 case 'ancestor':
                     $svalues = XARRAY::clear_empty_items($svalues);
                     if (!empty($svalues)) {
                         $OM = $this->_tree->Search(null, false, $svalues, $OM, '=', false, ' order by s.rate ASC');
                         if (empty($OM)) {
                             break 1;
                         }
                     }
                     break;
                 case 'sortby':
                     $sortby = XARRAY::clear_empty_items($svalues);
                     break;
                 case 'sort':
                     $sort = XARRAY::clear_empty_items($svalues);
                     break;
             }
         }
         $endpage = $params['startpage'] + $params['Onpage'];
         if (!empty($OM) && is_array($OM)) {
             //убираем отключенные из результатаы
             if ($DOM = $this->_tree->Search(array('Disable' => '1'), false, array('id' => $OM))) {
                 $OM = array_diff($OM, $DOM);
             }
             if ($sortby) {
                 $OM = $this->sortby($OM, $sortby);
             }
             if ($sort) {
                 $OM = $this->sorter($OM, $sort);
             }
             $obj_count = count($OM);
             if ($OM = array_slice($OM, $params['startpage'], $params['Onpage'])) {
                 return array('objects' => $this->_tree->GetNodesByIdArray($OM, 'ASC', true), 'count' => $obj_count);
             }
         }
     }
 }
Exemple #11
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         Common::call_common_instance('pages');
         $pages =& pages_module_common::getInstance();
         if ($this->ishop) {
             $this->result['action_properties_form']['BasketPage'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_ishop_basket'), 'id', 'params', 'Name'), false, true);
             $TMS->parseSection('ishop', true);
         }
         switch ($parameters['Action']) {
             case 'show_level_catmenu':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $this->result['xlist'] = true;
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $this->result['action_properties_form']['Cat_destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 break;
             case 'show_catalog_server':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html', '.show_object.html', '.show_category.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['CategoryTemplate'] = $tpls;
                 $this->result['action_properties_form']['ObjectTemplate'] = $tpls;
                 $this->result['url_point_xlist'] = true;
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_search_results':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['action_properties_form']['ResultTemplate'] = $tpls;
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_search_form':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['SearchTemplate'] = $tpls;
                 $this->result['action_properties_form']['SearchForm'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->search_forms_tree->GetChildsParam(1, '%'), 'Name'), false, true);
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_search_results'), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_smart_search_form':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['SearchTemplate'] = $tpls;
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_search_results'), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_branch_info':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['Template'] = $tpls;
                 $this->result['action_properties_form']['SearchForm'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->search_forms_tree->GetChildsParam(1, '%'), 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'catalog_filter':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['action_properties_form']['FilterTemplate'] = $tpls;
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'catalog_comparsion':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['ComparsionTemplate'] = $tpls;
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_category':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $this->result['xlist'] = true;
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['InnerCategoryTemplate'] = $tpls;
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'catalog_filter_results':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['ResultTemplate'] = $tpls;
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_react_menu':
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = true;
                 $this->result['action_properties_form']['CatObjDestination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
         }
     }
 }
Exemple #12
0
 function get_subgroup_elements($params)
 {
     if ($subgr = $this->_common_obj->get_subgroups($params[0])) {
         $subgr = XARRAY::askeyval($subgr, 'SubNameEng');
         $subgr = array_flip($subgr);
         return $this->_common_obj->property_tree->Search(array('Prop_subgroup' => $subgr[$params[1]]), true, array('ancestor' => $params[0], 'obj_type' => '_PROPERTY'));
     }
 }