Example #1
0
    function formhtml($obj = null, $event = null, $form = '', $overlimitdisable = false, $type = 'I')
    {
        global $amp, $xhtml;
        parent::formhtml($obj, $event, $form, $overlimitdisable);
        $fieldType = DtrModel::getInstance('Fieldtype', 'DtregisterModel');
        $fieldTypes = $fieldType->getTypes();
        require_once JPATH_SITE . "/components/com_dtregister/views/field/view.html.php";
        $fieldView = new DtregisterViewField(array());
        if (count($fieldView->_path['template']) > 0) {
            foreach ($fieldView->_path['template'] as $path) {
                if (file_exists($path)) {
                    $basepath = $path;
                    break;
                }
            }
        }
        $file = $basepath . "default.php";
        $this->requiredHtml = "";
        if ($this->required) {
            $this->label = $this->label . " <span class='dtrequired'>&nbsp;&nbsp;*&nbsp;&nbsp;</span> ";
            $this->requiredHtml = "<span class='dtrequired'>&nbsp;&nbsp;*&nbsp;&nbsp;</span>";
            $this->required = true;
        }
        $requiredClass = $this->required ? 'required' : '';
        $tpl = file_get_contents($file);
        $constants = array('[label]', '[value]', '[description]');
        $description = trim($this->description) != "" ? JDTHTML::tooltip($this->description, '', 'tooltip.png', '', '') : '';
        $value = isset($obj['fields'][$this->id]) ? $obj['fields'][$this->id] : '';
        $maxlength = $this->maxlength != 0 && $this->maxlength != "" ? "maxlength='" . $this->maxlength . "'" : '';
        $requiredClass = $this->required ? 'required email' : 'email';
        $readonly = "";
        global $cbviewonly, $cb_integrated, $map_cb_fields;
        $my =& JFactory::getUser();
        if ($value != "" && $cb_integrated > 0 && $cbviewonly == 1 && $my->id && isset($map_cb_fields[$this->id])) {
            $readonly = "readonly='readonly'";
        }
        if (isset($obj['groupMemberId']) && $obj['groupMemberId'] > 0) {
            $readonly = "";
        }
        $fieldhtml = "<input type='text' id='Field" . $this->id . "' class='inputbox " . $requiredClass . "' " . $readonly . " size='{$this->field_size}' {$maxlength} name='Field[" . $this->id . "]' value='{$value}' />";
        $replace = array($this->label, $fieldhtml, $description);
        $html = "";
        $html .= str_replace($constants, $replace, $tpl);
        $replace = array(JText::_("DT_CONFIRM_EMAIL") . $this->requiredHtml, "<input type='text' id='ConfirmField" . $this->id . "' class='inputbox " . $requiredClass . "' size='{$this->field_size}' {$maxlength} name='ConfirmField[" . $this->id . "]' value='' />", '');
        global $mainframe;
        $this->emailConfirmation = false;
        if (!$mainframe->isAdmin() && $this->confirmation_field) {
            $html .= str_replace($constants, $replace, $tpl);
            $this->emailConfirmation = true;
        }
        // confirmemail
        $document =& JFactory::getDocument();
        ob_start();
        $dup_check = "";
        if (isset($this->duplicate_check) && !$this->duplicate_check) {
            $dup_check = "&dup_check=true";
        }
        $member_check = "";
        if ($type == 'M') {
            $member_check = "&member_check=true";
        }
        ?>

          DTjQuery(function(){

                DTjQuery(document.<?php 
        echo $form;
        ?>
).validate({

                        success: function(label) {

                            label.addClass("success");

                        }

                });
              
             DTjQuery('#Field<?php 
        echo $this->id;
        ?>
').rules('add',{remote: "<?php 
        echo JRoute::_('index.php?option=com_dtregister&controller=validate&task=email&no_html=1&eventId=' . $event->slabId . $dup_check . $member_check, $xhtml);
        ?>
" });
      <?php 
        if ($this->emailConfirmation && $form != 'adminForm') {
            ?>
              DTjQuery('#ConfirmField<?php 
            echo $this->id;
            ?>
').rules('add',{equalTo: "#Field<?php 
            echo $this->id;
            ?>
"
     
});

             <?php 
        }
        ?>
  

          })

            <?php 
        $js = ob_get_clean();
        $document->addScriptDeclaration($js);
        return $html;
    }