Beispiel #1
0
 public function cache__reloadComments($itemId)
 {
     if (!USE_CACHE) {
         return;
     }
     for ($i = 0; $i < count($this->queries); $i++) {
         $q = $this->queries[$i];
         for ($j = 0; $j < count($q["items"]); $j++) {
             $item = $q["items"][$j];
             if ($item["item"]["id"] == $itemId) {
                 //echo "found item ".$itemId." adding reloading comments";
                 $this->queries[$i]["items"][$j]["comments"] = api__getComments($itemId);
                 $this->save();
                 return;
             }
         }
     }
     die("api_class error : Couldn't add comment to item " . $itemId);
 }
function getItemComments($item)
{
    if (is_object($item)) {
        $item = (array) $item;
    }
    $comments = api__getComments($item["id"]);
    $commentsOrderAsc = array();
    foreach ($comments as $comment) {
        $commentsOrderAsc[$comment->id] = $comment;
    }
    ksort($commentsOrderAsc);
    return $commentsOrderAsc;
}