当前位置: 首页>>代码示例>>PHP>>正文


PHP client::validation_results方法代码示例

本文整理汇总了PHP中client::validation_results方法的典型用法代码示例。如果您正苦于以下问题:PHP client::validation_results方法的具体用法?PHP client::validation_results怎么用?PHP client::validation_results使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在client的用法示例。


在下文中一共展示了client::validation_results方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 public function add()
 {
     $form = array('building_id' => '', 'name' => '', 'index' => '', 'img_uri' => '', 'active' => '');
     $errors = $form;
     if ($_POST) {
         $post = new Validation($_POST);
         $post->pre_filter('trim', true);
         $post->add_rules('buildings_id', 'required', 'digit');
         $post->add_rules('name', 'required');
         $post->add_rules('index', 'required');
         $post->add_rules('img_uri', 'required');
         $post->add_rules('active', 'required');
         if ($post->validate()) {
             // check for invilid
             $form = arr::overwrite($form, $post->as_array());
             $people = new Person_Model();
             $result = $people->save($this->input->get('person'), $person_id);
         } else {
             $form = arr::overwrite($form, $post->as_array());
             client::validation_results(arr::overwrite($errors, $post->errors('hiring_employee_form_validations')));
             client::messageSend("There were errors in some fields", E_USER_WARNING);
         }
     }
     $building = new Building_Model();
     $buildings_list = $building->select_list();
     $this->template->title = 'Seating::Spaces::Add';
     $this->template->content = new View('pages/spaces_add');
     $this->template->content->form = $form;
     $this->template->content->buildings_list = $buildings_list;
 }
开发者ID:samkeen,项目名称:Confab-Server,代码行数:30,代码来源:spaces.php

示例2: action_edit

 public function action_edit($edit_id = null)
 {
     if (!$edit_id) {
         client::messageSend("Invalid Request", E_USER_WARNING);
         $this->request->redirect('markers');
     }
     $this->template->title = 'Markers :: Edit';
     $this->template->content = new View('admin/pages/markers_edit');
     $marker = ORM::factory('marker', $edit_id);
     //        echo Kohana::debug($marker->has('spaces',orm::factory('space',1)));die;
     $this->template->content->spaces_list = ORM::factory('space')->find_all()->as_array('id', 'name');
     if ($_POST) {
         //            var_dump($_POST);die;
         $marker->email = Arr::get($_POST, 'email');
         if (Arr::get($_POST, 'space')) {
             $marker->remove_all('spaces');
             foreach (Arr::get($_POST, 'space', array()) as $space_id) {
                 $space = ORM::factory('space', $space_id);
                 $marker->add('spaces', $space);
             }
         }
         if ($marker->validate()) {
             $marker->save();
             client::messageSend("The Marker '{$marker->email}' Was Saved", E_USER_NOTICE);
             $this->request->redirect('admin/markers');
         } else {
             client::validation_results($marker->errors());
             client::messageSend("There were errors in some fields", E_USER_WARNING);
         }
     }
     $this->template->content->marker = $marker;
 }
开发者ID:samkeen,项目名称:spot,代码行数:32,代码来源:markers.php

示例3: action_edit

 public function action_edit($edit_id = null)
 {
     if (!$edit_id) {
         client::messageSend("Invalid Request", E_USER_WARNING);
         $this->request->redirect('buildings');
     }
     $this->template->title = 'Buildings :: Edit';
     $this->template->content = new View('admin/pages/buildings_edit');
     $this->template->content->sites_list = ORM::factory('site')->find_all()->as_array('id', 'name');
     $building = ORM::factory('building')->find($edit_id);
     if ($_POST) {
         $building->site_id = Arr::get($_POST, 'site_id');
         $building->name = Arr::get($_POST, 'name');
         $building->lat = Arr::get($_POST, 'lat');
         $building->long = Arr::get($_POST, 'long');
         if ($building->validate()) {
             $building->save();
             client::messageSend("The Building '{$building->name}' Was Saved", E_USER_NOTICE);
             $this->request->redirect('admin/buildings');
         } else {
             client::validation_results($building->errors());
             client::messageSend("There were errors in some fields", E_USER_WARNING);
         }
     }
     $this->template->content->building = $building;
 }
开发者ID:samkeen,项目名称:spot,代码行数:26,代码来源:buildings.php

示例4: action_edit

 public function action_edit($edit_id = null)
 {
     if (!$edit_id) {
         client::messageSend("Invalid Request", E_USER_WARNING);
         $this->request->redirect('spaces');
     }
     $this->template->title = 'Spaces :: Edit';
     $this->template->content = new View('admin/pages/spaces_edit');
     $this->template->content->buildings_list = ORM::factory('building')->find_all()->as_array('id', 'name');
     $space = ORM::factory('space')->find($edit_id);
     if ($_POST) {
         $space->name = Arr::get($_POST, 'name');
         $space->index = Arr::get($_POST, 'index');
         $space->img_url = Arr::get($_POST, 'img_url');
         if ($space->validate()) {
             $space->save();
             client::messageSend("The Space '{$space->name}' Was Saved", E_USER_NOTICE);
             $this->request->redirect('admin/spaces');
         } else {
             client::validation_results($space->errors());
             client::messageSend("There were errors in some fields", E_USER_WARNING);
         }
     }
     $this->template->content->space = $space;
 }
开发者ID:samkeen,项目名称:spot,代码行数:25,代码来源:spaces.php

示例5: login

 /**
  * note: Route set to /login
  */
 public function login()
 {
     $username = $this->input->post('bz_username');
     $password = $this->input->post('bz_password');
     if ($_POST) {
         $validation = Validation::factory($this->input->post())->pre_filter('trim')->add_rules('bz_username', 'required')->add_rules('bz_password', 'required');
         if ($validation->validate()) {
             if ($this->bugzilla->login($username, $password)) {
                 url::redirect();
             } else {
                 client::messageSend($this->bugzilla->error_message(), E_USER_WARNING);
             }
         } else {
             client::validation_results($validation->errors());
             client::messageSend("There were errors in some fields", E_USER_WARNING);
         }
     }
     $this->template->content = new View('pages/bz_login');
     $this->template->content->bz_username = $username;
     $this->template->content->bz_password = $password;
     $this->template->title = 'Worker Managment :: Login';
 }
开发者ID:samkeen,项目名称:workermgmt-k,代码行数:25,代码来源:authenticate.php

示例6: action_edit

 public function action_edit($edit_id = null)
 {
     if (!$edit_id) {
         client::messageSend("Invalid Request", E_USER_WARNING);
         $this->request->redirect('sites');
     }
     $this->template->title = 'Sites :: Edit';
     $this->template->content = new View('admin/pages/sites_edit');
     $site = ORM::factory('site')->find($edit_id);
     if ($_POST) {
         $site->name = Arr::get($_POST, 'name');
         $site->lat = Arr::get($_POST, 'lat');
         $site->long = Arr::get($_POST, 'long');
         if ($site->validate()) {
             $site->save();
             client::messageSend("The Site '{$site->name}' Was Saved", E_USER_NOTICE);
             $this->request->redirect('admin/sites');
         } else {
             client::validation_results($site->errors());
             client::messageSend("There were errors in some fields", E_USER_WARNING);
         }
     }
     $this->template->content->site = $site;
 }
开发者ID:samkeen,项目名称:spot,代码行数:24,代码来源:sites.php

示例7: validation_results

 /**
  * Set the results of the validation (from Validation_Core).
  * self::validation($input_key) then uses this to output those errors
  * at the specific form input element
  * 
  * @param array $results
  */
 public static function validation_results($results)
 {
     self::$validation_results = $results;
 }
开发者ID:samkeen,项目名称:workermgmt-k,代码行数:11,代码来源:client.php

示例8: contractor

 /**
  * Form for submitting Contractor hirings
  */
 public function contractor()
 {
     $hiring = new Hiring_Model($this->get_ldap());
     $this->select_lists['manager'] = hiring_forms::format_manager_list($hiring->manager_list());
     $this->select_lists['buddy'] = hiring_forms::format_manager_list($hiring->buddy_list());
     // allow only hire_type = 'Contractor'
     $this->select_lists['hire_type'] = array('Contractor' => 'Contractor');
     /**
      * track required fields with this array, Validator uses it and form helper
      * uses it to determine which fields to decorate as 'required' in the UI
      */
     $required_fields = array('contract_type', 'contractor_category', 'first_name', 'last_name', 'address', 'phone_number', 'email_address', 'start_date', 'end_date', 'pay_rate', 'payment_limit', 'manager', 'location', 'statement_of_work');
     $form = array('hire_type' => 'Contractor', 'contract_type' => '', 'contractor_category' => '', 'first_name' => '', 'last_name' => '', 'org_name' => '', 'address' => '', 'phone_number' => '', 'email_address' => '', 'start_date' => '', 'end_date' => '', 'pay_rate' => '', 'payment_limit' => '', 'manager' => '', 'buddy' => '', 'location' => '', 'location_other' => '', 'statement_of_work' => '', 'mail_needed' => '', 'default_username' => '', 'mail_alias' => '', 'mail_lists' => '', 'other_comments' => '');
     $errors = $form;
     if ($_POST) {
         hiring_forms::filter_disallowed_values($this->select_lists);
         $post = new Validation($_POST);
         $post->pre_filter('trim', true);
         $post->add_rules('start_date', 'valid::date');
         $post->add_rules('end_date', 'valid::date');
         $post->add_rules('email_address', 'valid::email');
         if ($this->input->post('mail_needed') == '1') {
             array_push($required_fields, 'location');
         }
         if ($this->input->post('location') == 'other') {
             array_push($required_fields, 'location_other');
         }
         // add all the required fields
         foreach ($required_fields as $required_field) {
             $post->add_rules($required_field, 'required');
         }
         if ($post->validate()) {
             // check for invilid
             $form = arr::overwrite($form, $post->as_array());
             $form = $this->build_supplemental_form_values($form, $hiring);
             $bugs_to_file = array(Bugzilla::BUG_NEWHIRE_SETUP, Bugzilla::BUG_HR_CONTRACTOR);
             if ($form['mail_needed']) {
                 $bugs_to_file[] = Bugzilla::BUG_EMAIL_SETUP;
             }
             // File the appropriate Bugs
             $this->file_these($bugs_to_file, $form);
             // Send Buddy Email
             if (!empty($form['buddy'])) {
                 $this->notify_buddy($form, $hiring);
             }
             if (!client::has_errors()) {
                 url::redirect('hiring/contractor');
             }
         } else {
             $form = arr::overwrite($form, $post->as_array());
             client::validation_results(arr::overwrite($errors, $post->errors('hiring_contractor_form_validations')));
             client::messageSend("There were errors in some fields", E_USER_WARNING);
         }
     }
     // the UI used client to determine which fields to decorate as 'required'
     form::required_fields($required_fields);
     $this->template->js_extra = html::script(array('media/js/jquery.autocomplete.min.js'), false);
     $this->template->css_extra = html::stylesheet(array('media/css/jquery.autocomplete.css'), array('screen'));
     $this->template->title = 'Hiring::Contractor';
     $this->template->content = new View('pages/hiring_contractor');
     $this->template->content->form = $form;
     $this->template->content->lists = $this->select_lists;
 }
开发者ID:samkeen,项目名称:workermgmt-k,代码行数:66,代码来源:hiring.php


注:本文中的client::validation_results方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。