Exemplo n.º 1
0
 public function start($formName)
 {
     $array = array("class" => "form-horizontal", "role" => "form", "enctype" => "multipart/form-data");
     $this->init($formName, '/index.php?m=admin&c=article&a=save', '', $array);
     $array = array("class" => "form-control", "placeholder" => "NAME");
     $this->setText("title", "", $array, array('datatype' => '*2-24'));
     $this->setText("id", "", $array, array('datatype' => 'n1-8'), "hidden");
     $array = array("class" => "form-control", "placeholder" => date("Y-m-d H:i:s"), "disabled" => "disabled");
     $this->setText("time", "", $array, array(), "text", 0, 3);
     $array = array("class" => "form-control");
     $this->setUeditor("content", "", $array);
     $array = array("class" => "form-control", "id" => "tags", "placeholder" => "日志标签,逗号或空格分隔");
     $this->setText("tag", "", $array, array('datatype' => '*0-256'), "text", 0, 6);
     $array = array("class" => "form-control");
     $menu = new \Admin\Model\articleModel();
     $data = $menu->getCategory();
     $this->setSelect("category", "", $array, $data, 3, 3);
     $array = array("class" => "form-control", "style" => "height:200px");
     $this->setUeditor("excerpt", "", $array);
     $array = array("class" => "form-control");
     $this->setText("password", "访问密码", $array, array('datatype' => '*0-24'), "text", 1, 3);
     $array = array("class" => "form-control");
     $this->setText("thumbnail", "", $array, array(), "file", 1, 3);
     $array = array("class" => "make-switch", "data-on-color" => "primary", "data-off-color" => "info");
     $this->setBsCheckBox("istop", "是否置顶", $array);
     $this->setBsCheckBox("allow_comment", "允许评论", $array);
 }
Exemplo n.º 2
0
 /**
  * 日志列表
  */
 public function listAction()
 {
     //检测标签 组合where
     $class = get("class", "int");
     $tags = get("tags", "txt");
     $member = get("member", "int");
     $where = array();
     if ($class) {
         $where['category'] = $class;
     }
     if ($member) {
         $where['member_id'] = $member;
     }
     if ($tags) {
         $tags = db()->table('article_tag')->getAll(array("tagname?LIKE" => "%{$tags}%"))->order('id')->done();
         $tid = array();
         //获取文章id
         foreach ($tags as $v) {
             $arr = explode(",", $v['gid']);
             $tid = array_unique(array_merge($tid, $arr));
         }
         $tid = implode(',', $tid);
         $where['id?in'] = $tid;
     }
     $where['status'] = \Admin\Article\Type\Status::STATUS_ENABLE;
     $all = db()->Table('article')->getAll($where)->done();
     //getAll
     $this->getView()->assign(array('articleAll' => $all));
     //获取分类
     $menu = new \Admin\Model\articleModel();
     $category = $menu->getCategory();
     //获取标签
     $tag = new \Admin\Model\articleModel();
     $tags = $tag->getTags();
     //获取作者
     $member = new \Member\Model\memberModel();
     $author = $member->getAuthor();
     $this->getView()->assign(array('tags' => $tags, 'category' => $category, 'author' => $author));
     return $this->getView()->display();
 }