本文整理汇总了PHP中ValidationResult::getVarType方法的典型用法代码示例。如果您正苦于以下问题:PHP ValidationResult::getVarType方法的具体用法?PHP ValidationResult::getVarType怎么用?PHP ValidationResult::getVarType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValidationResult
的用法示例。
在下文中一共展示了ValidationResult::getVarType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUserInput
public function addUserInput($post, $data = NULL)
{
if (!$data) {
$data = $this->record->getData($this->getPage());
}
foreach ($post as $key => $value) {
if ($key == 'page') {
continue;
}
$page = substr($key, 0, strpos($key, "-"));
// Split out class and name from input field
$fieldName = substr($key, strpos($key, "-") + 1);
if ($page == $this->getPage()) {
// Checks that the input is from the right page
$valRules = $this->getValRules($page, $fieldName);
if (!emptyInput($value)) {
if ($valRules) {
$vR = new ValidationRules();
$vR->addRulesFromDB($valRules);
$record = isset($this->record) ? $this->record : $data;
$valid = new ValidationResult($value, $vR, $record);
$value = $valid->getValue();
if ($valid->isValid()) {
$data->set($fieldName, $value);
} else {
if (!is_array($valid->getValue())) {
$_SESSION['inputErr'][$key]['value'] = $valid->getValue();
} else {
$_SESSION['inputErr'][$key]['value'] = false;
// Allows marking an error without reproducing the error value
}
$_SESSION['inputErr'][$key]['error'] = $valid->getError();
if ($valid->getVarType() == 'password') {
$_SESSION['error'] = $valid->getError();
}
}
} else {
$data->set($fieldName, $value);
}
}
}
}
if (!($complete = $this->checkComplete($this->getPage(), $data))) {
// Check to see if the object is complete, if so then set it as complete, if not then add a missingData field to inputErr
$_SESSION['inputErr']['missingData'] = true;
// This ensures mandatory data missing is shown
}
$nextPage = $complete && !isset($_SESSION['inputErr']);
return $nextPage;
}