本文整理汇总了PHP中Zend_Form_Element_Textarea::addDecorator方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Textarea::addDecorator方法的具体用法?PHP Zend_Form_Element_Textarea::addDecorator怎么用?PHP Zend_Form_Element_Textarea::addDecorator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Textarea
的用法示例。
在下文中一共展示了Zend_Form_Element_Textarea::addDecorator方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init($review_id)
{
global $mySession;
$db = new Db();
$airport1_value = "";
$review_date_value = "";
$property_value = "";
$status_value = "";
$review_value = "";
$description_value = "";
$amenityArr = $db->runQuery("select * from " . OWNER_REVIEW . " where review_status = '1' ");
if ($review_id != "") {
$pptyData = $db->runQuery("select guest_name, property_title, review_date, location, review_status, check_in, review, \n\t\t\t\t\t\t\t\t\t " . OWNER_REVIEW . ".rating as rating, headline, comment from " . OWNER_REVIEW . " \n\t\t\t\t\t\t\t\t\t inner join " . PROPERTY . " on " . PROPERTY . ".id = " . OWNER_REVIEW . ".property_id \n\t\t\t\t\t\t\t\t\t where review_id = '" . $review_id . "' ");
$user_value = $pptyData[0]['guest_name'];
$property_value = $pptyData[0]['property_title'];
$review_date_value = date('d-m-Y', strtotime($pptyData[0]['review_date']));
$location_value = $pptyData[0]['location'];
$status_value = $pptyData[0]['review_status'];
$check_in_value = date('d-m-Y', strtotime($pptyData[0]['check_in']));
$rating_value = $pptyData[0]['rating'];
$review_value = $pptyData[0]['review'];
$headline_value = $pptyData[0]['headline'];
$comment_value = $pptyData[0]['comment'];
}
$i = 0;
$full_name = new Zend_Form_Element_Text('full_name');
$full_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter Full Name"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($user_value);
$location = new Zend_Form_Element_Text('location');
$location->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($location_value);
$check_in = new Zend_Form_Element_Text('check_in');
$check_in->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter phone number"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput mws-datepicker required ")->setValue($check_in_value);
$ratingArr = array();
$ratingArr[0]['key'] = "";
$ratingArr[0]['value'] = "- - Select - -";
for ($i = 1; $i <= 10; $i++) {
$ratingArr[$i]['key'] = $i;
$ratingArr[$i]['value'] = $i;
}
$rating = new Zend_Form_Element_Select('rating');
$rating->setRequired(true)->addMultiOptions($ratingArr)->addValidator('NotEmpty', true, array('messages' => "Enter Rating"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($rating_value);
$headline = new Zend_Form_Element_Text('headline');
$headline->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Enter Review Headline"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required reviewHeadline")->setAttrib("maxlength", "100")->setValue($headline_value);
$comment = new Zend_Form_Element_Textarea('comment');
$comment->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "required")->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "300")->setValue($comment_value);
$review = new Zend_Form_Element_Textarea('review');
$review->setRequired(true)->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "required")->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "1000")->addValidator('NotEmpty', true, array('messages' => "Enter Review"))->setValue($review_value);
$statusArr[0]['key'] = "";
$statusArr[0]['value'] = "- - Select - ";
$statusArr[1]['key'] = "0";
$statusArr[1]['value'] = "Disable";
$statusArr[2]['key'] = "1";
$statusArr[2]['value'] = "Enable";
$status = new Zend_Form_Element_Select('status');
$status->setRequired(true)->addMultiOptions($statusArr)->setValue($status_value);
$this->addElements(array($full_name, $location, $check_in, $rating, $headline, $comment, $review, $status));
}
示例2: init
public function init($userId)
{
global $mySession;
$db = new Db();
$full_name_value = "";
$location_value = "";
$check_in_value = "";
$rating_value = "";
$headline_value = "";
$comment_value = "";
$review_value = "";
/*if($userId != "")
{
$userData = $db->runQuery("select * from ".OWNER_REVIEW." where property_id = '".$userId."' ");
if($userData != "" && count($userData) > 0)
{
$full_name_value = $userData[0]['owner_name'];
$location_value = $userData[0]['location'];
$check_in_value = $userData[0]['check_in'];
$rating_value = $userData[0]['rating'];
$headline_value = $userData[0]['headline'];
$comment_value = $userData[0]['comment'];
$review_value = $userData[0]['review'];
}
}*/
$full_name = new Zend_Form_Element_Text('full_name');
$full_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter Full Name"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($full_name_value);
$location = new Zend_Form_Element_Text('location');
$location->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($location_value);
$check_in = new Zend_Form_Element_Text('check_in');
$check_in->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter phone number"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($check_in_value);
$ratingArr = array();
$ratingArr[0]['key'] = "";
$ratingArr[0]['value'] = "- - Select - -";
for ($i = 1; $i <= 10; $i++) {
$ratingArr[$i]['key'] = $i;
$ratingArr[$i]['value'] = $i;
}
$rating = new Zend_Form_Element_Select('rating');
$rating->setRequired(true)->addMultiOptions($ratingArr)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($rating_value);
$headline = new Zend_Form_Element_Text('headline');
$headline->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required reviewHeadline")->setAttrib("maxlength", "100")->setValue($headline_value);
$comment = new Zend_Form_Element_Textarea('comment');
$comment->addDecorator('Errors', array('class' => 'error'))->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "300")->setValue($comment_value);
$review = new Zend_Form_Element_Textarea('review');
$review->setRequired(true)->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "required")->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "1000")->addValidator('NotEmpty', true, array('messages' => "Enter message"))->setValue($review_value);
$step = new Zend_Form_Element_Hidden('step');
$step->setRequired(true)->setValue("8");
/*$check = new Zend_Form_Element_Hidden('check');
$check->setRequired(true)
->setValue($text);*/
$this->addElements(array($full_name, $location, $check_in, $rating, $headline, $comment, $review, $step));
}
示例3: init
public function init($ptyleId)
{
global $mySession;
$db = new Db();
$amenity_value = "";
$description_value = "";
$box1View_value = "";
$box2View_value = "";
$location_status = 0;
//** array used when adding new amenity otherwise in editing next one will be overwritten **//
$locationData = $db->runQuery("select * from " . LOCAL_AREA . " ");
$i = 1;
foreach ($locationData as $value) {
$locationArr[$i]['key'] = $value['local_area_id'];
$locationArr[$i]['value'] = $value['local_area_name'];
$i++;
}
//$box2ViewArr = "";
if ($ptyleId != "") {
$ptyleData = $db->runQuery("select * from " . AMENITY . " where amenity_id ='" . $ptyleId . "'");
$amenity_value = $ptyleData[0]['title'];
$description_value = $ptyleData[0]['description'];
$amenity_status_value = $ptyleData[0]['amenity_status'];
$locations = explode(",", $ptyleData[0]['location_view']);
}
$amenity_name = new Zend_Form_Element_Text('amenity_name');
$amenity_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Amenity Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", '65')->setAttrib("minlength", "3")->setAttrib("tabindex", '1')->setValue($amenity_value);
$description = new Zend_Form_Element_Textarea('description');
$description->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", '100')->setValue($description_value);
$statusArr[0]['key'] = '0';
$statusArr[0]['value'] = 'Disable';
$statusArr[1]['key'] = '1';
$statusArr[1]['value'] = 'Enable';
$amenity_status = new Zend_Form_Element_Select('amenity_status');
$amenity_status->addDecorator('Errors', array('class' => 'error'))->addMultiOptions($statusArr)->setAttrib("class", "mws-textinput required")->setValue($amenity_status_value);
$this->addElements(array($amenity_name, $description, $amenity_status));
}
示例4: init
public function init($newsId)
{
global $mySession;
$db = new Db();
$posted_on_value = "";
$news_value = "";
$subject_value = "";
if ($newsId != "") {
$newsArr = $db->runQuery("select * from " . NEWS . " where news_id ='" . $newsId . "'");
$subject_value = $newsArr[0]['subject'];
$news_value = $newsArr[0]['news_update'];
$posted_on_value = date('m/d/Y', strtotime($newsArr[0]['posted_on']));
}
if ($newsId != "") {
$posted_on = new Zend_Form_Element_Text('posted_on');
$posted_on->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Date is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-datepicker required")->setAttrib("maxlength", '65')->setAttrib("minlength", "3")->setAttrib("tabindex", '1')->setValue($posted_on_value);
$this->addElement($posted_on);
}
$subject = new Zend_Form_Element_Text('subject');
$subject->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Date is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", '65')->setAttrib("minlength", "3")->setAttrib("tabindex", '1')->setValue($subject_value);
$news = new Zend_Form_Element_Textarea('news');
$news->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", '100')->setValue($news_value);
$this->addElements(array($news, $subject));
}
示例5: myInit
public function myInit($cid)
{
global $mySession;
$db = new Db();
$public_name = "";
$description_val = "";
$shippingaddr = "";
$firstname_val = "";
$lastname_val = "";
$address_val = "";
$city_val = "";
$state_val = "";
$zipcode_val = "";
$url_val = "";
$instruction_val = '';
$qur = $db->runquery("SELECT * FROM " . LAUNCHCAMPAIGN . " WHERE campaign_id='" . $cid . "' ");
if ($qur != "" and count($qur) > 0) {
$public_name = $qur[0]['title'];
$url_val = $qur[0]['url'];
$description_val = $qur[0]['description'];
$shippingaddr_val = $qur[0]['new_address'];
}
$url = new Zend_Form_Element_Hidden('url');
$url->setValue($url_val);
$this->addElement($url);
# FORM ELEMENT:camptitle
# TYPE : text
$camptitle = new Zend_Form_Element_Text('camptitle');
$camptitle->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:450px; height:30px;")->setValue($public_name);
# FORM ELEMENT:description
# TYPE : text
$description = new Zend_Form_Element_Textarea('description');
$description->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:450px; height:120px;")->setValue($description_val);
# FORM ELEMENT:check
# TYPE : text
$shippingaddr = new Zend_Form_Element_Checkbox('shippingaddr');
$shippingaddr->setAttrib('onclick', 'opendiv(this.id);');
if ($shippingaddr_val == 1) {
$qur1 = $db->runquery("SELECT * FROM " . SHIPPING_ADDRESS . " WHERE url='" . $url_val . "' ");
//prd($qur1);
if ($qur1 != "" and count($qur1) > 0) {
$firstname_val = $qur1[0]['fname'];
$lastname_val = $qur1[0]['lname'];
$address_val = $qur1[0]['address'];
$city_val = $qur1[0]['city'];
$state_val = $qur1[0]['state'];
$instruction_val = $qur1[0]['instruction'];
$zipcode_val = $qur1[0]['zipcode'];
}
}
$firstname = new Zend_Form_Element_Text('firstname');
$firstname->addValidator('NotEmpty', true, array('messages' => 'First name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
$firstname->setRequired(true);
}
$firstname->setAttrib("style", "width:180px; height:30px;")->setValue($firstname_val);
$this->addElement($firstname);
# FORM ELEMENT:last name
# TYPE : text
$lastname = new Zend_Form_Element_Text('lastname');
$lastname->addValidator('NotEmpty', true, array('messages' => 'Last name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
$lastname->setRequired(true);
}
$lastname->setAttrib("style", "width:180px; height:30px;")->setValue($lastname_val);
$this->addElement($lastname);
# FORM ELEMENT:address
# TYPE : text
$newaddress = new Zend_Form_Element_Text('newaddress');
$newaddress->addValidator('NotEmpty', true, array('messages' => 'Address is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($address_val);
if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
$newaddress->setRequired(true);
}
$this->addElement($newaddress);
# FORM ELEMENT:city
# TYPE : text
$newcity = new Zend_Form_Element_Text('newcity');
$newcity->addValidator('NotEmpty', true, array('messages' => 'City is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress')->setValue($city_val);
if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
$newcity->setRequired(true);
}
$newcity->setAttrib("style", "width:100px; height:30px;");
$this->addElement($newcity);
# FORM ELEMENT:state
# TYPE : text
$StateArr = array();
$StateArr[0]['key'] = "";
$StateArr[0]['value'] = "- - Select State- -";
$StateData = $db->runQuery("select * from " . STATE . " order by state_name");
if ($StateData != "" and count($StateData) > 0) {
$i = 1;
foreach ($StateData as $key => $StateValues) {
$StateArr[$i]['key'] = $StateValues['state_id'];
$StateArr[$i]['value'] = $StateValues['state_name'];
$i++;
}
}
$newstate = new Zend_Form_Element_Select('newstate');
$newstate->addMultiOptions($StateArr)->addValidator('NotEmpty', true, array('messages' => 'State is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setValue($state_val);
if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
//.........这里部分代码省略.........
示例6: initMyForm
public function initMyForm($cid, $cidresume)
{
global $mySession;
$db = new Db();
$title_val = "";
$description_val = "";
$url_val = "";
$camplength_val = "";
$campaign_category_val = '';
if ($mySession->TeeLoggedID != "") {
if ($mySession->camptitl != "" && $mySession->showurl != "") {
//echo "in form with session values"; die;
$title_val = $mySession->camptitl;
$description_val = $mySession->descrip;
$url_val = $mySession->showurl;
$camplength_val = $mySession->camplength;
$campaign_category_val = $mySession->campaign_category;
}
}
if ($cid != "") {
$qur = $db->runquery("SELECT * FROM " . LAUNCHCAMPAIGN . " WHERE campaign_id='" . $cid . "'");
if ($qur != "" and count($qur) > 0) {
//prd($qur);
$title_val = $qur[0]['title'];
$description_val = $qur[0]['description'];
$url_val = $qur[0]['url'];
$camplength_val = $qur[0]['campaign_length'];
$campaign_category_val = $qur[0]['campaign_category'];
}
}
# FORM ELEMENT:camptitle
# TYPE : text
$camptitle = new Zend_Form_Element_Text('camptitle');
$camptitle->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:450px; height:30px;")->setvalue($title_val);
# FORM ELEMENT:description
# TYPE : text
$description = new Zend_Form_Element_Textarea('description');
$description->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:450px; height:120px;")->setvalue($description_val);
$daysArr = array();
$daysArr[1]['key'] = "3";
$daysArr[1]['value'] = "3 Days";
$daysArr[2]['key'] = "7";
$daysArr[2]['value'] = "7 Days";
$daysArr[3]['key'] = "10";
$daysArr[3]['value'] = "10 Days";
$daysArr[4]['key'] = "14";
$daysArr[4]['value'] = "14 Days";
$daysArr[5]['key'] = "21";
$daysArr[5]['value'] = "21 Days";
$no_ofdays = new Zend_Form_Element_Select('no_ofdays');
$no_ofdays->addMultiOptions($daysArr)->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:150px; height:30px;")->setvalue($camplength_val);
# FORM ELEMENT:url
# TYPE : text
if ($cid != "" || $cid != 0) {
$url = new Zend_Form_Element_Text('url');
$url->setRequired(true)->setAttrib('class', 'setgoaltxt')->setAttrib("readonly", "readonly")->setAttrib("style", "width:100px; height:30px;")->setvalue($url_val);
} else {
/*$url= new Zend_Form_Element_Text('url');
$url->setRequired(true)
->addDecorator('Errors', array('class'=>'errmsg'))
->setAttrib('class','setgoaltxt')
->setAttrib("onkeypress","return checkspecchar(event)")
->setAttrib('onkeyup','uniqueurl(this.value)')
->setAttrib("style","width:100px; height:30px;")
->setvalue($url_val);*/
$url = new Zend_Form_Element_Text('url');
$url->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib('onblur', 'uniqueurl(this.value)')->setAttrib("style", "width:100px; height:30px;")->setvalue($url_val);
}
# FORM ELEMENT:check
# TYPE : text
$add_checkbox = new Zend_Form_Element_Checkbox('add_checkbox');
$add_checkbox->setAttrib('onclick', 'opendiv(this.id);');
$newcheckbx = new Zend_Form_Element_Checkbox('newcheckbx');
$newcheckbx->setAttrib('onclick', 'newdivaddr(this.id);');
$firstname = new Zend_Form_Element_Text('firstname');
$firstname->addValidator('NotEmpty', true, array('messages' => 'First name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
$firstname->setRequired(true);
}
$firstname->setAttrib("style", "width:180px; height:30px;");
$this->addElement($firstname);
# FORM ELEMENT:last name
# TYPE : text
$lastname = new Zend_Form_Element_Text('lastname');
$lastname->addValidator('NotEmpty', true, array('messages' => 'Last name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
$lastname->setRequired(true);
}
$lastname->setAttrib("style", "width:180px; height:30px;");
//if(@$_REQUEST['lastname']!="")
// {
// $lastname-> addValidator('Alpha', true)
// ->addDecorator('Errors', array('class'=>'errmsg'))
// ->addErrorMessage('Enter only characters');
// }
$this->addElement($lastname);
# FORM ELEMENT:address
# TYPE : text
$newaddress = new Zend_Form_Element_Text('newaddress');
$newaddress->addValidator('NotEmpty', true, array('messages' => 'Address is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox');
//.........这里部分代码省略.........
示例7: getSaveProductForm
public function getSaveProductForm($id)
{
$form = new Zend_Form();
//get product whitch want update
$productMapper = new Application_Model_ProductMapper();
$product = new Application_Model_Product();
if ($id) {
$product = $productMapper->getProductById($id);
}
// Set the method for the display form to POST
$form->setMethod('post');
$form->setAttribs(array('class' => 'form-horizontal', 'enctype' => 'multipart/form-data'));
$decoratorField = new My_Decorator_Field();
$elements = array();
//Add id hidden field
$input = new Zend_Form_Element_Hidden('id', array('value' => $id));
$elements[] = $input;
// Add name field
$input = new Zend_Form_Element_Text('name', array('required' => true, 'label' => 'Name:', 'id' => 'name', 'placeholder' => 'Type something..', 'value' => $product->getName(), 'class' => 'form-control'));
$input->addValidators(array(new Zend_Validate_Alnum(), new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add category field
$select = new Zend_Form_Element_Select('category_id', array('required' => true, 'label' => 'Category:', 'id' => 'category', 'class' => 'form-control'));
$categoryMapper = new Application_Model_CategoryMapper();
$categories = $categoryMapper->fetchAll();
foreach ($categories as $category) {
$select->addMultiOption($category->getId(), $category->getName());
}
// set selected option
$select->setValue($product->getCategoryId());
$select->addDecorator($decoratorField);
$elements[] = $select;
$currencyMapper = new Application_Model_CurrencyMapper();
$currency = $currencyMapper->getDefaultCurrency();
// Add Price field
$input = new Zend_Form_Element_Text('price', array('required' => true, 'label' => 'Price in ' . $currency->getCode() . ':', 'id' => 'price', 'placeholder' => 'Type something..', 'value' => number_format((double) $product->price, 2), 'class' => 'form-control', 'min' => self::MIN, 'max' => self::MAX, 'step' => 'any', 'type' => 'number'));
$min = new Zend_Validate_LessThan(self::MAX);
$max = new Zend_Validate_GreaterThan(self::MIN);
$input->addValidators(array(new Zend_Validate_Float(), $min, $max, new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
if ($id) {
//Add File field
if ($product->file) {
$input = new Zend_Form_Element('file', array('label' => 'File:', 'id' => 'file', 'class' => 'form-control', 'value' => $product->file));
$input->addDecorator(new My_Decorator_AnchoraFileForm());
$elements[] = $input;
} else {
$input = new Zend_Form_Element_File('file', array('label' => 'File:', 'id' => 'file', 'class' => 'form-control'));
$input->addDecorator($decoratorField);
$elements[] = $input;
}
//Add Image field
if ($product->image) {
$input = new Zend_Form_Element('image', array('label' => 'Image:', 'id' => 'image', 'class' => 'form-control', 'value' => $product->image));
$input->addDecorator(new My_Decorator_ImageForm());
$elements[] = $input;
} else {
$input = new Zend_Form_Element_File('image', array('label' => 'Image:', 'id' => 'image', 'class' => 'form-control'));
$input->addDecorator($decoratorField);
$elements[] = $input;
}
} else {
//Add File field
$input = new Zend_Form_Element_File('file', array('label' => 'File:', 'id' => 'file', 'class' => 'form-control'));
$input->addDecorator($decoratorField);
$elements[] = $input;
//Add Image field
$input = new Zend_Form_Element_File('image', array('label' => 'Image:', 'id' => 'image', 'class' => 'form-control'));
$input->addDecorator($decoratorField);
$elements[] = $input;
}
//Add Description field
$input = new Zend_Form_Element_Textarea('description', array('label' => 'Description:', 'id' => 'description', 'class' => 'form-control', 'value' => $product->description));
$input->addDecorator($decoratorField);
$elements[] = $input;
//Add Submit button
if (!$id) {
$input = new Zend_Form_Element_Submit('submit', array('Label' => ' ', 'class' => 'btn btn-success', 'value' => 'Add New Product'));
} else {
$input = new Zend_Form_Element_Submit('submit', array('Label' => ' ', 'class' => 'btn btn-info', 'value' => 'Update Product'));
}
$input->addDecorator($decoratorField);
$elements[] = $input;
$form->addElements($elements);
$form->addDisplayGroup(array('name', 'category_id', 'price', 'currency_id', 'file', 'image', 'description', 'submit'), 'displgrp', array('legend' => 'Add Products', 'decorators' => array('FormElements', 'Fieldset')));
return $form;
}
示例8: replyForm
/**
* Build replyForm
*
* @return void
*/
protected function replyForm()
{
$this->setName('replyForm')->setElementsBelongTo('replyForm');
$element = new Zend_Form_Element_Text('subject', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setAttribs(array('class' => 'input-title', 'maxlength' => 126, 'tabindex' => 1))->addFilter('StripTags')->addFilter('StringTrim');
$this->addElement($element);
$element = new Zend_Form_Element_Textarea('body', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setRequired(true)->addErrorMessage('Message cannot be empty!')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
$this->addElement($element);
$element = new Zend_Form_Element_Hash('token', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->addErrorMessage('Form must not be resubmitted');
$this->addElement($element);
$element = new Zend_Form_Element_Submit('replySubmit', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setLabel('Post Reply');
$this->addElement($element);
$element = new Zend_Form_Element_Reset('reset', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setLabel('Reset');
$this->addElement($element);
$this->clearDecorators();
$this->addDecorator('FormElements')->addDecorator('Form');
/*
$this->setName('replyForm')
->setElementsBelongTo('replyForm')
->setMethod('post')
->setEnctype('application/x-www-form-urlencoded');
$subject = new Zend_Form_Element_Text('subject');
$subject->setLabel('Post Subject')
->setAttribs(array('class' => 'input-title', 'maxlength' => 126))
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty');
$message = new Zend_Form_Element_Textarea('message');
$message->setLabel('Your Message')
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty');
$posthash = new Zend_Form_Element_Hash('token');
$submit = new Zend_Form_Element_Submit('forumSubmit');
$submit->setLabel('Post Reply');
$this->addElements(array($subject, $message, $posthash, $submit));
*/
}
示例9: init
public function init($ppty_id)
{
global $mySession;
$db = new Db();
$address_value = "";
$telephone_value = "";
$website_value = "";
$master_cal_value = "";
$company_name_value = "";
$agent_name_value = "";
$agent_address_value = "";
$agent_telephone_value = "";
$agent_email_value = "";
$agent_website_value = "";
$direction_property_value = "";
$key_instruction_value = "";
$late_instruction_value = "";
$property_name_value = "";
$emergency_value = "";
if ($ppty_id != "") {
$arrivalValue = $db->runQuery("select * from " . PROPERTY . " where id = '" . $ppty_id . "' ");
$property_name_value = $arrivalValue['0']['property_name'];
$address_value = $arrivalValue['0']['address1'];
$telephone_value = $arrivalValue['0']['telephone'];
$emergency_value = $arrivalValue['0']['emergency_no'];
$website_value = $arrivalValue['0']['website'];
$master_cal_value = $arrivalValue['0']['master_cal_url'];
$company_name_value = $arrivalValue['0']['agent_name'];
$agent_name_value = $arrivalValue['0']['agent_person'];
$agent_address_value = $arrivalValue['0']['agent_address'];
$agent_telephone_value = $arrivalValue['0']['agent_phone'];
$agent_email_value = $arrivalValue['0']['agent_email'];
$agent_website_value = $arrivalValue['0']['agent_website'];
$direction_property_value = $arrivalValue['0']['directions_to_property'];
$key_instruction_value = $arrivalValue['0']['key_instructions'];
$late_instruction_value = $arrivalValue['0']['late_arrival_instruction'];
//$late_instruction_value = $arrivalValue['0']['late_arrival_instruction'];
}
$property_name = new Zend_Form_Element_Text('property_name');
$property_name->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "20")->setValue($property_name_value);
$address = new Zend_Form_Element_Textarea('address');
$address->setAttrib("class", "mws-textinput")->setAttrib("rows", "4")->setAttrib("cols", "30")->setValue($address_value);
$telephone = new Zend_Form_Element_Text('telephone');
$telephone->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput number")->setAttrib("maxlength", "15")->setValue($telephone_value);
$emergency = new Zend_Form_Element_Text('emergency');
$emergency->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput number")->setAttrib("maxlength", "15")->setValue($emergency_value);
$website = new Zend_Form_Element_Text('website');
$website->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput validUrl")->setValue($website_value);
$master_cal = new Zend_Form_Element_Text('master_cal');
$master_cal->setAttrib("class", "mws-textinput validUrl")->setValue($master_cal_value);
////** Agent details **////
/*company name*/
$company_name = new Zend_Form_Element_Text('company_name');
$company_name->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "50")->setValue($company_name_value);
/*agent_name*/
$agent_name = new Zend_Form_Element_Text('agent_name');
$agent_name->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "50")->setValue($agent_name_value);
/*agent_address*/
$agent_address = new Zend_Form_Element_Text('agent_address');
$agent_address->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "200")->setValue($agent_address_value);
/*agent_telephone*/
$agent_telephone = new Zend_Form_Element_Text('agent_telephone');
$agent_telephone->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "200")->setValue($agent_telephone_value);
/*agent_email*/
$agent_email = new Zend_Form_Element_Text('agent_email');
$agent_email->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "200")->setValue($agent_email_value);
/*agent_website*/
$agent_website = new Zend_Form_Element_Text('agent_website');
$agent_website->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput validUrl")->setAttrib("maxlength", "200")->setValue($agent_website_value);
////*** instructions**////
/* directions to the property*/
$direction_property = new Zend_Form_Element_Textarea('direction_property');
$direction_property->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "250")->setValue($direction_property_value);
/* Key Instructions to the property*/
$key_instruction = new Zend_Form_Element_Textarea('key_instruction');
$key_instruction->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "250")->setValue($key_instruction_value);
/* Late Instructions to the Property */
$late_instruction = new Zend_Form_Element_Textarea('late_instruction');
$late_instruction->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "250")->setValue($late_instruction_value);
/* Arrival Instructions to the Property */
$arrival_instruction = new Zend_Form_Element_File('arrival_instruction');
$arrival_instruction->setDestination(SITE_ROOT . 'uploads/instructions/')->addValidator('Extension', false, 'pdf,doc')->addDecorator('Errors', array('class' => 'error'));
$step = new Zend_Form_Element_Hidden('step');
$step->setValue("9");
$this->addElements(array($property_name, $address, $telephone, $emergency, $website, $master_cal, $agent_name, $agent_address, $agent_telephone, $agent_email, $agent_website, $direction_property, $key_instruction, $late_instruction, $arrival_instruction, $company_name, $step));
}
示例10: init
public function init($userId)
{
global $mySession;
$db = new Db();
$full_name_value = "";
$location_value = "";
$check_in_value = "";
$rating_value = "";
$headline_value = "";
$comment_value = "";
$review_value = "";
$ppty_no_value = "";
if ($userId != "") {
$userData = $db->runQuery("select * from " . OWNER_REVIEW . " inner join " . PROPERTY . " on " . PROPERTY . ".id = " . OWNER_REVIEW . ".property_id where property_id = '" . $userId . "' ");
if ($userData != "" && count($userData) > 0) {
$full_name_value = $userData[0]['owner_name'];
$ppty_no_value = $userData[0]['propertycode'];
$location_value = $userData[0]['location'];
$check_in_value = $userData[0]['check_in'];
$rating_value = $userData[0]['rating'];
$headline_value = $userData[0]['headline'];
$comment_value = $userData[0]['comment'];
$review_value = $userData[0]['review'];
}
} else {
$userData = $db->runQuery("select * from " . USERS . " where user_id = '" . $mySession->LoggedUserId . "' ");
$full_name_value = $userData[0]['first_name'];
//$location_value = $userData[0]['address'];
}
// $ppty_no = new Zend_Form_Element_Text('ppty_no');
// $ppty_no->setRequired(true)
// ->addValidator('NotEmpty', true, array('messages' => "Please enter Property number"))
// ->addDecorator('Errors', array('class' => 'error'))
// ->setAttrib("class", "mws-textinput required")
// ->setAttrib("maxlength", "50")
// ->setValue($ppty_no_value);
$new_array = array();
$final_array = array();
$final_array = array("No data found");
$user_id = $mySession->LoggedUserId;
$propert_codes_sql = "SELECT propertycode,(select count(property_id) from booking where user_id = {$user_id} and property_id = b.property_id) as _bcount, (select count(property_id) from review where user_id = {$user_id} and property_id = b.property_id ) as _count, review.*,b.property_id FROM " . BOOKING . " as b\n inner join " . PROPERTY . " on " . PROPERTY . ".id = b.property_id\n left join review on review.property_id = b.property_id and review.user_id = b.user_id\n where b.user_id = " . $user_id . "\n group by b.property_id\n having _bcount > _count or review.property_id is NULL \n ";
//prd($propert_codes_sql);
$propert_codes_arr = $db->runQuery($propert_codes_sql);
// prd($propert_codes_arr);
if (!empty($propert_codes_arr[0])) {
$final_array = array();
foreach ($propert_codes_arr as $p_key => $p_value) {
$final_array[$p_value["propertycode"]] = $p_value["propertycode"];
}
}
// prd($final_array);
$ppty_no = new Zend_Form_Element_Select("ppty_no");
$ppty_no->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please select property code"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setMultiOptions($final_array);
$full_name = new Zend_Form_Element_Text('full_name');
$full_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter Full Name"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("maxlength", "50")->setValue($full_name_value);
$location = new Zend_Form_Element_Text('location');
$location->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($location_value);
$check_in = new Zend_Form_Element_Text('check_in');
$check_in->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter phone number"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput mws-datepicker-forward required")->setValue($check_in_value);
$ratingArr = array();
$ratingArr[0]['key'] = "";
$ratingArr[0]['value'] = "- - Select - -";
for ($i = 1; $i <= 10; $i++) {
$ratingArr[$i]['key'] = $i;
$ratingArr[$i]['value'] = $i;
}
$rating = new Zend_Form_Element_Select('rating');
$rating->setRequired(true)->addMultiOptions($ratingArr)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($rating_value);
$headline = new Zend_Form_Element_Text('headline');
$headline->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required reviewHeadline")->setAttrib("maxlength", "100")->setValue($headline_value);
$comment = new Zend_Form_Element_Textarea('comment');
$comment->addDecorator('Errors', array('class' => 'error'))->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "300")->setValue($comment_value);
$review = new Zend_Form_Element_Textarea('review');
$review->setRequired(true)->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "required")->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "1000")->addValidator('NotEmpty', true, array('messages' => "Enter message"))->setValue($review_value);
$this->addElements(array($ppty_no, $full_name, $location, $check_in, $rating, $headline, $comment, $review));
}
示例11: init
public function init($userId)
{
global $mySession;
$db = new Db();
if ($userId != "") {
$adminData = $db->runQuery("select * from " . USERS . " where user_id='" . $userId . "'");
$first_name_value = $adminData[0]['first_name'];
$last_name_value = $adminData[0]['last_name'];
$email_address_value = $adminData[0]['email_address'];
$old_profile_image_value = $adminData[0]['image'];
$gender_value = $adminData[0]['gender'];
//$dob_value=$adminData[0]['dob'];
$dob_value = changeDate($adminData[0]['dob'], 1);
$location_value = $adminData[0]['location'];
$country_value = $adminData[0]['country'];
$blog_url_value = $adminData[0]['blog_url'];
$website_url_value = $adminData[0]['website_url'];
$about_me_value = $adminData[0]['about_me'];
$occupation_value = $adminData[0]['occupation'];
//$password_value=md5($adminData[0]['password']);
}
$first_name = new Zend_Form_Element_Text('first_name');
$first_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($first_name_value);
$this->addElement($first_name);
$last_name = new Zend_Form_Element_Text('last_name');
$last_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Last Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("onkeypress", "return checknummsp1(event);")->setValue($last_name_value);
$this->addElement($last_name);
$email_address = new Zend_Form_Element_Text('email_address');
$email_address->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email address is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($email_address_value);
$this->addElement($email_address);
if (@$_REQUEST['email_address'] != "") {
$email_address->addValidator('EmailAddress', true)->addErrorMessage('Please enter a valid email address');
}
$old_profile_image = new Zend_Form_Element_Hidden('old_profile_image');
$old_profile_image->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($old_profile_image_value);
$this->addElement($old_profile_image);
$user_pic = new Zend_Form_Element_File('user_pic');
$user_pic->setDestination(SITE_ROOT . 'images/profileimgs/');
if ($userId == "") {
$user_pic->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select a photo.'));
}
$user_pic->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error'))->setValue($image_value);
$this->addElement($user_pic);
$GenderArr = array();
$GenderArr[0]['key'] = "1";
$GenderArr[0]['value'] = "Male";
$GenderArr[1]['key'] = "2";
$GenderArr[1]['value'] = "Female";
$gender = new Zend_Form_Element_Radio('gender');
$gender->addMultiOptions($GenderArr)->setValue($gender_value);
$this->addElement($gender);
$countryArr = array();
$sql = "select * from " . COUNTRIES;
$countryData = $db->runQuery($sql);
$countryArr[0]['key'] = 0;
$countryArr[0]['value'] = "---Select Country---";
$i = 1;
foreach ($countryData as $key => $data) {
$countryArr[$i]['key'] = $data['country_id'];
$countryArr[$i]['value'] = $data['country_name'];
$i++;
}
$country = new Zend_Form_Element_Select('country');
$country->setRequired(true)->addMultiOptions($countryArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'error'))->setValue($country_value);
$this->addElement($country);
$password = new Zend_Form_Element_Text('password');
$password->setAttrib("class", "textInput")->setValue($password_value);
$this->addElement($password);
$cpassword = new Zend_Form_Element_Password('cpassword');
$cpassword->setAttrib("class", "textInput")->setValue($password_value);
$this->addElement($cpassword);
$npassword = new Zend_Form_Element_Password('npassword');
$npassword->setAttrib("class", "textInput")->setValue($password_value);
$this->addElement($npassword);
if (isset($_REQUEST['changePass']) && $userId != "") {
$npassword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Password is required.'))->addDecorator('Errors', array('class' => 'error'));
$cpassword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Confirm password is required.'))->addDecorator('Errors', array('class' => 'error'));
}
$GenderArr = array();
$GenderArr[0]['key'] = "1";
$GenderArr[0]['value'] = "Male";
$GenderArr[1]['key'] = "2";
$GenderArr[1]['value'] = "Female";
$gender = new Zend_Form_Element_Radio('gender');
$gender->addMultiOptions($GenderArr)->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Field is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($gender_value);
$this->addElement($gender);
$location = new Zend_Form_Element_Text('location');
$location->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Location is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($location_value);
$this->addElement($location);
$occupation = new Zend_Form_Element_Text('occupation');
$occupation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Occupation is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($occupation_value);
$this->addElement($occupation);
$about_me = new Zend_Form_Element_Textarea('about_me');
//$about_me->setRequired(true)
//->addValidator('NotEmpty',true,array('messages' =>'Please enter this field.'))
$about_me->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:150px; height:60px;")->setValue($about_me_value);
$this->addElement($about_me);
$blog_url = new Zend_Form_Element_Text('blog_url');
//$blog_url->setRequired(true)
//->addValidator('NotEmpty',true,array('messages' =>'Blog URL is required.'))
//.........这里部分代码省略.........