コード例 #1
0
/** 
 * Mathieu : Retourne le type d'un media d'un item
 * T = text, A = audio, P = picture, V = video
 */
function getItemMediaType($item)
{
    $mediaType = "T";
    // default
    $mediaPath = getItemMediaId($item);
    if (strlen($mediaPath) > 1) {
        $temp = explode("-", $mediaPath);
        $mediaType = $temp[2];
    }
    return $mediaType;
}
コード例 #2
0
<!DOCTYPE html>
<html>
  <?php 
include "includes.php";
$question = getCurrentQuestion();
//MC-bJSOzCRo-V
$moreItem = getItemMore(getItems($question["id"]));
$moreId = $moreItem["id"];
$url = getItemMediaId($moreItem);
$info = $moreItem["description"];
// echo($moreId . "--> url" . $url . "--> description" . $info);
$temp = explode("-", $info);
$author = $temp[0];
$description = $temp[1];
//echo "MORE ID = ".$moreId;
?>
<head>
    <title>Question : <?php 
echo $question["content"];
?>
</title>
    <?php 
include "head.php";
?>
    <link rel="stylesheet" type="text/css" href="styles/mosaicQuestion.css?v=1" />
    <script type="text/javascript" src="js/loading.js?v=1"></script>
</head>
<body>
<div class="all" id="all-question">
	<?php 
displayMenuHeader($question, $question["content"]);
コード例 #3
0
    $page = 0;
}
$itemId = 0;
if (!isset($_GET["itemId"])) {
    displayError("pas d'item selectionné");
}
$itemId = $_GET["itemId"];
$_SESSION["visited"][(int) $_GET["itemId"]] = 1;
$item = getItem($question["id"], $itemId);
//var_dump($item);var_dump($itemId);
//GOT MEDIA
$description = "";
$mediaPath = "";
$mediaType = "T";
// default = text
$mediaPath = getItemMediaId($item);
//echo "<p>mediaPath : ".$mediaPath."</p>";
if (strlen($mediaPath) > 1) {
    //récupérer le type du média à partir de l'objet qui vient de l'API (S = sound, P = picture, V = video)
    $temp = explode("-", $mediaPath);
    $mediaType = $temp[2];
    //echo "Media-URL = ".$mediaPath;
    if (strlen($mediaType) < 1) {
        displayError("Le média n'a pas de format dans son url (mediaPath = " . $mediaPath . ")");
    }
} else {
    $description = $item["description"];
    if (strlen($description) < 2) {
        displayError("Pas de média ni de description pour cet item (id=" . $itemId . ")");
    }
}
コード例 #4
0
echo "<hr>ITEMS<hr>";
$items = getItems(76);
var_dump($items);
echo "<hr>ITEM index 2<hr>";
$item = $items[2];
var_dump($item);
echo "<hr>ITEM MORE OF ITEMS<hr>";
$more = getItemMore($items);
var_dump($more);
echo "<hr>ITEM RATE<hr>";
$voteCount = getItemRate($item);
var_dump($voteCount);
echo "<hr>ITEM COMMENTS<hr>";
$voteCount = getItemComments($item);
var_dump($voteCount);
echo "<hr>SPECIFIC ITEM COMMENTS<hr>";
$item = getItem(79, 1367);
var_dump($item);
$comments = getItemComments($item);
if (count($comments) < 1) {
    echo "Pas de coms";
} else {
    foreach ($comments as $com) {
        if (is_object($com)) {
            $com = (array) $com;
        }
        echo $com["content"] . "<br/>";
    }
}
echo "<br/>Media Id = " . getItemMediaId($item);