-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRegistrationAnswerTextAreaBehavior.php
More file actions
45 lines (40 loc) · 1.18 KB
/
RegistrationAnswerTextAreaBehavior.php
File metadata and controls
45 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* RegistrationValidate Behavior
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Allcreator <info@allcreator.net>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('RegistrationAnswerBehavior', 'Registrations.Model/Behavior');
/**
* TextArea Behavior
*
* @package Registrations\Registrations\Model\Befavior\Answer
* @author Allcreator <info@allcreator.net>
*/
class RegistrationAnswerTextAreaBehavior extends RegistrationAnswerBehavior {
/**
* this answer type
*
* @var int
*/
protected $_myType = RegistrationsComponent::TYPE_TEXT_AREA;
/**
* answerMaxLength 登録が登録フォームが許す最大長を超えていないかの確認
*
* @param object &$model use model
* @param array $data Validation対象データ
* @param array $question 登録データに対応する質問
* @param int $max 最大長
* @return bool
*/
public function answerMaxLength(&$model, $data, $question, $max) {
if ($question['question_type'] != $this->_myType) {
return true;
}
return Validation::maxLength($data['answer_value'], $max);
}
}