/** * Saves a new product credit * * @param int $market_id * @param int $presenter_sequence_id The presenter sequence id * @param int $credit_type * @param decimal $amount * @param int $user_id * @return boolean */ public function saveCredit($market_id, $presenter_sequence_id, $credit_type, $amount, $user_id) { $entry_type_id = 2; $status_type_id = 2; $ref = CakeSession::read('admin_user')->id; $entry_user = '******'; //convert presenter sequence id to primary key id require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php'; $presenter = new Presenter(); $presenter_id = $presenter->getIdBySequenceId($presenter_sequence_id); $sql = "INSERT INTO {$this->_table_name} " . "(market_id, user_id, presenter_id, product_credit_type_id, product_credit_entry_type_id, product_credit_status_type_id, entry_user, created, reference_id, amount) " . "VALUES (:market, :user, :presenter, :type, :entry, :status, :entry_user, NOW(), :ref, :amt)"; $query = $this->_db->prepare($sql); $query->bindParam(':market', $market_id); $query->bindParam(':user', $user_id); $query->bindParam(':presenter', $presenter_id); $query->bindParam(':type', $credit_type); $query->bindParam(':entry', $entry_type_id); $query->bindParam(':status', $status_type_id); $query->bindParam(':ref', $ref); $query->bindParam(':entry_user', $entry_user); $query->bindParam(':amt', $amount); if ($query->execute()) { return TRUE; } }
public function testCallThrowsBadMethodCallException() { $presenter = new Presenter(new stdClass()); try { $presenter->someInvalidMethod(); } catch (BadMethodCallException $e) { $this->assertRegExp("/Presenter::someInvalidMethod\\(\\)/", $e->getMessage()); return; } $this->fail('BadMethodCallException has not been raised.'); }
public function startup() { parent::startup(); $this->loadBlackboard(); $this->loadBlock(function () { $block = $this->blackboard->getRandomParent(); if ($block) { $this->redirectToEntity($this->blackboard, $block); } }); $this->loadSchema(function () { if (!$this->block) { return NULL; } $schema = $this->block->getRandomParent(); if ($schema) { $this->redirectToEntity($this->blackboard, $this->block, $schema); } }); if ($this->block && !$this->block->contains($this->blackboard)) { $this->redirectToEntity($this->blackboard); } if ($this->block && $this->schema && !$this->schema->contains($this->block)) { $this->redirectToEntity($this->blackboard); } $this->checkSlug($this->blackboard); }
protected function startup() { parent::startup(); if ($this->user->isLoggedIn() && $this->action != 'out') { $this->redirect(':Admin:Homepage:'); } }
public function action_search() { $coupons = ""; try { $coupons = unserialize(Cache::get('cache_coupons')); } catch (\CacheNotFoundException $e) { $curl = Request::forge('http://allcoupon.jp/api-v1/coupon', 'curl'); $curl->set_params(array('output' => 'json', 'apikey' => '9EBgSyRbAPmutrWE')); // this is going to be an HTTP POST $curl->set_method('get'); $curl->set_auto_format(true); $result = $curl->execute()->response(); $coupons = json_decode($result->body); Cache::set('cache_coupons', serialize($coupons), 300); } if ($area = Input::get('area')) { $coupons = array_filter($coupons, function ($v, $k) { return $v->coupon_area == Input::get('area'); }, ARRAY_FILTER_USE_BOTH); } if ($category = Input::get('category')) { $coupons = array_filter($coupons, function ($v, $k) { return $v->category_name == Input::get('category'); }, ARRAY_FILTER_USE_BOTH); } $view = Presenter::forge('home/search'); $view->set('title', $area, false); $view->set('area', $area, false); $view->set('category', $category, false); $view->set('coupons', $coupons, false); $this->template->content = $view; }
public function before() { parent::before(); // Load Slills package \Package::load('Skills'); $this->skillsPackage = \Skills\Skills::forge(); }
public function createComponent($name) { switch ($name) { case 'searchForm': $form = new AppForm($this, $name); $form->addText('q', __('Query:')); $form['q']->getControlPrototype()->onclick('if (this.value === "' . __('Input search keywords') . '") { this._default = this.value; this.value = ""; }'); $form['q']->getControlPrototype()->onblur('if (this.value === "" && this._default !== undefined) { this.value = this._default; }'); $form->setAction($this->link('Search:default')); $form->setMethod('get'); if (isset(Environment::getSession(SESSION_SEARCH_NS)->last)) { $form->setDefaults(array('q' => Environment::getSession(SESSION_SEARCH_NS)->last)); } else { $form->setDefaults(array('q' => __('Input search keywords'))); } break; default: return parent::createComponent($name); } }
public function templatePrepareFilters($template) { $template->registerFilter('TemplateFilters::removePhp'); LatteMacros::$defaultMacros['part'] = '<?php try{ $%% = $presenter->getPart%%() ?>'; LatteMacros::$defaultMacros['/part'] = '<?php }catch(Exception $e){ Debug::processException($e, true);?><div class="error">Něco se nám tu pokakalo, počkejte, prosím, než to přebalíme.</div><?php }; ?>'; parent::templatePrepareFilters($template); }
public function action_index($view_path, $id) { $post_input = Input::post(); // First of all turn the submitted data into a FuelPHP model representation. $form_data_object = new \EBS\Form_Data($post_input); // Now go through and save created models and run validation. $model_validation = new \EBS\Form_Save_Models($form_data_object->models_and_actions); if (!$model_validation->run()) { $this->response->highlight_fields = $model_validation->get_highlightfields(); foreach ($model_validation->database_errors as $database_error) { // Create alerts specific to database errors for debugging purposes. // Perhaps this should only be shown if in DEV environment. $this->response->alerts[] = new \EBS\Response_Alert("There was a database error! Message: {$database_error->getMessage()}", 'danger', '', 0); } } else { // If that's successful, set the response success to true, as we're all done! $this->response->success = true; // Check if there was a view to generate and send back as well. if ($view_path !== null) { // Get the path for the view request. $view_path = str_replace('_', '/', $view_path); $updated_view = new \EBS\Response_View(); $updated_view->html = Presenter::forge($view_path)->set('id', $id)->render(); $updated_view->context = Input::post('response_target'); $this->response->updated_views[] = $updated_view; } } // Encode the response object as JSON and send it back to the UI! return Response::forge(json_encode($this->response)); }
public function action_index() { $exports = ['news' => Presenter::forge('portal/component/news'), 'slider' => View_Twig::forge('portal/component/slider')]; $this->template->title = 'Metro Royal'; $this->template->navigation = View_Twig::forge('portal/_navigation'); $this->template->content = View_Twig::forge('portal/index', $exports); }
public function action_index() { /** * Skills page, Computer Networking, Information Management, Web Development, Art and Design */ $this->template->content = Presenter::forge('skills/page'); }
/** * */ public function action_index() { Package::load('oil'); \Oil\Generate_Scaffold::forge(['page1', 'title:string', 'content:text'], "orm"); $this->title = 'Backend Dashboard'; $this->template->content = Presenter::forge('backend/page'); }
public function render() { $this->addStylesheet('css/bootstrap.css'); $output = parent::render(); $indenter = new Indenter(); return $indenter->indent($output); }
public function editPermissions() { /** @var SettingsHandler $manageHandler */ $manageHandler = app('xe.settings'); $permissionGroups = $manageHandler->getPermissionList(); return \Presenter::make('settings.permissions', compact('permissionGroups')); }
public function startup() { parent::startup(); $this->template->registerHelper('fshl_highlighter', array($this, 'fshl_highlighter')); $this->template->registerHelper('ansi_console_colors', array($this, 'ansi_console_colors')); $this->template->registerHelper('wordwrap', 'wordwrap'); }
public function action_index() { /** * Communication */ $this->template->content = Presenter::forge('skills/page', 'communication_view'); // $this->template->content = Presenter::forge('skills/communication'); }
public function action_404() { $messages = array('Uh Oh!', 'Huh ?'); $data['notfound_title'] = $messages[array_rand($messages)]; $data['title'] = '<h1>404 Times</h1>'; $this->template->title = __('page-not-found'); $this->template->content = Presenter::forge('frontpage/page')->set('content', View::forge('404', $data)); }
public function action_index() { /** * Art and Design */ $this->template->content = Presenter::forge('skills/page', 'design_view'); // $this->template->content = Presenter::forge('skills/design'); }
public function action_index() { /** * Web Development */ // $this->template->content = Presenter::forge('skills/development'); $this->template->content = Presenter::forge('skills/page', 'development_view'); }
public function action_index() { /** * Information Management. */ $this->template->content = Presenter::forge('skills/page', 'information_view'); // $this->template->content = Presenter::forge('skills/information'); }
protected function startup() { if (!$this->lang) { $this->lang = 'sk'; } // not calling parent::startup to avoid redirection to Homepage Presenter::startup(); // parent::startup(); }
public function __construct($appConfig) { parent::__construct(); $this->appConfig = $appConfig; $this->meta['title'] = $this->appConfig['title']; $this->meta['fullTitle'] = $this->appConfig['title']; $this->meta['siteTitle'] = $this->appConfig['title']; $this->meta['assetVersion'] = $this->appConfig['asset_version']; }
/** * Loads a coupon presenter record * * If noe exists, this function will create it and then load the record just created. * * @param int $presenter_sequence_id */ public function loadDataByPresenterSequenceId($presenter_sequence_id) { //first get the presenter id require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php'; $presenter = new Presenter(); $presenter_id = $presenter->getIdBySequenceId($presenter_sequence_id); //then see if there's a record for that presenter $this->data = $this->getDataByPresenterId($presenter_id); //add if not if ($this->data == FALSE) { $sql = "INSERT INTO {$this->_table_name} " . "(presenter_id,coupon_id,start_date,end_date,max_redemptions,discount_percentage,discount_flat) " . "VALUES(:p_id, 1, NOW(),'0000-00-00 00:00:00',-1,50,0) "; $query = $this->_db->prepare($sql); $query->bindParam(':p_id', $presenter_id); $query->execute(); $coupon_presenter_id = $this->_db->lastInsertId(); $this->data = $this->getDataById($coupon_presenter_id); } }
public function before() { parent::before(); if ($this->id == 'null') { $this->id = '_new'; } $this->requested_person = Model_Person::find($this->id); $this->requested_person === null ? $this->requested_person = Model_Person::forge() : null; }
public function before() { parent::before(); // Load list of aircraft here $this->aircraft_models = Model_Aircraft::find('all'); $this->aircraft_options = ['_new' => 'Create new aircraft']; foreach ($this->aircraft_models as $aircraft_model) { $this->aircraft_options[$aircraft_model->id] = $aircraft_model->name; } }
/** * Restores current request to session. * @param string key * @return void */ public function restoreRequest($key) { $session = $this->getSession('Nette.Application/requests'); if (isset($session[$key])) { $request = clone $session[$key]; unset($session[$key]); $request->setFlag(PresenterRequest::RESTORED, TRUE); $this->presenter->terminate(new ForwardingResponse($request)); } }
public function action_view($id = null) { $article = Model_Article::find_by_url_title($id); if ($article) { $view = Presenter::forge('article/view'); $view->set('article', $article); $this->template->set('content', $view); } else { return Response::forge(Presenter::forge('welcome/404'), 404); } }
public function action_index($view = 'basic') { // Put navigation view into header $this->_header->set('navigation', $this->_navigation); // Grab presenter to be used for layout $presenter = Presenter::forge('account/page')->set('header', $this->_header); // Get view and place in presenter $data['user'] = $this->_user; $view = View::forge('account/' . $view . '/index', $data); $presenter->set('content', $view); $this->template->content = $presenter; }
public function view() { $initial_content = ''; $meta_description = ''; $organisation = ''; $assets = [Asset::css(['ebs.css', 'bootstrap.css']), Asset::js(['jquery-2.1.4.js', 'ebs.js', 'bootstrap.js', 'confirm-bootstrap.js'])]; $nav_header = Presenter::forge('layouts/index/header'); $content = View::forge('layout/content', ['content' => $initial_content]); $nav_footer = Presenter::forge('layouts/index/footer'); $ebs = View::forge('layout/ebs', ['meta_description' => $meta_description, 'organisation' => $organisation, 'assets' => $assets, 'nav_header' => $nav_header, 'content' => $content, 'alert_area' => View::forge('layout/alert_area'), 'nav_footer' => $nav_footer], false); $this->ebs = $ebs; }
public function before() { parent::before(); $this->requested_flight_record = Model_Flight_Record::find($this->id, ['related' => ['manifests' => ['related' => ['aircraft', 'aerodromes']]]]); $this->requested_flight_record === null ? $this->requested_flight_record = Model_Flight_Record::forge() : null; // Pull out manifest details foreach ($this->requested_flight_record->manifests as $manifest) { $left_text = ''; // AA-CH #10009 for example $cells = [View::forge('widgets/tablewithactions/row/cell', ['cell_content' => $left_text], false)]; $this->manifests_table_rows[] = View::forge('widgets/tablewithactions/row', ['cells' => $cells, 'id' => $manifest->id, 'duplicate_action' => false]); } }