本文整理汇总了PHP中Template::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::redirect方法的具体用法?PHP Template::redirect怎么用?PHP Template::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login()
{
// if the user is not logged in continue to show the login page
if ($this->auth->is_logged_in() === false) {
if ($this->input->post('submit')) {
$remember = $this->input->post('remember_me') == '1' ? true : false;
// Try to login
if ($this->auth->login($this->input->post('login'), $this->input->post('password'), $remember) === true) {
$this->activity_model->log_activity($this->auth->user_id(), lang('us_log_logged') . ': ' . $this->input->ip_address(), 'users');
/*
In many cases, we will have set a destination for a
particular user-role to redirect to. This is helpful for
cases where we are presenting different information to different
roles that might cause the base destination to be not available.
*/
if (config_item('auth.do_login_redirect')) {
Template::redirect($this->auth->login_destination);
} else {
if (!empty($this->requested_page)) {
Template::redirect($this->requested_page);
} else {
Template::redirect('/');
}
}
}
}
Template::set_view('users/users/login');
Template::set('page_title', 'Login');
Template::render();
} else {
redirect(SITE_AREA . '/content');
}
}
示例2: create
public function create()
{
$this->auth->restrict('Bonfire.Users.Add');
$this->load->helper('address');
if ($this->input->post('submit'))
{
if ($this->save_user())
{
Template::set_message('User successfully created.', 'success');
Template::redirect('admin/settings/users');
}
else
{
Template::set_message('There was a problem creating the user: '. $this->user_model->error);
}
}
Template::set('roles', $this->role_model->select('role_id, role_name, default')->find_all());
Template::set('toolbar_title', 'Create New User');
Template::set_view('settings/user_form');
Template::render();
}
示例3: create
public function create()
{
$this->auth->restrict('Jenis_Pembayaran.Keuangan.Create');
Assets::add_js('format_uang');
if ($this->input->post('save')) {
if ($insert_id = $this->save_jenis_pembayaran()) {
// Log the activity
$this->activity_model->log_activity($this->current_user->id, lang('jenis_pembayaran_act_create_record') . ': ' . $insert_id . ' : ' . $this->input->ip_address(), 'jenis_pembayaran');
Template::set_message(lang('jenis_pembayaran_create_success'), 'success');
Template::redirect(SITE_AREA . '/keuangan/jenis_pembayaran/create');
} else {
Template::set_message(lang('jenis_pembayaran_create_failure') . $this->jenis_pembayaran_model->error, 'error');
}
}
$data = $this->jenis_pembayaran_model->get_nama_jurusan();
if (!empty($data)) {
$option[""] = "";
foreach ($data as $row) {
$option[$row->kode_nama_jurusan] = $row->nama_jurusan;
}
$option['99'] = 'Semua Jurusan';
Template::set('nama_jurusan', $option);
}
$data_kode_jenis_pembayaran = $this->jenis_pembayaran_model->get_kode_jenis_pembayaran();
if (!empty($data_kode_jenis_pembayaran)) {
$option_kode_jenis[""] = "";
foreach ($data_kode_jenis_pembayaran as $row) {
$option_kode_jenis[$row->kode_jenis_pembayaran] = $row->jenis_pembayaran;
}
Template::set('kode_jenis_pembayaran', $option_kode_jenis);
}
Assets::add_module_js('jenis_pembayaran', 'jenis_pembayaran.js');
Template::set('toolbar_title', lang('jenis_pembayaran_create') . ' Jenis Pembayaran');
Template::render();
}
示例4: create
public function create()
{
$this->auth->restrict('Navigation.Content.Create');
$nav_items = $this->navigation_model->order_by('nav_group_id, position')->find_all();
$data['parents'] = array();
$data['parents'][] = '';
if (is_array($nav_items) && count($nav_items)) {
foreach ($nav_items as $key => $record) {
$data['parents'][$record->nav_id] = $record->title;
}
}
$groups = $this->navigation_group_model->find_all('nav_group_id');
$data['groups'] = array();
if (is_array($groups) && count($groups)) {
foreach ($groups as $group_id => $record) {
$data['groups'][$group_id] = $record->title;
}
}
Template::set("data", $data);
if ($this->input->post('submit')) {
if ($this->save_navigation()) {
Template::set_message(lang("navigation_create_success"), 'success');
Template::redirect(SITE_AREA . '/content/navigation');
} else {
Template::set_message(lang("navigation_create_failure") . $this->navigation_model->error, 'error');
}
}
Template::set_view('content/form');
Template::set('toolbar_title', lang("navigation_create_new_button"));
Template::render();
}
示例5: logout
/**
* Log out, destroy the session, and cleanup, then redirect to the home page.
*
* @return void
*/
public function logout()
{
if (isset($this->current_user->id)) {
// TODO Log the logout Activity.
//lang('us_log_logged_out') . ': ' . $this->input->ip_address(),
}
// Always clear browser data (don't silently ignore user requests).
$this->auth->logout();
Template::redirect('/');
}
示例6: create
public function create()
{
if ($this->input->post('submit')) {
if ($this->save_role()) {
Template::set_message('Role successfully created.', 'success');
Template::redirect(SITE_AREA . '/settings/roles');
} else {
Template::set_message('There was a problem creating the role: ' . $this->role_model->error, 'error');
}
}
Template::set('toolbar_title', 'Create New Role');
Template::set_view('settings/role_form');
Template::render();
}
示例7: create
public function create()
{
if ($this->input->post('submit')) {
if ($this->save_permissions()) {
Template::set_message(lang("permissions_create_success"), 'success');
Template::redirect(SITE_AREA . '/settings/permissions');
} else {
Template::set_message(lang("permissions_create_failure") . $this->permission_model->error, 'error');
}
}
Template::set('toolbar_title', lang("permissions_create_new_button"));
Template::set_view('settings/permission_form');
Template::render();
}
示例8: create
/**
* Creates a new navigation group
*/
public function create()
{
$this->auth->restrict('Navigation.Content.Create');
if ($this->input->post('submit')) {
if ($this->save_navigation()) {
Template::set_message(lang("navigation_create_success"), 'success');
Template::redirect(SITE_AREA . '/content/navigation/groups');
} else {
Template::set_message(lang("navigation_create_failure") . $this->navigation_group_model->error, 'error');
}
}
Template::set('toolbar_title', lang("navigation_create_new_button"));
Template::set_view('groups/create');
Template::set("toolbar_title", "Manage Navigation Groups");
Template::render();
}
示例9: save_kurikulum
public function save_kurikulum()
{
if ($this->input->post('save')) {
$kode_mk = $this->input->post('kode_matakuliah');
$kode_kurikulum = $this->input->post('kode_nama_kurikulum');
$matakuliah = count($kode_mk);
for ($i = 0; $i < $matakuliah; $i++) {
$data = array();
$data['kode_nama_kurikulum'] = $kode_kurikulum;
$data['kode_matakuliah'] = $kode_mk[$i];
$this->kurikulum_model->insert($data);
}
Template::set_message($matakuliah . ' Mata Kuliah Berhasil Ditambahkan ke Kurikulum', 'success');
Template::redirect(SITE_AREA . '/jurusan/kurikulum/index/' . $kode_kurikulum);
}
}
示例10: create
public function create()
{
$this->auth->restrict('Kode_Jenis_Pembayaran.Keuangan.Create');
if ($this->input->post('save')) {
if ($insert_id = $this->save_kode_jenis_pembayaran()) {
// Log the activity
$this->activity_model->log_activity($this->current_user->id, lang('kode_jenis_pembayaran_act_create_record') . ': ' . $insert_id . ' : ' . $this->input->ip_address(), 'kode_jenis_pembayaran');
Template::set_message(lang('kode_jenis_pembayaran_create_success'), 'success');
Template::redirect(SITE_AREA . '/keuangan/kode_jenis_pembayaran');
} else {
Template::set_message(lang('kode_jenis_pembayaran_create_failure') . $this->kode_jenis_pembayaran_model->error, 'error');
}
}
Assets::add_module_js('kode_jenis_pembayaran', 'kode_jenis_pembayaran.js');
Template::set('toolbar_title', lang('kode_jenis_pembayaran_create') . ' Kode Jenis Pembayaran');
Template::render();
}
示例11: create
public function create()
{
$this->auth->restrict('Departemen.Manajemen.Create');
if ($this->input->post('save')) {
if ($insert_id = $this->save_departemen()) {
// Log the activity
$this->activity_model->log_activity($this->current_user->id, lang('departemen_act_create_record') . ': ' . $insert_id . ' : ' . $this->input->ip_address(), 'departemen');
Template::set_message(lang('departemen_create_success'), 'success');
Template::redirect(SITE_AREA . '/manajemen/departemen');
} else {
Template::set_message(lang('departemen_create_failure') . $this->departemen_model->error, 'error');
}
}
Assets::add_module_js('departemen', 'departemen.js');
Template::set('toolbar_title', lang('departemen_create') . ' Departemen');
Template::render();
}
示例12: register
/**
* Display registration form for new user.
*
* @return void
*/
public function register()
{
// Are users allowed to register?
if (!$this->settings_lib->item('auth.allow_register')) {
Template::set_message(lang('us_register_disabled'), 'error');
Template::redirect('/');
}
$register_url = $this->input->post('register_url') ?: REGISTER_URL;
$login_url = $this->input->post('login_url') ?: LOGIN_URL;
$this->load->model('roles/role_model');
$this->load->helper('date');
$this->load->config('address');
$this->load->helper('address');
$this->load->config('user_meta');
$meta_fields = config_item('user_meta_fields');
Template::set('meta_fields', $meta_fields);
}
示例13: create
public function create()
{
$this->auth->restrict('Jenjang.Jurusan.Create');
if ($this->input->post('save')) {
if ($insert_id = $this->save_jenjang()) {
// Log the activity
$this->activity_model->log_activity($this->current_user->id, lang('jenjang_act_create_record') . ': ' . $insert_id . ' : ' . $this->input->ip_address(), 'jenjang');
Template::set_message(lang('jenjang_create_success'), 'success');
Template::redirect(SITE_AREA . '/jurusan/jenjang');
} else {
Template::set_message(lang('jenjang_create_failure') . $this->jenjang_model->error, 'error');
}
}
Assets::add_module_js('jenjang', 'jenjang.js');
Template::set('toolbar_title', lang('jenjang_create') . ' Jenjang');
Template::render();
}
示例14: create
public function create()
{
$this->auth->restrict('Bonfire.Users.Add');
$this->load->config('address');
$this->load->helper('address');
if ($this->input->post('submit')) {
if ($id = $this->save_user()) {
$user = $this->user_model->find($id);
$this->activity_model->log_activity($this->auth->user_id(), lang('us_log_create') . ' ' . $user->role_name . ': ' . (config_item('auth.use_usernames') ? $user->username : $user->email), 'users');
Template::set_message('User successfully created.', 'success');
Template::redirect(SITE_AREA . '/settings/users');
} else {
Template::set_message('There was a problem creating the user: ' . $this->user_model->error);
}
}
Template::set('roles', $this->role_model->select('role_id, role_name, default')->find_all());
Template::set('toolbar_title', lang('us_create_user'));
Template::set_view('settings/user_form');
Template::render();
}
示例15: edit
public function edit()
{
$id = (int) $this->uri->segment(5);
if (empty($id)) {
Template::set_message('Invalid Role ID.', 'error');
redirect(SITE_AREA . '/settings/roles');
}
$this->auth->restrict('Bonfire.Roles.Manage');
if ($this->input->post('submit')) {
if ($this->save_role('update', $id)) {
Template::set_message('Role successfully saved.', 'success');
// redirect to update the sidebar which will show old name otherwise.
Template::redirect(SITE_AREA . '/settings/roles');
} else {
Template::set_message('There was a problem saving the role: ' . $this->role_model->error);
}
}
Template::set('role', $this->role_model->find($id));
Template::set('toolbar_title', 'Edit Role');
Template::set_view('settings/role_form');
Template::render();
}