Пример #1
0
<?php

/** 
 * @author Amedeo Leo
 */
use Stichoza\GoogleTranslate\TranslateClient;
session_start();
require 'manageDB.php';
$content = $_POST['content'];
$idIdea = $_POST['idIdea'];
$idUser = $_SESSION['email'];
$scores = getScore($content);
insertComment($idUser, $idIdea, $content, $scores);
$comments = getCommentsByIdIdea($idIdea);
$idea = getIdeaById($idIdea);
$user_comment = getUserById($idUser);
$flag = 0;
$nameSurname = $user_comment['User']['name'] . " " . $user_comment['User']['surname'];
echo $nameSurname;
$followers = getFollowersByIdIdea($idIdea);
$alreadySent = array();
foreach ($followers as $follower) {
    if ($follower['idUser'] != $idUser) {
        $mail_destinatario = "{$follower['idUser']}";
        $mail_oggetto = "C'è un nuovo commento ad un'idea che stai seguendo!";
        $title = "L'idea {$idea['Idea']['nome']} ha un nuovo commento!";
        $nameSurname = $user_comment['User']['name'] . " " . $user_comment['User']['surname'];
        $body = "L'idea {$idea['Idea']['nome']} ha un nuovo commento: [{$nameSurname}]: {$content}";
        $alreadySent[] = $follower['idUser'];
        $text_idea = $idea['Idea']['nome'];
        $text = "La idea " . $text_idea . " che stai seguendo ha un nuovo commento:[" . $nameSurname . "]: " . $content;
Пример #2
0
                                <?php 
        }
    }
    ?>
                </div>
		<?php 
}
?>
        </div><!--row -->
         
        <div class="row">
            <div class="col-lg-10 col-md-offset-1" id='divComments'>
                <ul class="timeline" id="lista">
                <?php 
$flag = 0;
$comments = getCommentsByIdIdea($idea['Idea']['id']);
if (!empty($comments)) {
    foreach ($comments as $comment) {
        if ($flag % 2 == 0) {
            echo "<li><div class='tldate'>";
            echo $comment['date'];
            echo "</div></li><li><div class='timeline-panel'><div class='tl-heading'><p><small class='text-muted'><i class='glyphicon glyphicon-time'></i>";
            echo $comment['date'];
            echo "</small></p></div><div class='tl-body'><p>";
            echo $comment['text'];
            $user = getUserById($comment['idUser']);
            $nameSurname = $user['User']['name'] . " " . $user['User']['surname'];
            echo "&nbsp;[{$nameSurname}]</p></div></div></li>";
        } else {
            echo "<li><div class='tldate'>";
            echo $comment['date'];
Пример #3
0
/** 
 * @author Amedeo Leo
 */
function getWritersOfIdea($idIdea)
{
    $toReturn = array();
    $comments = getCommentsByIdIdea($idIdea);
    if ($comments == NULL) {
        return NULL;
    } else {
        foreach ($comments as $comment) {
            if (!in_array($comment['idUser'], $toReturn)) {
                $toReturn[] = $comment['idUser'];
            }
        }
    }
    return $toReturn;
}