本文整理汇总了PHP中Presenter类的典型用法代码示例。如果您正苦于以下问题:PHP Presenter类的具体用法?PHP Presenter怎么用?PHP Presenter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Presenter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveCredit
/**
* 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 = 'Customer service portal';
//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;
}
}
示例2: testCallThrowsBadMethodCallException
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.');
}
示例3: action_search
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;
}
示例4: action_index
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));
}
示例5: action_index
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);
}
示例6: action_index
public function action_index()
{
/**
* Skills page, Computer Networking, Information Management, Web Development, Art and Design
*/
$this->template->content = Presenter::forge('skills/page');
}
示例7: editPermissions
public function editPermissions()
{
/** @var SettingsHandler $manageHandler */
$manageHandler = app('xe.settings');
$permissionGroups = $manageHandler->getPermissionList();
return \Presenter::make('settings.permissions', compact('permissionGroups'));
}
示例8: action_index
public function action_index()
{
/**
* Communication
*/
$this->template->content = Presenter::forge('skills/page', 'communication_view');
// $this->template->content = Presenter::forge('skills/communication');
}
示例9: action_404
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));
}
示例10: action_index
public function action_index()
{
/**
* Art and Design
*/
$this->template->content = Presenter::forge('skills/page', 'design_view');
// $this->template->content = Presenter::forge('skills/design');
}
示例11: action_index
public function action_index()
{
/**
* Web Development
*/
// $this->template->content = Presenter::forge('skills/development');
$this->template->content = Presenter::forge('skills/page', 'development_view');
}
示例12: action_index
public function action_index()
{
/**
* Information Management.
*/
$this->template->content = Presenter::forge('skills/page', 'information_view');
// $this->template->content = Presenter::forge('skills/information');
}
示例13: startup
protected function startup()
{
if (!$this->lang) {
$this->lang = 'sk';
}
// not calling parent::startup to avoid redirection to Homepage
Presenter::startup();
// parent::startup();
}
示例14: startup
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);
}
示例15: startup
protected function startup()
{
parent::startup();
if ($this->user->isLoggedIn() && $this->action != 'out') {
$this->redirect(':Admin:Homepage:');
}
}