function api__getAllItems() { $items = array(); foreach (api__getQueries() as $q) { $list = api__getItems($q->id); //echo "<br />question#".$q->id." as ".count($list)." items"; foreach ($list as $item) { $items[] = $item; } } return $items; }
public function reload__items($qstId) { $qstItems = api__getItems($qstId); $items = array(); foreach ($qstItems as $item) { $itemStruct = array(); $itemStruct["item"] = $item; $itemStruct["metas"] = api__getMetas($item); $itemStruct["url"] = api__getMediaUrl($item->id); //get item comments $itemStruct["comments"] = api__getComments($item->id); $itemStruct["vote"] = api__getVotes($item->id); $queryIndex = -1; for ($i = 0; $i < count($this->queries); $i++) { $query = $this->queries[$i]; if ($query["query"]["id"] == $qstId) { $queryIndex = $i; } } //ref l'id de l'item qui sera la vidéo de ref de la question //l'item de ref est le premier qui a sa question avec des quotes if (strpos($item->title, '"') !== false) { $this->queries[$queryIndex]["more"] = $item->id; } $items[] = $itemStruct; } $this->queries[$queryIndex]["items"] = $items; return $items; }
function getItems($qstId) { $items = api__getItems($qstId); return $items; }
foreach ($questions as $q) { echo "<option value=\"" . $q->id . "\">QUESTION #" . $q->id . " -- " . $q->content . "</option>"; } ?> </select> <p>ITEM-TITLE<input name="title" /></p> <p>ITEM-DESCRIPTION<input name="description" /></p> <p><input name="file" id="file" type="file" /></p> <p><input type="submit" name="submit" /></p> </form> </div> <a href="index.php">BACK</a> <hr /> <div style="font-size:0.6em"> <?php echo "QUESTIONS COUNT = " . count($questions); foreach ($questions as $q) { $items = api__getItems($q->id); echo "<br />QST #" . $q->id . " has " . count($items) . " items"; echo "<ul>"; foreach ($items as $item) { echo "<li>ITEM #" . $item->id . " -- " . $item->title . "</li>"; } echo "</ul>"; } ?> </div>