Defined constants for post types

This commit is contained in:
Pierre 2018-01-07 16:41:24 +01:00
parent d909b2a29e
commit 52ab3aa206

View File

@ -34,6 +34,24 @@ class Posts {
//When a user has a full access to the post //When a user has a full access to the post
const FULL_ACCESS = 3; const FULL_ACCESS = 3;
/**
* Kinds of posts page
*/
//Post on user page
const PAGE_KIND_USER = "user";
/**
* Kinds of post
*/
const POST_KIND_TEXT = "text";
const POST_KIND_IMAGE = "image";
const POST_KIND_WEBLINK = "weblink";
const POST_KIND_PDF = "pdf";
const POST_KIND_MOVIE = "movie";
const POST_KIND_COUNTDOWN = "countdown";
const POST_KIND_SURVEY = "survey";
const POST_KIND_YOUTUBE = "youtube";
/** /**
* Table informations * Table informations
*/ */
@ -41,15 +59,15 @@ class Posts {
const TABLE_NAME = "texte"; const TABLE_NAME = "texte";
//Translation of posts types between the API language and the database structure //Translation of posts types between the API language and the database structure
const POSTS_TYPE = array( const POSTS_DB_TYPES = array(
"texte" => "text", "texte" => Posts::POST_KIND_TEXT,
"image" => "image", "image" => Posts::POST_KIND_IMAGE,
"webpage_link" => "weblink", "webpage_link" => Posts::POST_KIND_WEBLINK,
"pdf" => "pdf", "pdf" => Posts::POST_KIND_PDF,
"video" => "movie", "video" => Posts::POST_KIND_MOVIE,
"count_down" => "countdown", "count_down" => Posts::POST_KIND_COUNTDOWN,
"sondage" => "survey", "sondage" => Posts::POST_KIND_SURVEY,
"youtube" => "youtube" "youtube" => Posts::POST_KIND_YOUTUBE
); );
/** /**
@ -280,7 +298,7 @@ class Posts {
$info["visibility_level"] = $src["niveau_visibilite"]; $info["visibility_level"] = $src["niveau_visibilite"];
//Determine the kind of post //Determine the kind of post
$info["kind"] = $this::POSTS_TYPE[$src["type"]]; $info["kind"] = $this::POSTS_DB_TYPES[$src["type"]];
//Document info //Document info
$info["file_size"] = $src["size"]; $info["file_size"] = $src["size"];