예제 #1
0
    private function signupFieldHTML(waContactField $f, $params, $error = '')
    {
        $data = waRequest::post('data');
        // get value
        if (isset($params['parent'])) {
            $parent_value = $data[$params['parent']];
            $params['value'] = isset($parent_value[$params['id']]) ? $parent_value[$params['id']] : '';
        } else {
            $params['value'] = isset($data[$params['id']]) ? $data[$params['id']] : '';
        }
        $config = wa()->getAuthConfig();
        if (!empty($config['fields'][$f->getId()]['caption'])) {
            $name = htmlspecialchars($config['fields'][$f->getId()]['caption']);
        } else {
            $name = $f->getName(null, true);
            if (isset($params['ext'])) {
                $exts = $f->getParameter('ext');
                if (isset($exts[$params['ext']])) {
                    $name .= ' (' . _ws($exts[$params['ext']]) . ')';
                } else {
                    $name .= ' (' . $params['ext'] . ')';
                }
            }
        }
        $params['namespace'] = 'data';
        $is_multi = $f->isMulti();
        if ($is_multi) {
            $f->setParameter('multi', false);
        }
        $attrs = $error !== false ? 'class="wa-error"' : '';
        if (!empty($config['fields'][$f->getId()]['placeholder'])) {
            $attrs .= ' placeholder="' . htmlspecialchars($config['fields'][$f->getId()]['placeholder']) . '"';
        } elseif (!empty($params['placeholder'])) {
            $attrs .= ' placeholder="' . htmlspecialchars($params['placeholder']) . '"';
        }
        if ($f instanceof waContactHiddenField) {
            $html = $f->getHTML($params, $attrs);
        } else {
            $html = '<div class="wa-field wa-field-' . $f->getId() . '">
					<div class="wa-name">' . $name . '</div>
					<div class="wa-value">' . $f->getHTML($params, $attrs);
            if ($error) {
                $html .= '<em class="wa-error-msg">' . $error . '</em>';
            }
            $html .= '</div></div>';
        }
        if ($is_multi) {
            $f->setParameter('multi', $is_multi);
        }
        return $html;
    }
예제 #2
0
 private function signupFieldHTML(waContactField $f, $params, $error = '')
 {
     $data = waRequest::post('data');
     // get value
     if (isset($params['parent'])) {
         $parent_value = $data[$params['parent']];
         $params['value'] = $parent_value[$params['id']];
     } else {
         $params['value'] = isset($data[$params['id']]) ? $data[$params['id']] : '';
     }
     $name = $f->getName();
     if (isset($params['ext'])) {
         $exts = $f->getParameter('ext');
         if (isset($exts[$params['ext']])) {
             $name .= ' (' . _ws($exts[$params['ext']]) . ')';
         } else {
             $name .= ' (' . $params['ext'] . ')';
         }
     }
     $params['namespace'] = 'data';
     if ($f->isMulti()) {
         $f->setParameter('multi', false);
     }
     $html = '<div class="wa-field">
             <div class="wa-name">' . $name . '</div>
             <div class="wa-value">' . $f->getHTML($params, $error !== false ? 'class="wa-error"' : '');
     if ($error) {
         $html .= '<em class="wa-error-msg">' . $error . '</em>';
     }
     $html .= '</div></div>';
     return $html;
 }