本文整理汇总了PHP中Zend_Form_Element_Xhtml类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Xhtml类的具体用法?PHP Zend_Form_Element_Xhtml怎么用?PHP Zend_Form_Element_Xhtml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Form_Element_Xhtml类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadDefaultDecorators
public function loadDefaultDecorators()
{
parent::loadDefaultDecorators();
$this->removeDecorator('Label');
$this->removeDecorator('HtmlTag');
$this->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'spanImg'));
}
示例2: __construct
public function __construct($spec, $options = array())
{
$options = array_merge($options, array('disableLoadDefaultDecorators' => true));
parent::__construct($spec, $options);
$this->_decorator = new Monkeys_Form_Decorator_Composite();
$this->addDecorator($this->_decorator);
}
示例3: __construct
/**
* constructor
* @param $spec
* @param $options
*/
public function __construct($spec, $options = null)
{
$objLoader = new PluginLoader();
$objLoader->setPluginLoader($this->getPluginLoader(PluginLoader::TYPE_FORM_DECORATOR));
$objLoader->setPluginType(PluginLoader::TYPE_FORM_DECORATOR);
$this->setPluginLoader($objLoader, PluginLoader::TYPE_FORM_DECORATOR);
parent::__construct($spec, $options);
}
示例4: isValid
/**
* Override isValid()
*
* Ensure that validation error messages mask password value.
*
* @param string $value
* @param mixed $context
* @return bool
*/
public function isValid($value, $context = null)
{
foreach ($this->getValidators() as $validator) {
if ($validator instanceof Zend_Validate_Abstract) {
$validator->setObscureValue(true);
}
}
return parent::isValid($value, $context);
}
示例5: __construct
public function __construct($spec, $options = null)
{
$localOptions = array('filters' => array('StringTrim'), 'label' => 'Date and time', 'validators' => array(new \Tillikum\Validate\FormDatetime()));
if (isset($options)) {
$options = array_replace_recursive($localOptions, $options);
} else {
$options = $localOptions;
}
parent::__construct($spec, $options);
}
示例6: __construct
public function __construct($spec, $options = null)
{
if (is_string($spec) && (null !== $options && is_string($options))) {
$options = array('label' => $options);
}
if (!isset($options['ignore'])) {
$options['ignore'] = true;
}
parent::__construct($spec, $options);
}
示例7: __construct
public function __construct($spec, $options = null)
{
$localOptions = array('filters' => array('StringTrim'));
if (isset($options)) {
$options = array_replace_recursive($localOptions, $options);
} else {
$options = $localOptions;
}
parent::__construct($spec, $options);
}
示例8: getLabel
/**
* Return label
*
* If no label is present, returns the currently set name.
*
* If a translator is present, returns the translated label.
*
* @return string
*/
public function getLabel()
{
$value = parent::getLabel();
if (null === $value) {
$value = $this->getName();
}
if (null !== ($translator = $this->getTranslator())) {
return $translator->translate($value);
}
return $value;
}
示例9: getValue
public function getValue()
{
if (is_array($this->_value)) {
$value = $this->_value['year'] . '-' . $this->_value['month'] . '-' . $this->_value['day'];
if ($value == '--') {
$value = null;
}
$this->setValue($value);
}
return parent::getValue();
}
示例10: __construct
/**
* Определяем массив ролей и уровней доступа и дергаем родительский конструктор
*
* @param unknown_type $spec
* @param unknown_type $options
*/
public function __construct($spec, $options = null)
{
/**
* @see Phorm_User
*/
require_once "Phorm/User.php";
$User = new Phorm_User();
$options['roles'] = $User->getRolesListAsPairs();
$options['levels'] = $User->getAccessLevelsAsPairs();
parent::__construct($spec, $options);
}
示例11: isRequired
public function isRequired()
{
$elements = $this->getElements();
if (empty($elements)) {
return parent::isRequired();
}
foreach ($elements as $el) {
if ($el->isRequired()) {
return true;
}
}
return false;
}
示例12: __call
/**
* Overloading: allow rendering specific decorators
*
* Call renderDecoratorName() to render a specific decorator.
*
* @param string $method
* @param array $args
* @return \MUtil_Html_HtmlElement or at least something that implements the \MUtil_Html_HtmlInterface interface
* @throws \Zend_Form_Exception for invalid decorator or invalid method call
*/
public function __call($method, $args)
{
if ('render' == substr($method, 0, 6)) {
return parent::__call($method, $args);
}
$elem = \MUtil_Html::createArray($method, $args);
$value = $this->getValue();
if (!$value instanceof \MUtil_Html_ElementInterface) {
$value = new \MUtil_Html_Sequence();
}
$value->append($elem);
$this->setValue($value);
return $elem;
}
示例13: isValid
public function isValid($value, $context = null)
{
if (!is_array($value)) {
return false;
}
$result = checkdate((int) $value['month'], (int) $value['day'], (int) $value['year']);
if ($result == false) {
$value = null;
}
if ($this->max_year && (int) $value['year'] > $this->max_year || $this->min_year && (int) $value['year'] < $this->min_year) {
$value = null;
}
return parent::isValid($value, $context);
}
示例14: isValid
/**
* Validate upload
*
* @param string $value
* @param mixed $context
* @return bool
*/
public function isValid($value, $context = null)
{
if (isset($_FILES[$this->getName()])) {
$value = $_FILES[$this->getName()]['tmp_name'];
$context = $_FILES[$this->getName()];
$context['destination'] = $this->_destination;
}
$isValid = parent::isValid($value, $context);
// If it's valid, we move the file to its final destination
if ($isValid && isset($this->_destination)) {
$destination = is_dir($this->_destination) ? $this->_destination . '/' . $context['name'] : $this->_destination;
move_uploaded_file($value, $destination);
}
return $isValid;
}
示例15: setValue
public function setValue($value)
{
if (is_array($value)) {
if (isset($value['value'])) {
parent::setValue($value['value']);
}
if (isset($value['overwrite'])) {
if ($value['overwrite'] == '1' || $value['overwrite'] === true) {
$this->overwrite = true;
} else {
$this->overwrite = false;
}
}
} else {
parent::setValue($value);
}
}