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


PHP client::has_errors方法代码示例

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


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

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