本文整理汇总了PHP中Checker::checkTypeName方法的典型用法代码示例。如果您正苦于以下问题:PHP Checker::checkTypeName方法的具体用法?PHP Checker::checkTypeName怎么用?PHP Checker::checkTypeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Checker
的用法示例。
在下文中一共展示了Checker::checkTypeName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showEditTypeGeneralRes
function showEditTypeGeneralRes()
{
$displaySysAdmin = new DisplaySysAdmin();
$survey = new Survey($_SESSION['SUID']);
$tyd = getFromSessionParams('tyd');
$content = "";
if ($tyd != '') {
//edit
$type = $survey->getType($tyd);
$_SESSION['TYD'] = $tyd;
$content = $displaySysAdmin->displaySuccess(Language::messageTypeChanged(loadvar(SETTING_NAME)));
} else {
//add section!
if (loadvar(SETTING_NAME) != "") {
$type = new Type();
$type->setSuid($_SESSION['SUID']);
$_SESSION['TYD'] = $type->getTyd();
$content = $displaySysAdmin->displaySuccess(Language::messageTypeAdded(loadvar(SETTING_NAME)));
}
}
$checker = new Checker($_SESSION['SUID']);
if ($tyd == '') {
$checks = $checker->checkTypeName(loadvar(SETTING_NAME));
if (sizeof($checks) > 0) {
$content = implode("<br/>", $checks);
return $this->showAddType($content);
}
}
//ADD ALL SORTS OF CHECKS!!
if ($tyd != '' || loadvar(SETTING_NAME) != "") {
$type->setName(trim(loadvar(SETTING_NAME)));
$type->setAnswerType(loadvar(SETTING_ANSWERTYPE));
$type->setAnswerTypeCustom(loadvar(SETTING_ANSWERTYPE_CUSTOM));
$type->setOptionsText(loadvarAllowHTML(SETTING_OPTIONS));
$type->setArray(loadvar(SETTING_ARRAY));
$type->setKeep(loadvar(SETTING_KEEP));
$answertype = loadvar(SETTING_ANSWERTYPE);
if (inArray($answertype, array(ANSWER_TYPE_NONE, ANSWER_TYPE_SECTION))) {
$type->setHidden(HIDDEN_YES);
} else {
$type->setHidden(loadvar(SETTING_HIDDEN));
}
if ($type->getInputMask() == "") {
switch ($answertype) {
case ANSWER_TYPE_INTEGER:
$type->setInputMask(INPUTMASK_INTEGER);
break;
case ANSWER_TYPE_DOUBLE:
$type->setInputMask(INPUTMASK_DOUBLE);
break;
case ANSWER_TYPE_RANGE:
$type->setInputMask(INPUTMASK_INTEGER);
break;
default:
$type->setInputMask(null);
break;
}
}
$type->save();
$checker = new Checker($_SESSION['SUID']);
$checks = $checker->checkType($type);
if (sizeof($checks) > 0) {
$content .= $displaySysAdmin->displayError(implode("<br/>", $checks));
}
}
/* compile */
$compiler = new Compiler($_SESSION['SUID'], getSurveyVersion($survey));
$mess = $compiler->generateTypes(array($type));
$vars = $survey->getVariableDescriptivesOfType($tyd);
$mess = $compiler->generateVariableDescriptives($vars);
$mess = $compiler->generateGetFills($vars);
$mess = $compiler->generateInlineFields($vars);
/* update last page */
$_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res"));
if ($tyd != '') {
return $displaySysAdmin->showEditType($_SESSION['TYD'], $content);
} else {
return $displaySysAdmin->showSurvey($content);
}
}