Example #1
0
 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');
     }
 }
Example #2
0
	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: '******'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();
	}
Example #3
0
 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();
 }
 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();
 }
Example #5
0
 /**
  * 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('/');
 }
Example #6
0
 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();
 }
Example #7
0
 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();
 }
 /**
  * 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();
 }
Example #9
0
 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);
     }
 }
Example #10
0
 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();
 }
Example #11
0
 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();
 }
Example #12
0
 /**
  * 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);
 }
Example #13
0
 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();
 }
Example #14
0
 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: '******'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();
 }
Example #15
0
 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();
 }
Example #16
0
 public function create()
 {
     $this->auth->restrict('Data_Penjadwalan.Penjadwalan.Create');
     if ($this->input->post('save')) {
         if ($insert_id = $this->save_data_penjadwalan()) {
             // Log the activity
             $this->activity_model->log_activity($this->current_user->id, lang('data_penjadwalan_act_create_record') . ': ' . $insert_id . ' : ' . $this->input->ip_address(), 'data_penjadwalan');
             Template::set_message(lang('data_penjadwalan_create_success'), 'success');
             Template::redirect(SITE_AREA . '/penjadwalan/data_penjadwalan');
         } else {
             Template::set_message(lang('data_penjadwalan_create_failure') . $this->data_penjadwalan_model->error, 'error');
         }
     }
     //pilih tahun akademik
     $data_tahun_akademik = $this->data_penjadwalan_model->get_tahun_akademik();
     if (!empty($data_tahun_akademik)) {
         $option_ta[''] = '';
         foreach ($data_tahun_akademik as $row) {
             $option_ta[$row->kode_tahun_akademik] = $row->semester == 1 ? "{$row->tahun_akademik} Semester Ganjil" : " {$row->tahun_akademik} Semester Genap";
         }
         Template::set('option_ta', $option_ta);
     }
     $this->load->library('siska');
     Template::set('ta_aktif', $this->siska->get_kode_tahun_akademik());
     //pilih ruuang
     $data_ruang = $this->data_penjadwalan_model->get_ruang();
     if (!empty($data_ruang)) {
         $option_ruang[''] = '';
         foreach ($data_ruang as $row) {
             $option_ruang[$row->kode_ruang] = $row->nama_ruang;
         }
         Template::set('option_ruang', $option_ruang);
     }
     Assets::add_module_js('data_penjadwalan', 'data_penjadwalan.js');
     Template::set('toolbar_title', lang('data_penjadwalan_create') . ' Data Penjadwalan');
     Template::render();
 }
Example #17
0
 public function create()
 {
     $this->auth->restrict('Kompetensi.Jurusan.Create');
     if ($this->input->post('save')) {
         if ($insert_id = $this->save_kompetensi()) {
             // Log the activity
             $this->activity_model->log_activity($this->current_user->id, lang('kompetensi_act_create_record') . ': ' . $insert_id . ' : ' . $this->input->ip_address(), 'kompetensi');
             Template::set_message(lang('kompetensi_create_success'), 'success');
             Template::redirect(SITE_AREA . '/jurusan/kompetensi/create');
         } else {
             Template::set_message(lang('kompetensi_create_failure') . $this->kompetensi_model->error, 'error');
         }
     }
     $data = $this->kompetensi_model->get_nama_jurusan();
     if (!empty($data)) {
         foreach ($data as $row) {
             $options[$row->kode_nama_jurusan] = $row->nama_jurusan;
         }
         Template::set('options', $options);
     }
     Assets::add_module_js('kompetensi', 'kompetensi.js');
     Template::set('toolbar_title', lang('kompetensi_create') . ' Kompetensi');
     Template::render();
 }
Example #18
0
 public function create()
 {
     $this->auth->restrict('Detail_Kalender_Akademik.Jurusan.Create');
     $options_kode_kalender_akademik = $this->detail_kalender_akademik_model->get_kalender_akademik()->result();
     $options = array('' => '');
     foreach ($options_kode_kalender_akademik as $row) {
         //$data['options_kode_kalender_akademik']
         $options[$row->kode_kalender_akademik] = $row->kode_kalender_akademik . ' - ' . $row->deskripsi_kalender_akademik;
     }
     Template::set('options', $options);
     if ($this->input->post('save')) {
         if ($insert_id = $this->save_detail_kalender_akademik()) {
             // Log the activity
             $this->activity_model->log_activity($this->current_user->id, lang('detail_kalender_akademik_act_create_record') . ': ' . $insert_id . ' : ' . $this->input->ip_address(), 'detail_kalender_akademik');
             Template::set_message(lang('detail_kalender_akademik_create_success'), 'success');
             Template::redirect(SITE_AREA . '/jurusan/detail_kalender_akademik/index/' . $this->uri->segment(5));
         } else {
             Template::set_message(lang('detail_kalender_akademik_create_failure') . $this->detail_kalender_akademik_model->error, 'error');
         }
     }
     Assets::add_module_js('detail_kalender_akademik', 'detail_kalender_akademik.js');
     Template::set('toolbar_title', lang('detail_kalender_akademik_create') . ' Detail Kalender Akademik');
     Template::render();
 }
 /**
  * Forces all users to require a password reset on their next login.
  *
  * Intended to be used as an AJAX function.
  *
  * @return void
  */
 public function force_password_reset_all()
 {
     $this->auth->restrict('Bonfire.Users.Manage');
     if ($this->user_model->force_password_reset()) {
         // Resets are in place, so log the user out
         $this->auth->logout();
         Template::redirect(LOGIN_URL);
     } else {
         Template::redirect($this->previous_page);
     }
 }
Example #20
0
 /**
  * Checks that a user is logged in (and, optionally of the correct role)
  * and, if not, send them to the login screen.
  *
  * If no permission is checked, will simply verify that the user is logged in.
  * If a permission is passed in to the first parameter, will check the user's role
  * and verify that role has the appropriate permission.
  *
  * @access public
  *
  * @param string $permission (Optional) A string representing the permission to check for.
  * @param string $uri        (Optional) A string representing an URI to redirect, if FALSE
  *
  * @return bool TRUE if the user has the appropriate access permissions. Redirect to the previous page if the user doesn't have permissions. Redirect to LOGIN_AREA page if the user is not logged in.
  */
 public function restrict($permission = NULL, $uri = NULL)
 {
     // If user isn't logged in, don't need to check permissions
     if ($this->is_logged_in() === FALSE) {
         $this->ci->load->library('Template');
         Template::set_message($this->ci->lang->line('us_must_login'), 'error');
         Template::redirect(LOGIN_URL);
     }
     // Check to see if the user has the proper permissions
     if (!empty($permission) && !$this->has_permission($permission)) {
         // set message telling them no permission THEN redirect
         Template::set_message(lang('us_no_permission'), 'attention');
         if (!$uri) {
             $uri = $this->ci->session->userdata('previous_page');
             // If previous page was the same (e.g. user pressed F5),
             // but permission has been removed, then redirecting
             // to it will cause an infinite loop.
             if ($uri == current_url()) {
                 $uri = site_url();
             }
         }
         Template::redirect($uri);
     }
     return TRUE;
 }
Example #21
0
 /**
  * Activate user.
  *
  * Checks a passed activation code and, if verified, enables the user account.
  * If the code fails, an error is generated.
  *
  * @param  integer $user_id The user's ID.
  *
  * @return void
  */
 public function activate($user_id = null)
 {
     if (isset($_POST['activate'])) {
         $this->form_validation->set_rules('code', 'Verification Code', 'required|trim');
         if ($this->form_validation->run()) {
             $code = $this->input->post('code');
             $activated = $this->user_model->activate($user_id, $code);
             if ($activated) {
                 $user_id = $activated;
                 // Now send the email.
                 $this->load->library('emailer/emailer');
                 $email_message_data = array('title' => $this->settings_lib->item('site.title'), 'link' => site_url(LOGIN_URL));
                 $data = array('to' => $this->user_model->find($user_id)->email, 'subject' => lang('us_account_active'), 'message' => $this->load->view('_emails/activated', $email_message_data, true));
                 if ($this->emailer->send($data)) {
                     Template::set_message(lang('us_account_active'), 'success');
                 } else {
                     Template::set_message(lang('us_err_no_email') . $this->emailer->error, 'error');
                 }
                 Template::redirect('/');
             }
             if (!empty($this->user_model->error)) {
                 Template::set_message($this->user_model->error . '. ' . lang('us_err_activate_code'), 'error');
             }
         }
     }
     Template::set_view('users/activate');
     Template::set('page_title', 'Account Activation');
     Template::render();
 }
Example #22
0
 /**
  * Activate user.
  *
  * Checks a passed activation code and, if verified, enables the user account.
  * If the code fails, an error is generated.
  *
  * @param  integer $user_id The user's ID.
  *
  * @return void
  */
 public function activate($user_id = null, $activate_code = NULL)
 {
     if (!empty($activate_code)) {
         if (isset($activate_code)) {
             $code = $activate_code;
             $activated = $this->user_model->activate($user_id, $code);
             if ($activated) {
                 $user_id = $activated;
                 // Now send the email.
                 $this->load->library('emailer/emailer');
                 $data = array('to' => $this->user_model->find($user_id)->email, 'subject' => lang('us_account_active'), 'variables' => array(array('name' => 'SITE_URL', 'content' => site_url()), array('name' => 'SITETITLE', 'content' => $this->settings_lib->item('site.title')), array('name' => 'LOGIN_LINK', 'content' => site_url() . '/login')), 'template_name' => 'ACCOUNT_ACTIVATE');
                 if ($this->emailer->send($data)) {
                     Template::set_message(lang('us_account_active'), 'success');
                 } else {
                     Template::set_message(lang('us_err_no_email') . $this->emailer->error, 'error');
                 }
                 Template::redirect('/login');
             }
             if (!empty($this->user_model->error)) {
                 Template::set_message($this->user_model->error . '. ' . lang('us_err_activate_code'), 'error');
                 Template::redirect('/login');
             }
         }
     }
     Template::set_view('users/activate');
     Template::set('page_title', 'Account Activation');
     Template::render();
 }
Example #23
0
 /**
  * Edit a role record
  *
  * @access public
  *
  * @return void
  */
 public function edit()
 {
     $this->auth->restrict('Bonfire.Roles.Manage');
     $id = (int) $this->uri->segment(5);
     if (empty($id)) {
         Template::set_message('Invalid Role ID.', 'error');
         redirect(SITE_AREA . '/settings/roles');
     }
     if (isset($_POST['save'])) {
         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);
         }
     } elseif (isset($_POST['delete'])) {
         if ($this->role_model->delete($id)) {
             Template::set_message('The Role was successfully deleted.', 'success');
             redirect(SITE_AREA . '/settings/roles');
         } else {
             Template::set_message('We could not delete the role: ' . $this->role_model->error, 'error');
         }
     }
     Template::set('role', $this->role_model->find($id));
     Template::set('contexts', list_contexts(true));
     Template::set('toolbar_title', 'Edit Role');
     Template::set_view('settings/role_form');
     Template::render();
 }
Example #24
0
 /**
  * Check whether a user is logged in (and, optionally of the correct role) and,
  * if not, send them to the login screen.
  *
  * If no permission is checked, will simply verify that the user is logged in.
  * If a permission is passed in to the first parameter, it will check the user's
  * role and verify that role has the appropriate permission.
  *
  * @param string $permission (Optional) The permission to check for.
  * @param string $uri        (Optional) The redirect URI if the user does not
  * have the correct permission.
  *
  * @return boolean True if the user has the appropriate access permissions.
  * Redirect to the previous page if the user doesn't have permissions.
  * Redirect to LOGIN_AREA page if the user is not logged in.
  */
 public function restrict($permission = null, $uri = null)
 {
     // If user isn't logged in, redirect to the login page.
     if ($this->is_logged_in() === false) {
         $this->ci->load->library('Template');
         Template::set_message($this->ci->lang->line('us_must_login'), 'error');
         Template::redirect(LOGIN_URL);
     }
     // Check whether the user has the proper permissions.
     if (empty($permission) || $this->has_permission($permission)) {
         return true;
     }
     // If the user is logged in, but does not have permission...
     // If $uri is not set, get the previous page from the session.
     if (!$uri) {
         $uri = $this->ci->session->userdata('previous_page');
         // If previous page and current page are the same, but the user no longer
         // has permission, redirect to site URL to prevent an infinite loop.
         if ($uri == current_url()) {
             $uri = site_url();
         }
     }
     // Inform the user of the lack of permission and redirect.
     $this->ci->load->library('Template');
     Template::set_message(lang('us_no_permission'), 'attention');
     Template::redirect($uri);
 }
Example #25
0
 /**
  * Create a new email and send to selected recipents
  *
  * @access public
  *
  * @return void
  */
 public function create()
 {
     $this->load->model('users/user_model');
     $this->load->library('emailer');
     if ($this->input->post('submit')) {
         // validate subject, content and recipients
         $this->form_validation->set_rules('email_subject', 'Email Subject', 'required|xss_clean|trim|min_length[1]|max_length[255]');
         $this->form_validation->set_rules('email_content', 'Email Content', 'required|trim|min_length[1]');
         $this->form_validation->set_rules('checked', 'Users', 'required');
         if ($this->form_validation->run() === FALSE) {
             Template::set('email_subject', $this->security->xss_clean($this->input->post('email_subject')));
             Template::set('email_content', $this->input->post('email_content'));
             Template::set('checked', $this->input->post('checked'));
         } else {
             $data = array('subject' => $this->input->post('email_subject'), 'message' => $this->input->post('email_content'));
             $checked = $this->input->post('checked');
             $success_count = 0;
             if (is_array($checked) && count($checked)) {
                 $result = FALSE;
                 foreach ($checked as $user_id) {
                     //get the email from user_id
                     $user = $this->user_model->find($user_id);
                     if ($user != NULL) {
                         $data['to'] = $user->email;
                         $result = $this->emailer->send($data, TRUE);
                         if ($result) {
                             $success_count++;
                         }
                     }
                 }
                 if ($result) {
                     Template::set_message($success_count . ' ' . lang('em_create_email_success'), 'success');
                     Template::redirect(SITE_AREA . '/settings/emailer/queue');
                 } else {
                     Template::set_message(lang('em_create_email_failure') . $this->user_model->error, 'error');
                 }
             } else {
                 Template::set_message(lang('em_create_email_error') . $this->user_model->error, 'error');
             }
             //end if
         }
         //end if
     }
     //end if
     $users = $this->user_model->find_all();
     Template::set('users', $users);
     Template::set('toolbar_title', lang('em_create_email'));
     Template::render();
 }
Example #26
0
 public function edit()
 {
     $id = $this->uri->segment(5);
     if (empty($id)) {
         Template::set_message(lang('nama_jurusan_invalid_id'), 'error');
         redirect(SITE_AREA . '/jurusan/nama_jurusan');
     }
     if (isset($_POST['save'])) {
         $this->auth->restrict('Nama_Jurusan.Jurusan.Edit');
         if ($this->save_nama_jurusan('update', $id)) {
             // Log the activity
             $this->activity_model->log_activity($this->current_user->id, lang('nama_jurusan_act_edit_record') . ': ' . $id . ' : ' . $this->input->ip_address(), 'nama_jurusan');
             Template::set_message(lang('nama_jurusan_edit_success'), 'success');
             Template::redirect(SITE_AREA . '/jurusan/nama_jurusan');
         } else {
             Template::set_message(lang('nama_jurusan_edit_failure') . $this->nama_jurusan_model->error, 'error');
         }
     } else {
         if (isset($_POST['delete'])) {
             $this->auth->restrict('Nama_Jurusan.Jurusan.Delete');
             if ($this->nama_jurusan_model->delete($id)) {
                 // Log the activity
                 $this->activity_model->log_activity($this->current_user->id, lang('nama_jurusan_act_delete_record') . ': ' . $id . ' : ' . $this->input->ip_address(), 'nama_jurusan');
                 Template::set_message(lang('nama_jurusan_delete_success'), 'success');
                 redirect(SITE_AREA . '/jurusan/nama_jurusan');
             } else {
                 Template::set_message(lang('nama_jurusan_delete_failure') . $this->nama_jurusan_model->error, 'error');
             }
         }
     }
     Template::set('nama_jurusan', $this->nama_jurusan_model->find($id));
     $data = $this->nama_jurusan_model->select_jurusan();
     if (!empty($data)) {
         $option_jurusan[''] = '';
         foreach ($data as $row) {
             $option_jurusan[$row->kode_jurusan] = $row->nama_jurusan;
         }
         Template::set('jurusan', $option_jurusan);
     }
     //print_r($option_jurusan);
     $data = $this->nama_jurusan_model->select_jenjang();
     if (!empty($data)) {
         $option[''] = '';
         foreach ($data as $row) {
             $option[$row->kode_jenjang] = $row->nama_jenjang;
         }
         Template::set('jenjang', $option);
     }
     //print_r($option);
     Assets::add_module_js('nama_jurusan', 'nama_jurusan.js');
     Template::set('toolbar_title', lang('nama_jurusan_edit') . ' Nama Jurusan');
     Template::render();
 }
Example #27
0
 public function view($enc_msg_id, $enc_from_user, $enc_to_user)
 {
     //Restrict the user if he is not logged in
     $this->auth->restrict();
     $this->set_current_user();
     $from_user_id = $enc_from_user;
     $to_user_id = $enc_to_user;
     $fmsg_id = $enc_msg_id;
     if ($this->current_user->id != $from_user_id && $this->current_user->id != $to_user_id) {
         Template::set_message(lang('view_wrong_msg'), 'error');
         Template::redirect($login_url);
     }
     $message = $this->message_model->find($fmsg_id);
     $user1 = $this->user_model->find($from_user_id);
     $message->from_user = $user1->display_name;
     $user2 = $this->user_model->find($to_user_id);
     $message->to_user = $user2->display_name;
     Template::set('message', $message);
     Template::set('page_title', 'My Inbox Message');
     Template::set_view('messages/view_single_message');
     Template::render('user');
 }
Example #28
0
 public function pembayaran_dispensasi()
 {
     $this->auth->restrict('Pembayaran.Keuangan.Dispensasi');
     $kode_pembayaran = $this->uri->segment(5);
     Assets::clear_cache();
     Assets::add_module_js('pembayaran', 'dispensasi');
     if ($this->input->post('save')) {
         $this->load->model('dispensasi_model', null, true);
         $data = array();
         $data['tanggal_pembayaran'] = $this->input->post('tanggal_pembayaran');
         $this->dispensasi_model->update_where('kode_pembayaran', $kode_pembayaran, $data);
         $data_pembayaran['status_pembayaran'] = 'LD';
         $this->input->post('denda') == 'D' ? $data_pembayaran['status_denda'] = 'D' : "";
         $this->pembayaran_model->update_where('kode_pembayaran', $kode_pembayaran, $data_pembayaran);
         Template::set_message('Berhasil menyimpan pembayaran dispensasi', 'success');
         Template::redirect(SITE_AREA . '/keuangan/pembayaran/');
     }
     $records = $this->pembayaran_model->getdata_dispensasi($kode_pembayaran);
     Template::set('record', $records);
     Template::set('toolbar_title', 'Pembayaran Dispensasi');
     Template::render();
 }
Example #29
0
 public function restore()
 {
     $id = $this->uri->segment(5);
     if ($this->user_model->update($id, array('users.deleted' => 0))) {
         Template::set_message('User successfully restored.', 'success');
     } else {
         Template::set_message('Unable to restore user: '******'error');
     }
     Template::redirect(SITE_AREA . '/settings/users');
 }
Example #30
0
 public function view($file = '')
 {
     if (empty($file)) {
         $file = $this->uri->segment(5);
     }
     if (empty($file)) {
         Template::set_message('No log file provided.', 'error');
         Template::redirect(SITE_AREA . '/developer/logs');
     }
     Template::set('log_file', $file);
     Template::set('log_content', file($this->config->item('log_path') . $file));
     Template::render();
 }