85 lines
2.7 KiB
PHP
85 lines
2.7 KiB
PHP
<?php
|
|
require_once 'functions/space.php';
|
|
|
|
/*
|
|
* Generates a card for a given Space.
|
|
*
|
|
* @* @param int $space_id "Retrieves information from the database using this ID."
|
|
* @* @param int $user_id "Retrieves information from the database using this ID. Default is -1, which will limit queries to a singular Open Space."
|
|
* @* @return String $html "The HTML card component for a Space."
|
|
*/
|
|
function spaceCard(Space $space)
|
|
{
|
|
$html = '';
|
|
|
|
return $html;
|
|
}
|
|
|
|
/*
|
|
* Generates a card for a given Thought.
|
|
*
|
|
* @* @param Integer $post_id "Retrieves information from the database using this ID."
|
|
* @* @return String $html "The HTML card component for a Thought."
|
|
*/
|
|
function thoughtCard(Post $post)
|
|
{
|
|
$html = '';
|
|
|
|
return $html;
|
|
}
|
|
|
|
/*
|
|
* Generates a card for a given Moment.
|
|
*
|
|
* @* @param Integer $post_id "Retrieves information from the database using this ID."
|
|
* @* @return String $html "The HTML card component for a Moment."
|
|
*/
|
|
function momentCard(Post $post)
|
|
{
|
|
$html = '';
|
|
|
|
return $html;
|
|
}
|
|
|
|
/*
|
|
* Generates a card for a given Moment.
|
|
*
|
|
* @* @param Integer $post_id "Retrieves information from the database using this ID."
|
|
* @* @return String $html "The HTML card component for a Moment."
|
|
*/
|
|
function essayCard(Post $post)
|
|
{
|
|
$topics_html = '';
|
|
$topics_html .= '<div class="tag_row">';
|
|
$topics_html .= '<a href="/articles.php?view=filter&tag=' . $row['tag'] . '" class="tag">#' . $row['tag'] . '</a>';
|
|
$topics_html .= '</div>';
|
|
|
|
$author = exec_stmt('SELECT user_id, username, profile_picture FROM user WHERE user_id = ?', 'i', $essay['author_id'])->fetch_assoc();
|
|
|
|
$html = '
|
|
<div class="article_card">
|
|
<div class="row_space_between">
|
|
<h4>' . $essay['title'] . '</h4>
|
|
<div class="card_info_box">
|
|
<div class="col-right">
|
|
<a href="user.php?view=display&user_id=' . $author['user_id'] . '">Written by: ' . $author['username'] . '</a>
|
|
<small>Published: ' . $essay['published_at'] . '</small>
|
|
<small>Updated: ' . $essay['updated_at'] . '</small>
|
|
</div>
|
|
<div class="card_pic_box">
|
|
<img src="' . $_ENV['PROFILE_IMAGES_PQ_PATH'] . $author['profile_picture'] . '" class="card_profile_picture">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="line"></div>
|
|
<p>' . $essay['excerpt'] . '</p>
|
|
<div class="row_space_between">
|
|
<a href="/articles.php?view=read&article_id=' . $essay['article_id'] . '" class="button">Read More</a>
|
|
<div class="tag_box">' . $topics_html . '</div>
|
|
</div>
|
|
</div>
|
|
';
|
|
|
|
return $html;
|
|
}
|