本文整理汇总了PHP中set_value函数的典型用法代码示例。如果您正苦于以下问题:PHP set_value函数的具体用法?PHP set_value怎么用?PHP set_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_value函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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');
}
}
}
开发者ID:singgihsap,项目名称:elearning,代码行数:26,代码来源:Kategori.php
示例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');
}
开发者ID:ngonchan,项目名称:pyrocms,代码行数:31,代码来源:admin.php
示例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');
}
}
开发者ID:singgihsap,项目名称:elearning,代码行数:25,代码来源:Media.php
示例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);
}
}
开发者ID:vietda,项目名称:cnpmnc,代码行数:32,代码来源:upload.php
示例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');
}
}
开发者ID:Furiansyah,项目名称:lp2m_uinsgd_ac_id,代码行数:27,代码来源:mahasiswa.php
示例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);
}
开发者ID:reergymerej,项目名称:techniart,代码行数:35,代码来源:product.php
示例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);
}
开发者ID:Davincier,项目名称:epayroll,代码行数:27,代码来源:grade.php
示例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'] = '[email protected]';
$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("[email protected]");
$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");
}
}
}
开发者ID:stefannikolov94,项目名称:ci_project_reward_gateway_stefan_nikolov,代码行数:60,代码来源:site.php
示例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
}
}
}
开发者ID:salvador503,项目名称:proyecto2015,代码行数:33,代码来源:Expediente_masivo.php
示例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
}
}
}
开发者ID:CristianoRibeiro,项目名称:oficina-ro-a,代码行数:33,代码来源:imagens.php
示例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;
}
开发者ID:prolabs,项目名称:pyrocms,代码行数:34,代码来源:MY_form_helper.php
示例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);
}
开发者ID:reith2004,项目名称:pyrocms,代码行数:30,代码来源:admin.php
示例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';
}
}
}
开发者ID:patriciomase,项目名称:stock,代码行数:31,代码来源:movements.php
示例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);
}
开发者ID:vigm,项目名称:advancedMD,代码行数:33,代码来源:MemberImport.php
示例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');
}
开发者ID:super99199,项目名称:oasystem,代码行数:7,代码来源:Users.php
示例16: edit
public function edit($id)
{
$rules = [['field' => 'caption', 'label' => 'Caption', 'rules' => 'required'], ['field' => 'description', 'label' => 'Description', 'rules' => 'required']];
$this->form_validation->set_rules($rules);
$image = $this->Gallery_model->find($id)->row();
if ($this->form_validation->run() == FALSE) {
$this->load->view('admin/gallery/edit_view', ['image' => $image]);
} else {
if (isset($_FILES["userfile"]["name"])) {
/* Start Uploading File */
$config = ['upload_path' => './uploads/', 'allowed_types' => 'gif|jpg|png', 'max_size' => 100, 'max_width' => 1024, 'max_height' => 768];
$this->load->library('upload', $config);
if (!$this->upload->do_upload()) {
$error = array('error' => $this->upload->display_errors());
$this->load->view('admin/gallery/edit_view', ['image' => $image, 'error' => $error]);
} else {
$file = $this->upload->data();
$data['file'] = 'uploads/' . $file['file_name'];
unlink($image->file);
}
}
$data['caption'] = set_value('caption');
$data['description'] = set_value('description');
$this->Gallery_model->update($id, $data);
$this->session->set_flashdata('message', 'New image has been updated..');
redirect('/admin/gallery');
}
}
开发者ID:32x32,项目名称:spaghescript,代码行数:28,代码来源:Gallery.php
示例17: add
function add()
{
$this->checkLogin();
$this->load->library('form_validation');
$this->data['custom_error'] = '';
$table = 'venta_credito';
$key = 'id';
$value = 'id';
$list = null;
foreach ($this->codegen_model->get($table, $key . "," . $value, "", "", "") as $row) {
$list[$row[$key]] = $row[$value];
}
$this->data['venta_credito_id'] = $list;
if ($this->form_validation->run('cpx') == false) {
$this->data['custom_error'] = validation_errors() ? '<div class="form_error">' . validation_errors() . '</div>' : false;
} else {
$data = array('pago' => set_value('pago'), 'venta_credito_id' => set_value('venta_credito_id'));
//add cause sometimes, when pass empty string I get troubles in the insert
foreach ($data as $i => $value) {
if ($value === "") {
$data[$i] = null;
}
}
if ($this->codegen_model->add('cpx', $data) == TRUE) {
//$this->data['custom_error'] = '<div class="form_ok"><p>Added</p></div>';
// or redirect
redirect(base_url() . 'index.php/cpx/manage/');
} else {
$this->data['custom_error'] = '<div class="form_error"><p>An Error Occured.</p></div>';
}
}
$this->load->view('cpx_add', $this->data);
//$this->template->load('content', 'cpx_add', $this->data);
}
开发者ID:ricardo-vargas,项目名称:SPV,代码行数:34,代码来源:cpx.php
示例18: adicionar
function adicionar()
{
if (!$this->permission->checkPermission($this->session->userdata('permissao'), 'aProduto')) {
$this->session->set_flashdata('error', 'Você não tem permissão para adicionar produtos.');
redirect(base_url());
}
$this->load->library('form_validation');
$this->data['custom_error'] = '';
if ($this->form_validation->run('produtos') == false) {
$this->data['custom_error'] = validation_errors() ? '<div class="form_error">' . validation_errors() . '</div>' : false;
} else {
$precoCompra = $this->input->post('precoCompra');
$precoCompra = str_replace(",", "", $precoCompra);
$precoVenda = $this->input->post('precoVenda');
$precoVenda = str_replace(",", "", $precoVenda);
$data = array('descricao' => set_value('descricao'), 'unidade' => set_value('unidade'), 'precoCompra' => $precoCompra, 'precoVenda' => $precoVenda, 'estoque' => set_value('estoque'), 'estoqueMinimo' => set_value('estoqueMinimo'));
if ($this->produtos_model->add('produtos', $data) == TRUE) {
$this->session->set_flashdata('success', 'Produto adicionado com sucesso!');
redirect(base_url() . 'index.php/produtos/adicionar/');
} else {
$this->data['custom_error'] = '<div class="form_error"><p>An Error Occured.</p></div>';
}
}
$this->data['view'] = 'produtos/adicionarProduto';
$this->load->view('tema/topo', $this->data);
}
开发者ID:RamonSilva20,项目名称:mapos,代码行数:26,代码来源:produtos.php
示例19: addEdit
public function addEdit($id)
{
//---------------------------------------------------------------------
//
//---------------------------------------------------------------------
if (!bTestForURLHack('showClients')) {
return;
}
$this->load->helper('dl_util/verify_id');
verifyIDsViaType($this, CENUM_CONTEXT_STATUSCAT, $id, true);
$id = (int) $id;
$bNew = $id <= 0;
$this->load->model('clients/mclient_status', 'clsClientStat');
$this->clsClientStat->loadClientStatCats(true, true, $id);
// validation rules
$this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
$this->form_validation->set_rules('txtStatCatName', 'Status Category', 'trim|required|' . 'callback_verifyUniqueStatCat[' . $id . ']');
$this->form_validation->set_rules('txtNotes');
if ($this->form_validation->run() == FALSE) {
$displayData = array();
$displayData['formD'] = new stdClass();
$this->load->library('generic_form');
if ($bNew) {
$this->clsClientStat->loadClientStatCats(true, true, -1);
$this->clsClientStat->statCats[0]->lKeyID = -1;
$this->clsClientStat->statCats[0]->strCatName = '';
}
if (validation_errors() == '') {
$displayData['formD']->txtStatCatName = htmlspecialchars($this->clsClientStat->statCats[0]->strCatName);
$displayData['formD']->txtNotes = htmlspecialchars($this->clsClientStat->statCats[0]->strDescription);
} else {
setOnFormError($displayData);
$displayData['formD']->txtStatCatName = set_value('txtStatCatName');
$displayData['formD']->txtNotes = set_value('txtNotes');
}
//--------------------------
// breadcrumbs
//--------------------------
$displayData['pageTitle'] = anchor('main/menu/admin', 'Admin', 'class="breadcrumb"') . ' | ' . anchor('admin/alists/showLists', 'Lists', 'class="breadcrumb" ') . ' | ' . anchor('admin/admin_special_lists/clients/statCatView', 'Client Status Categories', 'class="breadcrumb" ') . ' | ' . ($bNew ? 'Add new status category' : 'Edit status category');
$displayData['title'] = CS_PROGNAME . ' | Lists';
$displayData['nav'] = $this->mnav_brain_jar->navData();
$displayData['id'] = $id;
$displayData['bNew'] = $bNew;
$displayData['statCats'] = $this->clsClientStat->statCats;
$displayData['mainTemplate'] = 'client/client_status_cat_add_edit';
$this->load->vars($displayData);
$this->load->view('template');
} else {
$this->clsClientStat->statCats[0]->strCatName = trim($_POST['txtStatCatName']);
$this->clsClientStat->statCats[0]->strDescription = trim($_POST['txtNotes']);
if ($id == 0) {
$id = $this->clsClientStat->addNewClientStatusCat();
$this->session->set_flashdata('msg', 'Your status category was added');
} else {
$this->clsClientStat->updateClientStatusCat($id);
$this->session->set_flashdata('msg', 'Your status category was updated');
}
redirect('admin/admin_special_lists/clients/statCatView');
}
}
开发者ID:simple-gifts,项目名称:Delightful-Labor,代码行数:60,代码来源:status_cat.php
示例20: edit_profile
public function edit_profile()
{
$this->form_validation->set_rules('fullname', 'Fullname', 'required|trim|xss_clean|max_length[40]');
$this->form_validation->set_rules('sex', 'Sex', 'required|trim|xss_clean|max_length[10]');
$this->form_validation->set_rules('city', 'City', 'trim|xss_clean|max_length[30]');
//$this->form_validation->set_rules('zipcode', 'ZipCode', 'trim|xss_clean|max_length[8]');
$this->form_validation->set_rules('state_province', 'State/Province', 'trim|xss_clean|max_length[20]');
$this->form_validation->set_rules('country', 'Country', 'required|trim|xss_clean|max_length[30]');
$this->form_validation->set_rules('mobile', 'Mobile', 'trim|xss_clean|max_length[11]');
$this->form_validation->set_rules('date_of_birth', 'Date of Birth', 'trim|xss_clean');
//$this->form_validation->set_rules('marial_status', 'Marial Status', 'trim|xss_clean|max_length[8]');
$this->form_validation->set_error_delimiters('<label class="error">', '</label>');
if ($this->form_validation->run() == FALSE) {
$this->load->view('_partials/header', $this->data);
$this->load->view('profile/edit_profile');
$this->load->view('_partials/footer');
} else {
// build array for the model
$form_data = array('fullname' => set_value('fullname'), 'sex' => set_value('sex'), 'city' => set_value('city'), 'state_province' => set_value('state_province'), 'country' => set_value('country'), 'mobile' => set_value('mobile'), 'dob' => set_value('date_of_birth'));
if ($this->user_profile->SaveProfile($form_data, $this->user_id)) {
$this->data['success'] = 1;
} else {
$this->data['success'] = 2;
}
$this->load->view('_partials/header', $this->data);
$this->load->view('profile/edit_profile');
$th
|
请发表评论