예제 #1
0
파일: Print.php 프로젝트: knatorski/SMS
 /**
  * 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');
 }
예제 #2
0
파일: Calculate.php 프로젝트: knatorski/SMS
 protected function getBrands()
 {
     $brandModel = new Branch();
     $brandsResult = $brandModel->fetchAll();
     $brands = array();
     foreach ($brandsResult as $brand) {
         $brands[$brand->id] = $brand->branch_name;
     }
     return $brands;
 }
예제 #3
0
파일: Add.php 프로젝트: knatorski/SMS
 public function getBranches()
 {
     $branchModel = new Branch();
     $branches = $branchModel->fetchAll();
     $branchOptions = array();
     foreach ($branches as $branch) {
         $branchOptions[$branch->id] = $branch->web_name;
     }
     return $branchOptions;
 }
예제 #4
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;
 }
예제 #5
0
파일: init.php 프로젝트: knatorski/SMS
} else {
    echo "\n\nParametr app_env jest wymagany!";
    echo "\n\n" . $opts->getUsageMessage() . "\n\n";
    exit;
}
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
Base_Controller_Action_Helper_Currentip::$_unitTestEnabled = true;
$application->bootstrap();
$application->getBootstrap()->runForCmd();
Zend_Controller_Front::getInstance()->setParam('bootstrap', $application->getBootstrap());
Zend_registry::set('config', $application->getOptions());
$user = $application->getOption('bin');
$u = new User();
$u_data = $u->fetchAll("login = '******'user'] . "'", "id DESC", 1);
if (null == $u_data) {
    throw new Exception('Brak użytkownika o podanym ID');
}
$u_data = $u_data->toArray();
$storageRow = new stdClass();
foreach ($u_data[0] as $key => $value) {
    $storageRow->{$key} = $value;
}
$auth = Zend_Auth::getInstance();
$storage = $auth->getStorage();
$o = new Branch();
$data = $o->fetchAll("branch_name = '" . $user['branch'] . "'", "id DESC", 1)->toArray();
$storageRow->jednostka = $data[0];
$storage->write($storageRow);
예제 #6
0
 public function __construct($options = null)
 {
     $model = new Branch();
     $this->braches = $model->fetchAll();
     parent::__construct($options);
 }
예제 #7
0
파일: Branch.php 프로젝트: knatorski/SMS
 public function updateBranch($form, $id)
 {
     $values = $form->getValues();
     $branch = new Branch();
     $row = $branch->findOne($id);
     if ($values['desk'] == 0) {
         $values['desk'] = new Zend_Db_Expr("0");
     }
     $row->setFromArray($values);
     $form_groups = $values['groups'];
     $form_groups = $form_groups ? $form_groups : array();
     $branch_groups = $this->getGroupsForBranch($id);
     foreach ($branch->fetchAll($branch_groups) as $group) {
         if (false === ($key = array_search($group->id, $form_groups))) {
             $this->removeBranchFromGroup($id, $group->id);
         }
         unset($form_groups[$key]);
     }
     foreach ($form_groups as $group) {
         $this->addBranchToGroup($id, $group);
     }
     $row->save();
 }
예제 #8
0
파일: Branches.php 프로젝트: knatorski/SMS
 public function __construct($options = null)
 {
     $o = new Branch();
     $this->oddzialy = $o->fetchAll(array('ghost = false and id != ' . $options['id_branch']))->toArray();
     parent::__construct($options);
 }
예제 #9
0
파일: User.php 프로젝트: knatorski/SMS
 public function getDataToUserReport()
 {
     $profileModel = new Profile();
     $select = $profileModel->select()->order('id_user');
     $profileDataArray = $profileModel->fetchAll($select)->toArray();
     $groupModel = new Group();
     $select = $groupModel->select();
     $groupDataArray = $groupModel->fetchAll($select)->toArray();
     foreach ($groupDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $groupDataArray = $tmp;
     unset($tmp);
     $branchModel = new Branch();
     $select = $branchModel->select();
     $branchDataArray = $branchModel->fetchAll($select)->toArray();
     foreach ($branchDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $branchDataArray = $tmp;
     unset($tmp);
     $userModel = new User();
     $select = $userModel->select();
     $userDataArray = $userModel->fetchAll($select)->toArray();
     foreach ($userDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $userDataArray = $tmp;
     unset($tmp);
     $roleModel = new Role();
     $select = $roleModel->select();
     $roleDataArray = $roleModel->fetchAll($select)->toArray();
     foreach ($roleDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $roleDataArray = $tmp;
     unset($tmp);
     $groupArray = array();
     foreach ($profileDataArray as $key => $value) {
         $data = $this->getAuthorizationsForProfile($value['id']);
         foreach ($data as $key2 => $values) {
             foreach ($values as $key3 => $privs) {
                 /* if ($privs['ghost'] === true) {
                     unset($data[$key2][$key3]);
                     continue;
                     }
                    */
                 $tmp = array('login' => '', 'surname' => '', 'first_name' => '', 'group' => '', 'role' => '', 'branch' => '', 'ghost' => '');
                 if ($key2 === 'group') {
                     $tmp['group'] = $groupDataArray[$privs['id_group']]['group_name'];
                 }
                 if ($key2 === 'role') {
                     $tmp['role'] = $roleDataArray[$privs['id_role']]['description'];
                 }
                 $tmp['login'] = $userDataArray[$value['id_user']]['login'];
                 $tmp['surname'] = $userDataArray[$value['id_user']]['surname'];
                 $tmp['first_name'] = $userDataArray[$value['id_user']]['first_name'];
                 $tmp['branch'] = $branchDataArray[$value['id_branch']]['branch_name'];
                 $tmp['ghost'] = $userDataArray['ghost'] ? 'NIEAKTYWNY' : 'AKTYWNY';
                 $groupArray[] = $tmp;
             }
         }
     }
     return $groupArray;
 }
예제 #10
0
파일: Profiles.php 프로젝트: knatorski/SMS
 public function __construct($options = null)
 {
     $oddzialModel = new Branch();
     $this->branches = $oddzialModel->fetchAll(array('ghost = false'))->toArray();
     parent::__construct($options);
 }