示例#1
0
function getTableList($component_name, $state)
{
    global $smarty;
    inc_lib('AdminInterface/UnitAdminInterface.php');
    $_GET['state'] = $state;
    $objResponse = new xajaxResponse();
    if (CUtils::_sessionVar('user')) {
        $ocomponent = $GLOBALS['rtti']->getComponent($component_name);
        if (inc_u($component_name)) {
            $className = ucfirst($component_name) . 'Unit';
            $unit = new $className();
        } else {
            inc_lib('components/Unit.php');
            $unit = new Unit($component_name);
        }
        $uai = new UnitAdminInterface($unit, '', array());
        $text = $uai->getTableMenu();
        $objResponse->assign('tableMenu_' . $component_name, 'innerHTML', $text);
        $objResponse->script("showDiv('tableMenu_" . $component_name . "', 0, 0);");
        $objResponse->script("hideDiv('waiting');");
    } else {
        $objResponse->script("alert('Ошибка сессии');");
    }
    return $objResponse;
}
示例#2
0
/**
 * Smarty {raVote} function plugin
 *
 * Type:     function<br>
 * Name:     raVote<br>
 * Purpose:  initialize overlib
 * @author   Roman Alyakrytskiy
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_raVote($params, &$smarty)
{
    global $urlprops;
    $urlprops['action'] = 'form';
    $urlprops['frmname'] = empty($params['name']) ? '' : $params['name'];
    inc_u('vote');
    $unit = new VoteUnit($urlprops);
    return $unit->getBody();
}
示例#3
0
function showOrderDetail($order_id)
{
    inc_u('cart');
    $cart = new CartUnit($GLOBALS['urlprops']);
    $text = $cart->getOrderDetail($order_id);
    $objResponse = new xajaxResponse();
    $objResponse->assign('popup_content', 'innerHTML', $text);
    $objResponse->script("popUp('popup')");
    return $objResponse;
}
示例#4
0
/**
 * Smarty {raForm} function plugin
 *
 * Type:     function<br>
 * Name:     raForm<br>
 * Purpose:  initialize overlib
 * @author   Roman Alyakrytskiy
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_raForm($params, &$smarty)
{
    if (empty($params['name'])) {
        $smarty->trigger_error('raForm: Не указан параметр: name');
    } else {
        inc_u('forms');
        $unit = new FormsUnit(array());
        return $unit->getForm("name='" . $params['name'] . "'", $params);
    }
}
示例#5
0
 protected function addUnit($u, $users)
 {
     global $PRJ_DIR, $THEME_REF;
     if (($u['ctype'] == 'S' || $u['name'] == 'meta' || $u['name'] == 'tree') && !inc_u($u['name'])) {
         CUtils::raiseError('Not exists component: ' . $u['name'], ERROR_DIE);
     }
     $className = ucfirst($u['name']) . 'Unit';
     $unit = inc_u($u['name']) ? new $className() : new Unit($u['name']);
     $this->units[$u['name']] = new UnitAdminInterface($unit, $u['title'], $users);
 }
示例#6
0
 function __construct($props = array())
 {
     parent::__construct('tree', $props);
     if (!empty($this->props['node']['module_id_name']) && $this->props['node']['module_id_name'] != 'tree') {
         if (inc_u($this->props['node']['module_id_name'])) {
             $unitName = ucfirst($this->props['node']['module_id_name']) . 'Unit';
             $this->subunit = new $unitName($this->props);
             $this->subunit_service = true;
         } else {
             $this->subunit = new Unit($this->props['node']['module_id_name'], $this->props);
             $this->subunit_service = false;
         }
     }
 }
示例#7
0
 function getResults($text)
 {
     $ret = array();
     $props = $this->props;
     $trees = $GLOBALS['utree']->tables['tree']->getArraysWhere("publish='on' AND module_id<>0");
     if (is_array($trees)) {
         foreach ($trees as $tr) {
             if (!empty($tr['module_id_name'])) {
                 $props['dir_uri'] = $props['uri'] = $tr['name'];
                 $props['dir_id'] = $tr['id'];
                 if (inc_u($tr['module_id_name'])) {
                     $moduleName = ucfirst($tr['module_id_name']) . 'Unit';
                     $unit = new $moduleName($props);
                     $results = $unit->getSearchResults($text);
                     foreach ($results as $a) {
                         $ret[] = $a;
                     }
                 } else {
                     $unit = new Unit($tr['module_id_name'], $props);
                     foreach ($unit->tables as $t) {
                         if (!$t->props['is_search']) {
                             continue;
                         }
                         $results = $unit->getTableSearchResults($text, $t->name, "publish='on'", $t->props['search_prefix']);
                         foreach ($results as $a) {
                             $ret[] = $a;
                         }
                     }
                 }
             }
         }
         $results = $GLOBALS['utree']->getSearchResults($text);
         foreach ($results as $a) {
             $ret[] = $a;
         }
     }
     return $ret;
 }
示例#8
0
    }
    $GLOBALS['smarty']->assign('slang', $GLOBALS['urlprops']['lang']);
    $GLOBALS['smarty']->assign('urlprops', $GLOBALS['urlprops']);
    if (!stristr($_SERVER['REQUEST_URI'], '/admin')) {
        /*if ((isset($GLOBALS['urlprops']['node'])) && $GLOBALS['urlprops']['node']['id'] == 82 && $GLOBALS['urlprops']['method'] == 'index') {
        			$cat = $GLOBALS['db']->getItem('get_cat',"SELECT id,filters FROM catalog_categories WHERE id=".$GLOBALS['urlprops']['params'][0]);
        			$filters = $GLOBALS['db']->getItems('get_filters', "SELECT id FROM catalog_features WHERE id IN(".$cat['filters'].")");
        			$filters_values = array();
        			foreach($filters as $filter) {
        				if(isset($_GET['filter_'.$filter['id']])) {
        					$filters_values[$filter['id']] = CUtils::_getVar('filter_'.$filter['id'], true);
        				}
        			}
        			$GLOBALS['smarty']->assign('filters_values2', $filters_values);
        		}*/
        inc_u('tree');
        $GLOBALS['utree'] = new TreeUnit($GLOBALS['urlprops']);
        inc_u('auth');
        $GLOBALS['uauth'] = new AuthUnit($GLOBALS['urlprops']);
        if (isset($GLOBALS['urlprops']['node']['id'])) {
            $GLOBALS['smarty']->assign('dirs', $GLOBALS['utree']->tables['tree']->getPrev($GLOBALS['urlprops']['node']['id']));
        }
        if (isset($GLOBALS['urlprops']['params'][0])) {
            $GLOBALS['smarty']->assign('cats_tree', $GLOBALS['rtti']->getPrev('catalog_categories', $GLOBALS['urlprops']['params'][0]));
        }
        $GLOBALS['smarty']->assign('mail_to', $ADMIN_EMAIL);
        $GLOBALS['smarty']->assign('utree', $GLOBALS['utree']);
        $GLOBALS['smarty']->assign('uauth', $GLOBALS['uauth']);
        //var_dump($GLOBALS['urlprops']);
    }
}
示例#9
0
 function callMethodInstance($aMethod, $aParams)
 {
     global $PRJ_DIR;
     if ($aMethod['module_id_name'] != 'tree') {
         if (inc_u($aMethod['module_id_name'])) {
             $cCls = ucfirst($aMethod['module_id_name']) . 'Unit';
             $unit = new $cCls($GLOBALS['urlprops']);
         } else {
             inc_lib('components/Unit.php');
             $unit = new Unit($aMethod['module_id_name'], $GLOBALS['urlprops']);
         }
         $tpl = $unit->smarty;
         $tpl->assign('settings', $unit->dbparams);
         $tpl->assign('unit', $unit);
         $tpl->assign('ref', '/' . $GLOBALS['urlprops']['uri'] . '/');
     } else {
         global $smarty;
         $tpl = $smarty;
     }
     /*if (!empty($methodInstance['processor']) && file_exists($PRJ_DIR.$methodInstance['processor'])) {
     			require_once($PRJ_DIR.$methodInstance['processor']);
     		}*/
     if ($aMethod['template'] && file_exists($PRJ_DIR . $aMethod['template'])) {
         if ($aMethod['module_id_name'] == 'tree' && $aMethod['name'] == 'index' && !count($aParams)) {
             $aParams[] = '/';
         }
         foreach ($aParams as $iKey => $mParam) {
             $tpl->assign('param' . $iKey, $mParam);
         }
         $tpl->assign('cname', $aMethod['module_id_name']);
         $tpl->assign('mname', $aMethod['name']);
         return $tpl->fetch($PRJ_DIR . $aMethod['template']);
     } else {
         throw new Exception('Method template error: ' . $aMethod['module_id_name'] . '.' . $aMethod['name'] . '. <a href="/">Mainpage</a>');
     }
 }