本文整理汇总了PHP中Flash::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP Flash::clear方法的具体用法?PHP Flash::clear怎么用?PHP Flash::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flash
的用法示例。
在下文中一共展示了Flash::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _add
private function _add(ORM $page)
{
$page_data = $this->request->post('page');
// Сохраняем полученые данные в сесиию
Flash::set('page::add::data', $page_data);
// Создаем новую страницу
try {
$page = $page->values($page_data)->create();
// Если есть права на управление ролями
if (ACL::check('page.permissions')) {
$page->save_permissions($this->request->post('page_permissions'));
}
Messages::success(__('Page has been saved!'));
Flash::clear('page::add::data');
} catch (ORM_Validation_Exception $e) {
Messages::errors($e->errors('validation'));
$this->go_back();
} catch (Kohana_Exception $e) {
Messages::errors(__('Something went wrong!'));
$this->go_back();
}
// save and quit or save and continue editing ?
if ($this->request->post('commit') !== NULL) {
$this->go();
} else {
$this->go(array('action' => 'edit', 'id' => $page->id));
}
}
示例2: _edit
private function _edit($job)
{
$data = $this->request->post();
$this->auto_render = FALSE;
$job->values($data);
try {
if ($job->update()) {
Kohana::$log->add(Log::INFO, 'Job :job has been updated by :user', array(':job' => HTML::anchor(Route::get('backend')->uri(array('controller' => 'scheduler', 'action' => 'edit', 'id' => $job->id)), $job->name)))->write();
Flash::clear('post_data');
Messages::success(__('Job has been saved!'));
}
} catch (ORM_Validation_Exception $e) {
Messages::errors($e->errors('validation'));
$this->go_back();
}
// save and quit or save and continue editing?
if ($this->request->post('commit') !== NULL) {
$this->go(Route::get('backend')->uri(array('controller' => 'jobs')));
} else {
$this->go(Route::get('backend')->uri(array('controller' => 'jobs', 'action' => 'edit', 'id' => $job->id)));
}
}
示例3: SSP_Slideshow
//CREATE PAGE PART
$slideshow = '<?php echo new SSP_Slideshow(' . $ssid . ');?>';
$sql = "INSERT INTO wolfpage_part (name, filter_id, content, content_html, page_id) VALUES ('ssp_slideshow', null, '" . $slideshow . "', '" . $slideshow . "', " . $pageId . ");";
$query = Record::query($sql);
if ($query) {
$status_message = 'Successfully created Slideshow';
$status_type = 'success';
Flash::set('page', $pageId);
} else {
$status_message = 'Could not create Slideshow';
$status_type = 'errors';
}
break;
case 'delete':
$sql = "DELETE FROM wolf_ssp WHERE page_id=" . $pageId . "; DELETE FROM wolf_page_part WHERE name='ssp_slideshow' AND page_id=" . $pageId . ";";
$query = Record::query($sql);
if ($query) {
$status_message = 'Successfully deleted Slideshow';
$status_type = 'success';
Flash::clear();
} else {
$status_message = 'Could not delete Slideshow';
$status_type = 'errors';
}
break;
default:
break;
}
//COMPLETE. REDIRECT
Flash::set($status_type, $status_message);
header('Location:' . URL_PUBLIC . 'admin/plugin/ssp/manage');