本文整理汇总了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');
}
示例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);
}
示例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?");
}
示例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);
}
示例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);
}