Merge branch 'kevin-prototype' into 'master'
Kevin prototype See merge request !143
This commit was merged in pull request #147.
This commit is contained in:
@@ -8,6 +8,17 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
include("../queries/group_page.php");
|
||||||
|
|
||||||
|
$group = selectGroupByName($_GET["groupname"]);
|
||||||
|
$members = selectGroupMembers(2);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script>alert("<?= $members[0] ?>");</script>
|
||||||
|
<script>alert("<?= $members[1] ?>");</script>
|
||||||
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This view adds the main layout over the screen.
|
* This view adds the main layout over the screen.
|
||||||
* Header, menu, footer.
|
* Header, menu, footer.
|
||||||
|
|||||||
@@ -70,9 +70,7 @@ function masonry(mode) {
|
|||||||
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
||||||
columns[0][1].append($postInput);
|
columns[0][1].append($postInput);
|
||||||
|
|
||||||
$postInput.on("load", function() {
|
|
||||||
columns[0][0] = $postInput.height() + margin;
|
columns[0][0] = $postInput.height() + margin;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -99,11 +97,12 @@ function masonry(mode) {
|
|||||||
/*
|
/*
|
||||||
* Rearange the objects.
|
* Rearange the objects.
|
||||||
*/
|
*/
|
||||||
jQuery.each(posts, function() {
|
$.each(posts, function() {
|
||||||
$post = $("<div class=\"post platform\" onclick=\"requestPost(\'"+this['postID']+"\')\">");
|
$post = $("<div class=\"post platform\" onclick=\"requestPost(\'"+this['postID']+"\')\">");
|
||||||
$post.append($("<h2>").text(this["title"]));
|
$post.append($("<h2>").html(this["title"]));
|
||||||
$post.append($("<p>").html(this["content"]));
|
$post.append($("<p>").html(this["content"]));
|
||||||
$post.append($("<p class=\"subscript\">").text(this["nicetime"]));
|
$post.append($("<p class=\"subscript\">").text(this["nicetime"]));
|
||||||
|
$post.append($("<p class=\"subscript\">").text("comments: " + this["comments"] + ", niet slechts: " + this["niet_slechts"]));
|
||||||
|
|
||||||
shortestColumn = getShortestColumn(columns);
|
shortestColumn = getShortestColumn(columns);
|
||||||
shortestColumn[1].append($post);
|
shortestColumn[1].append($post);
|
||||||
|
|||||||
@@ -1,5 +1,58 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
require("connect.php");
|
||||||
|
|
||||||
|
function selectGroupByName($name) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`group_page`.`groupID`,
|
||||||
|
`name`,
|
||||||
|
`description`,
|
||||||
|
`picture`,
|
||||||
|
`status`,
|
||||||
|
COUNT(`group_member`.`groupID`) as `members`
|
||||||
|
FROM
|
||||||
|
`group_page`
|
||||||
|
LEFT JOIN
|
||||||
|
`group_member`
|
||||||
|
ON
|
||||||
|
`group_page`.`groupID` = `group_member`.`groupID`
|
||||||
|
WHERE
|
||||||
|
name LIKE :name
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':name', $name);
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
return $stmt->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectGroupMembers(int $groupID) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`username`,
|
||||||
|
`fname`,
|
||||||
|
`lname`,
|
||||||
|
`profilepicture`
|
||||||
|
FROM
|
||||||
|
`group_member`
|
||||||
|
LEFT JOIN
|
||||||
|
`user`
|
||||||
|
ON
|
||||||
|
`group_member`.`userID` = `user`.`userID`
|
||||||
|
WHERE
|
||||||
|
`groupID` = :groupID
|
||||||
|
LIMIT 20
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':groupID', $groupID);
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
return $stmt->fetchAll();
|
||||||
|
}
|
||||||
|
|
||||||
function selectGroupById($groupID) {
|
function selectGroupById($groupID) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -106,24 +106,36 @@ function selectAllUserGroups($userID) {
|
|||||||
function selectAllUserPosts($userID) {
|
function selectAllUserPosts($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`postID`,
|
`post`.`postID`,
|
||||||
`author`,
|
`post`.`author`,
|
||||||
`title`,
|
`title`,
|
||||||
CASE LENGTH(`content`) >= 150 AND `content` NOT LIKE '<img%'
|
CASE LENGTH(`post`.`content`) >= 150 AND `post`.`content` NOT LIKE '<img%'
|
||||||
WHEN TRUE THEN
|
WHEN TRUE THEN
|
||||||
CONCAT(LEFT(`content`, 150), '...')
|
CONCAT(LEFT(`post`.`content`, 150), '...')
|
||||||
WHEN FALSE THEN
|
WHEN FALSE THEN
|
||||||
`content`
|
`post`.`content`
|
||||||
END
|
END
|
||||||
AS `content`,
|
AS `content`,
|
||||||
`creationdate`
|
`post`.`creationdate`,
|
||||||
|
COUNT(`commentID`) AS `comments`,
|
||||||
|
COUNT(`niet_slecht`.`postID`) AS `niet_slechts`
|
||||||
FROM
|
FROM
|
||||||
`post`
|
`post`
|
||||||
|
LEFT JOIN
|
||||||
|
`niet_slecht`
|
||||||
|
ON
|
||||||
|
`post`.`postID` = `niet_slecht`.`postID`
|
||||||
|
LEFT JOIN
|
||||||
|
`comment`
|
||||||
|
ON
|
||||||
|
`post`.`postID` = `comment`.`postID`
|
||||||
WHERE
|
WHERE
|
||||||
`author` = :userID AND
|
`post`.`author` = :userID AND
|
||||||
`groupID` IS NULL
|
`groupID` IS NULL
|
||||||
|
GROUP BY
|
||||||
|
`post`.`postID`
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`creationdate` DESC
|
`post`.`creationdate` DESC
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
|
|||||||
@@ -1,43 +1,21 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="profile-box platform">
|
<div class="profile-box platform">
|
||||||
<img class="left group-picture" src="http://i.imgur.com/afjEUx2.jpg">
|
<img class="left group-picture" src="<?= $group['picture'] ?>">
|
||||||
<div class="profile-button">
|
<div class="profile-button">
|
||||||
<p><img src="img/leave-group.png"> Groep verlaten</p>
|
<p><img src="img/leave-group.png"> Groep verlaten</p>
|
||||||
</div>
|
</div>
|
||||||
<h1 class="profile-username">[groepnaam]</h1>
|
<h1 class="profile-username"><?= $group['name'] ?></h1>
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dictum turpis quam, eu ultrices sapien hendrerit tincidunt. Nunc aliquam neque turpis, id porta quam iaculis id. Sed suscipit, nisl a fermentum congue, nunc augue finibus lectus, id varius nunc purus nec dolor. Integer laoreet tellus sit amet sapien auctor congue. Mauris laoreet eu elit vel rhoncus. Nam et tortor arcu. Maecenas sit amet leo quis tellus varius gravida. Sed quis fermentum odio, sed dictum nulla. Donec aliquam rutrum orci cursus tempus. Quisque sit amet ipsum eget velit aliquam facilisis ultricies quis ligula. Nunc nisi lacus, luctus non bibendum quis, sagittis sit amet odio.</p>
|
<p><?= $group['description'] ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item-box-full-width platform">
|
<div class="item-box-full-width platform">
|
||||||
<h2>Leden</h2>
|
<h2>Leden (<?= $group['members'] ?>)</h2>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
<?php
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
foreach($members as $member) {
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
echo "<a href=\"profile.php?username=" . $member["username"] . "\" data-title=\"" . $member["username"] . "\"><img class=\"profile-picture\" src=\"" . $member["profilepicture"] . "\" alt=\"" . $member["username"] . "'s profielfoto\">";
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
}
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
?>
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
|
|
||||||
<a href="#vrienden">...en nog 25 anderen!</a>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user