public function block_content($context, array $blocks = array())
 {
     // line 4
     echo "<h4>Edit Kelas Aktif</h4>\n";
     // line 5
     echo get_flashdata("class");
     echo "\n\n";
     // line 7
     echo form_open("siswa/moved_class/" . (isset($context["status_id"]) ? $context["status_id"] : null) . "/" . (isset($context["siswa_id"]) ? $context["siswa_id"] : null), array("class" => "form-horizontal row-fluid"));
     echo "\n<table class=\"table table-striped\">\n    <tr>\n        <td>\n            <select class=\"span2\" name=\"kelas_id\">\n                <option value=\"\">--pilih--</option>\n                ";
     // line 13
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable(isset($context["kelas"]) ? $context["kelas"] : null);
     foreach ($context['_seq'] as $context["_key"] => $context["k"]) {
         // line 14
         echo "                    <option value=\"";
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "id"), "html", null, true);
         echo "\" ";
         echo $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "id") == $this->getAttribute(isset($context["get_aktif"]) ? $context["get_aktif"] : null, "kelas_id") ? "selected" : "";
         echo ">";
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "nama"), "html", null, true);
         echo "</option>\n                ";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['k'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 16
     echo "            </select>\n            <br>";
     // line 17
     echo form_error("kelas_id");
     echo "\n        </td>\n        <td>\n            <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n        </td>\n    </tr>\n</table>\n";
     // line 24
     echo form_close();
     echo "\n";
 }
function writeProjectRow($idx, $project)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    if (is_numeric($project->lAssignedMin)) {
        $strValue = strDurationViaMinutes($project->lAssignedMin);
    } else {
        $strValue = $project->lAssignedMin;
    }
    echoT('
         <tr>
            <td class="enpViewLabel" style="padding-top: 8px;">' . htmlspecialchars($project->strGroupName) . ':
            </td>
            <td class="enpView" style="vertical-align: top;">
               <input type="text" name="txtPMin' . $idx . '"
                    size="5"
                    maxlength="8"  
                    style="text-align: right;"   onFocus="txtPMin' . $idx . '.style.background=\'#fff\';"
                    id="addEditEntry"
                    value="' . $strValue . '">
            </td>
            <td style="vertical-align: top; padding-top: 6pt;">
               hh:mm 
            </td>
            <td style="width: 45pt; text-align: right;vertical-align: top; padding-top: 6pt;">
               Notes:
            </td>
            <td style="text-align: top;">
               <textarea name="txtNotes' . $idx . '" rows="2" cols="30">' . $project->notes . '</textarea>' . form_error('txtPMin' . $idx) . '
            </td>
         </tr>');
}
 public function process_form()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules("name", "name", "required|trim|xss_clean");
     $this->form_validation->set_rules("comment", "comment", "xss_clean");
     // if validation errors exist, send user back to form else send user to result page.
     if ($this->form_validation->run() === FALSE) {
         $this->session->set_userdata('error', form_error('name'));
         redirect('/');
     } else {
         $this->session->unset_userdata('error');
         $this->session->set_userdata('name', $this->input->post('name', true));
         $this->session->set_userdata('location', $this->input->post('location'));
         $this->session->set_userdata('language', $this->input->post('language'));
         $this->session->set_userdata('comment', $this->input->post('comment', true));
         // set counter to display number of times current user submits the form
         if ($this->session->userdata('counter')) {
             $counter = $this->session->userdata('counter');
             $this->session->set_userdata('counter', $counter + 1);
         } else {
             $this->session->set_userdata('counter', 1);
         }
         redirect('result');
     }
 }
 /**
  * Validate the settings form.
  */
 public function validateSettings(&$element, &$form_state)
 {
     $schema = drupal_get_schema('membership_entity');
     if ($element['length']['#value'] > $schema['fields']['member_id']['length']) {
         form_error($element['length'], t('Member ID length cannot exceed %max.', array('%max' => $schema['fields']['member_id']['length'])));
     }
 }
Example #5
0
 function login_proses()
 {
     $data['pesan'] = '';
     $data['username'] = $this->input->post('username');
     $data['password'] = $this->input->post('password');
     $this->form_validation->set_rules("username", 'Username', 'trim|required|xss_clean');
     $this->form_validation->set_rules("password", 'Password', 'trim|required|xss_clean');
     # message rules
     $this->form_validation->set_message('required', 'Field %s harus diisi.');
     if ($this->form_validation->run() == FALSE) {
         // jika tidak valid
         $data['pesan'] .= trim(form_error('username', ' ', ' ')) == '' ? '' : form_error('username', ' ', '<br>');
         $data['pesan'] .= trim(form_error('password', ' ', ' ')) == '' ? '' : form_error('password', ' ', '<br>');
         $this->load->view('auth/form_login', $data);
     } else {
         $result = $this->mdl_auth->ceklogin($data);
         if ($result->num_rows() > 0) {
             $this->session->set_userdata('user_id', $result->row()->user_id);
             $this->session->set_userdata('user_name', $result->row()->user_name);
             $this->session->set_userdata('full_name', $result->row()->full_name);
             $this->session->set_userdata('user_level_id', $result->row()->user_level_id);
             $this->session->set_userdata('kd_fakultas', $result->row()->kd_fakultas);
             $this->session->set_userdata('kd_prodi', $result->row()->kd_prodi);
             $this->session->set_userdata('login', TRUE);
             redirect('main');
         } else {
             $data['pesan'] .= '<b>Login Gagal<b> <br> masukan username dan password dengan benar.';
             $this->load->view('auth/form_login', $data);
         }
     }
 }
Example #6
0
 function submitform1()
 {
     $this->form_validation->set_rules('input-txtfield', 'Textfield', 'trim|required|xss_clean|max_length[100]');
     $this->form_validation->set_rules('input-textarea', 'Textarea', 'trim|required|xss_clean|max_length[1024]');
     $this->form_validation->set_rules('input-radio', 'Radio', 'trim|required|xss_clean');
     $this->form_validation->set_rules('input-checkbox[]', 'Checkbox', 'trim');
     $successurl = base_url('welcome/form1');
     if ($this->form_validation->run() == false) {
         $res['error'] = true;
         $res['display_errors']['input-txtfield-error'] = form_error('input-txtfield');
         $res['display_errors']['input-textarea-error'] = form_error('input-textarea');
         $res['display_errors']['input-radio-error'] = form_error('input-radio');
         $res['display_errors']['input-checkbox-error'] = form_error('input-checkbox');
     } else {
         $res['error'] = false;
         $res['s_title'] = "STitle";
         $res['s_text'] = "Form submitted successfully";
         $res['eval_script'] = "load_view('#my-content', 'content1', '" . $successurl . "');";
     }
     if ($this->input->is_ajax_request()) {
         echo json_encode($res);
     } else {
         if ($res['error'] == true) {
             $this->res = $res;
             $this->view_maintenance_head($society_id, $head_id);
         } else {
             $this->session->set_flashdata('success_message', $res['s_text']);
             redirect($successurl);
         }
     }
 }
 /**
  * Signup
  * Presents user with a signup form.
  */
 public function signup()
 {
     $this->load->helper('form');
     $this->layouts->set_title('Sign Up');
     $data['signup_form_first_name'] = $this->security->xss_clean($this->input->post('signup_form_first_name'));
     $data['signup_form_last_name'] = $this->security->xss_clean($this->input->post('signup_form_last_name'));
     $data['signup_form_email'] = $this->security->xss_clean($this->input->post('signup_form_email'));
     $data['signup_form_username'] = $this->security->xss_clean($this->input->post('signup_form_username'));
     $data['signup_form_lost_password_question_1'] = $this->security->xss_clean($this->input->post('signup_form_lost_password_question_1'));
     $data['signup_form_lost_password_question_2'] = $this->security->xss_clean($this->input->post('signup_form_lost_password_question_2'));
     $data['signup_form_lost_password_question_3'] = $this->security->xss_clean($this->input->post('signup_form_lost_password_question_3'));
     if ($this->input->post('ajax') && !$this->input->post('test')) {
         $this->layouts->view('accounts/signup', $data, 'json');
     } elseif ($this->input->post('ajax') && $this->input->post('test')) {
         $data['changes'] = [];
         if (form_error($this->input->post('test_field'))) {
             $data['changes'][] = ['target' => '#' . $this->input->post('test_field') . '_error', 'content' => form_error($this->input->post('test_field'))];
         } else {
             $data['changes'][] = ['target' => '#' . $this->input->post('test_field') . '_error', 'content' => ''];
         }
         $data['changes'][] = ['target' => '#signup_form_bucket_csrf_token', 'value' => $this->security->get_csrf_hash()];
         $this->layouts->view(null, $data, 'json');
     } else {
         $this->layouts->view('accounts/signup', $data);
     }
 }
Example #8
0
 public function save()
 {
     $this->load->library('form_validation');
     $frm = $this->form_validation;
     $frm->set_rules('name', 'Name', 'trim|required');
     $frm->set_rules('database', 'Database', 'trim|required');
     $frm->set_message('required', 'กรุณากรอก %s');
     if ($frm->run() == FALSE) {
         $message = '';
         $message .= form_error('name');
         $message .= form_error('database');
         $result = array('result' => FALSE, 'message' => $message);
     } else {
         $post = $this->input->post(NULL, TRUE);
         // returns all POST/GET items with XSS filter
         $data = array('id' => $post['id'], 'name' => $post['name'], 'database' => $post['database'], 'remark' => $post['remark']);
         $this->model->id = $post['id'];
         if ($this->model->save($data)) {
             $result = array('result' => true);
         } else {
             $result = array('result' => false, 'message' => $this->db->error());
         }
     }
     echo json_encode($result);
 }
Example #9
0
 public function proses()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('username', 'Username', 'trim|required|alpha_numeric|min_length[3]');
     $this->form_validation->set_rules('password', 'Password', 'trim|required');
     if ($this->form_validation->run() == FALSE) {
         if (validation_errors('username') != NULL) {
             $view['error_username'] = strip_tags(form_error('username'));
         }
         if (validation_errors('password') != NULL) {
             $view['error_password'] = strip_tags(form_error('password'));
         }
     } else {
         $this->load->model('login_model');
         $username = $this->input->post('username');
         $password = $this->input->post('password');
         $doLogin = $this->login_model->doLogin($username, $password);
         if ($doLogin) {
             $this->load->library('sess');
             $this->sess->sess_reg($doLogin);
             $view['success'] = "Success Login";
         } else {
             $view['error_failed'] = "username or password WRONG!";
         }
     }
     header('content-type:application/json');
     echo json_encode($view);
     exit;
 }
Example #10
0
 function _nuevoProveedor_Cliente($tipo)
 {
     $nombre = $_POST["nombre"];
     $rif = $_POST["rif"];
     $msj_nombre = "";
     $msj_rif = "";
     $error = 0;
     $this->load->library("form_validation");
     $this->form_validation->set_rules("nombre", "Nombre", "required");
     $this->form_validation->set_rules("rif", "RIF", "required|is_rif");
     if ($this->form_validation->run()) {
         try {
             /*if($tipo=="Proveedor"){
                   $proveedorCliente=new Entities\Proveedor;
               }else{
                   $proveedorCliente=new Entities\Cliente;
               }*/
             $proveedorCliente = new Entities\ProveedorCliente();
             $proveedorCliente->setNombre($nombre);
             $rif = preg_replace("/^([J|V|G])\\-?(\\d{8})\\-?(\\d)\$/", "\$1-\$2-\$3", $rif);
             $proveedorCliente->setRif($rif);
             $proveedorCliente->setTipo($tipo);
             guardar($proveedorCliente, TRUE);
         } catch (Exception $e) {
             $error = 1;
             $nombre = "";
             $rif = "";
         }
     } else {
         $msj_nombre = form_error("nombre");
         $msj_rif = form_error("rif");
         $error = 1;
     }
     return json_encode(array("nombre" => $nombre, "rif" => $rif, "error" => $error, "msj_nombre" => $msj_nombre, "msj_rif" => $msj_rif));
 }
 public function index()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('user_full_name', 'Name', 'required|min_length[5]');
     $this->form_validation->set_rules('user_name', 'username', 'required|min_length[5]|is_unique[users.username]');
     $this->form_validation->set_rules('email_address', 'Email', 'required|is_unique[users.email]|valid_email');
     $this->form_validation->set_rules('password', 'Password ', 'required|min_length[5]|matches[con_password]');
     $this->form_validation->set_rules('con_password', 'Password', 'required|min_length[5]');
     $this->form_validation->set_message('required', 'required');
     $this->form_validation->set_message('min_length', 'lenght');
     $this->form_validation->set_message('is_unique', 'Allready exist');
     $this->form_validation->set_message('valid_email', 'Invalid Email');
     $this->form_validation->set_message('matches', 'password not match');
     if ($this->form_validation->run() == true) {
         $this->user_model->add_user();
         $this->load->library('email');
         $this->email->from('*****@*****.**', 'Komail');
         $this->email->to($this->input->post('email_address'));
         $this->email->subject('Email Verification');
         $this->email->message('http://privilegedpk.com/prev/index.php/signup/verify?email=' . $this->input->post('email_address'));
         $this->email->send();
         //echo $this->email->print_debugger();
         redirect('main', 'refresh');
     } else {
         redirect($this->input->post('current') . 'un=' . form_error('user_name') . '&&nam=' . form_error('user_full_name') . '&&email=' . form_error('email_address') . '&&pass='******'password') . '&&pass1=' . form_error('con_password'));
     }
 }
Example #12
0
 public function addsupport()
 {
     $this->form_validation->set_rules('fname', 'FirstName', 'trim|required|max_length[300]');
     $this->form_validation->set_rules('lname', 'LastName', 'trim|required|max_length[300]');
     $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
     $this->form_validation->set_rules('phone', 'Phone', 'trim|is_natural|min_length[10]|max_length[11]');
     $this->form_validation->set_rules('cmt', 'Address', 'trim|required|max_length[300]');
     $this->form_validation->set_rules('zip', 'Zipcode', 'trim|is_natural');
     $this->form_validation->set_rules('recaptcha', 'ReCaptcha', 'callback_check_recaptcha');
     if (!$this->form_validation->run()) {
         $result = array('ajax' => 1, 'error_fname' => form_error('fname'), 'error_lname' => form_error('lname'), 'error_email' => form_error('email'), 'error_phone' => form_error('phone'), 'error_cmt' => form_error('cmt'), 'error_zip' => form_error('zip'), 'error_recaptcha' => form_error('recaptcha'), 'capt' => $this->create_capt());
         echo json_encode($result);
     } else {
         $this->email->from('*****@*****.**', 'Email Support');
         $this->email->to($this->input->post('email'));
         $this->email->cc('*****@*****.**');
         $this->email->subject($this->input->post('fname') . ' Need to support!');
         $this->email->message('First Name: ' . $this->input->post('fname') . '<br>' . 'Last Name: ' . $this->input->post('lname') . '<br>' . 'Phone: ' . $this->input->post('phone') . '<br>' . 'Address: ' . $this->input->post('address') . '<br>' . 'City: ' . $this->input->post('city') . '<br>' . 'State/Province: ' . $this->input->post('s_p') . '<br>' . 'Zip/Postal Code: ' . $this->input->post('zip') . '<br>' . 'Industry: ' . $this->input->post('indus') . '<br>' . 'Message:<br>' . $this->input->post('cmt'));
         if ($this->email->send()) {
             $result['result'] = "\n\t\t\t\t<div class='alert alert-success' role='alert'>\n\t\t\t\t\t<strong>Well done!</strong>Thanks for your mail. We will contact you as soon as posible!<br>\n\t\t\t\t  \t<a href='" . base_url() . "' class='alert-link'>Back to Home Page!</a>\n\t\t\t\t</div>\n\t\t\t\t";
             $result['kt'] = 0;
             echo json_encode($result);
         } else {
             $result['result'] = "\n\t\t\t\t<div class='alert alert-warning' role='alert'>\n\t\t\t\t\t<strong>Warning!</strong>There are Errors! Please try againt!<br>\n\t\t\t\t  \t<a href='" . base_url() . "' class='alert-link'>Back to Home Page!</a>\n\t\t\t\t</div>\n\t\t\t\t";
             $result['kt'] = 1;
             echo json_encode($result);
         }
     }
 }
 function add_new_category()
 {
     // validate form
     $this->load->library('form_validation');
     $this->form_validation->set_rules('categoryName', 'categoryName', 'trim|required|xss_clean');
     // if form is invalid
     if ($this->form_validation->run() == FALSE) {
         if (form_error('categoryName')) {
             $this->session->set_flashdata('msg', 'กรุณาใส่ชื่อหมวดหมู่');
             redirect('admin/add_category');
             return;
         }
     }
     $name = set_value('categoryName');
     //add category
     $arr = array('category_name' => $name);
     $res = $this->Category->add_category($arr);
     // if can't add to db
     if ($res == FALSE) {
         $this->session->set_flashdata('msg', 'ไม่สามารถเพิ่มหมวดหมู่ได้');
         redirect('admin/add_category');
         return;
     }
     redirect('admin/category');
 }
 public function block_content($context, array $blocks = array())
 {
     // line 4
     echo "<div class=\"module\">\n    <div class=\"module-head\">\n        <h3>";
     // line 6
     echo isset($context["module_title"]) ? $context["module_title"] : null;
     echo "</h3>\n    </div>\n    <div class=\"module-body\">\n        ";
     // line 9
     echo get_flashdata("mapel");
     echo "\n\n        ";
     // line 11
     echo form_open("admin/mapel/add", array("class" => "form-horizontal row-fluid"));
     echo "\n            <div class=\"control-group\">\n                <label class=\"control-label\">Nama <span class=\"text-error\">*</span></label>\n                <div class=\"controls\">\n                    <input type=\"text\" name=\"nama\" class=\"span8\" value=\"";
     // line 15
     echo twig_escape_filter($this->env, set_value("nama"), "html", null, true);
     echo "\">\n                    <br>";
     // line 16
     echo form_error("nama");
     echo "\n                </div>\n            </div>\n            <div class=\"control-group\">\n                <label class=\"control-label\">Deskripsi</label>\n                <div class=\"controls\">\n                    <textarea name=\"info\" class=\"span12\" rows=\"5\">";
     // line 22
     echo set_value("info");
     echo "</textarea>\n                </div>\n            </div>\n            <div class=\"control-group\">\n                <div class=\"controls\">\n                    <button type=\"submit\" class=\"btn btn-primary\">Simpan</button>\n                    <a href=\"";
     // line 28
     echo twig_escape_filter($this->env, site_url("admin/mapel"), "html", null, true);
     echo "\" class=\"btn\">Batal</a>\n                </div>\n            </div>\n        ";
     // line 31
     echo form_close();
     echo "\n\n    </div>\n</div>\n";
 }
 public function block_content($context, array $blocks = array())
 {
     // line 4
     echo "<div class=\"module\">\n    <div class=\"module-head\">\n        <h3>";
     // line 6
     echo isset($context["module_title"]) ? $context["module_title"] : null;
     echo "</h3>\n    </div>\n    <div class=\"module-body\">\n        ";
     // line 9
     echo get_flashdata("kelas");
     echo "\n\n        <div class=\"panel panel-default\">\n            <div class=\"panel-heading\">\n                Tambah Kelas\n            </div>\n            <div class=\"panel-body\">\n                ";
     // line 16
     echo form_open("admin/kelas", array("class" => "form-horizontal row-fluid"));
     echo "\n                    <div class=\"control-group\">\n                        <label class=\"control-label\">Nama Kelas <span class=\"text-error\">*</span></label>\n                        <div class=\"controls\">\n                            <input type=\"text\" name=\"nama\" class=\"span5\" placeholder=\"Nama Kelas\" value=\"";
     // line 20
     echo twig_escape_filter($this->env, set_value("nama"), "html", null, true);
     echo "\">\n                            <button type=\"submit\" class=\"btn btn-primary\">Simpan</button>\n                            ";
     // line 22
     echo form_error("nama");
     echo "\n                        </div>\n                    </div>\n                ";
     // line 25
     echo form_close();
     echo "\n            </div>\n        </div>\n\n        <p><b>Note:</b> Kelas tidak dapat di hapus namun dapat di ubah menjadi tidak aktif</p>\n\n        ";
     // line 31
     echo isset($context["kelas_hirarki"]) ? $context["kelas_hirarki"] : null;
     echo "\n\n        <br>\n        <div id=\"response_update\"></div>\n        <button class=\"btn btn-primary\" id=\"update-hirarki\">Update Hirarki</button>\n    </div>\n</div>\n";
 }
Example #16
0
 public function multi_career()
 {
     //comprobamos si es una petición ajax
     if ($this->input->is_ajax_request()) {
         $this->form_validation->set_rules('code', 'codigo', 'required');
         $this->form_validation->set_rules('name', 'nombre', 'required');
         $this->form_validation->set_message('required', 'El %s es obligatorio');
         if ($this->form_validation->run() == FALSE) {
             //de esta forma devolvemos los errores de formularios
             //con ajax desde codeigniter, aunque con php es lo mismo
             $errors = array('code' => form_error('code'), 'name' => form_error('name'), 'respuesta' => 'error');
             //y lo devolvemos así para parsearlo con JSON.parse
             echo json_encode($errors);
             return FALSE;
         } else {
             $code = $this->input->post('code');
             $name = $this->input->post('name');
             //si estamos editando
             if ($this->input->post('id')) {
                 $id = $this->input->post('id');
                 $this->career->edit_career($id, $code, $name);
                 //si estamos agregando una carrera
             } else {
                 $this->career->new_career($code, $name);
             }
             //en cualquier caso damos ok porque todo ha salido bien
             //habría que hacer la comprobación de la respuesta del modelo
             $response = array('respuesta' => 'ok');
             echo json_encode($response);
         }
     }
 }
Example #17
0
 public function reset_password()
 {
     $response['status'] = 'n';
     $username = $this->tank_auth->get_username();
     if ($this->input->post('password')) {
         $this->form_validation->set_rules('password', '密码', 'trim|required|xss_clean|min_length[' . $this->config->item('password_min_length', 'tank_auth') . ']|max_length[' . $this->config->item('password_max_length', 'tank_auth') . ']|alpha_dash');
         $this->form_validation->set_rules('confirm_password', '确认密码', 'trim|required|xss_clean|matches[password]');
         if ($this->form_validation->run()) {
             $forgotten_data = $this->tank_auth->forgot_password($username);
             if (!is_null($forgotten_data)) {
                 $reset_data = $this->tank_auth->reset_password($forgotten_data['user_id'], $forgotten_data['new_pass_key'], $this->form_validation->set_value('password'));
                 if (!is_null($reset_data)) {
                     $response['status'] = 'y';
                     $response['info'] = '密码修改成功';
                 }
             } else {
                 $errors = $this->tank_auth->get_error_message();
                 foreach ($errors as $k => $v) {
                     $response['info'][$k] = $this->lang->line($v);
                 }
             }
         } else {
             $response['info']['password'] = form_error('password');
             $response['info']['confirm_password'] = form_error('confirm_password');
         }
         echo json_encode($response);
     } else {
         $this->load->view('front/memeber_reset_password.php', $data);
     }
 }
Example #18
0
 public function validateOptionsForm(&$form, FormStateInterface $form_state)
 {
     // Require a key if the format is key.
     if ($form_state['values']['options']['format'] == 'key' && $form_state['values']['options']['key'] == '') {
         form_error($form['key'], $form_state, t('You have to enter a key if you want to display a key of the data.'));
     }
 }
 public function block_content($context, array $blocks = array())
 {
     // line 4
     echo "<div class=\"btn-group pull-right\">\n    <a class=\"btn btn-primary btn-small\" href=\"";
     // line 5
     echo twig_escape_filter($this->env, site_url("tugas/tambah_soal/" . $this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "id")), "html", null, true);
     echo "\">Tambah Pertanyaan</a>\n    ";
     // line 6
     if ($this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "type_id") == 3) {
         // line 7
         echo "    <a class=\"btn btn-primary btn-small\" href=\"";
         echo twig_escape_filter($this->env, site_url("tugas/tambah_pilihan/" . $this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "id") . "/" . $this->getAttribute(isset($context["pertanyaan"]) ? $context["pertanyaan"] : null, "id")), "html", null, true);
         echo "\">Tambah Pilihan</a>\n    ";
     }
     // line 9
     echo "</div>\n\n<h4>Edit Pertanyaan ke ";
     // line 11
     echo twig_escape_filter($this->env, isset($context["no_pertanyaan"]) ? $context["no_pertanyaan"] : null, "html", null, true);
     echo "</h4>\n";
     // line 12
     echo get_flashdata("tugas");
     echo "\n\n";
     // line 14
     echo form_open("tugas/edit_soal/" . $this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "id") . "/" . $this->getAttribute(isset($context["pertanyaan"]) ? $context["pertanyaan"] : null, "id"));
     echo "\n<table class=\"table table-striped\" style=\"margin-top:20px;\">\n    <tbody>\n        <tr>\n            <td>\n                <textarea name=\"pertanyaan\" id=\"pertanyaan\" style=\"height:400px;width:100%;\">";
     // line 19
     echo set_value("pertanyaan", html_entity_decode($this->getAttribute(isset($context["pertanyaan"]) ? $context["pertanyaan"] : null, "pertanyaan")));
     echo "</textarea>\n                ";
     // line 20
     echo form_error("pertanyaan");
     echo "\n            </td>\n        <tr>\n        <tr>\n            <td colspan=\"2\">\n                <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n            </td>\n        </tr>\n    </tbody>\n</table>\n";
     // line 30
     echo form_close();
     echo "\n";
 }
/**
 * Displays an error if the given class has an error attached to it
 */
function show_if_error($field_name)
{
    $error = form_error($field_name);
    if (!empty($error)) {
        return '<span class="help-block">' . $error . '</span>';
    }
}
Example #21
0
 public function register()
 {
     $post = $this->input->post();
     // var_dump($post);
     $this->form_validation->set_rules('name', "Name", "trim|required");
     $this->form_validation->set_rules('alias', "Alias", "trim|required");
     $this->form_validation->set_rules('email', "Email", "valid_email|required");
     $this->form_validation->set_rules('password', "Password", "min_length[5]|required");
     $this->form_validation->set_rules('confirm_password', "Confirm Password", "matches[password]|required");
     // die('register');
     if ($this->form_validation->run() === FALSE) {
         //if validaiton fails
         $this->session->set_flashdata('name', form_error('name'));
         $this->session->set_flashdata('alias', form_error('alias'));
         $this->session->set_flashdata('email', form_error('email'));
         $this->session->set_flashdata('password', form_error('password'));
         $this->session->set_flashdata('confirm_password', form_error('confirm_password'));
         redirect('/');
     } else {
         $user['name'] = $post['name'];
         $user['alias'] = $post['alias'];
         $user['email'] = $post['email'];
         $user['password'] = $this->encrypt->encode($post['password']);
         $all_users = $this->user->get_all_users();
         // var_dump($all_users);
         // var_dump($user);
         $this->user->add_user($user);
         redirect('/');
         die('registered');
     }
 }
Example #22
0
 public function create()
 {
     // $user = $this->input->post( 'user' );
     // var_dump($user);
     // return;
     $this->form_validation->set_error_delimiters('', '');
     $this->form_validation->set_rules('name', 'Imię', 'required|min_length[3]');
     $this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');
     $this->form_validation->set_rules('password', 'Hasło', 'required|matches[passconf]');
     $this->form_validation->set_rules('passconf', 'Powtórz hasło', 'required|matches[password]');
     if ($this->form_validation->run()) {
         $user = $this->input->post('user');
         $user['role'] = 'user';
         //unset odpina
         unset($user['passconf']);
         // szyfrowanie hasła zeby w bazie nie bylo widoczne prawdziwe, drugi parametr to dowatkowy klucz zeby mocniej szyfrowalo, kod mozesz wpisac w configu codeignitera (encryption_key) a potem odnosimy sie do tego (mozna wpisac bezposredniu tutaj bez codeignitera)
         $user['password'] = crypt($user['password'], config_item('encryption_key'));
         $this->User_model->create($user);
     } else {
         $errors['name'] = form_error('name');
         $errors['email'] = form_error('email');
         $errors['password'] = form_error('password');
         $errors['passconf'] = form_error('passconf');
         echo json_encode($errors);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function elementValidateRequired($element, FormStateInterface $form_state)
 {
     // Set a custom validation error on the #required element.
     if (!empty($element['#required_but_empty']) && isset($element['#form_test_required_error'])) {
         form_error($element, $form_state, $element['#form_test_required_error']);
     }
 }
Example #24
0
 function register()
 {
     if (isset($_POST['nombre'])) {
         $this->data['user'] = json_decode($_POST['user']);
         if ($this->usuario_samsung->alreadyRegistrer('usuarios', array('fbid' => $this->data['user']->id))) {
             $updateUser = array('nombre' => $_POST['nombre'], 'completo' => $_POST['nombre'] . " " . $_POST['apellido'], 'mail' => $_POST['mail'], 'ultima_app' => $this->data['app_name'], 'ciudad' => $_POST['ciudad'], 'cedula' => $_POST['cedula'], 'telefono' => $_POST['telefono']);
             $this->db->update('usuarios', $updateUser, array('fbid' => $this->data['user']->id));
             $participante = $this->usuario_samsung->getUserFbid($this->data['user']->id);
             $id = $participante->id;
             $this->db->insert("todocurvo", array("id_user" => $id));
             $resp = "1";
         } else {
             $insertUser = array('nombre' => $_POST['nombre'], 'completo' => $_POST['nombre'] . " " . $_POST['apellido'], 'mail' => $_POST['mail'], 'ultima_app' => $this->data['app_name'], 'ciudad' => $_POST['ciudad'], 'cedula' => $_POST['cedula'], 'telefono' => $_POST['telefono'], 'fbid' => $this->data['user']->id);
             $this->db->insert('usuarios', $insertUser);
             $id = $this->db->insert_id();
             $this->db->insert("todocurvo", array("id_user" => $id));
             $resp = "1";
         }
         echo $resp;
     } else {
         $this->data['errors'] = array('nombre' => form_error('nombre') || FALSE, 'ciudad' => form_error('ciudad') || FALSE, 'mail' => form_error('mail') || FALSE, 'telefono' => form_error('telefono') || FALSE, 'cedula' => form_error('cedula') || FALSE);
         $this->data['fb_page'] = json_decode($_POST['fb_page']);
         $this->data['user'] = json_decode($_POST['user']);
         $user = $this->usuario_samsung->getUserFbid($this->data['user']->id);
         $this->data['user']->telefono = isset($user->telefono) ? $user->telefono : '';
         $this->data['user']->cedula = isset($user->cedula) ? $user->cedula : '';
         $this->load->view('samsung_todocurvo/register', array('data' => $this->data));
     }
 }
Example #25
0
 public function update($payment_id = 0)
 {
     $this->form_validation->set_rules('amount', 'Payment Amount', 'trim|required|numeric');
     $this->form_validation->set_rules('or_number', 'OR Number', 'trim|required');
     $this->form_validation->set_rules('date', 'Payment Date', 'trim|required');
     $this->form_validation->set_rules('regular_discount', 'Regular Discount', 'trim|numeric');
     $this->form_validation->set_rules('discount', 'Discount', 'trim|numeric');
     $this->form_validation->set_rules('penalty', 'Penalty', 'trim|numeric');
     $this->form_validation->set_rules('adjustment', 'Adjustment', 'trim|numeric');
     $this->form_validation->set_rules('other_charges', 'Penalty', 'trim|numeric');
     if ($this->input->post()) {
         if ($this->form_validation->run() == FALSE) {
             $errors = array('amount' => form_error('amount', '<div class="error">', '</div>'), 'or_number' => form_error('or_number', '<div class="error">', '</div>'), 'date' => form_error('date', '<div class="error">', '</div>'), 'regular_discount' => form_error('regular_discount', '<div class="error">', '</div>'), 'penalty' => form_error('penalty', '<div class="error">', '</div>'), 'other_charges' => form_error('other_charges', '<div class="error">', '</div>'), 'discount' => form_error('discount', '<div class="error">', '</div>'), 'adjustment' => form_error('adjustment', '<div class="error">', '</div>'));
             return die(json_encode($errors));
         } else {
             $data = array('amount' => !empty($this->input->post('amount')) ? $this->input->post('amount') : 0, 'or_number' => $this->input->post('or_number'), 'date' => strtotime($this->input->post('date')), 'regular_discount' => !empty($this->input->post('regular_discount')) ? $this->input->post('regular_discount') : 0, 'discount' => !empty($this->input->post('discount')) ? $this->input->post('discount') : 0, 'penalty' => !empty($this->input->post('penalty')) ? $this->input->post('penalty') : 0, 'other_charges' => !empty($this->input->post('other_charges')) ? $this->input->post('other_charges') : 0, 'wmm' => !empty($this->input->post('wmm')) ? $this->input->post('wmm') : 0, 'payment_type' => $this->input->post('payment_type'), 'adjustment' => !empty($this->input->post('adjustment')) ? $this->input->post('adjustment') : 0);
             $result = $this->payment_model->update_payment($payment_id, $data);
             if ($result) {
                 return die('success');
             }
         }
     } else {
         $data['payments'] = $this->payment_model->get_payment_by_id($payment_id);
         $data['options'] = $this->paymentTypeList;
         $template['content'] = $this->load->view('payment/update_payment', $data, TRUE);
         $this->load->view('template/popup_template', $template);
     }
 }
 public function block_content($context, array $blocks = array())
 {
     // line 4
     echo "<div class=\"module\">\n    <div class=\"module-head\">\n        <h3>";
     // line 6
     echo isset($context["module_title"]) ? $context["module_title"] : null;
     echo "</h3>\n    </div>\n    <div class=\"module-body\">\n        ";
     // line 9
     echo get_flashdata("mapel");
     echo "\n\n        ";
     // line 11
     echo form_open("admin/mapel/edit/" . $this->getAttribute(isset($context["mapel"]) ? $context["mapel"] : null, "id") . "/" . enurl_redirect(isset($context["uri_back"]) ? $context["uri_back"] : null), array("class" => "form-horizontal row-fluid"));
     echo "\n            <div class=\"control-group\">\n                <label class=\"control-label\">Nama <span class=\"text-error\">*</span></label>\n                <div class=\"controls\">\n                    <input type=\"text\" name=\"nama\" class=\"span8\" value=\"";
     // line 15
     echo twig_escape_filter($this->env, set_value("nama", $this->getAttribute(isset($context["mapel"]) ? $context["mapel"] : null, "nama")), "html", null, true);
     echo "\">\n                    <br>";
     // line 16
     echo form_error("nama");
     echo "\n                </div>\n            </div>\n            <div class=\"control-group\">\n                <label class=\"control-label\">Deskripsi</label>\n                <div class=\"controls\">\n                    <textarea name=\"info\" class=\"span12\" rows=\"5\">";
     // line 22
     echo set_value("info", $this->getAttribute(isset($context["mapel"]) ? $context["mapel"] : null, "info"));
     echo "</textarea>\n                </div>\n            </div>\n            <div class=\"control-group\">\n                <label class=\"control-label\">Status</label>\n                <div class=\"controls\">\n                    <label class=\"checkbox inline\">\n                        <input type=\"checkbox\" value=\"1\" name=\"status\" ";
     // line 29
     echo twig_escape_filter($this->env, set_checkbox("status", "1", $this->getAttribute(isset($context["mapel"]) ? $context["mapel"] : null, "aktif") == 1 ? true : false), "html", null, true);
     echo ">\n                        Aktif\n                    </label>\n                </div>\n            </div>\n            <div class=\"control-group\">\n                <div class=\"controls\">\n                    <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n                    <a href=\"";
     // line 37
     echo twig_escape_filter($this->env, isset($context["uri_back"]) ? $context["uri_back"] : null, "html", null, true);
     echo "\" class=\"btn\">Batal</a>\n                </div>\n            </div>\n        ";
     // line 40
     echo form_close();
     echo "\n\n    </div>\n</div>\n";
 }
 public function Actualizar()
 {
     $user = $this->input->post(null, true);
     $user = $this->Fechas($user, 'update');
     $this->Validar(1);
     $errores = array();
     if ($this->form_validation->run() == false) {
         $error['name'] = form_error('name');
         $error['apellidos'] = form_error('apellidos');
         $error['nacimiento'] = form_error('nacimiento');
         $error['type_id'] = form_error('type_id');
         $error['level_id'] = form_error('level_id');
         $errores['exito'] = false;
         $errores['errores'] = $error;
     } else {
         if (empty($error['name']) && empty($error['apellidos']) && empty($error['nacimiento']) && empty($error['type_id']) && empty($error['level_id'])) {
             $this->Modeluser->update($user, $user['id']);
             $errores['exito'] = true;
             $errores['alert'] = "Actualizacion Exitosa del usuario: " . $user['email'] . "";
             $errores['url'] = base_url() . "paneladmin/user";
             $errores['alertc'] = "alert alert-success alert-dismissible";
         }
     }
     echo json_encode($errores);
 }
 function foundation_form_input($name, $args = array())
 {
     $isValid = form_error($name) ? false : true;
     if (!empty($args['default_value'])) {
         $default_value = $args['default_value'];
     } else {
         $default_value = null;
     }
     $class = !empty($args['class']) ? $args['class'] : '';
     $node = "<label>" . humanize($name);
     if (!empty($args['as'])) {
         switch ($args['as']) {
             case 'collection':
                 if (!empty($args['collection'])) {
                     if ($args['allow_blank']) {
                         $args['collection'] = array_merge(array(" " => " "), $args['collection']);
                     }
                     $node .= form_dropdown($name, $args['collection'], set_value($name));
                 }
                 break;
             case 'text':
                 $node .= form_textarea($name, set_value($name, $default_value));
                 break;
             default:
                 # ...
                 break;
         }
     } else {
         $node .= form_input($name, set_value($name, $default_value));
     }
     $node .= form_error($name, '<div class="error">', '</div>');
     $node .= "</label>";
     return $node;
 }
 public function update($id)
 {
     $this->load->library("form_validation");
     $this->form_validation->set_rules("name", "product name", "required|min_length[3]|trim|xss_clean");
     $this->form_validation->set_rules("description", "Description", "required|min_length[10]|trim|xss_clean");
     $this->form_validation->set_rules("price", "Price", "required|trim|max_length[7]|xss_clean");
     if ($this->form_validation->run()) {
         $product['id'] = $id;
         $product['name'] = $this->input->post('name');
         $product['description'] = $this->input->post('description');
         $product['price'] = $this->input->post('price');
         $this->load->model('product');
         if ($this->product->update_product($product)) {
             redirect('/');
         } else {
             $this->session->set_flashdata('database_error', 'Sorry. There was an error updating your product');
             redirect("/products/edit/{$id}");
         }
     } else {
         $this->session->set_flashdata('name', form_error('name'));
         $this->session->set_flashdata('description', form_error('description'));
         $this->session->set_flashdata('price', form_error('price'));
         redirect("/products/edit/{$id}");
     }
 }
Example #30
0
 public function sign_in()
 {
     header('Content-Type: application/json');
     if ($this->input->post('email')) {
         redirect('user/mypage');
         //	$this->load->view('user/mypage');
     } else {
         header('Content-Type: application/json');
         $data = $this->input->post(NULL, true);
         $result = array();
         $this->form_validation->set_rules('email', 'email', 'required|trim|min_length[6]|max_length[50]|valid_email|xss_clean');
         $this->form_validation->set_rules('password', 'Password', 'required|trim|min_length[6]|max_length[50]|xss_clean|md5');
         if ($this->form_validation->run() == FALSE) {
             $result['errorLogin']['email'] = form_error('email');
             $result['errorLogin']['password'] = form_error('password');
         } else {
             $login = $this->login_model->login($data);
             print_r($login);
             if (!empty($login)) {
                 $id = $login[0]->id;
                 $this->session->set_userdata('id_user', $id);
                 echo json_encode(array('msg' => 'success'));
                 die;
             } else {
                 $result['errorLogin']['aaaaa'] = "login OR password invalid";
             }
         }
     }
     echo json_encode($result);
 }