|
@@ -54,123 +54,93 @@ public static $helpEmailTo = 'biuro@bialnet.com.pl'; // todo:email na który zos
|
|
|
'uwagi',
|
|
|
];
|
|
|
|
|
|
-/**
|
|
|
- * View Page About Project
|
|
|
- */
|
|
|
- public function aboutAction() {
|
|
|
- UI::gora();
|
|
|
- echo UI::h('script', ['src'=>"static/sweetalert2.min.js"]);
|
|
|
- echo UI::h('link', ['rel'=>"stylesheet", 'type'=>"text/css", 'href'=>"static/sweetalert2.min.css"]);
|
|
|
- Theme::top();
|
|
|
- include('page-about.view.php');
|
|
|
- UI::dol();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * View Page training
|
|
|
- */
|
|
|
- public function trainingAction() {
|
|
|
- UI::gora();
|
|
|
- echo UI::h('script', ['src'=>"static/sweetalert2.min.js"]);
|
|
|
- echo UI::h('link', ['rel'=>"stylesheet", 'type'=>"text/css", 'href'=>"static/sweetalert2.min.css"]);
|
|
|
- Theme::top();
|
|
|
- include('page-training.view.php');
|
|
|
- UI::dol();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * View Page training
|
|
|
- */
|
|
|
- public function offerAction() {
|
|
|
- UI::gora();
|
|
|
- echo UI::h('script', ['src'=>"static/sweetalert2.min.js"]);
|
|
|
- echo UI::h('link', ['rel'=>"stylesheet", 'type'=>"text/css", 'href'=>"static/sweetalert2.min.css"]);
|
|
|
- Theme::top();
|
|
|
- include('page-offer.view.php');
|
|
|
- UI::dol();
|
|
|
+ function aboutAction() { $this->sendPageView('page-about.view.php'); }
|
|
|
+ function trainingAction() { $this->sendPageView('page-training.view.php'); }
|
|
|
+ function offerAction() { $this->sendPageView('page-offer.view.php'); }
|
|
|
+ function helpFormAction() { $this->sendPageView('page-help.view.php', [ $this, '_helpFormBeforeViewTrigger' ]); }
|
|
|
+ function _helpFormBeforeViewTrigger($args) {
|
|
|
+ $messageValidate = array();
|
|
|
+ if ( V::get('button_send', 0, $args) == 1 ) {
|
|
|
+ // fields form
|
|
|
+ $helpName = htmlentities(V::get('help_name', 0, $args));
|
|
|
+ $helpEmail = htmlentities(V::get('help_email', 0, $args));
|
|
|
+ $helpDescription = htmlentities(V::get('help_description', 0, $args));
|
|
|
+
|
|
|
+ if ( empty($helpDescription) && !filter_var($helpEmail, FILTER_VALIDATE_EMAIL)) {
|
|
|
+ $messageValidate['error'] = 1;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * View Page Help form
|
|
|
- */
|
|
|
- public function helpFormAction() {
|
|
|
- UI::gora();
|
|
|
- echo UI::h('script', ['src'=>"static/sweetalert2.min.js"]);
|
|
|
- echo UI::h('link', ['rel'=>"stylesheet", 'type'=>"text/css", 'href'=>"static/sweetalert2.min.css"]);
|
|
|
- Theme::top();
|
|
|
-
|
|
|
- $messageValidate = array();
|
|
|
- if( V::get('button_send', 0, $_POST) == 1 ){
|
|
|
-
|
|
|
- // fields form
|
|
|
- $helpName = htmlentities(V::get('help_name', 0, $_POST));
|
|
|
- $helpEmail = htmlentities(V::get('help_email', 0, $_POST));
|
|
|
- $helpDescription = htmlentities(V::get('help_description', 0, $_POST));
|
|
|
-
|
|
|
- if ( empty($helpDescription) && !filter_var($helpEmail, FILTER_VALIDATE_EMAIL)) {
|
|
|
- $messageValidate['error'] = 1;
|
|
|
- }
|
|
|
-
|
|
|
- $noticeRequest = 'Email: ' . $helpEmail . "; Treść zgłoszenia: " . $helpDescription;
|
|
|
-
|
|
|
- // data for create insert in DB
|
|
|
- $idQualityNotice = DB::getPDO()->insert('QUALITY_NOTICES', [
|
|
|
- 'NOTICE_INITIAL_TYPE' => 'BAD_PROCESS',
|
|
|
- 'ID_PROCES' => '1', //todo: ustalić ID procesu - ustawiłem defaultowo 1!!!!!
|
|
|
- 'NOTICE_REQUEST' => $noticeRequest,
|
|
|
- 'NOTICE_REPLY' => '',
|
|
|
- 'NOTICE_REPLY_TYPE' => 'BAD_PROCESS',
|
|
|
- 'L_APPOITMENT_DATE' => 'NOW()',
|
|
|
- 'L_APPOITMENT_USER' => User::getLogin(),
|
|
|
- 'ADM_ACCOUNT' => User::getLogin(),
|
|
|
- 'THIS_SINGLE_WASTE_COST' => '',
|
|
|
- 'WASTE_COST_COMMENT' => '',
|
|
|
- 'THIS_SINGLE_FIX_COST' => '',
|
|
|
- 'YEAR_COST_FOREACST_OF_SUCH_PROBLEM_WITH_FIXING' => '',
|
|
|
- 'FIX_COST_COMMENT' => '',
|
|
|
- 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
- 'A_RECORD_CREATE_DATE' => 'NOW()'
|
|
|
- ]);
|
|
|
-
|
|
|
- if( $idQualityNotice > 0 ) {
|
|
|
- $messageValidate['success'] = 'send';
|
|
|
+ $noticeRequest = 'Email: ' . $helpEmail . "; Treść zgłoszenia: " . $helpDescription;
|
|
|
+
|
|
|
+ // data for create insert in DB
|
|
|
+ $idQualityNotice = DB::getPDO()->insert('QUALITY_NOTICES', [
|
|
|
+ 'NOTICE_INITIAL_TYPE' => 'BAD_PROCESS',
|
|
|
+ 'ID_PROCES' => '1', //todo: ustalić ID procesu - ustawiłem defaultowo 1!!!!!
|
|
|
+ 'NOTICE_REQUEST' => $noticeRequest,
|
|
|
+ 'NOTICE_REPLY' => '',
|
|
|
+ 'NOTICE_REPLY_TYPE' => 'BAD_PROCESS',
|
|
|
+ 'L_APPOITMENT_DATE' => 'NOW()',
|
|
|
+ 'L_APPOITMENT_USER' => User::getLogin(),
|
|
|
+ 'ADM_ACCOUNT' => User::getLogin(),
|
|
|
+ 'THIS_SINGLE_WASTE_COST' => '',
|
|
|
+ 'WASTE_COST_COMMENT' => '',
|
|
|
+ 'THIS_SINGLE_FIX_COST' => '',
|
|
|
+ 'YEAR_COST_FOREACST_OF_SUCH_PROBLEM_WITH_FIXING' => '',
|
|
|
+ 'FIX_COST_COMMENT' => '',
|
|
|
+ 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
+ 'A_RECORD_CREATE_DATE' => 'NOW()'
|
|
|
+ ]);
|
|
|
|
|
|
- } else {
|
|
|
- $messageValidate['error'] = 2;
|
|
|
- }
|
|
|
+ if( $idQualityNotice > 0 ) {
|
|
|
+ $messageValidate['success'] = 'send';
|
|
|
+ } else {
|
|
|
+ $messageValidate['error'] = 2;
|
|
|
+ }
|
|
|
|
|
|
-/*
|
|
|
-TODO: dodać możliwość wysyłania maila używajac mail()
|
|
|
- // Data fpr create mail
|
|
|
- $to = self::$helpEmailTo; // uzupełnić mail
|
|
|
- $subject = 'Bocian - formularz pomocy';
|
|
|
- $message = "Zgłaszający: " . $helpName . " \r\n E-mail: " . $helpEmail . ". \r\n Treść wiadomości:\r\n " . $helpDescription;
|
|
|
- $headers = 'From: '. self::$helpEmailTo . "\r\n" .
|
|
|
- 'Reply-To: '. self::$helpEmailTo . "\r\n" .
|
|
|
- 'X-Mailer: PHP/' . phpversion();
|
|
|
+ /*
|
|
|
+ TODO: dodać możliwość wysyłania maila używajac mail()
|
|
|
+ // Data fpr create mail
|
|
|
+ $to = self::$helpEmailTo; // uzupełnić mail
|
|
|
+ $subject = 'Bocian - formularz pomocy';
|
|
|
+ $message = "Zgłaszający: " . $helpName . " \r\n E-mail: " . $helpEmail . ". \r\n Treść wiadomości:\r\n " . $helpDescription;
|
|
|
+ $headers = 'From: '. self::$helpEmailTo . "\r\n" .
|
|
|
+ 'Reply-To: '. self::$helpEmailTo . "\r\n" .
|
|
|
+ 'X-Mailer: PHP/' . phpversion();
|
|
|
|
|
|
- $sendMail = mail($to, $subject, $message, $headers);
|
|
|
+ $sendMail = mail($to, $subject, $message, $headers);
|
|
|
|
|
|
- if( $sendMailResponse == true ) {
|
|
|
- $responseSendMail = true;
|
|
|
- $messageValidate['success'] = 'send';
|
|
|
+ if( $sendMailResponse == true ) {
|
|
|
+ $responseSendMail = true;
|
|
|
+ $messageValidate['success'] = 'send';
|
|
|
|
|
|
- } else {
|
|
|
- $messageValidate['error'] = 2;
|
|
|
- }
|
|
|
-*/
|
|
|
+ } else {
|
|
|
+ $messageValidate['error'] = 2;
|
|
|
+ }
|
|
|
+ */
|
|
|
+ }
|
|
|
+ return [
|
|
|
+ 'messageValidate' => $messageValidate,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ function sendPageView($templateFile, $beforeViewTrigger = null) {
|
|
|
+ UI::gora();
|
|
|
+ echo UI::h('script', ['src'=>"static/sweetalert2.min.js"]);
|
|
|
+ echo UI::h('link', ['rel'=>"stylesheet", 'type'=>"text/css", 'href'=>"static/sweetalert2.min.css"]);
|
|
|
+ Theme::top();
|
|
|
+ $tmplPath = __FILE__ . '.' . $templateFile;
|
|
|
+ if (!file_exists($tmplPath)) throw new Exception("Template file not exists '{$templateFile}'");
|
|
|
|
|
|
+ if ($beforeViewTrigger && is_callable($beforeViewTrigger)) {
|
|
|
+ $data = $beforeViewTrigger($_POST);
|
|
|
+ if (is_array($data) && !empty($data)) {
|
|
|
+ extract($data);
|
|
|
}
|
|
|
-
|
|
|
- include('page-help.view.php');
|
|
|
- UI::dol();
|
|
|
}
|
|
|
+ include($tmplPath);
|
|
|
+ UI::dol();
|
|
|
+ }
|
|
|
|
|
|
- public function defaultAction() {
|
|
|
-
|
|
|
+ function defaultAction() {
|
|
|
UI::gora();
|
|
|
echo UI::h('script', ['src'=>"static/sweetalert2.min.js"]);
|
|
|
echo UI::h('link', ['rel'=>"stylesheet", 'type'=>"text/css", 'href'=>"static/sweetalert2.min.css"]);
|