mirror of
https://github.com/e107inc/e107.git
synced 2025-01-18 05:09:05 +01:00
FAQs cron for unanswered questions added.
This commit is contained in:
parent
30e806b91d
commit
cfd438c827
81
e107_plugins/faqs/e_cron.php
Normal file
81
e107_plugins/faqs/e_cron.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2015 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
class faqs_cron // include plugin-folder in the name.
|
||||
{
|
||||
function config()
|
||||
{
|
||||
|
||||
$cron = array();
|
||||
|
||||
$cron[] = array(
|
||||
'name' => "Unanswered Questions Report", //TODO LAN
|
||||
'function' => "unanswered",
|
||||
'category' => "report",
|
||||
'description' => "Mails a report of unanswered questions to ".e107::pref('core','siteadminemail').'.' // TODO LAN
|
||||
);
|
||||
|
||||
return $cron;
|
||||
}
|
||||
|
||||
function unanswered()
|
||||
{
|
||||
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
|
||||
$existing = $sql->retrieve('faqs','faq_question,faq_datestamp',"faq_answer='' ORDER BY faq_datestamp ", true);
|
||||
|
||||
if(empty($existing))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$questions = array();
|
||||
|
||||
foreach($existing as $row)
|
||||
{
|
||||
$questions[] = "<i>".$row['faq_question']."</i><br /><small>".$tp->toDate($row['faq_datestamp'],'short')."</small>";
|
||||
}
|
||||
|
||||
$name = SITENAME . " Automation";
|
||||
|
||||
$email = e107::pref('core','siteadminemail');
|
||||
$name = e107::pref('core','siteadmin');
|
||||
|
||||
$link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?searchquery=&filter_options=faq_author__0&mode=main&action=list", 'full');
|
||||
|
||||
$eml = array(
|
||||
'subject' => "Unuanswered Question as of ".date('d-M-Y')." ",
|
||||
// 'sender_email' => $email,
|
||||
'sender_name' => SITENAME . " Automation",
|
||||
// 'replyto' => $email,
|
||||
'html' => true,
|
||||
'template' => 'default',
|
||||
'body' => "
|
||||
<h2>Unuanswered Questions at ".SITENAME."</h2>To answer these questions, please login to ".SITENAME." and then <a href='{$link}'>click here</a>.<br />
|
||||
<ul><li>".implode("</li><li>",$questions)."</li></ul>"
|
||||
);
|
||||
|
||||
e107::getEmail()->sendEmail($email, $name, $eml);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user