示例#1
0
 function getTpls_Component($component_id)
 {
     if (!is_numeric($component_id)) {
         return;
     }
     $aAllTpls = tblGetAll(DB_TBL_TPLS);
     $aLinkedTpls = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2TPLS, 'tpl_id', array('tpl_id'));
     //dbg($aLinkedTpls);
     foreach ($aLinkedTpls as $k => $v) {
         $aAllTpls[$v['tpl_id']]['checked'] = 1;
     }
     //dbg($aAllTpls);
     $aClientTpls = array();
     $aAdminTpls = array();
     $aOtherTpls = array();
     $aReturn = array();
     foreach ($aAllTpls as $k => $v) {
         if (!isset($v['checked'])) {
             $v['checked'] = 0;
         }
         unset($v['file_id']);
         unset($v['file_id']);
         if ($v['type'] == 'client') {
             $aClientTpls[] = $v;
         } elseif ($v['type'] == 'admin') {
             $aAdminTpls[] = $v;
         } else {
             $aOtherTpls[] = $v;
         }
     }
     $aReturn = array($aClientTpls, $aAdminTpls, $aOtherTpls);
     return $aReturn;
 }
示例#2
0
        $tplModules->reset();
    }
    $aTpls = tblGetAll(DB_TBL_COMPONENTS2TPLS, "`component_id` = " . $component['id']);
    //dbg($aTpls);
    if (empty($aTpls)) {
        $tplElt->assign('Tpls', 'Нет шаблонов');
    }
    foreach ($aTpls as $template) {
        $template = array_merge($aAllTpls[$template['tpl_id']], $template);
        //dbg($template);
        $tplTpls = $tplElt->fetchBlock('Tpls');
        $tplTpls->assign($template);
        $tplElt->assign('Tpls', $tplTpls);
        $tplTpls->reset();
    }
    $aPages = tblGetAll(DB_TBL_COMPONENTS2PAGES, "`component_id` = " . $component['id']);
    //dbg($aTpls);
    if (empty($aPages)) {
        $tplElt->assign('Pages', 'Нет страниц');
    }
    foreach ($aPages as $page) {
        $page = array_merge($aAllPages[$page['page_id']], $page);
        $tplPages = $tplElt->fetchBlock('Pages');
        $tplPages->assign($page);
        $tplElt->assign('Pages', $tplPages);
        $tplPages->reset();
    }
    $tpl->assign('Elt', $tplElt);
    $tplElt->reset();
}
// OUT