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


PHP Checker::checkTypeName方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:80,代码来源:sysadmin.php


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