function treatItemArray($list) { $data = DatabaseData::getInstance(); $high = 0; $low = 0; foreach ($list as $item) { $rate = $data->getItemVoteRate($item->id); if ($high == 0 || $low == 0) { $high = $rate; $low = $rate; } else { if ($rate > $high) { $high = $rate; } if ($rate < $low) { $low = $rate; } } } $gap = $high - $low; if ($gap == 0) { $gap = 1; } $i = 0; foreach ($list as $item) { $vote = getItemRate($item->id); //$perc = ($vote - $low) / $gap; $class = $vote >= 0 ? "item-plus" : "item-minus"; // Mathieu : type de media $class_type_media = "type-media-" . getItemMediaType($item); $offset = $vote >= 0 ? 160 : 70; if (isset($_SESSION["visited"][(int) $item->id])) { $class .= "-visited"; } global $question; //$position = ($offset - ($highest - $vote)); $position = $offset - $vote * 10; if ($position < 30) { $position = 30; } //$itemTitle = utf8_encode($item->title); $itemTitle = $item->title; echo "<a href=\"mosaicMedia.php?itemId=" . $item->id . "\" class=\"item " . $class . "\" rel=\"" . $class_type_media . "\" "; echo "alt=\"" . $itemTitle . "\""; //echo "title=\"".$itemTitle." (vote:".$vote.")\""; echo "style=\"position:relative;margin-top:" . $position . "px;\">"; echo getTextToSpeech($itemTitle); echo "</a>"; $i++; } }
} echo "<hr>QUESTION 76<hr>"; var_dump(getQuestion(76)); echo "<hr>CURRENT QUESTION<hr>"; var_dump(getCurrentQuestion()); 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; }