private function _getUIconfig($custom)
 {
     $moduleList = array();
     foreach (AppbymeUIDiyModel::getModules() as $module) {
         if (!$custom && $module['type'] == AppbymeUIDiyModel::MODULE_TYPE_CUSTOM) {
             $module['componentList'] = array();
         }
         $moduleList[] = AppUtils::filterModule($module);
     }
     return array('navigation' => AppbymeUIDiyModel::getNavigationInfo(), 'moduleList' => $moduleList);
 }
 private function _getModuleconfig($moduleId)
 {
     $module = array('padding' => '');
     foreach (AppbymeUIDiyModel::getModules() as $tmpModule) {
         if ($tmpModule['id'] == $moduleId) {
             $module = AppUtils::filterModule($tmpModule);
             break;
         }
     }
     return array('module' => $module);
 }
Example #3
0
 public static function filterComponent($component)
 {
     $tempComponent = $component;
     // 临时处理
     if ($component['type'] == AppbymeUIDiyModel::COMPONENT_TYPE_FORUMLIST) {
         $tempComponent['extParams']['forumId'] = 0;
     }
     $tempComponent['style'] = self::_filterStyle($component['style']);
     $tempComponent['extParams']['subListStyle'] = self::_filterStyle($component['extParams']['subListStyle']);
     $tempComponent['extParams']['subDetailViewStyle'] = self::_filterStyle($component['extParams']['subDetailViewStyle']);
     // 转换componentList结构
     $tempComponentList = array();
     if ($tempComponent['style'] == AppbymeUIDiyModel::COMPONENT_STYLE_LAYOUT_NEWS_AUTO && count($tempComponent['componentList']) > 0 && $tempComponent['componentList'][0]['type'] == AppbymeUIDiyModel::COMPONENT_TYPE_NEWSLIST) {
         $newslist = WebUtils::httpRequestAppAPI('portal/newslist', array('moduleId' => $tempComponent['componentList'][0]['extParams']['newsModuleId']));
         if ($newslist = WebUtils::jsonDecode($newslist)) {
             foreach ($newslist['list'] as $key => $value) {
                 $tempParam = array('title' => $value['title'], 'desc' => $value['summary'], 'icon' => $value['pic_path']);
                 if ($value['source_type'] == 'topic') {
                     $tempParam = array_merge($tempParam, array('type' => AppbymeUIDiyModel::COMPONENT_TYPE_POSTLIST, 'extParams' => array('topicId' => $value['source_id'])));
                 } else {
                     if ($value['source_type'] == 'weblink') {
                         $tempParam = array_merge($tempParam, array('type' => AppbymeUIDiyModel::COMPONENT_TYPE_WEBAPP, 'extParams' => array('redirect' => $value['redirectUrl'])));
                     } else {
                         if ($value['source_type'] == 'news') {
                             $tempParam = array_merge($tempParam, array('type' => AppbymeUIDiyModel::COMPONENT_TYPE_NEWSVIEW, 'extParams' => array('articleId' => $value['source_id'])));
                         }
                     }
                 }
                 $tempComponentList[] = array_merge(AppbymeUIDiyModel::initComponent(), $tempParam);
             }
         }
     } else {
         foreach ($tempComponent['componentList'] as $subComponent) {
             $tempComponentList[] = self::filterComponent($subComponent);
         }
     }
     $tempComponent['componentList'] = $tempComponentList;
     return $tempComponent;
 }
Example #4
0
?>
,
        componentInitParams: <?php 
echo WebUtils::jsonEncode(AppbymeUIDiyModel::initComponent(), 'utf-8');
?>
,
        layoutInitParams: <?php 
echo WebUtils::jsonEncode(AppbymeUIDiyModel::initLayout(), 'utf-8');
?>
,
        moduleInitList: <?php 
echo WebUtils::jsonEncode($modules, 'utf-8');
?>
,
        navItemInitParams: <?php 
echo WebUtils::jsonEncode(AppbymeUIDiyModel::initNavItem(), 'utf-8');
?>
,
        navItemInitList: <?php 
echo WebUtils::jsonEncode($navInfo['navItemList'], 'utf-8');
?>
,
    };
    <?php 
$reflect = new ReflectionClass('AppbymeUIDiyModel');
foreach ($reflect->getConstants() as $key => $value) {
    echo "var {$key} = '{$value}';";
}
?>
    var SUBNAV_MAX_COMPONENT_LEN = 4;
    </script>
Example #5
0
 private function _encodeConfig()
 {
     $config = array('version' => AppbymeUIDiyModel::CONFIG_VERSION, 'dataChecksum' => '', 'data' => array('navigation' => AppbymeUIDiyModel::getNavigationInfo(true), 'moduleList' => AppbymeUIDiyModel::getModules(true)));
     $config['dataChecksum'] = md5(WebUtils::jsonEncode($config['data'], 'utf-8'));
     $config = (string) WebUtils::jsonEncode($config, 'utf-8');
     return base64_encode($config);
 }