Example #1
0
 public function actionIndex($categoryid = 0, $status = null)
 {
     $where = array();
     if (!empty($categoryid)) {
         $where[] = 'AND';
         $where[] = array('categoryid', '=', $categoryid);
     }
     if (isset($status)) {
         $where[] = 'AND';
         $where[] = array('status', '=', $status);
     }
     $where = array_slice($where, 1);
     $blog = zotop::model('blog.blog');
     $blogs = $blog->db()->where($where)->orderby('order', 'desc')->orderby('updatetime', 'desc')->getPage();
     $blogstatus = $blog->status();
     $category = zotop::model('blog.category');
     $categorys = $category->getAll();
     $categorys = arr::hashmap($categorys, 'id');
     $pagination = new pagination();
     $pagination->page = $blogs['page'];
     $pagination->pagesize = $blogs['pagesize'];
     $pagination->total = $blogs['total'];
     $p = $pagination->render();
     $page = new page();
     $page->set('title', '日志管理');
     $page->set('navbar', $this->navbar($categoryid));
     $page->set('blogs', $blogs);
     $page->set('status', $status);
     $page->set('blogstatus', $blogstatus);
     $page->set('pagination', $p);
     $page->set('categoryid', $categoryid);
     $page->set('categorys', $categorys);
     $page->display();
 }
Example #2
0
 /**
  * 获取已经安装过的模块名称
  *
  */
 public function getInstalled()
 {
     $data = $this->db()->select('*')->orderby(array('order' => 'asc', 'updatetime' => 'desc'))->getAll();
     if (is_array($data)) {
         $modules = arr::hashmap($data, $this->key());
         return $modules;
     }
     return array();
 }
Example #3
0
 public function getAll()
 {
     static $data = array();
     if (empty($data)) {
         $data = $this->db()->orderby('order', 'asc')->getAll();
         $data = arr::hashmap($data, 'id');
     }
     return $data;
 }
Example #4
0
 public function cache($reload = false)
 {
     $name = $this->table();
     $data = zotop::data($name);
     //设置缓存数据
     if ($reload || $data === null) {
         $data = $this->getAll($sql);
         $data = arr::hashmap($data, $this->key());
         if (is_array($data)) {
             zotop::data($name, $data);
         }
     }
     return $data;
 }
Example #5
0
});
</script>
<style type="text/css">
body.dialog {width:700px;}
body.dialog .form-body{height:400px;overflow:auto;}
</style>
<?php 
form::header(array('icon' => 'category', 'title' => zotop::t('新建栏目'), 'description' => zotop::t('新建一个栏目,并设置栏目的名称,模型及相关属性')));
box::header('基本信息');
form::field(array('type' => 'hidden', 'label' => zotop::t('栏目编号'), 'name' => 'id', 'valid' => '', 'description' => zotop::t('')));
form::field(array('type' => 'hidden', 'label' => zotop::t('上级栏目'), 'name' => 'parentid', 'value' => (int) $data['id']));
form::field(array('type' => 'disabled', 'label' => zotop::t('上级栏目'), 'name' => 'parent_name', 'value' => $data['title']));
form::field(array('type' => 'text', 'label' => zotop::t('栏目名称'), 'name' => 'title', 'valid' => 'required:true', 'description' => zotop::t('')));
form::field(array('type' => 'textarea', 'label' => zotop::t('栏目说明'), 'name' => 'description', 'description' => zotop::t('')));
form::field(array('type' => 'select', 'options' => array('' => zotop::t('请选择栏目模型')) + arr::hashmap($models, 'id', 'name'), 'label' => zotop::t('栏目模型'), 'name' => 'modelid', 'class' => 'box', 'valid' => 'required:true', 'value' => $data['modelid']));
box::footer();
box::header('模板设置');
form::field(array('type' => 'template', 'label' => zotop::t('首页模板'), 'name' => 'settings[template_index]', 'id' => 'template_index', 'value' => $data['settings']['template_index'], 'valid' => 'required:true', 'description' => zotop::t('')));
form::field(array('type' => 'template', 'label' => zotop::t('列表页面模板'), 'name' => 'settings[template_list]', 'value' => $data['settings']['template_list'], 'id' => 'template_list', 'valid' => 'required:true', 'description' => zotop::t('')));
form::field(array('type' => 'template', 'label' => zotop::t('详细页面模板'), 'name' => 'settings[template_detail]', 'id' => 'template_detail', 'value' => $data['settings']['template_detail'], 'valid' => 'required:true', 'description' => zotop::t('')));
form::field(array('type' => 'template', 'label' => zotop::t('打印页面模板'), 'name' => 'settings[template_print]', 'id' => 'template_print', 'value' => $data['settings']['template_print'], 'valid' => 'required:true', 'description' => zotop::t('')));
box::footer();
box::header('搜索优化');
form::field(array('type' => 'text', 'label' => zotop::t('栏目标题'), 'name' => 'settings[meta_title]', 'value' => $data['settings']['meta_title'], 'description' => zotop::t('针对搜索引擎设置的标题(meta title)')));
form::field(array('type' => 'text', 'label' => zotop::t('栏目关键词'), 'name' => 'settings[meta_keywords]', 'value' => $data['settings']['meta_keywords'], 'description' => zotop::t('针对搜索引擎设置的关键词(meta keywords)')));
form::field(array('type' => 'text', 'label' => zotop::t('栏目描述'), 'name' => 'settings[meta_description]', 'value' => $data['settings']['meta_description'], 'description' => zotop::t('针对搜索引擎设置的网页描述(meta description)')));
box::footer();
form::buttons(array('type' => 'submit', 'value' => '保存'), array('type' => 'button', 'value' => '关闭', 'class' => 'zotop-dialog-close'));
form::footer();
$this->bottom();
Example #6
0
<?php

$this->header();
$this->top();
$this->navbar();
form::header();
form::field(array('type' => 'hidden', 'label' => zotop::t('日志编号'), 'name' => 'id', 'value' => $data['id'], 'description' => zotop::t('')));
form::field(array('type' => 'html', 'label' => '', 'name' => 'option', 'value' => ' ' . html::checkbox(array('name' => 'link', 'label' => zotop::t('转向链接'), 'value' => '1', 'checked' => (bool) $data['link'])) . ' '));
form::field(array('type' => 'title', 'label' => zotop::t('日志标题'), 'name' => 'title', 'class' => 'long', 'value' => $data['title'], 'style' => $data['style'], 'valid' => 'required:true', 'description' => zotop::t('')));
form::field(array('type' => 'image', 'label' => zotop::t('标题图片'), 'name' => 'image', 'class' => 'long', 'value' => $data['image'], 'description' => zotop::t('')));
form::field(array('type' => 'text', 'label' => zotop::t('转向链接'), 'name' => 'url', 'class' => 'long', 'value' => $data['url'], 'display' => 'none', 'description' => zotop::t('填写此项后,页面将直接跳转到链接地址页面,链接地址必须以<b>http://</b>开头')));
form::field(array('type' => 'editor', 'label' => zotop::t('日志内容'), 'name' => 'content', 'class' => 'long', 'value' => $data['content']));
form::field(array('type' => 'textarea', 'label' => zotop::t('日志摘要'), 'name' => 'description', 'class' => 'long', 'value' => $data['description'], 'valid' => 'maxlength:255', 'description' => zotop::t('')));
form::field(array('type' => 'keywords', 'label' => zotop::t('日志标签'), 'name' => 'keywords', 'class' => 'long', 'value' => $data['keywords'], 'valid' => '', 'description' => zotop::t('多个标签请用空格分开')));
form::field(array('type' => 'select', 'options' => arr::hashmap($categorys, 'id', 'title'), 'label' => zotop::t('日志类别'), 'name' => 'categoryid', 'value' => (int) $data['categoryid'], 'valid' => 'required:true', 'description' => zotop::t('')));
block::header(array('title' => '<span class="zotop-icon"></span>高级设置', 'class' => 'collapsed'));
form::field(array('type' => 'text', 'label' => zotop::t('日志权重'), 'name' => 'order', 'value' => (int) $data['order'], 'valid' => 'required:true,number:true', 'description' => zotop::t('日志权重参数,数字较大者排在较前位置')));
form::field(array('type' => 'radio', 'options' => $status, 'label' => zotop::t('日志状态'), 'name' => 'status', 'value' => (int) $data['status'], 'description' => zotop::t('')));
form::field(array('type' => 'radio', 'options' => array(0 => '允许评论', -1 => '禁止评论'), 'label' => zotop::t('日志评论'), 'name' => 'comment', 'value' => (int) $data['comment'], 'description' => zotop::t('')));
block::footer();
form::buttons(array('type' => 'submit', 'value' => '保存'), array('type' => 'back'));
form::footer();
?>
<script type="text/javascript">
//转向链接
$(function(){	
	showlink($("input[name=link]").is(":checked"));
	$("input[name=link]").click(function(){
		showlink($(this).is(":checked"))														 
	})   
})
Example #7
0
 public function getAll()
 {
     $data = $this->db()->orderby('order', 'asc')->getAll();
     $data = arr::hashmap($data, 'id');
     return $data;
 }
Example #8
0
 public function cache($reload = false)
 {
     $data = $this->db()->select('id', 'value')->getAll();
     $data = arr::hashmap($data, 'id', 'value');
     zotop::data('config', $data);
     zotop::reboot();
     return $data;
 }
Example #9
0
    $column['select'] = html::checkbox(array('name' => 'id[]', 'value' => $blog['id'], 'class' => 'select'));
    $column['w30 center'] = '<span title="' . $blogstatus[$blog['status']] . '" class="zotop-icon zotop-icon-status' . $blog['status'] . '"></span>';
    $column['order w30 center'] = empty($blog['order']) ? '0' : '<b class="red">' . $blog['order'] . '</b>';
    $column['title'] = '<b' . (empty($blog['style']) ? '' : ' style="' . $blog['style'] . '"') . '>' . $blog['title'] . '</b>';
    $column['title'] .= '<h5>';
    $column['title'] .= '<a href="' . zotop::url('site://blog/index/view', array('id' => $blog['id'])) . '" target="_blank">查看</a>';
    $column['title'] .= '&nbsp;<a href="' . zotop::url('blog/index/edit', array('id' => $blog['id'])) . '">编辑</a>';
    $column['title'] .= '&nbsp;<a href="' . zotop::url('blog/index/delete', array('id' => $blog['id'])) . '" class="confirm">删除</a>';
    $column['title'] .= '</h5>';
    $column['categoryid w50'] = '<div class="w60 textflow" title="' . $categorys[$blog['categoryid']]['title'] . '">' . $categorys[$blog['categoryid']]['title'] . '</div>';
    $column['comment w30 center'] = empty($blog['comment']) ? '0' : '<b class="red">' . $blog['comment'] . '</b>';
    $column['atime w120'] = '' . time::format($blog['updatetime']) . '';
    table::row($column);
}
table::footer();
form::buttons(array('type' => 'select', 'name' => 'operation', 'id' => 'operation', 'class' => 'short', 'options' => array('status100' => $blogstatus['100'], 'status0' => $blogstatus['0'], 'status-1' => $blogstatus['-1'], 'status-50' => $blogstatus['-50'], 'order' => '权重->', 'move' => '移动->', 'delete' => '永久删除')), array('type' => 'text', 'name' => 'order', 'id' => 'order', 'value' => '50', 'title' => '权重参数,必须是数字', 'style' => 'width:30px;padding:4px;display:none;'), array('type' => 'select', 'options' => arr::hashmap($categorys, 'id', 'title'), 'name' => 'categoryid', 'id' => 'categoryid', 'value' => $categoryid, 'class' => 'short', 'style' => 'display:none;'), array('type' => 'submit', 'value' => '执行操作'));
form::footer($pagination);
$this->bottom();
$this->mainFooter();
$this->sideHeader();
?>

<?php 
block::header(array('title' => '日志分类', 'action' => '<a href="' . zotop::url('blog/category/index') . '" class="dialog">管理</a><a href="' . zotop::url('blog/category/add', array('referer' => url::encode(url::location()))) . '" class="dialog">添加</a>'));
?>
<div class="navbarlist">
	<ul>
		<li<?php 
echo empty($categoryid) ? ' class="selected"' : '';
?>
><a href="<?php 
Example #10
0
 public function getAll()
 {
     $this->_category = $this->db()->where('status', '>', 0)->orderby('order', 'asc')->getAll();
     $this->_category = arr::hashmap($this->_category, 'id');
     return $this->_category;
 }