本文整理汇总了PHP中Template::set_message方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::set_message方法的具体用法?PHP Template::set_message怎么用?PHP Template::set_message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::set_message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload_action
public function upload_action()
{
// dump($_FILES);die;
if (!isset($this->config->module)) {
die("Nao foi coinfigurado o module, nao sei onde salvar. Operacao abortada");
}
// $upload_folder = $this->options->image_path;
$upload_folder = "./assets/upload/image_galery";
if (!is_dir($upload_folder)) {
mkdir($upload_folder, 0777);
chmod($upload_folder, 0777);
}
list($w, $h) = explode("x", $this->config->size);
$config = array();
$config['upload_path'] = $upload_folder;
$config['allowed_types'] = str_replace(array(";"), "|", str_replace(array("*", ".", " "), "", $this->config->file_types));
$config['image_width'] = $w;
$config['image_height'] = $h;
$config['encrypt_name'] = true;
$config['overwrite'] = false;
$files_uploades = array();
$file_keys = array_keys($_FILES);
for ($i = 0; $i < count($file_keys); $i++) {
$files_uploades = $this->upload_act($file_keys[$i], $config);
}
if (!empty($files_uploades)) {
if ($files_uploades["error"]) {
Template::set_message($files_uploades["response"]);
} else {
return $this->save_image($files_uploades["response"]);
}
}
// dump($this->config);
// dump($files_uploades);die;
}
示例2: edit
public function edit()
{
$server_type = $this->uri->segment(5);
if ($this->input->post('submit'))
{
//echo '<pre>'; print_r($_POST); die();
unset($_POST['server_type'], $_POST['submit']);
if (write_db_config(array($server_type => $_POST)) == TRUE)
{
Template::set_message('Your settings were successfully saved.', 'success');
} else
{
Template::set_message('There was an error saving the settings.', 'error');
}
}
$settings = read_db_config($server_type);
Template::set('db_settings', $settings[$server_type]);
Template::set('server_type', $server_type);
Template::render();
}
示例3: __construct
/**
* Constructor
*
* @return void
*/
public function __construct()
{
parent::__construct();
$this->load->library('template');
$this->load->library('assets');
$this->load->config('docs');
$this->lang->load('docs');
$this->docsGroup = $this->uri->segment(2);
// Is displaying docs permitted for this environment?
if (config_item('docs.permitted_environments') && !in_array(ENVIRONMENT, config_item('docs.permitted_environments'))) {
Template::set_message(lang('docs_env_disabled'), 'error');
redirect();
}
// Was a doc group provided?
if (!$this->docsGroup) {
redirect('docs/' . config_item('docs.default_group'));
}
$this->showAppDocs = config_item('docs.show_app_docs');
$this->showDevDocs = config_item('docs.show_dev_docs');
$this->tocFile = config_item('docs.toc_file') ?: '_toc.ini';
// Make sure we can still get to the search method.
if ($this->docsGroup == 'search') {
$this->docsGroup = false;
} elseif ($this->docsGroup == 'developer' && !$this->showDevDocs && ENVIRONMENT != 'development') {
if ($this->showAppDocs) {
Template::set_message(lang('docs_not_allowed_dev'), 'warning');
redirect('docs/application');
}
show_error(lang('docs_not_allowed'));
}
Template::set_theme(config_item('docs.theme'), 'docs');
$this->load->helper('form');
}
示例4: index
/**
* Displays the available shortcuts and the details of the keys setup
* for these shortcut options. Manages adding, editing and deleting of
* the shortcut keys.
*
* @access public
*
* @return void
*/
public function index()
{
if ($this->input->post('add_shortcut')) {
if ($this->add()) {
Template::set_message(lang('ui_shortcut_success'), 'success');
} else {
Template::set_message(lang('ui_shortcut_add_error'), 'error');
}
} elseif ($this->input->post('remove_action')) {
if ($this->remove()) {
Template::set_message(lang('ui_shortcut_remove_success'), 'success');
} else {
Template::set_message(lang('ui_shortcut_remove_error'), 'error');
}
} elseif ($this->input->post('submit')) {
if ($this->save_settings()) {
Template::set_message(lang('ui_shortcut_save_success'), 'success');
redirect(uri_string());
} else {
Template::set_message(lang('ui_shortcut_save_error'), 'error');
}
}
//end if
// Read our current settings from the application config
Template::set('current', config_item('ui.current_shortcuts'));
$settings = $this->settings_lib->find_all_by('module', 'core.ui');
Template::set('settings', $settings);
Template::render();
}
示例5: edit
public function edit()
{
$this->load->library('form_validation');
$server_type = $this->uri->segment(5);
if ($this->input->post('submit')) {
$this->form_validation->set_rules('server_type', lang('db_server_type'), 'required|trim|max_length[20]|xss_clean');
$this->form_validation->set_rules('hostname', lang('db_hostname'), 'required|trim|max_length[120]|xss_clean');
$this->form_validation->set_rules('database', lang('db_dbname'), 'required|trim|max_length[120]|xss_clean');
$this->form_validation->set_rules('username', lang('bf_username'), 'trim|xss_clean');
$this->form_validation->set_rules('password', lang('bf_password'), 'trim|xss_clean');
if ($this->form_validation->run() !== FALSE) {
unset($_POST['server_type'], $_POST['submit']);
if (write_db_config(array($server_type => $_POST)) == TRUE) {
Template::set_message(lang('db_successful_save'), 'success');
$this->activity_model->log_activity($this->auth->user_id(), $server_type . ' : ' . lang('db_successful_save_act'), 'database');
} else {
Template::set_message(lang('db_erroneous_save'), 'error');
$this->activity_model->log_activity($this->auth->user_id(), $server_type . ' : ' . lang('db_erroneous_save_act'), 'database');
}
}
}
$settings = read_db_config($server_type);
if (!empty($settings)) {
Template::set('db_settings', $settings[$server_type]);
}
Template::set('server_type', $server_type);
Template::render();
}
示例6: index
public function index()
{
if ($this->input->post('submit')) {
if ($this->save_settings()) {
Template::set_message(lang('mod_settings_saved'), 'success');
redirect(SITE_AREA . '/settings/comments');
} else {
Template::set_message(lang('md_settings_error'), 'error');
}
}
// Read our current settings
$settings = $this->settings_model->select('name,value')->find_all_by('module', 'comments');
Template::set('settings', $settings);
if (!isset($this->role_model)) {
$this->load->model('roles/role_model');
}
$roles = array();
$tmpRoles = $this->role_model->select('role_id, role_name, default')->where('deleted', 0)->find_all();
if (isset($tmpRoles) && is_array($tmpRoles) && count($tmpRoles)) {
foreach ($tmpRoles as $role) {
$roles = $roles + array($role->role_id => $role->role_name);
}
}
Template::set('roles', $roles);
Template::set('toolbar_title', lang('mod_settings_title'));
Template::set_view('comments/settings/index');
Template::render();
}
示例7: index
/**
* Displays the available shortcuts and the details of the keys setup
* for these shortcut options. Manages adding, editing and deleting of
* the shortcut keys.
*
* @access public
*
* @return void
*/
public function index()
{
if (isset($_POST['add_shortcut'])) {
if ($this->add()) {
Template::set_message(lang('ui_shortcut_success'), 'success');
} else {
Template::set_message(lang('ui_shortcut_add_error'), 'error');
}
} elseif (isset($_POST['remove_shortcut'])) {
if ($this->remove()) {
Template::set_message(lang('ui_shortcut_remove_success'), 'success');
} else {
Template::set_message(lang('ui_shortcut_remove_error'), 'error');
}
} elseif (isset($_POST['save'])) {
if ($this->save_settings()) {
Template::set_message(lang('ui_shortcut_save_success'), 'success');
redirect(uri_string());
} else {
Template::set_message(lang('ui_shortcut_save_error'), 'error');
}
}
//end if
// Read available shortcuts from the application config
Template::set('current', config_item('ui.current_shortcuts'));
$settings = $this->settings_lib->find_all_by('module', 'core.ui');
Template::set('settings', $settings);
Template::set('toolbar_title', lang('ui_shortcuts'));
Template::render();
}
示例8: index
/**
* Display a form with various site settings including site name and
* registration settings
*
* @return void
*/
public function index()
{
$this->load->config('extended_settings');
$extended_settings = config_item('extended_settings_fields');
if (isset($_POST['save'])) {
if ($this->saveSettings($extended_settings)) {
Template::set_message(lang('settings_saved_success'), 'success');
} else {
Template::set_message(lang('settings_error_success'), 'error');
$settingsError = $this->settings_lib->getError();
if ($settingsError) {
Template::set_message($settingsError, 'error');
}
}
redirect(SITE_AREA . '/settings/settings');
}
// Read the current settings
$settings = $this->settings_lib->find_all();
// Get the available languages
$this->load->helper('translate/languages');
Template::set_view('settings/settings/index');
Template::set('extended_settings', $extended_settings);
Template::set('languages', list_languages());
Template::set('selected_languages', unserialize($settings['site.languages']));
Template::set('settings', $settings);
Template::set('showDeveloperTab', $this->auth->has_permission($this->permissionDevView));
Template::render();
}
示例9: index
public function index()
{
$result = $this->migrations->version(3);
if ($result) {
Template::set_message('Successfully migrated database to version ' . $result, 'success');
} else {
Template::set_message('There was an error migrating the database.', 'error');
}
Template::render();
}
示例10: edit
public function edit()
{
$this->auth->restrict('Simplenews.Developer.Edit');
$id = $this->uri->segment(5);
if (empty($id)) {
Template::set_message(lang('simplenews_invalid_id'), 'error');
redirect(SITE_AREA . '/developer/simplenews');
}
Assets::add_module_js('simplenews', 'simplenews.js');
Template::set('toolbar_title', lang('simplenews_edit') . ' simplenews');
Template::render();
}
示例11: view
public function view($file='')
{
if (empty($file))
{
Template::set_message('No log file provided.', 'error');
redirect('admin/settings/developer/logs');
}
Template::set('log_file', $file);
Template::set('log_content', file($this->config->item('log_path') . $file));
Template::render();
}
示例12: delete
public function delete()
{
$id = $this->uri->segment(5);
if (!empty($id)) {
if ($this->permission_model->delete($id)) {
Template::set_message(lang("permissions_delete_success"), 'success');
} else {
Template::set_message(lang("permissions_delete_failure") . $this->permission_model->error, 'error');
}
}
redirect(SITE_AREA . '/settings/permissions');
}
示例13: add_news
/**
* add_news.
*
* Displays a default list of news articles. The nbumber of articles displayed is managed via
* the news.default_article_count setting.
*
* @return <void> This function outputs to the Template::render() function
*
*/
public function add_news()
{
$settings = $this->_settings;
if ($this->input->post('submit')) {
$this->load->module('news/content');
$uploadData = array();
$upload = true;
if (isset($_FILES['attachment']) && is_array($_FILES['attachment']) && $_FILES['attachment']['error'] != 4) {
$uploadData = $this->content->handle_upload();
if (isset($uploadData['error']) && !empty($uploadData['error'])) {
$upload = false;
}
}
if (count($uploadData) > 0 && $upload || count($uploadData) == 0 && $upload) {
if ($id = $this->content->save_article($uploadData)) {
$article = $this->news_model->find($id);
$this->load->model('activities/activity_model');
$this->activity_model->log_activity($this->current_user->id, 'Created Article: ' . $article->id, 'news');
Template::set_message('Article successfully submitted. It will be reviewed by the news moderator.', 'success');
Template::set_view('index');
Template::render();
} else {
Template::set_message('There was a problem creating the article: ' . $this->news_model->error);
}
} else {
Template::set_message('There was a problem saving the file attachment: ' . $uploadData['error']);
}
}
if ($settings['news.public_submissions'] == 1) {
$showForm = true;
if ($settings['news.public_submitters'] == 1) {
$cookie = unserialize($this->input->cookie($this->config->item('sess_cookie_name')));
$showForm = isset($cookie['logged_in']);
$error = 'You must be <a href="' . site_url('/login/') . '">logged in</a> to post news to this site.';
unset($cookie);
}
if ($showForm) {
$this->load->helper('form');
Assets::add_css(array(Template::theme_url('js/editors/markitup/skins/markitup/style.css'), Template::theme_url('js/editors/markitup/sets/default/style.css'), css_path() . 'chosen.css', css_path() . 'bootstrap-datepicker.css'));
Assets::add_js(array(Template::theme_url('js/editors/markitup/jquery.markitup.js'), Template::theme_url('js/editors/markitup/sets/default/set.js'), js_path() . 'chosen.jquery.min.js', js_path() . 'bootstrap-datepicker.js'));
Template::set('public', true);
Template::set('settings', $settings);
Template::set('toolbar_title', lang('us_create_news'));
Template::set_view('content/news_form');
Template::render();
} else {
show_error($error, 501, 'Form Access Error');
}
} else {
show_error('<h2>Sorry</h2><br />Public news submissions are not currently available.<br /><a href="' . site_url() . '">Return to the site</a>.', 501, 'Public News Submission not available');
}
}
示例14: template
public function template()
{
if ($this->input->post('submit')) {
$header = $_POST['header'];
$footer = $_POST['footer'];
$this->load->helper('file');
write_file(APPPATH . 'modules/emailer/views/email/_header.php', $header, 'w+');
write_file(APPPATH . 'modules/emailer/views/email/_footer.php', $footer, 'w+');
Template::set_message('Template successfully saved.', 'success');
redirect(SITE_AREA . '/settings/emailer/template');
}
Template::set('toolbar_title', 'Email Template');
Template::render();
}
示例15: index
public function index()
{
if ($this->input->post('submit')) {
if ($this->save_settings()) {
Template::set_message('Your settings were successfully saved.', 'success');
redirect(SITE_AREA . '/settings');
} else {
Template::set_message('There was an error saving your settings.', 'error');
}
}
// Read our current settings
Template::set('settings', read_config('application'));
Template::set_view('admin/settings/index');
Template::render();
}