Ejemplo n.º 1
0
function checkThreadsTopic($threads, $idTopic, $threadMembers, $userID)
{
    $counter = 0;
    foreach ($threads as $thr) {
        if ($thr->topic == $idTopic) {
            if ($thr->type == 'close') {
                $close = sumCloseThread($threadMembers, $thr->id, $userID);
                $counter += $close;
            } else {
                $counter += 1;
            }
        }
    }
    return $counter;
}
Ejemplo n.º 2
0
function checkThreadsTopic($threads, $idTopic, $threadMembers, $categoryID, $categoryUser, $topicTenagaAhli, $userID)
{
    $counter = 0;
    foreach ($threads as $thr) {
        if ($thr->topic == $idTopic and $topicTenagaAhli != $userID) {
            if ($thr->type == 'close' and $thr->author != $userID) {
                foreach ($categoryUser as $catUS) {
                    if ($catUS->user_id == $userID and $catUS->category_id == $categoryID) {
                        $counter += 1;
                    } else {
                        $close = sumCloseThread($threadMembers, $thr->id, $userID);
                        $counter += $close;
                    }
                }
            } else {
                $counter += 1;
            }
        } elseif ($thr->topic == $idTopic and $topicTenagaAhli == $userID) {
            $counter += 1;
        }
    }
    return $counter;
}