</div> </div><!--row --> <?php } ?> <div class="row"> <div class="box" > <div class="col-lg-4 text-center"> <hr> <h2 class="intro-text text-center"><strong>User</strong> </h2> <hr> <?php $userImgPath = getUserOfIdea($idea['Idea']['id'])['imPath']; ?> <img src="<?php echo $userImgPath; ?> " alt="" class="img-circle" style="height:90px; weight:100px;"> <h3><?php echo $idea['User']['name'] . " " . $idea['User']['surname']; ?> </h3> <div class="btn-group btn-group-justified" role="group" aria-label="..."> <div class="btn-group" role="group"> <button type="button" class="btn btn-default" style="background-color: #43CBC7; font-weight: 900; color:white"><span class="glyphicon glyphicon-heart"></span><br><?php echo getNumberOfFollowers($idea['Idea']['id']); ?>
/** * @author Amedeo Leo */ function getIdeas() { $returnValues = array(); $conn = getConn(); $sql = "SELECT * FROM idea"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { $returnValues['Idea'] = $row; } mysqli_close($conn); $returnValues['User'] = getUserOfIdea($returnValues['Idea']['id']); $returnValues['Followers'] = getFollowersByIdIdea($returnValues['Idea']['id']); $returnValues['Comments'] = getCommentsByIdIdea($returnValues['Idea']['id']); return $returnValues; } else { mysqli_close($conn); return NULL; } }
<?php /** * @author Amedeo Leo */ session_start(); error_reporting(0); require 'manageDB.php'; $idIdea = $_POST['idIdea']; $idFinancier = $_SESSION['email']; $idea = getIdeaById($idIdea); $userFinancier = getUserById($idFinancier); $userIdea = getUserOfIdea($idIdea); $response = insertFinancier($idIdea, $idFinancier); if ($response == "ok") { /* finanziatore */ $mail_destinatario = "{$userFinancier['User']['email']}"; $mail_oggetto = "Hai finanziato un'idea!"; $title = "Hai finanziato l'idea {$idea['Idea']['nome']}"; $body = "Complimenti! Hai finanziato l'idea {$idea['Idea']['nome']}! Mettiti in contatto con l'ideatore tramite l'email: {$userIdea['email']}"; sendMail($mail_destinatario, $mail_oggetto, $title, $body); $text = "Hai finanziato la idea {$idea['Idea']['nome']}"; insertNotice($mail_destinatario, $idIdea, $text, "Financier", 0); /* ideatore */ $mail_destinatario = "{$userIdea['email']}"; $mail_oggetto = "Hai ottenuto un finanziamento per una tua idea!"; $title = "Hai ottenuto un finanziamento per l'idea {$idea['Idea']['nome']}"; $body = "Complimenti! Hai ottenuto un finanziamento per l'idea {$idea['Idea']['nome']}! Mettiti in contatto con il finanziatore tramite l'email: {$userFinancier['User']['email']}"; sendMail($mail_destinatario, $mail_oggetto, $title, $body); $text = "Idea {$idea['Idea']['nome']} finanziata!"; insertNotice($mail_destinatario, $idIdea, $text, "Financier");
$ideaName = getIdeaName($ideaId); $author = $row['idIdea']; //query result column have different name (try query to understand value of each column) ?> <tr> <td><i class="pull-right fa fa-edit"></i> <?php echo "{$date} - Hai deciso di finanziare l'idea <a href='idea.php?id={$ideaId}'>{$ideaName}</a> dell'utente <b>{$author}</b>"; ?> <td> </tr><?php } else { if ($row['type'] == 'comment') { $date = $row['date']; $comment = $row['text']; $ideaName = getIdeaName($row['idIdea']); $author = getUserOfIdea($row['idIdea'])['email']; $ideaId = $row['idIdea']; ?> <tr> <td><i class="pull-right fa fa-edit"></i> <?php echo "{$date} - Hai lasciato il messaggio <b>{$comment}</b> sull'idea <a href='idea.php?id={$ideaId}'>{$ideaName}</a> dell'utente <b>{$author}</b>"; ?> <td> </tr><?php } } } } } } ?>