コード例 #1
0
ファイル: IndexAction.class.php プロジェクト: cjmi/miniblog
 public function index()
 {
     import("ORG.Util.Page");
     $now = date("Y-m-d");
     $db = new WorldsModel();
     $count['total'] = $db->count();
     //总条数
     $count['new'] = $db->where("substring(time,1,10)='{$now}'")->count();
     //今日更新条数
     $page = new Page($db->count(), 5);
     $rs = $db->relation(true)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
     $this->assign('count', $count);
     $this->assign('rs', $rs);
     $this->assign('page_nav', $page->show());
     $this->display();
 }
コード例 #2
0
ファイル: WorldsAction.class.php プロジェクト: cjmi/miniblog
 public function view()
 {
     $db = new WorldsModel();
     $map['id'] = $_GET['id'];
     $count['total'] = $db->count();
     //微薄总数
     $count['new'] = $db->where("substring(time,1,10)='{$now}'")->count();
     //竟日更新条数
     $rs = $db->where($map)->relation(true)->select();
     if ($map == '' or $rs == '') {
         $this->error("非法操作1!");
     }
     $this->assign('world', $rs);
     $this->assign('count', $count);
     $this->display("Index:viewWorld");
 }
コード例 #3
0
ファイル: IndexAction.class.php プロジェクト: cjmi/miniblog
 public function index()
 {
     import("ORG.Util.Page");
     $now = date("Y-m-d");
     $db = new WorldsModel();
     $count['total'] = $db->count();
     //总条数
     $count['new'] = $db->where("substring(time,1,10)='{$now}'")->count();
     //今日更新条数
     $page = new page($count['total'], 10);
     $page->setConfig('header', '条微博');
     $world = $db->relation(true)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
     $this->assign('count', $count);
     $this->assign('world', $world);
     $this->assign('page_nav', $page->show());
     $me = $this->getConfig('screen_name') + $this->getConfig('sex') + $this->getConfig('location') + $this->getConfig('profession');
     $me += $this->getConfig('qq_js') + $this->getConfig('self_introduction');
     $this->assign('me', $me);
     $this->display();
 }
コード例 #4
0
ファイル: WorldsAction.class.php プロジェクト: cjmi/miniblog
 public function view()
 {
     $db = new WorldsModel();
     $map['id'] = isset($_GET['id']) ? (int) $_GET['id'] : null;
     if ($map['id'] == null) {
         $this->error('非法操作');
         exit;
     }
     $data = array('last_time' => null);
     $db->where($map)->save($data);
     $count['total'] = $db->count();
     //微薄总数
     $count['new'] = $db->where("substring(time,1,10)='{$now}'")->count();
     //竟日更新条数
     $rs = $db->where($map)->relation(true)->select();
     if ($rs === null || $rs === false) {
         $this->error("你查看的内容不存在或者已经被管理员删除!");
     }
     $this->assign('world', $rs);
     $this->assign('count', $count);
     $this->display("Index:viewWorld");
     //echo $db->getLastSql();
 }