예제 #1
0
 public function frmSender($data)
 {
     $sender = new Zend_Dojo_Form_Element_ValidationTextBox('sender_name');
     $sender->setAttribs(array("required" => true, "class" => "fullside", "dojoType" => "dijit.form.ValidationTextBox"));
     $sender_tel = new Zend_Dojo_Form_Element_NumberTextBox('tel');
     $sender_tel->setAttribs(array("class" => "fullside", "dojoType" => "dijit.form.ValidationTextBox"));
     $email = new Zend_Dojo_Form_Element_TextBox('email');
     $email->setAttribs(array("class" => "fullside", "dojoType" => "dijit.form.TextBox"));
     $address = new Zend_Dojo_Form_Element_TextBox('address');
     $address->setAttribs(array("class" => "fullside", "dojoType" => "dijit.form.TextBox"));
     $status = new Zend_Dojo_Form_Element_FilteringSelect('status');
     $status->setAttribs(array("class" => "fullside", "dojoType" => "dijit.form.FilteringSelect", "required" => true));
     $_opt = array(1 => "ប្រើប្រាស់", 0 => "មិនប្រើប្រាស់");
     $status->setMultiOptions($_opt);
     $sender_id = new Zend_Form_Element_Hidden('id');
     if (!empty($data)) {
         $sender_id->setValue($data['sender_id']);
         $sender->setValue($data['sender_name']);
         $sender_tel->setValue($data['tel']);
         $email->setValue($data['email']);
         $address->setValue($data['address']);
         $status->setValue($data['status']);
         //print_r($data);
     }
     $this->addElements(array($sender, $sender_tel, $email, $address, $sender_id, $status));
     return $this;
 }
예제 #2
0
 protected function setupHash()
 {
     $this->hidden = new Zend_Form_Element_Hidden(self::HIDDEN_HASH);
     $this->hidden->setValue($this->formName);
     $this->addElements(array($this->hidden));
     $this->hidden->setDecorators($this->getHiddenDecorators());
 }
예제 #3
0
파일: CommentForm.php 프로젝트: jannev/site
 public function __construct($parent = null, $options = null)
 {
     parent::__construct($options);
     $parentId = 0;
     if ($parent != null) {
         $parentId = $parent;
     }
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setName('comment_form');
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     /*						
     $comment_subject = new Zend_Form_Element_Text('comment_subject');
     $comment_subject->setLabel($translate->_("content-view-comment-form-subject"))
     		->setRequired(true)
     		->setAttribs(array(
     			'class' => 'comment_subject'))
     		->addValidators(array(
     			array('NotEmpty', true, array('messages' => array('isEmpty' => 'Tyhjä')))
     		));
     */
     $comment_message = new Zend_Form_Element_Textarea('comment_message');
     $comment_message->setRequired(true)->setAttribs(array('rows' => 10, 'cols' => 58, 'class' => 'comment_textarea'))->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Tyhjä')))));
     $comment_parent = new Zend_Form_Element_Hidden('comment_parent');
     $comment_parent->setValue($parentId)->setAttribs(array('class' => 'comment_subject'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($translate->_("submit"));
     $parent_username = new Zend_Form_Element_Hidden('parent_username');
     $this->addElements(array($comment_message, $comment_parent, $submit, $parent_username));
 }
예제 #4
0
 /**
  *
  * Edit Group form
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditGroup.phtml'))));
     // get group from database
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $group = $request->getParam('name');
     $Profiles = new Application_Model_Profiles();
     $ProfilesMeta = new Application_Model_ProfilesMeta();
     $profile = $Profiles->getProfile($group, false, true);
     $owners_profile = $Profiles->getProfileByField('id', $profile->owner);
     $username_minchars = Zend_Registry::get('config')->get('username_minchars');
     $username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
     // fields
     $id = new Zend_Form_Element_Hidden('id');
     $id->setValue($profile->id);
     $name = new Zend_Form_Element_Text('name');
     $name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Group Name'))->setValue($profile->name)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control');
     $screenname = new Zend_Form_Element_Text('screen_name');
     $screenname->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue($profile->screen_name)->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Screen Name'))->setRequired(true)->setAttrib('class', 'form-control');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($ProfilesMeta->getMetaValue('description', $profile->id))->setLabel($this->translator->translate('About this group'))->setAttrib('class', 'form-control');
     $profile_privacy = new Zend_Form_Element_Select('profile_privacy');
     $profile_privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('group_privacy_array'))->setErrorMessages(array($this->translator->translate('Select group visibility')))->setLabel($this->translator->translate('Select group visibility'))->setRequired(true)->setValue($profile->profile_privacy)->setAttrib('class', 'form-control');
     $is_hidden = new Zend_Form_Element_Checkbox('is_hidden');
     $is_hidden->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($profile->is_hidden) && $profile->is_hidden == 1 ? 1 : 0)->setLabel($this->translator->translate('Remove?'))->setCheckedValue("1")->setUncheckedValue("0");
     $submit = new Zend_Form_Element_Submit('formsubmit');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($id, $name, $screenname, $profile_privacy, $description, $is_hidden, $submit));
     $this->postInit();
 }
예제 #5
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oFormSliderEditId = new Zend_Form_Element_Hidden("slider_edit_id");
     $oFormSliderEditId->setValue(0);
     $oFormSliderEditId->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormSliderEditId);
     $oSliderName = new Zend_Form_Element_Text("name");
     $oSliderName->setLabel("Nazwa slidera:");
     $oSliderName->addValidator(new Zend_Validate_StringLength(array("min" => 3, "max" => 45)));
     $oSliderName->setRequired(TRUE);
     $oSliderName->setAttrib("class", "valid");
     $this->addElement($oSliderName);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Zapisz");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
예제 #6
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oTableName = new Zend_Form_Element_Multiselect("table_name");
     $oTableName->addMultiOptions($this->_aTableName);
     $oTableName->addValidator(new Zend_Validate_InArray(array_keys($this->_aTableName)));
     $oTableName->setRequired(FALSE);
     $oTableName->setLabel("Nazwa tabeli:");
     $oTableName->setAttrib("class", "multiselect");
     $this->addElement($oTableName);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Zapisz");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
예제 #7
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => "flex", 'controller' => 'panel', 'action' => 'form'), 'default');
     $this->setAction($url)->setMethod('post');
     $this->setLegend(sprintf(Zoo::_('Edit %s'), $this->target->name));
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Name')->setRequired(true);
     $name->setDescription('Administration-side identifier');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title');
     $title->setDescription('User-visible title of panel');
     $layout = new Zend_Form_Element_Select('layout');
     $layout->setLabel('Layout');
     $layout->setMultiOptions($this->getLayouts());
     $category = new Zend_Form_Element_Text('category');
     $category->setLabel('Category');
     $category->setDescription('Administration-side grouping');
     $category->setRequired(true);
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setLabel('save')->setOrder(100);
     $this->addElements(array($name, $title, $layout, $category));
     $legend = Zoo::_("Basic options");
     $this->addDisplayGroup(array('name', 'title', 'layout', 'category'), 'block_form', array('legend' => $legend));
     $this->addElement($submit);
     if ($this->target->id > 0) {
         $id_ele = new Zend_Form_Element_Hidden('id');
         $id_ele->setValue(intval($this->target->id));
         $this->addElement($id_ele);
     }
     $this->populate($this->target->toArray());
 }
예제 #8
0
 public function setValue($value)
 {
     if (null === $this->_value) {
         parent::setValue($value);
     }
     return $this;
 }
예제 #9
0
파일: PrivMsgForm.php 프로젝트: jannev/site
 public function __construct($options = null, $data = null)
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setDisableLoadDefaultDecorators(true);
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div'))->addDecorator('Form');
     $this->setName('send_privmsg_form');
     $this->addElementPrefixPath('Oibs_Validators', 'OIBS/Validators/', 'validate');
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $header = new Zend_Form_Element_Text('privmsg_header');
     $header->setLabel($translate->_("privmsg-header"))->setRequired(true)->setAttrib('size', 53)->addValidators(array(array('StringLength', true, array(1, 255, 'messages' => array('stringLengthTooShort' => 'field-too-short', 'stringLengthTooLong' => 'field-too-long')))))->setDecorators(array('PrivMsgTextFieldDecorator'));
     $message = new Zend_Form_Element_Textarea('privmsg_message');
     $message->setLabel($translate->_("privmsg-message"))->setRequired(true)->setAttrib('rows', 6)->setAttrib('cols', 40)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), array('StringLength', true, array(1, 1000, 'messages' => array('stringLengthTooLong' => 'field-too-long'))), new Oibs_Validators_MessageTime('')))->setDecorators(array('PrivMsgMessageDecorator'));
     $charCount = new Oibs_Form_Element_Note('charCount');
     $charCount->setValue("Character limit: 0/1000")->removeDecorator('Label')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'privmsg-charcount', 'class' => 'left'));
     $overlimit = new Oibs_Form_Element_Note('overlimit');
     $overlimit->setValue("Characters over the limit will be cut.")->removeDecorator('Label')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'privmsg-charcount-cut', 'class' => 'left', 'style' => 'display: none'));
     $clear = new Oibs_Form_Element_Note('clear');
     $clear->setValue("")->removeDecorator('Label')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'clear'));
     $sender_id = new Zend_Form_Element_Hidden('privmsg_sender_id');
     $sender_id->setValue($data['sender_id'])->removeDecorator('DtDdWrapper');
     $receiver_id = new Zend_Form_Element_Hidden('privmsg_receiver_id');
     $receiver_id->setValue($data['receiver_id'])->removeDecorator('DtDdWrapper');
     // Form submit buttom form element
     $submit = new Zend_Form_Element_Submit('privmsg_submit');
     $submit->setLabel($translate->_("privmsg-send"))->removeDecorator('DtDdWrapper');
     $this->addElements(array($header, $message, $charCount, $overlimit, $clear, $sender_id, $receiver_id, $submit));
 }
예제 #10
0
 public function addProServiceCategory($data = null)
 {
     $_title = new Zend_Dojo_Form_Element_ValidationTextBox('servicetype_title');
     $_title->setAttribs(array('dojoType' => $this->tvalidate, 'class' => 'fullside', 'required' => 'true'));
     $_tem_desc = new Zend_Dojo_Form_Element_TextBox('item_desc');
     $_tem_desc->setAttribs(array('dojoType' => $this->text, 'required' => 'true', 'class' => 'fullside'));
     $_status = new Zend_Dojo_Form_Element_FilteringSelect('sertype_status');
     $_status->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
     $_status_opt = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $_status->setMultiOptions($_status_opt);
     $_type = new Zend_Dojo_Form_Element_FilteringSelect('ser_type');
     $_status_type = array(1 => $this->tr->translate("SERVICE"), 2 => $this->tr->translate("PROGRAM"));
     $_type->setMultiOptions($_status_type);
     $_type->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
     $_id = new Zend_Form_Element_Hidden('id');
     $_id->setAttribs(array('dojoType' => $this->text));
     if ($data != null) {
         $_id->setValue($data['id']);
         $_title->setValue($data['title']);
         $_tem_desc->setValue($data['item_desc']);
         $_status->setValue($data['status']);
         $_type->setValue($data['type']);
     }
     $this->addElements(array($_title, $_tem_desc, $_status, $_type, $_id));
     return $this;
 }
예제 #11
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setName('process_image_form');
     //$this->setAction($actionUrl);
     /*
     $this->addElementPrefixPath('Oibs_Decorators', 
     						'Oibs/Decorators/',
     						'decorator');
     */
     $this->removeDecorator('DtDdWrapper');
     // Hidden form element elements (values will be set with javascript on processimage.phtml)
     $c_x = new Zend_Form_Element_Hidden('c_x');
     $c_x->setValue('0')->removeDecorator('label')->removeDecorator('HtmlTag');
     $c_y = new Zend_Form_Element_Hidden('c_y');
     $c_y->setValue('0')->removeDecorator('label')->removeDecorator('HtmlTag');
     $c_w = new Zend_Form_Element_Hidden('c_w');
     $c_w->setValue('0')->removeDecorator('label')->removeDecorator('HtmlTag');
     $c_h = new Zend_Form_Element_Hidden('c_h');
     $c_h->setValue('0')->removeDecorator('label')->removeDecorator('HtmlTag');
     // Form submit buttom element
     $submit = new Zend_Form_Element_Submit('sendcoords');
     $submit->setLabel($translate->_("account-processimage-save"));
     // Add elements to form
     $this->addElements(array($c_x, $c_y, $c_w, $c_h, $submit));
 }
예제 #12
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oTranslation = new Zend_Form_Element_Select("translation");
     $oTranslation->setLabel("Tłumaczenie:");
     $oTranslation->setRequired(TRUE)->setAttrib("class", "valid");
     $oTranslation->addMultiOptions($this->_aAllLang);
     $this->addElement($oTranslation);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Dalej");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/lang.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
예제 #13
0
 public function init()
 {
     $this->setMethod('post')->setAttrib('id', 'frmVenta')->setAttrib('style', 'width: 300px;margin:auto;');
     // Producto
     $e = new Zend_Form_Element_Select('id_producto');
     $e->setLabel('Producto');
     $e->setRequired();
     $_producto = new Application_Model_Producto();
     $e->addMultiOption(-1, '--Producto--');
     $e->addMultiOptions($_producto->getComboValues());
     $e->addValidator(new Zend_Validate_InArray($_producto->getComboValidValues()));
     $this->addElement($e);
     // Cantidad
     $e = new Zend_Form_Element_Text('cantidad');
     $e->setLabel('Cantidad');
     $e->setRequired();
     $e->addValidator(new Zend_Validate_Int(new Zend_Locale('US')));
     $e->addValidator(new Zend_Validate_GreaterThan(0));
     $e->addValidator(new Zend_Validate_LessThan(100));
     $this->addElement($e);
     // AddVentaDetalles
     $e = new Zend_Form_Element_Hidden('is_detalle');
     $e->setValue(true);
     $e->setRequired();
     $this->addElement($e);
     //Submit
     $e = new Zend_Form_Element_Submit('submit');
     $e->setLabel('Agregar');
     $this->addElement($e);
 }
예제 #14
0
 public function FrmGeneraljurnal($data = null)
 {
     $Brance = new Zend_Dojo_Form_Element_FilteringSelect('branch_id');
     $Brance->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => true, 'onchange' => 'getJurnalcode();'));
     $db = new Application_Model_DbTable_DbGlobal();
     $rows = $db->getAllBranchName();
     $options = '';
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options[$row['br_id']] = $row['branch_namekh'];
         }
     }
     $rows = $db->getAllBranchName();
     $options = array('' => '---Select Branch---');
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options[$row['br_id']] = $row['branch_namekh'];
         }
     }
     $Brance->setMultiOptions($options);
     $_currency_type = new Zend_Dojo_Form_Element_FilteringSelect('currency_type');
     $_currency_type->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $opt = $db->getVewOptoinTypeByType(15, 1, 3, 1);
     $_currency_type->setMultiOptions($opt);
     $_currency_type->setValue(2);
     $parent = new Zend_Dojo_Form_Element_FilteringSelect('parent');
     $parent->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => true, 'onchange' => 'getAllAccountNameByParents();'));
     $db = new Accounting_Model_DbTable_DbChartaccount();
     $option = $db->getAllchartaccount(3, 1);
     $parent->setMultiOptions($option);
     $Add_Date = new Zend_Dojo_Form_Element_DateTextBox('add_date');
     $Add_Date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => true));
     $Add_Date->setValue(date('Y-m-d'));
     $Account_Number = new Zend_Dojo_Form_Element_TextBox('journal_code');
     $Account_Number->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside', 'readOnly' => 'readOnly', 'required' => 'true'));
     $invoice = new Zend_Dojo_Form_Element_TextBox('invoice');
     $invoice->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside'));
     $Note = new Zend_Dojo_Form_Element_TextBox('note');
     $Note->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside'));
     $Debit = new Zend_Dojo_Form_Element_NumberTextBox('debit');
     $Debit->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 1, 'readonly' => 'readonly'));
     // 		$Debit->setValue(0);
     $Credit = new Zend_Dojo_Form_Element_NumberTextBox('credit');
     $Credit->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 1, 'readonly' => 'readonly'));
     $id = new Zend_Form_Element_Hidden('id');
     if ($data != null) {
         $id->setValue($data['id']);
         $Brance->setValue($data['branch_id']);
         $Account_Number->setValue($data['journal_code']);
         $invoice->setValue($data['receipt_number']);
         $_currency_type->setValue($data['currency_id']);
         $Note->setValue($data['note']);
         $Add_Date->setValue($data['date']);
         $Debit->setValue($data['debit']);
         $Credit->setValue($data['credit']);
     }
     // 		$Credit->setValue(0);
     $this->addElements(array($id, $invoice, $_currency_type, $parent, $Add_Date, $Account_Number, $Note, $Debit, $Credit, $Brance));
     return $this;
 }
예제 #15
0
 public function FrmAddHoliday($_data = null)
 {
     $_holiday_name = new Zend_Dojo_Form_Element_TextBox('holiday_name');
     $_holiday_name->setAttribs(array('dojoType' => $this->tvalidate, 'required' => 'true', 'class' => 'fullside'));
     $_startdate = new Zend_Dojo_Form_Element_DateTextBox('start_date');
     $_startdate->setAttribs(array('dojoType' => $this->date, 'required' => 'true', 'class' => 'fullside', 'onchange' => 'CalculateDate();'));
     $date = date("Y-m-d");
     $_startdate->setValue($date);
     $_enddate = new Zend_Dojo_Form_Element_DateTextBox('end_date');
     $_enddate->setAttribs(array('dojoType' => $this->date, 'required' => 'true', 'class' => 'fullside'));
     $_date = date("Y-m-d");
     $_enddate->setValue($_date);
     $_amount_day = new Zend_Dojo_Form_Element_NumberTextBox('amount_day');
     $_amount_day->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'required' => 'true', 'class' => 'fullside', 'onkeyup' => 'CalculateDate();'));
     $_status = new Zend_Dojo_Form_Element_FilteringSelect('status');
     $_status->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
     $_status_opt = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $_status->setMultiOptions($_status_opt);
     $_id = new Zend_Form_Element_Hidden('id');
     if (!empty($_data)) {
         $_holiday_name->setValue($_data['holiday_name']);
         $_startdate->setValue($_data['start_date']);
         $_amount_day->setValue($_data['amount_day']);
         $_enddate->setValue($_data['end_date']);
         $_status->setValue($_data['status']);
         $_id->setValue($_data['id']);
     }
     $this->addElements(array($_id, $_holiday_name, $_startdate, $_enddate, $_amount_day, $_status));
     return $this;
 }
예제 #16
0
 public function Frmcallecterall($data = null)
 {
     $name_en = new Zend_Dojo_Form_Element_TextBox('title_en');
     $name_en->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside', 'required' => true));
     $name_kh = new Zend_Dojo_Form_Element_TextBox('title_kh');
     $name_kh->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside', 'required' => true));
     $key_code = new Zend_Dojo_Form_Element_NumberTextBox('key_code');
     $key_code->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => true));
     $_display = new Zend_Dojo_Form_Element_FilteringSelect('display_by');
     $_display->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $_display_opt = array(1 => $this->tr->translate("NAME_KHMER"), 2 => $this->tr->translate("NAME_ENGLISH"));
     $_display->setMultiOptions($_display_opt);
     $_arr = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $_status = new Zend_Dojo_Form_Element_FilteringSelect("status");
     $_status->setMultiOptions($_arr);
     $_status->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'required' => 'true', 'missingMessage' => 'Invalid Module!', 'class' => 'fullside'));
     $date_call = new Zend_Dojo_Form_Element_DateTextBox('date');
     $date_call->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => true));
     $date_call->setValue(date('Y-m-d'));
     $_id = new Zend_Form_Element_Hidden('id');
     if ($data != null) {
         $name_en->setValue($data['title_en']);
         $name_kh->setValue($data['title_kh']);
         $_display->setValue($data['displayby']);
         $_status->setValue($data['status']);
         $date_call->setValue($data['date']);
         //$key_code->setValue($data['key_code']);
         $_id->setValue($data['id']);
     }
     $this->addElements(array($name_en, $name_kh, $key_code, $_id, $_display, $_status, $date_call));
     return $this;
 }
예제 #17
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $language = $translate->getLocale();
     $baseurl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $actionUrl = $baseurl . '/' . $language . '/account/fetchpassword';
     $this->setName('fetchpassword_form');
     $this->setAction($actionUrl);
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $mailvalid = new Zend_Validate_EmailAddress();
     $mailvalid->setMessage('email-invalid', Zend_Validate_EmailAddress::INVALID);
     $mailvalid->setMessage('email-invalid-hostname', Zend_Validate_EmailAddress::INVALID_HOSTNAME);
     $mailvalid->setMessage('email-invalid-mx-record', Zend_Validate_EmailAddress::INVALID_MX_RECORD);
     $mailvalid->setMessage('email-dot-atom', Zend_Validate_EmailAddress::DOT_ATOM);
     $mailvalid->setMessage('email-quoted-string', Zend_Validate_EmailAddress::QUOTED_STRING);
     $mailvalid->setMessage('email-invalid-local-part', Zend_Validate_EmailAddress::INVALID_LOCAL_PART);
     $mailvalid->setMessage('email-length-exceeded', Zend_Validate_EmailAddress::LENGTH_EXCEEDED);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-hostname', Zend_Validate_Hostname::INVALID_HOSTNAME);
     $mailvalid->hostnameValidator->setMessage('hostname-local-name-not-allowed', Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED);
     $mailvalid->hostnameValidator->setMessage('hostname-unknown-tld', Zend_Validate_Hostname::UNKNOWN_TLD);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-local-name', Zend_Validate_Hostname::INVALID_LOCAL_NAME);
     $mailvalid->hostnameValidator->setMessage('hostname-undecipherable-tld', Zend_Validate_Hostname::UNDECIPHERABLE_TLD);
     // Username input form element
     $username = new Zend_Form_Element_Text('email');
     $username->setLabel($translate->_("account-fetchpassword-email"))->removeDecorator('DtDdWrapper')->addFilter('StringtoLower')->setRequired(true)->addValidators(array($mailvalid))->setDecorators(array('FetchPasswordDecorator'));
     $hidden = new Zend_Form_Element_Hidden('submittedform');
     $hidden->setValue('fetchpassword');
     // Form submit buttom element
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($translate->_("account-fetchpassword-submit"))->removeDecorator('DtDdWrapper')->setAttrib('class', 'fetchpassword-submit left');
     // Add elements to form
     $this->addElements(array($username, $submit, $hidden));
 }
예제 #18
0
 function getForm()
 {
     $form = new Cible_Form(array('disabledDefaultActions' => true));
     $base_dir = $this->getFrontController()->getBaseUrl();
     $redirect = str_replace($base_dir, '', $this->_request->getParam('redirect'));
     $form->setAction("{$base_dir}/auth/login")->setMethod('post');
     $form->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
     $form->setAttrib('class', 'auth-form');
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel(Cible_Translation::getCibleText('form_label_username'));
     $username->setRequired(true);
     $username->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('error_field_required'))));
     $username->setAttrib('class', 'loginTextInput');
     $username->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'username')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'openOnly' => true))));
     $form->addElement($username);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel(Cible_Translation::getCibleText('form_label_password'));
     $password->setRequired(true);
     $password->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('error_field_required'))));
     $password->setAttrib('class', 'loginTextInput');
     $password->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'password')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'closeOnly' => true))));
     $form->addElement($password);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel(Cible_Translation::getCibleText('button_authenticate'))->setAttrib('class', 'loginButton')->setAttrib('onmouseover', 'this.className=\'loginButtonOver\';')->setAttrib('onmouseout', 'this.className=\'loginButton\';')->removeDecorator('label')->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => '2', 'align' => 'right', 'class' => 'submit')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $form->addElement($submit);
     $redirect_hidden = new Zend_Form_Element_Hidden('redirect');
     $redirect_hidden->setValue($redirect)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => '2')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $form->addElement($redirect_hidden);
     return $form;
 }
예제 #19
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $moduleID = -1;
     $moduleName = '';
     if (!empty($options['moduleID'])) {
         $moduleID = $options['moduleID'];
         $moduleName = Cible_FunctionsModules::getModuleNameByID($moduleID);
     }
     // input text for the title of the text module
     $categoryTitle = new Zend_Form_Element_Text('Title');
     $categoryTitle->setLabel($this->getView()->getCibleText('form_category_title_label') . '*')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->_view->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput');
     $this->addElement($categoryTitle);
     $categoryDescription = new Zend_Form_Element_Text('WordingShowAllRecords');
     $categoryDescription->setLabel($this->_view->getCibleText('form_category_view_all_label'));
     $this->addElement($categoryDescription);
     $views = Cible_FunctionsCategories::getCategoryViews($moduleID);
     foreach ($views as $view) {
         $pickerName = $view['MV_Name'];
         $controllerName = new Zend_Form_Element_Text("{$pickerName}_controllerName");
         $controllerName->setLabel($this->getView()->getCibleText("form_select_option_view_{$moduleName}_{$pickerName}"))->setAttrib('onfocus', "openPagePicker('page-picker-{$pickerName}');");
         $this->addElement($controllerName);
         $pagePicker = new Cible_Form_Element_PagePicker("{$pickerName}_pageID", array('associatedElement' => "{$pickerName}_controllerName", 'onclick' => "javascript:closePagePicker(\"page-picker-{$pickerName}\")"));
         $pagePicker->setLabel($this->_view->getCibleText('form_category_associated_page_label'));
         $pagePicker->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => "page-picker", 'id' => "page-picker-{$pickerName}"))));
         $this->addElement($pagePicker);
     }
     $module = new Zend_Form_Element_Hidden('ModuleID');
     $module->setValue($moduleID)->removeDecorator('label')->removeDecorator('DtDdWrapper');
     $this->addElement($module);
 }
예제 #20
0
 public function myInit()
 {
     global $mySession;
     $db = new Db();
     $public_name = "";
     $emailid_val = "";
     $bio_value = '';
     $old_profile_image_value = '';
     $qur = $db->runquery("SELECT * FROM  " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
     if ($qur != "" and count($qur) > 0) {
         $public_name = $qur[0]['public_name'];
         $emailid_val = $qur[0]['emailid'];
         $bio_value = $qur[0]['bio'];
         $old_profile_image_value = $qur[0]['profile_image'];
     }
     $publicname = new Zend_Form_Element_Text('publicname');
     $publicname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Public name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($public_name);
     $bio = new Zend_Form_Element_Textarea('bio');
     $bio->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Bio is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "changepasstextarea")->setAttrib("style", "height:150px;width:354px;")->setAttrib("maxlength", "300")->setAttrib("placeholder", "Max 300 Characters")->setValue($bio_value);
     $profile_image = new Zend_Form_Element_File('profile_image');
     $profile_image->setDestination(SITE_ROOT . 'images/profileimages/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "textInput")->setAttrib("style", "width:325px");
     $old_profile_image = new Zend_Form_Element_Hidden('old_profile_image');
     $old_profile_image->setValue($old_profile_image_value);
     $emailid = new Zend_Form_Element_Text('emailid');
     $emailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email Id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($emailid_val);
     $this->addElements(array($publicname, $emailid, $bio, $profile_image, $old_profile_image));
 }
예제 #21
0
 public function myInit($Id)
 {
     global $mySession;
     $db = new Db();
     if ($Id != "") {
         $adminData = $db->runQuery("select * from " . TSHIRT_ICONS . " where id='" . $Id . "'");
         $title_value = $adminData[0]['title'];
         $oldicon_value = $adminData[0]['icon'];
         $colorcode_value = $adminData[0]['colorcode'];
     } else {
         $title_value = '';
         $oldicon_value = '';
         $colorcode_value = '';
     }
     $title = new Zend_Form_Element_Text('title');
     $title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($title_value);
     $colorcode = new Zend_Form_Element_Text('colorcode');
     $colorcode->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please enter color code.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "Expandable mws-textinput required")->setAttrib("onkeypress", "return checknummspK(event)")->setValue($colorcode_value);
     $this->addElement($colorcode);
     $this->addElement($title);
     if ($Id == "") {
         $image = new Zend_Form_Element_File('image');
         $image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select an icon.'))->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error'));
     } else {
         $image = new Zend_Form_Element_File('image');
         $image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox");
     }
     $this->addElement($image);
     if ($Id != "") {
         $oldicon = new Zend_Form_Element_Hidden('oldicon');
         $oldicon->setValue($oldicon_value);
         $this->addElement($oldicon);
         $this->addElement("hidden", "foo", array("decorators" => array(array(array("img" => "HtmlTag"), array("tag" => "img", "openOnly" => true, "src" => IMAGES_URL . 'tshirt-icons/' . $oldicon_value, "align" => "middle", "class" => "myClass", "style" => "max-width:200px;max-height:200px;")), array("ViewHelper"), array(array("span" => "HtmlTag"), array("tag" => "span", "class" => "myElement", "style" => "text-align:center;display:block;")))));
     }
 }
예제 #22
0
 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));
 }
예제 #23
0
파일: Login.php 프로젝트: nuxwin/i-PMS
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $this->setName('loginForm');
     $this->setElementsBelongTo('loginForm');
     $element = new Zend_Form_Element_Text('username');
     $element->setLabel('Username')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $this->addElement($element);
     $element = new Zend_Form_Element_Password('password');
     $element->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $this->addElement($element);
     $element = new Zend_Form_Element_Checkbox('rememberMe');
     $element->setLabel('Remember me');
     $this->addElement($element);
     /**
      * @var $request Zend_Controller_Request_Http
      */
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $element = new Zend_Form_Element_Hidden('redirect');
     $element->setValue($request->getParam('from', '/'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $element->getDecorator('HtmlTag')->setOption('class', 'hidden');
     $element->getDecorator('Label')->setOption('tagClass', 'hidden');
     $this->addElement($element);
     $element = new Zend_Form_Element_Submit('submit');
     $element->setLabel('Connection');
     $this->addElement($element);
 }
예제 #24
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oBBarcode = new Zend_Form_Element_Text("bbarcode_id");
     $oBBarcode->setLabel("Numer karty bibliotecznej:")->setFilters($this->_aFilters);
     $oBBarcode->addValidator(new AppCms2_Validate_BBarcode());
     $oBBarcode->addValidator(new Zend_Validate_Digits());
     $oBBarcode->setRequired(TRUE);
     $oBBarcode->setAttrib("class", "valid");
     $this->addElement($oBBarcode);
     $oSubmit = new Zend_Form_Element_Submit("submit_get_sybase_user_param");
     $oSubmit->setLabel("Pobierz");
     $this->addElement($oSubmit);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
예제 #25
0
파일: EditPassword.php 프로젝트: valizr/MMA
 function editUserPassword()
 {
     $this->setMethod('post');
     $this->addAttribs(array('id' => 'formAccountEditPassword', 'class' => ''));
     $filters = array(new Zend_Filter_StringTrim(), new Zend_Filter_StripTags());
     $control = new Zend_Form_Element_Hidden('control');
     $control->setValue('editPassword');
     $this->addElement($control);
     $oldPassword = new Zend_Form_Element_Password('oldPassword');
     $oldPassword->setLabel('Old password');
     $oldPassword->addValidator(new Zend_Validate_StringLength(6, 32));
     $oldPassword->setAttribs(array('class' => 'text validate[required,minSize[6],maxSize[32]] rightAdd', 'minlenght' => '6', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'data-prompt-position' => 'topLeft:0'));
     $oldPassword->setRequired(true);
     $this->addElement($oldPassword);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel(Zend_Registry::get('translate')->_('admin_administrators_new_password'));
     $password->addValidator(new Zend_Validate_StringLength(6, 32));
     $password->setAttribs(array('class' => 'text validate[required] rightAdd', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'ondrop' => 'return false', 'onpaste' => 'return false'));
     $password->setRequired(true);
     $this->addElement($password);
     $retypePassword = new Zend_Form_Element_Password('retypePassword');
     $retypePassword->setLabel(Zend_Registry::get('translate')->_('admin_administrators_retype_new_password'));
     $retypePassword->addValidator(new Zend_Validate_Identical('password'));
     $retypePassword->addValidator(new Zend_Validate_StringLength(6, 32));
     $retypePassword->setAttribs(array('class' => 'text validate[required] rightAdd', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'ondrop' => 'return false', 'onpaste' => 'return false'));
     $retypePassword->setRequired(true);
     $retypePassword->setIgnore(true);
     $this->addElement($retypePassword);
     $submit = new Zend_Form_Element_Submit('savePassword');
     $submit->setValue(Zend_Registry::get('translate')->_('apply_password'));
     $submit->setAttribs(array('class' => 'submit tsSubmitLogin fL'));
     $submit->setIgnore(true);
     $this->addElement($submit);
     $this->setElementFilters($filters);
 }
예제 #26
0
 /**
  *
  * Edit Album form
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditAlbum.phtml'))));
     // get group from database
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $album_id = $request->getParam('id');
     $Albums = new Application_Model_Albums();
     $album = $Albums->getAlbum($album_id);
     $username_minchars = Zend_Registry::get('config')->get('username_minchars');
     $username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
     // fields
     $id = new Zend_Form_Element_Hidden('id');
     $id->setValue($album);
     $album_name = new Zend_Form_Element_Text('album_name');
     $album_name->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Album Name'))->setRequired(true)->setValue($album['name'])->setAttrib('class', 'form-control');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($album['description'])->setLabel($this->translator->translate('About this album'))->setAttrib('class', 'form-control');
     $submit = new Zend_Form_Element_Submit('formsubmit');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($id, $album_name, $description, $submit));
     $this->postInit();
 }
예제 #27
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oMessage = new Zend_Form_Element_Textarea("message");
     $oMessage->setFilters($this->_aFilters);
     $oMessage->setRequired(FALSE);
     $oMessage->removeDecorator("label");
     $this->addElement($oMessage);
     $oIsDing = new Zend_Form_Element_Checkbox("is_ding");
     $oIsDing->setLabel("Włącz dźwięk");
     $oIsDing->setValue(1);
     $this->addElement($oIsDing);
     $oSubmit = new Zend_Form_Element_Submit("send_message");
     $oSubmit->setLabel("Wyślij wiadomość");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/chat.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
예제 #28
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oRealEditMode = new Zend_Form_Element_Select("real_edit_mode");
     $oRealEditMode->setLabel("Edycja w czasie rzeczywistym:");
     $oRealEditMode->setRequired(TRUE);
     $oRealEditMode->addMultiOptions(array("1" => "Włącz", "0" => "Wyłącz"));
     $this->addElement($oRealEditMode);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "choose_site_submit");
     $oSubmit->setLabel("Zapisz");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
예제 #29
0
 public function __construct($options = null)
 {
     // variable
     parent::__construct($options);
     $baseDir = $options['baseDir'];
     // name
     $name = new Zend_Form_Element_Text('EGI_Name');
     $name->setLabel($this->getView()->getCibleText('form_label_name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput');
     $this->addElement($name);
     // description
     $description = new Zend_Form_Element_Textarea('EGI_Description');
     $description->setLabel($this->getView()->getCibleText('form_label_description'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextareaEdit');
     $this->addElement($description);
     //status
     $status = new Zend_Form_Element_Select('EG_Status');
     $status->setLabel($this->getView()->getCibleText('form_label_status'))->setAttrib('class', 'stdSelect');
     $status = Cible_FunctionsGeneral::fillStatusSelectBox($status, 'Extranet_Groups', 'EG_Status');
     $this->addElement($status);
     // Hidden GroupID
     $groupID = new Zend_Form_Element_Hidden('groupID');
     $groupID->removeDecorator('label');
     $groupID->removeDecorator('DtDdWrapper');
     if (isset($options['groupID'])) {
         $groupID->setValue($options['groupID']);
     }
     $this->addElement($groupID);
 }
예제 #30
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => "flex", 'controller' => 'panel', 'action' => 'layout'), 'default');
     $this->setAction($url)->setMethod('post');
     $this->setLegend(sprintf(Zoo::_('Edit %s'), $this->target->name));
     $settings_elements = $this->target->getLayout()->getSettingsFormElements();
     $this->addElements($settings_elements);
     $settings = $this->target->getLayout()->settings;
     $settings['structure'] = json_encode($settings['structure']);
     $legend = Zoo::_('Layout options');
     $this->addDisplayGroup($settings_elements, 'layout_settings', array('legend' => $legend));
     $regions = $this->target->getLayout()->getAllRegions();
     $allregions = array();
     foreach (array_keys($regions) as $name) {
         $region = new Zend_Form_Element_Select('region_' . $name);
         $region->setLabel($name)->setMultiOptions($this->getRegionStyles());
         $this->addElement($region);
         $allregions[] = 'region_' . $name;
     }
     $legend = Zoo::_('Region styles');
     $this->addDisplayGroup($allregions, 'region_form', array('legend' => $legend));
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setLabel('save')->setOrder(100);
     $this->addElement($submit);
     if ($this->target->id > 0) {
         $id_ele = new Zend_Form_Element_Hidden('id');
         $id_ele->setValue(intval($this->target->id));
         $this->addElement($id_ele);
     }
     $this->populate($settings);
     $this->populate($this->target->toArray());
 }