当前位置: 首页>>代码示例>>PHP>>正文


PHP sentinel函数代码示例

本文整理汇总了PHP中sentinel函数的典型用法代码示例。如果您正苦于以下问题:PHP sentinel函数的具体用法?PHP sentinel怎么用?PHP sentinel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sentinel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update($id)
 {
     $this->form_validation->set_rules('name', 'Name', 'trim|required');
     if ($this->form_validation->run() == FALSE) {
         $group = sentinel()->findRoleBySlug('edt');
         $data['kategori'] = Model\Portal\Category::findOrFail($id);
         $data['kategori_lists'] = $this->model->getLists($id);
         $data['users'] = $group->users->pluck('email', 'id')->toArray();
         $this->template->build('kategori_edit', $data);
     } else {
         $kategori['name'] = $this->input->post('name');
         $kategori['description'] = $this->input->post('description');
         $kategori['parent'] = $this->input->post('parent');
         $editor = set_value('editor', []);
         $category = Model\Portal\Category::findOrFail($id);
         $category->update($kategori);
         $category->editors()->sync($editor);
         if ($res == TRUE) {
             set_message_success('Kategori berhasil diperbarui.');
             redirect('kategori');
         } else {
             set_message_error('Kategori gagal diperbarui.');
             redirect('kategori/update');
         }
     }
 }
开发者ID:singgihsap,项目名称:elearning,代码行数:26,代码来源:Kategori.php

示例2: getKatByUser

 public function getKatByUser()
 {
     $user_id = sentinel()->getUser()->id;
     $data = array('konsultasi_kategori.name', 'konsultasi_kategori.description', 'konsultasi_user_has_kategori.*');
     $get = $this->db->select($data)->from('konsultasi_user_has_kategori')->join('konsultasi_kategori', 'konsultasi_user_has_kategori.id_kategori=konsultasi_kategori.id')->where('konsultasi_user_has_kategori.user_id', $user_id)->get();
     return $get->result();
 }
开发者ID:singgihsap,项目名称:elearning,代码行数:7,代码来源:M_konsultasi.php

示例3: detail

 public function detail($id)
 {
     $this->form_validation->set_rules('isi', 'Isi', 'required');
     if ($this->form_validation->run() == FALSE) {
         $detail['konsultasi'] = $this->M_konsultasi->getByIdKonsultasi($id);
         $detail['kategori'] = $this->M_konsultasi->getKatByKons($id);
         $balasan = collect($this->M_konsultasi->getReply($id));
         $detail['reply'] = pagination($balasan, 3, 'konsultasi/detail/' . $id, 'bootstrap_md');
         $this->template->build('detail', $detail);
     } else {
         $config['upload_path'] = PATH_KONSULTASI_ATTACHMENT;
         $config['allowed_types'] = 'gif|jpg|jpeg|png|pdf|doc|xls|xlsx|docx|zip|txt|ppt|pptx';
         $config['max_size'] = '10000';
         $this->load->library('upload', $config);
         if (!$this->upload->do_upload('files')) {
             $reply = array('isi' => set_value('isi', '', FALSE), 'id_konsultasi' => $id, 'id_user' => sentinel()->getUser()->id);
             $updateat = date('Y-m-d H:i:s');
         } else {
             $file_data = $this->upload->data();
             $reply = array('attachment' => $file_data['file_name'], 'isi' => set_value('isi', '', FALSE), 'id_konsultasi' => $id, 'id_user' => sentinel()->getUser()->id);
             $updateat = date('Y-m-d H:i:s');
         }
         $id_konsultasi = set_value('id_konsultasi');
         $update = $this->M_konsultasi->updatedAt($updateat, $id_konsultasi);
         $save = $this->M_konsultasi->sendReply($reply, $id_konsultasi);
         redirect('dashboard/detail/' . $id);
     }
 }
开发者ID:ruly1992,项目名称:elearning,代码行数:28,代码来源:Dashboard.php

示例4: generateNavigator

 protected function generateNavigator()
 {
     $role = sentinel()->getUser()->roles->pluck('slug')->toArray();
     $menus = $this->getMenusByRole($role);
     $template = $this->load->view('template/menus', compact('menus'), TRUE);
     $this->template->set('navigator', $template);
     return $template;
 }
开发者ID:ruly1992,项目名称:elearning,代码行数:8,代码来源:MY_Controller.php

示例5: pengampu

 public function pengampu()
 {
     $data['users'] = sentinel()->findRoleBySlug('ta')->users->pluck('email', 'id')->toArray();
     $data['getKategori'] = $this->model->getAllGroupByUser();
     // $data['getUser']    	= $this->model->getByUser();
     $data['kategori_list'] = $this->model->getKategoriList();
     $this->template->build('pengampu', $data);
 }
开发者ID:singgihsap,项目名称:elearning,代码行数:8,代码来源:Konsultasi.php

示例6: __construct

 public function __construct()
 {
     $this->user = sentinel()->getUser();
     $this->course = new Course();
     $this->category = new Category();
     $this->chapter = new Chapter();
     $this->attachment = new Attachment();
 }
开发者ID:fajarekos,项目名称:elearning,代码行数:8,代码来源:Kelas.php

示例7: __construct

 public function __construct()
 {
     $this->model = new Model\Portal\Article();
     $this->imageManager = new ImageManager();
     $this->user = sentinel()->check();
     $this->categories = [];
     $this->tags = [];
 }
开发者ID:ruly1992,项目名称:elearning,代码行数:8,代码来源:Article.php

示例8: check

 public function check()
 {
     if (!sentinel()->check()) {
         redirect(login_url(), 'refresh');
     }
     if (!sentinel()->inRole($this->roles)) {
         redirect(site_url(), 'refresh');
     }
 }
开发者ID:ruly1992,项目名称:elearning,代码行数:9,代码来源:MY_Controller.php

示例9: onlyAllowEditor

 public function onlyAllowEditor()
 {
     if (sentinel()->inRole('edt')) {
         $user = sentinel()->getUser();
         $allowed_ids = $user->editorcategory->pluck('id')->toArray();
         $this->db->group_start()->where_in('id', $allowed_ids)->or_where_in('parent', $allowed_ids)->group_end();
     }
     return $this;
 }
开发者ID:singgihsap,项目名称:elearning,代码行数:9,代码来源:M_kategori.php

示例10: __construct

 public function __construct()
 {
     parent::__construct();
     $this->load->database();
     $this->load->model(array('Model_faq' => 'model_faq'));
     if (!sentinel()->check()) {
         redirect(login_url());
     }
 }
开发者ID:ruly1992,项目名称:elearning,代码行数:9,代码来源:User.php

示例11: index

 public function index()
 {
     if (sentinel()->inRole('ins')) {
         redirect('dashboard', 'refresh');
         return;
     }
     $popular = $this->repository->getPopular()->take(4);
     $latest = $this->repository->getLatest()->take(8);
     $this->template->build('index', compact('popular', 'latest'));
 }
开发者ID:ruly1992,项目名称:elearning,代码行数:10,代码来源:Homepage.php

示例12: check

 public function check()
 {
     if (!sentinel()->check()) {
         redirect(login_url(), 'refresh');
     }
     if (!sentinel()->inRole($this->roles)) {
         set_message_error('Anda tidak mempunyai hak akses.');
         redirect(login_url(), 'refresh');
     }
 }
开发者ID:nurmanhabib,项目名称:elearning,代码行数:10,代码来源:MY_Controller.php

示例13: run

 /**
  * Run Method.
  *
  * Write your database seeder using this method.
  *
  * More information on writing seeders is available here:
  * http://docs.phinx.org/en/latest/seeding.html
  */
 public function run()
 {
     $this->execute('DELETE FROM role_users');
     $role = sentinel()->getRoleRepository()->createModel();
     $role->truncate();
     $roles = ['su' => 'Super Admin', 'adm' => 'Admin', 'edt' => 'Editor', 'ctr' => 'Contributor', 'ins' => 'Instructor', 'lnr' => 'Learner', 'pcp' => 'Principal', 'mdr' => 'Moderator', 'ast' => 'Asisten', 'pus' => 'Pustakawan', 'ta' => 'Tenaga Ahli'];
     foreach ($roles as $slug => $name) {
         $role->create(compact('slug', 'name'));
     }
 }
开发者ID:singgihsap,项目名称:elearning,代码行数:18,代码来源:RoleSeeder.php

示例14: setUser

 public function setUser($user)
 {
     if ($user instanceof User) {
         $this->user = $user;
     } elseif (is_numeric($user)) {
         $this->user = User::findOrFail($user);
     } else {
         $this->user = sentinel()->getUser();
     }
     return $this;
 }
开发者ID:ruly1992,项目名称:elearning,代码行数:11,代码来源:CourseRepository.php

示例15: show

 public function show($category, $id, $name)
 {
     $this->medialib = new Library\Media\Media();
     $modelMedia = new Library\Media\Model\Media();
     $user = sentinel()->getUser();
     $name = urldecode($name);
     $media = $this->medialib->getMedia()->where('file_name', 'like', $name . '%')->findOrFail($id);
     $data = ['category' => $media->category, 'media' => $media];
     $modelMedia->resolveVisitorUnique($user, $media->id);
     $this->template->build('single', $data);
 }
开发者ID:ruly1992,项目名称:elearning,代码行数:11,代码来源:Lib.php


注:本文中的sentinel函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。