Made small changes to posts, added amount of comments and niet slechts
This commit is contained in:
@@ -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>").html(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);
|
||||||
|
|||||||
@@ -105,24 +105,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);
|
||||||
|
|||||||
Reference in New Issue
Block a user