本文整理汇总了PHP中Zend_Form_Element::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element::getValue方法的具体用法?PHP Zend_Form_Element::getValue怎么用?PHP Zend_Form_Element::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element
的用法示例。
在下文中一共展示了Zend_Form_Element::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: aElement
/**
* Render element
*
* @param Zend_Form_Element $element
* @return string
*/
public function aElement(Zend_Form_Element $element)
{
$viewClasses = array($element->getAttrib('class'));
if ($element->isRequired()) {
if (!$element->getAttrib('title')) {
$element->setAttrib('title', 'Field is required');
}
$viewClasses[] = 'aForm-field-required';
}
if ($element->getValidators()) {
$viewClasses[] = 'aForm-field-validate';
}
if ($element->hasErrors()) {
$viewClasses[] = 'aForm-field-invalid';
} elseif ($element->getValue() || !$element->isRequired()) {
$viewClasses[] = 'aForm-field-valid';
}
if ($element->getValidators()) {
$viewClasses[] = 'aForm-field-validate';
}
$element->setAttrib('class', implode(' ', $viewClasses));
$options = null;
$separator = null;
if ($element instanceof Zend_Form_Element_Multi) {
$options = $element->getMultiOptions();
$separator = $element->getSeparator();
}
return $this->view->{$element->helper}($element->getName(), $element->getValue(), $element->getAttribs(), $options, $separator);
}
示例2: isValid
/**
* @param mixed $value
* @return booleans
*/
public function isValid($value)
{
$db = Zend_Db_Table::getDefaultAdapter();
$sql = 'SELECT
m.id
FROM
meeting m LEFT JOIN event e ON (m.id_event = e.id)
WHERE
m.ghost = false
AND (e.latest = true OR (e.latest IS NULL AND m.id_meeting_type = 6))
AND m.id_meeting_type IN (3,4,6)
AND
(
(' . $db->quoteInto('m.meeting_at >= ?', $this->_objectEventAt->getValue()) . ' AND ' . $db->quoteInto('m.meeting_at + (m.length * interval \'1 minute\') <= timestamp ? + interval \'' . $this->_objectLength->getValue() . ' minutes\'', $this->_objectEventAt->getValue()) . ')
OR (' . $db->quoteInto('m.meeting_at <= ?', $this->_objectEventAt->getValue()) . ' AND ' . $db->quoteInto('m.meeting_at >= timestamp ?', $this->_objectEventAt->getValue()) . ')
OR (' . $db->quoteInto('m.meeting_at <= ?', $this->_objectEventAt->getValue()) . ' AND ' . $db->quoteInto('m.meeting_at + (m.length * interval \'1 minute\') >= timestamp ? + interval \'' . $this->_objectLength->getValue() . ' minutes\'', $this->_objectEventAt->getValue()) . ')
OR (' . $db->quoteInto('m.meeting_at < timestamp ? + interval \'' . $this->_objectLength->getValue() . ' minutes\'', $this->_objectEventAt->getValue()) . ' AND ' . $db->quoteInto('m.meeting_at + (m.length * interval \'1 minute\') >= timestamp ? + interval \'' . $this->_objectLength->getValue() . ' minutes\'', $this->_objectEventAt->getValue()) . ')
)
AND ' . $db->quoteInto('m.id_user = ?', Zend_Auth::getInstance()->getIdentity()->id) . '
AND ' . $db->quoteInto('m.id_branch = ?', Zend_Auth::getInstance()->getIdentity()->id_branch);
if ($this->_nextEvent !== false) {
$sql .= ' AND ' . $db->quoteInto('m.id_event <> ?', $this->_nextEvent);
}
$rows = $db->query($sql);
if ($rows->rowCount() > 0) {
$this->_error(self::VISIT_EXISTS);
return false;
} else {
return true;
}
}
示例3: isValid
/**
* @param mixed $value
* @return booleans
*/
public function isValid($value)
{
if (count($this->_object->getValue()) >= count($this->_object->getMultiOptions())) {
return true;
} else {
$this->_error(self::ALL_FIELDS_NOT_CHECKED);
return false;
}
}
示例4: isValid
/**
* Overrides isValid() from Zend_Validate_Interface
*
* @param string $value
* @access public
* @return bool
*/
public function isValid($value)
{
if (NULL === $this->_element) {
require_once 'Zend/Exception.php';
throw new Zend_Exception('You must add a Zend_Form_Element to the SameAs validator prior to calling the isValid() method');
}
if ($value != $this->_element->getValue()) {
$this->_error(self::NOT_THE_SAME);
return FALSE;
}
return TRUE;
}
示例5: getValue
public function getValue($name = '')
{
$value = parent::getValue();
if ($name) {
$value = isset($value[$name]) ? $value[$name] : '';
}
return $value;
}
示例6: getValue
/**
* Get value
*
* If element type is one of the button types, returns the label.
*
* @param \Zend_Form_Element $element
*
* @return string|null
*/
public function getValue($element)
{
if (!$element instanceof \Zend_Form_Element) {
return null;
}
foreach ($this->_buttonTypes as $type) {
if ($element instanceof $type) {
if (stristr($type, 'submit')) {
$element->content = $element->getLabel();
return $element->getValue();
}
if (stristr($type, 'button')) {
$element->content = $element->getLabel();
return $element->getValue();
}
return $element->getLabel();
}
}
return $element->getValue();
}
示例7: getValue
public function getValue()
{
$valueFiltered = parent::getValue();
$tmp = array();
if (!empty($valueFiltered)) {
foreach ($valueFiltered as $value) {
$_from = preg_match('/^\\d{4}-\\d{2}-\\d{2}$/', $value['from']) ? $value['from'] : '';
$_to = preg_match('/^\\d{4}-\\d{2}-\\d{2}$/', $value['to']) || empty($value['to']) ? $value['to'] : $_from;
if (!empty($_from)) {
array_push($tmp, array('from' => $_from, 'to' => $_to));
}
}
}
return $tmp;
}
示例8: getValue
public function getValue($toString = true)
{
$value = parent::getValue();
if (is_array($value)) {
$xml = new SimpleXMLElement('<elementData />');
foreach ($value as $k => $v) {
$xml->{$k} = $v;
}
} else {
$xml = simplexml_load_string($value);
}
if (is_object($xml)) {
if ($toString) {
return $xml->asXML();
} else {
return $xml;
}
} else {
return null;
}
}
示例9: testPassingConfigObjectToConstructorSetsObjectState
public function testPassingConfigObjectToConstructorSetsObjectState()
{
$config = new Zend_Config($this->getOptions());
$element = new Zend_Form_Element($config);
$this->assertEquals('changed', $element->getName());
$this->assertEquals('foo', $element->getValue());
$this->assertEquals('bar', $element->getLabel());
$this->assertEquals(50, $element->getOrder());
$this->assertFalse($element->isRequired());
$this->assertEquals('bar', $element->foo);
$this->assertEquals('bat', $element->baz);
}
示例10: prepareConfigElement
/**
* Remove cookie.jar if configs change and convert form password to password element
* @param string $section
* @param string $namespace
* @param unknown_type $key
* @param Zend_Form_Element $element
* @param Zend_Form $form
* @param Zend_Controller_Action $controller
*/
public function prepareConfigElement($section, $namespace, $key, Zend_Form_Element $element, Zend_Form $form, Zend_Controller_Action $controller)
{
// nothing to do if this isn't the right section
if ($namespace != $this->getId()) {
return;
}
// remove cookie.jar if somethings has value
if (!$form->isErrors() && !is_null($element->getValue())) {
$this->clearLastCheck();
}
}
示例11: getValue
/**
* Get value
*
* If element type is one of the button types, returns the label.
*
* @param Zend_Form_Element $element
* @return string|null
*/
public function getValue($element)
{
if (!$element instanceof Zend_Form_Element) {
return null;
}
$type = $element->getType();
if (in_array($type, $this->_buttonTypes)) {
return $element->getLabel();
}
return $element->getValue();
}
示例12: prepareConfigElement
/**
* Remove cookie.jar if configs change and convert form password to password element
* @param string $section
* @param string $namespace
* @param unknown_type $key
* @param Zend_Form_Element $element
* @param Zend_Form $form
* @param Zend_Controller_Action $controller
*/
public function prepareConfigElement($section, $namespace, $key, Zend_Form_Element $element, Zend_Form $form, Zend_Controller_Action $controller)
{
// nothing to do if this isn't the right section
if ($namespace != $this->getId()) {
return;
}
switch ($key) {
// i have to convert it to a password element
case 'plugins_megavideo_premium_password':
$password = $form->createElement('password', 'plugins_megavideo_premium_password', array('label' => $element->getLabel(), 'description' => $element->getDescription(), 'renderPassword' => true));
$form->plugins_megavideo_premium_password = $password;
break;
}
// remove cookie.jar if somethings has value
if (!$form->isErrors() && !is_null($element->getValue()) && file_exists(APPLICATION_PATH . '/../data/megavideo/cookie.jar')) {
if (@(!unlink(APPLICATION_PATH . '/../data/megavideo/cookie.jar'))) {
X_Debug::e("Error removing cookie.jar");
}
}
}
示例13: getValue
/**
* Get value
*
* If element type is one of the button types, returns the label.
*
* @param Zend_Form_Element $element
* @return string|null
*/
public function getValue($element)
{
if (!$element instanceof Zend_Form_Element) {
return null;
}
foreach ($this->_buttonTypes as $type) {
if ($element instanceof $type) {
return $element->getLabel();
}
}
return $element->getValue();
}
示例14: getInputHTML
/**
* Gets form element html
*
* @param Zend_Form_Element $element
* @return string
*/
protected function getInputHTML($element)
{
$helper = $element->helper;
$elBelongsTo = $element->getBelongsTo();
if (!empty($this->belongsTo)) {
$name = $this->mergeBelongsTo($this->belongsTo, $element->getBelongsTo());
$name .= '[' . $element->getName() . ']';
} else {
if (!empty($elBelongsTo)) {
$name = $this->mergeBelongsTo($elBelongsTo, $element->getName());
} else {
$name = $element->getName();
}
}
$value = $element->getValue();
//echo 'Name:'.$name.' | Class:'. get_class($element).' | Helper:'.$helper.'['.$value.']'.'<br/>';
return $element->getView()->{$helper}($name, $value, $element->getAttribs(), $element->options);
}
示例15: decorateConfig
public function decorateConfig($content, Zend_Form_Element $element, array $options)
{
$view = $this->getView();
$value = $view->escape($element->getValue());
return '<textarea name="' . $view->escape($element->getName()) . '"' . ' class="f-max-size" readonly="readonly"' . ' id="' . $view->escape($element->getId()) . '"' . ' rows="' . (substr_count($value, "\n") + 1) . '" cols="80" style="width: 100%;"' . '>' . $value . '</textarea>';
}