本文整理汇总了PHP中Zend_Form_Element_Text::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Text::setValue方法的具体用法?PHP Zend_Form_Element_Text::setValue怎么用?PHP Zend_Form_Element_Text::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Text
的用法示例。
在下文中一共展示了Zend_Form_Element_Text::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->setMethod('POST');
$defaultArgs = array('disableLoadDefaultDecorators' => true, 'decorators' => array('ViewHelper'));
$identity = $this->getAttrib('user_id');
$user_object = Engine_Api::_()->user()->getUser($identity);
$user_id = new Zend_Form_Element_Hidden('user_id');
$user_id->setValue($identity);
$email = new Zend_Form_Element_Text('email', $defaultArgs);
$email->addValidator('emailAddress', true)->addValidator(new Zend_Validate_Db_NoRecordExists(Engine_Db_Table::getTablePrefix() . 'users', 'email'));
$email->setValue($user_object->email);
$password = new Zend_Form_Element_Password('password', $defaultArgs);
$password->addValidator('stringLength', false, array(6, 32));
$passconf = new User_Form_Element_PasswordConfirm('passconf', $defaultArgs);
//$passconf->addDecorator('ViewHelper');
if ($settings->getSetting('user.signup.username', 1) > 0) {
$username = new Zend_Form_Element_Text('username', $defaultArgs);
$username->setValue($user_object->username);
$username->addValidator('stringLength', true, array(6, 32))->addValidator(new Zend_Validate_Db_NoRecordExists(Engine_Db_Table::getTablePrefix() . 'users', 'username'));
}
$language = new Zend_Form_Element_Select('language', $defaultArgs);
$language->addMultiOptions(array('English', 'post-English'));
$language->setValue($user_object->language_id);
$level_id = new Zend_Form_Element_Select('level_id', $defaultArgs);
$level_id->setValue($user_object->level_id);
$levels = Engine_Api::_()->authorization()->getLevelInfo();
foreach ($levels as $level) {
$level_id->addMultiOption($level['level_id'], $level['title']);
}
$this->addElements(array($user_id, $email, $password, $passconf, $username, $level_id, $language));
}
示例2: frmRetrunIn
public function frmRetrunIn($data = null)
{
$request = Zend_Controller_Front::getInstance()->getRequest();
//$db=new Application_Model_DbTable_DbGlobal();
////////////////////////////////////////////////////////Purchase*****/////////////////////////////////////////////
//get sales or purchase id text
$returnOutValue = $request->getParam('invoice_in');
$returnOutElement = new Zend_Form_Element_Text('invoice_in');
$returnOutElement->setValue($returnOutValue);
$this->addElement($returnOutElement);
$outValue = $request->getParam('invoice_out');
$returnInElement = new Zend_Form_Element_Text('invoice_out');
$returnInElement->setValue($outValue);
$this->addElement($returnInElement);
$startDateValue = $request->getParam('search_start_date');
$startDateElement = new Zend_Form_Element_Text('search_start_date');
$startDateElement->setValue($startDateValue);
$this->addElement($startDateElement);
$endDateValue = $request->getParam('search_end_date');
$endDateElement = new Zend_Form_Element_Text('search_end_date');
$endDateElement->setValue($endDateValue);
$this->addElement($endDateElement);
Application_Form_DateTimePicker::addDateField(array('search_start_date', 'search_end_date'));
return $this;
}
示例3: FrmProCate
public function FrmProCate($frm = null)
{
$db = new Application_Model_DbTable_DbGlobal();
$id_code = new Zend_Form_Element_Text('id_code');
$id_code->setAttribs(array('class' => 'form-control', "readonly" => ""));
$code = table_Model_DbTable_DbTable::getCallteralCode();
$id_code->setValue($code);
$cat_name_en = new Zend_Form_Element_Text("name_en");
$cat_name_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In English', "OnChange" => "GetCatName(1)"));
$cat_name_km = new Zend_Form_Element_Text("name_km");
$cat_name_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In Khmer', "OnChange" => "GetCatName(2)"));
$status = new Zend_Form_Element_Select('status');
$_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
$status->setMultiOptions($_arr_status);
$status->setAttribs(array('class' => 'form-control validate[required]'));
$icon = new Zend_Form_Element_File("icon");
$description = new Zend_Form_Element_Textarea("description");
$this->addElements(array($icon, $status, $cat_name_en, $cat_name_km, $id_code, $description));
if ($frm != "") {
$id_code->setValue($frm["code"]);
$cat_name_en->setValue($frm["name_en"]);
$cat_name_km->setValue($frm["name_km"]);
$status->setValue($frm["status"]);
$description->setValue($frm["description"]);
}
return $this;
}
示例4: __construct
/**
*
* @param mixed $options
*
* @return void
*
*/
public function __construct($options = null)
{
parent::__construct($options = null);
$this->setAction('/default/wished-userbook/search-list')->setMethod('get');
$defaultValue = __("Nom, prénom, email...", "s1b");
// Email element
$searchTermElement = new \Zend_Form_Element_Text("wishedListSearchTerm");
$searchTermElement->class = "input-item";
$searchTermElement->setValue($defaultValue);
$searchTermElement->setAttrib("auto-restore", "");
$searchTermElement->addValidator("stringlength", false, array("min" => 3, "messages" => array(\Zend_Validate_StringLength::TOO_SHORT => __("'%value%' doit faire plus de %min% caractères de long", "s1b"))));
$this->removeAllDecorators($searchTermElement);
// Submit button element
$searchButtonElement = new \Zend_Form_Element_Submit("search");
$searchButtonElement->setOptions(array('label' => __("Rechercher", "s1b")));
$searchButtonElement->class = "button bt-red-m";
$this->removeAllDecorators($searchButtonElement);
// Email default label element
$defaultLabelHidden = new \Zend_Form_Element_Hidden("emailDefaultLabel");
$defaultLabelHidden->setValue($defaultValue);
$defaultLabelHidden->class = "default-value";
$this->removeAllDecorators($defaultLabelHidden);
$this->addElements(array($searchTermElement, $searchButtonElement, $defaultLabelHidden));
$this->removeDecorator("HtmlTag");
}
示例5: FrmProCate
public function FrmProCate($frm = null)
{
$vendor_name = new Zend_Form_Element_Text("vendor_name");
$vendor_name->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'ឈ្មោះអ្នផ្ឌត់ផ្ឌង់'));
$phone = new Zend_Form_Element_Text("phone");
$phone->setAttribs(array('class' => 'validate[required]', 'placeholder' => ''));
$contact = new Zend_Form_Element_Text("contact");
$contact->setAttribs(array('class' => 'validate[required]', 'placeholder' => ''));
$email = new Zend_Form_Element_Text("email");
$email->setAttribs(array('class' => 'validate[required]', 'placeholder' => ''));
$address = new Zend_Form_Element_Textarea("address");
$address->setAttribs(array('class' => '', 'placeholder' => ''));
$status = new Zend_Form_Element_Select('status');
$_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
$status->setMultiOptions($_arr_status);
$status->setAttribs(array('class' => 'form-control validate[required]'));
$this->addElements(array($vendor_name, $phone, $contact, $email, $address, $status));
if ($frm != "") {
$vendor_name->setValue($frm["v_name"]);
$phone->setValue($frm["phone"]);
$contact->setValue($frm["contact_name"]);
$email->setValue($frm["email"]);
$address->setValue($frm["vendor_remark"]);
$status->setValue($frm["is_active"]);
}
return $this;
}
示例6: init
public function init()
{
if (get_class($this) === 'Default_Form_ValueDomain') {
$err = new Zend_Form_Element_Text('err');
$err->setValue('Please use the subclass...')->setAttrib('readonly', true)->setDecorators($this->decorators);
$this->addElement($err);
return;
}
parent::init();
$this->setMethod('post');
$this->addElement('hidden', 'idVD');
$name = new Zend_Form_Element_Text('Name');
$name->setLabel('Name:')->setRequired(true)->addFilters(array('StringTrim'))->setDecorators($this->decorators);
$this->addElement($name);
$dataType = new Zend_Form_Element_Text('Data_type');
$dataType->setLabel('Data_Type:')->setRequired(true)->addFilters(array('StringTrim'))->setDecorators($this->decorators);
$this->addElement($dataType);
$precision = new Zend_Form_Element_Text('Precision');
$precision->setLabel('Precision:')->setRequired(true)->addFilters(array('StringTrim'))->setDecorators($this->decorators);
$this->addElement($precision);
$cd = new Zend_Form_Element_Select('idCD');
$cd->setLabel('Conceptual Domain:')->addMultiOptions($this->_getDependentSelect('Default_Model_ConceptualDomain'))->setDecorators($this->decorators);
$this->addElement($cd);
$uom = new Zend_Form_Element_Select('idUOM');
$uom->setLabel('Unite of Measure:')->addMultiOptions($this->_getDependentSelect('Default_Model_UnitOfMeasure'))->setDecorators($this->decorators);
$this->addElement($uom);
$this->addDisplayGroup(array('Name', 'Data_type', 'Precision', 'idCD', 'idUOM'), 'groups', array("legend" => "Value Domain"));
}
示例7:
function __construct($user)
{
parent::__construct();
$this->setName('Registration');
$this->setMethod('POST');
$this->setAction('/user/update');
$gender = new Zend_Form_Element_Select('gender');
$gender->setLabel('Gender');
$gender->setMultiOptions(array('Male' => 'Male', 'Female' => 'Female'));
$gender->setValue($user->gender);
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email');
$email->setValue($user->email);
$email->setRequired(true);
$email->addValidator('NotEmpty', true);
$email->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
$paymentEmail = new Zend_Form_Element_Text('paymentEmail');
$paymentEmail->setLabel('Payment Email');
$paymentEmail->setRequired(true);
$paymentEmail->addValidator('NotEmpty', true);
$paymentEmail->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
$paymentEmail->setValue($user->paymentEmail);
$countries = new Zend_Form_Element_Select('country');
$countries->setMultiOptions(self::getCountries());
$countries->setLabel('Country');
$countries->addValidator('NotEmpty');
$countries->setValue($user->country);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Update');
$this->addElements(array($gender, $email, $paymentEmail, $countries, $submit));
}
示例8: createDBForm
/** create form */
public function createDBForm()
{
$form = new Zend_Form();
$form->setAction($this->webroot . '/install/step2')->setMethod('post');
$type = new Zend_Form_Element_Hidden('type');
$host = new Zend_Form_Element_Text('host');
$host->setValue('localhost');
$port = new Zend_Form_Element_Text('port');
$port->addValidator('Digits', true);
$unixsocket = new Zend_Form_Element_Text('unix_socket');
$dbname = new Zend_Form_Element_Text('dbname');
$dbname->setRequired(true)->addValidator('NotEmpty', true)->setValue('midas');
$username = new Zend_Form_Element_Text('username');
$username->setRequired(true)->addValidator('NotEmpty', true);
$password = new Zend_Form_Element_Password('password');
$firstname = new Zend_Form_Element_Text('firstname');
$firstname->setRequired(true)->addValidator('NotEmpty', true);
$lastname = new Zend_Form_Element_Text('lastname');
$lastname->setRequired(true)->addValidator('NotEmpty', true);
$email = new Zend_Form_Element_Text('email');
$email->setRequired(true)->addValidator('NotEmpty', true)->addValidator('EmailAddress');
$userpassword1 = new Zend_Form_Element_Password('userpassword1');
$userpassword1->addValidator('NotEmpty', true)->setRequired(true);
$userpassword2 = new Zend_Form_Element_Password('userpassword2');
$userpassword2->addValidator('NotEmpty', true)->setRequired(true);
$gravatar = new Zend_Form_Element_Checkbox('gravatar');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Setup database and account');
$form->addElements(array($type, $host, $port, $unixsocket, $dbname, $username, $password, $firstname, $lastname, $email, $userpassword1, $userpassword2, $gravatar, $submit));
return $form;
}
示例9: init
public function init()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$db = new Application_Model_DbTable_DbGlobal();
/////////////Filter stock/////////////////
$tr = Application_Form_FrmLanguages::getCurrentlanguage();
$nameElement = new Zend_Form_Element_Text('s_name');
$nameValue = $request->getParam('s_name');
$nameElement->setValue($nameValue);
$this->addElement($nameElement);
$phonevalue = $request->getParam('phone');
$phoneElement = new Zend_Form_Element_Text('phone');
$phoneElement->setValue($phonevalue);
$this->addElement($phoneElement);
$rs = $db->getGlobalDb('SELECT LocationId,Name FROM tb_sublocation ORDER BY LocationId DESC ');
$options = array('' => $tr->translate('Please_Select'));
$agentValue = $request->getParam('stock_location');
foreach ($rs as $read) {
$options[$read['LocationId']] = $read['Name'];
}
$sale_agent = new Zend_Form_Element_Select('stock_location');
$sale_agent->setMultiOptions($options);
$sale_agent->setAttribs(array('id' => 'LocationId', 'class' => 'demo-code-language'));
$sale_agent->setValue($agentValue);
$this->addElement($sale_agent);
return $this;
}
示例10: setValue
public function setValue($value)
{
if ($value) {
$date = new Zend_Date($value, $this->_db_format);
return parent::setValue($date->toString($this->_format));
}
}
示例11: __construct
/** The constructor
* @access public
* @param array $options
* @return void
*/
public function __construct(array $options = null)
{
parent::__construct($options);
$this->setName('comments');
$comment_author = new Zend_Form_Element_Text('comment_author');
$comment_author->setLabel('Enter your name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty')->addErrorMessage('Please enter a valid name!')->setDescription('If you are offering us SEO services, you will be added to the akismet spam list.');
$comment_author_email = new Zend_Form_Element_Text('comment_author_email');
$comment_author_email->setLabel('Enter your email address: ')->setRequired(true)->addValidator('EmailAddress')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addErrorMessage('Please enter a valid email address!')->setDescription('* This will not be displayed to the public.');
$comment_author_url = new Zend_Form_Element_Text('comment_author_url');
$comment_author_url->setLabel('Enter your web address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('NotEmpty')->addErrorMessage('Please enter a valid address!')->setDescription('Not compulsory');
$comment_content = new Pas_Form_Element_CKEditor('comment_content');
$comment_content->setLabel('Enter your comment: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'))->addErrorMessage('Please enter something in the comments box!');
$captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'ReCaptcha', 'label' => 'Please fill in this reCaptcha to prove human life exists at your end!', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'privKey' => $this->_privateKey, 'pubKey' => $this->_pubKey, 'theme' => 'clean', 'ssl' => true)));
$hash = new Zend_Form_Element_Hash('csrf');
$hash->setValue($this->_salt)->setTimeout(4800);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large')->setLabel('Submit your query');
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()) {
$this->addElements(array($comment_author, $comment_author_email, $comment_content, $comment_author_url, $captcha, $submit, $hash));
$this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'captcha'), 'details');
$this->details->setLegend('Enter your comments: ');
} else {
$user = $auth->getIdentity();
$comment_author->setValue($user->fullname);
$comment_author_email->setValue($user->email);
$this->addElements(array($comment_author, $comment_author_email, $comment_content, $comment_author_url, $submit, $hash));
$this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_content'), 'details');
$this->details->setLegend('Enter your comments: ');
}
$this->addDisplayGroup(array('submit'), 'buttons');
parent::init();
}
示例12: getAllAsForm
/**
* 一覧をフォーム形式で取得
*/
public function getAllAsForm($delivery_id, $form, $order_id = 0)
{
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$models = $db->fetchAll("SELECT * FROM `dtb_delivery_detail` WHERE `delivery_id` = ? ORDER BY size", $delivery_id);
if (!$models) {
$size_order = $db->fetchAll("SELECT * FROM `dtb_order_detail` WHERE `order_id` = ? ORDER BY size ASC", $order_id);
$models = array();
$total = 0;
foreach ($size_order as $pair) {
$size_delivery = $db->fetchOne("SELECT SUM(`detail`.`quantity`) as quantity \n FROM dtb_delivery delivery, dtb_delivery_detail detail \n WHERE delivery.id = detail.delivery_id AND order_id = ? AND `size` = ? \n GROUP BY size ORDER BY size ASC", array($order_id, $pair['size']));
$pair['quantity'] -= $size_delivery;
$total += $pair['quantity'];
array_push($models, $pair);
}
$form->setDefault('quantity', $total);
$form->setDefault('quantity_ori', $total);
}
foreach ($models as $model) {
$id = $model['id'];
$elem = new Zend_Form_Element_Text("quantity_{$id}");
$elem->setOptions(array('size' => '3', 'onkeyup' => 'sum()', 'style' => 'text-align:right'));
$elem->setValue($model['quantity']);
$form->addElement($elem);
}
return $form;
}
示例13: FrmBrand
public function FrmBrand($frm = null)
{
$db = new Application_Model_DbTable_DbGlobal();
$status = new Zend_Form_Element_Select('status');
$_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
$status->setMultiOptions($_arr_status);
$status->setAttribs(array('class' => 'form-control validate[required]'));
$parent = new Zend_Form_Element_Select("parent_id");
$parent->setAttribs(array('class' => 'select', 'style' => 'width:100%'));
$category = $db->getAllBrand();
if (empty($category)) {
$option_category = array('0' => 'No Brand To Select');
} else {
$option_category = array('0' => 'Choose Brand');
foreach ($category as $row_cat) {
$option_category[$row_cat["brand_id"]] = $row_cat["name_kh"];
}
}
$parent->setMultiOptions($option_category);
$brand_en = new Zend_Form_Element_Text("name_en");
$brand_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Brand Name In English', "OnChange" => "GetBrandName(1)"));
$brand_km = new Zend_Form_Element_Text("name_km");
$brand_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Brand Name In Khmer', "OnChange" => "GetBrandName(2)"));
$icon = new Zend_Form_Element_File("icon");
$this->addElements(array($icon, $status, $brand_en, $brand_km, $parent));
if ($frm != "") {
$parent->setValue($frm["parent_id"]);
$brand_en->setValue($frm["name_en"]);
$brand_km->setValue($frm["name_kh"]);
$status->setValue($frm["status"]);
}
return $this;
}
示例14: renderFormElement
public function renderFormElement()
{
$elm = new Zend_Form_Element_Text($this->getName(), array('label' => $this->getLabel() . ':', 'class' => 'mask'));
$elm->setDescription($this->getDescription());
$elm->setValue($this->getValue());
$elm->setRequired($this->getRequired());
return $elm;
}
示例15: _port
protected function _port()
{
$element = new Zend_Form_Element_Text('port');
$element->setLabel('Port')->addDecorators($this->_decorators)->setRequired(true)->setAttrib('class', 'span2');
$element->setValue(25);
$element->addValidator(new Zend_Validate_Int());
return $element;
}