public function update($id) { $this->form_validation->set_rules('title', 'Title', 'required'); $this->form_validation->set_rules('pertanyaan', 'Pertanyaan', 'required'); $this->form_validation->set_rules('jawaban', 'Jawaban', 'required'); if ($this->form_validation->run() == TRUE) { $data = array('title' => set_value('title'), 'question' => set_value('pertanyaan'), 'answer' => set_value('jawaban', '', FALSE), 'updated_at' => date('Y-m-d H:i:s')); $update = $this->model_faq->update($id, $data); if ($update == TRUE) { $this->session->set_flashdata('success', 'FAQ berhasil diperbarui'); } else { $this->session->set_flashdata('failed', 'FAQ tidak berhasil diperbarui'); } redirect('dashboard/'); } else { $this->session->set_flashdata('failed', validation_error()); redirect('dashboard/'); } }
public function update($id) { if ($this->checkRole() == FALSE) { $this->session->set_flashdata('failed', 'Maaf, anda tidak dapat mengakses halaman tersebut!'); redirect('topic/'); } $this->form_validation->set_rules('kategori', 'Kategori', 'required'); $this->form_validation->set_rules('topic', 'Topic', 'required'); $this->form_validation->set_rules('daerah', 'Daerah', 'required'); if ($this->form_validation->run() == TRUE) { $user = sentinel()->getUser(); $data = array('tenaga_ahli' => $user->id, 'category' => set_value('kategori'), 'topic' => set_value('topic'), 'daerah' => set_value('daerah'), 'updated_at' => date('Y-m-d H:i:s')); $update = $this->model_topic->update($id, $data); if ($update == TRUE) { $this->session->set_flashdata('success', 'Topic was successfully updated.'); } else { $this->session->set_flashdata('failed', 'Topic was failed to be updated.'); } redirect('topic/'); } else { $this->session->set_flashdata('success', validation_error()); redirect('topic/'); } }
validation_error(); } if (!empty($args['acodec']) && !preg_match('/^[a-zA-Z0-9]+$/', $args['acodec'])) { validation_error(); } if (!empty($args['container']) && !preg_match('/^[a-zA-Z0-9]+$/', $args['container'])) { validation_error(); } if (!empty($args['vpre']) && !preg_match('/^[a-zA-Z0-9]+$/', $args['vpre'])) { validation_error(); } if (!empty($args['vpre2']) && !preg_match('/^[a-zA-Z0-9]+$/', $args['vpre2'])) { validation_error(); } if (!empty($args['seek']) && !preg_match('/^\\d+:\\d+:\\d+$/', $args['seek'])) { validation_error(); } /* send mime type */ $mime = ''; if ($args['vcodec'] == 'flv') { $mime = 'video/x-flv'; } else { if ($args['vcodec'] == 'libx264') { $mime = 'video/mp4'; } else { if ($args['vcodec'] == 'libtheora') { $mime = 'video/ogg'; } else { if ($args['vcodec'] == 'libvpx') { $mime = 'video/webm'; } else {
public function update($id) { if ($this->checkTA() == FALSE) { $this->session->set_flashdata('failed', 'Maaf, anda tidak dapat mengakses halaman tersebut!'); redirect('topic/'); } $this->form_validation->set_rules('kategori', 'Kategori', 'required'); $this->form_validation->set_rules('topic', 'Topic', 'required'); $this->form_validation->set_rules('type', 'Type', 'required'); if ($this->form_validation->run() == TRUE) { $user = sentinel()->getUser(); $type = set_value('type'); if ($type == 'close') { $provinsi = $this->input->post('provinsi'); $kota = $this->input->post('kota'); $kecamatan = $this->input->post('kecamatan'); $desa = $this->input->post('kecamatan'); if ($desa != '') { $daerah = $desa; } elseif ($kecamatan != '') { $daerah = $kecamatan; } elseif ($kota != '') { $daerah = $kota; } elseif ($provinsi != '') { $daerah = $provinsi; } else { $daerah = '00.00.00.0000'; } } else { $daerah = '00.00.00.0000'; } $data = array('tenaga_ahli' => $user->id, 'category' => set_value('kategori'), 'topic' => set_value('topic'), 'daerah' => $daerah, 'updated_at' => date('Y-m-d H:i:s')); $update = $this->model_topic->update($id, $data); if ($update == TRUE) { $this->session->set_flashdata('success', 'Topic was successfully updated.'); } else { $this->session->set_flashdata('failed', 'Topic was failed to be updated.'); } redirect('topic/'); } else { $this->session->set_flashdata('success', validation_error()); redirect('topic/'); } }
function upd_article() { $this->user_logged_in(); $this->form_validation->set_rules('judul', 'Story Title', 'trim|required'); $this->form_validation->set_rules('editor1', 'Story Content', 'trim|required'); $id = $this->input->post('id_artikel'); if ($this->form_validation->run() == FALSE) { $error = validation_error(); } else { if ($this->m_master->upd_artikel()) { $error = 'Congratulation., your story have been updated.'; } else { $error = 'Sorry., please enter the valid data.'; } } $this->edit($id, $error); }
function display() { ?> <?php if ($this->specific != 'hidden') { ?> <div class="form-item<?php echo $this->outerClass; echo $this->specific == 'checkbox' ? ' form-item-checkbox' : ''; ?> " for="<?php echo $this->name; ?> "> <?php } ?> <?php if (isset($this->bind[$this->name])) { ?> <?php list($Model, $Field) = $this->bind[$this->name]; ?> <input type="hidden" name="bind[<?php echo $Model; ?> ][<?php echo $Field; ?> ]" value="<?php echo $this->name; ?> " /> <?php } ?> <?php if (isset($this->label)) { ?> <label for="<?php $this->name; ?> "><?php echo $this->label; ?> </label> <?php } ?> <?php if ($this->specific != 'hidden' && validation_error($this->name) !== FALSE) { ?> <p class="form-item-error"><?php echo validation_error($this->name); ?> </p> <?php } ?> <?php switch ($this->type) { case 'input': ?> <input type="<?php echo $this->specific(); ?> " <?php $this->_displayCommon(); ?> value="<?php echo $this->value(); ?> " /> <?php if ($this->specific == 'checkbox') { ?> <span><?php echo $this->note; ?> </span><?php } ?> <?php break; ?> <?php case 'textarea': ?> <textarea <?php $this->_displayCommon(); ?> <?php if ($this->editor) { ?> editor <?php } ?> rows="<?php echo $this->rows; ?> " ><?php echo $this->value(); ?> </textarea> <?php break; ?> <?php } ?> <?php if ($this->specific != 'hidden') { ?> </div> <?php } ?> <?php }