コード例 #1
0
    $required = "";
    $label = "";
    if (!empty($__pd['fields'][$field]['required'])) {
        $required = '<span style="color: red" title="$_str_required">*</span>';
    }
    if (isset($__pd['fields'][$field]['label']) && $__pd['fields'][$field]['label'] != '') {
        $label = $__pd['fields'][$field]['label'];
    } else {
        $label = str_replace('_', ' ', $field);
        $label = ucwords($label);
    }
    // The value comes either from what was defined in the field definition, or from a previous form submit, or
    // just an empty string.
    $val = isset($__pd['game'][$field]) ? $__pd['game'][$field] : (isset($opts['value']) ? $opts['value'] : '');
    $html .= "<tr><td>{$label} {$required}</td><td>";
    $html .= create_html_element($field, $opts, $val);
    if ($field == 'fen') {
        $html .= "<button onclick=\"open_FEN_builder();\">{$_str_setupboard}</button>";
    }
    $html .= "</td></tr>";
}
echo $html;
// Works out what html element to generate based on the options provided.
function create_html_element($field, $opts, $value)
{
    $html = "";
    if (!isset($opts['render_type'])) {
        $opts['render_type'] = 'text';
    }
    switch ($opts['render_type']) {
        case 'description':
コード例 #2
0
<?php 
$html = '';
foreach ($__pd['fields'] as $field => $opts) {
    $required = "";
    $label = "";
    if (!empty($__pd['fields'][$field]['required'])) {
        $required = '<span style="color: red" title="' . _T('IDS_Form_Message_FIELDREQUIRED_', $config) . '">*</span>';
    }
    if (isset($__pd['fields'][$field]['label']) && $__pd['fields'][$field]['label'] != '') {
        $label = $__pd['fields'][$field]['label'];
    } else {
        $label = str_replace('_', ' ', $field);
        $label = ucwords($label);
    }
    $html .= "<tr><td>{$label} {$required}</td><td>";
    $html .= create_html_element($field, $opts, $__pd['tournament'][$field]);
    $html .= "</tr>";
}
echo $html;
// Works out what html element to generate based on the options provided.
function create_html_element($field, $opts, $value)
{
    $html = "";
    if (!isset($opts['render_type'])) {
        $opts['render_type'] = 'text';
    }
    switch ($opts['render_type']) {
        case 'description':
            $html = '<textarea name="' . $field . '"';
            if (isset($opts['id'])) {
                $html .= ' id="' . $opts['id'] . '"';
コード例 #3
0
ファイル: base.php プロジェクト: rolandinsh/Pegasus-Theme
/**
 * Handles generating the link tags configured for this theme.
 *
 * @return string
 * @author Jared Lang
 **/
function header_links()
{
    $links = Config::$links;
    $links_html = array();
    $defaults = array();
    foreach ($links as $link) {
        $link = array_merge($defaults, $link);
        $links_html[] = create_html_element('link', $link, null, True);
    }
    $links_html = implode("\n", $links_html);
    return $links_html;
}