Esempio n. 1
0
 private static function checkAndLoadInputParams()
 {
     self::$file = InputData::getPost('file');
     self::$convertType = InputData::getPost('convertType');
     self::$options = array('hotelsNames' => InputData::getPost('hotelsNames'));
     return InputData::hasPost('file') & InputData::hasPost("convertType");
 }
 public function __construct(&$objPHPExcel, &$data, $options)
 {
     $this->selectedHotels = $options['hotelsNames'];
     $this->worksheet = $objPHPExcel->getActiveSheet();
     $this->data =& $data;
     $this->selectedHotels = InputData::getPost("hotelsNames");
 }
 public function __construct()
 {
     $this->app = App::getInstance();
     $this->config = $this->app->getConfig();
     $this->view = View::getInstance();
     $this->input = InputData::getInstance();
 }
Esempio n. 4
0
 private static function checkAndLoadInputParams()
 {
     self::$file = InputData::getPost('file');
     if (!self::$file) {
         self::$file = InputData::getGet('file');
     }
     return self::$file;
 }
Esempio n. 5
0
 private static function checkAndLoadInputParams()
 {
     self::$file = InputData::getPost('file');
     if (!self::$file) {
         self::$file = InputData::getGet('file');
     }
     if (InputData::getPost('convertType')) {
         self::$convertType = InputData::getPost('convertType');
     }
     return self::$file && self::$convertType;
 }
Esempio n. 6
0
 function populateWithPost($obj)
 {
     $post = parent::getInstance()->postAll();
     foreach ($post as $var => $value) {
         if (property_exists($obj, $var)) {
             if (is_array($value)) {
                 $obj->{$var} = array_map('trim', $value);
             } else {
                 //$setter = 'set'.$var;
                 //$obj->$setter($value);
                 $obj->{$var} = trim($value);
             }
         } else {
             throw new \Exception("Unexpected value for {$var} form input", 400);
         }
     }
 }
Esempio n. 7
0
 public function login()
 {
     if (!$this->isLogged && $_POST) {
         if ($_POST) {
             $username = Common::normalize("mysql|trim", InputData::getPost('username'));
             $password = Common::normalize("mysql|trim", InputData::getPost('password'));
             $sql = "SELECT * FROM users WHERE password = MD5('{$password}') and username = '******' and active = '1';";
             $data = core::$oDb->db_query($sql);
             if ($data && $data[0]['password'] == MD5($password)) {
                 unset($data[0]['password']);
                 Core::$oSession->authUserData = $data[0];
                 Router::redirect($this->redirectUrl);
             } else {
                 $this->loginForm();
             }
         }
     }
 }
Esempio n. 8
0
 public static function syncDepProducts($brand)
 {
     $db = new DEFProduct();
     $brand_model = new Branch();
     $id_branch = $brand_model->getIdBranchByName(ucfirst($brand));
     $downloaded = self::getDepProductsList($brand, array("\"TYP_KLIENTA\" = 'Osoby fizyczne'"));
     $current = $db->getActiveDepArray($id_branch);
     $delete1 = array_keys($current);
     $adapter = Zend_Db_Table::getDefaultAdapter();
     $sh = new Shaccept();
     $sh->dumpDepositsChanges();
     foreach ($downloaded as $id => $data) {
         try {
             $adapter->beginTransaction();
             if (!isset($current[$id])) {
                 self::lvl1ProductInsert($id, $id_branch, $data);
                 goto a;
             }
             unset($delete1[array_search($id, $delete1)]);
             foreach ($data as $client_type => $data2) {
                 if ($client_type == 'active') {
                     continue;
                 }
                 $lvl1 = false;
                 if (!isset($current[$id][$client_type])) {
                     self::lvl1ProductInsert($id, $id_branch, $data, $current[$id]['active']);
                     break;
                 }
                 foreach ($data2 as $currency => $data3) {
                     $desc = $data3['desc'];
                     $symbol = $data3['symbol'];
                     if ($current[$id][$client_type][$currency]['desc'] != $desc || $current[$id][$client_type][$currency]['symbol'] != $symbol) {
                         $lvl1 = true;
                         self::lvl1ProductInsert($id, $id_branch, $data, $current[$id]['active']);
                         break;
                     }
                     $delete2 = array_keys($current[$id][$client_type][$currency]['interest_data']);
                     foreach ($data3['interest_data'] as $cash => $data4) {
                         if (!isset($current[$id][$client_type][$currency]['interest_data'][$cash])) {
                             self::lvl2ProductInsert($id, $client_type, $cash, $currency, $data4);
                             continue;
                         }
                         unset($delete2[array_search($cash, $delete2)]);
                         $delete3 = array_keys($current[$id][$client_type][$currency]['interest_data'][$cash]);
                         foreach ($data4 as $period => $interest) {
                             if (!(isset($current[$id][$client_type][$currency]['interest_data'][$cash][$period]) && $current[$id][$client_type]['interest_data'][$cash][$period] == $interest)) {
                                 self::lvl3ProductInsert($id, $client_type, $cash, $currency, $period, $interest);
                             }
                             unset($delete3[array_search($period, $delete3)]);
                         }
                         if (!empty($delete3)) {
                             self::lvl3ProductDelete($id, $cash, $currency, $delete3);
                         }
                     }
                     if (!empty($delete2)) {
                         self::lvl2ProductDelete($id, $currency, $delete2);
                     }
                 }
                 if ($lvl1) {
                     continue;
                 }
             }
             a:
             $adapter->commit();
         } catch (Exception $exc) {
             $adapter->rollBack();
             throw new Exception($exc);
         }
     }
     if (!empty($delete1)) {
         self::lvl1ProductDelete($delete1);
     }
     $ida = new InputData();
     $ida->updateLastDepUpdate($id_branch);
 }
Esempio n. 9
0
 /**
  * 
  * @return \GTFramework\InputData
  */
 public static function getInstance()
 {
     if (self::$_instance == NULL) {
         self::$_instance = new \GTFramework\InputData(\GTFramework\App::getLoger());
     }
     return self::$_instance;
 }
Esempio n. 10
0
 public static function useMethod($Create, $Read, $Update, $Delete)
 {
     if (!InputData::getPost("_method")) {
         return $Read;
     }
     if (Router::$method == 'GET') {
         return $Read;
     } elseif (Router::$method == 'POST' && InputData::getPost("_method") == "PUT") {
         return $Update;
     } elseif (Router::$method == 'POST' && InputData::getPost("_method") == "DELETE") {
         return $Delete;
     } elseif (Router::$method == 'POST') {
         return $Create;
     }
 }
Esempio n. 11
0
 public function __call($name, $v)
 {
     return InputData::getInstance()->{$name}($v[0], $v[1], $v[2]);
 }