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


PHP UserHelper::setNotice方法代码示例

本文整理汇总了PHP中UserHelper::setNotice方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::setNotice方法的具体用法?PHP UserHelper::setNotice怎么用?PHP UserHelper::setNotice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserHelper的用法示例。


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

示例1: redirectAndComeback

 /**
  * Redirect the current user to the login page. After they login or register,
  *  they'll be sent back to $back_to
  * @param string $back_to The URL to come bak to after login. Default $back_to
  *  is the current URL
  * @param string $message A message to show on the login page like "Login first, sucka"
  */
 public static function redirectAndComeback($back_to = FALSE, $message = FALSE)
 {
     $CI =& get_instance();
     # Come back to a diferent page?
     if (!$back_to) {
         $back_to = current_url();
     }
     $CI->session->set_userdata('back_to', $back_to);
     # Set a message
     if ($message) {
         UserHelper::setNotice($message);
     }
     redirect(base_url() . 'login');
 }
开发者ID:souparno,项目名称:getsparks.org,代码行数:21,代码来源:utility_helper.php

示例2: index

 /**
  * The search page call
  */
 function index()
 {
     $this->load->helper('form');
     $this->load->library('form_validation');
     $submit = $this->input->post('submit');
     $search_results = array();
     $search_term = $this->input->get_post('term', TRUE);
     if ($submit) {
         if ($this->form_validation->run('search')) {
             $this->load->model('spark');
             $search_results = Spark::search($search_term);
         } else {
             UserHelper::setNotice('Whoops. There were some errors. Check below and re-submit!');
         }
     }
     $data['search_term'] = $search_term;
     $data['sparks'] = $search_results;
     echo json_encode($data);
 }
开发者ID:souparno,项目名称:getsparks.org,代码行数:22,代码来源:search.php

示例3: add

 /**
  * The POST call to add a version to a package
  *  Redirect to the package page on success
  */
 public function add()
 {
     $submit = $this->input->post('submit');
     if ($submit) {
         $this->load->library('form_validation');
         $this->load->model('version');
         $this->load->model('spark');
         $insert = elements(array('spark_id', 'tag'), $_POST);
         if ($this->form_validation->run('add-version')) {
             if (Version::insert($insert)) {
                 UserHelper::setNotice("Version added!");
             }
         } else {
             UserHelper::setNotice("Try to enter a valid tag!", FALSE);
         }
         $spark = Spark::getById($insert['spark_id']);
         redirect(base_url() . 'packages/' . $spark->name . '/show');
     }
     show_error("Whatcha doin' here?");
 }
开发者ID:souparno,项目名称:getsparks.org,代码行数:24,代码来源:versions.php

示例4: search

 /**
  * Show the spark search page
  */
 function search()
 {
     $this->load->helper('form');
     $this->load->library('form_validation');
     $submit = $this->input->post('submit');
     $search_results = array();
     $search_term = $this->input->post('term');
     $data['ratings'] = array();
     if ($submit) {
         if ($this->form_validation->run('search')) {
             $this->load->model('spark');
             $this->load->model('rating');
             $search_results = Spark::search($search_term);
             $ids = array();
             foreach ($search_results as $s) {
                 $ids[] = $s->id;
             }
             $data['ratings'] = $this->rating->getRatingsFromList($ids);
         } else {
             UserHelper::setNotice('Whoops. There were some errors. Check below and re-submit!');
         }
     }
     $data['search_term'] = $search_term;
     $data['sparks'] = $search_results;
     $data['description'] = 'These are the most recently registered sparks with at least one release.';
     $this->load->view('search/listing', $data);
 }
开发者ID:souparno,项目名称:getsparks.org,代码行数:30,代码来源:packages.php

示例5: edit

 /**
  * Called when to show the edit page for a user's profile. Works of the current
  *  logged in user
  */
 public function edit()
 {
     $this->load->model('contributor');
     $this->load->helper('form');
     $this->load->library('form_validation');
     $contributor_id = UserHelper::getId();
     $contributor = Contributor::findById($contributor_id);
     $submit = $this->input->post('submit');
     if ($submit) {
         if ($this->form_validation->run('edit_profile')) {
             $update = elements(array('email', 'website', 'real_name', 'password'), $_POST);
             Contributor::update($contributor_id, $update);
             if ($update['password']) {
                 UserHelper::setNotice("Nice, everything saved, including your new password");
             } else {
                 UserHelper::setNotice("Nice, everything saved");
             }
         } else {
             UserHelper::setNotice("Hrm, there was a problem (see below)", FALSE);
         }
     }
     $data = array('contributor' => $contributor);
     $this->load->view('contributors/edit', $data);
 }
开发者ID:souparno,项目名称:getsparks.org,代码行数:28,代码来源:contributors.php


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