2014-12-20 23:59:44 +01:00
|
|
|
<?php
|
|
|
|
namespace Framadate\Services;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class AdminPollService
|
|
|
|
* @package Framadate\Services
|
|
|
|
*/
|
|
|
|
class AdminPollService {
|
|
|
|
|
|
|
|
private $connect;
|
|
|
|
|
|
|
|
function __construct($connect) {
|
|
|
|
$this->connect = $connect;
|
|
|
|
}
|
|
|
|
|
|
|
|
function updatePoll($poll) {
|
|
|
|
return $this->connect->updatePoll($poll);
|
|
|
|
}
|
|
|
|
|
2014-12-21 00:25:00 +01:00
|
|
|
/**
|
|
|
|
* Delete a comment from a poll.
|
|
|
|
*
|
|
|
|
* @param $poll_id int The ID of the poll
|
|
|
|
* @param $comment_id int The ID of the comment
|
|
|
|
* @return mixed true is action succeeded
|
|
|
|
*/
|
2014-12-20 23:59:44 +01:00
|
|
|
function deleteComment($poll_id, $comment_id) {
|
|
|
|
return $this->connect->deleteComment($poll_id, $comment_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove all comments of a poll.
|
|
|
|
*
|
|
|
|
* @param $poll_id int The ID a the poll
|
|
|
|
* @return bool|null true is action succeeded
|
|
|
|
*/
|
|
|
|
function cleanComments($poll_id) {
|
2014-12-21 00:25:00 +01:00
|
|
|
return $this->connect->deleteCommentsByAdminPollId($poll_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete a vote from a poll.
|
|
|
|
*
|
|
|
|
* @param $poll_id int The ID of the poll
|
|
|
|
* @param $vote_id int The ID of the vote
|
|
|
|
* @return mixed true is action succeeded
|
|
|
|
*/
|
|
|
|
function deleteVote($poll_id, $vote_id) {
|
|
|
|
return $this->connect->deleteVote($poll_id, $vote_id);
|
2014-12-20 23:59:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove all votes of a poll.
|
|
|
|
*
|
2014-12-21 00:25:00 +01:00
|
|
|
* @param $poll_id int The ID of the poll
|
2014-12-20 23:59:44 +01:00
|
|
|
* @return bool|null true is action succeeded
|
|
|
|
*/
|
|
|
|
function cleanVotes($poll_id) {
|
|
|
|
return $this->connect->deleteVotesByAdminPollId($poll_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|