當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。