diff --git a/plugins/AsdCurl/src/AsdCurl.php b/plugins/AsdCurl/src/AsdCurl.php index af437d6..68f2058 100644 --- a/plugins/AsdCurl/src/AsdCurl.php +++ b/plugins/AsdCurl/src/AsdCurl.php @@ -179,7 +179,7 @@ class AsdCurl //echo $this->html; die; $login_data = [ 'portal_username' => 'asd.trinkl', - 'portal_password' => 'HiegTzs!184', + 'portal_password' => 'HiegTzs!192', ]; $post = [ diff --git a/plugins/AsdCurl/src/AsdUs.php b/plugins/AsdCurl/src/AsdUs.php index 6cdd933..a7bf9f7 100644 --- a/plugins/AsdCurl/src/AsdUs.php +++ b/plugins/AsdCurl/src/AsdUs.php @@ -173,8 +173,8 @@ class AsdUs extends AsdCurl //die; } - public function save_up_data($ch) { - $SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl'); + public function save_up_data($ch,$env) { + $SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl.'.$env); // Maske US 01 01 vom linken Menü aufrufen $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); @@ -224,7 +224,7 @@ class AsdUs extends AsdCurl if(!($this->status)) { die($this->error); } - echo $this->html;die; + //echo $this->html;die; // Auf der Ergebnisseite auf "Alle" Klicken $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); diff --git a/src/Controller/CurlsController.php b/src/Controller/CurlsController.php index 2c61c6c..d93d833 100644 --- a/src/Controller/CurlsController.php +++ b/src/Controller/CurlsController.php @@ -99,14 +99,20 @@ class CurlsController extends AppController } public function saveup() { + if(isset($this->request->params['pass'][0])) { + $env = $this->request->params['pass'][0]; + } + else { + $env = 'prod'; + } $curl = new AsdUs(); //debug($curl->status); $ch = $curl->init_curl_params(); $curl->login_school($ch); - $curl->login_asd($ch); - $curl->save_up_data($ch); + $curl->login_asd($ch,$env); + $curl->save_up_data($ch,$env); $this->set('html',$curl->html); - $this->redirect(['action' => 'getjsonup']); + $this->redirect(['action' => 'getjsonup/'.$env]); } diff --git a/src/Controller/EmploymentsController.php b/src/Controller/EmploymentsController.php new file mode 100644 index 0000000..50aa201 --- /dev/null +++ b/src/Controller/EmploymentsController.php @@ -0,0 +1,65 @@ +Employments->newEntity(); + if ($this->request->is('post')) { + //debug($this->request->data); + $xmldata = $this->request->data['xmldata']; + $filename = $xmldata['tmp_name']; + //echo $filename; + $dataxml = file_get_contents($filename); + $dataxml = '' . $dataxml . ''; + //debug($dataxml);die; + $xml = simplexml_load_string($dataxml); + //debug($xml); + $json = json_encode($xml); + $array =json_decode($json,TRUE); + //debug($array);die; + $rows = ['TYP', 'ARBEITGEBER', 'DIENSTSTELLE','RECHTSVERHAELTNIS','VON','BIS', 'IST_NEBENTAETIGKEIT','MELDENDE_DIENSTSTELLE','UPZ_MIN','UPZ_MAX','BEURLAUBUNG','TEILZEIT','TEILZEITSTUNDEN_SCHULAUFSICHT','TEILZEITSTUNDEN','VIVA_PKZ','DV_ID']; + $this->set('rows',$rows); + $rows_eas = ['VON','BIS','STAT_RELEV_WOSTD','STUNDEN','STD_WISS','DIENSTSTELLE','LEH_ID','MELDENDE_DIENSTSTELLE','IST_KENNZAHLENRELEVANT']; + $this->set('rows_eas',$rows_eas); + + foreach($array['Lehrer'] as $teacher) { + //debug($teacher);die; + $teacher_nr =$teacher['PKZ']; + $part_nr = 0; + foreach($teacher['DV'] as $part) { + foreach($part as $key => $value) { + $data[$teacher_nr][$part_nr][$key] = $value; + } + $part_nr++; + } + $part_nr = 0; + if(isset($teacher['EAS'])) { + foreach($teacher['EAS'] as $part) { + foreach($part as $key => $value) { + $data_eas[$teacher_nr][$part_nr][$key] = $value; + } + $part_nr++; + } + } + + } + //debug($data); + //debug($rows); + //$list = implode($rows,','); + //debug($list); + //echo 'Hallo';die; + //debug($data_eas);die; + $this->set('data',$data); + if (isset($data_eas)) { + $this->set('data_eas',$data_eas); + } + } + $this->set('employment',$employment); + + } + + } \ No newline at end of file diff --git a/src/Controller/OfficesController.php b/src/Controller/OfficesController.php index 1ef37f3..605f7d3 100644 --- a/src/Controller/OfficesController.php +++ b/src/Controller/OfficesController.php @@ -31,7 +31,9 @@ class OfficesController extends AppController while ($row = fgetcsv($handle, $options['length'], $options['delimiter'])) { $data = array(); if($i == 0) { + //debug($row); $keys = $row; + //debug($keys); } else { $j = 0; diff --git a/src/Model/Entity/Employment.php b/src/Model/Entity/Employment.php new file mode 100644 index 0000000..7e46079 --- /dev/null +++ b/src/Model/Entity/Employment.php @@ -0,0 +1,31 @@ + true, + 'created' => true, + 'modified' => true + ]; +} diff --git a/src/Model/Table/EmploymentsTable.php b/src/Model/Table/EmploymentsTable.php new file mode 100644 index 0000000..e822341 --- /dev/null +++ b/src/Model/Table/EmploymentsTable.php @@ -0,0 +1,63 @@ +setTable('employments'); + $this->setDisplayField('id'); + $this->setPrimaryKey('id'); + + $this->addBehavior('Timestamp'); + } + + /** + * Default validation rules. + * + * @param \Cake\Validation\Validator $validator Validator instance. + * @return \Cake\Validation\Validator + */ + public function validationDefault(Validator $validator) + { + $validator + ->integer('id') + ->allowEmpty('id', 'create'); + + $validator + ->scalar('name') + ->maxLength('name', 255) + ->requirePresence('name', 'create') + ->notEmpty('name'); + + return $validator; + } +} diff --git a/src/Template/Curls/up_statistik.ctp b/src/Template/Curls/up_statistik.ctp index e3473fa..a4c8a1b 100644 --- a/src/Template/Curls/up_statistik.ctp +++ b/src/Template/Curls/up_statistik.ctp @@ -1,11 +1,11 @@ UP 2018 - Stand: ' . $time->i18nFormat('dd.MM.yyyy HH:mm') . ''; +echo '

UP ' . date("Y") .' - Stand: ' . $time->i18nFormat('dd.MM.yyyy HH:mm') . '

'; ?>