Example #1
0
function __style_bodypart($email, $tipe, $start, $limit)
{
    $userDetails = __getUserDetails($email);
    $output = array();
    if ($userDetails) {
        $bodytype = !isset($userDetails['bodytype']) || $userDetails['bodytype'] == "" ? "medium" : $userDetails['bodytype'];
        $gender = $userDetails['gender'];
        //echo $tipe ." " . $bodytype . " " . $gender . "<br/>";
        $mongo = new LiloMongo();
        $mongo->selectDB("Assets");
        $mongo->selectCollection("Avatar");
        $avatar = null;
        $count = 0;
        if ($tipe == "hat") {
            $avatar = $mongo->find(array('tipe' => $tipe));
            $count = $mongo->count(array('tipe' => $tipe));
        } else {
            if ($tipe == "shoes") {
                $avatar = $mongo->find(array('tipe' => $tipe));
                $count = $mongo->count(array('tipe' => $tipe));
            } else {
                $avatar = $mongo->find(array('tipe' => $tipe, 'size' => $bodytype, 'gender' => $gender));
                $count = $mongo->count(array('tipe' => $tipe, 'size' => $bodytype, 'gender' => $gender));
            }
        }
        if ($avatar) {
            $output = __explode_avatar_items($avatar, $gender, $count);
        }
    }
    return $output;
}
Example #2
0
function __store_bodypart($email, $tipe, $filter, $id_brand, $start, $limit)
{
    $userDetails = __getUserDetails($email);
    $output = array();
    if ($userDetails) {
        $bodytype = !isset($userDetails['bodytype']) || $userDetails['bodytype'] == "" ? "medium" : $userDetails['bodytype'];
        $gender = $userDetails['gender'];
        $mongo = new LiloMongo();
        $mongo->selectDB("Assets");
        $mongo->selectCollection("Avatar");
        $avatar = null;
        $count = 0;
        if ($tipe == "hat") {
            $avatar = $mongo->find_pagging(array('tipe' => $tipe, "brand_id" => $id_brand), $start, $limit, array());
            $count = $mongo->count(array('tipe' => $tipe, "brand_id" => $id_brand));
        } else {
            if ($tipe == "shoes") {
                $avatar = $mongo->find_pagging(array('tipe' => $tipe, "brand_id" => $id_brand), $start, $limit, array());
                $count = $mongo->count(array('tipe' => $tipe, "brand_id" => $id_brand));
            } else {
                $avatar = $mongo->find_pagging(array('tipe' => $tipe, 'size' => $bodytype, 'gender' => $gender, "brand_id" => $id_brand), $start, $limit, array());
                $count = $mongo->count(array('tipe' => $tipe, 'size' => $bodytype, 'gender' => $gender, "brand_id" => $id_brand));
            }
        }
        if ($avatar) {
            $output = __explode_avatar_items($avatar, $gender, $count);
        }
    }
    return $output;
}