public function init() { parent::init(); $this->setAttrib('class', 'simplified-sub-element')->setIsArray(true); $model = new Model_Wep(); $form = array(); $form['id'] = new Zend_Form_Element_Hidden('id'); $form['id']->setValue($this->data['id']); $form['title_id'] = new Zend_Form_Element_Hidden('title_id'); $form['title_id']->setValue($this->data['title_id']); $form['title'] = new Zend_Form_Element_Text('title'); $form['title']->setLabel('Title')->setRequired()->setValue($this->data['title'])->setAttrib('class', 'form-text'); $form['category_id'] = new Zend_Form_Element_Hidden('category_id'); $form['category_id']->setValue($this->data['category_id']); $categoryCodes = $model->getCodeArray('DocumentCategory', '', 1, true); $form['category_code'] = new Zend_Form_Element_Select('category_code'); $form['category_code']->setLabel('Category Code')->setRequired()->addMultiOptions($categoryCodes)->setValue($this->data['category_code'])->setAttrib('class', 'form-select'); $form['url'] = new Zend_Form_Element_Text('url'); $form['url']->setLabel('Url')->setRequired()->addValidator(new App_Validate_Url())->setValue($this->data['url'])->setAttrib('class', 'form-text'); $this->addElements($form); $this->setElementsBelongTo("document[{$this->count}]"); // Add remove button $remove = new Iati_Form_Element_Note('remove'); $remove->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-remove-element')); $remove->setValue("<a href='#' class='button' value='DocumentLink'> Remove element</a>"); $this->addElement($remove); foreach ($form as $item_name => $element) { $form[$item_name]->addDecorators(array(array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help simplified-document-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item')))); } }
/** * Function to add Sub Elements form to the element. * * @param string $formClass Class name of the form to be added. * @param string $elementClassName Class name of the element whose form is added, eg for transaction _tiedstatus the * classname is TiedStatus. * @param int $elementCount Count value for the element. It is added as the array key for the element's array * @param array $attribs Array of form element values. */ public function addSubElement($formClass, $elementClassName, $elementCount, $attribs = null, $multiple = false) { $subForm = new $formClass(); $camelCaseToSeperator = new Zend_Filter_Word_CamelCaseToSeparator(" "); $title = $camelCaseToSeperator->filter($elementClassName); $subForm->removeDecorator('form'); if ($multiple) { $add = new Iati_Form_Element_Note('add'); $add->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'button')); $add->setValue("<a href='#' class='add-element' value='{$elementClassName}'> Add More</a>"); $add->setOrder(101); $remove = new Iati_Form_Element_Note('remove'); $remove->setValue("<a href='/wep/remove-elements?classname={$elementClassName}' class='remove-this'> Remove This</a>"); $remove->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'remove button')); $remove->setOrder(100); $subForm->addElements(array($add, $remove)); } $subForm->addDisplayGroup(array_keys($subForm->getElements()), $elementClassName, array('legend' => $title, 'class' => $subForm->getAttrib('class'))); $subForm->setElementsBelongTo("{$elementClassName}[{$elementCount}]"); if ($attribs) { $subForm->populate($attribs); } $subForm->addDecorators(array(array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'options' => array('class' => 'element-wrapper'))))); $this->addSubForm($subForm, "{$elementClassName}{$elementCount}"); return $subForm; }
public function init() { parent::init(); $this->removeElement('end_date'); foreach ($this->getElements() as $item_name => $element) { $element->addDecorators(array(array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help simplified-expenditure-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item')))); } $this->setElementsBelongTo("expenditure[{$this->count}]"); // Add remove button $remove = new Iati_Form_Element_Note('remove'); $remove->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-remove-element')); $remove->setValue("<a href='#' class='button' value='Transaction'> Remove element</a>"); $this->addElement($remove); }
public function init() { parent::init(); $this->setAttrib('class', 'simplified-sub-element')->setIsArray(true); $model = new Model_Wep(); $form = array(); $form['id'] = new Zend_Form_Element_Hidden('id'); $form['id']->setValue($this->data['id']); $form['title_id'] = new Zend_Form_Element_Hidden('title_id'); $form['title_id']->setValue($this->data['title_id']); $form['description_id'] = new Zend_Form_Element_Hidden('description_id'); $form['description_id']->setValue($this->data['description_id']); $form['indicator_id'] = new Zend_Form_Element_Hidden('indicator_id'); $form['indicator_id']->setValue($this->data['indicator_id']); $form['indicator_title_id'] = new Zend_Form_Element_Hidden('indicator_title_id'); $form['indicator_title_id']->setValue($this->data['indicator_title_id']); $form['period_id'] = new Zend_Form_Element_Hidden('period_id'); $form['period_id']->setValue($this->data['period_id']); $form['actual_id'] = new Zend_Form_Element_Hidden('actual_id'); $form['actual_id']->setValue($this->data['actual_id']); $form['period_end_id'] = new Zend_Form_Element_Hidden('period_end_id'); $form['period_end_id']->setValue($this->data['period_end_id']); $resultTypeCodes = $model->getCodeArray('ResultType', '', 1, true); $form['result_type'] = new Zend_Form_Element_Select('result_type'); $form['result_type']->setLabel('Result Type')->setRequired()->addMultiOptions($resultTypeCodes)->setValue($this->data['result_type'])->setAttrib('class', 'form-select'); $form['title'] = new Zend_Form_Element_Text('title'); $form['title']->setLabel('Title')->setRequired()->setValue($this->data['title'])->setAttrib('class', 'form-text'); $form['description'] = new Zend_Form_Element_Textarea('description'); $form['description']->setLabel('Description')->setRequired()->setValue($this->data['description'])->setAttrib('COLS', '40')->setAttrib('ROWS', '4')->setAttrib('class', 'form-text'); $form['indicator'] = new Zend_Form_Element_Text('indicator'); $form['indicator']->setLabel('Indicator')->setRequired()->setValue($this->data['indicator'])->setAttrib('class', 'form-text'); $form['achievement'] = new Zend_Form_Element_Text('achievement'); $form['achievement']->setLabel('Achievement')->setRequired()->setValue($this->data['achievement'])->setAttrib('class', 'form-text'); $form['end_date'] = new Zend_Form_Element_Text('end_date'); $form['end_date']->setLabel('As of')->setRequired()->setValue($this->data['end_date'])->setAttrib('class', 'form-text datepicker simplified-result-date'); $this->addElements($form); $this->setElementsBelongTo("result[{$this->count}]"); // Add remove button $remove = new Iati_Form_Element_Note('remove'); $remove->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-remove-element')); $remove->setValue("<a href='#' class='button' value='Result'> Remove element</a>"); $this->addElement($remove); foreach ($form as $item_name => $element) { $form[$item_name]->addDecorators(array(array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help simplified-result-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item')))); } }
public function init() { parent::init(); $this->setAttrib('class', 'simplified-sub-element')->setIsArray(true); $model = new Model_Wep(); $form = array(); $form['id'] = new Zend_Form_Element_Hidden('id'); $form['id']->setValue($this->data['id']); $form['start_id'] = new Zend_Form_Element_Hidden('start_id'); $form['start_id']->setValue($this->data['start_id']); $form['end_id'] = new Zend_Form_Element_Hidden('end_id'); $form['end_id']->setValue($this->data['end_id']); $form['value_id'] = new Zend_Form_Element_Hidden('value_id'); $form['value_id']->setValue($this->data['value_id']); $this->addElements($form); $form['amount'] = new Zend_Form_Element_Text('amount'); $form['amount']->setLabel('Amount')->setRequired()->addFilter(new App_Filter_Currency())->setValue($this->data['amount'])->addValidator(new App_Validate_Numeric())->setAttrib('class', 'form-text'); $currency = $model->getCodeArray('Currency', '', 1, true); $form['currency'] = new Zend_Form_Element_Select('currency'); $form['currency']->setLabel('Currency')->addMultiOptions($currency)->setValue($this->data['currency'])->setAttrib('class', 'form-select'); $form['start_date'] = new Zend_Form_Element_Text('start_date'); $form['start_date']->setLabel('Start Date')->setRequired()->setValue($this->data['start_date'])->setAttrib('class', 'form-text datepicker'); $form['end_date'] = new Zend_Form_Element_Text('end_date'); $form['end_date']->setLabel('End Date')->setRequired()->setValue($this->data['end_date'])->addValidator(new App_Validate_EndDate())->setAttrib('class', 'form-text datepicker'); $form['signed_date'] = new Zend_Form_Element_Text('signed_date'); $form['signed_date']->setLabel('Contract Signed Date')->setRequired()->setValue($this->data['signed_date'])->setAttrib('class', 'form-text datepicker'); $this->addElements($form); $this->setElementsBelongTo("budget[{$this->count}]"); // Add remove button $remove = new Iati_Form_Element_Note('remove'); $remove->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-remove-element')); $remove->setValue("<a href='#' class='button' value='Budget'> Remove element</a>"); $this->addElement($remove); foreach ($form as $item_name => $element) { $form[$item_name]->addDecorators(array(array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help simplified-budget-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item')))); } }
public function init() { $model = new Model_Wep(); $this->setAttrib('id', 'simplified-default-form')->setIsArray(true); $form = array(); $requiredMessage = new Iati_Form_Element_Note('form-message'); $requiredMessage->setValue("If you fill this section, the fields marked <span class='form-required'>*</span> must be filled.")->setOrder(-1); $defaultMessage = new Iati_Form_Element_Note('message'); $defaultMessage->setValue("The fields marked <span class='form-required'>*</span> must be filled."); $form['activity_id'] = new Zend_Form_Element_Hidden('activity_id'); $form['activity_id']->setValue($this->data['activity_id']); $form['identifier_id'] = new Zend_Form_Element_Hidden('identifier_id'); $form['identifier_id']->setValue($this->data['identifier_id']); $form['identifier'] = new Zend_Form_Element_Text('identifier'); $form['identifier']->setLabel('Project Identifier')->setRequired()->setValue($this->data['identifier'])->setAttrib('class', 'form-text'); $form['title_id'] = new Zend_Form_Element_Hidden('title_id'); $form['title_id']->setValue($this->data['title_id']); $form['title'] = new Zend_Form_Element_Text('title'); $form['title']->setLabel('Title')->setRequired()->setValue($this->data['title'])->setAttrib('class', 'form-text'); $form['description_id'] = new Zend_Form_Element_Hidden('description_id'); $form['description_id']->setValue($this->data['description_id']); $form['description'] = new Zend_Form_Element_Textarea('description'); $form['description']->setLabel('Description')->setRequired()->setValue($this->data['description'])->setAttrib('COLS', '40')->setAttrib('ROWS', '4')->setAttrib('class', 'form-text'); $fundingOrgData = $this->data['funding_org']; $fundingOrgs = ''; if ($fundingOrgData && is_array($fundingOrgData)) { $fundingOrgs = implode(',', $fundingOrgData); } $form['funding_org'] = new Zend_Form_Element_Hidden('funding_org'); $form['funding_org']->setValue($fundingOrgs)->setLabel('Funding Organisation')->setAttrib('style', 'width:300px'); /* $form['funding_org'] = new Zend_Form_Element_Text('funding_org'); $form['funding_org']->setLabel('Funding Organisation') ->setRequired() ->setValue(array('test')) ->setAttrib('class', 'form-text'); */ $form['start_date_id'] = new Zend_Form_Element_Hidden('start_date_id'); $form['start_date_id']->setValue($this->data['start_date_id']); $form['start_date'] = new Zend_Form_Element_Text('start_date'); $form['start_date']->setLabel('Actual Start Date')->setRequired()->setValue($this->data['start_date'])->setAttrib('class', 'form-text datepicker'); $form['end_date_id'] = new Zend_Form_Element_Hidden('end_date_id'); $form['end_date_id']->setValue($this->data['end_date_id']); $form['end_date'] = new Zend_Form_Element_Text('end_date'); $form['end_date']->setLabel('Actual End Date')->setRequired()->setValue($this->data['end_date'])->addValidator(new App_Validate_EndDate($form['start_date']))->setAttrib('class', 'form-text datepicker'); $sectorCodes = $model->getCodeArray('Sector', '', 1); $sectors = $this->data['sector']; if ($sectors) { foreach ($sectors as $sector) { $sectorData[] = $sector['sector']; } } $form['sector'] = new Zend_Form_Element_Select('sector'); $form['sector']->setLabel('Sector')->addMultiOptions($sectorCodes)->setRegisterInArrayValidator(false)->setValue($sectorData)->setAttrib('multiple', 'true')->setAttrib('class', 'form-text'); $form['status_id'] = new Zend_Form_Element_Hidden('status_id'); $form['status_id']->setValue($this->data['status_id']); $statuses = $model->getCodeArray('ActivityStatus', '', 1); $form['status'] = new Zend_Form_Element_Select('status'); $form['status']->setLabel('Activity Status')->addMultiOption('', 'Select anyone')->addMultiOptions($statuses)->setValue($this->data['status'])->setRegisterInArrayValidator(false)->setAttrib('class', 'form-select')->setAttrib('style', 'width:300px'); $this->addElements($form); foreach ($form as $item_name => $element) { $form[$item_name]->addDecorators(array(array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help simplified-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item')))); } // location $locationForm = new App_Form(); $locationForm->removeDecorator('form'); if ($this->data['location']) { foreach ($this->data['location'] as $key => $locationData) { $location = new Simplified_Form_Activity_Location(array('data' => $locationData, 'count' => $key)); $locationForm->addSubForm($location, 'location' . $key); $location->removeDecorator('form'); } } else { $location = new Simplified_Form_Activity_Location(array('data' => $locationData)); $locationForm->addSubForm($location, 'location'); $location->removeDecorator('form'); } $add = new Iati_Form_Element_Note('add'); $add->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-add-more')); $add->setValue("<a href='#' class='button' value='Location'> Add More</a>"); $locationForm->addElement($add); $locationForm->addElement($requiredMessage); $this->addSubForm($locationForm, 'location_wrapper'); // Budget $budgetForm = new App_Form(); $budgetForm->removeDecorator('form'); if ($this->data['budget']) { foreach ($this->data['budget'] as $key => $budgetData) { $budget = new Simplified_Form_Activity_Budget(array('data' => $budgetData, 'count' => $key)); $budgetForm->addSubForm($budget, 'budget' . $key); $budget->removeDecorator('form'); } } else { $budget = new Simplified_Form_Activity_Budget(array('data' => $budgetData)); $budgetForm->addSubForm($budget, 'budget'); $budget->removeDecorator('form'); } $add = new Iati_Form_Element_Note('add'); $add->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-add-more')); $add->setValue("<a href='#' class='button' value='Budget'> Add More</a>"); $budgetForm->addElement($add); $budgetForm->addElement($requiredMessage); $this->addSubForm($budgetForm, 'budget_wrapper'); /** * @deprecated */ /* // Commitment $commForm = new App_Form(); $commForm->removeDecorator('form'); if($this->data['commitment']){ foreach($this->data['commitment'] as $key=>$commitmentData){ $commitment = new Simplified_Form_Activity_Transaction_Commitment(array('data' => $commitmentData , 'count' => $key)); $commForm->addSubForm($commitment , 'commitment'.$key); $commitment->removeDecorator('form'); } } else { $commitment = new Simplified_Form_Activity_Transaction_Commitment(); $commForm->addSubForm($commitment , 'commitment'); $commitment->removeDecorator('form'); } $add = new Iati_Form_Element_Note('add'); $add->addDecorator('HtmlTag', array('tag' => 'span' , 'class' => 'simplified-add-more')); $add->setValue("<a href='#' class='button' value='Transaction_Commitment'> Add More</a>"); $commForm->addElement($add); $this->addSubForm($commForm , 'commitment_wrapper'); */ // incommingFund $incommForm = new App_Form(); $incommForm->removeDecorator('form'); if ($this->data['incommingFund']) { foreach ($this->data['incommingFund'] as $key => $incommingFundData) { $incommingFund = new Simplified_Form_Activity_Transaction_IncommingFund(array('data' => $incommingFundData, 'count' => $key)); $incommForm->addSubForm($incommingFund, 'incommingFund' . $key); $incommingFund->removeDecorator('form'); } } else { $incommingFund = new Simplified_Form_Activity_Transaction_IncommingFund(); $incommForm->addSubForm($incommingFund, 'incommingFund'); $incommingFund->removeDecorator('form'); } $add = new Iati_Form_Element_Note('add'); $add->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-add-more')); $add->setValue("<a href='#' class='button' value='Transaction_IncommingFund'> Add More</a>"); $incommForm->addElement($add); $incommForm->addElement($requiredMessage); $this->addSubForm($incommForm, 'incomming_fund_wrapper'); // Expenditure $expForm = new App_Form(); $expForm->removeDecorator('form'); if ($this->data['expenditure']) { foreach ($this->data['expenditure'] as $key => $expenditureData) { $expenditure = new Simplified_Form_Activity_Transaction_Expenditure(array('data' => $expenditureData, 'count' => $key)); $expForm->addSubForm($expenditure, 'expenditure' . $key); $expenditure->removeDecorator('form'); } } else { $expenditure = new Simplified_Form_Activity_Transaction_Expenditure(); $expForm->addSubForm($expenditure, 'expenditure'); $expenditure->removeDecorator('form'); } $add = new Iati_Form_Element_Note('add'); $add->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-add-more')); $add->setValue("<a href='#' class='button' value='Transaction_Expenditure'> Add More</a>"); $expForm->addElement($add); $expForm->addElement($requiredMessage); $this->addSubForm($expForm, 'expenditure_wrapper'); // document $documentForm = new App_Form(); $documentForm->removeDecorator('form'); if ($this->data['document']) { foreach ($this->data['document'] as $key => $documentData) { $document = new Simplified_Form_Activity_Document(array('data' => $documentData, 'count' => $key)); $documentForm->addSubForm($document, 'document' . $key); $document->removeDecorator('form'); } } else { $document = new Simplified_Form_Activity_Document(array('data' => $documentData)); $documentForm->addSubForm($document, 'document'); $document->removeDecorator('form'); } $add = new Iati_Form_Element_Note('add'); $add->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-add-more')); $add->setValue("<a href='#' class='button' value='Document'> Add More</a>"); $documentForm->addElement($add); $documentForm->addElement($requiredMessage); $this->addSubForm($documentForm, 'document_wrapper'); // Result $resultForm = new App_Form(); $resultForm->removeDecorator('form'); if ($this->data['result']) { foreach ($this->data['result'] as $key => $resultData) { $result = new Simplified_Form_Activity_Result(array('data' => $resultData, 'count' => $key)); $resultForm->addSubForm($result, 'result' . $key); $result->removeDecorator('form'); } } else { $result = new Simplified_Form_Activity_Result(array('data' => $resultData)); $resultForm->addSubForm($result, 'result'); $result->removeDecorator('form'); } $add = new Iati_Form_Element_Note('add'); $add->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-add-more')); $add->setValue("<a href='#' class='button' value='Result'> Add More</a>"); $resultForm->addElement($add); $resultForm->addElement($requiredMessage); $this->addSubForm($resultForm, 'result_wrapper'); foreach ($form as $item_name => $element) { $form[$item_name]->addDecorators(array(array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item')))); } $this->addElement('submit', 'save', array('label' => 'Save', 'required' => false, 'class' => 'simplified-save-button')); $this->addDecorators(array(array('ViewScript', array('viewScript' => 'default/viewscripts/simplified.phtml')))); $this->addElement($defaultMessage); }
/** * Function to add 'add more' link to form for element which can be multiple. * * @param String $classname to which add more link is to be added. */ public function addAddLink($className) { $add = new Iati_Form_Element_Note('add'); $add->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'add-more element-add-more v2-add-element')); $add->setValue("<a href='#' class='button' value='{$className}'> Add more</a>"); $this->addElement($add); }
public function init() { $this->setName('Register'); $this->setMethod('post'); $userInfo = new Iati_Form_Element_Note('user_info_message'); $userInfo->setValue("Please enter your personal details.")->setAttrib('class', 'form-message'); $orgname = new Zend_Form_Element_Text('org_name'); $orgname->setLabel('Organisation Name')->setRequired()->setAttrib('class', 'form-text'); $orgaddress = new Zend_Form_Element_Textarea('org_address'); $orgaddress->setLabel('Organisation Address')->setAttrib('rows', 4)->setRequired()->setAttrib('class', 'form-text'); $account_identifier = new Zend_Form_Element_Text('account_identifier'); $account_identifier->setLabel('Organisation User Identifier')->setRequired()->addValidator('Db_NoRecordExists', false, array('table' => 'account', 'field' => 'username'))->addErrorMessage('This Organisation User Identifier is already used.')->setDescription("Your organisation user identifier will be used as a prefix for all the \n AidStream users in your organisation. We recommend that you use a short \n abbreviation that uniquely identifies your organisation. If your organisation \n is 'Acme Bellus Foundation', your organisation user identifier should be \n 'abf', depending upon it's availability.")->setAttrib('class', 'form-text'); $firstname = new Zend_Form_Element_Text('first_name'); $firstname->setLabel('Your First Name')->setRequired()->setAttrib('class', 'form-text'); $lastname = new Zend_Form_Element_Text('last_name'); $lastname->setLabel('Your Last Name')->setRequired()->setAttrib('class', 'form-text'); $username = new Zend_Form_Element_Text('user_name'); $username->setLabel('User Name')->setRequired()->setAttrib('readonly', true)->setDescription("AidStream will create a default username with your Organisation User \n Identifier as prefix. You will not be able to change '_admin' part of the \n username. This user will have administrative privilege and can create \n multiple AidStream users with different set of permissions.")->setAttrib('class', 'form-text'); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Your Email')->setRequired()->addValidator('emailAddress', false)->addValidator('Db_NoRecordExists', false, array('table' => 'user', 'field' => 'email'))->setAttrib('class', 'form-text'); $passwordConfirmation = new App_Validate_PasswordConfirmation(); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password')->setRequired()->setAttrib('class', 'form-text')->addValidator($passwordConfirmation); $confirmPassword = new Zend_Form_Element_Password('confirmpassword'); $confirmPassword->setLabel('Confirm Password')->setRequired()->setAttrib('class', 'form-text')->addValidator($passwordConfirmation); $publisherId = new Zend_Form_Element_Text('publisher_id'); $publisherId->setLabel('Publisher Id')->setAttrib('class', 'form-text')->addErrorMessage('Please Enter the Publisher ID'); $apiKey = new Zend_Form_Element_Text('api_key'); $apiKey->setLabel('API Key')->setAttrib('class', 'form-text')->addErrorMessage('Please Enter an API key'); $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); /* $captcha = new Zend_Form_Element_Captcha( 'captcha', array( 'label' => 'Please enter the characters shown in the picture', 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'font' => APPLICATION_PATH.'/../public/font/Ubuntu-B.ttf', 'imgDir' => APPLICATION_PATH.'/../public/captcha/', 'imgUrl' => $baseUrl.'/captcha/', 'dotNoiseLevel' => 70, 'lineNoiseLevel' => 5 ) ) ); */ $publickey = '6Ld6RM0SAAAAANYtQD4j-0THK1HBXLUhAsQCXyiH'; $privatekey = '6Ld6RM0SAAAAAJlk5mZV9tZ65xfrmHEoXtmYdyHz'; $recaptcha = new Zend_Service_ReCaptcha($publickey, $privatekey); $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => "Please enter the text in the box", 'captcha' => 'ReCaptcha', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'service' => $recaptcha), 'ignore' => true)); $this->addElements(array($userInfo, $orgname, $orgaddress, $account_identifier, $firstname, $lastname, $userIdentifier, $username, $email, $password, $confirmPassword, $captcha)); $this->addDisplayGroup(array('org_name', 'org_address', 'account_identifier'), 'organisation_info', array('legend' => 'Organisation Info')); $this->addDisplayGroup(array('user_info_message', 'first_name', 'last_name', 'email', 'user_identifier', 'user_name', 'password', 'confirmpassword', 'captcha'), 'user_info', array('legend' => 'User Info')); /* $this->addDisplayGroup( array('publisher_id' , 'api_key'), 'register_registry_info', array( 'legend' => 'Registry Info', ) ); $reg = $this->getDisplayGroup('register_registry_info'); $reg->setDescription("If you don't have the registry info please visit the <a href='http://www.iatiregistry.org' target='_blank'>Iati Registry</a>") ->addDecorators(array( array('Description', array('escape' => false, 'tag' => 'div')), )); */ // Add wrapper to all element foreach ($this->getElements() as $item) { if ($item->getType() == 'Iati_Form_Element_Note') { continue; } $item->addDecorators(array(array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item')))); } $groups = $this->getDisplayGroups(); foreach ($this->getDisplayGroups() as $group) { $group->addDecorators(array(array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'default-activity-list')))); } $create = new Zend_Form_Element_Submit('create_new_account'); $create->setLabel('Sign Up'); $this->addElement($create); }
public function init() { parent::init(); $this->setAttrib('class', 'simplified-sub-element')->setIsArray(true); $model = new Model_Wep(); $form = array(); $form['location_id'] = new Zend_Form_Element_Hidden('location_id'); $form['location_id']->setValue($this->data['location_id']); $form['location_desc_id'] = new Zend_Form_Element_Hidden('location_desc_id'); $form['location_desc_id']->setValue($this->data['location_desc_id']); $form['location_coord_id'] = new Zend_Form_Element_Hidden('location_coord_id'); $form['location_coord_id']->setValue($this->data['location_coord_id']); /* $form['location_coord_lat'] = new Zend_Form_Element_Hidden('location_coord_lat'); $form['location_coord_lat']->setValue($this->data['location_coord_lat']); $form['location_coord_lat']->setAttrib('class' , 'latitude'); $form['location_coord_long'] = new Zend_Form_Element_Hidden('location_coord_long'); $form['location_coord_long']->setValue($this->data['location_coord_long']); $form['location_coord_long']->setAttrib('class' , 'longitude'); */ $form['location_adm_id'] = new Zend_Form_Element_Hidden('location_adm_id'); $form['location_adm_id']->setValue($this->data['location_adm_id']); /* $form['location_adm_adm1'] = new Zend_Form_Element_Hidden('location_adm_adm1'); $form['location_adm_adm1']->setValue($this->data['location_adm_adm1']); $form['location_adm_adm1']->setAttrib('class' , 'adm1'); $form['location_adm_adm2'] = new Zend_Form_Element_Hidden('location_adm_adm2'); $form['location_adm_adm2']->setValue($this->data['location_adm_adm2']); $form['location_adm_adm2']->setAttrib('class' , 'adm2'); */ $form['location_name_id'] = new Zend_Form_Element_Hidden('location_name_id'); $form['location_name_id']->setValue($this->data['location_name_id']); $nameData = $this->data['location_name']; $form['location_name'] = new Zend_Form_Element_Select('location_name'); $form['location_name']->setLabel('District Name')->setRequired()->addMultiOption($nameData, $nameData)->setValue($nameData)->setRegisterInArrayValidator(false)->setAttrib('class', 'location level-1 form-select')->setAttrib('style', 'width:300px'); //$this->data['location_vdcs'] = 'Amahibariyati , Babiyabirta'; $adm2Data = $this->data['location_vdcs']; if (is_array($adm2Data)) { $adm2Data = implode(',', $adm2Data); } $options = array(); if ($adm2Data) { $adm2Data = explode(',', $adm2Data); $adm2Data = preg_replace('/ /', '', $adm2Data); foreach ($adm2Data as $data) { $options[$data] = $data; } } $form['location_vdcs'] = new Zend_Form_Element_Select('location_vdcs'); $form['location_vdcs']->setLabel('VDC name')->addMultiOptions($options)->setValue($adm2Data)->setRegisterInArrayValidator(false)->setAttrib('multiple', true)->setAttrib('class', 'location level-2 form-select'); $this->addElements($form); $this->setElementsBelongTo("location[{$this->count}]"); // Add remove button $remove = new Iati_Form_Element_Note('remove'); $remove->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-remove-element')); $remove->setValue("<a href='#' class='button' value='Location'> Remove element</a>"); $this->addElement($remove); foreach ($form as $item_name => $element) { $form[$item_name]->addDecorators(array(array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help simplified-location-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item')))); } }