LogService : WIP

This commit is contained in:
Olivier PEREZ 2014-12-24 09:40:41 +01:00
parent b5fc415edc
commit a5d1305535
3 changed files with 23 additions and 3 deletions

View File

@ -19,6 +19,7 @@
use Framadate\Services\PollService;
use Framadate\Services\AdminPollService;
use Framadate\Services\InputService;
use Framadate\Services\LogService;
use Framadate\Message;
use Framadate\Utils;
@ -35,8 +36,9 @@ $editingVoteId = 0;
/* Services */
/*----------*/
$logService = new LogService();
$pollService = new PollService($connect);
$adminPollService = new AdminPollService($connect, $pollService);
$adminPollService = new AdminPollService($connect, $pollService, $logService);
$inputService = new InputService();
/* PAGE */
@ -267,7 +269,6 @@ if (isset($_POST['delete_poll'])) {
exit;
}
if (isset($_POST['confirm_delete_poll'])) {
// TODO Add log
if ($adminPollService->deleteEntirePoll($poll_id)) {
$message = new Message('success', _('Poll fully deleted.'));
} else {

View File

@ -12,10 +12,12 @@ class AdminPollService {
private $connect;
private $pollService;
private $logService;
function __construct($connect, $pollService) {
function __construct($connect, $pollService, $logService) {
$this->connect = $connect;
$this->pollService = $pollService;
$this->logService = $logService;
}
function updatePoll($poll) {
@ -71,6 +73,8 @@ class AdminPollService {
* @return bool true is action succeeded
*/
function deleteEntirePoll($poll_id) {
$poll = $this->connect->findPollById($poll_id);
$this->logService->log("DELETE_POLL", "id$poll->poll_id, format:$poll->format, $poll->admin_name, $poll->admin_mail");
/*$this->connect->deleteVotesByPollId($poll_id);
$this->connect->deleteCommentsByPollId($poll_id);
$this->connect->deleteSlotsByPollId($poll_id);

View File

@ -0,0 +1,15 @@
<?php
namespace Framadate\Services;
/**
* This service provides a standard way to log some informations.
*
* @package Framadate\Services
*/
class LogService {
function __construct() {
}
}