本文整理汇总了PHP中Events::trigger方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::trigger方法的具体用法?PHP Events::trigger怎么用?PHP Events::trigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::trigger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rollback
/**
* @see TransactionManagerInterface::rollback
*/
public function rollback()
{
if (!$this->transactionInProgress) {
throw new TransactionException("No transaction is started.");
}
$this->Events->trigger('TransactionManager.rollback');
$this->transactionInProgress = false;
return $this;
}
示例2: destroy
public function destroy()
{
// Run the standard CI_Cart function
parent::destroy();
// Fire an event to tell external modules that the cart has been destroyed
Events::trigger('cart_destroyed');
}
示例3: group
/**
* Shows the permissions for a specific user group.
*
* @param int $group_id The id of the group to show permissions for.
*/
public function group($group_id)
{
$this->load->library('form_validation');
if ($_POST) {
$modules = $this->input->post('modules');
$roles = $this->input->post('module_roles');
// Save the permissions.
if ($this->permission_m->save($group_id, $modules, $roles)) {
// Fire an event. Permissions have been saved.
Events::trigger('permissions_saved', array($group_id, $modules, $roles));
}
$this->session->set_flashdata('success', lang('permissions:message_group_saved_success'));
$this->input->post('btnAction') === 'save_exit' ? redirect('admin/permissions') : redirect('admin/permissions/group/' . $group_id);
}
// Get the group data
$group = $this->group_m->get($group_id);
// If the group data could not be retrieved
if (!$group) {
// Set a message to notify the user.
$this->session->set_flashdata('error', lang('permissions:message_no_group_id_provided'));
// Send him to the main index to select a proper group.
redirect('admin/permissions');
}
// See if this is the admin group
$group_is_admin = (bool) ($this->config->item('admin_group', 'ion_auth') == $group->name);
// Get the groups permission rules (no need if this is the admin group)
$edit_permissions = $group_is_admin ? array() : $this->permission_m->get_group($group_id);
// Get all the possible permission rules from the installed modules
$permission_modules = $this->module_m->get_all(array('is_backend' => true, 'installed' => true));
foreach ($permission_modules as &$permission_module) {
$permission_module['roles'] = $this->module_m->roles($permission_module['slug']);
}
$this->template->append_js('module::group.js')->set('edit_permissions', $edit_permissions)->set('group_is_admin', $group_is_admin)->set('permission_modules', $permission_modules)->set('group', $group)->build('admin/group');
}
示例4: index
public function index()
{
$this->load->parser();
$validation_rules = array(array('field' => 'email_test_form_captcha', 'label' => 'Captcha', 'rules' => 'nohtml|trim|callback__captcha'));
$success = false;
$messages = array();
$this->form_validation->set_rules($validation_rules);
if ($this->form_validation->run()) {
$custom_text = $this->input->post('custom_text');
$custom_html = trim($custom_text) != '' ? $this->parser->parse_string($custom_text, null, true, array('textile' => array('restricted_mode' => true))) : '';
$success = (bool) Events::trigger('email_test', array('custom_text' => $custom_html));
if ($success) {
$messages[] = $this->lang->line('mailer_your_message_has_been_sent');
} else {
if ($this->registry->get('email_debugger') != '') {
$messages[] = $this->lang->line('mailer_error') . '<br /><br />' . $this->registry->get('email_debugger');
} else {
$messages[] = $this->lang->line('mailer_error');
}
}
} else {
$messages = validation_errors_array();
}
extract(Modules::run('email/test/get_message'));
$has_logo = file_exists(DEFAULTFCPATH . 'apple-touch-icon-precomposed.png');
$body = $this->parser->parse_string($body, array('has_logo' => $has_logo, 'logo_src' => default_base_url('apple-touch-icon-precomposed.png')), true, 'mustache');
$this->captcha->clear();
$this->template->set(compact('success', 'messages', 'subject', 'body'))->enable_parser_body('i18n')->build('email_test');
}
示例5: index
/**
* 버전정보 페이지입니다
*/
public function index()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cbversion_index';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
Requests::register_autoloader();
$headers = array('Accept' => 'application/json');
$postdata = array('requesturl' => current_full_url(), 'package' => CB_PACKAGE, 'version' => CB_VERSION);
$request = Requests::post(config_item('ciboard_check_latest_version'), $headers, $postdata);
$view['view']['latest_versions'] = json_decode($request->body, true);
if (strtolower(CB_PACKAGE) === 'premium') {
$view['view']['latest_version_name'] = $view['view']['latest_versions']['premium_version'];
$view['view']['latest_download_url'] = $view['view']['latest_versions']['premium_downloadurl'];
} else {
$view['view']['latest_version_name'] = $view['view']['latest_versions']['basic_version'];
$view['view']['latest_download_url'] = $view['view']['latest_versions']['basic_downloadurl'];
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
示例6: login
/**
* Login the user
*
* @return void
*/
public function login()
{
// Check post and session for the redirect place
$redirect_to = $this->input->post('redirect_to') ? trim(urldecode($this->input->post('redirect_to'))) : $this->session->userdata('redirect_to');
// Any idea where we are heading after login?
if (!$_POST and $args = func_get_args()) {
$this->session->set_userdata('redirect_to', $redirect_to = implode('/', $args));
}
// This persists the login redirect
$this->session->set_userdata('login_redirect', $this->session->userdata('login_redirect'));
//validate form input
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
// If the validation worked, or the user is already logged in
if ($this->form_validation->run() or $this->current_user) {
// if ($this->form_validation->run()) {
// Kill the session
$this->session->unset_userdata('redirect_to');
// trigger a post login event for third party
Events::trigger('post_user_login');
$remember = $this->input->post('remember') == 1 ? TRUE : FALSE;
if ($this->ion_auth->login($this->input->post('username'), $this->input->post('password'), $remember, 0)) {
$redirect = $this->session->userdata('login_redirect') ? $this->session->userdata('login_redirect') : 'admin';
$this->session->set_userdata('success', $this->ion_auth->messages());
redirect($redirect, 'refresh');
}
}
$this->template->set_layout('login')->build('login');
}
示例7: banner
/**
* banner url 이동 관련 함수입니다
*/
public function banner($ban_id = 0)
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_gotourl_banner';
$this->load->event($eventname);
// 이벤트가 존재하면 실행합니다
Events::trigger('before', $eventname);
$ban_id = (int) $ban_id;
if (empty($ban_id) or $ban_id < 1) {
show_404();
}
$this->load->model(array('Banner_model'));
$banner = $this->Banner_model->get_one($ban_id);
if (!element('ban_id', $banner)) {
show_404();
}
if (!element('ban_activated', $banner)) {
show_404();
}
if (!element('ban_url', $banner)) {
show_404();
}
if (!$this->session->userdata('banner_click_' . $ban_id)) {
$this->session->set_userdata('banner_click_' . $ban_id, '1');
$this->Banner_model->update_plus($ban_id, 'ban_hit', 1);
}
// 이벤트가 존재하면 실행합니다
Events::trigger('after', $eventname);
redirect(prep_url(element('ban_url', $banner)));
}
示例8: view_order
public function view_order($id)
{
// Variables
$user = isset($this->current_user->id) ? $this->current_user->id : NULL;
$order = $this->orders_m->get_order_by_id($id);
// Check user can view
if ($user != NULL and $order != FALSE and $user == $order['created_by']['user_id']) {
// Format order for display
$order['price_sub'] = number_format($order['price_sub'], 2);
$order['price_ship'] = number_format($order['price_ship'], 2);
$order['price_total'] = number_format($order['price_total'], 2);
// Format products
foreach ($order['items'] as &$item) {
$item['price'] = number_format($item['price'], 2);
}
// Build page
$this->template->title(sprintf(lang('firesale:orders:view_order'), $id))->set_breadcrumb('Home', '/home')->set_breadcrumb(lang('firesale:orders:my_orders'), '/users/orders')->set_breadcrumb(sprintf(lang('firesale:orders:view_order'), $id), '/users/orders/' . $id)->set($order);
// Fire events
Events::trigger('page_build', $this->template);
// Build page
$this->template->build('orders_single');
} else {
// Must be logged in
$this->set_flashdata('error', lang('firesale:orders:logged_in'));
redirect('/users/login');
}
}
示例9: index
/**
* 전체 메인 페이지입니다
*/
public function index()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_main_index';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$where = array('brd_search' => 1);
$board_id = $this->Board_model->get_board_list($where);
$board_list = array();
if ($board_id && is_array($board_id)) {
foreach ($board_id as $key => $val) {
$board_list[] = $this->board->item_all(element('brd_id', $val));
}
}
$view['view']['board_list'] = $board_list;
$view['view']['canonical'] = site_url();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 레이아웃을 정의합니다
*/
$page_title = $this->cbconfig->item('site_meta_title_main');
$meta_description = $this->cbconfig->item('site_meta_description_main');
$meta_keywords = $this->cbconfig->item('site_meta_keywords_main');
$meta_author = $this->cbconfig->item('site_meta_author_main');
$page_name = $this->cbconfig->item('site_page_name_main');
$layoutconfig = array('path' => 'main', 'layout' => 'layout', 'skin' => 'main', 'layout_dir' => $this->cbconfig->item('layout_main'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_main'), 'use_sidebar' => $this->cbconfig->item('sidebar_main'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_main'), 'skin_dir' => $this->cbconfig->item('skin_main'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_main'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name);
$view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
示例10: index
function index()
{
//Set your email
$your_email = "youremail@domain.com";
//Load form_validation library
$this->load->library('form_validation');
//Set validation rules
$this->form_validation->set_rules('name', lang('label_name'), 'trim|required');
$this->form_validation->set_rules('lastname', lang('label_lastname'), 'trim|required');
$this->form_validation->set_rules('message', lang('label_message'), 'trim|required');
//Is it valid?
if (!$this->form_validation->run()) {
//No it isn't, show the form agan
$this->template->append_metadata($this->load->view('fragments/wysiwyg', $this->data, TRUE))->build('form');
} else {
//Yes it is, let's get data
//Get user id
$user_id = $this->current_user->id;
//I need also the user email for the answare, i can get it from users table
$user_email = $this->supporto_m->get_user_email($user_id);
//Set template and other info
$email = array('slug' => 'support_email_template', 'to' => $your_email, 'from' => $user_email, 'name' => $this->input->post('name'), 'lastname' => $this->input->post('lastname'), 'message' => $this->input->post('message'));
//Send email
if (Events::trigger('email', $email, 'array')) {
$this->session->set_flashdata('success', lang('success_email'));
} else {
$this->session->set_flashdata('error', lang('error_email'));
}
redirect('admin/supporto');
}
}
示例11: __construct
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct();
Events::trigger('before_front_controller');
$this->load->library('template');
$this->set_current_user();
Events::trigger('after_front_controller');
}
示例12: __construct
public function __construct()
{
parent::__construct();
$this->benchmark->mark('public_controller_start');
//check for a redirect
$this->load->model('redirects/redirect_m');
$uri = trim(uri_string(), '/');
if ($redirect = $this->redirect_m->get_from($uri)) {
redirect($redirect->to);
}
Events::trigger('public_controller');
// Check the frontend hasnt been disabled by an admin
if (!$this->settings->frontend_enabled && (empty($this->current_user) or $this->current_user->group != 'admin')) {
header('Retry-After: 600');
$error = $this->settings->unavailable_message ? $this->settings->unavailable_message : lang('cms_fatal_error');
show_error($error, 503);
}
// -- Navigation menu -----------------------------------
$this->load->model('pages/page_m');
// Load the current theme so we can set the assets right away
ci()->theme = $this->theme_m->get();
if (empty($this->theme->slug)) {
show_error('This site has been set to use a theme that does not exist. If you are an administrator please ' . anchor('admin/themes', 'change the theme') . '.');
}
// Prepare Asset library
$this->asset->set_theme($this->theme->slug);
// Set the front-end theme directory
$this->config->set_item('theme_asset_dir', dirname($this->theme->path) . '/');
$this->config->set_item('theme_asset_url', BASE_URL . dirname($this->theme->web_path) . '/');
// Set the theme view folder
$this->template->set_theme($this->theme->slug)->append_metadata('
<script type="text/javascript">
var APPPATH_URI = "' . APPPATH_URI . '";
var BASE_URI = "' . BASE_URI . '";
</script>');
// Is there a layout file for this module?
if ($this->template->layout_exists($this->module . '.html')) {
$this->template->set_layout($this->module . '.html');
} elseif ($this->template->layout_exists('default.html')) {
$this->template->set_layout('default.html');
}
// Make sure whatever page the user loads it by, its telling search robots the correct formatted URL
$this->template->set_metadata('canonical', site_url($this->uri->uri_string()), 'link');
// If there is a blog module, link to its RSS feed in the head
if (module_exists('blog')) {
$this->template->append_metadata('<link rel="alternate" type="application/rss+xml" title="' . $this->settings->site_name . '" href="' . site_url('blog/rss/all.rss') . '" />');
}
// Frontend data
$this->load->library('variables/variables');
// grab the theme options if there are any
$this->theme->options = $this->pyrocache->model('theme_m', 'get_values_by', array(array('theme' => $this->theme->slug)));
// Assign segments to the template the new way
$this->template->variables = $this->variables->get_all();
$this->template->settings = $this->settings->get_all();
$this->template->server = $_SERVER;
$this->template->theme = $this->theme;
$this->benchmark->mark('public_controller_end');
}
示例13: index
/**
* 게시판 그룹 페이지입니다
*/
public function index($bgr_key = '')
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_group_index';
$this->load->event($eventname);
if (empty($bgr_key)) {
show_404();
}
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$group_id = $this->board_group->item_key('bgr_id', $bgr_key);
if (empty($group_id)) {
show_404();
}
$group = $this->board_group->item_all($group_id);
$select = 'brd_id';
$where = array('bgr_id' => element('bgr_id', $group), 'brd_search' => 1);
$board_id = $this->Board_model->get_board_list($where);
$board_list = array();
if ($board_id && is_array($board_id)) {
foreach ($board_id as $key => $val) {
$board_list[] = $this->board->item_all(element('brd_id', $val));
}
}
$view['view']['board_list'] = $board_list;
$view['view']['canonical'] = group_url($bgr_key);
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 레이아웃을 정의합니다
*/
$page_title = $this->cbconfig->item('site_meta_title_group');
$meta_description = $this->cbconfig->item('site_meta_description_group');
$meta_keywords = $this->cbconfig->item('site_meta_keywords_group');
$meta_author = $this->cbconfig->item('site_meta_author_group');
$page_name = $this->cbconfig->item('site_page_name_group');
$searchconfig = array('{그룹명}', '{그룹아이디}');
$replaceconfig = array(element('bgr_name', $group), $bgr_key);
$page_title = str_replace($searchconfig, $replaceconfig, $page_title);
$meta_description = str_replace($searchconfig, $replaceconfig, $meta_description);
$meta_keywords = str_replace($searchconfig, $replaceconfig, $meta_keywords);
$meta_author = str_replace($searchconfig, $replaceconfig, $meta_author);
$page_name = str_replace($searchconfig, $replaceconfig, $page_name);
$layout_dir = element('group_layout', $group) ? element('group_layout', $group) : $this->cbconfig->item('layout_group');
$mobile_layout_dir = element('group_mobile_layout', $group) ? element('group_mobile_layout', $group) : $this->cbconfig->item('mobile_layout_group');
$use_sidebar = element('group_sidebar', $group) ? element('group_sidebar', $group) : $this->cbconfig->item('sidebar_group');
$use_mobile_sidebar = element('group_mobile_sidebar', $group) ? element('group_mobile_sidebar', $group) : $this->cbconfig->item('mobile_sidebar_group');
$skin_dir = element('group_skin', $group) ? element('group_skin', $group) : $this->cbconfig->item('skin_group');
$mobile_skin_dir = element('group_mobile_skin', $group) ? element('group_mobile_skin', $group) : $this->cbconfig->item('mobile_skin_group');
$layoutconfig = array('path' => 'group', 'layout' => 'layout', 'skin' => 'group', 'layout_dir' => $layout_dir, 'mobile_layout_dir' => $mobile_layout_dir, 'use_sidebar' => $use_sidebar, 'use_mobile_sidebar' => $use_mobile_sidebar, 'skin_dir' => $skin_dir, 'mobile_skin_dir' => $mobile_skin_dir, 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name);
$view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
示例14: _check_login
/**
* Callback From: login()
*
* @param string $email The Email address to validate
*
* @return bool
*/
public function _check_login($email)
{
if ($this->ion_auth->login($email, $this->input->post('password'), (bool) $this->input->post('remember'))) {
Events::trigger('post_admin_login');
return true;
}
$this->form_validation->set_message('_check_login', $this->ion_auth->errors());
return false;
}
示例15: _mailToSaleDepartment
private function _mailToSaleDepartment($orderDetail)
{
$this->ci->load->model('users/ion_auth_model');
$users = $this->ci->ion_auth_model->get_active_users('sale')->result();
if (!empty($users)) {
foreach ($users as $user) {
$array = Events::trigger('email', array('slug' => 'mail-to-sale-deparment', 'to' => $user->email, 'name' => $user->first_name . $user->last_name, 'order_id' => sprintf('#%s', $orderDetail->order_number)), 'array');
}
}
return;
}