public function actionSide() { $m = array(); $modules = (array) zotop::modules(); foreach ($modules as $module) { if ($module['type'] == 'com') { $module['href'] = zotop::url($module['id']); $m[$module['id']] = $module; } } $page = new side(); $page->set('modules', $page->navlist($m)); $page->display(); }
public function actionSide() { $modules = (array) zotop::modules(); foreach ($modules as $id => $module) { if ($module['type'] != 'com') { unset($modules[$id]); } else { $modules[$id]['href'] = zotop::url($module['id']); } } $page = new side(); $page->title = '系统控制面板'; $page->set('modules', $modules); $page->display(); }
function xheditor($attrs) { $attrs['class'] = isset($attrs['class']) ? 'editor ' . $attrs['class'] : 'editor'; $tools = array('image' => '<a href="' . zotop::url('zotop/image/upload', array('globalid' => form::globalid(), 'field' => $attrs['name'], 'image' => '__image__')) . '" class="button editor-insert" name="' . $attrs['name'] . '" type="image"><span class="zotop-icon zotop-icon-imageuploader button-icon"></span><span class="button-text">插入本地图片</span></a>', 'file' => '<a href="' . zotop::url('zotop/file/upload', array('globalid' => form::globalid(), 'field' => $attrs['name'], 'image' => '__file__')) . '" class="button editor-insert" name="' . $attrs['name'] . '" type="file"><span class="zotop-icon zotop-icon-fileuploader button-icon"></span><span class="button-text">插入本地文件</span></a>', 'template' => '<a href="' . zotop::url('zotop/file/upload', array('globalid' => form::globalid(), 'field' => $attrs['name'], 'image' => '__file__')) . '" class="button editor-insert" name="' . $attrs['name'] . '" type="template"><span class="zotop-icon zotop-icon-template button-icon"></span><span class="button-text">插入模板</span></a>'); $tools = zotop::filter('editor.tools', $tools); $tools = arr::take('tools', $attrs) === false ? array() : $tools; $url = zotop::modules('xheditor', 'url'); $html[] = html::script($url . '/editor/xheditor-zh-cn.min.js'); $html[] = html::script($url . '/common/global.js'); if (is_array($tools) && !empty($tools)) { $html[] = '<div class="field-toolbar">'; foreach ($tools as $tool) { $html[] = ' ' . $tool; } $html[] = '</div>'; } $html[] = '<div class="field-wrapper">'; $html[] = ' ' . field::textarea($attrs); $html[] = '</div>'; return implode("\n", $html); }
/** * 应用程序执行 * * * @return null */ public static function execute() { if (zotop::modules(ZOTOP_MODULE) === null || (int) zotop::modules(ZOTOP_MODULE, 'status') < 0) { msg::error(array('title' => '404 error', 'content' => zotop::t('<h2>未能找到模块,模块可能尚未安装或者已经被禁用?</h2>'), 'detail' => zotop::t('模块名称:{$module}', array('module' => ZOTOP_MODULE)))); } //controller classname $controllerName = ZOTOP_MODULE . '_controller_' . ZOTOP_CONTROLLER; $controllerPath = ZOTOP_MODULE_PATH . DS . ZOTOP_GROUP . DS . ZOTOP_CONTROLLER . '.php'; if (!class_exists($controllerName, false)) { if (!zotop::load($controllerPath)) { msg::error(array('title' => '404 error', 'content' => zotop::t('<h2>未能找到控制器,请检查控制器文件是否存在?</h2>'), 'detail' => zotop::t('文件名称:{$file}', array('file' => $controllerPath)))); } } if (class_exists($controllerName, false)) { //实例化控制器 $controller = new $controllerName(); //调用__execute方法 $controller->execute(ZOTOP_ACTION, application::arguments()); } else { msg::error(array('title' => '404 error', 'content' => zotop::t('<h2>未能找到控制器类,请检查控制器文件中是否存在控制器类?</h2>'), 'detail' => zotop::t('类名称:{$className}', array('className' => $controllerName)))); } }
/** * 用于实例化一个模型{module}.{model},如 zotop.user,实例化系统模块的user模型 * * * @param $name 模型名称空间 * @return object(model) */ public static function model($name = '') { static $models = array(); if (empty($name)) { return new model(); } if (isset($models[$name])) { return $models[$name]; } list($module, $model) = explode('.', $name); $modelName = $module . '_model_' . $model; if (!class_exists($modelName)) { $modelPath = zotop::modules($module, 'path') . DS . 'models' . DS . $model . '.php'; if (zotop::load($modelPath) == false) { zotop::error(array('content' => zotop::t('请检查相应的模型文件是否存在'), 'detail' => zotop::t('文件地址:{$modelPath}', array('modelPath' => $modelPath)))); } } if (class_exists($modelName)) { $m = new $modelName(); $models[$name] = $m; return $m; } zotop::error(array('content' => zotop::t('请检查相应的模型文件中是否存在模型类 :{$modelName}', array('modelPath' => $modelPath, 'modelName' => $modelName)), 'detail' => zotop::t('文件地址:{$modelPath}', array('modelPath' => $modelPath, 'modelName' => $modelName)))); }
block::footer(); ?> <?php block::header(array('title' => zotop::modules('blog', 'name'))); ?> <table class="table"> <tr><td><?php echo zotop::modules('blog', 'description'); ?> </td></tr> <tr><td>版本:<?php echo zotop::modules('blog', 'version'); ?> </td></tr> <tr><td>作者:<?php echo zotop::modules('blog', 'author'); ?> </td></tr> <tr><td>主页:<?php echo html::a(zotop::modules('blog', 'homepage')); ?> </td></tr> </table> <?php block::footer(); ?> <?php $this->sideFooter(); $this->footer();