text
*
* @param string $href the link url.
* @param string $title the link title.
* @param string $misc other params.
* @param string $newline
* @static
* @access public
* @return string
*/
static public function a($href = '', $title = '', $target = "_self", $misc = '', $newline = true)
{
if(empty($target)) $target = '_self';
if($target != '_self') $misc .= " target='$target'";
return parent::a($href, $title, $misc, $newline);
}
/**
* 生成input输入标签。
* Create tags like ""
*
* @param string $name the name of the text input tag.
* @param string $value the default value.
* @param string $attrib other attribs.
* @static
* @access public
* @return string
*/
static public function input($name, $value = "", $attrib = "", $autocomplete = false)
{
$id = "id='$name'";
if(strpos($attrib, 'id=') !== false) $id = '';
$value = str_replace("'", ''', $value);
$autocomplete = $autocomplete ? 'autocomplete="on"' : 'autocomplete="off"';
return "\n";
}
/**
* 生成多选按钮。
* Create tags like ""
*
* @param string $name the name of the checkbox tag.
* @param array $options the array to create checkbox tag from.
* @param string $checked the value to checked by default, can be item1,item2
* @param string $attrib other attribs.
* @param string $type inline or block
* @static
* @access public
* @return string
*/
static public function checkbox($name, $options, $checked = "", $attrib = "", $type = 'block')
{
$options = (array)($options);
if(!is_array($options) or empty($options)) return false;
if(is_array($checked)) $checked = implode(',', $checked);
$string = '';
$checked = ",$checked,";
$isBlock = $type == 'block';
foreach($options as $key => $value)
{
$key = str_replace('item', '', $key);
if($isBlock) $string .= "
";
else $string .= "
";
$string .= "
';
}
return $string;
}
/**
* 创建提交按钮。
* Create submit button.
*
* @param string $label the label of the button
* @param string $class the class of the button
* @param string $misc other params
* @static
* @access public
* @return string the submit button tag.
*/
public static function submitButton($label = '', $misc = '', $class = 'btn btn-wide btn-primary')
{
return parent::submitButton($label, $class, $misc);
}
public static function commonButton($label = '', $misc = '', $class = 'btn', $icon = '')
{
return parent::commonButton($label, $class, $misc, $icon);
}
public static function linkButton($label = '', $link = '', $target = 'self', $misc = '', $class = 'btn')
{
return parent::linkButton($label, $link, $class, $misc, $target);
}
/**
* 创建全选checkbox。
* Create select buttons include 'selectAll' and 'selectReverse'.
*
* @param string $scope the scope of select reverse.
* @param bool $asGroup
* @param string $appendClass
* @static
* @access public
* @return string
*/
static public function selectButton($scope = "", $asGroup = true, $appendClass = 'btn')
{
global $lang;
return "
";
}
/**
* 生成select标签。
* Create tags like "
"
*
* @param string $name the name of the select tag.
* @param array $options the array to create select tag from.
* @param string $selectedItems the item(s) to be selected, can like item1,item2.
* @param string $attrib other params such as multiple, size and style.
* @param string $append adjust if add options[$selectedItems].
* @static
* @access public
* @return string
*/
static public function select($name = '', $options = array(), $selectedItems = "", $attrib = "", $append = false)
{
$options = (array)($options);
if($append and !isset($options[$selectedItems])) $options[$selectedItems] = $selectedItems;
if(!is_array($options) or empty($options)) return false;
/* The begin. */
$id = $name;
if(strpos($name, '[') !== false) $id = trim(str_replace(']', '', str_replace('[', '', $name)));
$id = "id='{$id}'";
if(strpos($attrib, 'id=') !== false) $id = '';
global $config;
$string = '';
if(count($options) >= $config->maxCount or isset($config->moreLinks[$name]))
{
if(strpos($attrib, 'chosen') !== false) $attrib = str_replace('chosen', 'picker-select', $attrib);
if(isset($config->moreLinks[$name]))
{
$link = $config->moreLinks[$name];
$attrib .= " data-pickertype='remote' data-pickerremote='" . $link . "'";
}
$convertedPinYin = array();
if(count($options) <= $config->maxCount) $convertedPinYin = (empty($config->isINT) and class_exists('common')) ? common::convert2Pinyin($options) : array();
}
else
{
$convertedPinYin = (empty($config->isINT) and class_exists('common')) ? common::convert2Pinyin($options) : array();
}
$string .= "
\n";
}
/**
* Create input tag that type is number.
*
* @param string $name
* @param string $value
* @param string $attrib
* @static
* @access public
* @return string
*/
static public function number($name, $value = '', $attrib = '')
{
$id = "id='$name'";
if(strpos($attrib, 'id=') !== false) $id = '';
$value = str_replace("'", ''', $value);
return "
\n";
}
}
/**
* JS类。
* JS class.
*
* @package front
*/
class js extends baseJS
{
}
/**
* css类。
* css class.
*
* @package front
*/
class css extends baseCSS
{
}