Commit baac1932 authored by Chenu Denis's avatar Chenu Denis

[update] listing log

parent 0c6823ba
......@@ -6,7 +6,7 @@
* @copyright 2017 Denis Chenu <www.sondages.pro>
* @copyright 2017 OECD (Organisation for Economic Co-operation and Development ) <www.oecd.org>
* @license GPL v3
* @version 0.6.4
* @version 0.6.5
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
......@@ -222,11 +222,13 @@ class oecdMenu extends PluginBase
'type'=>'string',
'label'=>'List of email to send all action log (with cron)',
'current' => $this->get('sendWholeLogTo', 'Survey', $event->get('survey')),
'help' => 'Using detailed admin response template from related initiative survey',
),
'sendWholeLogCountryAdmin'=>array(
'type'=>'boolean',
'label'=>'Send all action log by country to country admin(with cron)',
'current' => $this->get('sendWholeLogCountryAdmin', 'Survey', $event->get('survey'),0), // Since we search via DB, best is to use 1
'help' => 'Using basic admin response template from related initiative survey',
),
)
));
......@@ -2220,16 +2222,13 @@ class oecdMenu extends PluginBase
$attributes['token'] = $token;
$oToken = Token::model($surveyId)->find("token = :token",array(":token"=>$token));
if($oToken) {
$attributes['tokenuser'] = "{$oToken->firstname} {$oToken->lastname} ({$oToken->email})";
if(!empty($oToken->attribute_3)) {
$attributes['tokenuser'] .= " From {$oToken->attribute_3}";
}
$attributes['tokenuser'] = "{$oToken->firstname} {$oToken->lastname} ({$oToken->attribute_3}, {$oToken->email})";
}
}
if(!empty($attributes['tokenuser'])) {
$attributes['finaluser'] = $attributes['tokenuser'];
}
if(!empty($attributes['adminuser'])) {
if(false && !empty($attributes['adminuser'])) {
$attributes['finaluser'] = $attributes['adminuser'];
if(!empty($attributes['tokenuser'])) {
$attributes['finaluser'] .= " with token of ".$attributes['tokenuser'];
......@@ -2365,7 +2364,9 @@ class oecdMenu extends PluginBase
$url = $aReplacementFields["{{$key}URL}"];
$aReplacementFields["{{$key}URL}"] = "<a href='{$url}'>".htmlspecialchars($url).'</a>';
}
foreach($oToken->attributes as $attribute => $value) {
$aReplacementFields["{".strtoupper($attribute)."}"] = $value;
}
$subject = ReplaceFields($baseSubject, $aReplacementFields);
$message = ReplaceFields($baseMessage, $aReplacementFields);
if(SendEmailMessage($message, $subject, $email, $from, Yii::app()->getConfig("sitename"), true, Yii::app()->getConfig("siteadminbounce"))) {
......
......@@ -23,16 +23,25 @@ foreach($oResponses as $oResponse) {
echo $text;
echo " - ";
if($aInitiativeLog['new']) {
echo CHtml::tag("strong",array(),"New");
echo CHtml::tag("strong",array(),"New initiative");
} else {
echo CHtml::tag("strong",array(),"Existing initiative");
}
if(!empty($aInitiativeLog['countDiff'])) {
echo CHtml::tag("em",array(),$aInitiativeLog['countDiff']." updated values");
//echo CHtml::tag("em",array(),$aInitiativeLog['countDiff']." updated values");
}
if(!empty($aUserLogs[$oResponse->id])) {
echo "\n\t<ul>\n";
echo "\t\t<em>Updated by</em>\n";
foreach($aUserLogs[$oResponse->id] as $aUserLog) {
echo "\t\t<li>{$aUserLog['finaluser']}, {$aUserLog['count']} time, last {$aUserLog['action']}</li>\n";
$time = @date("H:i:s",strtotime($aUserLog['action']));
$date = @date("d-m-y",strtotime($aUserLog['action']));
if(empty($date)) {
$date = $aUserLog['action'];
} else {
$date = $time." CET on ".$date;
}
echo "\t\t<li>{$aUserLog['finaluser']}, edited {$aUserLog['count']} time(s), the last one being at {$date}</li>\n";
}
echo "\t</ul>\n";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment