diff --git a/_ajax/EVERY_FILE_MUST_HAVE_644 b/_ajax/EVERY_FILE_MUST_HAVE_644 new file mode 100644 index 0000000..e69de29 diff --git a/_ajax/send_notify.php b/_ajax/send_notify.php new file mode 100644 index 0000000..a0ceda3 --- /dev/null +++ b/_ajax/send_notify.php @@ -0,0 +1,118 @@ + $value) { + trigger_error($_SERVER['HTTP_HOST'], E_USER_NOTICE); +} +*/ +if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach'); +else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos'); + +if (empty($_POST['uk_id'])) { + echo json_encode(null); +} + +else { + $toNotify = new user_kid(); + $toNotify->set_user_data_by_id($_POST['uk_id']); + + if (null === $toNotify->get_uk_notify_email() || null === $toNotify->get_uk_notify_name()) { + echo json_encode('missing-data'); + } + else { + $email_template_id = $sql->single_variable('select et_id from email_template where et_name = \'below_zero\''); + if (null !== $email_template_id) { + $emailTemplate = new email_template(); + $emailTemplate->set_et_data_by_id($email_template_id); + + $raw_subject = $emailTemplate->get_et_subject(); + $raw_message = $emailTemplate->get_et_message(); + //var_dump($toNotify_array); + //foreach ($toNotify_array as $toNotify) { + $personalizedSubject = $emailTemplate->personalize($raw_subject, array( + 'uk_name' => $toNotify->get_uk_name(), + )); + + $personalizedMessage = $emailTemplate->personalize($raw_message, array( + 'notify_name' => $toNotify->get_uk_notify_name(), + 'uk_name' => $toNotify->get_uk_name(), + 'uk_balance' => $toNotify->get_uk_balance(), + 'uk_password' => $toNotify->get_uk_password(), + )); + + $mail = new PHPMailer(true); // Passing `true` enables exceptions + try { + //Server settings + $mail->SMTPDebug = 0; // Enable verbose debug output + $mail->isSMTP(); // Set mailer to use SMTP + $mail->CharSet = PHPMailer::CHARSET_UTF8; // UTF-8 + $mail->Host = 'mail.gginternet.com '; // Specify main and backup SMTP servers + $mail->SMTPAuth = true; // Enable SMTP authentication + $mail->Username = 'hirlevel@tollaslabda.info'; // SMTP username + $mail->Password = 'tollas12'; // SMTP password + $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted + $mail->Port = 465; // TCP port to connect to + + //Recipients + $mail->setFrom($emailTemplate->get_et_from_email(), $emailTemplate->get_et_from_name()); + $mail->addAddress($toNotify->get_uk_notify_email(), $toNotify->get_uk_notify_name()); + //$mail->addAddress('tricsusz@gmail.com', 'Tóth Richárd'); // TEST + + + //Content + $mail->isHTML(true); // Set email format to HTML + $mail->Subject = $personalizedSubject; + $mail->Body = $personalizedMessage; + $mail->AltBody = 'Az Ön levelezője nem támogatja a HTML tartalom megjelenítését!'; + + //send mail + $mail->send(); + //LOG SUCCESS + email_log::create_email_log( + $personalizedMessage, + $personalizedSubject, + $toNotify->get_uk_notify_name(), + $toNotify->get_uk_notify_email(), + $emailTemplate->get_et_id() + ); + + //Update kids last noti date + $sql->update_table('user_kid', array('uk_last_notification' => date('Y-m-d H:i:s')), array('uk_id' => $toNotify->get_uk_id())); + + echo json_encode('success'); + + } catch (Exception $e) { + //LOG ERROR + email_log::create_email_log( + $personalizedMessage, + $personalizedSubject, + $toNotify->get_uk_notify_name(), + $toNotify->get_uk_notify_email(), + $emailTemplate->get_et_id(), + mysql_escape_string($e) + ); + + echo json_encode(null); + } + + //} + } + } +} + +?> diff --git a/_class/class_shuttle.php b/_class/class_shuttle.php deleted file mode 100644 index c6bb3be..0000000 --- a/_class/class_shuttle.php +++ /dev/null @@ -1,73 +0,0 @@ -cst_id; - } - - /** - * Sets the value of cst_id. - * - * @param mixed $cst_id the cst id - * - * @return self - */ - private function set_cst_id($cst_id) - { - $this->cst_id = $cst_id; - - return $this; - } - - /** - * Gets the value of cst_name. - * - * @return mixed - */ - public function get_cst_name() - { - return $this->cst_name; - } - - /** - * Sets the value of cst_name. - * - * @param mixed $cst_name the cst name - * - * @return self - */ - private function set_cst_name($cst_name) - { - $this->cst_name = $cst_name; - - return $this; - } - - public function set_cst_data_by_id($_cst_id) { - global $sql; - $cst_assoc_array = $sql->assoc_array("select * from camp_shuttle_type where cst_id = " . $_cst_id); - $cst_array = $cst_assoc_array[0]; - //alapadatok - foreach ($cst_array as $field => $value) { - $function_name = "set_" . $field; - $this->$function_name($value); - } - - } -} - - -?> \ No newline at end of file diff --git a/_css/default.css b/_css/default.css index d612f11..2f7e7f7 100644 --- a/_css/default.css +++ b/_css/default.css @@ -692,6 +692,24 @@ form#auto_filters > div > label { display: inline; } +.notification-text { + margin: -3px 0px 0px 20px; + padding: 3px 3px; + background-color: cadetblue; +} + +.notification-text.in-progress { + background-color: #f5ea16; +} + +.notification-text.success { + background-color: #26f329; +} + +.notification-text.fail { + background-color: #f6625c; +} + @media (min-width: 680px) { .categories { diff --git a/_include/include_balance_list.php b/_include/include_balance_list.php index 787feb2..2e0152f 100644 --- a/_include/include_balance_list.php +++ b/_include/include_balance_list.php @@ -3,35 +3,69 @@ # HA NINCS ID, AKKOR EGYENLEGLISTA # HA VAN ID, AKKOR RENDEZÉS IS VAN +$where = ''; if ($this->is_id()) { - # RENDEZÉS + # RENDEZÉS + + /* + + */ + switch ($this->get_id()) { + case 1: + //1 - egyenleg szerint növekvő + $order_by = 'uk_balance ASC, uk_name ASC'; + $url_postfix = '/' . $this->get_id(); + break; + case 2: + //2 - tartozások + $where = ' AND uk_balance < 0'; + $order_by = 'uk_name ASC'; + $url_postfix = '/' . $this->get_id(); + break; + case 3: + //3 - tartozások csökkenőben + $where = ' AND uk_balance < 0'; + $order_by = 'uk_balance ASC, uk_name ASC'; + $url_postfix = '/' . $this->get_id(); + break; + case 4: + //4 - tartozások növekvőben + $where = ' AND uk_balance < 0'; + $order_by = 'uk_balance DESC, uk_name ASC'; + $url_postfix = '/' . $this->get_id(); + break; + case 5: + //5 - tartozások növekvőben + $where = ' AND uk_balance < 0'; + $order_by = 'uk_last_notification DESC, uk_name ASC'; + $url_postfix = '/' . $this->get_id(); + break; + + default: + # code... + break; + } - /* - 1 - egyenleg szerint növekvő - */ - $order_by = 'uk_balance ASC, uk_name ASC'; - $url_postfix = '/' . $this->get_id(); - } else { - # EGYENLEG LISTA - $order_by = 'uk_name ASC'; - $url_postfix = ''; - + # EGYENLEG LISTA + $order_by = 'uk_name ASC'; + $url_postfix = ''; } -$active_kid_assoc_array = $sql->assoc_array('select * from user_kid where uk_deleted = 0 and uk_is_active = 1 order by '. $order_by .';'); +$active_kid_assoc_array = $sql->assoc_array('select * from user_kid where uk_deleted = 0 and uk_is_active = 1'.$where.' order by '. $order_by .';'); $user_kids = array(); foreach ($active_kid_assoc_array as $kid) { - $new_kid = new user_kid(); - $new_kid->set_user_data_by_id($kid['uk_id']); - $user_kids[] = $new_kid; + $new_kid = new user_kid(); + $new_kid->set_user_data_by_id($kid['uk_id']); + $user_kids[] = $new_kid; } +$smarty->assign('page_id', $this->is_id() ? $this->get_id() : null); $smarty->assign('user_kids', $user_kids); $smarty->assign('url_postfix', $url_postfix); $smarty->display('user_balance_list.tpl'); -?> \ No newline at end of file +?> diff --git a/template/templates/user_balance_list.tpl b/template/templates/user_balance_list.tpl index 238ff0d..df80a93 100644 --- a/template/templates/user_balance_list.tpl +++ b/template/templates/user_balance_list.tpl @@ -1,21 +1,71 @@
- Név szerinti rendezés - Egyenleg szerinti rendezés - Egyenleg frissítése + Név szerinti rendezés + Egyenleg szerinti rendezés + Tartozások + Egyenleg frissítése
+
+{if $page_id == 2 || $page_id == 3 || $page_id == 4 || $page_id == 5} +
+ Legnagyobb tartozás előre + Legkisebb tartozás előre + Kiküldés szerint rendezés +
+{/if} -
- {foreach $user_kids as $user} - -
- - {$user->get_uk_name()} - {$user->get_uk_balance()|number_format:0:'':' '} Ft -
-
- {/foreach} - +
+ {foreach $user_kids as $user} + +
+ + {$user->get_uk_name()} + {if $user->get_uk_last_notification() && $page_id >= 2} + ({$user->get_uk_last_notification()}) + {/if} + {if $user->get_uk_balance() < 0} + Értesítő e-mail + {/if} + {$user->get_uk_balance()|number_format:0:'':' '} Ft +
+
+ {/foreach}
+