/** * フリーマーケット詳細表示画面 * * @access public * @param mixed $fleamarket_id フリーマーケットID * @return void * @author ida */ public function get_detail($fleamarket_id) { Asset::css('jquery-ui.min.css', array(), 'add_css'); Asset::js('jquery-ui.min.js', array(), 'add_js'); if (!$fleamarket_id) { return $this->forward('errors/notfound', 404); } $fleamarket = \Model_Fleamarket::findDetail($fleamarket_id); if (!$fleamarket) { return $this->forward('errors/notfound', 404); } $this->setHtmlReplace(array('AREA' => $this->getArea($fleamarket['prefecture_id']), 'AREA_NAME' => $this->getAreaName($fleamarket['prefecture_id']), 'FLEAMARKET_NAME' => $fleamarket['name'], 'LOCATION_ID' => $fleamarket['location_id'], 'LOCATION_NAME' => $fleamarket['location_name'])); $fleamarket_abouts = \Model_Fleamarket_About::findByFleamarketId($fleamarket_id); $fleamarket_images = \Model_Fleamarket_Image::findByFleamarketId($fleamarket_id); $entry_styles = \Model_Fleamarket_Entry_Style::findByFleamarketId($fleamarket_id); $entries = \Model_Entry::getTotalEntryByFleamarketId($fleamarket_id); $fleamarket['entries'] = $entries; $view_model = \ViewModel::forge('search/detail'); $view_model->set('fleamarket', $fleamarket, false); $view_model->set('fleamarket_images', $fleamarket_images, false); $view_model->set('fleamarket_abouts', $fleamarket_abouts, false); $view_model->set('fleamarket_entry_styles', $entry_styles, false); $view_model->set('entries', $entries, false); $view_model->set('prefectures', \Config::get('master.prefectures'), false); $view_model->set('user', $this->login_user, false); $this->template->content = $view_model; }
/** * 会場詳細 * * @access public * @param mixed $location_id 会場ID * @param mixed $fleamarket_id フリマID * @return void * @author ida */ public function action_detail($location_id = null, $fleamarket_id = null) { if (!$location_id) { return $this->forward('errors/notfound', 404); } \Asset::css('jquery-ui.min.css', array(), 'add_css'); \Asset::js('jquery-ui.min.js', array(), 'add_js'); // 会場に紐づくフリマを取得する $fleamarket_date_list = \Model_Fleamarket::find('all', array('select' => array('fleamarket_id', 'event_date'), 'where' => array(array('location_id' => $location_id)), 'order_by' => array('event_date' => 'asc'))); if (!$location_id || !$fleamarket_date_list) { \Response::redirect('errors/notfound'); } if (!$fleamarket_id) { $first_fleamarket = end($fleamarket_date_list); $fleamarket_id = $first_fleamarket['fleamarket_id']; } $fleamarket = \Model_Fleamarket::findDetail($fleamarket_id); if (!$fleamarket) { \Response::redirect('errors/notfound'); } $this->setHtmlReplace(array('AREA' => $this->getArea($fleamarket['prefecture_id']), 'AREA_NAME' => $this->getAreaName($fleamarket['prefecture_id']), 'LOCATION_ID' => $fleamarket['location_id'], 'LOCATION_NAME' => $fleamarket['location_name'], 'FLEAMARKET_NAME' => $fleamarket['name'])); $fleamarket_abouts = \Model_Fleamarket_About::findByFleamarketId($fleamarket_id); $fleamarket_images = \Model_Fleamarket_Image::findByFleamarketId($fleamarket_id); $entry_styles = \Model_Fleamarket_Entry_Style::findByFleamarketId($fleamarket_id); $view_model = \ViewModel::forge('location/detail'); $view_model->set('fleamarket', $fleamarket, false); $view_model->set('fleamarket_date_list', $fleamarket_date_list, false); $view_model->set('fleamarket_images', $fleamarket_images, false); $view_model->set('fleamarket_abouts', $fleamarket_abouts, false); $view_model->set('fleamarket_entry_styles', $entry_styles, false); $view_model->set('prefectures', \Config::get('master.prefectures'), false); $view_model->set('user', $this->login_user, false); $this->template->content = $view_model; }
/** * Test for View_Dbdocs_Index::view() */ public function test_view() { $html = \ViewModel::forge('dbdocs/index')->set('information', static::$dd->get_information())->set('description', isset(static::$dd->config['description']) ? static::$dd->config['description'] : '')->set('__tables', static::$dd->get_tables())->set('__views', static::$dd->get_views())->render(); $dom = new \DOMDocument(); $dom->loadHTML($html); $tbody = $dom->getElementsByTagName('table')->item(0)->getElementsByTagName('tbody')->item(0); /** * check platform */ $output = $tbody->getElementsByTagName('td')->item(0)->nodeValue; $expected = static::$dd->conn->getDatabasePlatform()->getName(); $this->assertEquals($expected, $output); /** * check database */ $output = $tbody->getElementsByTagName('td')->item(1)->nodeValue; $expected = static::$dd->conn->getDatabase(); $this->assertEquals($expected, $output); /** * check description */ $output = $tbody->getElementsByTagName('td')->item(2)->nodeValue; $expected = isset(static::$dd->config['description']) ? static::$dd->config['description'] : ''; $this->assertEquals($expected, $output); }
/** * 予約履歴一覧 * * @access public * @param * @return void * @author kobayashi * @author ida */ public function action_list() { Asset::css('jquery-ui.min.css', array(), 'add_css'); Asset::js('jquery-ui.min.js', array(), 'add_js'); $conditions = $this->getCondition(); $condition_list = \Model_Entry::createAdminSearchCondition($conditions); $total_count = \Model_Entry::getCountByAdminSearch($condition_list); // ページネーション設定 $pagination = \Pagination::forge('entry_pagination', $this->getPaginationConfig($total_count)); $entry_list = \Model_Entry::findAdminBySearch($condition_list, $pagination->current_page, $this->result_per_page); $view_model = \ViewModel::forge('admin/entry/list'); if (\Input::param('fleamarket_id')) { $fleamarket = \Model_Fleamarket::find(\Input::param('fleamarket_id')); $view_model->set('fleamarket', $fleamarket, false); } if (\Input::param('user_id')) { $user = \Model_User::find(Input::param('user_id')); $view_model->set('user', $user, false); } $view_model->set('entry_list', $entry_list, false); $view_model->set('pagination', $pagination, false); $view_model->set('conditions', $conditions, false); $view_model->set('total_count', $total_count); $this->template->content = $view_model; }
/** * Test for View_Dbdocs_Indexes::view() */ public function test_view() { $tables = static::$dd->get_tables(); $html = \ViewModel::forge('dbdocs/indexes')->set('__tables', $tables)->render(); $dom = new \DOMDocument(); $dom->loadHTML($html); $tbody = $dom->getElementsByTagName('table')->item(0)->getElementsByTagName('tbody')->item(0); /** * check elements count */ $expected = $output = array('column_count' => 0, 'pk_count' => 0, 'ui_count' => 0, 'fk_count' => 0); foreach ($tbody->getElementsByTagName('tr') as $tr) { $output['column_count']++; foreach ($tr->getElementsByTagName('span') as $span) { if (0 < preg_match('/^label label-info$/', $span->getAttribute('class'))) { if (0 < preg_match('/^.*PK.*$/', $span->nodeValue)) { $output['pk_count']++; } else { if (0 < preg_match('/^.*UI.*$/', $span->nodeValue)) { $output['ui_count']++; } } if (0 < preg_match('/^.*FK.*$/', $span->nodeValue)) { $output['fk_count']++; } } } } foreach ($tables as $table) { $indexes = $table->getIndexes(); $foreign_keys = $table->getForeignKeys(); foreach ($indexes as $index) { $expected['column_count']++; /* @var $index \Doctrine\DBAL\Schema\Index */ if ($index->isPrimary()) { $expected['pk_count']++; } else { if ($index->isUnique()) { $expected['ui_count']++; } } foreach ($index->getColumns() as $index_column_name) { foreach ($foreign_keys as $foreign_key) { /* @var $foreign_key \Doctrine\DBAL\Schema\ForeignKeyConstraint */ if (in_array($index_column_name, $foreign_key->getColumns())) { $expected['fk_count']++; } } } } } \Log::debug('expected : ' . print_r($expected, true)); \Log::debug('output : ' . print_r($output, true)); foreach ($expected as $k => $v) { $this->assertEquals($expected[$k], $output[$k]); } }
/** * action_index * * @access public * @return void * @author ida */ public function action_index() { $year = (int) $this->param('year', date('Y')); $month = (int) $this->param('month', date('n')); $view_model = ViewModel::forge('component/calendar'); $view_model->set('year', $year); $view_model->set('month', $month); return $view_model; }
/** * トップページ * * @access public * @return void * @author ida * @author shimma */ public function action_index() { $view_model = \ViewModel::forge('top/index'); $view_model->set('news_headlines', \Model_News::getHeadlines()); $view_model->set('upcomming', \ViewModel::forge('component/upcomming'), false); $view_model->set('calendar', \ViewModel::forge('component/calendar'), false); $view_model->set('search', \ViewModel::forge('component/search')->set('is_top', true), false); $view_model->set('popular_ranking', \ViewModel::forge('component/popular'), false); $view_model->set('latest', \ViewModel::forge('component/latest'), false); Asset::js('jquery.carouFredSel.js', array(), 'add_js'); Asset::js('jquery.rwdImageMaps.min.js', array(), 'add_js'); Asset::js('top.js', array(), 'add_js'); Asset::css('top.css', array(), 'add_css'); $this->template->content = $view_model; }
/** * 入力 * * @access public * @param * @return void * @author kobayashi */ public function action_index() { $fleamarket_id = $this->fleamarket->fleamarket_id; $has_empty_booth = \Model_Fleamarket::hasEmptyBooth($fleamarket_id); $can_reserve = $this->canReserve($fleamarket_id, $has_empty_booth); $view_model = \ViewModel::forge('reservation/index'); $view_model->set('fieldset', $this->fieldset, false); $view_model->set('fleamarket', $this->fleamarket, false); $view_model->set('user', $this->login_user, false); $view_model->set('item_categories', \Model_Entry::getItemCategories(), false); $view_model->set('item_genres', \Model_Entry::getItemGenres(), false); $view_model->set('has_empty_booth', $has_empty_booth, false); $view_model->set('can_reserve', $can_reserve, false); $this->template->content = $view_model; }
/** * 確認 * * @access public * @param * @return void * @author kobayashi */ public function post_confirm() { if (\Input::post('location_id')) { $this->location = \Model_Location::find(\Input::post('location_id')); } $fieldset = $this->getFieldset(); \Session::set_flash('admin.location.fieldset', $fieldset); if (!$fieldset->validation()->run()) { \Response::redirect('admin/location/?location_id=' . \Input::param('location_id', '')); } $view_model = \ViewModel::forge('admin/location/confirm'); $view_model->set('fieldset', $fieldset, false); $view_model->set('location', $this->location, false); $this->template->content = $view_model; }
/** * Test for View_Dbdocs_View::view() */ public function test_view() { $views = static::$dd->get_views(); foreach ($views as $view) { /* @var $view \Doctrine\DBAL\Schema\View */ $html = \ViewModel::forge('dbdocs/view')->set('__view', $view)->render(); $dom = new \DOMDocument(); $dom->loadHTML($html); /** * check view name */ $output = $dom->getElementsByTagName('h1')->item(0)->nodeValue; $expected = $view->getName(); $this->assertEquals($expected, $output); } }
/** * Test for View_Dbdocs_Views::view() */ public function test_view() { $views = static::$dd->get_views(); $html = \ViewModel::forge('dbdocs/views')->set('__views', $views)->render(); $dom = new \DOMDocument(); $dom->loadHTML($html); $tbody = $dom->getElementsByTagName('table')->item(0)->getElementsByTagName('tbody')->item(0); /** * check a link views */ $output = array(); foreach ($tbody->getElementsByTagName('a') as $a) { if (0 < preg_match('/^view_.*\\.html$/', $a->getAttribute('href'))) { $output[] = $a->nodeValue; } } foreach ($views as $view) { /* @var $view \Doctrine\DBAL\Schema\View */ $this->assertTrue(in_array($view->getName(), $output)); } }
/** * 送信結果確認画面 * * @access public * @param * @return void * @author ida */ public function action_result() { $mail_magazine_id = \Input::get('mail_magazine_id'); $view_model = \ViewModel::forge('admin/mailmagazine/result'); $view_model->set('mail_magazine_id', $mail_magazine_id, false); $view_model->set('user', $this->administrator, false); $this->template->content = $view_model; }
/** * The 404 action for the application. * * @access public * @return Response */ public function action_404() { return Response::forge(ViewModel::forge('default/404'), 404); }
/** * マイリスト/出店予約したフリマ/開催投稿したフリマ一覧ページ * * @access public * @return void * @author shimma */ public function action_list() { \Asset::css('jquery-ui.min.css', array(), 'add_css'); \Asset::js('jquery-ui.min.js', array(), 'add_js'); $pagination_param = 'p'; $item_per_page = 10; $page = Input::get($pagination_param, 1); $type = Input::get('type'); switch ($type) { case 'finished': $fleamarkets = $this->login_user->getFinishedEntries($page, $item_per_page); $count = $this->login_user->getFinishedEntryCount(); break; case 'reserved': $fleamarkets = $this->login_user->getReservedEntries($page, $item_per_page); $count = $this->login_user->getReservedEntryCount(); break; case 'waiting': $fleamarkets = $this->login_user->getWaitingEntries($page, $item_per_page); $count = $this->login_user->getWaitingEntryCount(); break; case 'mylist': $fleamarkets = $this->login_user->getFavorites($page, $item_per_page); $count = $this->login_user->getFavoriteCount(); break; case 'myfleamarket': $fleamarkets = $this->login_user->getMyFleamarkets($page, $item_per_page); $count = $this->login_user->getMyFleamarketCount(); break; default: return \Response::redirect('/mypage'); } $num_links = 5; $pagination = \Pagination::forge('mypage/list', array('uri_segment' => $pagination_param, 'num_links' => $num_links, 'per_page' => $item_per_page, 'total_items' => $count)); $fleamarkets_view = array(); foreach ($fleamarkets as $fleamarket) { $fleamarkets_view[] = \ViewModel::forge('component/fleamarket')->set('type', $type)->set('fleamarket', $fleamarket)->set('user', $this->login_user); } $view_model = \View::forge('mypage/list'); $view_model->set('type', $type, false); $view_model->set('pagination', $pagination, false); $view_model->set('user', $this->login_user, false); $view_model->set('fleamarkets_view', $fleamarkets_view, false); $view_model->set('calendar', \ViewModel::forge('component/calendar'), false); $view_model->set('prefectures', \Config::get('master.prefectures'), false); $view_model->set('regions', \Config::get('master.regions'), false); $this->template->content = $view_model; }
/** * 確認画面 * * @access public * @param * @return void * @autjor kobayashi */ public function post_confirm() { if (\Input::post('user_id')) { $this->user = \Model_User::find(\Input::post('user_id')); } $fieldset = $this->getFieldset(); \Session::set_flash('admin.user.fieldset', $fieldset); if (!$fieldset->validation()->run()) { \Response::redirect('admin/user/?user_id=' . \Input::post('user_id', '')); } $view_model = \ViewModel::forge('admin/user/confirm'); $view_model->set('fieldset', $fieldset, false); $view_model->set('user', $this->user, false); $this->template->content = $view_model; }
public function action_images($id = null) { $pass = Model_Pass::find($id); if (Input::method() == 'POST') { $manager = new Pass_File_Manager($pass); $image_selection_number = \Fuel\Core\Input::post('upload_image_selection'); $images = $manager->required_images(); $name = $images[$image_selection_number]; if ($manager->get_upload_files(array('png'), $name) == false) { Session::set_flash('error', $manager->error); } elseif ($pass and $pass->save()) { Session::set_flash('success', e('Added pass #' . $pass->id . '.')); Response::redirect('admin/pass/images/' . $pass->id); } else { Session::set_flash('error', e('Could not save pass.')); } } $this->template->set_global('pass', $pass); $this->template->title = "Pass Images"; $images_vm = ViewModel::forge('admin/pass/images'); $images_vm->pass = $pass; $this->template->content = $images_vm; }
/** * Generate database documentation * * @param $dir string Documentation directory * @return mixed (true or error message) */ public function generate($dir, $force = false) { /** * delete and create dbdocs dir */ if (file_exists($dir)) { if ($force === false) { return "{$dir} already exist, please use -f option to force delete and generate."; } $ret = \File::delete_dir($dir); if ($ret === false) { return "Could not delete directory \"{$dir}\""; } } $ret = mkdir($dir, 0777, true); if ($ret === false) { return "Could not create directory \"{$dir}\""; } /** * copy assets */ \File::copy_dir(__DIR__ . DS . '..' . DS . 'assets', $dir . 'assets'); /** * get tables and views */ $tables = $this->get_tables(); $views = $this->get_views(); foreach ($tables as $table) { $this->set_fuel_relations($table); } /** * generate index.html */ $html = \ViewModel::forge('dbdocs/index')->set('information', $this->get_information())->set('description', $this->config['description'])->set('__tables', $tables)->set('__views', $views)->render(); \File::create($dir, 'index.html', $html); /** * generate indexes.html */ $html = \ViewModel::forge('dbdocs/indexes')->set('__tables', $tables)->render(); \File::create($dir, 'indexes.html', $html); /** * generate tables.html */ $html = \ViewModel::forge('dbdocs/tables')->set('__tables', $tables)->render(); \File::create($dir, 'tables.html', $html); /** * generate table_*.html */ foreach ($tables as $table) { /* @var $table \Doctrine\DBAL\Schema\Table */ $html = \ViewModel::forge('dbdocs/table')->set('__table', $table)->render(); \File::create($dir, 'table_' . $table->getName() . '.html', $html); } /** * generate views.html */ $html = \ViewModel::forge('dbdocs/views')->set('__views', $views)->render(); \File::create($dir, 'views.html', $html); /** * generate view_*.html */ foreach ($views as $view) { /* @var $view \Doctrine\DBAL\Schema\View */ $html = \ViewModel::forge('dbdocs/view')->set('__view', $view)->render(); \File::create($dir, 'view_' . $view->getName() . '.html', $html); } return true; }
/** * Loads a viewmodel, and have it use the view from the currently active theme, * the fallback theme, or the standard FuelPHP cascading file system * * @param * string ViewModel classname without View_ prefix or full classname * @param * string Method to execute * @param bool $auto_filter * Auto filter the view data * @return View New View object */ public function viewmodel($view, $method = 'view', $auto_filter = null) { return \ViewModel::forge($view, $method, $auto_filter, $this->find_file($view)); }
/** * 登録処理 * * @access public * @param * @return void * @author ida */ public function post_thanks() { if (!Security::check_token()) { Response::redirect('errors/doubletransmission'); } try { $db = \Database_Connection::instance('master'); \DB::start_transaction(); $fieldsets = $this->getFieldsets(); $location = $this->saveLocation($fieldsets['location']); $fleamarket = $this->saveFleamarket($fieldsets['fleamarket'], $location->location_id); $fleamarket_about = $this->saveFleamarketAbout($fieldsets['fleamarket_about'], $fleamarket->fleamarket_id); $this->deleteFleamarketImage($fleamarket->fleamarket_id); $this->saveFleamarketImage($fleamarket->fleamarket_id); \DB::commit_transaction(); } catch (\Exception $e) { \DB::rollback_transaction(); throw new SystemException(\Model_Error::ER00905); } $this->template->content = \ViewModel::forge('fleamarket/thanks'); }
/** * The 404 action for the application. * * @access public * @return Response */ public function action_404() { return Response::forge(ViewModel::forge('welcome/404'), 404); }
/** * 会場検索 * * ダイアログ表示のHTMLを返答する * * @access public * @param * @return string * @author ida */ public function action_searchlocation() { $this->template = ''; $prefecture_id = \Input::post('prefecture_id'); $name = \Input::post('name'); $query = \Model_Location::query()->select('location_id', 'name', 'address'); if ($prefecture_id) { $query->where(array('prefecture_id' => $prefecture_id)); } if ($name) { $query->where(array('name', 'LIKE', '%' . $name . '%')); } $locations = $query->get(); $view_model = \ViewModel::forge('admin/fleamarket/searchlocation'); $view_model->set('location_list', $locations, false); return $view_model; }
/** * 初期画面 * * @access public * @param * @return void * @author kobayashi */ public function action_index() { $this->template->content = \ViewModel::forge('admin/index/index'); }