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


PHP ilNonEditableValueGUI::setRequired方法代码示例

本文整理汇总了PHP中ilNonEditableValueGUI::setRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP ilNonEditableValueGUI::setRequired方法的具体用法?PHP ilNonEditableValueGUI::setRequired怎么用?PHP ilNonEditableValueGUI::setRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilNonEditableValueGUI的用法示例。


在下文中一共展示了ilNonEditableValueGUI::setRequired方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showCustomFields

 /**
  * Show course defined fields
  *
  * @access protected
  */
 protected function showCustomFields()
 {
     global $ilUser;
     include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
     include_once 'Modules/Course/classes/Export/class.ilCourseUserData.php';
     if (!count($cdf_fields = ilCourseDefinedFieldDefinition::_getFields($this->container->getId()))) {
         return true;
     }
     $cdf = new ilNonEditableValueGUI($this->lng->txt('ps_crs_user_fields'));
     $cdf->setValue($this->lng->txt($this->type . '_ps_cdf_info'));
     $cdf->setRequired(true);
     foreach ($cdf_fields as $field_obj) {
         $course_user_data = new ilCourseUserData($ilUser->getId(), $field_obj->getId());
         switch ($field_obj->getType()) {
             case IL_CDF_TYPE_SELECT:
                 $select = new ilSelectInputGUI($field_obj->getName(), 'cdf[' . $field_obj->getId() . ']');
                 $select->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
                 $select->setOptions($field_obj->prepareSelectBox());
                 if ($field_obj->isRequired()) {
                     $select->setRequired(true);
                 }
                 $cdf->addSubItem($select);
                 break;
             case IL_CDF_TYPE_TEXT:
                 $text = new ilTextInputGUI($field_obj->getName(), 'cdf[' . $field_obj->getId() . ']');
                 $text->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
                 $text->setSize(32);
                 $text->setMaxLength(255);
                 if ($field_obj->isRequired()) {
                     $text->setRequired(true);
                 }
                 $cdf->addSubItem($text);
                 break;
         }
     }
     $this->form->addItem($cdf);
     return true;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:43,代码来源:class.ilRegistrationGUI.php

示例2: addCustomFields

 /**
  * Add custom course fields
  * @param type $form
  * @param type $a_obj_id
  * @param type $a_type
  */
 public static function addCustomFields($form, $a_obj_id, $a_type, $a_mode = 'user')
 {
     global $lng;
     include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
     include_once 'Modules/Course/classes/Export/class.ilCourseUserData.php';
     if (!count($cdf_fields = ilCourseDefinedFieldDefinition::_getFields($a_obj_id))) {
         return $form;
     }
     if ($a_mode == 'user') {
         $cdf = new ilNonEditableValueGUI($lng->txt('ps_' . $a_type . '_user_fields'));
         $cdf->setValue($lng->txt($a_type . '_ps_cdf_info'));
         $cdf->setRequired(true);
     }
     foreach ($cdf_fields as $field_obj) {
         switch ($field_obj->getType()) {
             case IL_CDF_TYPE_SELECT:
                 if ($field_obj->getValueOptions()) {
                     // Show as radio group
                     $option_radios = new ilRadioGroupInputGUI($field_obj->getName(), 'cdf_' . $field_obj->getId());
                     if ($field_obj->isRequired()) {
                         $option_radios->setRequired(true);
                     }
                     $open_answer_indexes = (array) $field_obj->getValueOptions();
                     foreach ($field_obj->getValues() as $key => $val) {
                         $option_radio = new ilRadioOption($val, $field_obj->getId() . '_' . $key);
                         // open answers
                         if (in_array($key, $open_answer_indexes)) {
                             $open_answer = new ilTextInputGUI($lng->txt("form_open_answer"), 'cdf_oa_' . $field_obj->getId() . '_' . $key);
                             $open_answer->setRequired(true);
                             $option_radio->addSubItem($open_answer);
                         }
                         $option_radios->addOption($option_radio);
                     }
                     if ($a_mode == 'user') {
                         $cdf->addSubItem($option_radios);
                     } else {
                         $form->addItem($option_radios);
                     }
                 } else {
                     $select = new ilSelectInputGUI($field_obj->getName(), 'cdf_' . $field_obj->getId());
                     #$select->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
                     $select->setOptions($field_obj->prepareSelectBox());
                     if ($field_obj->isRequired()) {
                         $select->setRequired(true);
                     }
                     if ($a_mode == 'user') {
                         $cdf->addSubItem($select);
                     } else {
                         $form->addItem($select);
                     }
                 }
                 break;
             case IL_CDF_TYPE_TEXT:
                 $text = new ilTextInputGUI($field_obj->getName(), 'cdf_' . $field_obj->getId());
                 #$text->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
                 $text->setSize(32);
                 $text->setMaxLength(255);
                 if ($field_obj->isRequired()) {
                     $text->setRequired(true);
                 }
                 if ($a_mode == 'user') {
                     $cdf->addSubItem($text);
                 } else {
                     $form->addItem($text);
                 }
                 break;
         }
     }
     if ($a_mode == 'user') {
         $form->addItem($cdf);
     }
     return $form;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:79,代码来源:class.ilMemberAgreementGUI.php


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