Beispiel #1
0
 /**
  * Inicjalizacja formularza
  */
 public function baseInit()
 {
     $this->_atModel = $atModel = new AddonType();
     $this->_bModel = $bModel = new Branch();
     $rows = $atModel->fetchAll('not ghost', 'name asc');
     $addons = array();
     foreach ($rows as $row) {
         $addons[Base_Convert::strToHex($row->id)] = $row->name;
     }
     $this->addElement('MultiCheckbox', 'addons', array('label' => 'Uzwględnij następujące dodatki:', 'MultiOptions' => $addons, 'value' => array_keys($addons), 'required' => true));
     $this->addons->getDecorator('row')->setOption('class', 'row widerow');
     $rows = $bModel->fetchAll('not ghost', 'web_name asc');
     $branches = array();
     foreach ($rows as $row) {
         $branches[Base_Convert::strToHex($row->id)] = $row->branch_name;
     }
     $this->addElement('MultiCheckbox', 'branches', array('label' => 'Uwzględnij następujące brandy:', 'MultiOptions' => $branches, 'value' => array_keys($branches), 'required' => true));
     $dic = new Logic_Dictionary();
     $cTypes = array();
     $this->_cDic = $cDic = $dic->getDictionaryEntriesByCode('client_type');
     foreach ($cDic as $ct) {
         $cTypes[Base_Convert::strToHex($ct->id)] = ucfirst($ct->entry);
     }
     $rows = $bModel->fetchAll('not ghost', 'web_name asc');
     $branches = array();
     foreach ($rows as $row) {
         $branches[Base_Convert::strToHex($row->id)] = $row->branch_name;
     }
     $this->addElement('MultiCheckbox', 'clients', array('label' => 'Uwzględnij nastepujących klientów:', 'MultiOptions' => $cTypes, 'value' => array_keys($cTypes), 'required' => true));
     $this->addElement('Select', 'timepoint', array('label' => 'Wyeksportuj wartości:', 'MultiOptions' => array('now' => 'Aktualne', 'archive' => 'Archiwalne'), 'required' => true));
     $this->datee(false, 'date', 'Data:', true, array('value' => date('Y-m-d'), 'required' => true));
     $this->addElement('text', 'time', array('label' => 'Godzina:', 'class' => 'timeentry', 'required' => true, 'value' => date('H:00:00'), 'validators' => array(array('validator' => 'Date', 'options' => array('format' => 'H:i:s')))));
     $this->submit(false, 'submitbtn', 'Eksportuj');
 }
Beispiel #2
0
 public function getTable($customerType, $addonType, $version = null)
 {
     $tableData = new stdClass();
     $tableData->header = array('');
     $tableData->data = array();
     $addonTypeModel = new AddonType();
     $addonTypeRow = $addonTypeModel->findOne($addonType);
     $addonTypeCode = $addonTypeRow->code;
     $branchModel = new Branch();
     $branches = $branchModel->fetchAll();
     foreach ($branches as $branch) {
         $tableData->header[] = $branch->branch_name;
     }
     $addon = new Addon();
     $addonResults = $addon->getOrderedAddons($customerType, $addonType, $version);
     $previousStep = null;
     $rowArray = array();
     foreach ($addonResults as $addonResult) {
         if ($addonResult->step_description !== $previousStep) {
             if ($previousStep !== null) {
                 $tableData->data[] = $rowArray;
             }
             $previousStep = $addonResult->step_description;
             switch ($addonTypeCode) {
                 case 'deposit_period':
                     $rowArray = array($previousStep);
                     break;
                 case 'deposit_amount':
                 case 'customer_engagement':
                     $rowArray = array(number_format($previousStep, 0, '.', ' '));
                     break;
                 case 'new_old_money':
                     if ($previousStep == 0) {
                         $rowArray = array('Stare środki');
                     } else {
                         $rowArray = array('Nowe środki');
                     }
                     break;
                 case 'brand':
                     $rowArray = array('Dodatek');
                     break;
             }
         }
         $rowArray[] = $addonResult->interest_value;
     }
     $tableData->data[] = $rowArray;
     return $tableData;
 }
Beispiel #3
0
 public function isActive()
 {
     $addonTypeModel = new AddonType();
     $addonTypeRow = $addonTypeModel->findOne($this->addonTypeId);
     return $addonTypeRow->is_active;
 }