Current File : /home/k/a/r/karenpetzb/www/items/category/Element.tar |
Object/Stream.php 0000604 00000033266 15071303560 0007724 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element_Object */
require_once 'Zend/Pdf/Element/Object.php';
/** Zend_Pdf_Element_Stream */
require_once 'Zend/Pdf/Element/Stream.php';
/** Zend_Pdf_Filter_Ascii85 */
require_once 'Zend/Pdf/Filter/Ascii85.php';
/** Zend_Pdf_Filter_AsciiHex */
require_once 'Zend/Pdf/Filter/AsciiHex.php';
/** Zend_Pdf_Filter_Compression_Flate */
require_once 'Zend/Pdf/Filter/Compression/Flate.php';
/** Zend_Pdf_Filter_Compression_Lzw */
require_once 'Zend/Pdf/Filter/Compression/Lzw.php';
/** Zend_Pdf_ElementFactory */
require_once 'Zend/Pdf/ElementFactory.php';
/**
* PDF file 'stream object' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Object_Stream extends Zend_Pdf_Element_Object
{
/**
* StreamObject dictionary
* Required enries:
* Length
*
* @var Zend_Pdf_Element_Dictionary
*/
private $_dictionary;
/**
* Flag which signals, that stream is decoded
*
* @var boolean
*/
private $_streamDecoded;
/**
* Stored original stream object dictionary.
* Used to decode stream during an access time.
*
* The only properties, which affect decoding, are sored here.
*
* @var array|null
*/
private $_originalDictionary = null;
/**
* Object constructor
*
* @param mixed $val
* @param integer $objNum
* @param integer $genNum
* @param Zend_Pdf_ElementFactory $factory
* @param Zend_Pdf_Element_Dictionary|null $dictionary
* @throws Zend_Pdf_Exception
*/
public function __construct($val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory, $dictionary = null)
{
parent::__construct(new Zend_Pdf_Element_Stream($val), $objNum, $genNum, $factory);
if ($dictionary === null) {
$this->_dictionary = new Zend_Pdf_Element_Dictionary();
$this->_dictionary->Length = new Zend_Pdf_Element_Numeric(strlen( $val ));
$this->_streamDecoded = true;
} else {
$this->_dictionary = $dictionary;
$this->_streamDecoded = false;
}
}
/**
* Store original dictionary information in $_originalDictionary class member.
* Used to store information and to normalize filters information before defiltering.
*
*/
private function _storeOriginalDictionary()
{
$this->_originalDictionary = array();
$this->_originalDictionary['Filter'] = array();
$this->_originalDictionary['DecodeParms'] = array();
if ($this->_dictionary->Filter === null) {
// Do nothing.
} else if ($this->_dictionary->Filter->getType() == Zend_Pdf_Element::TYPE_ARRAY) {
foreach ($this->_dictionary->Filter->items as $id => $filter) {
$this->_originalDictionary['Filter'][$id] = $filter->value;
$this->_originalDictionary['DecodeParms'][$id] = array();
if ($this->_dictionary->DecodeParms !== null ) {
if ($this->_dictionary->DecodeParms->items[$id] !== null &&
$this->_dictionary->DecodeParms->items[$id]->value !== null ) {
foreach ($this->_dictionary->DecodeParms->items[$id]->getKeys() as $paramKey) {
$this->_originalDictionary['DecodeParms'][$id][$paramKey] =
$this->_dictionary->DecodeParms->items[$id]->$paramKey->value;
}
}
}
}
} else if ($this->_dictionary->Filter->getType() != Zend_Pdf_Element::TYPE_NULL) {
$this->_originalDictionary['Filter'][0] = $this->_dictionary->Filter->value;
$this->_originalDictionary['DecodeParms'][0] = array();
if ($this->_dictionary->DecodeParms !== null ) {
foreach ($this->_dictionary->DecodeParms->getKeys() as $paramKey) {
$this->_originalDictionary['DecodeParms'][0][$paramKey] =
$this->_dictionary->DecodeParms->$paramKey->value;
}
}
}
if ($this->_dictionary->F !== null) {
$this->_originalDictionary['F'] = $this->_dictionary->F->value;
}
$this->_originalDictionary['FFilter'] = array();
$this->_originalDictionary['FDecodeParms'] = array();
if ($this->_dictionary->FFilter === null) {
// Do nothing.
} else if ($this->_dictionary->FFilter->getType() == Zend_Pdf_Element::TYPE_ARRAY) {
foreach ($this->_dictionary->FFilter->items as $id => $filter) {
$this->_originalDictionary['FFilter'][$id] = $filter->value;
$this->_originalDictionary['FDecodeParms'][$id] = array();
if ($this->_dictionary->FDecodeParms !== null ) {
if ($this->_dictionary->FDecodeParms->items[$id] !== null &&
$this->_dictionary->FDecodeParms->items[$id]->value !== null) {
foreach ($this->_dictionary->FDecodeParms->items[$id]->getKeys() as $paramKey) {
$this->_originalDictionary['FDecodeParms'][$id][$paramKey] =
$this->_dictionary->FDecodeParms->items[$id]->items[$paramKey]->value;
}
}
}
}
} else {
$this->_originalDictionary['FFilter'][0] = $this->_dictionary->FFilter->value;
$this->_originalDictionary['FDecodeParms'][0] = array();
if ($this->_dictionary->FDecodeParms !== null ) {
foreach ($this->_dictionary->FDecodeParms->getKeys() as $paramKey) {
$this->_originalDictionary['FDecodeParms'][0][$paramKey] =
$this->_dictionary->FDecodeParms->items[$paramKey]->value;
}
}
}
}
/**
* Decode stream
*
* @throws Zend_Pdf_Exception
*/
private function _decodeStream()
{
if ($this->_originalDictionary === null) {
$this->_storeOriginalDictionary();
}
/**
* All applied stream filters must be processed to decode stream.
* If we don't recognize any of applied filetrs an exception should be thrown here
*/
if (isset($this->_originalDictionary['F'])) {
/** @todo Check, how external files can be processed. */
throw new Zend_Pdf_Exception('External filters are not supported now.');
}
foreach ($this->_originalDictionary['Filter'] as $id => $filterName ) {
$valueRef = &$this->_value->value->getRef();
$this->_value->value->touch();
switch ($filterName) {
case 'ASCIIHexDecode':
$valueRef = Zend_Pdf_Filter_AsciiHex::decode($valueRef);
break;
case 'ASCII85Decode':
$valueRef = Zend_Pdf_Filter_Ascii85::decode($valueRef);
break;
case 'FlateDecode':
$valueRef = Zend_Pdf_Filter_Compression_Flate::decode($valueRef,
$this->_originalDictionary['DecodeParms'][$id]);
break;
case 'LZWDecode':
$valueRef = Zend_Pdf_Filter_Compression_Lzw::decode($valueRef,
$this->_originalDictionary['DecodeParms'][$id]);
break;
default:
throw new Zend_Pdf_Exception('Unknown stream filter: \'' . $filterName . '\'.');
}
}
$this->_streamDecoded = true;
}
/**
* Encode stream
*
* @throws Zend_Pdf_Exception
*/
private function _encodeStream()
{
/**
* All applied stream filters must be processed to encode stream.
* If we don't recognize any of applied filetrs an exception should be thrown here
*/
if (isset($this->_originalDictionary['F'])) {
/** @todo Check, how external files can be processed. */
throw new Zend_Pdf_Exception('External filters are not supported now.');
}
$filters = array_reverse($this->_originalDictionary['Filter'], true);
foreach ($filters as $id => $filterName ) {
$valueRef = &$this->_value->value->getRef();
$this->_value->value->touch();
switch ($filterName) {
case 'ASCIIHexDecode':
$valueRef = Zend_Pdf_Filter_AsciiHex::encode($valueRef);
break;
case 'ASCII85Decode':
$valueRef = Zend_Pdf_Filter_Ascii85::encode($valueRef);
break;
case 'FlateDecode':
$valueRef = Zend_Pdf_Filter_Compression_Flate::encode($valueRef,
$this->_originalDictionary['DecodeParms'][$id]);
break;
case 'LZWDecode':
$valueRef = Zend_Pdf_Filter_Compression_Lzw::encode($valueRef,
$this->_originalDictionary['DecodeParms'][$id]);
break;
default:
throw new Zend_Pdf_Exception('Unknown stream filter: \'' . $filterName . '\'.');
}
}
$this->_streamDecoded = false;
}
/**
* Get handler
*
* @param string $property
* @return mixed
* @throws Zend_Pdf_Exception
*/
public function __get($property)
{
if ($property == 'dictionary') {
/**
* If stream is note decoded yet, then store original decoding options (do it only once).
*/
if (( !$this->_streamDecoded ) && ($this->_originalDictionary === null)) {
$this->_storeOriginalDictionary();
}
return $this->_dictionary;
}
if ($property == 'value') {
if (!$this->_streamDecoded) {
$this->_decodeStream();
}
return $this->_value->value->getRef();
}
throw new Zend_Pdf_Exception('Unknown stream object property requested.');
}
/**
* Set handler
*
* @param string $property
* @param mixed $value
*/
public function __set($property, $value)
{
if ($property == 'value') {
$valueRef = &$this->_value->value->getRef();
$valueRef = $value;
$this->_value->value->touch();
$this->_streamDecoded = true;
return;
}
throw new Zend_Pdf_Exception('Unknown stream object property: \'' . $property . '\'.');
}
/**
* Treat stream data as already encoded
*/
public function skipFilters()
{
$this->_streamDecoded = false;
}
/**
* Call handler
*
* @param string $method
* @param array $args
* @return mixed
*/
public function __call($method, $args)
{
if (!$this->_streamDecoded) {
$this->_decodeStream();
}
switch (count($args)) {
case 0:
return $this->_value->$method();
case 1:
return $this->_value->$method($args[0]);
default:
throw new Zend_Pdf_Exception('Unsupported number of arguments');
}
}
/**
* Dump object to a string to save within PDF file
*
* $factory parameter defines operation context.
*
* @param Zend_Pdf_ElementFactory $factory
* @return string
*/
public function dump(Zend_Pdf_ElementFactory $factory)
{
$shift = $factory->getEnumerationShift($this->_factory);
if ($this->_streamDecoded) {
$this->_storeOriginalDictionary();
$this->_encodeStream();
} else if ($this->_originalDictionary != null) {
$startDictionary = $this->_originalDictionary;
$this->_storeOriginalDictionary();
$newDictionary = $this->_originalDictionary;
if ($startDictionary !== $newDictionary) {
$this->_originalDictionary = $startDictionary;
$this->_decodeStream();
$this->_originalDictionary = $newDictionary;
$this->_encodeStream();
}
}
// Update stream length
$this->dictionary->Length->value = $this->_value->length();
return $this->_objNum + $shift . " " . $this->_genNum . " obj \n"
. $this->dictionary->toString($factory) . "\n"
. $this->_value->toString($factory) . "\n"
. "endobj\n";
}
/**
* Clean up resources, used by object
*/
public function cleanUp()
{
$this->_dictionary = null;
$this->_value = null;
}
}
Stream.php 0000604 00000004746 15071303560 0006517 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Pdf
*/
require_once 'Zend/Pdf.php';
/**
* @see Zend_Pdf_Element
*/
require_once 'Zend/Pdf/Element.php';
/**
* @see Zend_Memory
*/
require_once 'Zend/Memory.php';
/**
* PDF file 'stream' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Stream extends Zend_Pdf_Element
{
/**
* Object value
*
* @var Zend_Memory_Container
*/
public $value;
/**
* Object constructor
*
* @param string $val
*/
public function __construct($val)
{
$this->value = Zend_Pdf::getMemoryManager()->create($val);
}
/**
* Return type of the element.
*
* @return integer
*/
public function getType()
{
return Zend_Pdf_Element::TYPE_STREAM;
}
/**
* Stream length.
* (Method is used to avoid string copying, which may occurs in some cases)
*
* @return integer
*/
public function length()
{
return strlen($this->value->getRef());
}
/**
* Clear stream
*
*/
public function clear()
{
$ref = &$this->value->getRef();
$ref = '';
$this->value->touch();
}
/**
* Append value to a stream
*
* @param mixed $val
*/
public function append($val)
{
$ref = &$this->value->getRef();
$ref .= (string)$val;
$this->value->touch();
}
/**
* Return object as string
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
return "stream\n" . $this->value->getRef() . "\nendstream";
}
}
String/Binary.php 0000604 00000005504 15071303560 0007747 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element_String */
require_once 'Zend/Pdf/Element/String.php';
/**
* PDF file 'binary string' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_String_Binary extends Zend_Pdf_Element_String
{
/**
* Object value
*
* @var string
*/
public $value;
/**
* Escape string according to the PDF rules
*
* @param string $inStr
* @return string
*/
public static function escape($inStr)
{
$outStr = '';
for ($count = 0; $count < strlen($inStr); $count++) {
$outStr .= sprintf('%02X', ord($inStr[$count]));
}
return $outStr;
}
/**
* Unescape string according to the PDF rules
*
* @param string $inStr
* @return string
*/
public static function unescape($inStr)
{
$outStr = '';
$nextHexCode = '';
for ($count = 0; $count < strlen($inStr); $count++) {
$nextCharCode = ord($inStr[$count]);
if( ($nextCharCode >= 48 /*'0'*/ &&
$nextCharCode <= 57 /*'9'*/ ) ||
($nextCharCode >= 97 /*'a'*/ &&
$nextCharCode <= 102 /*'f'*/ ) ||
($nextCharCode >= 65 /*'A'*/ &&
$nextCharCode <= 70 /*'F'*/ ) ) {
$nextHexCode .= $inStr[$count];
}
if (strlen($nextHexCode) == 2) {
$outStr .= chr(intval($nextHexCode, 16));
$nextHexCode = '';
}
}
if ($nextHexCode != '') {
// We have odd number of digits.
// Final digit is assumed to be '0'
$outStr .= chr(base_convert($nextHexCode . '0', 16, 10));
}
return $outStr;
}
/**
* Return object as string
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
return '<' . self::escape((string)$this->value) . '>';
}
}
Boolean.php 0000604 00000003467 15071303560 0006642 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/**
* PDF file 'boolean' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Boolean extends Zend_Pdf_Element
{
/**
* Object value
*
* @var boolean
*/
public $value;
/**
* Object constructor
*
* @param boolean $val
* @throws Zend_Pdf_Exception
*/
public function __construct($val)
{
if (! is_bool($val)) {
throw new Zend_Pdf_Exception('Argument must be boolean.');
}
$this->value = $val;
}
/**
* Return type of the element.
*
* @return integer
*/
public function getType()
{
return Zend_Pdf_Element::TYPE_BOOL;
}
/**
* Return object as string
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
return $this->value ? 'true' : 'false';
}
}
Reference/Context.php 0000604 00000004157 15071303560 0010602 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_StringParser */
require_once 'Zend/Pdf/StringParser.php';
/** Zend_Pdf_Element_Reference_Table */
require_once 'Zend/Pdf/Element/Reference/Table.php';
/**
* PDF reference object context
* Reference context is defined by PDF parser and PDF Refernce table
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Reference_Context
{
/**
* PDF parser object.
*
* @var Zend_Pdf_Parser
*/
private $_stringParser;
/**
* Reference table
*
* @var Zend_Pdf_Element_Reference_Table
*/
private $_refTable;
/**
* Object constructor
*
* @param Zend_Pdf_StringParser $parser
* @param Zend_Pdf_Element_Reference_Table $refTable
*/
public function __construct(Zend_Pdf_StringParser $parser,
Zend_Pdf_Element_Reference_Table $refTable)
{
$this->_stringParser = $parser;
$this->_refTable = $refTable;
}
/**
* Context parser
*
* @return Zend_Pdf_Parser
*/
public function getParser()
{
return $this->_stringParser;
}
/**
* Context reference table
*
* @return Zend_Pdf_Element_Reference_Table
*/
public function getRefTable()
{
return $this->_refTable;
}
}
Reference/Table.php 0000604 00000010622 15071303560 0010177 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* PDF file reference table
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Reference_Table
{
/**
* Parent reference table
*
* @var Zend_Pdf_Element_Reference_Table
*/
private $_parent;
/**
* Free entries
* 'reference' => next free object number
*
* @var array
*/
private $_free;
/**
* Generation numbers for free objects.
* Array: objNum => nextGeneration
*
* @var array
*/
private $_generations;
/**
* In use entries
* 'reference' => offset
*
* @var array
*/
private $_inuse;
/**
* Generation numbers for free objects.
* Array: objNum => objGeneration
*
* @var array
*/
private $_usedObjects;
/**
* Object constructor
*/
public function __construct()
{
$this->_parent = null;
$this->_free = array(); $this->_generations = array();
$this->_inuse = array(); $this->_usedObjects = array();
}
/**
* Add reference to the reference table
*
* @param string $ref
* @param integer $offset
* @param boolean $inuse
*/
public function addReference($ref, $offset, $inuse = true)
{
$refElements = explode(' ', $ref);
if (!is_numeric($refElements[0]) || !is_numeric($refElements[1]) || $refElements[2] != 'R') {
throw new Zend_Pdf_Exception("Incorrect reference: '$ref'");
}
$objNum = (int)$refElements[0];
$genNum = (int)$refElements[1];
if ($inuse) {
$this->_inuse[$ref] = $offset;
$this->_usedObjects[$objNum] = $objNum;
} else {
$this->_free[$ref] = $offset;
$this->_generations[$objNum] = $genNum;
}
}
/**
* Set parent reference table
*
* @param Zend_Pdf_Element_Reference_Table $parent
*/
public function setParent(self $parent)
{
$this->_parent = $parent;
}
/**
* Get object offset
*
* @param string $ref
* @return integer
*/
public function getOffset($ref)
{
if (isset($this->_inuse[$ref])) {
return $this->_inuse[$ref];
}
if (isset($this->_free[$ref])) {
return null;
}
if (isset($this->_parent)) {
return $this->_parent->getOffset($ref);
}
return null;
}
/**
* Get next object from a list of free objects.
*
* @param string $ref
* @return integer
* @throws Zend_Pdf_Exception
*/
public function getNextFree($ref)
{
if (isset($this->_inuse[$ref])) {
throw new Zend_Pdf_Exception('Object is not free');
}
if (isset($this->_free[$ref])) {
return $this->_free[$ref];
}
if (isset($this->_parent)) {
return $this->_parent->getNextFree($ref);
}
throw new Zend_Pdf_Exception('Object not found.');
}
/**
* Get next generation number for free object
*
* @param integer $objNum
* @return unknown
*/
public function getNewGeneration($objNum)
{
if (isset($this->_usedObjects[$objNum])) {
throw new Zend_Pdf_Exception('Object is not free');
}
if (isset($this->_generations[$objNum])) {
return $this->_generations[$objNum];
}
if (isset($this->_parent)) {
return $this->_parent->getNewGeneration($objNum);
}
throw new Zend_Pdf_Exception('Object not found.');
}
}
Null.php 0000604 00000003151 15071303560 0006163 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/**
* PDF file 'null' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Null extends Zend_Pdf_Element
{
/**
* Object value. Always null.
*
* @var mixed
*/
public $value;
/**
* Object constructor
*/
public function __construct()
{
$this->value = null;
}
/**
* Return type of the element.
*
* @return integer
*/
public function getType()
{
return Zend_Pdf_Element::TYPE_NULL;
}
/**
* Return object as string
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
return 'null';
}
}
Array.php 0000604 00000007370 15071303560 0006336 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/** Zend_Pdf_PhpArray */
require_once 'Zend/Pdf/PhpArray.php';
/**
* PDF file 'array' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Array extends Zend_Pdf_Element
{
/**
* Object value
* Array of Zend_Pdf_Element objects.
* Appropriate methods must (!) be used to modify it to provide correct
* work with objects and references.
*
* @var Zend_Pdf_PhpArray
*/
private $_items;
/**
* Object constructor
*
* @param array $val - array of Zend_Pdf_Element objects
* @throws Zend_Pdf_Exception
*/
public function __construct($val = null)
{
$this->_items = new Zend_Pdf_PhpArray();
if ($val !== null && is_array($val)) {
foreach ($val as $element) {
if (!$element instanceof Zend_Pdf_Element) {
throw new Zend_Pdf_Exception('Array elements must be Zend_Pdf_Element objects');
}
$this->_items[] = $element;
}
} else if ($val !== null){
throw new Zend_Pdf_Exception('Argument must be an array');
}
}
/**
* Provides access to $this->_items
*
* @param string $property
* @return Zend_Pdf_PhpArray
*/
public function __get($property) {
if ($property=='items') {
return $this->_items;
}
throw new Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
}
/**
* Provides read-only access to $this->_items;
*
* @param unknown_type $offset
* @param unknown_type $value
*/
public function __set($property, $value) {
if ($property=='items') {
throw new Exception('Array container cannot be overwritten');
}
throw new Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
}
/**
* Return type of the element.
*
* @return integer
*/
public function getType()
{
return Zend_Pdf_Element::TYPE_ARRAY;
}
/**
* Return object as string
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
$outStr = '[';
$lastNL = 0;
foreach ($this->_items as $element) {
if (strlen($outStr) - $lastNL > 128) {
$outStr .= "\n";
$lastNL = strlen($outStr);
}
$outStr .= $element->toString($factory) . ' ';
}
$outStr .= ']';
return $outStr;
}
/**
* Convert PDF element to PHP type.
*
* Dictionary is returned as an associative array
*
* @return mixed
*/
public function toPhp()
{
foreach ($this->_items as $item) {
$phpArray[] = $item->toPhp();
}
return $phpArray;
}
}
Object.php 0000604 00000013164 15071303560 0006464 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/** Zend_Pdf_ElementFactory */
require_once 'Zend/Pdf/ElementFactory.php';
/**
* PDF file 'indirect object' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Object extends Zend_Pdf_Element
{
/**
* Object value
*
* @var Zend_Pdf_Element
*/
protected $_value;
/**
* Object number within PDF file
*
* @var integer
*/
protected $_objNum;
/**
* Generation number
*
* @var integer
*/
protected $_genNum;
/**
* Reference to the factory.
*
* @var Zend_Pdf_ElementFactory
*/
protected $_factory;
/**
* Object constructor
*
* @param Zend_Pdf_Element $val
* @param integer $objNum
* @param integer $genNum
* @param Zend_Pdf_ElementFactory $factory
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory)
{
if ($val instanceof self) {
throw new Zend_Pdf_Exception('Object number must not be instance of Zend_Pdf_Element_Object.');
}
if ( !(is_integer($objNum) && $objNum > 0) ) {
throw new Zend_Pdf_Exception('Object number must be positive integer.');
}
if ( !(is_integer($genNum) && $genNum >= 0) ) {
throw new Zend_Pdf_Exception('Generation number must be non-negative integer.');
}
$this->_value = $val;
$this->_objNum = $objNum;
$this->_genNum = $genNum;
$this->_factory = $factory;
$factory->registerObject($this);
}
/**
* Check, that object is generated by specified factory
*
* @return Zend_Pdf_ElementFactory
*/
public function getFactory()
{
return $this->_factory;
}
/**
* Return type of the element.
*
* @return integer
*/
public function getType()
{
return $this->_value->getType();
}
/**
* Get object number
*
* @return integer
*/
public function getObjNum()
{
return $this->_objNum;
}
/**
* Get generation number
*
* @return integer
*/
public function getGenNum()
{
return $this->_genNum;
}
/**
* Return reference to the object
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
if ($factory === null) {
$shift = 0;
} else {
$shift = $factory->getEnumerationShift($this->_factory);
}
return $this->_objNum + $shift . ' ' . $this->_genNum . ' R';
}
/**
* Dump object to a string to save within PDF file.
*
* $factory parameter defines operation context.
*
* @param Zend_Pdf_ElementFactory $factory
* @return string
*/
public function dump(Zend_Pdf_ElementFactory $factory)
{
$shift = $factory->getEnumerationShift($this->_factory);
return $this->_objNum + $shift . " " . $this->_genNum . " obj \n"
. $this->_value->toString($factory) . "\n"
. "endobj\n";
}
/**
* Get handler
*
* @param string $property
* @return mixed
*/
public function __get($property)
{
return $this->_value->$property;
}
/**
* Set handler
*
* @param string $property
* @param mixed $value
*/
public function __set($property, $value)
{
$this->_value->$property = $value;
}
/**
* Call handler
*
* @param string $method
* @param array $args
* @return mixed
*/
public function __call($method, $args)
{
switch (count($args)) {
case 0:
return $this->_value->$method();
case 1:
return $this->_value->$method($args[0]);
case 2:
return $this->_value->$method($args[0], $args[1]);
case 3:
return $this->_value->$method($args[0], $args[1], $args[2]);
case 4:
return $this->_value->$method($args[0], $args[1], $args[2], $args[3]);
default:
throw new Zend_Pdf_Exception('Unsupported number of arguments');
}
}
/**
* Mark object as modified, to include it into new PDF file segment
*/
public function touch()
{
$this->_factory->markAsModified($this);
}
/**
* Clean up resources, used by object
*/
public function cleanUp()
{
$this->_value = null;
}
/**
* Convert PDF element to PHP type.
*
* @return mixed
*/
public function toPhp()
{
return $this->_value->toPhp();
}
}
Name.php 0000604 00000007762 15071303560 0006145 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/**
* PDF file 'name' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Name extends Zend_Pdf_Element
{
/**
* Object value
*
* @var string
*/
public $value;
/**
* Object constructor
*
* @param string $val
* @throws Zend_Pdf_Exception
*/
public function __construct($val)
{
settype($val, 'string');
if (strpos($val,"\x00") !== false) {
throw new Zend_Pdf_Exception('Null character is not allowed in PDF Names');
}
$this->value = (string)$val;
}
/**
* Return type of the element.
*
* @return integer
*/
public function getType()
{
return Zend_Pdf_Element::TYPE_NAME;
}
/**
* Escape string according to the PDF rules
*
* @param string $inStr
* @return string
*/
public static function escape($inStr)
{
$outStr = '';
for ($count = 0; $count < strlen($inStr); $count++) {
$nextCode = ord($inStr[$count]);
switch ($inStr[$count]) {
case '(':
// fall through to next case
case ')':
// fall through to next case
case '<':
// fall through to next case
case '>':
// fall through to next case
case '[':
// fall through to next case
case ']':
// fall through to next case
case '{':
// fall through to next case
case '}':
// fall through to next case
case '/':
// fall through to next case
case '%':
// fall through to next case
case '\\':
// fall through to next case
case '#':
$outStr .= sprintf('#%02X', $nextCode);
break;
default:
if ($nextCode >= 33 && $nextCode <= 126 ) {
// Visible ASCII symbol
$outStr .= $inStr[$count];
} else {
$outStr .= sprintf('#%02X', $nextCode);
}
}
}
return $outStr;
}
/**
* Unescape string according to the PDF rules
*
* @param string $inStr
* @return string
*/
public static function unescape($inStr)
{
$outStr = '';
for ($count = 0; $count < strlen($inStr); $count++) {
if ($inStr[$count] != '#' ) {
$outStr .= $inStr[$count];
} else {
// Escape sequence
$outStr .= chr(base_convert(substr($inStr, $count+1, 2), 16, 10 ));
$count +=2;
}
}
return $outStr;
}
/**
* Return object as string
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
return '/' . self::escape((string)$this->value);
}
}
String.php 0000604 00000015236 15071303560 0006526 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/**
* PDF file 'string' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_String extends Zend_Pdf_Element
{
/**
* Object value
*
* @var string
*/
public $value;
/**
* Object constructor
*
* @param string $val
*/
public function __construct($val)
{
$this->value = (string)$val;
}
/**
* Return type of the element.
*
* @return integer
*/
public function getType()
{
return Zend_Pdf_Element::TYPE_STRING;
}
/**
* Return object as string
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
return '(' . self::escape((string)$this->value) . ')';
}
/**
* Escape string according to the PDF rules
*
* @param string $inStr
* @return string
*/
public static function escape($inStr)
{
$outStr = '';
$lastNL = 0;
for ($count = 0; $count < strlen($inStr); $count++) {
if (strlen($outStr) - $lastNL > 128) {
$outStr .= "\\\n";
$lastNL = strlen($outStr);
}
$nextCode = ord($inStr[$count]);
switch ($nextCode) {
// "\n" - line feed (LF)
case 10:
$outStr .= '\\n';
break;
// "\r" - carriage return (CR)
case 13:
$outStr .= '\\r';
break;
// "\t" - horizontal tab (HT)
case 9:
$outStr .= '\\t';
break;
// "\b" - backspace (BS)
case 8:
$outStr .= '\\b';
break;
// "\f" - form feed (FF)
case 12:
$outStr .= '\\f';
break;
// '(' - left paranthesis
case 40:
$outStr .= '\\(';
break;
// ')' - right paranthesis
case 41:
$outStr .= '\\)';
break;
// '\' - backslash
case 92:
$outStr .= '\\\\';
break;
default:
// Don't use non-ASCII characters escaping
// if ($nextCode >= 32 && $nextCode <= 126 ) {
// // Visible ASCII symbol
// $outStr .= $inStr[$count];
// } else {
// $outStr .= sprintf('\\%03o', $nextCode);
// }
$outStr .= $inStr[$count];
break;
}
}
return $outStr;
}
/**
* Unescape string according to the PDF rules
*
* @param string $inStr
* @return string
*/
public static function unescape($inStr)
{
$outStr = '';
for ($count = 0; $count < strlen($inStr); $count++) {
if ($inStr[$count] != '\\' || $count == strlen($inStr)-1) {
$outStr .= $inStr[$count];
} else { // Escape sequence
switch ($inStr{++$count}) {
// '\\n' - line feed (LF)
case 'n':
$outStr .= "\n";
break;
// '\\r' - carriage return (CR)
case 'r':
$outStr .= "\r";
break;
// '\\t' - horizontal tab (HT)
case 't':
$outStr .= "\t";
break;
// '\\b' - backspace (BS)
case 'b':
$outStr .= "\x08";
break;
// '\\f' - form feed (FF)
case 'f':
$outStr .= "\x0C";
break;
// '\\(' - left paranthesis
case '(':
$outStr .= '(';
break;
// '\\)' - right paranthesis
case ')':
$outStr .= ')';
break;
// '\\\\' - backslash
case '\\':
$outStr .= '\\';
break;
// "\\\n" or "\\\n\r"
case "\n":
// skip new line symbol
if ($inStr[$count+1] == "\r") {
$count++;
}
break;
default:
if (ord($inStr[$count]) >= ord('0') &&
ord($inStr[$count]) <= ord('9')) {
// Character in octal representation
// '\\xxx'
$nextCode = '0' . $inStr[$count];
if (ord($inStr[$count+1]) >= ord('0') &&
ord($inStr[$count+1]) <= ord('9')) {
$nextCode .= $inStr{++$count};
if (ord($inStr[$count+1]) >= ord('0') &&
ord($inStr[$count+1]) <= ord('9')) {
$nextCode .= $inStr{++$count};
}
}
$outStr .= chr($nextCode);
} else {
$outStr .= $inStr[$count];
}
break;
}
}
}
return $outStr;
}
}
Numeric.php 0000604 00000004231 15071303560 0006653 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/**
* PDF file 'numeric' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Numeric extends Zend_Pdf_Element
{
/**
* Object value
*
* @var numeric
*/
public $value;
/**
* Object constructor
*
* @param numeric $val
* @throws Zend_Pdf_Exception
*/
public function __construct($val)
{
if ( !is_numeric($val) ) {
throw new Zend_Pdf_Exception('Argument must be numeric');
}
$this->value = $val;
}
/**
* Return type of the element.
*
* @return integer
*/
public function getType()
{
return Zend_Pdf_Element::TYPE_NUMERIC;
}
/**
* Return object as string
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
if (is_integer($this->value)) {
return (string)$this->value;
}
/**
* PDF doesn't support exponental format.
* Fixed point format must be used instead
*/
$prec = 0; $v = $this->value;
while (abs( floor($v) - $v ) > 1e-10) {
$prec++; $v *= 10;
}
return sprintf("%.{$prec}F", $this->value);
}
}
Reference.php 0000604 00000015416 15071303560 0007156 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/** Zend_Pdf_Element_Reference_Context */
require_once 'Zend/Pdf/Element/Reference/Context.php';
/** Zend_Pdf_Element_Reference_Table */
require_once 'Zend/Pdf/Element/Reference/Table.php';
/** Zend_Pdf_ElementFactory */
require_once 'Zend/Pdf/ElementFactory.php';
/**
* PDF file 'reference' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
{
/**
* Object value
* The reference to the object
*
* @var mixed
*/
private $_ref;
/**
* Object number within PDF file
*
* @var integer
*/
private $_objNum;
/**
* Generation number
*
* @var integer
*/
private $_genNum;
/**
* Reference context
*
* @var Zend_Pdf_Element_Reference_Context
*/
private $_context;
/**
* Reference to the factory.
*
* It's the same as referenced object factory, but we save it here to avoid
* unnecessary dereferencing, whech can produce cascade dereferencing and parsing.
* The same for duplication of getFactory() function. It can be processed by __call()
* method, but we catch it here.
*
* @var Zend_Pdf_ElementFactory
*/
private $_factory;
/**
* Object constructor:
*
* @param integer $objNum
* @param integer $genNum
* @param Zend_Pdf_Element_Reference_Context $context
* @param Zend_Pdf_ElementFactory $factory
* @throws Zend_Pdf_Exception
*/
public function __construct($objNum, $genNum = 0, Zend_Pdf_Element_Reference_Context $context, Zend_Pdf_ElementFactory $factory)
{
if ( !(is_integer($objNum) && $objNum > 0) ) {
throw new Zend_Pdf_Exception('Object number must be positive integer');
}
if ( !(is_integer($genNum) && $genNum >= 0) ) {
throw new Zend_Pdf_Exception('Generation number must be non-negative integer');
}
$this->_objNum = $objNum;
$this->_genNum = $genNum;
$this->_ref = null;
$this->_context = $context;
$this->_factory = $factory;
}
/**
* Check, that object is generated by specified factory
*
* @return Zend_Pdf_ElementFactory
*/
public function getFactory()
{
return $this->_factory;
}
/**
* Return type of the element.
*
* @return integer
*/
public function getType()
{
if ($this->_ref === null) {
$this->_dereference();
}
return $this->_ref->getType();
}
/**
* Return reference to the object
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
if ($factory === null) {
$shift = 0;
} else {
$shift = $factory->getEnumerationShift($this->_factory);
}
return $this->_objNum + $shift . ' ' . $this->_genNum . ' R';
}
/**
* Dereference.
* Take inderect object, take $value member of this object (must be Zend_Pdf_Element),
* take reference to the $value member of this object and assign it to
* $value member of current PDF Reference object
* $obj can be null
*
* @throws Zend_Pdf_Exception
*/
private function _dereference()
{
$obj = $this->_context->getParser()->getObject(
$this->_context->getRefTable()->getOffset($this->_objNum . ' ' . $this->_genNum . ' R'),
$this->_context
);
if ($obj === null ) {
$this->_ref = new Zend_Pdf_Element_Null();
return;
}
if ($obj->toString() != $this->_objNum . ' ' . $this->_genNum . ' R') {
throw new Zend_Pdf_Exception('Incorrect reference to the object');
}
$this->_ref = $obj;
$this->setParentObject($obj);
$this->_factory->registerObject($this);
}
/**
* Mark object as modified, to include it into new PDF file segment.
*/
public function touch()
{
if ($this->_ref === null) {
$this->_dereference();
}
$this->_ref->touch();
}
/**
* Get handler
*
* @param string $property
* @return mixed
*/
public function __get($property)
{
if ($this->_ref === null) {
$this->_dereference();
}
return $this->_ref->$property;
}
/**
* Set handler
*
* @param string $property
* @param mixed $value
*/
public function __set($property, $value)
{
if ($this->_ref === null) {
$this->_dereference();
}
$this->_ref->$property = $value;
}
/**
* Call handler
*
* @param string $method
* @param array $args
* @return mixed
*/
public function __call($method, $args)
{
if ($this->_ref === null) {
$this->_dereference();
}
switch (count($args)) {
case 0:
return $this->_ref->$method();
case 1:
return $this->_ref->$method($args[0]);
case 2:
return $this->_ref->$method($args[0], $args[1]);
case 3:
return $this->_ref->$method($args[0], $args[1], $args[2]);
case 4:
return $this->_ref->$method($args[0], $args[1], $args[2], $args[3]);
default:
throw new Zend_Pdf_Exception('Unsupported number of arguments');
}
}
/**
* Clean up resources
*/
public function cleanUp()
{
$this->_ref = null;
}
/**
* Convert PDF element to PHP type.
*
* @return mixed
*/
public function toPhp()
{
if ($this->_ref === null) {
$this->_dereference();
}
return $this->_ref->toPhp();
}
}
Dictionary.php 0000604 00000010443 15071303560 0007360 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/**
* PDF file 'dictionary' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Dictionary extends Zend_Pdf_Element
{
/**
* Dictionary elements
* Array of Zend_Pdf_Element objects ('name' => Zend_Pdf_Element)
*
* @var array
*/
private $_items = array();
/**
* Object constructor
*
* @param array $val - array of Zend_Pdf_Element objects
* @throws Zend_Pdf_Exception
*/
public function __construct($val = null)
{
if ($val === null) {
return;
} else if (!is_array($val)) {
throw new Zend_Pdf_Exception('Argument must be an array');
}
foreach ($val as $name => $element) {
if (!$element instanceof Zend_Pdf_Element) {
throw new Zend_Pdf_Exception('Array elements must be Zend_Pdf_Element objects');
}
if (!is_string($name)) {
throw new Zend_Pdf_Exception('Array keys must be strings');
}
$this->_items[$name] = $element;
}
}
/**
* Add element to an array
*
* @name Zend_Pdf_Element_Name $name
* @param Zend_Pdf_Element $val - Zend_Pdf_Element object
* @throws Zend_Pdf_Exception
*/
public function add(Zend_Pdf_Element_Name $name, Zend_Pdf_Element $val)
{
$this->_items[$name->value] = $val;
}
/**
* Return dictionary keys
*
* @return array
*/
public function getKeys()
{
return array_keys($this->_items);
}
/**
* Get handler
*
* @param string $property
* @return Zend_Pdf_Element | null
*/
public function __get($item)
{
$element = isset($this->_items[$item]) ? $this->_items[$item]
: null;
return $element;
}
/**
* Set handler
*
* @param string $property
* @param mixed $value
*/
public function __set($item, $value)
{
if ($value === null) {
unset($this->_items[$item]);
} else {
$this->_items[$item] = $value;
}
}
/**
* Return type of the element.
*
* @return integer
*/
public function getType()
{
return Zend_Pdf_Element::TYPE_DICTIONARY;
}
/**
* Return object as string
*
* @param Zend_Pdf_Factory $factory
* @return string
*/
public function toString($factory = null)
{
$outStr = '<<';
$lastNL = 0;
foreach ($this->_items as $name => $element) {
if (!is_object($element)) {
throw new Zend_Pdf_Exception('Wrong data');
}
if (strlen($outStr) - $lastNL > 128) {
$outStr .= "\n";
$lastNL = strlen($outStr);
}
$nameObj = new Zend_Pdf_Element_Name($name);
$outStr .= $nameObj->toString($factory) . ' ' . $element->toString($factory) . ' ';
}
$outStr .= '>>';
return $outStr;
}
/**
* Convert PDF element to PHP type.
*
* Dictionary is returned as an associative array
*
* @return mixed
*/
public function toPhp()
{
$phpArray = array();
foreach ($this->_items as $itemName => $item) {
$phpArray[$itemName] = $item->toPhp();
}
return $phpArray;
}
}
ColorPicker.php 0000604 00000002357 15071460713 0007500 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category ZendX
* @package ZendX_JQuery
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ColorPicker.php 20165 2010-01-09 18:57:56Z bkarwin $
*/
/**
* @see ZendX_JQuery_Form_Element_UiWidget
*/
require_once "UiWidget.php";
/**
* Form Element for jQuery ColorPicker View Helper
*
* @package ZendX_JQuery
* @subpackage Form
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ZendX_JQuery_Form_Element_ColorPicker extends ZendX_JQuery_Form_Element_UiWidget
{
public $helper = "colorPicker";
} UiWidget.php 0000604 00000012473 15071460713 0007005 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category ZendX
* @package ZendX_JQuery
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: UiWidget.php 20165 2010-01-09 18:57:56Z bkarwin $
*/
require_once "Zend/Form/Element.php";
/**
* Base Form Element for jQuery View Helpers
*
* @package ZendX_JQuery
* @subpackage Form
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ZendX_JQuery_Form_Element_UiWidget extends Zend_Form_Element
{
/**
* jQuery related parameters of this form element.
*
* @var array
*/
public $jQueryParams = array();
/**
* Just here to prevent errors.
*
* @var array
*/
public $options = array();
/**
* Constructor
*
* @param mixed $spec
* @param mixed $options
* @return void
*/
public function __construct($spec, $options = null)
{
$this->addPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator', 'decorator');
parent::__construct($spec, $options);
}
/**
* Get jQuery related parameter of this form element
*
* @param string $key
* @return string
*/
public function getJQueryParam($key)
{
$key = (string) $key;
return $this->jQueryParams[$key];
}
/**
* Get all currently known jQuery related parameters of this element
*
* @return array
*/
public function getJQueryParams()
{
return $this->jQueryParams;
}
/**
* Set a jQuery related parameter of this form element.
*
* @param string $key
* @param string $value
* @return ZendX_JQuery_Form_Element_UiWidget
*/
public function setJQueryParam($key, $value)
{
$key = (string) $key;
$this->jQueryParams[$key] = $value;
return $this;
}
/**
* Set an array of jQuery related options for this element (merging with old options).
*
* @param Array $params
* @return ZendX_JQuery_Form_Element_UiWidget
*/
public function setJQueryParams($params)
{
$this->jQueryParams = array_merge($this->jQueryParams, $params);
return $this;
}
/**
* Load default decorators
*
* @return void
*/
public function loadDefaultDecorators()
{
if ($this->loadDefaultDecoratorsIsDisabled()) {
return;
}
$decorators = $this->getDecorators();
if (empty($decorators)) {
$this->addDecorator('UiWidgetElement')
->addDecorator('Errors')
->addDecorator('Description', array('tag' => 'p', 'class' => 'description'))
->addDecorator('HtmlTag', array('tag' => 'dd'))
->addDecorator('Label', array('tag' => 'dt'));
}
}
/**
* Set the view object
*
* Ensures that the view object has the jQuery view helper path set.
*
* @param Zend_View_Interface $view
* @return ZendX_JQuery_Form_Element_UiWidget
*/
public function setView(Zend_View_Interface $view = null)
{
if (null !== $view) {
if (false === $view->getPluginLoader('helper')->getPaths('ZendX_JQuery_View_Helper')) {
$view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
}
}
return parent::setView($view);
}
/**
* Retrieve all decorators
*
* @throws ZendX_JQuery_Form_Exception
* @return array
*/
public function getDecorators()
{
$decorators = parent::getDecorators();
if(count($decorators) > 0) {
// Only check this if there are decorators present, otherwise it could
// be that the decorators have not been initialized yet.
$foundUiWidgetElementMarker = false;
foreach($decorators AS $decorator) {
if($decorator instanceof ZendX_JQuery_Form_Decorator_UiWidgetElementMarker) {
$foundUiWidgetElementMarker = true;
}
}
if($foundUiWidgetElementMarker === false) {
require_once "ZendX/JQuery/Form/Exception.php";
throw new ZendX_JQuery_Form_Exception(
"Cannot render jQuery form element without at least one decorator ".
"implementing the 'ZendX_JQuery_Form_Decorator_UiWidgetElementMarker' interface. ".
"Default decorator for this marker interface is the 'ZendX_JQuery_Form_Decorator_UiWidgetElement'. ".
"Hint: The ViewHelper decorator does not render jQuery elements correctly."
);
}
}
return $decorators;
}
} AutoComplete.php 0000604 00000002363 15071460713 0007662 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category ZendX
* @package ZendX_JQuery
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: AutoComplete.php 20165 2010-01-09 18:57:56Z bkarwin $
*/
/**
* @see ZendX_JQuery_Form_Element_UiWidget
*/
require_once "UiWidget.php";
/**
* Form Element for jQuery Autocomplete View Helper
*
* @package ZendX_JQuery
* @subpackage Form
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ZendX_JQuery_Form_Element_AutoComplete extends ZendX_JQuery_Form_Element_UiWidget
{
public $helper = "autoComplete";
} Spinner.php 0000604 00000002337 15071460713 0006700 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category ZendX
* @package ZendX_JQuery
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Spinner.php 20165 2010-01-09 18:57:56Z bkarwin $
*/
/**
* @see ZendX_JQuery_Form_Element_UiWidget
*/
require_once "UiWidget.php";
/**
* Form Element for jQuery Spinner View Helper
*
* @package ZendX_JQuery
* @subpackage Form
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ZendX_JQuery_Form_Element_Spinner extends ZendX_JQuery_Form_Element_UiWidget
{
public $helper = "spinner";
} DatePicker.php 0000604 00000002353 15071460713 0007273 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category ZendX
* @package ZendX_JQuery
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: DatePicker.php 20165 2010-01-09 18:57:56Z bkarwin $
*/
/**
* @see ZendX_JQuery_Form_Element_UiWidget
*/
require_once "UiWidget.php";
/**
* Form Element for jQuery DatePicker View Helper
*
* @package ZendX_JQuery
* @subpackage Form
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ZendX_JQuery_Form_Element_DatePicker extends ZendX_JQuery_Form_Element_UiWidget
{
public $helper = "datePicker";
} Slider.php 0000604 00000011006 15071460713 0006475 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_Dijit */
require_once 'Zend/Dojo/Form/Element/Dijit.php';
/**
* Abstract Slider dijit
*
* @uses Zend_Dojo_Form_Element_Dijit
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Slider.php 10003 2008-07-09 02:40:49Z matthew $
*/
abstract class Zend_Dojo_Form_Element_Slider extends Zend_Dojo_Form_Element_Dijit
{
/**
* Set clickSelect flag
*
* @param bool $clickSelect
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setClickSelect($flag)
{
$this->setDijitParam('clickSelect', (bool) $flag);
return $this;
}
/**
* Retrieve clickSelect flag
*
* @return bool
*/
public function getClickSelect()
{
if (!$this->hasDijitParam('clickSelect')) {
return false;
}
return $this->getDijitParam('clickSelect');
}
/**
* Set intermediateChanges flag
*
* @param bool $intermediateChanges
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setIntermediateChanges($flag)
{
$this->setDijitParam('intermediateChanges', (bool) $flag);
return $this;
}
/**
* Retrieve intermediateChanges flag
*
* @return bool
*/
public function getIntermediateChanges()
{
if (!$this->hasDijitParam('intermediateChanges')) {
return false;
}
return $this->getDijitParam('intermediateChanges');
}
/**
* Set showButtons flag
*
* @param bool $showButtons
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setShowButtons($flag)
{
$this->setDijitParam('showButtons', (bool) $flag);
return $this;
}
/**
* Retrieve showButtons flag
*
* @return bool
*/
public function getShowButtons()
{
if (!$this->hasDijitParam('showButtons')) {
return false;
}
return $this->getDijitParam('showButtons');
}
/**
* Set discreteValues
*
* @param int $value
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setDiscreteValues($value)
{
$this->setDijitParam('discreteValues', (int) $value);
return $this;
}
/**
* Retrieve discreteValues
*
* @return int|null
*/
public function getDiscreteValues()
{
return $this->getDijitParam('discreteValues');
}
/**
* Set maximum
*
* @param int $value
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setMaximum($value)
{
$this->setDijitParam('maximum', (int) $value);
return $this;
}
/**
* Retrieve maximum
*
* @return int|null
*/
public function getMaximum()
{
return $this->getDijitParam('maximum');
}
/**
* Set minimum
*
* @param int $value
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setMinimum($value)
{
$this->setDijitParam('minimum', (int) $value);
return $this;
}
/**
* Retrieve minimum
*
* @return int|null
*/
public function getMinimum()
{
return $this->getDijitParam('minimum');
}
/**
* Set pageIncrement
*
* @param int $value
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setPageIncrement($value)
{
$this->setDijitParam('pageIncrement', (int) $value);
return $this;
}
/**
* Retrieve pageIncrement
*
* @return int|null
*/
public function getPageIncrement()
{
return $this->getDijitParam('pageIncrement');
}
}
Interface.php 0000604 00000002614 15071564417 0007166 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_InfoCard
* @subpackage Zend_InfoCard_Xml
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 9094 2008-03-30 18:36:55Z thomas $
*/
/**
* The Interface used to represent an XML Data Type
*
* @category Zend
* @package Zend_InfoCard
* @subpackage Zend_InfoCard_Xml
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_InfoCard_Xml_Element_Interface
{
/**
* Return the data within the object as an XML document
*/
public function asXML();
/**
* Magic function which allows us to treat the object as a string to return XML
* (same as the asXML() method)
*/
public function __toString();
}
CheckBox.php 0000604 00000012207 15071652640 0006747 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_Dijit */
require_once 'Zend/Dojo/Form/Element/Dijit.php';
/**
* CheckBox dijit
*
* Note: this would be easier with mixins or traits...
*
* @uses Zend_Dojo_Form_Element_Dijit
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CheckBox.php 10001 2008-07-08 21:26:09Z matthew $
*/
class Zend_Dojo_Form_Element_CheckBox extends Zend_Dojo_Form_Element_Dijit
{
/**
* Is the checkbox checked?
* @var bool
*/
public $checked = false;
/**
* Use formCheckbox view helper by default
* @var string
*/
public $helper = 'CheckBox';
/**
* Value when checked
* @var string
*/
protected $_checkedValue = '1';
/**
* Value when not checked
* @var string
*/
protected $_uncheckedValue = '0';
/**
* Current value
* @var string 0 or 1
*/
protected $_value = '0';
/**
* Set options
*
* Intercept checked and unchecked values and set them early; test stored
* value against checked and unchecked values after configuration.
*
* @param array $options
* @return Zend_Form_Element_Checkbox
*/
public function setOptions(array $options)
{
if (array_key_exists('checkedValue', $options)) {
$this->setCheckedValue($options['checkedValue']);
unset($options['checkedValue']);
}
if (array_key_exists('uncheckedValue', $options)) {
$this->setUncheckedValue($options['uncheckedValue']);
unset($options['uncheckedValue']);
}
parent::setOptions($options);
$curValue = $this->getValue();
$test = array($this->getCheckedValue(), $this->getUncheckedValue());
if (!in_array($curValue, $test)) {
$this->setValue($curValue);
}
return $this;
}
/**
* Set value
*
* If value matches checked value, sets to that value, and sets the checked
* flag to true.
*
* Any other value causes the unchecked value to be set as the current
* value, and the checked flag to be set as false.
*
*
* @param mixed $value
* @return Zend_Form_Element_Checkbox
*/
public function setValue($value)
{
if ($value == $this->getCheckedValue()) {
parent::setValue($value);
$this->checked = true;
} else {
parent::setValue($this->getUncheckedValue());
$this->checked = false;
}
return $this;
}
/**
* Set checked value
*
* @param string $value
* @return Zend_Form_Element_Checkbox
*/
public function setCheckedValue($value)
{
$this->_checkedValue = (string) $value;
return $this;
}
/**
* Get value when checked
*
* @return string
*/
public function getCheckedValue()
{
return $this->_checkedValue;
}
/**
* Set unchecked value
*
* @param string $value
* @return Zend_Form_Element_Checkbox
*/
public function setUncheckedValue($value)
{
$this->_uncheckedValue = (string) $value;
return $this;
}
/**
* Get value when not checked
*
* @return string
*/
public function getUncheckedValue()
{
return $this->_uncheckedValue;
}
/**
* Set checked flag
*
* @param bool $flag
* @return Zend_Form_Element_Checkbox
*/
public function setChecked($flag)
{
$this->checked = (bool) $flag;
if ($this->checked) {
$this->setValue($this->getCheckedValue());
} else {
$this->setValue($this->getUncheckedValue());
}
return $this;
}
/**
* Get checked flag
*
* @return bool
*/
public function isChecked()
{
return $this->checked;
}
/**
* Render
*
* Ensure that options property is set when rendering.
*
* @param Zend_View_Interface $view
* @return string
*/
public function render(Zend_View_Interface $view = null)
{
$this->options = array(
'checked' => $this->getCheckedValue(),
'unChecked' => $this->getUncheckedValue(),
);
return parent::render($view);
}
}
RadioButton.php 0000604 00000002536 15071652640 0007517 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_DijitMulti */
require_once 'Zend/Dojo/Form/Element/DijitMulti.php';
/**
* RadioButton dijit
*
* @uses Zend_Dojo_Form_Element_DijitMulti
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: RadioButton.php 10003 2008-07-09 02:40:49Z matthew $
*/
class Zend_Dojo_Form_Element_RadioButton extends Zend_Dojo_Form_Element_DijitMulti
{
/**
* Use RadioButton dijit view helper
* @var string
*/
public $helper = 'RadioButton';
}
NumberSpinner.php 0000604 00000013463 15071652640 0010055 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_ValidationTextBox */
require_once 'Zend/Dojo/Form/Element/ValidationTextBox.php';
/**
* NumberSpinner dijit
*
* @uses Zend_Dojo_Form_Element_ValidationTextBox
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: NumberSpinner.php 10069 2008-07-12 23:48:03Z matthew $
*/
class Zend_Dojo_Form_Element_NumberSpinner extends Zend_Dojo_Form_Element_ValidationTextBox
{
/**
* Use NumberSpinner dijit view helper
* @var string
*/
public $helper = 'NumberSpinner';
/**
* Set defaultTimeout
*
* @param int $timeout
* @return Zend_Dojo_Form_Element_NumberSpinner
*/
public function setDefaultTimeout($timeout)
{
$this->setDijitParam('defaultTimeout', (int) $timeout);
return $this;
}
/**
* Retrieve defaultTimeout
*
* @return int|null
*/
public function getDefaultTimeout()
{
return $this->getDijitParam('defaultTimeout');
}
/**
* Set timeoutChangeRate
*
* @param int $rate
* @return Zend_Dojo_Form_Element_NumberSpinner
*/
public function setTimeoutChangeRate($rate)
{
$this->setDijitParam('timeoutChangeRate', (int) $rate);
return $this;
}
/**
* Retrieve timeoutChangeRate
*
* @return int|null
*/
public function getTimeoutChangeRate()
{
return $this->getDijitParam('timeoutChangeRate');
}
/**
* Set largeDelta
*
* @param int $delta
* @return Zend_Dojo_Form_Element_NumberSpinner
*/
public function setLargeDelta($delta)
{
$this->setDijitParam('largeDelta', (int) $delta);
return $this;
}
/**
* Retrieve largeDelta
*
* @return int|null
*/
public function getLargeDelta()
{
return $this->getDijitParam('largeDelta');
}
/**
* Set smallDelta
*
* @param int $delta
* @return Zend_Dojo_Form_Element_NumberSpinner
*/
public function setSmallDelta($delta)
{
$this->setDijitParam('smallDelta', (int) $delta);
return $this;
}
/**
* Retrieve smallDelta
*
* @return int|null
*/
public function getSmallDelta()
{
return $this->getDijitParam('smallDelta');
}
/**
* Set intermediateChanges flag
*
* @param bool $flag
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setIntermediateChanges($flag)
{
$this->setDijitParam('intermediateChanges', (bool) $flag);
return $this;
}
/**
* Retrieve intermediateChanges flag
*
* @return bool
*/
public function getIntermediateChanges()
{
if (!$this->hasDijitParam('intermediateChanges')) {
return false;
}
return $this->getDijitParam('intermediateChanges');
}
/**
* Set rangeMessage
*
* @param string $message
* @return Zend_Dojo_Form_Element_NumberSpinner
*/
public function setRangeMessage($message)
{
$this->setDijitParam('rangeMessage', (string) $message);
return $this;
}
/**
* Retrieve rangeMessage
*
* @return string|null
*/
public function getRangeMessage()
{
return $this->getDijitParam('rangeMessage');
}
/**
* Set minimum value
*
* @param int $value
* @return Zend_Dojo_Form_Element_NumberSpinner
*/
public function setMin($value)
{
$constraints = array();
if ($this->hasDijitParam('constraints')) {
$constraints = $this->getDijitParam('constraints');
}
$constraints['min'] = (int) $value;
$this->setDijitParam('constraints', $constraints);
return $this;
}
/**
* Get minimum value
*
* @return null|int
*/
public function getMin()
{
if (!$this->hasDijitParam('constraints')) {
return null;
}
$constraints = $this->getDijitParam('constraints');
if (!array_key_exists('min', $constraints)) {
return null;
}
return $constraints['min'];
}
/**
* Set maximum value
*
* @param int $value
* @return Zend_Dojo_Form_Element_NumberSpinner
*/
public function setMax($value)
{
$constraints = array();
if ($this->hasDijitParam('constraints')) {
$constraints = $this->getDijitParam('constraints');
}
$constraints['max'] = (int) $value;
$this->setDijitParam('constraints', $constraints);
return $this;
}
/**
* Get maximum value
*
* @return null|int
*/
public function getMax()
{
if (!$this->hasDijitParam('constraints')) {
return null;
}
$constraints = $this->getDijitParam('constraints');
if (!array_key_exists('max', $constraints)) {
return null;
}
return $constraints['max'];
}
}
CurrencyTextBox.php 0000604 00000006227 15071652640 0010376 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_NumberTextBox */
require_once 'Zend/Dojo/Form/Element/NumberTextBox.php';
/**
* CurrencyTextBox dijit
*
* @uses Zend_Dojo_Form_Element_NumberTextBox
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CurrencyTextBox.php 10079 2008-07-14 10:56:37Z matthew $
*/
class Zend_Dojo_Form_Element_CurrencyTextBox extends Zend_Dojo_Form_Element_NumberTextBox
{
/**
* Use CurrencyTextBox dijit view helper
* @var string
*/
public $helper = 'CurrencyTextBox';
/**
* Set currency
*
* @param string $currency
* @return Zend_Dojo_Form_Element_CurrencyTextBox
*/
public function setCurrency($currency)
{
$this->setDijitParam('currency', (string) $currency);
return $this;
}
/**
* Retrieve currency
*
* @return string|null
*/
public function getCurrency()
{
return $this->getDijitParam('currency');
}
/**
* Set currency symbol
*
* Casts to string, uppercases, and trims to three characters.
*
* @param string $symbol
* @return Zend_Dojo_Form_Element_CurrencyTextBox
*/
public function setSymbol($symbol)
{
$symbol = strtoupper((string) $symbol);
$length = strlen($symbol);
if (3 > $length) {
require_once 'Zend/Form/Element/Exception.php';
throw new Zend_Form_Element_Exception('Invalid symbol provided; please provide ISO 4217 alphabetic currency code');
}
if (3 < $length) {
$symbol = substr($symbol, 0, 3);
}
$this->setConstraint('symbol', $symbol);
return $this;
}
/**
* Retrieve symbol
*
* @return string|null
*/
public function getSymbol()
{
return $this->getConstraint('symbol');
}
/**
* Set whether currency is fractional
*
* @param bool $flag
* @return Zend_Dojo_Form_Element_CurrencyTextBox
*/
public function setFractional($flag)
{
$this->setConstraint('fractional', (bool) $flag);
return $this;
}
/**
* Get whether or not to present fractional values
*
* @return bool
*/
public function getFractional()
{
return ('true' == $this->getConstraint('fractional'));
}
}
Textarea.php 0000604 00000002443 15071652640 0007037 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_Dijit */
require_once 'Zend/Dojo/Form/Element/Dijit.php';
/**
* Textarea dijit
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Textarea.php 10001 2008-07-08 21:26:09Z matthew $
*/
class Zend_Dojo_Form_Element_Textarea extends Zend_Dojo_Form_Element_Dijit
{
/**
* Use Textarea dijit view helper
* @var string
*/
public $helper = 'Textarea';
}
NumberTextBox.php 0000604 00000010040 15071652640 0010020 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_ValidationTextBox */
require_once 'Zend/Dojo/Form/Element/ValidationTextBox.php';
/**
* NumberTextBox dijit
*
* @uses Zend_Dojo_Form_Element_ValidationTextBox
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: NumberTextBox.php 10079 2008-07-14 10:56:37Z matthew $
*/
class Zend_Dojo_Form_Element_NumberTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
{
/**
* Use NumberTextBox dijit view helper
* @var string
*/
public $helper = 'NumberTextBox';
/**
* Allowed numeric type formats
* @var array
*/
protected $_allowedTypes = array(
'decimal',
'scientific',
'percent',
'currency',
);
/**
* Set locale
*
* @param string $locale
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setLocale($locale)
{
$this->setConstraint('locale', (string) $locale);
return $this;
}
/**
* Retrieve locale
*
* @return string|null
*/
public function getLocale()
{
return $this->getConstraint('locale');
}
/**
* Set numeric format pattern
*
* @param string $pattern
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setPattern($pattern)
{
$this->setConstraint('pattern', (string) $pattern);
return $this;
}
/**
* Retrieve numeric format pattern
*
* @return string|null
*/
public function getPattern()
{
return $this->getConstraint('pattern');
}
/**
* Set numeric format type
*
* @see $_allowedTypes
* @param string $type
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setType($type)
{
$type = strtolower($type);
if (!in_array($type, $this->_allowedTypes)) {
require_once 'Zend/Form/Element/Exception.php';
throw new Zend_Form_Element_Exception(sprintf('Invalid numeric type "%s" specified', $type));
}
$this->setConstraint('type', $type);
return $this;
}
/**
* Retrieve type
*
* @return string|null
*/
public function getType()
{
return $this->getConstraint('type');
}
/**
* Set decimal places
*
* @param int $places
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setPlaces($places)
{
$this->setConstraint('places', (int) $places);
return $this;
}
/**
* Retrieve decimal places
*
* @return int|null
*/
public function getPlaces()
{
return $this->getConstraint('places');
}
/**
* Set strict flag
*
* @param bool $strict
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setStrict($flag)
{
$this->setConstraint('strict', (bool) $flag);
return $this;
}
/**
* Retrieve strict flag
*
* @return bool
*/
public function getStrict()
{
if (!$this->hasConstraint('strict')) {
return false;
}
return ('true' == $this->getConstraint('strict'));
}
}
TimeTextBox.php 0000604 00000007617 15071652640 0007506 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_DateTextBox */
require_once 'Zend/Dojo/Form/Element/DateTextBox.php';
/**
* TimeTextBox dijit
*
* @uses Zend_Dojo_Form_Element_DateTextBox
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: TimeTextBox.php 10079 2008-07-14 10:56:37Z matthew $
*/
class Zend_Dojo_Form_Element_TimeTextBox extends Zend_Dojo_Form_Element_DateTextBox
{
/**
* Use TimeTextBox dijit view helper
* @var string
*/
public $helper = 'TimeTextBox';
/**
* Validate ISO 8601 time format
*
* @param string $format
* @return true
* @throws Zend_Form_Element_Exception
*/
protected function _validateIso8601($format)
{
if (!preg_match('/^T\d{2}:\d{2}:\d{2}$/', $format)) {
require_once 'Zend/Form/Element/Exception.php';
throw new Zend_Form_Element_Exception(sprintf('Invalid format "%s" provided; must match T:00:00:00 format', $format));
}
return true;
}
/**
* Set time format pattern
*
* @param string $pattern
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setTimePattern($pattern)
{
$this->setConstraint('timePattern', (string) $pattern);
return $this;
}
/**
* Retrieve time format pattern
*
* @return string|null
*/
public function getTimePattern()
{
return $this->getConstraint('timePattern');
}
/**
* Set clickableIncrement
*
* @param string $format
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setClickableIncrement($format)
{
$format = (string) $format;
$this->_validateIso8601($format);
$this->setConstraint('clickableIncrement', $format);
return $this;
}
/**
* Retrieve clickableIncrement
*
* @return string|null
*/
public function getClickableIncrement()
{
return $this->getConstraint('clickableIncrement');
}
/**
* Set visibleIncrement
*
* @param string $format
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setVisibleIncrement($format)
{
$format = (string) $format;
$this->_validateIso8601($format);
$this->setConstraint('visibleIncrement', $format);
return $this;
}
/**
* Retrieve visibleIncrement
*
* @return string|null
*/
public function getVisibleIncrement()
{
return $this->getConstraint('visibleIncrement');
}
/**
* Set visibleRange
*
* @param string $format
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setVisibleRange($format)
{
$format = (string) $format;
$this->_validateIso8601($format);
$this->setConstraint('visibleRange', $format);
return $this;
}
/**
* Retrieve visibleRange
*
* @return string|null
*/
public function getVisibleRange()
{
return $this->getConstraint('visibleRange');
}
}
Dijit.php 0000604 00000011342 15071652640 0006323 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Form_Element */
require_once 'Zend/Form/Element.php';
/**
* Base element for dijit elements
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Dijit.php 13261 2008-12-15 14:32:20Z matthew $
*/
abstract class Zend_Dojo_Form_Element_Dijit extends Zend_Form_Element
{
/**
* Dijit parameters
* @var array
*/
public $dijitParams = array();
/**
* View helper to use
* @var string
*/
public $helper;
/**
* Constructor
*
* @todo Should we set dojo view helper paths here?
* @param mixed $spec
* @param mixed $options
* @return void
*/
public function __construct($spec, $options = null)
{
$this->addPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'decorator');
parent::__construct($spec, $options);
}
/**
* Set a dijit parameter
*
* @param string $key
* @param mixed $value
* @return Zend_Dojo_Form_Element_Dijit
*/
public function setDijitParam($key, $value)
{
$key = (string) $key;
$this->dijitParams[$key] = $value;
return $this;
}
/**
* Set multiple dijit params at once
*
* @param array $params
* @return Zend_Dojo_Form_Element_Dijit
*/
public function setDijitParams(array $params)
{
$this->dijitParams = array_merge($this->dijitParams, $params);
return $this;
}
/**
* Does the given dijit parameter exist?
*
* @param string $key
* @return bool
*/
public function hasDijitParam($key)
{
return array_key_exists($key, $this->dijitParams);
}
/**
* Get a single dijit parameter
*
* @param string $key
* @return mixed
*/
public function getDijitParam($key)
{
$key = (string) $key;
if ($this->hasDijitParam($key)) {
return $this->dijitParams[$key];
}
return null;
}
/**
* Retrieve all dijit parameters
*
* @return array
*/
public function getDijitParams()
{
return $this->dijitParams;
}
/**
* Remove a single dijit parameter
*
* @param string $key
* @return Zend_Dojo_Form_Element_Dijit
*/
public function removeDijitParam($key)
{
$key = (string) $key;
if (array_key_exists($key, $this->dijitParams)) {
unset($this->dijitParams[$key]);
}
return $this;
}
/**
* Clear all dijit parameters
*
* @return Zend_Dojo_Form_Element_Dijit
*/
public function clearDijitParams()
{
$this->dijitParams = array();
return $this;
}
/**
* Load default decorators
*
* @return void
*/
public function loadDefaultDecorators()
{
if ($this->loadDefaultDecoratorsIsDisabled()) {
return;
}
$decorators = $this->getDecorators();
if (empty($decorators)) {
$this->addDecorator('DijitElement')
->addDecorator('Errors')
->addDecorator('Description', array('tag' => 'p', 'class' => 'description'))
->addDecorator('HtmlTag', array('tag' => 'dd'))
->addDecorator('Label', array('tag' => 'dt'));
}
}
/**
* Set the view object
*
* Ensures that the view object has the dojo view helper path set.
*
* @param Zend_View_Interface $view
* @return Zend_Dojo_Form_Element_Dijit
*/
public function setView(Zend_View_Interface $view = null)
{
if (null !== $view) {
if (false === $view->getPluginLoader('helper')->getPaths('Zend_Dojo_View_Helper')) {
$view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper');
}
}
return parent::setView($view);
}
}
ComboBox.php 0000604 00000010750 15071652640 0006772 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_DijitMulti */
require_once 'Zend/Dojo/Form/Element/DijitMulti.php';
/**
* ComboBox dijit
*
* @uses Zend_Dojo_Form_Element_DijitMulti
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ComboBox.php 10723 2008-08-06 15:30:18Z matthew $
*/
class Zend_Dojo_Form_Element_ComboBox extends Zend_Dojo_Form_Element_DijitMulti
{
/**
* Use ComboBox dijit view helper
* @var string
*/
public $helper = 'ComboBox';
/**
* Flag: autoregister inArray validator?
* @var bool
*/
protected $_registerInArrayValidator = false;
/**
* Get datastore information
*
* @return array
*/
public function getStoreInfo()
{
if (!$this->hasDijitParam('store')) {
$this->dijitParams['store'] = array();
}
return $this->dijitParams['store'];
}
/**
* Set datastore identifier
*
* @param string $identifier
* @return Zend_Dojo_Form_Element_ComboBox
*/
public function setStoreId($identifier)
{
$store = $this->getStoreInfo();
$store['store'] = (string) $identifier;
$this->setDijitParam('store', $store);
return $this;
}
/**
* Get datastore identifier
*
* @return string|null
*/
public function getStoreId()
{
$store = $this->getStoreInfo();
if (array_key_exists('store', $store)) {
return $store['store'];
}
return null;
}
/**
* Set datastore dijit type
*
* @param string $dojoType
* @return Zend_Dojo_Form_Element_ComboBox
*/
public function setStoreType($dojoType)
{
$store = $this->getStoreInfo();
$store['type'] = (string) $dojoType;
$this->setDijitParam('store', $store);
return $this;
}
/**
* Get datastore dijit type
*
* @return string|null
*/
public function getStoreType()
{
$store = $this->getStoreInfo();
if (array_key_exists('type', $store)) {
return $store['type'];
}
return null;
}
/**
* Set datastore parameters
*
* @param array $params
* @return Zend_Dojo_Form_Element_ComboBox
*/
public function setStoreParams(array $params)
{
$store = $this->getStoreInfo();
$store['params'] = $params;
$this->setDijitParam('store', $store);
return $this;
}
/**
* Get datastore params
*
* @return array
*/
public function getStoreParams()
{
$store = $this->getStoreInfo();
if (array_key_exists('params', $store)) {
return $store['params'];
}
return array();
}
/**
* Set autocomplete flag
*
* @param bool $flag
* @return Zend_Dojo_Form_Element_ComboBox
*/
public function setAutocomplete($flag)
{
$this->setDijitParam('autocomplete', (bool) $flag);
return $this;
}
/**
* Get autocomplete flag
*
* @return bool
*/
public function getAutocomplete()
{
if (!$this->hasDijitParam('autocomplete')) {
return false;
}
return $this->getDijitParam('autocomplete');
}
/**
* Is the value valid?
*
* @param string $value
* @param mixed $context
* @return bool
*/
public function isValid($value, $context = null)
{
$storeInfo = $this->getStoreInfo();
if (!empty($storeInfo)) {
$this->setRegisterInArrayValidator(false);
}
return parent::isValid($value, $context);
}
}
DateTextBox.php 0000604 00000012143 15071652640 0007453 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_ValidationTextBox */
require_once 'Zend/Dojo/Form/Element/ValidationTextBox.php';
/**
* DateTextBox dijit
*
* @uses Zend_Dojo_Form_Element_ValidationTextBox
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: DateTextBox.php 10079 2008-07-14 10:56:37Z matthew $
*/
class Zend_Dojo_Form_Element_DateTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
{
/**
* Use DateTextBox dijit view helper
* @var string
*/
public $helper = 'DateTextBox';
/**
* Allowed formatLength types
* @var array
*/
protected $_allowedFormatTypes = array(
'long',
'short',
'medium',
'full',
);
/**
* Allowed selector types
* @var array
*/
protected $_allowedSelectorTypes = array(
'time',
'date',
);
/**
* Set am,pm flag
*
* @param bool $am,pm
* @return Zend_Dojo_Form_Element_DateTextBox
*/
public function setAmPm($flag)
{
$this->setConstraint('am,pm', (bool) $flag);
return $this;
}
/**
* Retrieve am,pm flag
*
* @return bool
*/
public function getAmPm()
{
if (!$this->hasConstraint('am,pm')) {
return false;
}
return ('true' ==$this->getConstraint('am,pm'));
}
/**
* Set strict flag
*
* @param bool $strict
* @return Zend_Dojo_Form_Element_DateTextBox
*/
public function setStrict($flag)
{
$this->setConstraint('strict', (bool) $flag);
return $this;
}
/**
* Retrieve strict flag
*
* @return bool
*/
public function getStrict()
{
if (!$this->hasConstraint('strict')) {
return false;
}
return ('true' == $this->getConstraint('strict'));
}
/**
* Set locale
*
* @param string $locale
* @return Zend_Dojo_Form_Element_DateTextBox
*/
public function setLocale($locale)
{
$this->setConstraint('locale', (string) $locale);
return $this;
}
/**
* Retrieve locale
*
* @return string|null
*/
public function getLocale()
{
return $this->getConstraint('locale');
}
/**
* Set date format pattern
*
* @param string $pattern
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setDatePattern($pattern)
{
$this->setConstraint('datePattern', (string) $pattern);
return $this;
}
/**
* Retrieve date format pattern
*
* @return string|null
*/
public function getDatePattern()
{
return $this->getConstraint('datePattern');
}
/**
* Set numeric format formatLength
*
* @see $_allowedFormatTypes
* @param string $formatLength
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setFormatLength($formatLength)
{
$formatLength = strtolower($formatLength);
if (!in_array($formatLength, $this->_allowedFormatTypes)) {
require_once 'Zend/Form/Element/Exception.php';
throw new Zend_Form_Element_Exception(sprintf('Invalid formatLength "%s" specified', $formatLength));
}
$this->setConstraint('formatLength', $formatLength);
return $this;
}
/**
* Retrieve formatLength
*
* @return string|null
*/
public function getFormatLength()
{
return $this->getConstraint('formatLength');
}
/**
* Set numeric format Selector
*
* @see $_allowedSelectorTypes
* @param string $selector
* @return Zend_Dojo_Form_Element_NumberTextBox
*/
public function setSelector($selector)
{
$selector = strtolower($selector);
if (!in_array($selector, $this->_allowedSelectorTypes)) {
require_once 'Zend/Form/Element/Exception.php';
throw new Zend_Form_Element_Exception(sprintf('Invalid Selector "%s" specified', $selector));
}
$this->setConstraint('selector', $selector);
return $this;
}
/**
* Retrieve selector
*
* @return string|null
*/
public function getSelector()
{
return $this->getConstraint('selector');
}
}
PasswordTextBox.php 0000604 00000002647 15071652640 0010410 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_ValidationTextBox */
require_once 'Zend/Dojo/Form/Element/ValidationTextBox.php';
/**
* ValidationTextBox dijit tied to password input
*
* @uses Zend_Dojo_Form_Element_ValidationTextBox
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: PasswordTextBox.php 10667 2008-08-05 13:00:56Z matthew $
*/
class Zend_Dojo_Form_Element_PasswordTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
{
/**
* Use PasswordTextBox dijit view helper
* @var string
*/
public $helper = 'PasswordTextBox';
}
VerticalSlider.php 0000604 00000013621 15071652640 0010176 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_Slider */
require_once 'Zend/Dojo/Form/Element/Slider.php';
/**
* VerticalSlider dijit
*
* @uses Zend_Dojo_Form_Element_Slider
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: VerticalSlider.php 10012 2008-07-09 20:47:48Z matthew $
*/
class Zend_Dojo_Form_Element_VerticalSlider extends Zend_Dojo_Form_Element_Slider
{
/**
* Use VerticalSlider dijit view helper
* @var string
*/
public $helper = 'VerticalSlider';
/**
* Get left decoration data
*
* @return array
*/
public function getLeftDecoration()
{
if ($this->hasDijitParam('leftDecoration')) {
return $this->getDijitParam('leftDecoration');
}
return array();
}
/**
* Set dijit to use with left decoration
*
* @param mixed $dijit
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setLeftDecorationDijit($dijit)
{
$decoration = $this->getLeftDecoration();
$decoration['dijit'] = (string) $dijit;
$this->setDijitParam('leftDecoration', $decoration);
return $this;
}
/**
* Set container to use with left decoration
*
* @param mixed $container
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setLeftDecorationContainer($container)
{
$decoration = $this->getLeftDecoration();
$decoration['container'] = (string) $container;
$this->setDijitParam('leftDecoration', $decoration);
return $this;
}
/**
* Set labels to use with left decoration
*
* @param array $labels
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setLeftDecorationLabels(array $labels)
{
$decoration = $this->getLeftDecoration();
$decoration['labels'] = array_values($labels);
$this->setDijitParam('leftDecoration', $decoration);
return $this;
}
/**
* Set params to use with left decoration
*
* @param array $params
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setLeftDecorationParams(array $params)
{
$decoration = $this->getLeftDecoration();
$decoration['params'] = $params;
$this->setDijitParam('leftDecoration', $decoration);
return $this;
}
/**
* Set attribs to use with left decoration
*
* @param array $attribs
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setLeftDecorationAttribs(array $attribs)
{
$decoration = $this->getLeftDecoration();
$decoration['attribs'] = $attribs;
$this->setDijitParam('leftDecoration', $decoration);
return $this;
}
/**
* Get right decoration data
*
* @return array
*/
public function getRightDecoration()
{
if ($this->hasDijitParam('rightDecoration')) {
return $this->getDijitParam('rightDecoration');
}
return array();
}
/**
* Set dijit to use with right decoration
*
* @param mixed $dijit
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setRightDecorationDijit($dijit)
{
$decoration = $this->getRightDecoration();
$decoration['dijit'] = (string) $dijit;
$this->setDijitParam('rightDecoration', $decoration);
return $this;
}
/**
* Set container to use with right decoration
*
* @param mixed $container
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setRightDecorationContainer($container)
{
$decoration = $this->getRightDecoration();
$decoration['container'] = (string) $container;
$this->setDijitParam('rightDecoration', $decoration);
return $this;
}
/**
* Set labels to use with right decoration
*
* @param array $labels
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setRightDecorationLabels(array $labels)
{
$decoration = $this->getRightDecoration();
$decoration['labels'] = array_values($labels);
$this->setDijitParam('rightDecoration', $decoration);
return $this;
}
/**
* Set params to use with right decoration
*
* @param array $params
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setRightDecorationParams(array $params)
{
$decoration = $this->getRightDecoration();
$decoration['params'] = $params;
$this->setDijitParam('rightDecoration', $decoration);
return $this;
}
/**
* Set attribs to use with right decoration
*
* @param array $attribs
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setRightDecorationAttribs(array $attribs)
{
$decoration = $this->getRightDecoration();
$decoration['attribs'] = $attribs;
$this->setDijitParam('rightDecoration', $decoration);
return $this;
}
}
Button.php 0000604 00000006055 15071652640 0006540 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_Dijit */
require_once 'Zend/Dojo/Form/Element/Dijit.php';
/**
* Button dijit
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Button.php 10091 2008-07-15 03:46:37Z matthew $
*/
class Zend_Dojo_Form_Element_Button extends Zend_Dojo_Form_Element_Dijit
{
/**
* Use Button dijit view helper
* @var string
*/
public $helper = 'Button';
/**
* Constructor
*
* @param string|array|Zend_Config $spec Element name or configuration
* @param string|array|Zend_Config $options Element value or configuration
* @return void
*/
public function __construct($spec, $options = null)
{
if (is_string($spec) && ((null !== $options) && is_string($options))) {
$options = array('label' => $options);
}
parent::__construct($spec, $options);
}
/**
* 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;
}
/**
* Has this submit button been selected?
*
* @return bool
*/
public function isChecked()
{
$value = $this->getValue();
if (empty($value)) {
return false;
}
if ($value != $this->getLabel()) {
return false;
}
return true;
}
/**
* Default decorators
*
* Uses only 'DijitElement' and 'DtDdWrapper' decorators by default.
*
* @return void
*/
public function loadDefaultDecorators()
{
if ($this->loadDefaultDecoratorsIsDisabled()) {
return;
}
$decorators = $this->getDecorators();
if (empty($decorators)) {
$this->addDecorator('DijitElement')
->addDecorator('DtDdWrapper');
}
}
}
Editor.php 0000604 00000034340 15071652640 0006511 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_Dijit */
require_once 'Zend/Dojo/Form/Element/Dijit.php';
/**
* Editor dijit
*
* @uses Zend_Dojo_Form_Element_Dijit
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_Form_Element_Editor extends Zend_Dojo_Form_Element_Dijit
{
/**
* @var string View helper
*/
public $helper = 'Editor';
/**
* Add a single event to connect to the editing area
*
* @param string $event
* @return Zend_Dojo_Form_Element_Editor
*/
public function addCaptureEvent($event)
{
$event = (string) $event;
$captureEvents = $this->getCaptureEvents();
if (in_array($event, $captureEvents)) {
return $this;
}
$captureEvents[] = (string) $event;
$this->setDijitParam('captureEvents', $captureEvents);
return $this;
}
/**
* Add multiple capture events
*
* @param array $events
* @return Zend_Dojo_Form_Element_Editor
*/
public function addCaptureEvents(array $events)
{
foreach ($events as $event) {
$this->addCaptureEvent($event);
}
return $this;
}
/**
* Overwrite many capture events at once
*
* @param array $events
* @return Zend_Dojo_Form_Element_Editor
*/
public function setCaptureEvents(array $events)
{
$this->clearCaptureEvents();
$this->addCaptureEvents($events);
return $this;
}
/**
* Get all capture events
*
* @return array
*/
public function getCaptureEvents()
{
if (!$this->hasDijitParam('captureEvents')) {
return array();
}
return $this->getDijitParam('captureEvents');
}
/**
* Is a given capture event registered?
*
* @param string $event
* @return bool
*/
public function hasCaptureEvent($event)
{
$captureEvents = $this->getCaptureEvents();
return in_array((string) $event, $captureEvents);
}
/**
* Remove a given capture event
*
* @param string $event
* @return Zend_Dojo_Form_Element_Editor
*/
public function removeCaptureEvent($event)
{
$event = (string) $event;
$captureEvents = $this->getCaptureEvents();
if (false === ($index = array_search($event, $captureEvents))) {
return $this;
}
unset($captureEvents[$index]);
$this->setDijitParam('captureEvents', $captureEvents);
return $this;
}
/**
* Clear all capture events
*
* @return Zend_Dojo_Form_Element_Editor
*/
public function clearCaptureEvents()
{
return $this->removeDijitParam('captureEvents');
}
/**
* Add a single event to the dijit
*
* @param string $event
* @return Zend_Dojo_Form_Element_Editor
*/
public function addEvent($event)
{
$event = (string) $event;
$events = $this->getEvents();
if (in_array($event, $events)) {
return $this;
}
$events[] = (string) $event;
$this->setDijitParam('events', $events);
return $this;
}
/**
* Add multiple events
*
* @param array $events
* @return Zend_Dojo_Form_Element_Editor
*/
public function addEvents(array $events)
{
foreach ($events as $event) {
$this->addEvent($event);
}
return $this;
}
/**
* Overwrite many events at once
*
* @param array $events
* @return Zend_Dojo_Form_Element_Editor
*/
public function setEvents(array $events)
{
$this->clearEvents();
$this->addEvents($events);
return $this;
}
/**
* Get all events
*
* @return array
*/
public function getEvents()
{
if (!$this->hasDijitParam('events')) {
return array();
}
return $this->getDijitParam('events');
}
/**
* Is a given event registered?
*
* @param string $event
* @return bool
*/
public function hasEvent($event)
{
$events = $this->getEvents();
return in_array((string) $event, $events);
}
/**
* Remove a given event
*
* @param string $event
* @return Zend_Dojo_Form_Element_Editor
*/
public function removeEvent($event)
{
$events = $this->getEvents();
if (false === ($index = array_search($event, $events))) {
return $this;
}
unset($events[$index]);
$this->setDijitParam('events', $events);
return $this;
}
/**
* Clear all events
*
* @return Zend_Dojo_Form_Element_Editor
*/
public function clearEvents()
{
return $this->removeDijitParam('events');
}
/**
* Add a single editor plugin
*
* @param string $plugin
* @return Zend_Dojo_Form_Element_Editor
*/
public function addPlugin($plugin)
{
$plugin = (string) $plugin;
$plugins = $this->getPlugins();
if (in_array($plugin, $plugins)) {
return $this;
}
$plugins[] = (string) $plugin;
$this->setDijitParam('plugins', $plugins);
return $this;
}
/**
* Add multiple plugins
*
* @param array $plugins
* @return Zend_Dojo_Form_Element_Editor
*/
public function addPlugins(array $plugins)
{
foreach ($plugins as $plugin) {
$this->addPlugin($plugin);
}
return $this;
}
/**
* Overwrite many plugins at once
*
* @param array $plugins
* @return Zend_Dojo_Form_Element_Editor
*/
public function setPlugins(array $plugins)
{
$this->clearPlugins();
$this->addPlugins($plugins);
return $this;
}
/**
* Get all plugins
*
* @return array
*/
public function getPlugins()
{
if (!$this->hasDijitParam('plugins')) {
return array();
}
return $this->getDijitParam('plugins');
}
/**
* Is a given plugin registered?
*
* @param string $plugin
* @return bool
*/
public function hasPlugin($plugin)
{
$plugins = $this->getPlugins();
return in_array((string) $plugin, $plugins);
}
/**
* Remove a given plugin
*
* @param string $plugin
* @return Zend_Dojo_Form_Element_Editor
*/
public function removePlugin($plugin)
{
$plugins = $this->getPlugins();
if (false === ($index = array_search($plugin, $plugins))) {
return $this;
}
unset($plugins[$index]);
$this->setDijitParam('plugins', $plugins);
return $this;
}
/**
* Clear all plugins
*
* @return Zend_Dojo_Form_Element_Editor
*/
public function clearPlugins()
{
return $this->removeDijitParam('plugins');
}
/**
* Set edit action interval
*
* @param int $interval
* @return Zend_Dojo_Form_Element_Editor
*/
public function setEditActionInterval($interval)
{
return $this->setDijitParam('editActionInterval', (int) $interval);
}
/**
* Get edit action interval; defaults to 3
*
* @return int
*/
public function getEditActionInterval()
{
if (!$this->hasDijitParam('editActionInterval')) {
$this->setEditActionInterval(3);
}
return $this->getDijitParam('editActionInterval');
}
/**
* Set focus on load flag
*
* @param bool $flag
* @return Zend_Dojo_Form_Element_Editor
*/
public function setFocusOnLoad($flag)
{
return $this->setDijitParam('focusOnLoad', (bool) $flag);
}
/**
* Retrieve focus on load flag
*
* @return bool
*/
public function getFocusOnLoad()
{
if (!$this->hasDijitParam('focusOnLoad')) {
return false;
}
return $this->getDijitParam('focusOnLoad');
}
/**
* Set editor height
*
* @param string|int $height
* @return Zend_Dojo_Form_Element_Editor
*/
public function setHeight($height)
{
if (!preg_match('/^\d+(em|px|%)?$/i', $height)) {
require_once 'Zend/Form/Element/Exception.php';
throw new Zend_Form_Element_Exception('Invalid height provided; must be integer or CSS measurement');
}
if (!preg_match('/(em|px|%)$/', $height)) {
$height .= 'px';
}
return $this->setDijitParam('height', $height);
}
/**
* Retrieve height
*
* @return string
*/
public function getHeight()
{
if (!$this->hasDijitParam('height')) {
return '300px';
}
return $this->getDijitParam('height');
}
/**
* Set whether or not to inherit parent's width
*
* @param bool $flag
* @return Zend_Dojo_Form_Element_Editor
*/
public function setInheritWidth($flag)
{
return $this->setDijitParam('inheritWidth', (bool) $flag);
}
/**
* Whether or not to inherit the parent's width
*
* @return bool
*/
public function getInheritWidth()
{
if (!$this->hasDijitParam('inheritWidth')) {
return false;
}
return $this->getDijitParam('inheritWidth');
}
/**
* Set minimum height of editor
*
* @param string|int $minHeight
* @return Zend_Dojo_Form_Element_Editor
*/
public function setMinHeight($minHeight)
{
if (!preg_match('/^\d+(em)?$/i', $minHeight)) {
require_once 'Zend/Form/Element/Exception.php';
throw new Zend_Form_Element_Exception('Invalid minHeight provided; must be integer or CSS measurement');
}
if ('em' != substr($minHeight, -2)) {
$minHeight .= 'em';
}
return $this->setDijitParam('minHeight', $minHeight);
}
/**
* Get minimum height of editor
*
* @return string
*/
public function getMinHeight()
{
if (!$this->hasDijitParam('minHeight')) {
return '1em';
}
return $this->getDijitParam('minHeight');
}
/**
* Add a custom stylesheet
*
* @param string $styleSheet
* @return Zend_Dojo_Form_Element_Editor
*/
public function addStyleSheet($styleSheet)
{
$stylesheets = $this->getStyleSheets();
if (strstr($stylesheets, ';')) {
$stylesheets = explode(';', $stylesheets);
} elseif (!empty($stylesheets)) {
$stylesheets = (array) $stylesheets;
} else {
$stylesheets = array();
}
if (!in_array($styleSheet, $stylesheets)) {
$stylesheets[] = (string) $styleSheet;
}
return $this->setDijitParam('styleSheets', implode(';', $stylesheets));
}
/**
* Add multiple custom stylesheets
*
* @param array $styleSheets
* @return Zend_Dojo_Form_Element_Editor
*/
public function addStyleSheets(array $styleSheets)
{
foreach ($styleSheets as $styleSheet) {
$this->addStyleSheet($styleSheet);
}
return $this;
}
/**
* Overwrite all stylesheets
*
* @param array $styleSheets
* @return Zend_Dojo_Form_Element_Editor
*/
public function setStyleSheets(array $styleSheets)
{
$this->clearStyleSheets();
return $this->addStyleSheets($styleSheets);
}
/**
* Get all stylesheets
*
* @return string
*/
public function getStyleSheets()
{
if (!$this->hasDijitParam('styleSheets')) {
return '';
}
return $this->getDijitParam('styleSheets');
}
/**
* Is a given stylesheet registered?
*
* @param string $styleSheet
* @return bool
*/
public function hasStyleSheet($styleSheet)
{
$styleSheets = $this->getStyleSheets();
$styleSheets = explode(';', $styleSheets);
return in_array($styleSheet, $styleSheets);
}
/**
* Remove a single stylesheet
*
* @param string $styleSheet
* @return Zend_Dojo_Form_Element_Editor
*/
public function removeStyleSheet($styleSheet)
{
$styleSheets = $this->getStyleSheets();
$styleSheets = explode(';', $styleSheets);
if (false !== ($index = array_search($styleSheet, $styleSheets))) {
unset($styleSheets[$index]);
$this->setDijitParam('styleSheets', implode(';', $styleSheets));
}
return $this;
}
/**
* Clear all stylesheets
*
* @return Zend_Dojo_Form_Element_Editor
*/
public function clearStyleSheets()
{
if ($this->hasDijitParam('styleSheets')) {
$this->removeDijitParam('styleSheets');
}
return $this;
}
/**
* Set update interval
*
* @param int $interval
* @return Zend_Dojo_Form_Element_Editor
*/
public function setUpdateInterval($interval)
{
return $this->setDijitParam('updateInterval', (int) $interval);
}
/**
* Get update interval
*
* @return int
*/
public function getUpdateInterval()
{
if (!$this->hasDijitParam('updateInterval')) {
return 200;
}
return $this->getDijitParam('updateInterval');
}
}
ValidationTextBox.php 0000604 00000012361 15071652640 0010672 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_TextBox */
require_once 'Zend/Dojo/Form/Element/TextBox.php';
/**
* ValidationTextBox dijit
*
* @uses Zend_Dojo_Form_Element_TextBox
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ValidationTextBox.php 10079 2008-07-14 10:56:37Z matthew $
*/
class Zend_Dojo_Form_Element_ValidationTextBox extends Zend_Dojo_Form_Element_TextBox
{
/**
* Use ValidationTextBox dijit view helper
* @var string
*/
public $helper = 'ValidationTextBox';
/**
* Set invalidMessage
*
* @param string $message
* @return Zend_Dojo_Form_Element_ValidationTextBox
*/
public function setInvalidMessage($message)
{
$this->setDijitParam('invalidMessage', (string) $message);
return $this;
}
/**
* Retrieve invalidMessage
*
* @return string|null
*/
public function getInvalidMessage()
{
return $this->getDijitParam('invalidMessage');
}
/**
* Set promptMessage
*
* @param string $message
* @return Zend_Dojo_Form_Element_ValidationTextBox
*/
public function setPromptMessage($message)
{
$this->setDijitParam('promptMessage', (string) $message);
return $this;
}
/**
* Retrieve promptMessage
*
* @return string|null
*/
public function getPromptMessage()
{
return $this->getDijitParam('promptMessage');
}
/**
* Set regExp
*
* @param string $regexp
* @return Zend_Dojo_Form_Element_ValidationTextBox
*/
public function setRegExp($regexp)
{
$this->setDijitParam('regExp', (string) $regexp);
return $this;
}
/**
* Retrieve regExp
*
* @return string|null
*/
public function getRegExp()
{
return $this->getDijitParam('regExp');
}
/**
* Set an individual constraint
*
* @param string $key
* @param mixed $value
* @return Zend_Dojo_Form_Element_ValidationTextBox
*/
public function setConstraint($key, $value)
{
$constraints = $this->getConstraints();
$constraints[(string) $key] = $value;
$this->setConstraints($constraints);
return $this;
}
/**
* Set validation constraints
*
* Refer to Dojo dijit.form.ValidationTextBox documentation for valid
* structure.
*
* @param array $constraints
* @return Zend_Dojo_Form_Element_ValidationTextBox
*/
public function setConstraints(array $constraints)
{
array_walk_recursive($constraints, array($this, '_castBoolToString'));
$this->setDijitParam('constraints', $constraints);
return $this;
}
/**
* Is the given constraint set?
*
* @param string $key
* @return bool
*/
public function hasConstraint($key)
{
$constraints = $this->getConstraints();
return array_key_exists((string)$key, $constraints);
}
/**
* Get an individual constraint
*
* @param string $key
* @return mixed
*/
public function getConstraint($key)
{
$key = (string) $key;
if (!$this->hasConstraint($key)) {
return null;
}
return $this->dijitParams['constraints'][$key];
}
/**
* Get constraints
*
* @return array
*/
public function getConstraints()
{
if ($this->hasDijitParam('constraints')) {
return $this->getDijitParam('constraints');
}
return array();
}
/**
* Remove a single constraint
*
* @param string $key
* @return Zend_Dojo_Form_Element_ValidationTextBox
*/
public function removeConstraint($key)
{
$key = (string) $key;
if ($this->hasConstraint($key)) {
unset($this->dijitParams['constraints'][$key]);
}
return $this;
}
/**
* Clear all constraints
*
* @return Zend_Dojo_Form_Element_ValidationTextBox
*/
public function clearConstraints()
{
return $this->removeDijitParam('constraints');
}
/**
* Cast a boolean value to a string
*
* @param mixed $item
* @param string $key
* @return void
*/
protected function _castBoolToString(&$item, $key)
{
if (is_bool($item)) {
$item = ($item) ? 'true' : 'false';
}
}
}
HorizontalSlider.php 0000604 00000013633 15071652640 0010561 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_Slider */
require_once 'Zend/Dojo/Form/Element/Slider.php';
/**
* HorizontalSlider dijit
*
* @uses Zend_Dojo_Form_Element_Slider
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: HorizontalSlider.php 10012 2008-07-09 20:47:48Z matthew $
*/
class Zend_Dojo_Form_Element_HorizontalSlider extends Zend_Dojo_Form_Element_Slider
{
/**
* Use HorizontalSlider dijit view helper
* @var string
*/
public $helper = 'HorizontalSlider';
/**
* Get top decoration data
*
* @return array
*/
public function getTopDecoration()
{
if ($this->hasDijitParam('topDecoration')) {
return $this->getDijitParam('topDecoration');
}
return array();
}
/**
* Set dijit to use with top decoration
*
* @param mixed $dijit
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setTopDecorationDijit($dijit)
{
$decoration = $this->getTopDecoration();
$decoration['dijit'] = (string) $dijit;
$this->setDijitParam('topDecoration', $decoration);
return $this;
}
/**
* Set container to use with top decoration
*
* @param mixed $container
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setTopDecorationContainer($container)
{
$decoration = $this->getTopDecoration();
$decoration['container'] = (string) $container;
$this->setDijitParam('topDecoration', $decoration);
return $this;
}
/**
* Set labels to use with top decoration
*
* @param array $labels
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setTopDecorationLabels(array $labels)
{
$decoration = $this->getTopDecoration();
$decoration['labels'] = array_values($labels);
$this->setDijitParam('topDecoration', $decoration);
return $this;
}
/**
* Set params to use with top decoration
*
* @param array $params
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setTopDecorationParams(array $params)
{
$decoration = $this->getTopDecoration();
$decoration['params'] = $params;
$this->setDijitParam('topDecoration', $decoration);
return $this;
}
/**
* Set attribs to use with top decoration
*
* @param array $attribs
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setTopDecorationAttribs(array $attribs)
{
$decoration = $this->getTopDecoration();
$decoration['attribs'] = $attribs;
$this->setDijitParam('topDecoration', $decoration);
return $this;
}
/**
* Get bottom decoration data
*
* @return array
*/
public function getBottomDecoration()
{
if ($this->hasDijitParam('bottomDecoration')) {
return $this->getDijitParam('bottomDecoration');
}
return array();
}
/**
* Set dijit to use with bottom decoration
*
* @param mixed $dijit
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setBottomDecorationDijit($dijit)
{
$decoration = $this->getBottomDecoration();
$decoration['dijit'] = (string) $dijit;
$this->setDijitParam('bottomDecoration', $decoration);
return $this;
}
/**
* Set container to use with bottom decoration
*
* @param mixed $container
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setBottomDecorationContainer($container)
{
$decoration = $this->getBottomDecoration();
$decoration['container'] = (string) $container;
$this->setDijitParam('bottomDecoration', $decoration);
return $this;
}
/**
* Set labels to use with bottom decoration
*
* @param array $labels
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setBottomDecorationLabels(array $labels)
{
$decoration = $this->getBottomDecoration();
$decoration['labels'] = array_values($labels);
$this->setDijitParam('bottomDecoration', $decoration);
return $this;
}
/**
* Set params to use with bottom decoration
*
* @param array $params
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setBottomDecorationParams(array $params)
{
$decoration = $this->getBottomDecoration();
$decoration['params'] = $params;
$this->setDijitParam('bottomDecoration', $decoration);
return $this;
}
/**
* Set attribs to use with bottom decoration
*
* @param array $attribs
* @return Zend_Dojo_Form_Element_HorizontalSlider
*/
public function setBottomDecorationAttribs(array $attribs)
{
$decoration = $this->getBottomDecoration();
$decoration['attribs'] = $attribs;
$this->setDijitParam('bottomDecoration', $decoration);
return $this;
}
}
FilteringSelect.php 0000604 00000002752 15071652640 0010350 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_ComboBox */
require_once 'Zend/Dojo/Form/Element/ComboBox.php';
/**
* FilteringSelect dijit
*
* @uses Zend_Dojo_Form_Element_ComboBox
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FilteringSelect.php 10723 2008-08-06 15:30:18Z matthew $
*/
class Zend_Dojo_Form_Element_FilteringSelect extends Zend_Dojo_Form_Element_ComboBox
{
/**
* Use FilteringSelect dijit view helper
* @var string
*/
public $helper = 'FilteringSelect';
/**
* Flag: autoregister inArray validator?
* @var bool
*/
protected $_registerInArrayValidator = true;
}
SubmitButton.php 0000604 00000002473 15071652640 0007724 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_Button */
require_once 'Zend/Dojo/Form/Element/Button.php';
/**
* Submit button dijit
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: SubmitButton.php 10621 2008-08-04 00:05:33Z matthew $
*/
class Zend_Dojo_Form_Element_SubmitButton extends Zend_Dojo_Form_Element_Button
{
/**
* Use SubmitButton dijit view helper
* @var string
*/
public $helper = 'SubmitButton';
}
DijitMulti.php 0000604 00000016573 15071652640 0007351 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_Dijit */
require_once 'Zend/Dojo/Form/Element/Dijit.php';
/**
* CheckBox dijit
*
* Note: this would be easier with mixins or traits...
*
* @uses Zend_Dojo_Form_Element_Dijit
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: DijitMulti.php 10646 2008-08-04 20:24:37Z matthew $
*/
abstract class Zend_Dojo_Form_Element_DijitMulti extends Zend_Dojo_Form_Element_Dijit
{
/**
* Array of options for multi-item
* @var array
*/
public $options = array();
/**
* Flag: autoregister inArray validator?
* @var bool
*/
protected $_registerInArrayValidator = true;
/**
* Separator to use between options; defaults to '<br />'.
* @var string
*/
protected $_separator = '<br />';
/**
* Which values are translated already?
* @var array
*/
protected $_translated = array();
/**
* Retrieve separator
*
* @return mixed
*/
public function getSeparator()
{
return $this->_separator;
}
/**
* Set separator
*
* @param mixed $separator
* @return self
*/
public function setSeparator($separator)
{
$this->_separator = $separator;
return $this;
}
/**
* Retrieve options array
*
* @return array
*/
protected function _getMultiOptions()
{
if (null === $this->options || !is_array($this->options)) {
$this->options = array();
}
return $this->options;
}
/**
* Add an option
*
* @param string $option
* @param string $value
* @return Zend_Form_Element_Multi
*/
public function addMultiOption($option, $value = '')
{
$option = (string) $option;
$this->_getMultiOptions();
if (!$this->_translateOption($option, $value)) {
$this->options[$option] = $value;
}
return $this;
}
/**
* Add many options at once
*
* @param array $options
* @return Zend_Form_Element_Multi
*/
public function addMultiOptions(array $options)
{
foreach ($options as $option => $value) {
if (is_array($value)
&& array_key_exists('key', $value)
&& array_key_exists('value', $value)
) {
$this->addMultiOption($value['key'], $value['value']);
} else {
$this->addMultiOption($option, $value);
}
}
return $this;
}
/**
* Set all options at once (overwrites)
*
* @param array $options
* @return Zend_Form_Element_Multi
*/
public function setMultiOptions(array $options)
{
$this->clearMultiOptions();
return $this->addMultiOptions($options);
}
/**
* Retrieve single multi option
*
* @param string $option
* @return mixed
*/
public function getMultiOption($option)
{
$option = (string) $option;
$this->_getMultiOptions();
if (isset($this->options[$option])) {
$this->_translateOption($option, $this->options[$option]);
return $this->options[$option];
}
return null;
}
/**
* Retrieve options
*
* @return array
*/
public function getMultiOptions()
{
$this->_getMultiOptions();
foreach ($this->options as $option => $value) {
$this->_translateOption($option, $value);
}
return $this->options;
}
/**
* Remove a single multi option
*
* @param string $option
* @return bool
*/
public function removeMultiOption($option)
{
$option = (string) $option;
$this->_getMultiOptions();
if (isset($this->options[$option])) {
unset($this->options[$option]);
if (isset($this->_translated[$option])) {
unset($this->_translated[$option]);
}
return true;
}
return false;
}
/**
* Clear all options
*
* @return Zend_Form_Element_Multi
*/
public function clearMultiOptions()
{
$this->options = array();
$this->_translated = array();
return $this;
}
/**
* Set flag indicating whether or not to auto-register inArray validator
*
* @param bool $flag
* @return Zend_Form_Element_Multi
*/
public function setRegisterInArrayValidator($flag)
{
$this->_registerInArrayValidator = (bool) $flag;
return $this;
}
/**
* Get status of auto-register inArray validator flag
*
* @return bool
*/
public function registerInArrayValidator()
{
return $this->_registerInArrayValidator;
}
/**
* Is the value provided valid?
*
* Autoregisters InArray validator if necessary.
*
* @param string $value
* @param mixed $context
* @return bool
*/
public function isValid($value, $context = null)
{
if ($this->registerInArrayValidator()) {
if (!$this->getValidator('InArray')) {
$options = $this->getMultiOptions();
$this->addValidator(
'InArray',
true,
array(array_keys($options))
);
}
}
return parent::isValid($value, $context);
}
/**
* Translate an option
*
* @param string $option
* @param string $value
* @return bool
*/
protected function _translateOption($option, $value)
{
if (!isset($this->_translated[$option])) {
$this->options[$option] = $this->_translateValue($value);
if ($this->options[$option] === $value) {
return false;
}
$this->_translated[$option] = true;
return true;
}
return false;
}
/**
* Translate a value
*
* @param array|string $value
* @return array|string
*/
protected function _translateValue($value)
{
if (is_array($value)) {
foreach ($value as $key => $val) {
$value[$key] = $this->_translateValue($val);
}
return $value;
} else {
if (null !== ($translator = $this->getTranslator())) {
if ($translator->isTranslated($value)) {
return $translator->translate($value);
}
}
return $value;
}
}
}
TextBox.php 0000604 00000007265 15071652640 0006666 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Dojo_Form_Element_Dijit */
require_once 'Zend/Dojo/Form/Element/Dijit.php';
/**
* TextBox dijit
*
* @category Zend
* @package Zend_Dojo
* @subpackage Form_Element
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: TextBox.php 10003 2008-07-09 02:40:49Z matthew $
*/
class Zend_Dojo_Form_Element_TextBox extends Zend_Dojo_Form_Element_Dijit
{
/**
* Use TextBox dijit view helper
* @var string
*/
public $helper = 'TextBox';
/**
* Set lowercase flag
*
* @param bool $lowercase
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setLowercase($flag)
{
$this->setDijitParam('lowercase', (bool) $flag);
return $this;
}
/**
* Retrieve lowercase flag
*
* @return bool
*/
public function getLowercase()
{
if (!$this->hasDijitParam('lowercase')) {
return false;
}
return $this->getDijitParam('lowercase');
}
/**
* Set propercase flag
*
* @param bool $propercase
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setPropercase($flag)
{
$this->setDijitParam('propercase', (bool) $flag);
return $this;
}
/**
* Retrieve propercase flag
*
* @return bool
*/
public function getPropercase()
{
if (!$this->hasDijitParam('propercase')) {
return false;
}
return $this->getDijitParam('propercase');
}
/**
* Set uppercase flag
*
* @param bool $uppercase
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setUppercase($flag)
{
$this->setDijitParam('uppercase', (bool) $flag);
return $this;
}
/**
* Retrieve uppercase flag
*
* @return bool
*/
public function getUppercase()
{
if (!$this->hasDijitParam('uppercase')) {
return false;
}
return $this->getDijitParam('uppercase');
}
/**
* Set trim flag
*
* @param bool $trim
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setTrim($flag)
{
$this->setDijitParam('trim', (bool) $flag);
return $this;
}
/**
* Retrieve trim flag
*
* @return bool
*/
public function getTrim()
{
if (!$this->hasDijitParam('trim')) {
return false;
}
return $this->getDijitParam('trim');
}
/**
* Set maxLength
*
* @param int $length
* @return Zend_Dojo_Form_Element_TextBox
*/
public function setMaxLength($length)
{
$this->setDijitParam('maxLength', (int) $length);
return $this;
}
/**
* Retrieve maxLength
*
* @return int|null
*/
public function getMaxLength()
{
return $this->getDijitParam('maxLength');
}
}