Beispiel #1
0
 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'))));
     }
 }
Beispiel #2
0
 function checkPermission($action = '')
 {
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $wepModel = new Model_Wep();
     $permissions = $wepModel->getRowsByFields($this->tblName, 'user_id', $identity->user_id);
 }
Beispiel #3
0
 public function edit($account_id = '')
 {
     $form = array();
     $model = new Model_Wep();
     $language = $model->getCodeArray('Language', null, '1');
     $currency = $model->getCodeArray('Currency', null, '1');
     $form['xml_lang'] = new Zend_Form_Element_Select('xml_lang');
     $form['xml_lang']->setLabel('Language')->setAttrib('class', 'form-select')->addMultiOption('', 'Select anyone')->setRequired();
     foreach ($language as $key => $eachLanguage) {
         $form['xml_lang']->addMultiOption($key, $eachLanguage);
     }
     $form['default_currency'] = new Zend_Form_Element_Select('default_currency');
     $form['default_currency']->setAttrib('class', 'form-select')->setLabel('Default Currency')->setRequired()->addMultiOption('', 'Select anyone');
     foreach ($currency as $key => $eachCurrency) {
         $form['default_currency']->addMultiOption($key, $eachCurrency);
     }
     $form['hierarchy'] = new Zend_Form_Element_Text('hierarchy');
     $form['hierarchy']->setAttrib('class', 'form-text')->setLabel('Hierarchy');
     //This code is used to append a <div> with help class for all form elements, used for displaying help
     foreach ($form as $item_name => $element) {
         $form[$item_name]->setDecorators(array('ViewHelper', 'Errors', 'Label', array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help activity-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item'))));
     }
     $this->addElements($form);
     $this->addDisplayGroup(array('xml_lang', 'default_currency', 'hierarchy'), 'field1', array('legend' => 'Activity'));
     $group = $this->getDisplayGroup('field1');
     $group->addDecorators(array(array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'default-activity-list'))));
     $save = new Zend_Form_Element_Submit('save');
     $save->setValue('Save')->setAttrib('class', 'form-submit');
     $this->addElement($save);
     $this->setMethod('post');
     $this->setAttrib('id', 'activity-edit-form');
 }
Beispiel #4
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $policySignificance = $model->getCodeArray('PolicySignificance', null, '1', true);
     $form['significance'] = new Zend_Form_Element_Select('significance');
     $form['significance']->setLabel('Significance')->setValue($this->data['@significance'])->setAttrib('class', 'form-select')->setMultioptions($policySignificance);
     /**
      *  Hide Vocabulary (v1.2.7)
      *  
         $vocabulary = $model->getCodeArray('Vocabulary', null, '1' , true);
         $form['vocabulary'] = new Zend_Form_Element_Select('vocabulary');
         $form['vocabulary']->setLabel('Vocabulary')  
             ->setValue($this->data['@vocabulary'])   
             ->setAttrib('class' , 'form-select')
             ->setMultioptions($vocabulary);
     */
     $code = $model->getCodeArray('PolicyMarker', null, '1', true);
     $form['code'] = new Zend_Form_Element_Select('code');
     $form['code']->setLabel('Policy Marker')->setValue($this->data['@code'])->setAttrib('class', 'form-select')->setMultioptions($code);
     $form['text'] = new Zend_Form_Element_Textarea('text');
     $form['text']->setLabel('Description')->setValue($this->data['text'])->setAttribs(array('rows' => '2', 'cols' => '20'));
     $lang = $model->getCodeArray('Language', null, '1', true);
     $form['xml_lang'] = new Zend_Form_Element_Select('xml_lang');
     $form['xml_lang']->setLabel('Language')->setValue($this->data['@xml_lang'])->setAttrib('class', 'form-select')->setMultioptions($lang);
     $this->addElements($form);
     return $this;
 }
Beispiel #5
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $lang = $model->getCodeArray('Language', null, '1', true);
     $form['xml_lang'] = new Zend_Form_Element_Select('xml_lang');
     $form['xml_lang']->setLabel('Language')->setValue($this->data['@xml_lang'])->setAttrib('class', 'form-select')->setRequired()->addMultioptions($lang);
     $currency = $model->getCodeArray('Currency', null, '1', true);
     $form['default_currency'] = new Zend_Form_Element_Select('default_currency');
     $form['default_currency']->setLabel('Default Currency')->setValue($this->data['@default_currency'])->setRequired()->setAttrib('class', 'form-select')->setMultioptions($currency);
     $form['hierarchy'] = new Zend_Form_Element_Text('hierarchy');
     $form['hierarchy']->setLabel('Hierarchy')->setValue($this->data['@hierarchy'])->setAttrib('class', 'form-text');
     /*
      * Hide Linked Data Default (v1.2.4)
      *
         $form['linked_data_uri'] = new Zend_Form_Element_Text('linked_data_uri');
         $form['linked_data_uri']->setLabel('Linked Data Uri')    
             ->setValue($this->data['@linked_data_uri'])
             ->setAttrib('class' , 'form-text');
     */
     $this->addElements($form);
     return $this;
 }
 public function 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('Value 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')->setValue($this->data['end_date'])->addValidator(new App_Validate_EndDate())->setAttrib('class', 'form-text datepicker');
     foreach ($form as $item_name => $element) {
         $form[$item_name]->addDecorators(array(array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item'))));
     }
     $this->addElements($form);
 }
Beispiel #7
0
 public function deleteUserById($userId)
 {
     $userModel = new User_Model_DbTable_User();
     $userModel->deleteUser($userId);
     $profileModel = new User_Model_DbTable_Profile();
     $profileModel->deleteProfile($userId);
     $wepModel = new Model_Wep();
     $wepModel->deleteRow('user_permission', 'user_id', $userId);
     $wepModel->deleteRow('Privilege', 'owner_id', $userId);
 }
 public function updateIdentifierData($tableName, $elementId)
 {
     $identity = Zend_Auth::getInstance()->getIdentity();
     $wepModel = new Model_Wep();
     $defaultFieldsValues = $wepModel->getDefaults('default_field_values', 'account_id', $identity->account_id);
     $defaults = $defaultFieldsValues->getDefaultFields();
     $identifier = array();
     $identifier['id'] = $elementId;
     $identifier['text'] = trim($defaults['reporting_org_ref']);
     $wepModel->updateRowsToTable($tableName, $identifier);
 }
Beispiel #9
0
 public static function getRegionNamefromCode($code)
 {
     $db = new Model_Wep();
     $region = $db->getRowsByFields('Region', 'Code', $code);
     foreach ($region as $regionData) {
         if ($regionData['lang_id'] == 1) {
             return ucfirst(strtolower($regionData['Name']));
         }
     }
     return false;
 }
Beispiel #10
0
 public function updateReportingOrg($id)
 {
     $identity = Zend_Auth::getInstance()->getIdentity();
     $model = new Model_Wep();
     $defaultFieldsValues = $model->getDefaults('default_field_values', 'account_id', $identity->account_id);
     $defaults = $defaultFieldsValues->getDefaultFields();
     $reportingOrg['@ref'] = $defaults['reporting_org_ref'];
     $reportingOrg['@type'] = $defaults['reporting_org_type'];
     $reportingOrg['@xml_lang'] = $defaults['reporting_org_lang'];
     $reportingOrg['text'] = $defaults['reporting_org'];
     $this->update($reportingOrg, array('id = ?' => $id));
 }
Beispiel #11
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $budgetVocab = $model->getCodeArray('BudgetIdentifierVocabulary', null, '1', true);
     $form['vocabulary'] = new Zend_Form_Element_Select('vocabulary');
     $form['vocabulary']->setLabel('Vocabulary')->setValue($this->data['@vocabulary'])->setAttrib('class', 'form-select')->setMultioptions($budgetVocab);
     $this->addElements($form);
     return $this;
 }
Beispiel #12
0
 /**
  *
  * Function to get the activity status and activity sectors information for dashboard.
  * @param Array $activities
  */
 public function getActivityAttribs($activities)
 {
     $model = new Model_Wep();
     $sectors = array();
     $iatiStatuses = $model->getRowsByFields('ActivityStatus', 'lang_id', 1);
     $status = array();
     foreach ($activities as $activity) {
         //Preapare sector data.
         $sectorData = $model->listAll('iati_sector', 'activity_id', $activity['id']);
         if ($sectorData) {
             foreach ($sectorData as $sectorValue) {
                 if (!$sectorValue['@vocabulary'] || $sectorValue['@vocabulary'] == 3) {
                     if (!$sectorValue['@code']) {
                         continue;
                     }
                     $sectorName = $model->fetchValueById('Sector', $sectorValue['@code'], 'Name');
                     if (strlen($sectorName) > 35) {
                         $sectorName = substr($sectorName, 0, 32) . "...";
                     }
                 } else {
                     $sectorName = $sectorValue['text'];
                     if (strlen($sectorName) > 35) {
                         $sectorName = preg_replace('/ \\w+$/', '', substr($sectorName, 0, 32));
                         $sectorName .= "&hellip;";
                     }
                 }
                 if ($sectorName) {
                     $sectors[] = $sectorName;
                 }
             }
         }
         //Prepare activity status data.
         $statusData = $model->listAll('iati_activity_status', 'activity_id', $activity['id']);
         if ($statusData) {
             foreach ($statusData as $statusValue) {
                 $status[$statusValue['@code']] += 1;
             }
         } else {
             $status['unknown'] += 1;
         }
     }
     foreach ($iatiStatuses as $iatiStatus) {
         $iatiStatus['count'] = $status[$iatiStatus['Code']];
         $activityStatus[] = $iatiStatus;
     }
     if ($status['unknown']) {
         $activityStatus[] = array('Name' => 'Status Unspecified', 'count' => $status['unknown']);
     }
     $output = array();
     $output['status'] = $activityStatus;
     $output['sector'] = array_unique($sectors);
     return $output;
 }
Beispiel #13
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['text'] = new Zend_Form_Element_Text('text');
     $form['text']->setLabel('Text')->setRequired()->setValue($this->data['text'])->setAttribs(array('class' => 'form-text'));
     $gazetteerAgency = $model->getCodeArray('GazetteerAgency', null, '1', true);
     $form['gazetteer_ref'] = new Zend_Form_Element_Select('gazetteer_ref');
     $form['gazetteer_ref']->setLabel('Gazetteer Agency')->setValue($this->data['@gazetteer_ref'])->setRequired()->setAttrib('class', 'form-select')->addMultioptions($gazetteerAgency);
     $this->addElements($form);
     return $this;
 }
Beispiel #14
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $this->setAttrib('class', 'first-child')->setMethod('post')->setIsArray(true);
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $lang = $model->getCodeArray('Language', null, '1', true);
     $form['text'] = new Zend_Form_Element_Select('text');
     $form['text']->setLabel('Language')->setValue($this->data['text'])->setAttrib('class', 'form-select')->setMultioptions($lang);
     $this->addElements($form);
     return $this;
 }
Beispiel #15
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $this->setAttrib('class', 'simplified-sub-element');
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $type = $model->getCodeArray('ResultType', null, '1', true);
     $form['type'] = new Zend_Form_Element_Select('type');
     $form['type']->setLabel('Type')->setValue($this->data['@type'])->setAttrib('class', 'form-select')->setRequired()->setMultioptions($type);
     $form['aggregation_status'] = new Zend_Form_Element_Select('aggregation_status');
     $form['aggregation_status']->setLabel('Aggregation Status')->setAttribs(array('class' => 'form-select'))->setValue($this->data['@aggregation_status'])->setMultiOptions(array('' => 'Select Anyone', 'true' => 'True', 'false' => 'False'));
     $this->addElements($form);
     return $this;
 }
Beispiel #16
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $this->setAttrib('class', 'simplified-sub-element');
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['text'] = new Zend_Form_Element_Textarea('text');
     $form['text']->setLabel('Text')->setRequired()->setValue($this->data['text'])->setAttribs(array('rows' => '2', 'cols' => '20'));
     $lang = $model->getCodeArray('Language', null, '1', true);
     $form['xml_lang'] = new Zend_Form_Element_Select('xml_lang');
     $form['xml_lang']->setLabel('Language')->setValue($this->data['@xml_lang'])->setAttrib('class', 'form-select')->addMultioptions($lang);
     $this->addElements($form);
     return $this;
 }
Beispiel #17
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $this->setAttrib('class', 'simplified-sub-element');
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['url'] = new Zend_Form_Element_Text('url');
     $form['url']->setLabel('Url')->addValidator(new App_Validate_Url())->setAttribs(array('class' => 'form-text'))->setRequired()->setValue($this->data['@url']);
     $format = $model->getCodeArray('FileFormat', null, '1', true);
     $form['format'] = new Zend_Form_Element_Select('format');
     $form['format']->setLabel('Format')->setValue($this->data['@format'])->setAttrib('class', 'form-select')->setMultioptions($format);
     $this->addElements($form);
     return $this;
 }
Beispiel #18
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $countryCode = $model->getCodeArray('BudgetIdentifier', null, '1', true);
     $form['code'] = new Zend_Form_Element_Select('code');
     $form['code']->setLabel('Code')->setRequired()->setValue($this->data['@code'])->setAttrib('class', 'form-select')->setMultioptions($countryCode);
     $form['percentage'] = new Zend_Form_Element_Text('percentage');
     $form['percentage']->setLabel('Percentage')->setRequired()->setValue($this->data['@percentage'])->addValidator(new App_Validate_NumericValue())->setAttrib('class', 'form-text');
     $this->addElements($form);
     return $this;
 }
Beispiel #19
0
 public function getFormDefination()
 {
     $baseurl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $model = new Model_Wep();
     $this->setAttrib('class', 'simplified-sub-element');
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $indicatorMeasures = $model->getCodeArray('IndicatorMeasure', null, '1', true);
     $form['measure'] = new Zend_Form_Element_Select('measure');
     $form['measure']->setLabel('Measure')->setAttrib('class', 'form-select')->setValue($this->data['@measure'])->setRequired()->setMultioptions($indicatorMeasures);
     $form['ascending'] = new Zend_Form_Element_Select('ascending');
     $form['ascending']->setLabel('Ascending')->setAttribs(array('class' => 'form-select'))->setValue($this->data['@ascending'])->setMultiOptions(array('' => 'Select Anyone', 'true' => 'True', 'false' => 'False'));
     $this->addElements($form);
     return $this;
 }
Beispiel #20
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $this->setAttrib('class', 'first-child')->setMethod('post')->setIsArray(true);
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $codes = $model->getCodeArray('TransactionType', null, '1', true);
     $form['code'] = new Zend_Form_Element_Select('code');
     $form['code']->setLabel('Transaction Type Code')->setValue($this->data['@code'])->setRequired()->setAttrib('class', 'form-select')->setMultioptions($codes)->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'help transaction-transaction_type-code', 'placement' => 'PREPEND'))));
     $form['text'] = new Zend_Form_Element_Textarea('text');
     $form['text']->setLabel('Text')->setValue($this->data['text'])->setAttribs(array('rows' => '3', 'cols' => '20'))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'help transaction-transaction_type-text', 'placement' => 'PREPEND'))));
     $this->addElements($form);
     return $this;
 }
Beispiel #21
0
 public function getFormDefination()
 {
     $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $model = new Model_Wep();
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['url'] = new Zend_Form_Element_Textarea('url');
     $form['url']->setLabel('Document Url')->addValidator(new App_Validate_Url())->setAttribs(array('class' => 'form-text'))->setRequired()->setValue($this->data['@url'])->setDescription("If your document is not uploaded,\n                             <a href='#' class='upload-here'>Upload it</a>\n                             in AidStream. You can also add from your\n                             <a href='#' class='existing-doc'>existing</a> documents in Aidstream")->setAttribs(array('rows' => '2', 'cols' => '20'))->addDecorator('Description', array('escape' => false, 'class' => 'description'));
     $format = $model->getCodeArray('FileFormat', null, '1', true);
     $form['format'] = new Zend_Form_Element_Select('format');
     $form['format']->setLabel('Document Format')->setValue($this->data['@format'])->setAttrib('class', 'form-select')->setMultioptions($format);
     $this->addElements($form);
     return $this;
 }
Beispiel #22
0
 protected function _hasPermissionForState($state)
 {
     $identity = Zend_Auth::getInstance()->getIdentity();
     if ($identity->role == 'user') {
         $model = new Model_Wep();
         $userPermission = $model->getUserPermission($identity->user_id);
         $required_permissions = $this->PERMISSIONS[$state];
         foreach ($required_permissions as $permission) {
             if (!$userPermission->hasPermission($permission)) {
                 return false;
             }
         }
     }
     return true;
 }
Beispiel #23
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['latitude'] = new Zend_Form_Element_Text('latitude');
     $form['latitude']->setLabel('Latitude')->setRequired()->setValue($this->data['@latitude'])->setAttribs(array('class' => 'form-text'));
     $form['longitude'] = new Zend_Form_Element_Text('longitude');
     $form['longitude']->setLabel('longitude')->setRequired()->setValue($this->data['@longitude'])->setAttribs(array('class' => 'form-text'));
     $precisionCode = $model->getCodeArray('PercisionCode', null, '1', true);
     $form['precision'] = new Zend_Form_Element_Select('precision');
     $form['precision']->setLabel('Precision')->setValue($this->data['@precision'])->setAttrib('class', 'form-select')->setMultioptions($precisionCode);
     $this->addElements($form);
     return $this;
 }
Beispiel #24
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $identity = Zend_Auth::getInstance()->getIdentity();
     $this->setAttrib('class', 'simplified-sub-element');
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $lang = $model->getCodeArray('Language', null, '1', true);
     $form['xml_lang'] = new Zend_Form_Element_Select('xml_lang');
     $form['xml_lang']->setLabel('Language')->setValue($this->data['@xml_lang'])->setAttrib('class', 'form-select')->setRequired()->addMultioptions($lang);
     $currency = $model->getCodeArray('Currency', null, '1', true);
     $form['default_currency'] = new Zend_Form_Element_Select('default_currency');
     $form['default_currency']->setLabel('Currency')->setValue($this->data['@default_currency'])->setRequired()->setAttrib('class', 'form-select')->setMultioptions($currency);
     $this->addElements($form);
     return $this;
 }
Beispiel #25
0
 /**
  * Send notification for support query.
  */
 public function sendSupportNotifications($data)
 {
     $model = new Model_Wep();
     $account = $model->getRowById('account', 'id', Zend_Auth::getInstance()->getIdentity()->account_id);
     //Send Support Mail
     $mailParams['subject'] = 'Support Request';
     $mailParams['support_name'] = $data['support_name'];
     $mailParams['support_email'] = $data['support_email'];
     $mailParams['support_query'] = $data['support_query'];
     $mailParams['from'] = array($data['support_email'] => '');
     $mailParams['servername'] = $_SERVER['SERVER_NAME'];
     $mailParams['account_name'] = $account['name'];
     $supportEmail = Zend_Registry::get('config')->email->support;
     $template = 'support.phtml';
     $this->sendemail($mailParams, $template, array($supportEmail => ''));
 }
Beispiel #26
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $this->setAttrib('class', 'first-child')->setMethod('post')->setIsArray(true);
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['ref'] = new Zend_Form_Element_Text('ref');
     $form['ref']->setLabel('Ref')->setValue($this->data['@ref'])->setRequired()->setAttrib('class', 'form-text');
     $form['text'] = new Zend_Form_Element_Textarea('text');
     $form['text']->setLabel('Name')->setValue($this->data['text'])->setAttribs(array('rows' => '3', 'cols' => '20'));
     $lang = $model->getCodeArray('Language', null, '1', true);
     $form['xml_lang'] = new Zend_Form_Element_Select('xml_lang');
     $form['xml_lang']->setLabel('Language')->setValue($this->data['@xml_lang'])->setAttrib('class', 'form-select')->setMultioptions($lang);
     $this->addElements($form);
     return $this;
 }
Beispiel #27
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $this->setAttrib('class', 'first-child')->setMethod('post')->setIsArray(true);
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['text'] = new Zend_Form_Element_Text('text');
     $form['text']->setLabel('Amount')->setValue($this->data['text'])->setRequired()->addValidator(new App_Validate_NumericValue())->setAttribs(array('class' => 'currency form-text'));
     $currency = $model->getCodeArray('Currency', null, '1', true);
     $form['currency'] = new Zend_Form_Element_Select('currency');
     $form['currency']->setLabel('Currency')->setValue($this->data['@currency'])->setAttrib('class', 'form-select')->setMultioptions($currency);
     $form['value_date'] = new Zend_Form_Element_Text('value_date');
     $form['value_date']->setLabel('Value Date')->setValue($this->data['@value_date'])->setRequired()->setAttrib('class', 'datepicker');
     $this->addElements($form);
     return $this;
 }
Beispiel #28
0
 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'))));
     }
 }
Beispiel #29
0
 public function getFormDefination()
 {
     $model = new Model_Wep();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['text'] = new Zend_Form_Element_Textarea('text');
     $form['text']->setLabel('Text')->setRequired()->setValue($this->data['text'])->setAttribs(array('rows' => '2', 'cols' => '20'));
     $countryCode = $model->getCodeArray('Country', null, '1', true);
     $form['country'] = new Zend_Form_Element_Select('country');
     $form['country']->setLabel('Country')->setValue($this->data['@country'])->setAttrib('class', 'form-select')->setMultioptions($countryCode);
     $form['adm1'] = new Zend_Form_Element_Textarea('adm1');
     $form['adm1']->setLabel('Admin-1')->setValue($this->data['@adm1'])->setAttribs(array('rows' => '2', 'cols' => '20'));
     $form['adm2'] = new Zend_Form_Element_Textarea('adm2');
     $form['adm2']->setLabel('Admin-2')->setValue($this->data['@adm2'])->setAttribs(array('rows' => '2', 'cols' => '20'));
     $this->addElements($form);
     return $this;
 }
Beispiel #30
0
 public function getFormDefination()
 {
     $baseurl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $model = new Model_Wep();
     $this->setAttrib('class', 'simplified-sub-element');
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $types = $model->getCodeArray('DescriptionType', null, '1', true);
     $form['type'] = new Zend_Form_Element_Select('type');
     $form['type']->setLabel('Description Type')->setValue($this->data['@type'])->setAttrib('class', 'form-select')->setMultioptions($types);
     $form['text'] = new Zend_Form_Element_Textarea('text');
     $form['text']->setLabel('Description')->setValue($this->data['text'])->setRequired()->setAttribs(array('rows' => '3', 'cols' => '20'));
     $lang = $model->getCodeArray('Language', null, '1', true);
     $form['xml_lang'] = new Zend_Form_Element_Select('xml_lang');
     $form['xml_lang']->setLabel('Language')->setValue($this->data['@xml_lang'])->setAttrib('class', 'form-select')->setMultioptions($lang);
     $this->addElements($form);
     return $this;
 }