コード例 #1
0
ファイル: postlookup.php プロジェクト: akmnhm/tabi_log
 public function action_itta($pid)
 {
     $this->template->title = "旅ログ";
     $ret = Model_Members_General::getPostHeader($pid);
     $first = array_shift($ret);
     $first['itta'] = Model_Members_General::countItta($pid);
     $first['ikitai'] = Model_Members_General::countIkitai($pid);
     $first['users'] = Model_Members_General::getUsersitta($pid);
     $first['revnum'] = Model_Members_General::countReview($pid);
     $first['count'] = 0;
     $first['msg'] = $this->msg;
     $first['ikitaiflag'] = false;
     $this->template->content = View::forge('members/postlookupusrs', $first);
 }
コード例 #2
0
ファイル: giver.php プロジェクト: akmnhm/tabi_log
 public function action_search($lex)
 {
     $table = array('prefposts' => "都道府県", 'cate' => "カテゴリ", 't1' => "タグ", 't2' => "タグ", 'rate' => "評価値", 'ikitai' => "行きたい人数", 'itta' => "行った人数", 'usr' => "投稿ユーザ");
     $sentence = "";
     $jouken = "";
     $from = "";
     if (isset($lex['prefposts'])) {
         $jouken = $jouken . " and p.pref_num = " . $lex['prefposts'];
         $pref_name = Model_Members_General::getPrefname($lex['prefposts']);
         $sentence = $sentence . $table['prefposts'] . "「" . $pref_name . "」";
     }
     if (isset($lex['cate'])) {
         $jouken = $jouken . " and p.category = " . $lex['cate'];
         $cate_name = Model_Members_General::getCatename($lex['cate']);
         $sentence = $sentence . $table['cate'] . "「" . $cate_name . "」";
     }
     if (isset($lex['t1']) xor isset($lex['t2'])) {
         if (isset($lex['t1'])) {
             $jouken = $jouken . " and (p.tag1 = " . $lex['t1'] . " or p.tag2 = " . $lex['t1'] . ")";
             $tag_name = Model_Members_General::getTagname($lex['t1']);
             $sentence = $sentence . $table['t1'] . "「" . $tag_name . "」";
         } else {
             $jouken = $jouken . " and (p.tag1 = " . $lex['t2'] . " or p.tag2 = " . $lex['t2'] . ")";
             $tag_name = Model_Members_General::getTagname($lex['t2']);
             $sentence = $sentence . $table['t2'] . "「" . $tag_name . "」";
         }
     }
     if (isset($lex['t1']) && isset($lex['t2'])) {
         $tmp = " and ((p.tag1 = " . $lex['t1'] . " and p.tag2 = " . $lex['t2'] . ") or (p.tag2 = " . $lex['t1'] . " and p.tag1 = " . $lex['t2'] . "))";
         $jouken = $jouken . $tmp;
         $tag_name3 = Model_Members_General::getTagname($lex['t1']);
         $tag_name4 = Model_Members_General::getTagname($lex['t2']);
         $sentence = $sentence . $table['t1'] . "「" . $tag_name3 . "」「" . $tag_name4 . "」";
     }
     if (isset($lex['rate'])) {
         $jouken = $jouken . " and p.rating >= " . $lex['rate'];
         $sentence = $sentence . $table['rate'] . "「" . $lex['rate'] . "以上」";
     }
     if (isset($lex['ikitai'])) {
         $jouken = $jouken . " and (select count(*) from ikitai where p.pid = ikitai.pid) >=" . $lex['ikitai'];
         $sentence = $sentence . $table['ikitai'] . "「" . $lex['ikitai'] . "以上」";
     }
     if (isset($lex['itta'])) {
         $jouken = $jouken . " and (select count(*) from itta where p.pid = itta.pid) >=" . $lex['itta'];
         $sentence = $sentence . $table['itta'] . "「" . $lex['itta'] . "以上」";
     }
     if (isset($lex['usr'])) {
         $jouken = $jouken . " and p.uid = " . $lex['usr'];
         $sentence = $sentence . $table['usr'] . "「" . Model_Members_Userinfo::getUsername($lex['usr']) . "」";
     }
     $this->template = View::forge('members/result_template');
     $this->template->title = "旅ログ - 検索結果";
     $data = array();
     $data['sentence'] = $sentence;
     $data['count'] = 0;
     $data['posts'] = Model_Members_General2::getPostHeaderJoken($jouken);
     $this->template->jouken = $jouken;
     $ret = $this->make_option();
     $this->template->prefs = $ret['prefs'];
     $this->template->cates = $ret['cates'];
     $this->template->tags = $ret['tags'];
     $this->template->users = $ret['users'];
     $this->template->lex = $lex;
     $this->template->content = View::forge('members/result', $data);
 }