コード例 #1
0
 /**
  * @param object $group Passed by reference
  * @param mixed $required
  * @param mixed $error
  */
 function startGroup(&$group, $required, $error)
 {
     if (method_exists($group, 'getElementTemplateType')) {
         $html = $this->_elementTemplates[$group->getElementTemplateType()];
     } else {
         $html = $this->_elementTemplates['default'];
     }
     if ($this->_showAdvanced) {
         $advclass = ' advanced';
     } else {
         $advclass = ' advanced hide';
     }
     if (isset($this->_advancedElements[$group->getName()])) {
         $html = str_replace(' {advanced}', $advclass, $html);
         $html = str_replace('{advancedimg}', $this->_advancedHTML, $html);
     } else {
         $html = str_replace(' {advanced}', '', $html);
         $html = str_replace('{advancedimg}', '', $html);
     }
     if (method_exists($group, 'getHelpButton')) {
         $html = str_replace('{help}', $group->getHelpButton(), $html);
     } else {
         $html = str_replace('{help}', '', $html);
     }
     $html = str_replace('{name}', $group->getName(), $html);
     $html = str_replace('{type}', 'fgroup', $html);
     $this->_templates[$group->getName()] = $html;
     // Fix for bug in tableless quickforms that didn't allow you to stop a
     // fieldset before a group of elements.
     // if the element name indicates the end of a fieldset, close the fieldset
     if (in_array($group->getName(), $this->_stopFieldsetElements) && $this->_fieldsetsOpen > 0) {
         $this->_html .= $this->_closeFieldsetTemplate;
         $this->_fieldsetsOpen--;
     }
     parent::startGroup($group, $required, $error);
 }
コード例 #2
0
ファイル: formslib.php プロジェクト: educacionbe/cursos
 /**
  * Create advance group of elements
  *
  * @param object $group Passed by reference
  * @param bool $required if input is required field
  * @param string $error error message to display
  */
 function startGroup(&$group, $required, $error)
 {
     // Make sure the element has an id.
     $group->_generateId();
     if (method_exists($group, 'getElementTemplateType')) {
         $html = $this->_elementTemplates[$group->getElementTemplateType()];
     } else {
         $html = $this->_elementTemplates['default'];
     }
     if (isset($this->_advancedElements[$group->getName()])) {
         $html = str_replace(' {advanced}', ' advanced', $html);
         $html = str_replace('{advancedimg}', $this->_advancedHTML, $html);
     } else {
         $html = str_replace(' {advanced}', '', $html);
         $html = str_replace('{advancedimg}', '', $html);
     }
     if (method_exists($group, 'getHelpButton')) {
         $html = str_replace('{help}', $group->getHelpButton(), $html);
     } else {
         $html = str_replace('{help}', '', $html);
     }
     $html = str_replace('{id}', 'fgroup_' . $group->getAttribute('id'), $html);
     $html = str_replace('{name}', $group->getName(), $html);
     $html = str_replace('{type}', 'fgroup', $html);
     $emptylabel = '';
     if ($group->getLabel() == '') {
         $emptylabel = 'femptylabel';
     }
     $html = str_replace('{emptylabel}', $emptylabel, $html);
     $this->_templates[$group->getName()] = $html;
     // Fix for bug in tableless quickforms that didn't allow you to stop a
     // fieldset before a group of elements.
     // if the element name indicates the end of a fieldset, close the fieldset
     if (in_array($group->getName(), $this->_stopFieldsetElements) && $this->_fieldsetsOpen > 0) {
         $this->_html .= $this->_closeFieldsetTemplate;
         $this->_fieldsetsOpen--;
     }
     parent::startGroup($group, $required, $error);
 }
コード例 #3
0
ファイル: formslib.php プロジェクト: dg711/moodle
 /**
  * Create advance group of elements
  *
  * @param MoodleQuickForm_group $group Passed by reference
  * @param bool $required if input is required field
  * @param string $error error message to display
  */
 function startGroup(&$group, $required, $error)
 {
     global $OUTPUT;
     // Make sure the element has an id.
     $group->_generateId();
     // Prepend 'fgroup_' to the ID we generated.
     $groupid = 'fgroup_' . $group->getAttribute('id');
     // Update the ID.
     $group->updateAttributes(array('id' => $groupid));
     $advanced = isset($this->_advancedElements[$group->getName()]);
     $html = $OUTPUT->mform_element($group, $required, $advanced, $error, false);
     $fromtemplate = !empty($html);
     if (!$fromtemplate) {
         if (method_exists($group, 'getElementTemplateType')) {
             $html = $this->_elementTemplates[$group->getElementTemplateType()];
         } else {
             $html = $this->_elementTemplates['default'];
         }
         if (isset($this->_advancedElements[$group->getName()])) {
             $html = str_replace(' {advanced}', ' advanced', $html);
             $html = str_replace('{advancedimg}', $this->_advancedHTML, $html);
         } else {
             $html = str_replace(' {advanced}', '', $html);
             $html = str_replace('{advancedimg}', '', $html);
         }
         if (method_exists($group, 'getHelpButton')) {
             $html = str_replace('{help}', $group->getHelpButton(), $html);
         } else {
             $html = str_replace('{help}', '', $html);
         }
         $html = str_replace('{id}', $group->getAttribute('id'), $html);
         $html = str_replace('{name}', $group->getName(), $html);
         $html = str_replace('{typeclass}', 'fgroup', $html);
         $html = str_replace('{type}', 'group', $html);
         $html = str_replace('{class}', $group->getAttribute('class'), $html);
         $emptylabel = '';
         if ($group->getLabel() == '') {
             $emptylabel = 'femptylabel';
         }
         $html = str_replace('{emptylabel}', $emptylabel, $html);
     }
     $this->_templates[$group->getName()] = $html;
     // Fix for bug in tableless quickforms that didn't allow you to stop a
     // fieldset before a group of elements.
     // if the element name indicates the end of a fieldset, close the fieldset
     if (in_array($group->getName(), $this->_stopFieldsetElements) && $this->_fieldsetsOpen > 0) {
         $this->_html .= $this->_closeFieldsetTemplate;
         $this->_fieldsetsOpen--;
     }
     if (!$fromtemplate) {
         parent::startGroup($group, $required, $error);
     } else {
         $this->_html .= $html;
     }
 }