email logs; list only
This commit is contained in:
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_log', $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 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");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -67,6 +67,7 @@ if ($this->is_id()) {
|
||||
|
||||
$raw_subject = $emailTemplate->get_et_subject();
|
||||
$raw_message = $emailTemplate->get_et_message();
|
||||
//var_dump($kid_array);
|
||||
foreach ($kid_array as $kid) {
|
||||
$personalizedSubject = $emailTemplate->personalize($raw_subject, array(
|
||||
'uk_name' => $kid->get_uk_name(),
|
||||
@@ -94,7 +95,7 @@ if ($this->is_id()) {
|
||||
//Recipients
|
||||
$mail->setFrom($emailTemplate->get_et_from_email(), $emailTemplate->get_et_from_name());
|
||||
$mail->addBCC('tricsusz@gmail.com', 'Tóth Richárd'); // TEST
|
||||
$mail->addBCC($kid->get_uk_notify_email(), $kid->get_uk_notify_name());
|
||||
//$mail->addBCC($kid->get_uk_notify_email(), $kid->get_uk_notify_name());
|
||||
|
||||
|
||||
//Content
|
||||
@@ -105,8 +106,26 @@ if ($this->is_id()) {
|
||||
|
||||
//$mail->send();
|
||||
//LOG SUCCESS
|
||||
email_log::create_email_log(
|
||||
$personalizedMessage,
|
||||
$personalizedSubject,
|
||||
$kid->get_uk_notify_name(),
|
||||
$kid->get_uk_notify_email(),
|
||||
$emailTemplate->get_et_id()
|
||||
);
|
||||
|
||||
//TODO: Update kids last noti date
|
||||
|
||||
} catch (Exception $e) {
|
||||
//LOG ERROR
|
||||
email_log::create_email_log(
|
||||
$personalizedMessage,
|
||||
$personalizedSubject,
|
||||
$kid->get_uk_notify_name(),
|
||||
$kid->get_uk_notify_email(),
|
||||
$emailTemplate->get_et_id(),
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,69 +17,69 @@ $fold = true;
|
||||
//ha nem a gyerek belépéseit kérjük le ÉS létezik postolt logcategory és (nem létezik a cookie VAGY létezik de nem egyenlő az eddigivel)
|
||||
$selected = "";
|
||||
if (!isset($_REQUEST['login_kid']) && isset($_REQUEST['log_category']) && (!isset($_COOKIE['log_category']) || (isset($_COOKIE['log_category']) && $_COOKIE['log_category'] != $_REQUEST['log_category']))) {
|
||||
if ($_REQUEST['log_category'] != 'null') $condition = "WHERE log_log_category_logc_id = " . $_REQUEST['log_category'];
|
||||
//beállítjuk a cookie-t, rövid élettartammal
|
||||
setcookie("log_category", $_REQUEST['log_category'], time()+60*60, '/');
|
||||
$selected = $_REQUEST['log_category'];
|
||||
$update = true;
|
||||
if ($_REQUEST['log_category'] != 'null') $condition = "WHERE log_log_category_logc_id = " . $_REQUEST['log_category'];
|
||||
//beállítjuk a cookie-t, rövid élettartammal
|
||||
setcookie("log_category", $_REQUEST['log_category'], time()+60*60, '/');
|
||||
$selected = $_REQUEST['log_category'];
|
||||
$update = true;
|
||||
}
|
||||
|
||||
elseif (isset($_REQUEST['login_kid'])) {
|
||||
//lekérjük a gyerek befizetéseit + hideoljuk a lapozót
|
||||
$condition = "WHERE log_log_category_logc_id = 3 and log_user_id = " . $_REQUEST['login_kid'];
|
||||
$fold = false;
|
||||
//lekérjük a gyerek befizetéseit + hideoljuk a lapozót
|
||||
$condition = "WHERE log_log_category_logc_id = 3 and log_user_id = " . $_REQUEST['login_kid'];
|
||||
$fold = false;
|
||||
}
|
||||
//COOKIE HANDLER - igazából ide kell a condition leírása
|
||||
if (isset($_COOKIE['log_category']) && $_COOKIE['log_category'] != 'null' && !$update && !isset($_REQUEST['login_kid'])) {
|
||||
$condition = "WHERE log_log_category_logc_id = " . $_COOKIE['log_category'];
|
||||
$selected = $_COOKIE['log_category'];
|
||||
$condition = "WHERE log_log_category_logc_id = " . $_COOKIE['log_category'];
|
||||
$selected = $_COOKIE['log_category'];
|
||||
}
|
||||
|
||||
|
||||
foreach ($logc_assoc_array as $logc_array) {
|
||||
$new_logc = new log_category();
|
||||
$new_logc->set_logc_data_by_id($logc_array['logc_id']);
|
||||
$log_categories[] = $new_logc;
|
||||
$new_logc = new log_category();
|
||||
$new_logc->set_logc_data_by_id($logc_array['logc_id']);
|
||||
$log_categories[] = $new_logc;
|
||||
}
|
||||
|
||||
|
||||
if ($this->is_id()) {
|
||||
# LOG LIST FILTERED
|
||||
//50esével megyünk
|
||||
$from = ($this->get_id() - 1) * 50;
|
||||
$log_query = "SELECT * FROM log " . (isset($condition)?$condition:"") . " ORDER BY log_date DESC " . ($fold?"LIMIT ".$from.",50;":"");
|
||||
$log_count = $sql->num_of_rows("SELECT * FROM log ".(isset($condition)?$condition:"")." ORDER BY log_date DESC;");
|
||||
//echo $log_count;
|
||||
if ($log_count <= $this->get_id()*50) {
|
||||
$next_link = false;
|
||||
}
|
||||
$smarty->assign('next_id', ($next_link?$this->get_id()+1:false));
|
||||
$smarty->assign('previous_id', ($this->get_id()>1?$this->get_id()-1:false));
|
||||
# LOG LIST FILTERED
|
||||
//50esével megyünk
|
||||
$from = ($this->get_id() - 1) * 50;
|
||||
$log_query = "SELECT * FROM log " . (isset($condition)?$condition:"") . " ORDER BY log_date DESC " . ($fold?"LIMIT ".$from.",50;":"");
|
||||
$log_count = $sql->num_of_rows("SELECT * FROM log ".(isset($condition)?$condition:"")." ORDER BY log_date DESC;");
|
||||
//echo $log_count;
|
||||
if ($log_count <= $this->get_id()*50) {
|
||||
$next_link = false;
|
||||
}
|
||||
$smarty->assign('next_id', ($next_link?$this->get_id()+1:false));
|
||||
$smarty->assign('previous_id', ($this->get_id()>1?$this->get_id()-1:false));
|
||||
|
||||
$log_assoc_array = $sql->assoc_array($log_query);
|
||||
$log_array = array();
|
||||
foreach ($log_assoc_array as $log_list_array) {
|
||||
$current_log = new log();
|
||||
$current_log->set_log_data_by_id($log_list_array['log_id']);
|
||||
$log_array[] = $current_log;
|
||||
}
|
||||
$log_assoc_array = $sql->assoc_array($log_query);
|
||||
$log_array = array();
|
||||
foreach ($log_assoc_array as $log_list_array) {
|
||||
$current_log = new log();
|
||||
$current_log->set_log_data_by_id($log_list_array['log_id']);
|
||||
$log_array[] = $current_log;
|
||||
}
|
||||
|
||||
$smarty->assign('selected', $selected);
|
||||
$smarty->assign('fold', $fold);
|
||||
$smarty->assign('logc_array', $log_categories);
|
||||
$smarty->assign('log_array', $log_array);
|
||||
$smarty->display('log.tpl');
|
||||
$smarty->assign('selected', $selected);
|
||||
$smarty->assign('fold', $fold);
|
||||
$smarty->assign('logc_array', $log_categories);
|
||||
$smarty->assign('log_array', $log_array);
|
||||
$smarty->display('log.tpl');
|
||||
}
|
||||
else {
|
||||
# LOG LIST
|
||||
header("Location: /admin/log/1");
|
||||
/*
|
||||
$log_query = "SELECT * FROM log ORDER BY log_date DESC LIMIT 50;";
|
||||
$previous_link = false;
|
||||
$smarty->assign('next_id', '2');
|
||||
*/
|
||||
# LOG LIST
|
||||
header("Location: /admin/log/1");
|
||||
/*
|
||||
$log_query = "SELECT * FROM log ORDER BY log_date DESC LIMIT 50;";
|
||||
$previous_link = false;
|
||||
$smarty->assign('next_id', '2');
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user