本文整理汇总了PHP中set_value函数的典型用法代码示例。如果您正苦于以下问题:PHP set_value函数的具体用法?PHP set_value怎么用?PHP set_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($id)
{
$this->form_validation->set_rules('name', 'Name', 'trim|required');
if ($this->form_validation->run() == FALSE) {
$group = sentinel()->findRoleBySlug('edt');
$data['kategori'] = Model\Portal\Category::findOrFail($id);
$data['kategori_lists'] = $this->model->getLists($id);
$data['users'] = $group->users->pluck('email', 'id')->toArray();
$this->template->build('kategori_edit', $data);
} else {
$kategori['name'] = $this->input->post('name');
$kategori['description'] = $this->input->post('description');
$kategori['parent'] = $this->input->post('parent');
$editor = set_value('editor', []);
$category = Model\Portal\Category::findOrFail($id);
$category->update($kategori);
$category->editors()->sync($editor);
if ($res == TRUE) {
set_message_success('Kategori berhasil diperbarui.');
redirect('kategori');
} else {
set_message_error('Kategori gagal diperbarui.');
redirect('kategori/update');
}
}
}
示例2: create
/**
* Create new article
* @access public
* @return void
*/
public function create()
{
$this->load->library('form_validation');
//append the check slug callback function to rules array
$this->validation_rules[1]['rules'] .= '|callback__check_slug';
$this->form_validation->set_rules($this->validation_rules);
if ($this->form_validation->run()) {
$date = $this->input->post('date');
$date = explode('/', $date);
$id = $this->news_m->insert(array('title' => $this->input->post('title'), 'slug' => $this->input->post('slug'), 'category_id' => $this->input->post('category_id'), 'intro' => $this->input->post('intro'), 'body' => $this->input->post('body'), 'status' => $this->input->post('status'), 'created_on_hour' => $this->input->post('created_on_hour'), 'created_on_minute' => $this->input->post('created_on_minute'), 'created_on_day' => $date[1], 'created_on_month' => $date[0], 'created_on_year' => $date[2]));
if ($id) {
$this->cache->delete_all('news_m');
$this->session->set_flashdata('success', sprintf($this->lang->line('news_article_add_success'), $this->input->post('title')));
} else {
$this->session->set_flashdata('error', $this->lang->line('news_article_add_error'));
}
// Redirect back to the form or main page
$this->input->post('btnAction') == 'save_exit' ? redirect('admin/news') : redirect('admin/news/edit/' . $id);
} else {
// Go through all the known fields and get the post values
foreach ($this->validation_rules as $key => $field) {
$article->{$field}['field'] = set_value($field['field']);
}
}
$this->template->title($this->module_details['name'], lang('news_create_title'))->append_metadata($this->load->view('fragments/wysiwyg', $this->data, TRUE))->append_metadata(js('news_form.js', 'news'))->set('article', $article)->build('admin/form');
}
示例3: submit
public function submit($category)
{
$media = $this->medialib;
$category = $media->setCategory($category)->getCategory();
$uploaded = [];
$input_name = 'filemedia';
if (is_array($_FILES[$input_name]['name'])) {
foreach ($_FILES[$input_name]['name'] as $i => $name) {
$filemedia['name'] = $_FILES[$input_name]['name'][$i];
$filemedia['type'] = $_FILES[$input_name]['type'][$i];
$filemedia['tmp_name'] = $_FILES[$input_name]['tmp_name'][$i];
$filemedia['error'] = $_FILES[$input_name]['error'][$i];
$filemedia['size'] = $_FILES[$input_name]['size'][$i];
$uploaded[] = $this->submitSingle($category, $filemedia, $metadata);
}
} else {
$uploaded[] = $this->submitSingle($category, $_FILES[$input_name], set_value('meta', []));
}
if ($this->input->is_ajax_request()) {
echo json_encode($uploaded);
} else {
set_message_success('Media berhasil diunggah.');
redirect('elibrary/show/' . $category->id, 'refresh');
}
}
示例4: doMediaUpload
function doMediaUpload()
{
$this->load->library('form_validation');
if ($this->form_validation->run() == FALSE) {
$data['mediaList'] = $this->upload_model->getMedia();
$data['error'] = validation_errors();
$data['filelabel'] = set_value('filelabel');
$this->load->view('mediaupload_form', $data);
return;
}
$config['upload_path'] = './media/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '2000';
$config['max_width'] = '800';
$config['max_height'] = '600';
$this->load->library('upload', $config);
if (!$this->upload->do_upload()) {
$data['mediaList'] = $this->upload_model->getMedia();
$data = array('error' => $this->upload->display_errors());
$data['filelabel'] = set_value('filelabel');
$this->load->view('mediaupload_form', $data);
} else {
//$data['error'] = '<pre>'.var_dump($this->upload->data()).'</pre>';
$fileData = $this->upload->data();
$modelData['label'] = $this->input->post('filelabel');
$modelData['fileName'] = $fileData['file_name'];
$this->upload_model->saveImage($modelData);
$data['mediaList'] = $this->upload_model->getMedia();
$data['filelabel'] = "";
$this->load->view('mediaupload_form', $data);
}
}
示例5: kkm
public function kkm()
{
$cek = $this->session->userdata('logged_in');
$stts = $this->session->userdata('stts');
if (!empty($cek) && $stts == 'mahasiswa') {
$data = array('button' => 'Create', 'action' => site_url('mahasiswa/daftar_kkm'), 'no_daftar' => set_value('no_daftar'), 'jenis_kelamin' => set_value('jenis_kelamin'), 'tempat_tanggal_lahir' => set_value('tempat_tanggal_lahir'), 'semester' => set_value('semester'), 'alamat_asal' => set_value('alamat_asal'), 'alamat_sekarang' => set_value('alamat_sekarang'), 'no_telp' => set_value('no_telp'), 'keterangan_khusus' => set_value('keterangan_khusus'), 'photo_2x3' => set_value('photo_2x3'), 'id_kelompok' => set_value('id_kelompok'), 'dpl' => set_value('dpl'));
$d['judul'] = "Formulir Pendaftaran - Sistem Informasi Pendaftaran Kuliah Kerja Mahasiswa";
$bc['no'] = $this->session->userdata('no');
$bc['nama'] = $this->session->userdata('nama');
$bc['status'] = $this->session->userdata('stts');
$bc['nim'] = $this->session->userdata('nim');
$bc['jurusan'] = $this->session->userdata('jurusan');
$bc['fakultas'] = $this->session->userdata('fakultas');
$bc['id_kelompok'] = $this->session->userdata('id_kelompok');
$bc['dpl'] = $this->session->userdata('dpl');
$bc['semester'] = $this->session->userdata('semester');
$bc['kkma'] = $this->web_app_model->getmauDaftarkkm($bc['nim']);
$bc['cek'] = $this->web_app_model->cek_kelompok($bc['id_kelompok']);
$bc['menu'] = $this->load->view('mahasiswa/menu', '', true);
$bc['bio'] = $this->load->view('mahasiswa/bio', $bc, true);
$this->load->view('global/bg_top', $bc);
$this->load->view('mahasiswa/bg_jadwal', $data, $bc);
$this->load->view('global/bg_footer', $d);
} else {
header('location:' . base_url() . 'web');
}
}
示例6: create
public function create()
{
$data['title'] = 'Create Product';
// is user submitting form or viewing?
if ($this->input->post()) {
// handle cancelling
if (strtolower($this->input->post('submit')) == 'cancel') {
redirect('product');
}
// validate form
$this->form_validation->set_rules('type', 'type', 'trim|xss_clean');
$this->form_validation->set_rules('name', 'name', 'trim|required|xss_clean');
$this->form_validation->set_rules('price', 'price', 'trim|decimal|required|xss_clean');
$this->form_validation->set_rules('model', 'model', 'trim|required|xss_clean');
if ($this->form_validation->run() == TRUE) {
// save new product
$name = set_value('name');
$price = set_value('price');
$model = set_value('model');
$type = set_value('type') ? set_value('type') : NULL;
if ($this->product_model->create($name, $price, $model, $type)) {
// success
$this->contentData['message'] = 'product created';
return $this->index();
} else {
// error creating new user
$this->contentData['message'] = $this->product_model->getMessage();
}
} else {
$this->contentData['message'] = validation_errors();
}
}
$data['content'] = $this->load->view('product/product_create', $this->contentData, TRUE);
$this->techniart->load($data);
}
示例7: add
public function add()
{
$this->load->library('form_validation');
$this->form_validation->set_rules($this->validation_rules);
if ($this->form_validation->run() == TRUE) {
// preparing for insertion
foreach ($this->validation_rules as $k => $v) {
$fields[] = $v['field'];
}
// $fields = array('title', 'slug', 'description', 'date', 'description', 'url', 'status');
$data = $this->grade_m->array_from_post($fields);
if ($this->grade_m->save($data)) {
$this->session->set_flashdata('success', 'New Grade Added Successfully.');
} else {
$this->session->set_flashdata('error', 'sorry, Grade cannot be Added.');
}
redirect('grade/add/', 'refresh');
} else {
$grade = new stdClass();
// Go through all the known fields and get the post values
foreach ($this->validation_rules as $key => $field) {
$grade->{$field}['field'] = set_value($field['field']);
}
}
$data = array('method' => 'add', 'main_content' => 'form', 'editData' => $grade);
$this->load->view('admin_wrapper', $data);
}
示例8: send_email
public function send_email()
{
// Form validation
$this->load->library("form_validation");
//set_rules is function from CI library where first parameter is the field name,
// second is name for this field, which will be inserted into the error message
// and the third is the validation rules for this form field
$this->form_validation->set_rules("fullName", "Full Name", "required|alpha");
$this->form_validation->set_rules("email", "Email Address", "required|valid_email");
$this->form_validation->set_rules("message", "Message", "required");
$this->form_validation->set_rules('g-recaptcha-response', 'Captcha', 'callback_recaptcha');
if ($this->form_validation->run() == FALSE) {
$data['message'] = "";
$this->load->view("site_header");
$this->load->view("site_nav");
$this->load->view("content_contact", $data);
$this->load->view("site_footer");
} else {
$data['message'] = "The email is successful send!";
/*Storing submitted values
$fullName = $this->input->post('fullName');
$email = $this->input->post('email');
$message = $this->input->post('message');*/
// Configure email library
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = 'stefan.borislavov.nikolov@gmail.com';
$config['smtp_pass'] = 'stefannikolov1234';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n";
//use double quotes to comply with RFC 822 standard
//load the codeigniter email library and use its methods to send mail.
$this->load->library("email");
$this->email->from(set_value("email"), set_value("fullName"));
$this->email->to("stefan.borislavov.nikolov@gmail.com");
$this->email->subject("Message from out from");
$this->email->message(set_value("message"));
$this->email->send();
// show message..print_debugger from the CI library
echo $this->email->print_debugger();
// Insert into database model
$insert['query'] = $this->insert_model->insert();
if ($insert['query'] != NULL) {
$data = "The email is not successful send!";
$this->load->view("site_header");
$this->load->view("site_nav");
$this->load->view("content_contact", $data);
$this->load->view("site_footer");
} else {
$data['message'] = "The email is successful send!";
$this->load->view("site_header");
$this->load->view("site_nav");
$this->load->view("content_contact", $data);
$this->load->view("site_footer");
}
}
}
示例9: index
function index()
{
$this->form_validation->set_rules('id_masivo', 'id masivo:', 'required|xss_clean|max_length[3]');
$this->form_validation->set_rules('id_pais', 'id pais:', 'required|xss_clean|max_length[3]');
$this->form_validation->set_rules('id_institucion', 'id institucion:', 'required|xss_clean|max_length[3]');
$this->form_validation->set_rules('expediente_id_masivo', 'expediente id masivo:', 'required|xss_clean|max_length[3]');
$this->form_validation->set_rules('id_expediente', 'id expediente:', 'required|xss_clean|max_length[3]');
$this->form_validation->set_rules('tipo_masivo', 'tipo masivo:', 'required|xss_clean|max_length[25]');
$this->form_validation->set_rules('nombre', 'nombre:', 'required|xss_clean|max_length[25]');
$this->form_validation->set_rules('apellido', 'apellido:', 'required|xss_clean|max_length[25]');
$this->form_validation->set_rules('sexo', 'sexo:', 'required|xss_clean|max_length[10]');
$this->form_validation->set_rules('fecha_de_emision', 'fecha de emision:', 'required|xss_clean');
$this->form_validation->set_rules('observacion_masiva', 'observacion masiva:', 'required|xss_clean|max_length[25]');
$this->form_validation->set_rules('ruta_masiva', 'ruta masiva:', 'required|xss_clean|max_length[25]');
$this->form_validation->set_rules('nombre_adoptivo', 'nombre adoptivo:', 'required|xss_clean|max_length[25]');
$this->form_validation->set_rules('apellido_adoptivo', 'apellido adoptivo:', 'required|xss_clean|max_length[25]');
$this->form_validation->set_error_delimiters('<br /><span class="error">', '</span>');
if ($this->form_validation->run() == FALSE) {
// $this->load->view('pages/view_expediente_masivo');
$this->load->view('pages/expediente_masivo02');
} else {
// build array for the model
$form_data = array('id_masivo' => set_value('id_masivo'), 'id_pais' => set_value('id_pais'), 'id_institucion' => set_value('id_institucion'), 'expediente_id_masivo' => set_value('expediente_id_masivo'), 'id_expediente' => set_value('id_expediente'), 'tipo_masivo' => set_value('tipo_masivo'), 'nombre' => set_value('nombre'), 'apellido' => set_value('apellido'), 'sexo' => set_value('sexo'), 'fecha_de_emision' => set_value('fecha_de_emision'), 'observacion_masiva' => set_value('observacion_masiva'), 'ruta_masiva' => set_value('ruta_masiva'), 'nombre_adoptivo' => set_value('nombre_adoptivo'), 'apellido_adoptivo' => set_value('apellido_adoptivo'));
// run insert model to write data to db
if ($this->model_expediente_masivo->SaveForm($form_data) == TRUE) {
redirect('controller_expediente_masivo/success');
// or whatever logic needs to occur
} else {
echo 'An error occurred saving your information. Please try again later';
// Or whatever error handling is necessary
}
}
}
示例10: newImagem
public function newImagem()
{
$this->form_validation->set_rules('id', 'ID', '');
$this->form_validation->set_rules('referencia', 'Referência', 'max_length[45]');
$this->form_validation->set_rules('nome_produto', 'Nome Produto', 'max_length[200]');
$this->form_validation->set_rules('data_cadastro', 'Data Cadastro', '');
$this->form_validation->set_error_delimiters('<br /><span class="error">', '</span>');
if ($this->form_validation->run() == FALSE) {
session_start();
if ($this->session->userdata('logged_in')) {
$session_data = $this->session->userdata('logged_in');
$data['login'] = $session_data['login'];
$this->load->view('imagens/includes/header');
$this->load->view('includes/nav', $data);
$this->load->view('imagens/cad_imagens');
$this->load->view('imagens/includes/footer');
} else {
//If no session, redirect to login page
redirect('login', 'refresh');
}
} else {
// build array for the model
$form_data = array('id' => set_value('id'), 'referencia' => set_value('referencia'), 'nome_produto' => set_value('nome_produto'), 'data_cadastro' => set_value('data_cadastro'));
// run insert model to write data to db
if ($this->myform_model->SaveForm($form_data) == TRUE) {
redirect('myform/success');
// or whatever logic needs to occur
} else {
echo 'An error occurred saving your information. Please try again later';
// Or whatever error handling is necessary
}
}
}
示例11: form_open
function form_open($action = '', $attributes = '', $hidden = array())
{
$_ci = & get_instance();
$_ci->load->library('form_validation');
if ($attributes == '')
{
$attributes = 'method="post"';
}
$action = ( strpos($action, '://') === FALSE) ? $_ci->config->site_url($action) : $action;
$form = '<form action="' . $action . '"';
$form .= _attributes_to_string($attributes, TRUE);
$form .= '>';
if ($_ci->form_validation->has_nonce())
{
$value = set_value('nonce');
if ($value == '')
{
$value = $_ci->form_validation->create_nonce();
}
$hidden['nonce'] = set_value('nonce', $value);
}
if (is_array($hidden) && count($hidden) > 0)
{
$form .= form_hidden($hidden);
}
return $form;
}
示例12: add
/**
* Create a new redirect
* @access public
* @return void
*/
public function add()
{
// Got validation?
if ($this->form_validation->run())
{
if ($this->redirect_m->insert($_POST))
{
$this->session->set_flashdata('success', lang('redirects.add_success'));
// Redirect
redirect('admin/redirects');
}
$this->data->messages['error'] = lang('redirects.add_error');
}
// Loop through each validation rule
foreach($this->validation_rules as $rule)
{
$redirect->{$rule['field']} = set_value($rule['field']);
}
$this->data->redirect =& $redirect;
$this->template->build('admin/form', $this->data);
}
示例13: process
function process()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('movementstypes_id', 'movementstypes_id', 'required');
$this->form_validation->set_rules('products_id', 'products_id', 'required');
$this->form_validation->set_rules('quantity', 'quantity', 'required');
$this->form_validation->set_rules('comment', 'comment', '');
$this->form_validation->set_error_delimiters('<br /><span class="error">', '</span>');
if ($this->form_validation->run() == FALSE) {
$data['showMessage'] = TRUE;
echo validation_errors();
} else {
$this->load->model('movementstypes_model', 'movtypes');
/*
GET THE PRODUCT TO KNOW THE PRICE */
$the_product = $this->products->get(set_value('products_id'));
/*
GET THE TYPE OF MOVEMENT TO KNOW IF IS A + OR - OPERATION */
$the_type = $this->movtypes->get(set_value('movementstypes_id'));
$form_data = array('id' => -1, 'products_id' => set_value('products_id'), 'movementstypes_id' => set_value('movementstypes_id'), 'quantity' => set_value('quantity') * $the_type->sign, 'unitprice' => $the_product->price, 'comment' => set_value('comment'));
$id = $this->mov->save_form($form_data);
if ($id) {
/*
UPDATE THE STOCK */
$this->products->update_stock(set_value('products_id'), set_value('quantity') * $the_type->sign);
redirect(site_url('movimientos'));
} else {
echo 'An error occurred saving your information. Please try again later';
}
}
}
示例14: index
/**
* Member import
*/
public function index()
{
if (!ee()->cp->allowed_group('can_access_utilities')) {
show_error(lang('unauthorized_access'));
}
$groups = ee('Model')->get('MemberGroup')->order('group_title', 'asc')->all();
$member_groups = array();
foreach ($groups as $group) {
$member_groups[$group->group_id] = $group->group_title;
}
ee()->lang->loadfile('settings');
$vars['sections'] = array(array(array('title' => 'mbr_xml_file', 'desc' => 'mbr_xml_file_location', 'fields' => array('xml_file' => array('type' => 'text', 'required' => TRUE)))), 'mbr_import_default_options' => array(array('title' => 'member_group', 'fields' => array('group_id' => array('type' => 'select', 'choices' => $member_groups))), array('title' => 'mbr_language', 'fields' => array('language' => array('type' => 'select', 'choices' => ee()->lang->language_pack_names(), 'value' => ee()->config->item('deft_lang') ?: 'english'))), array('title' => 'timezone', 'fields' => array('timezones' => array('type' => 'html', 'content' => ee()->localize->timezone_menu(set_value('default_site_timezone') ?: ee()->config->item('default_site_timezone'), 'timezones')))), array('title' => 'mbr_datetime_fmt', 'desc' => 'used_in_cp_only', 'fields' => array('date_format' => array('type' => 'select', 'choices' => array('%n/%j/%Y' => 'mm/dd/yyyy', '%j/%n/%Y' => 'dd/mm/yyyy', '%j-%n-%Y' => 'dd-mm-yyyy', '%Y-%m-%d' => 'yyyy-mm-dd')), 'time_format' => array('type' => 'select', 'choices' => array('24' => lang('24_hour'), '12' => lang('12_hour'))))), array('title' => 'include_seconds', 'desc' => 'include_seconds_desc', 'fields' => array('include_seconds' => array('type' => 'yes_no'))), array('title' => 'mbr_create_custom_fields', 'desc' => 'mbr_create_custom_fields_desc', 'fields' => array('auto_custom_field' => array('type' => 'yes_no', 'value' => set_value('auto_custom_field') ?: 'y')))));
ee()->load->library('form_validation');
ee()->form_validation->set_rules(array(array('field' => 'xml_file', 'label' => 'lang:mbr_xml_file', 'rules' => 'required|file_exists'), array('field' => 'auto_custom_field', 'label' => 'lang:auto_custom_field', 'rules' => '')));
$base_url = ee('CP/URL')->make('utilities/member-import');
if (AJAX_REQUEST) {
ee()->form_validation->run_ajax();
exit;
} elseif (ee()->form_validation->run() !== FALSE) {
return $this->memberImportConfirm();
} elseif (ee()->form_validation->errors_exist()) {
ee()->view->set_message('issue', lang('member_import_error'), lang('member_import_error_desc'));
}
ee()->view->base_url = $base_url;
ee()->view->ajax_validate = TRUE;
ee()->view->cp_page_title = lang('member_import');
ee()->view->save_btn_text = 'mbr_import_btn';
ee()->view->save_btn_text_working = 'mbr_import_btn_saving';
ee()->cp->render('settings/form', $vars);
}
示例15: create
public function create()
{
$data = array('button' => '创建', 'action' => site_url('user/create_action'), 'id' => set_value('id'), 'username' => set_value('username'), 'jsdm' => set_value('jsdm'), 'password' => set_value('password'), 'email' => set_value('email'), 'created_on' => set_value(time()), 'active' => set_value('active'), 'sex' => set_value('sex'), 'birth_date' => set_value('birth_date'), 'yxdm' => set_value('yxdm'), 'jszw' => set_value('jszw'), 'jszc' => set_value('jszc'), 'jsxl' => set_value('jsxl'), 'phone' => set_value('phone'), 'jsinfo' => set_value('jsinfo'));
$this->load->view('common/header');
$this->load->view('users_form', $data);
$this->load->view('common/footer');
}