Пример #1
0
 function __timeInput($box, $fieldName, $value, $format = null)
 {
     global $wp_locale;
     $date = !empty($value) ? $value : time();
     $hour = mysql2date('H', $date);
     $mins = mysql2date('i', $date);
     $months = '';
     echo csml::tag('input[type="text"]', array('name' => $fieldName . "[hour]", 'size' => "2", 'value' => $hour));
     echo " : ";
     echo csml::tag('input[type="text"]', array('name' => $fieldName . "[mins]", 'size' => "2", 'value' => $mins));
     return;
 }
Пример #2
0
Файл: html.php Проект: soska/dte
 /**
  * Define Tag elements using CSS-ish selectors
  *
  * @param string $selector 
  * @param string $comment 
  * @return void
  * @author Armando Sosa
  */
 function tag($selector = "div", $params = '', $format = null, $comment = '')
 {
     return csml::tag($selector, $params, $format, $comment);
 }
Пример #3
0
Файл: csml.php Проект: soska/dte
function t($selector = "div", $params = '', $format = BREAK_AND_TABS, $comment = '')
{
    echo csml::tag($selector, $params, $format, $comment);
}
Пример #4
0
 function input($name, $options = array())
 {
     $fieldName = $this->panel['name'] . "_opts" . "[{$name}]";
     $fieldAdjacentFileName = $this->panel['name'] . "_opts" . "[{$name}__file]";
     $options = set_merge(array('label' => $name, 'hint' => '', 'type' => 'text', 'options' => false, 'attributes' => array('id' => $name, 'name' => $fieldName, 'class' => false), 'row' => true, 'preview' => false, 'enclosing_tag' => "div.input"), $options);
     if (isset($this->values[$name])) {
         $options['attributes']['value'] = $this->values[$name];
     } else {
         $options['attributes']['value'] = '';
     }
     $options['attributes']['type'] = $options['type'];
     switch ($options['type']) {
         case 'text':
         case 'input':
         case 'hidden':
             $input = csml::tag("input/", $options['attributes']);
             break;
         case 'file':
             $input = csml::tag("input/", array('type' => 'hidden', 'value' => $options['attributes']['value'], 'name' => $options['attributes']['name'])) . "<br/>";
             $input .= csml::tag("input/", array('type' => 'file', 'name' => $fieldAdjacentFileName));
             break;
         case 'textarea':
             $value = $options['attributes']['value'];
             $options['attributes']['value'] = false;
             $input = csml::entag($value, 'textarea', $options['attributes']);
             break;
         case 'select':
             $value = $options['attributes']['value'];
             $options['attributes']['value'] = false;
             $input = csml::tag('select', $options['attributes']);
             $options['options'] = (array) $options['options'];
             foreach ($options['options'] as $v => $l) {
                 $opattr = array('value' => $v);
                 if ($value == $v) {
                     $opattr['selected'] = 'selected';
                 }
                 $input .= csml::entag($l, 'option', $opattr);
             }
             $input .= csml::tag('/select');
             break;
         case 'checkbox':
             $options['attributes']['checked'] = $options['attributes']['value'] === "on" ? 'checked' : false;
             $options['attributes']['value'] = false;
             $options['legend'] = isset($options['legend']) ? $options['legend'] : $options['label'];
             $input = csml::tag("input/", $options['attributes']);
             if ($options['legend']) {
                 $input = csml::entag($input . " " . $options['legend'], 'label');
             }
             break;
         default:
             $input = csml::tag("input/", $options['attributes']);
             break;
     }
     // image preview
     if ($options['type'] == 'file') {
         if ($options['preview'] && !empty($options['attributes']['value'])) {
             $img = csml::tag('img/', array('src' => $options['attributes']['value'], 'max-height' => '120'));
             $input .= csml::entag($img, 'p.image_preview');
         }
         $options['hint'] .= "<br/>" . $options['attributes']['value'];
     }
     if ($options['row']) {
         $input = $this->row($options, $input, $options['hint']);
     } else {
         if ($options['label']) {
             $input = "<label>{$options['label']} {$input} </label>";
         }
         if (is_string($options['enclosing_tag'])) {
             $input = csml::entag($input, $options['enclosing_tag']);
         }
     }
     echo $input;
 }