/** * 入力チェック * * @access public * @param none * @return void */ public function _validation($page = '') { $errors = array(); if(\Security::check_token()) { $val = \Validation::forge(); $val->add_callable('MyValidation'); $val->add('email', 'メールアドレス') ->add_rule('required') ->add_rule('valid_email') ->add_rule('overlap_email', 'companies'); if($page == 'detail') { $val->add('password', 'パスワード') ->add_rule('required') ->add_rule('min_length', 8) ->add_rule('max_length', 20); $val->add('password_match', 'パスワード確認') ->add_rule('required') ->add_rule('match_field', 'password'); $val->add('company_name', '企業名') ->add_rule('required') ->add_rule('max_length', 30); $val->add('company_name_ruby', '企業名(フリガナ)') ->add_rule('required') ->add_rule('max_length', 60) ->add_rule('katakana'); $val->add('representative', '代表者名') ->add_rule('required') ->add_rule('max_length', 30); $val->add('pic_name', '担当者名') ->add_rule('required') ->add_rule('max_length', 20); $val->add('pic_name_ruby', '担当者名(フリガナ)') ->add_rule('required') ->add_rule('max_length', 40) ->add_rule('katakana'); $val->add('pic_department', '担当者部署名') ->add_rule('required') ->add_rule('max_length', 20); $val->add('pic_position', '担当者役職') ->add_rule('max_length', 30); $val->add('pic_tel', '担当者電話番号') ->add_rule('required') ->add_rule('valid_string', array('numeric'), '数字') ->add_rule('max_length', 20); $val->add('postal_code', '郵便番号') ->add_rule('required') ->add_rule('postalcode') ->add_rule('exact_length', 8); $val->add('pref', '都道府県') ->add_rule('required') ->add_rule('valid_string', array('numeric'), '数字') ->add_rule('max_length', 2); $val->add('address', '住所') ->add_rule('required') ->add_rule('max_length', 100); $val->add('web_url', 'WebサイトURL') ->add_rule('max_length', 100) ->add_rule('valid_url'); $val->add('industry_type', '業種・業態') ->add_rule('required') ->add_rule('max_length', 3); $val->add('employment_type', '掲載求人の雇用形態') ->add_rule('required') ->add_rule('max_length', 3); $val->add('agreement', '利用規約') ->add_rule('required') ->add_rule('exact_length', 1); } $val->run(); foreach ($val->error() as $key => $error) { $errors[$key] = $error->get_message(); } } else { $errors['fuel_csrf_token'] = '画面遷移が正しくありません。'; } return $errors; }