Remove some user data + send money email + email log #1
113
_ajax/send_notify.php
Normal file
113
_ajax/send_notify.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
//ini_set('include_path', '../_class/');
|
||||
|
||||
include '../_class/class_user_parent.php';
|
||||
foreach (glob("../_class/*.php") as $filename) {
|
||||
//echo $filename;
|
||||
$skip = array(
|
||||
'../_class/class_user_parent.php',
|
||||
'../_class/class_Exception.php',
|
||||
);
|
||||
if (in_array($filename, $skip))
|
||||
continue;
|
||||
|
||||
include $filename;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
foreach ($_POST as $key => $value) {
|
||||
trigger_error($_SERVER['HTTP_HOST'], E_USER_NOTICE);
|
||||
}
|
||||
*/
|
||||
include('../_include/include_db_conn.php');
|
||||
|
||||
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_parent_1()->get_up_email() || null === $toNotify->get_uk_parent_1()->get_up_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_parent_1()->get_up_name(),
|
||||
'uk_name' => $toNotify->get_uk_name(),
|
||||
));
|
||||
|
||||
$mail = new PHPMailer(true); // Passing `true` enables exceptions
|
||||
try {
|
||||
//Server settings
|
||||
$mail->SMTPDebug = 4; // Enable verbose debug output
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->CharSet = PHPMailer::CHARSET_UTF8; // UTF-8
|
||||
$mail->Host = 'mail.livingsport.hu'; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'notify@livingsport.hu'; // SMTP username
|
||||
$mail->Password = 'dpDiKSqU0V'; // SMTP password
|
||||
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
|
||||
$mail->Port = 465;
|
||||
|
||||
//Recipients
|
||||
$mail->setFrom($emailTemplate->get_et_from_email(), $emailTemplate->get_et_from_name());
|
||||
// $mail->addAddress($toNotify->get_uk_parent_1()->get_up_email(), $toNotify->get_uk_parent_1()->get_up_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_parent_1()->get_up_name(),
|
||||
$toNotify->get_uk_parent_1()->get_up_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_parent_1()->get_up_name(),
|
||||
$toNotify->get_uk_parent_1()->get_up_email(),
|
||||
$emailTemplate->get_et_id(),
|
||||
mysql_escape_string($e)
|
||||
);
|
||||
|
||||
echo json_encode(null);
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -221,7 +221,7 @@ class camp_apply
|
||||
$mail->SMTPDebug = 0; // Enable verbose debug output
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->CharSet = PHPMailer::CHARSET_UTF8; // UTF-8
|
||||
$mail->Host = 'mail.livingsport.hu '; // Specify main and backup SMTP servers
|
||||
$mail->Host = 'mail.livingsport.hu'; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'notify@livingsport.hu'; // SMTP username
|
||||
$mail->Password = 'dpDiKSqU0V'; // SMTP password
|
||||
|
||||
212
_class/class_email_log.php
Normal file
212
_class/class_email_log.php
Normal file
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
|
||||
class email_log
|
||||
{
|
||||
private $el_id;
|
||||
private $el_message;
|
||||
private $el_subject;
|
||||
private $el_to_name;
|
||||
private $el_to_email;
|
||||
private $el_sent_date;
|
||||
private $el_exception;
|
||||
private $el_email_template_et_id;
|
||||
|
||||
public function set_el_data_by_id($_id)
|
||||
{
|
||||
global $sql;
|
||||
$el_data_assoc_array = $sql->assoc_array("select * from email_log where el_id = " . $_id);
|
||||
$el_data_array = $el_data_assoc_array[0];
|
||||
foreach ($el_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value);
|
||||
if ('el_email_template_et_id' == $field) {
|
||||
$new_et = new email_template();
|
||||
$new_et->set_et_data_by_id($value);
|
||||
$this->set_el_email_template_et_id($new_et);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function create_email_log($_message, $_subject, $_name, $_email, $_et, $_exc = 'null', $_date = null)
|
||||
{
|
||||
global $sql;
|
||||
|
||||
if (null === $_date) {
|
||||
$_date = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
return $sql->insert_into('email_log', array(
|
||||
'el_message' => $_message,
|
||||
'el_subject' => $_subject,
|
||||
'el_to_name' => $_name,
|
||||
'el_to_email' => $_email,
|
||||
'el_email_template_et_id' => $_et,
|
||||
'el_exception' => $_exc,
|
||||
'el_sent_date' => $_date
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_id()
|
||||
{
|
||||
return $this->el_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_id($el_id)
|
||||
{
|
||||
$this->el_id = $el_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_message()
|
||||
{
|
||||
return $this->el_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_message
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_message($el_message)
|
||||
{
|
||||
$this->el_message = $el_message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_subject()
|
||||
{
|
||||
return $this->el_subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_subject
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_subject($el_subject)
|
||||
{
|
||||
$this->el_subject = $el_subject;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_to_name()
|
||||
{
|
||||
return $this->el_to_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_to_name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_to_name($el_to_name)
|
||||
{
|
||||
$this->el_to_name = $el_to_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_to_email()
|
||||
{
|
||||
return $this->el_to_email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_to_email
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_to_email($el_to_email)
|
||||
{
|
||||
$this->el_to_email = $el_to_email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_sent_date()
|
||||
{
|
||||
return $this->el_sent_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_sent_date
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_sent_date($el_sent_date)
|
||||
{
|
||||
$this->el_sent_date = $el_sent_date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_exception()
|
||||
{
|
||||
return $this->el_exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_exception
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_exception($el_exception)
|
||||
{
|
||||
$this->el_exception = $el_exception;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_email_template_et_id()
|
||||
{
|
||||
return $this->el_email_template_et_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_email_template_et_id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_email_template_et_id($el_email_template_et_id)
|
||||
{
|
||||
$this->el_email_template_et_id = $el_email_template_et_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -128,6 +128,11 @@ class user_kid extends user_parent {
|
||||
public function get_uk_shirt_size() {
|
||||
return $this->user_shirt_size;
|
||||
}
|
||||
|
||||
public function get_uk_is_active() {
|
||||
return $this->user_is_active;
|
||||
}
|
||||
|
||||
public function get_uk_shirt_size_name() {
|
||||
global $sql;
|
||||
if ($this->user_shirt_size) return $sql->single_variable("select shirt_name from shirt where shirt_id = " . $this->user_shirt_size);
|
||||
@@ -375,6 +380,11 @@ class user_kid extends user_parent {
|
||||
$city->set_school_city_data_by_id($value);
|
||||
$this->set_uk_address($city);
|
||||
}
|
||||
if ($field == 'uk_parent_1' && !empty($value)) {
|
||||
$parent = new user_parent();
|
||||
$parent->set_user_data_by_id($value);
|
||||
$this->set_uk_parent_1($parent);
|
||||
}
|
||||
//$this->set_ua_type(2); //kid típus beállítása
|
||||
}
|
||||
$this->set_login(true);
|
||||
@@ -418,25 +428,12 @@ class user_kid extends user_parent {
|
||||
$_user_value_array['uk_parent_1'] = self::add_new_parent(
|
||||
$_user_value_array['add_parent_1'],
|
||||
$_user_value_array['parent_1_email'],
|
||||
$_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']);
|
||||
'', $_user_value_array['parent_1_phone']);
|
||||
log::register('new_parent', $_user_value_array['uk_parent_1']);
|
||||
}
|
||||
if (isset($_user_value_array['add_parent_1'])) unset($_user_value_array['add_parent_1']);
|
||||
if (isset($_user_value_array['parent_1_email'])) unset($_user_value_array['parent_1_email']);
|
||||
if (isset($_user_value_array['parent_1_facebook'])) unset($_user_value_array['parent_1_facebook']);
|
||||
if (isset($_user_value_array['parent_1_phone'])) unset($_user_value_array['parent_1_phone']);
|
||||
//PARENT_2 HANDLER
|
||||
if (isset($_user_value_array['add_parent_2']) && $_user_value_array['add_parent_2'] != "") {
|
||||
$_user_value_array['uk_parent_2'] = self::add_new_parent(
|
||||
$_user_value_array['add_parent_2'],
|
||||
$_user_value_array['parent_2_email'], $_user_value_array['parent_2_facebook'],
|
||||
$_user_value_array['parent_2_phone']);
|
||||
log::register('new_parent', $_user_value_array['uk_parent_2']);
|
||||
}
|
||||
if (isset($_user_value_array['add_parent_2'])) unset($_user_value_array['add_parent_2']);
|
||||
if (isset($_user_value_array['parent_2_email'])) unset($_user_value_array['parent_2_email']);
|
||||
if (isset($_user_value_array['parent_2_facebook'])) unset($_user_value_array['parent_2_facebook']);
|
||||
if (isset($_user_value_array['parent_2_phone'])) unset($_user_value_array['parent_2_phone']);
|
||||
|
||||
//date handler
|
||||
if (!isset($_user_value_array['uk_first_training']) || $_user_value_array['uk_first_training'] == "") {
|
||||
@@ -482,38 +479,21 @@ class user_kid extends user_parent {
|
||||
$_user_value_array['uk_parent_1'] = self::add_new_parent(
|
||||
$_user_value_array['add_parent_1'],
|
||||
$_user_value_array['parent_1_email'],
|
||||
$_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']);
|
||||
'', $_user_value_array['parent_1_phone']);
|
||||
log::register('new_parent', $_user_value_array['uk_parent_1']);
|
||||
}
|
||||
else {
|
||||
//meglévő szülő updatelése
|
||||
user_parent::update_parent(array(
|
||||
'up_email' => $_user_value_array['parent_1_email'],
|
||||
'up_facebook' => $_user_value_array['parent_1_facebook'],
|
||||
'up_phone' => $_user_value_array['parent_1_phone']), $_user_value_array['uk_parent_1']);
|
||||
|
||||
}
|
||||
if (isset($_user_value_array['add_parent_1'])) unset($_user_value_array['add_parent_1']);
|
||||
if (isset($_user_value_array['parent_1_email'])) unset($_user_value_array['parent_1_email']);
|
||||
if (isset($_user_value_array['parent_1_facebook'])) unset($_user_value_array['parent_1_facebook']);
|
||||
if (isset($_user_value_array['parent_1_phone'])) unset($_user_value_array['parent_1_phone']);
|
||||
//PARENT_2 HANDLER
|
||||
if (isset($_user_value_array['add_parent_2']) && $_user_value_array['add_parent_2'] != "") {
|
||||
$_user_value_array['uk_parent_2'] = self::add_new_parent(
|
||||
$_user_value_array['add_parent_2'],
|
||||
$_user_value_array['parent_2_email'], $_user_value_array['parent_2_facebook'],
|
||||
$_user_value_array['parent_2_phone']);
|
||||
log::register('new_parent', $_user_value_array['uk_parent_2']);
|
||||
}
|
||||
else {
|
||||
//meglévő szülő updatelése
|
||||
//var_dump($_user_value_array['uk_parent_2']);
|
||||
user_parent::update_parent(array(
|
||||
'up_email' => $_user_value_array['parent_2_email'],
|
||||
'up_facebook' => $_user_value_array['parent_2_facebook'],
|
||||
'up_phone' => $_user_value_array['parent_2_phone']), $_user_value_array['uk_parent_2']);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_user_value_array['add_parent_2'])) unset($_user_value_array['add_parent_2']);
|
||||
if (isset($_user_value_array['parent_2_email'])) unset($_user_value_array['parent_2_email']);
|
||||
if (isset($_user_value_array['parent_2_facebook'])) unset($_user_value_array['parent_2_facebook']);
|
||||
|
||||
@@ -42,8 +42,13 @@
|
||||
text-shadow: 0 1px 0 #2f2f2f;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.button.black[disabled] {
|
||||
color: #aa9e9e;
|
||||
background: linear-gradient(#656565, #6a6262);
|
||||
}
|
||||
|
||||
.button.black:hover {
|
||||
.button.black:not([disabled]):hover {
|
||||
background: #4c4c4c;
|
||||
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#4c4c4c), to(#565656));
|
||||
background: -moz-linear-gradient(#4c4c4c, #565656);
|
||||
|
||||
@@ -759,6 +759,10 @@ form#auto_filters > div > label {
|
||||
background-color: cadetblue;
|
||||
}
|
||||
|
||||
.notification-text.disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.notification-text.in-progress {
|
||||
background-color: #f5ea16;
|
||||
}
|
||||
|
||||
17
_include/include_email.php
Normal file
17
_include/include_email.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
if ($this->is_id()) {
|
||||
|
||||
# EMAIL LOG RÉSZLETEK
|
||||
|
||||
$email_log = new email_log();
|
||||
$email_log->set_el_data_by_id($this->get_id());
|
||||
|
||||
$smarty->assign('email', $email_log);
|
||||
$smarty->display('email.tpl');
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
37
_include/include_emails.php
Normal file
37
_include/include_emails.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
if ($this->is_id()) {
|
||||
|
||||
# EMAIL LISTA (50 / oldal)
|
||||
|
||||
$all_emails_query = "SELECT count(DISTINCT el_id) FROM email_log";
|
||||
$emails_query = "SELECT * FROM email_log ORDER BY el_sent_date DESC LIMIT " . ($this->is_id() ? ($this->get_id() - 1) * 50 : "0") . ",50";
|
||||
$el_assoc_array = $sql->assoc_array($emails_query);
|
||||
$el_count = $sql->single_variable($all_emails_query);
|
||||
$next_link = true;
|
||||
|
||||
$el_array = array();
|
||||
foreach ($el_assoc_array as $key => $el) {
|
||||
$new_el = new email_log();
|
||||
$new_el->set_el_data_by_id($el['el_id']);
|
||||
$el_array[] = $new_el;
|
||||
}
|
||||
|
||||
$fold = $el_count > 50;
|
||||
|
||||
if ($el_count <= $this->get_id() * 50) {
|
||||
$next_link = false;
|
||||
}
|
||||
|
||||
$smarty->assign('el_array', $el_array);
|
||||
$smarty->assign('fold', $fold);
|
||||
$smarty->assign('next_id', $next_link ? $this->get_id() + 1 : false);
|
||||
$smarty->assign('previous_id', ($this->get_id() > 1 ? $this->get_id() - 1 : false));
|
||||
|
||||
$smarty->display('emails.tpl');
|
||||
} else {
|
||||
header("Location: /admin/emails/1");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -3,28 +3,33 @@
|
||||
$userAssocArray = $sql->assoc_array("
|
||||
SELECT
|
||||
uk_name AS 'Név',
|
||||
GROUP_CONCAT(trt_name) as 'Szint',
|
||||
sc_name as 'Iskola',
|
||||
uk_email as 'Email',
|
||||
uk_phone as 'Telefonszám',
|
||||
p1.up_name as 'Szülő1',
|
||||
p1.up_email as 'Sz1_Email',
|
||||
p1.up_phone as 'Sz1_Telefonszám',
|
||||
p2.up_name as 'Szülő2',
|
||||
p2.up_email as 'Sz2_Email',
|
||||
p2.up_phone as 'Sz2_Telefonszám'
|
||||
CASE
|
||||
WHEN uk_gender = 1 THEN 'fiú'
|
||||
ELSE 'lány'
|
||||
END AS 'Nem',
|
||||
uk_birth_date AS 'Születési dátum',
|
||||
scc_city AS 'Lakhely',
|
||||
CASE
|
||||
WHEN uk_hand = 1 THEN 'bal'
|
||||
ELSE 'jobb'
|
||||
END AS 'Kéz',
|
||||
sc_name AS 'Iskola',
|
||||
uk_email AS 'Email',
|
||||
uk_phone AS 'Telefonszám',
|
||||
p1.up_name AS 'Szülő',
|
||||
p1.up_email AS 'Szülő Email',
|
||||
p1.up_phone AS 'Szülő Telefonszám',
|
||||
uk_other AS 'Egyéb'
|
||||
FROM
|
||||
user_kid
|
||||
LEFT JOIN
|
||||
user_parent p1 ON p1.up_id = uk_parent_1
|
||||
LEFT JOIN
|
||||
user_parent p2 ON p2.up_id = uk_parent_2
|
||||
LEFT JOIN
|
||||
school ON sc_id = uk_school_sc_id
|
||||
LEFT JOIN
|
||||
user_kid_training_type ON uktt_user_kid_uk_id = uk_id
|
||||
LEFT JOIN
|
||||
training_type ON trt_id = uktt_training_type_tt_id
|
||||
school_city ON uk_address_scc_id = scc_id
|
||||
WHERE
|
||||
uk_deleted = 0 AND uk_is_active = 1
|
||||
GROUP BY uk_name
|
||||
|
||||
@@ -3,28 +3,33 @@
|
||||
$userAssocArray = $sql->assoc_array("
|
||||
SELECT
|
||||
uk_name AS 'Név',
|
||||
GROUP_CONCAT(trt_name) as 'Szint',
|
||||
sc_name as 'Iskola',
|
||||
uk_email as 'Email',
|
||||
uk_phone as 'Telefonszám',
|
||||
p1.up_name as 'Szülő1',
|
||||
p1.up_email as 'Sz1_Email',
|
||||
p1.up_phone as 'Sz1_Telefonszám',
|
||||
p2.up_name as 'Szülő2',
|
||||
p2.up_email as 'Sz2_Email',
|
||||
p2.up_phone as 'Sz2_Telefonszám'
|
||||
CASE
|
||||
WHEN uk_gender = 1 THEN 'fiú'
|
||||
ELSE 'lány'
|
||||
END AS 'Nem',
|
||||
uk_birth_date AS 'Születési dátum',
|
||||
scc_city AS 'Lakhely',
|
||||
CASE
|
||||
WHEN uk_hand = 1 THEN 'bal'
|
||||
ELSE 'jobb'
|
||||
END AS 'Kéz',
|
||||
sc_name AS 'Iskola',
|
||||
uk_email AS 'Email',
|
||||
uk_phone AS 'Telefonszám',
|
||||
p1.up_name AS 'Szülő',
|
||||
p1.up_email AS 'Szülő Email',
|
||||
p1.up_phone AS 'Szülő Telefonszám',
|
||||
uk_other AS 'Egyéb'
|
||||
FROM
|
||||
user_kid
|
||||
LEFT JOIN
|
||||
user_parent p1 ON p1.up_id = uk_parent_1
|
||||
LEFT JOIN
|
||||
user_parent p2 ON p2.up_id = uk_parent_2
|
||||
LEFT JOIN
|
||||
school ON sc_id = uk_school_sc_id
|
||||
LEFT JOIN
|
||||
user_kid_training_type ON uktt_user_kid_uk_id = uk_id
|
||||
LEFT JOIN
|
||||
training_type ON trt_id = uktt_training_type_tt_id
|
||||
school_city ON uk_address_scc_id = scc_id
|
||||
WHERE
|
||||
uk_deleted = 0 AND uk_is_active = 1
|
||||
GROUP BY uk_name
|
||||
|
||||
7
queries/20250525_email_logs.sql
Normal file
7
queries/20250525_email_logs.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
INSERT INTO `setting` (`set_id`, `set_name`, `set_setting_type_st_id`) VALUES (NULL, 'Email küldés log', '3');
|
||||
|
||||
INSERT INTO `setting_value` (`setv_id`, `setv_set_date`, `setv_setting_set_id`, `setv_int`, `setv_varchar`, `setv_text`, `setv_date`) VALUES (NULL, '2025-05-24 15:18:09.000000', '6', NULL, 'emails', NULL, NULL);
|
||||
|
||||
CREATE TABLE `email_log` ( `el_id` int(11) NOT NULL, `el_email_template_et_id` int(11) NOT NULL, `el_to_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_to_email` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_message` text CHARACTER SET utf8 COLLATE utf8_hungarian_ci, `el_sent_date` datetime DEFAULT NULL, `el_exception` text CHARACTER SET utf8 COLLATE utf8_hungarian_ci ) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
|
||||
INSERT INTO `email_template` (`et_id`, `et_name`, `et_title`, `et_deleted`, `et_message`, `et_subject`, `et_from_name`, `et_from_email`) VALUES (NULL, 'below_zero', 'Tollaslabda edzésdíj tartozás', '0', 'Kedves {$notify_name}!<br><br>Egyesületünk tollaslabda edzésdíj tartozást állapított meg {$uk_name} esetében.<br>Kérlek légy oly kedves és fáradj be hozzánk, hogy tartozásotokat rendezzétek.<br><br>Tartozásotokat több módon is rendezni tudjátok: készpénz, bankkártya, szépkártya.<br><br>Tartozásotokat több módon is rendezni tudjátok: készpénz, bankkártya, szépkártya.<br><br>Üdvözlettel,<br>Életmód Sport Egyesület<br>+36204100735<br>info@lvingsport.hu', 'Tollaslabda edzésdíj tartozás', 'Living Sport', 'notify@livingsport.hu');
|
||||
37
template/templates/email.tpl
Normal file
37
template/templates/email.tpl
Normal file
@@ -0,0 +1,37 @@
|
||||
<div class="list">
|
||||
<div class="list_item">
|
||||
<label class="desc" id="title1" for="tr_duration">
|
||||
Címzett:
|
||||
</label>
|
||||
<div>{$email->get_el_to_name()}<br><{$email->get_el_to_email()}></div>
|
||||
</div>
|
||||
<div class="list_item">
|
||||
<label class="desc" id="title1" for="tr_duration">
|
||||
Tárgy:
|
||||
</label>
|
||||
<div>{$email->get_el_subject()}</div>
|
||||
</div>
|
||||
<div class="list_item">
|
||||
<label class="desc" id="title1" for="tr_duration">
|
||||
Kiküldés dátuma:
|
||||
</label>
|
||||
<div>{$email->get_el_sent_date()}</div>
|
||||
</div>
|
||||
<div class="list_item">
|
||||
<label class="desc" id="title1" for="tr_duration">
|
||||
Üzenet:
|
||||
</label>
|
||||
<div>{$email->get_el_message()}</div>
|
||||
</div>
|
||||
|
||||
{if $email->get_el_exception()}
|
||||
<div class="list_item">
|
||||
<label class="desc" id="title1" for="tr_duration">
|
||||
Üzenet:
|
||||
</label>
|
||||
<div>{$email->get_el_exception()}</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
</div>
|
||||
75
template/templates/emails.tpl
Normal file
75
template/templates/emails.tpl
Normal file
@@ -0,0 +1,75 @@
|
||||
{if $fold}
|
||||
|
||||
<div class="navigator">
|
||||
<div class="previous">
|
||||
{if $previous_id}
|
||||
<a href="/admin/emails/{$previous_id}">
|
||||
{/if}
|
||||
<img src="/_image/previous.png" {if !$previous_id}class="grayscale" {/if}>
|
||||
{if $previous_id}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="next">
|
||||
{if $next_id}
|
||||
<a href="/admin/emails/{$next_id}">
|
||||
{/if}
|
||||
<img src="/_image/previous.png" {if !$next_id}class="grayscale" {/if}>
|
||||
{if $next_id}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
<div style="overflow-x:auto;">
|
||||
<table class="email log">
|
||||
<tr>
|
||||
<th class="left">#ID</th>
|
||||
<th class="left">Címzett</th>
|
||||
<th class="left">Kiküldés dátuma</th>
|
||||
<th class="left">Tárgy</th>
|
||||
<th class="left">Üzenet</th>
|
||||
<th class="left">Hibaüzenet</th>
|
||||
</tr>
|
||||
{foreach $el_array as $log}
|
||||
<tr class="email-log{if $log->get_el_exception()} delete{else} tick{/if}" data-log-id="{$log->get_el_id()}">
|
||||
<td>#{$log->get_el_id()}</td>
|
||||
<td>{$log->get_el_to_name()}<br><{$log->get_el_to_email()}></td>
|
||||
<td>{$log->get_el_sent_date()}</td>
|
||||
<td>{$log->get_el_subject()}</td>
|
||||
<td>{$log->get_el_message()|truncate:50}</td>
|
||||
<td>{$log->get_el_exception()|truncate:50}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="navigator">
|
||||
<div class="previous">
|
||||
{if $previous_id}
|
||||
<a href="/admin/emails/{$previous_id}">
|
||||
{/if}
|
||||
<img src="/_image/previous.png" {if !$previous_id}class="grayscale" {/if}>
|
||||
{if $previous_id}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="next">
|
||||
{if $next_id}
|
||||
<a href="/admin/emails/{$next_id}">
|
||||
{/if}
|
||||
<img src="/_image/previous.png" {if !$next_id}class="grayscale" {/if}>
|
||||
{if $next_id}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('table.email.log tr.email-log').click(function() {
|
||||
window.location.href = '/admin/email/' + $(this).data('log-id');
|
||||
});
|
||||
</script>
|
||||
@@ -7,14 +7,67 @@
|
||||
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="dev" value="{$dev}">
|
||||
|
||||
<div class="list half_width">
|
||||
{foreach $user_kids as $user}
|
||||
<a href="#" id="kid_{$user->get_uk_id()}">
|
||||
<div class="list_item">
|
||||
<a href="/preview/diary/{$user->get_uk_id()}" target="_blank" id="kid_{$user->get_uk_id()}">
|
||||
<div class="list_item{if !$user->get_uk_is_active()} passive{/if}">
|
||||
<img src="/_image/shuttlecock.png">
|
||||
{$user->get_uk_name()}
|
||||
{if $user->get_uk_last_notification() && $page_id >= 2}
|
||||
<span style="font-size: 14px; font-weight: normal; font-style: italic;">({$user->get_uk_last_notification()})</span>
|
||||
{/if}
|
||||
{if $user->get_uk_balance() < 0 && $page_id >= 2}
|
||||
{if $user->get_uk_parent_1() == null}
|
||||
<span class="float_right notification-text disabled">Értesítő e-mail</span>
|
||||
{else}
|
||||
<span class="float_right notification-text" id="{$user->get_uk_id()}" >Értesítő e-mail</span>
|
||||
{/if}
|
||||
{/if}
|
||||
<span class="float_right">{$user->get_uk_balance()|number_format:0:'':' '} Ft</span>
|
||||
</div>
|
||||
</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var clickFunction = function(event) {
|
||||
if ($('#dev').val() > 0) {
|
||||
return false;
|
||||
}
|
||||
event.preventDefault();
|
||||
$(event.target).off('click', clickFunction)
|
||||
$(event.target).addClass('in-progress');
|
||||
$(event.target).html('Küldés folyamatban...');
|
||||
|
||||
$.post("/_ajax/send_notify.php",
|
||||
{
|
||||
uk_id: event.target.id,
|
||||
},
|
||||
function(data, status){
|
||||
var pdata = JSON.parse(data);
|
||||
|
||||
if (null == pdata) {
|
||||
//error
|
||||
$(event.target).removeClass('in-progress');
|
||||
$(event.target).addClass('fail');
|
||||
$(event.target).html('Küldés sikertelen');
|
||||
}
|
||||
else if ('missing-data' == pdata) {
|
||||
$(event.target).removeClass('in-progress');
|
||||
$(event.target).addClass('fail');
|
||||
$(event.target).html('Hiányzó adatok!');
|
||||
}
|
||||
else {
|
||||
$(event.target).removeClass('in-progress');
|
||||
$(event.target).addClass('success');
|
||||
$(event.target).html('Kiküldve');
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.notification-text:not(.disabled)').on('click', clickFunction);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -61,18 +61,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_first_training">Első edzés dátuma:</label>
|
||||
<div><input type="text" name="uk_first_training" id="uk_first_training"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_beforehand">Előzmény:</label>
|
||||
<div><input type="text" name="uk_beforehand" id="uk_beforehand"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<legend class="desc" for="uk_hand">Kéz: </legend>
|
||||
<div>
|
||||
@@ -85,16 +74,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* <div>
|
||||
<label for="level">Szint:</label>
|
||||
{foreach $tt_assoc_array as $tt}
|
||||
<div>
|
||||
<input type="checkbox" name="level[]" value="{$tt['trt_id']}">
|
||||
<span style="position: relative; bottom: 3px;">{$tt['trt_name']}</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div> *}
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_email">E-mail cím:</label>
|
||||
<div><input type="email" name="uk_email" id="uk_email"></div>
|
||||
@@ -105,30 +84,6 @@
|
||||
<div><input type="text" name="uk_phone" id="uk_phone"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_facebook">Facebook:</label>
|
||||
<div><input type="text" name="uk_facebook" id="uk_facebook"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_shirt_size_ss_id">Pólóméret:</label>
|
||||
<div>
|
||||
<select name="uk_shirt_size_ss_id" id="uk_shirt_size_ss_id">
|
||||
<option value="null"> - </option>
|
||||
{foreach $shirt_size_assoc_array as $shirt_size_array}
|
||||
<option value="{$shirt_size_array.shirt_id}">
|
||||
{$shirt_size_array.shirt_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_shirt_note">Póló megjegyzés:</label>
|
||||
<div><input type="text" name="uk_shirt_note" id="uk_shirt_note"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_school_sc_id">Iskola neve:</label>
|
||||
<div>
|
||||
@@ -162,33 +117,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_region_reg_id">Diákolimpia körzet:</label>
|
||||
<div>
|
||||
<select name="uk_region_reg_id" id="uk_region_reg_id">
|
||||
<option value="null"> - </option>
|
||||
{foreach $region_assoc_array as $region_array}
|
||||
<option value="{$region_array.reg_id}">
|
||||
{$region_array.reg_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_age_category">Diákolimpia korcsoport:</label>
|
||||
<div><input type="text" name="uk_age_category" id="uk_age_category"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_official_age_category">MTLSz korosztály:</label>
|
||||
<div><input type="text" name="uk_official_age_category" id="uk_official_age_category"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_parent_1">Szülő:</label>
|
||||
<div>
|
||||
@@ -216,52 +144,6 @@
|
||||
<label class="desc" for="parent_1_phone">Telefonszám:</label>
|
||||
<div><input type="text" name="parent_1_phone" id="parent_1_phone"></div>
|
||||
</div>
|
||||
<div class="add_parent_1_block">
|
||||
<label class="desc" for="parent_1_facebook">Facebook:</label>
|
||||
<div><input type="text" name="parent_1_facebook" id="parent_1_facebook"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<label class="desc" id="title2" for="uk_parent_2">Szülő:</label>
|
||||
<div>
|
||||
<select name="uk_parent_2" id="uk_parent_2">
|
||||
<option value="null"> - (állítsd erre új szülő felvételéhez)</option>
|
||||
{foreach $parent_assoc_array as $parent_array}
|
||||
<option value="{$parent_array.up_id}">
|
||||
{$parent_array.up_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="add_parent_2_block">
|
||||
<label class="desc" id="title2" for="add_parent_2">Új szülő neve:</label>
|
||||
<div><input type="text" name="add_parent_2" id="add_parent_2"></div>
|
||||
</div>
|
||||
|
||||
<div class="add_parent_2_block">
|
||||
<label class="desc" id="title2" for="parent_2_email">E-mail cím:</label>
|
||||
<div><input type="text" name="parent_2_email" id="parent_2_email"></div>
|
||||
</div>
|
||||
|
||||
<div class="add_parent_2_block">
|
||||
<label class="desc" id="title2" for="parent_2_phone">Telefonszám:</label>
|
||||
<div><input type="text" name="parent_2_phone" id="parent_2_phone"></div>
|
||||
</div>
|
||||
|
||||
<div class="add_parent_2_block">
|
||||
<label class="desc" id="title2" for="parent_2_facebook">Facebook:</label>
|
||||
<div><input type="text" name="parent_2_facebook" id="parent_2_facebook"></div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label class="desc" id="title2" for="uk_contact">Kapcsolat tartás:</label>
|
||||
<div><textarea rows="7" name="uk_contact" id="uk_contact"></textarea></div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
@@ -275,7 +157,7 @@
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<input class="button black" type="submit" value="Létrehozás">
|
||||
<input disabled class="button black" type="submit" value="Létrehozás">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -297,4 +179,67 @@ $('#uk_school_sc_id').change(function() {
|
||||
$(".add_school").toggle(this.value == 'null');
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const form = document.querySelector(".form_wrapper form");
|
||||
const submitButton = form.querySelector('input.button.black[type="submit"]');
|
||||
|
||||
const textInputs = Array.from(form.querySelectorAll('input[type="text"], input[type="email"], textarea'));
|
||||
|
||||
// Select fields that control conditional validation
|
||||
const parentSelect = form.querySelector('#uk_parent_1');
|
||||
const schoolSelect = form.querySelector('#uk_school_sc_id');
|
||||
const addressSelect = form.querySelector('#uk_address_scc_id');
|
||||
|
||||
const conditionalFields = [
|
||||
{
|
||||
select: parentSelect,
|
||||
valueToIgnore: 'null',
|
||||
fields: [
|
||||
form.querySelector('#add_parent_1'),
|
||||
form.querySelector('#parent_1_email'),
|
||||
form.querySelector('#parent_1_phone')
|
||||
]
|
||||
},
|
||||
{
|
||||
select: schoolSelect,
|
||||
valueToIgnore: 'null',
|
||||
fields: [
|
||||
form.querySelector('#add_school')
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
function toggleSubmitButton() {
|
||||
let fieldsToCheck = [...textInputs];
|
||||
|
||||
// Exclude fields based on select value
|
||||
conditionalFields.forEach(group => {
|
||||
if (group.select.value !== group.valueToIgnore) {
|
||||
fieldsToCheck = fieldsToCheck.filter(field => !group.fields.includes(field));
|
||||
}
|
||||
});
|
||||
|
||||
// Check if any required field is empty
|
||||
const anyEmpty = fieldsToCheck.some(input => input.value.trim() === "");
|
||||
|
||||
// Check if uk_address_scc_id is still "null"
|
||||
const addressMissing = addressSelect.value === "null";
|
||||
|
||||
submitButton.disabled = anyEmpty || addressMissing;
|
||||
}
|
||||
|
||||
// Listen to input changes
|
||||
textInputs.forEach(input => {
|
||||
input.addEventListener("input", toggleSubmitButton);
|
||||
});
|
||||
|
||||
// Listen to select changes
|
||||
[parentSelect, schoolSelect, addressSelect].forEach(select => {
|
||||
select.addEventListener("change", toggleSubmitButton);
|
||||
});
|
||||
|
||||
// Initial validation
|
||||
toggleSubmitButton();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,42 +1,36 @@
|
||||
<div class="form_wrapper">
|
||||
<div class="buttons">
|
||||
<a href="/admin/delete_member/{$user_data.uk_id}" class="addbutton delete-big">Törlés</a>
|
||||
</div>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" id="action" value="user_data_edit">
|
||||
<input type="hidden" name="user_type" id="user_type" value="1">
|
||||
<input type="hidden" name="uk_id" id="uk_id" value="{$user_data.uk_id}">
|
||||
<div class="buttons">
|
||||
<a href="/admin/delete_member/{$user_data.uk_id}" class="addbutton delete-big">Törlés</a>
|
||||
</div>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" id="action" value="user_data_edit">
|
||||
<input type="hidden" name="user_type" id="user_type" value="1">
|
||||
<input type="hidden" name="uk_id" id="uk_id" value="{$user_data.uk_id}">
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_name">Név:</label>
|
||||
<div><input type="text" name="uk_name" id="uk_name" size="8" class="field text fn" value="{$user_data.uk_name}" required></div>
|
||||
<div><input type="text" name="uk_name" id="uk_name" size="8" class="field text fn"
|
||||
value="{$user_data.uk_name}" required></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_is_active">Aktív:</label>
|
||||
<div><input type="checkbox" name="uk_is_active" id="uk_is_active" value="1" {if 1==$user_data.uk_is_active}checked{/if}></div>
|
||||
<div><input type="checkbox" name="uk_is_active" id="uk_is_active" value="1"
|
||||
{if 1==$user_data.uk_is_active}checked{/if}></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="uk_lease">Bérletes:</label>
|
||||
<div><input type="checkbox" name="uk_lease" id="uk_lease" value="1" {if 1==$user_data.uk_lease}checked{/if}></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_last_modified">Utolsó módosítás dátuma:</label>
|
||||
<div><input type="text" name="uk_last_modified" id="uk_last_modified" value="{$user_data.uk_last_modified}"></div>
|
||||
<div><input type="checkbox" name="uk_lease" id="uk_lease" value="1" {if 1==$user_data.uk_lease}checked{/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="padding-top: 15px; border-top: 1px solid;">
|
||||
<label for="uk_balance_expires">Egyenleg lejár:</label>
|
||||
<div><input type="checkbox" name="uk_balance_expires" id="uk_balance_expires" value="1" {if 1==$user_data.uk_balance_expires}checked{/if}></div>
|
||||
<div><input type="checkbox" name="uk_balance_expires" id="uk_balance_expires" value="1"
|
||||
{if 1==$user_data.uk_balance_expires}checked{/if}></div>
|
||||
</div>
|
||||
|
||||
{* <div class="balance_expire_date">
|
||||
<label for="uk_balance_expire_date">Egyenleg lejárati dátuma (ha üres, akkor automatikusan lejár a legutóbbi befizetéshez képest):</label>
|
||||
<div><input type="text" name="uk_balance_expire_date" id="uk_balance_expire_date" placeholder="ÉÉÉÉ-HH-NN" value="{$user_data.uk_balance_expire_date}"></div>
|
||||
</div> *}
|
||||
|
||||
<div>
|
||||
<label>Egyenleg:</label>
|
||||
<div style="padding-top: 6px;">{{$user_data.uk_balance|number_format:0:'':' '}} Ft</div>
|
||||
@@ -90,7 +84,8 @@
|
||||
<select name="uk_address_scc_id" id="uk_address_scc_id">
|
||||
<option value="null"> - </option>
|
||||
{foreach $school_city_assoc_array as $school_city_array}
|
||||
<option value="{$school_city_array->get_scc_id()}"{if $user_data.uk_address_scc_id == $school_city_array->get_scc_id()} selected{/if}>
|
||||
<option value="{$school_city_array->get_scc_id()}"
|
||||
{if $user_data.uk_address_scc_id == $school_city_array->get_scc_id()} selected{/if}>
|
||||
{$school_city_array->get_scc_city()}
|
||||
</option>
|
||||
{/foreach}
|
||||
@@ -98,16 +93,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_first_training">Első edzés dátuma:</label>
|
||||
<div><input type="text" name="uk_first_training" id="uk_first_training" value="{$user_data.uk_first_training}"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_beforehand">Előzmény:</label>
|
||||
<div><input type="text" name="uk_beforehand" id="uk_beforehand" value="{$user_data.uk_beforehand}"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<legend class="desc" for="uk_hand">Kéz: </legend>
|
||||
<div>
|
||||
@@ -120,16 +105,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* <div>
|
||||
<label for="level">Szint:</label>
|
||||
{foreach $tt_assoc_array as $tt}
|
||||
<div>
|
||||
<input type="checkbox" name="level[]" value="{$tt['trt_id']}"{if user_kid::has_training_type($user_data.uk_id, $tt['trt_id'])} checked{/if}>
|
||||
<span style="position: relative; bottom: 3px;">{$tt['trt_name']}</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div> *}
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_email">E-mail cím:</label>
|
||||
<div><input type="email" name="uk_email" id="uk_email" value="{$user_data.uk_email}"></div>
|
||||
@@ -140,37 +115,14 @@
|
||||
<div><input type="text" name="uk_phone" id="uk_phone" value="{$user_data.uk_phone}"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_facebook">Facebook:</label>
|
||||
<div><input type="text" name="uk_facebook" id="uk_facebook" value="{$user_data.uk_facebook}"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_shirt_size_ss_id">Pólóméret:</label>
|
||||
<div>
|
||||
<select name="uk_shirt_size_ss_id" id="uk_shirt_size_ss_id">
|
||||
<option value="null"> - </option>
|
||||
{foreach $shirt_size_assoc_array as $shirt_size_array}
|
||||
<option value="{$shirt_size_array.shirt_id}"{if $shirt_size_array.shirt_id == $user_data.uk_shirt_size_ss_id} selected{/if}>
|
||||
{$shirt_size_array.shirt_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_shirt_note">Póló megjegyzés:</label>
|
||||
<div><input type="text" name="uk_shirt_note" id="uk_shirt_note" value="{$user_data.uk_shirt_note}"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_school_sc_id">Iskola neve:</label>
|
||||
<div>
|
||||
<select name="uk_school_sc_id" id="uk_school_sc_id">
|
||||
<option value="null"> - (állítsd erre új iskola felvételéhez)</option>
|
||||
{foreach $school_assoc_array as $school_array}
|
||||
<option value="{$school_array->get_sc_id()}"{if $school_array->get_sc_id() == $user_data.uk_school_sc_id} selected{/if}>
|
||||
<option value="{$school_array->get_sc_id()}"
|
||||
{if $school_array->get_sc_id() == $user_data.uk_school_sc_id} selected{/if}>
|
||||
{$school_array->get_sc_name()}
|
||||
{if $school_array->get_sc_school_city()}({$school_array->get_sc_school_city()->get_scc_city()}){/if}
|
||||
</option>
|
||||
@@ -198,39 +150,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_region_reg_id">Diákolimpia körzet:</label>
|
||||
<div>
|
||||
<select name="uk_region_reg_id" id="uk_region_reg_id">
|
||||
<option value="null"> - </option>
|
||||
{foreach $region_assoc_array as $region_array}
|
||||
<option value="{$region_array.reg_id}"{if $region_array.reg_id == $user_data.uk_region_reg_id} selected{/if}>
|
||||
{$region_array.reg_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_age_category">Diákolimpia korcsoport:</label>
|
||||
<div><input type="text" name="uk_age_category" id="uk_age_category" value="{$user_data.uk_age_category}"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_official_age_category">MTLSz korosztály:</label>
|
||||
<div><input type="text" name="uk_official_age_category" id="uk_official_age_category" value="{$user_data.uk_official_age_category}"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_parent_1">Szülő:</label>
|
||||
<div>
|
||||
<select name="uk_parent_1" id="uk_parent_1">
|
||||
<option value="null"> - (állítsd erre új szülő felvételéhez)</option>
|
||||
{foreach $parent_assoc_array as $parent_array}
|
||||
<option value="{$parent_array.up_id}"{if $parent_array.up_id == $user_data.uk_parent_1} selected{/if}>
|
||||
<option value="{$parent_array.up_id}" {if $parent_array.up_id == $user_data.uk_parent_1}
|
||||
selected{/if}>
|
||||
{$parent_array.up_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
@@ -252,53 +179,6 @@
|
||||
<label class="desc" for="parent_1_phone">Telefonszám:</label>
|
||||
<div><input type="text" name="parent_1_phone" id="parent_1_phone"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" for="parent_1_facebook">Facebook:</label>
|
||||
<div><input type="text" name="parent_1_facebook" id="parent_1_facebook"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<label class="desc" id="title2" for="uk_parent_2">Szülő:</label>
|
||||
<div>
|
||||
<select name="uk_parent_2" id="uk_parent_2">
|
||||
<option value="null"> - (állítsd erre új szülő felvételéhez)</option>
|
||||
{foreach $parent_assoc_array as $parent_array}
|
||||
<option value="{$parent_array.up_id}"{if $parent_array.up_id == $user_data.uk_parent_2} selected{/if}>
|
||||
{$parent_array.up_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="add_parent_2_block">
|
||||
<label class="desc" id="title2" for="add_parent_2">Új szülő neve:</label>
|
||||
<div><input type="text" name="add_parent_2" id="add_parent_2"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" id="title2" for="parent_2_email">E-mail cím:</label>
|
||||
<div><input type="text" name="parent_2_email" id="parent_2_email"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" id="title2" for="parent_2_phone">Telefonszám:</label>
|
||||
<div><input type="text" name="parent_2_phone" id="parent_2_phone"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" id="title2" for="parent_2_facebook">Facebook:</label>
|
||||
<div><input type="text" name="parent_2_facebook" id="parent_2_facebook"></div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label class="desc" id="title2" for="uk_contact">Kapcsolat tartás:</label>
|
||||
<div><textarea rows="7" name="uk_contact" id="uk_contact">{$user_data.uk_contact}</textarea></div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
@@ -317,11 +197,11 @@
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$( document ).ready(function() {
|
||||
$(document).ready(function() {
|
||||
if ($("#uk_parent_1").val() == 'null') $(".add_parent_1_block").show();
|
||||
else $(".add_parent_1_block").hide();
|
||||
if ($("#uk_parent_2").val() == 'null') $(".add_parent_2_block").show();
|
||||
@@ -345,61 +225,95 @@
|
||||
});
|
||||
|
||||
|
||||
$("#uk_parent_1").change(function(){
|
||||
$.post("/_ajax/get_parent_data.php",
|
||||
{
|
||||
parent_id: $("#uk_parent_1").val(),
|
||||
parent_number: 1
|
||||
},
|
||||
function(data, status){
|
||||
if (!data) {
|
||||
$("#parent_1_phone").val('');
|
||||
$("#parent_1_email").val('');
|
||||
$("#parent_1_facebook").val('');
|
||||
}
|
||||
else {
|
||||
var pdata = JSON.parse(data);
|
||||
$("#parent_1_phone").val(pdata[1]);
|
||||
$("#parent_1_email").val(pdata[0]);
|
||||
$("#parent_1_facebook").val(pdata[2]);
|
||||
$("#uk_parent_1").change(function() {
|
||||
$.post("/_ajax/get_parent_data.php", {
|
||||
parent_id: $("#uk_parent_1").val(),
|
||||
parent_number: 1
|
||||
},
|
||||
function(data, status) {
|
||||
if (!data) {
|
||||
$("#parent_1_phone").val('');
|
||||
$("#parent_1_email").val('');
|
||||
} else {
|
||||
var pdata = JSON.parse(data);
|
||||
$("#parent_1_phone").val(pdata[1]);
|
||||
$("#parent_1_email").val(pdata[0]);
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#uk_parent_2").change(function(){
|
||||
$.post("/_ajax/get_parent_data.php",
|
||||
{
|
||||
parent_id: $("#uk_parent_2").val(),
|
||||
parent_number: 2
|
||||
},
|
||||
function(data, status){
|
||||
if (!data) {
|
||||
$("#parent_2_phone").val('');
|
||||
$("#parent_2_email").val('');
|
||||
$("#parent_2_facebook").val('');
|
||||
}
|
||||
else {
|
||||
var pdata = JSON.parse(data);
|
||||
$("#parent_2_phone").val(pdata[1]);
|
||||
$("#parent_2_email").val(pdata[0]);
|
||||
$("#parent_2_facebook").val(pdata[2]);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#uk_balance_expires").on('change', function() {
|
||||
if (!$(this).is(':checked')) {
|
||||
$('#uk_balance_expire_date').val('');
|
||||
$('#uk_balance_expire_date').prop('disabled', 'disabled');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('#uk_balance_expire_date').removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$("#uk_balance_expires").trigger('change');
|
||||
|
||||
</script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const form = document.querySelector(".form_wrapper form");
|
||||
const submitButton = form.querySelector('input.button.black[type="submit"]');
|
||||
|
||||
const textInputs = Array.from(form.querySelectorAll(
|
||||
'input[type="text"], input[type="email"], textarea'));
|
||||
|
||||
// Select fields that control conditional validation
|
||||
const parentSelect = form.querySelector('#uk_parent_1');
|
||||
const schoolSelect = form.querySelector('#uk_school_sc_id');
|
||||
const addressSelect = form.querySelector('#uk_address_scc_id');
|
||||
|
||||
const conditionalFields = [{
|
||||
select: parentSelect,
|
||||
valueToIgnore: 'null',
|
||||
fields: [
|
||||
form.querySelector('#add_parent_1'),
|
||||
form.querySelector('#parent_1_email'),
|
||||
form.querySelector('#parent_1_phone')
|
||||
]
|
||||
},
|
||||
{
|
||||
select: schoolSelect,
|
||||
valueToIgnore: 'null',
|
||||
fields: [
|
||||
form.querySelector('#add_school')
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
function toggleSubmitButton() {
|
||||
let fieldsToCheck = [...textInputs];
|
||||
|
||||
// Exclude fields based on select value
|
||||
conditionalFields.forEach(group => {
|
||||
if (group.select.value !== group.valueToIgnore) {
|
||||
fieldsToCheck = fieldsToCheck.filter(field => !group.fields.includes(field));
|
||||
}
|
||||
});
|
||||
|
||||
// Check if any required field is empty
|
||||
const anyEmpty = fieldsToCheck.some(input => input.value.trim() === "");
|
||||
|
||||
// Check if uk_address_scc_id is still "null"
|
||||
const addressMissing = addressSelect.value === "null";
|
||||
|
||||
submitButton.disabled = anyEmpty || addressMissing;
|
||||
}
|
||||
|
||||
// Listen to input changes
|
||||
textInputs.forEach(input => {
|
||||
input.addEventListener("input", toggleSubmitButton);
|
||||
});
|
||||
|
||||
// Listen to select changes
|
||||
[parentSelect, schoolSelect, addressSelect].forEach(select => {
|
||||
select.addEventListener("change", toggleSubmitButton);
|
||||
});
|
||||
|
||||
// Initial validation
|
||||
toggleSubmitButton();
|
||||
});
|
||||
</script>
|
||||
@@ -8,30 +8,32 @@
|
||||
<table class="user_export">
|
||||
<tr>
|
||||
<th>Név</th>
|
||||
<th>Szint</th>
|
||||
<th>Nem</th>
|
||||
<th>Születési dátum</th>
|
||||
<th>Lakhely</th>
|
||||
<th>Kéz</th>
|
||||
<th>Email</th>
|
||||
<th>Telefonszám</th>
|
||||
<th>Iskola</th>
|
||||
<th>Email</th>
|
||||
<th>Telefonszám</th>
|
||||
<th>Szülő 1</th>
|
||||
<th>Email</th>
|
||||
<th>Telefonszám</th>
|
||||
<th>Szülő 2</th>
|
||||
<th>Email</th>
|
||||
<th>Telefonszám</th>
|
||||
<th>Szülő</th>
|
||||
<th>Szülő Email</th>
|
||||
<th>Szülő Telefonszám</th>
|
||||
<th>Egyéb</th>
|
||||
</tr>
|
||||
{foreach $users as $user}
|
||||
<tr>
|
||||
<td>{$user['Név']}</td>
|
||||
<td>{$user['Szint']}</td>
|
||||
<td>{$user['Iskola']}</td>
|
||||
<td>{$user['Nem']}</td>
|
||||
<td>{$user['Születési dátum']}</td>
|
||||
<td>{$user['Lakhely']}</td>
|
||||
<td>{$user['Kéz']}</td>
|
||||
<td>{$user['Email']}</td>
|
||||
<td>{$user['Telefonszám']}</td>
|
||||
<td>{$user['Szülő1']}</td>
|
||||
<td>{$user['Sz1_Email']}</td>
|
||||
<td>{$user['Sz1_Telefonszám']}</td>
|
||||
<td>{$user['Szülő2']}</td>
|
||||
<td>{$user['Sz2_Email']}</td>
|
||||
<td>{$user['Sz2_Telefonszám']}</td>
|
||||
<td>{$user['Iskola']}</td>
|
||||
<td>{$user['Szülő']}</td>
|
||||
<td>{$user['Szülő Email']}</td>
|
||||
<td>{$user['Szülő Telefonszám']}</td>
|
||||
<td>{$user['Egyéb']}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user