public function action_imagelist() { $query = Model_Board::query()->select("id"); $bbsCount = $query->count(); //ページネーション $pConfig = array('pagination_url' => 'admin/imagelist/', 'uri_segment' => 3, 'num_links' => 2, 'per_page' => 3, 'total_items' => $bbsCount, 'show_first' => true, 'show_last' => true, 'name' => 'bootstrap3'); $pagiNation = Pagination::forge('adminPagination', $pConfig); $query2 = Model_Board::query(); $query2->rows_offset($pagiNation->offset); $query2->rows_limit($pagiNation->per_page); $query2->order_by('id', 'desc'); $data['bbss'] = $query2->get(); $query3 = Model_Attach::query(); $query3->select('id', 'bbsId', 'mime'); foreach ($data['bbss'] as $bbs) { $query3->or_where_open(); $query3->where('bbsId', '=', $bbs->id); $query3->or_where_close(); } $query3->order_by('id', 'desc'); $data['attaches'] = $query3->get(); $this->template->boardDescription = '画像一覧'; $content = View::forge('admin/imglist', $data); $content->set_safe('pagination', $pagiNation); $this->template->content = $content; }
public function action_index($pr1 = null, $pr2 = null) { //パラメータが付いていた場合はリダイレクト if ($pr1 != null || $pr2 != null) { return Response::forge(Uri::base()); } $msg = Session::get('errorMsg'); Session::delete('errorMsg'); /* //ログインフォーム作成 $loginFieldSet = Fieldset::forge('loginForm'); $loginFieldSet->add('username','',array('type'=>'text','size'=>20)); $loginFieldSet->add('password','',array('type'=>'password','size'=>20)); $loginFieldSet->repopulate(); //送信ボタン追加 $loginFieldSet->add('submit','',array('type'=>'submit','width'=>80,'value'=>' ログイン ')); */ $content = ''; if (Agent::is_mobiledevice()) { $content = View::forge('index/index_mobile'); } else { $content = View::forge('index/index_pc'); } //掲示板全体の最新画像 $query = Model_Attach::query(); $query->select('id', 'bbsId'); $query->limit(12); $query->order_by('created_at', 'desc'); $images = $query->get(); //最新の書き込み掲示板(10個) $query2 = Model_Board::query(); $query2->select('id', 'shortName', 'title', 'updated_at'); $query2->limit(10); $query2->order_by('updated_at', 'desc'); $update = $query2->get(); //投稿数順 Model_Board::clear_cache(); $query3 = Model_Board::query(); $query3->select('id', 'shortName', 'title', 'postCount'); $query3->limit(10); $query3->order_by('postCount', 'desc'); $postCount = $query3->get(); $this->setBoardTitle(); // $content->set('loginForm',$loginFieldSet->build('index/login'),false); $content->set('newestImages', $images); $content->set('updateBoards', $update); $content->set('postCount', $postCount); //エラーメッセージ設定 if ($msg != null) { $content->set('msg', $msg, false); } $this->template->content = $content; }
public static function run() { $stmp = new \vendor\sitemap() - php\Sitemap(BASE); \Fuel\Core\Debug::dump($stmp); $stmp->setPath('../../public/sitemap/'); // $stmp->setFilename("sitemap"); //全掲示板を取得 $boards = \Model_Board::find('all'); if (count($boards) == 0) { die; } foreach ($boards as $board) { //掲示板を追加 // $stmp->addItem('/bbs/index/'.$board->shortName,"1.0","daily",date("Y/m/d H:i:s",$board->updated_at)); } // $stmp->createSitemapIndex(BASE.'/sitemap/', "Today"); }
/** * $oldPostからModel_Boardを復元(バリデーションエラー時の復元用) * @param type $oldPost 投稿データ * @return type */ public function getOldPostedData($oldPost) { if ($oldPost == null) { return null; } $oldAr = Model_Board::forge(); $oldAr->shortName = $oldPost['shortName']; $oldAr->title = $oldPost['title']; $oldAr->type = $oldPost['type']; $oldAr->description = $oldPost['description']; $oldAr->keywords = $oldPost['keywords']; $oldAr->allowRes = $oldPost['allowRes']; $oldAr->allowAttach = $oldPost['allowAttach']; $oldAr->adArea1 = $oldPost['adArea1']; $oldAr->adArea2 = $oldPost['adArea2']; $oldAr->adAreaMobile1 = $oldPost['adAreaMobile1']; $oldAr->adAreaMobile2 = $oldPost['adAreaMobile2']; $oldAr->allowXvideos = $oldPost['allowXvideos']; return $oldAr; }
echo '<a href = \'/bbs/index/' . $bd->shortName . '\'>' . $bd->title . '</a><BR>'; } echo '</div>'; } } ?> <?php if (isset($newestImages)) { if ($newestImages != null) { echo '<div id =\'newestImages\'>'; echo '<h3 class=\'title1\'>掲示板全体の最新画像</h3><BR>'; foreach ($newestImages as $at) { $query = Model_Board::query(); $query->select('id', 'shortName', 'title'); $query->where('id', '=', $at->bbsId); $bd = $query->get_one(); // Fuel\Core\Debug::dump($bd); echo '<div id = \'imageBox\'>'; echo '<div id = \'imageLink\'>'; echo '<a href=\'bbs/index' . DS . $bd->shortName . '\'>' . $bd->title . '</a>'; echo '</div>'; echo '<div id = \'thumbImage\'>'; echo '<img src =\'/imgLoader/thumbnail/' . $at->id . '\' width=100> '; echo '</div>'; echo '</div>'; } echo '</div>'; }
/** * ShortNameから掲示板(Model_Boardオブジェクト)を得る * @param type $shortName 掲示板shortName * @return type Model_Board */ public function getBoardFromShortName($shortName) { if ($shortName === null) { return null; } //Boardを取得 $query = Model_Board::query()->where('shortName', $shortName); $board = $query->get_one(); return $board; }
<?php if (isset($imgId) && isset($shortName)) { //掲示板を取得 $query = Model_Board::query()->where('shortName', $shortName); $board = $query->get_one(); if ($board == null) { echo 'パラメータ異常'; return; } //画像のbbsIDを確認 $img = Model_Attach::find($imgId); if ($img == null) { echo 'パラメータ異常'; return; } if ($img->bbsId != $board->id) { echo 'パラメータ異常'; return; } if (Auth::check()) { if ($board->userId == Auth::get('id')) { echo '<img src =\'/imgLoader/thumbnail/' . $imgId . '\' width=100/><BR>'; echo '<BR>'; echo '管理者権限で画像を削除しますか?<BR>'; echo '<div id=\'redBox\'> <a href = \'' . Uri::current() . '?mode=delete\'>削除</a></div>'; echo '<div id=\'shortBox\'> <a href = \'' . $backURL . '\'>キャンセル</a></div>'; echo '<BR>'; echo '<BR>'; return; }