public static function render($type, $owner) { $view = new ViewModel('views/user/comments.php'); $view->registerVar('type', $type); $view->registerVar('owner', $owner); return $view->render(); }
public function showAction() { $this->composerInfo->parse(); $loadedModules = $this->moduleManager->getLoadedModules(); $packages = $this->composerInfo->getPackages(); $this->viewModel->setPackages($packages); $this->viewModel->setLoadedModules($loadedModules); $this->viewModel->setTemplate('list-show'); return $this->renderer->render($this->viewModel); }
/** * Render a template or a view model * * @param string|array|ViewModel $template * @param array $variables * * @return string */ public function render($template, array $variables = array()) { if ($template instanceof ViewModel) { $template->setVariables($variables); } elseif (is_array($template)) { $section = isset($template['section']) ? $template['section'] : Pi::engine()->application()->getSection(); $module = !empty($template['module']) ? $template['module'] : Pi::service('module')->current(); $file = $template['file']; $template = $module . ':' . ($section ? $section . '/' : '') . $file; } $content = $this->getViewManager()->getRenderer()->render($template, $variables); return $content; }
public function login() { $view = new ViewModel('admin/login'); if (isset($_SESSION['user']) && $_SESSION['user'] != 'admin') { $view->assign('user', $_SESSION['user']); header('Location: yourAccount'); return; } if (isset($_POST['user']) && $_POST['user'] == 'admin') { $admin = new AdminController(); $admin->login(); } if (isset($_POST['user'])) { $customer = new CustomerModel(); $logged = $customer->selectWithPassword($_POST['user'], $_POST['pass']); if (!$logged) { $view->assign('message-type', 'error'); $view->assign('message', 'Błędne dane'); $view->display(); return; } $_SESSION['user'] = $_POST['user']; $view->assign('user', $_SESSION['user']); $view->setTemplate('customer/index'); header('Location: yourAccount'); } $view->display(); }
public static function get_instance($Messages = '') { if (!isset(self::$instance)) { self::$instance = new ViewModel($Messages); } return self::$instance; }
/** * 予約履歴一覧 * * @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; }
/** * 会場詳細 * * @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; }
/** * Profile_ViewModel constructor. */ public function __construct($user, $profileUser) { parent::__construct(); $this->logged_in_user = $user; $this->profile_user = $profileUser; $this->data = MorpheusPetsData::getInstance(); }
/** * フリーマーケット詳細表示画面 * * @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; }
/** * Battle_ViewModel constructor. */ public function __construct($user) { parent::__construct(); $this->logged_in_user = $user; $this->data = MorpheusPetsData::getInstance(); $this->battle = new Battle(); }
public function __construct() { $this->Messages = Messages::get_instance(); $this->Model = ViewModel::get_instance($this->Messages); $this->view = array('activelayer' => 'new'); $this->setHttpListener(); }
/** * 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); }
function __construct() { parent::__construct(); $arr = getModelFilterByNodeSetting(); if (is_array($arr)) { $this->_filter = $arr; } }
/** * 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; }
public function __construct($method, $auto_filter = null, $view = null) { // Maybe set the template... $template = $this->template(); if ($template !== null) { $view = $template; } parent::__construct($method, $auto_filter, $view); }
/** * indexAction * * @author Aravind B Dev * @access public * @return ViewModel * */ public function indexAction() { $viewModel = new ViewModel(); // check if search string is present $search = isset($_GET['search']) && $_GET['search'] ? trim($_GET['search']) : ''; $page = isset($_GET['page']) && $_GET['page'] ? $_GET['page'] : 1; $viewModel->search = $search; $images = array(); if ($search) { // if search string present try { // check if we can create a valid flicker model object $flicker = new FlickerModel(); } catch (Exception $e) { echo $e->getMessage(); die; } // set api key $flicker->api_key = '340aa607ac2d150d17fdca20882cf56a'; // set number of results per page $flicker->per_page = '5'; // set the page $flicker->page = $page; // set the search $flicker->tags = $search; // set the image to return and its sizes // s small square 75x75 // q large square 150x150 // t thumbnail, 100 on longest side // m small, 240 on longest side // n small, 320 on longest side // - medium, 500 on longest side // z medium 640, 640 on longest side // c medium 800, 800 on longest side† // b large, 1024 on longest side $flicker->setReturnImages(array('img_thumb' => 'q', 'img_main' => 'b')); // get the image list from flicker $images = $flicker->getImages(); } $viewModel->images = $images; $viewModel->display('index'); }
public function delete() { $view = new ViewModel('admin/workers'); $workerModel = new WorkerModel(); try { $view->assign('workers', $workerModel->deleteWorker($_POST['delete'], $_POST['function'])); } catch (PDOException $e) { $view->assign('workers', array()); $view->assign('message-type', 'error'); $view->assign('message', 'Nie można usunąć pracownika. Sprawdź czy nie jest powiązany z przesyłką lub zleceniem!'); $view->display(); return; } $view->assign('message-type', 'info'); $view->assign('message', 'Usunięto pracownika!'); $view->display(); }
public function delete() { $view = new ViewModel('admin/customers'); $customerModel = new CustomerModel(); try { $view->assign('customers', $customerModel->deleteCustomer($_POST['delete'])); } catch (PDOException $e) { $view->assign('message-type', 'error'); $view->assign('message', 'Nie można usunąć klienta. Sprawdź czy nie jest powiązany z przesyłką lub zleceniem!'); $view->display(); return; } $view->assign('message-type', 'info'); $view->assign('message', 'Usunięto klienta!'); $view->display(); }
/** * 確認 * * @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; }
/** * @override * */ public function select($options = array()) { $data = parent::select($options); // echo $this->getLastSql();exit; // print_r($data);exit; $theDataModel = D("DataModel")->getByAlias("product"); foreach ($data as $k => $v) { $data[$k]["modelIndex"] = sprintf("%d-%d", $v["goods_category_id"], $theDataModel["id"]); $data[$k]["goodsCode"] = explode(DBC("goods.unique.separator"), $v["factory_code_all"]); } $params = array($data, null, false, true); tag("assign_dataModel_data", $params); $data = $params[0]; return $data; }
/** * トップページ * * @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; }
private function renderView($data) { if (!isset($data["view"])) { $data["view"] = "index"; } $theme = "default"; $view_name = $data["view"] . ".phtml"; $view_page = APP_ROOT . "/theme/{$theme}/" . $view_name; $viewModel = ViewModel::fromArray($data); if (file_exists($view_page)) { logger::info("render page: {$view_page}"); require $view_page; } else { throw new Exception("{$view_page} > not found!"); } }
/** * 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); } }
public function find() { $view = new ViewModel('main/find'); $orderModel = new OrderModel(); if (isset($_POST['id_przesylki'])) { $result = $orderModel->findDelivery($_POST['id_przesylki']); if (!empty($result)) { $view->assign('delivery', $result); $view->assign('from', $orderModel->getAddress($result['od'])); $view->assign('to', $orderModel->getAddress($result['do'])); } $view->setTemplate('main/findResult'); } $view->display(); }
/** * 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)); } }
/** * 会場検索 * * ダイアログ表示の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; }
/** * The 404 action for the application. * * @access public * @return Response */ public function action_404() { return Response::forge(ViewModel::forge('welcome/404'), 404); }
public function make_form_project_area($regist_area = []) { $ViewModel = new ViewModel(); $data = $ViewModel->get_area_type(); if (!empty($regist_area)) { $defaults_area = array(); foreach ($regist_area as $key => $value) { if (!empty($value)) { $defaults_area = array_merge($defaults_area, array('area_type' . ($key + 1) => $value)); } } $this->form->setDefaults($defaults_area); } $this->form->addElement('select', 'area_type1', 'エリア1:', $data); $this->form->addElement('select', 'area_type2', 'エリア2:', $data); $this->form->addElement('select', 'area_type3', 'エリア3:', $data); }