function mobile_stream_list() { $start_from = (int) func_arg(0); $limit = (int) func_arg(1); $output = array(); $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Articles'); $lilo_mongo->selectCollection('ContentNews'); $filter = array("state_document" => "publish"); $temp_data = $lilo_mongo->find_pagging($filter, $start_from, $limit, array("update" => -1)); $output['count'] = $lilo_mongo->count($filter); if ($temp_data) { foreach ($temp_data as $dt) { $tgl = ""; if ($dt['update'] != "") { $tgl = date('Y-m-d H:i:s', $dt['update']->sec); } $path_upload = URL_ASSET_IMAGE . "images/"; $title = !isset($dt['title']) ? "" : $dt['title']; $text = !isset($dt['text']) ? "" : $dt['text']; $state_document = !isset($dt['state_document']) ? "" : $dt['state_document']; $picture = !isset($dt['picture']) ? "" : $dt['picture']; $output['data'][] = array('id' => (string) $dt['_id'], 'title' => $title, 'text' => replace_text_content(filter_text($text)), 'update' => $tgl, 'imageName' => $picture, 'imagePath' => $path_upload, 'state_document' => $state_document); } } return json_encode($output); }
function mobile_banner_list() { $start_from = (int) func_arg(0); $limit = (int) func_arg(1); $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Assets'); $lilo_mongo->selectCollection('Banner'); $temp_data = $lilo_mongo->find_pagging(array(), $start_from, $limit, array('dateAdd' => -1)); $count = $lilo_mongo->count(); $data = array(); if ($temp_data) { foreach ($temp_data as $dt) { $_id = !isset($dt['_id']) ? "" : (string) $dt['_id']; $ID = !isset($dt['ID']) ? "" : $dt['ID']; $name = !isset($dt['name']) ? "" : $dt['name']; $Descriptions = !isset($dt['Descriptions']) ? "" : $dt['Descriptions']; $type = !isset($dt['type']) ? "" : $dt['type']; $urlPicture = !isset($dt['urlPicture']) ? "" : $dt['urlPicture']; $dataValue = !isset($dt['dataValue']) ? "" : $dt['dataValue']; $picture = !isset($dt['picture']) ? "" : $dt['picture']; $path_upload = URL_ASSET_IMAGE . "images/"; $data[] = array('_id' => $_id, 'ID' => $ID, 'name' => $name, 'descriptions' => $Descriptions, 'type' => $type, 'urlPicture' => $urlPicture, 'dataValue' => $dataValue, 'picture' => $picture); } } $output = array('count' => $count, 'data' => $data); return json_encode($output); }
function mobile_content_list() { $start_from = (int) func_arg(0); $limit = (int) func_arg(1); $output = array(); $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Articles'); $lilo_mongo->selectCollection('ContentPage'); $filter = array("state_document" => "publish"); $temp_data = $lilo_mongo->find_pagging($filter, $start_from, $limit, array("document_update" => -1)); $output['count'] = $lilo_mongo->count($filter); if ($temp_data) { foreach ($temp_data as $dt) { $tgl = ""; if ($dt['document_update'] != "") { $tgl = date('Y-m-d H:i:s', $dt['document_update']->sec); } $title = !isset($dt['title']) ? "" : $dt['title']; $text = !isset($dt['text']) ? "" : $dt['text']; $alias = !isset($dt['alias']) ? "" : $dt['alias']; $state_document = !isset($dt['state_document']) ? "" : $dt['state_document']; $output['data'][] = array('_id' => (string) $dt['_id'], 'title' => $title, 'alias' => $alias, 'text' => replace_text_content(filter_text($text)), 'document_update' => $tgl, 'state_document' => $state_document); } } return json_encode($output); }
function mobile_avastream_list() { $start_from = (int) func_arg(0); $limit = (int) func_arg(1); $output = array(); $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Assets'); $lilo_mongo->selectCollection('AvatarStream'); $temp_data = $lilo_mongo->find_pagging(array(), $start_from, $limit, array('dateAdd' => -1)); $output['count'] = $lilo_mongo->count(); if ($temp_data) { foreach ($temp_data as $dt) { $_id = !isset($dt['_id']) ? "" : (string) $dt['_id']; $ID = !isset($dt['ID']) ? "" : $dt['ID']; $name = !isset($dt['name']) ? "" : $dt['name']; $brand_id = !isset($dt['brand_id']) ? "" : $dt['brand_id']; $type = !isset($dt['type']) ? "" : $dt['type']; $urlPicture = !isset($dt['urlPicture']) ? "" : $dt['urlPicture']; $dataValue = !isset($dt['dataValue']) ? "" : $dt['dataValue']; $picture = !isset($dt['picture']) ? "" : $dt['picture']; $output['data'][] = array('_id' => $_id, 'ID' => $ID, 'name' => $name, 'brand_id' => $brand_id, 'type' => $type, 'dataValue' => $dataValue); } } return json_encode($output); }
function __features_part($email, $type, $start, $limit) { $userData = __getUserDetails($email); $bodytype = $userData['bodytype']; $gender = $userData['gender']; $output = array(); $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Assets'); $lilo_mongo->selectCollection('Avatar'); $query1 = $lilo_mongo->find_pagging(array('tipe' => $type, 'gender' => $gender, 'size' => $bodytype), $start, $limit, array('last_update' => -1)); $count1 = $lilo_mongo->count(); $newType = str_replace("face_part_", "", $type); //echo "........... ". $newType . "......."; foreach ($query1 as $item) { if ($newType != $type) { $element = array('tipe' => $newType, 'element' => str_replace(".unity3d", "", $item['material'])); } else { $element = array('gender' => $gender, 'tipe' => $newType, 'element' => str_replace(".unity3d", "", $item['element']), 'material' => str_replace(".unity3d", "", $item['material'])); } $json = str_replace("\"", "'", json_encode($element)); $output['data'][] = array('tipe' => $type, 'title' => $item['name'], 'picture' => $item['preview_image'], 'action' => '/AvatarPreview?f=' . $type . "&id=" . (string) $item['_id'] . "&v=" . $json, 'value' => ''); } $query2 = $lilo_mongo->find_pagging(array('tipe' => $type, 'gender' => 'unisex'), $start, $limit, array('last_update' => -1)); $count2 = $lilo_mongo->count(); foreach ($query2 as $item) { if ($newType != $type) { $element = array('tipe' => $newType, 'element' => str_replace(".unity3d", "", $item['material'])); } else { $element = array('gender' => $gender, 'tipe' => $newType, 'element' => str_replace(".unity3d", "", $item['element']), 'material' => str_replace(".unity3d", "", $item['material'])); } $json = str_replace("\"", "'", json_encode($element)); $output['data'][] = array('tipe' => $type, 'title' => $item['name'], 'picture' => $item['preview_image'], 'action' => '/AvatarPreview?f=' . $type . "&id=" . (string) $item['_id'] . "&v=" . $json, 'value' => (string) $item['_id']); } $output['count'] = $count1 + $count2; return json_encode($output); }
function __style_mix($email) { $mongo = new LiloMongo(); $userDetails = __getUserDetails($email); $id = $userDetails["id"]; $gender = $userDetails['gender']; $bodytype = $userDetails['bodytype']; //echo $gender. " " . $bodytype; $mongo->selectDB("Users"); $mongo->selectCollection("AvatarMix"); $query = $mongo->find_pagging(array('gender' => $gender, 'bodytype' => $bodytype)); $count = $mongo->count(array('gender' => $gender, 'bodytype' => $bodytype)); $output = array(); $output['count'] = $count; if ($query) { foreach ($query as $item) { $json = $item['configuration']; $output['data'][] = array('tipe' => 'Mix', 'title' => $item['name'], 'picture' => $item['picture'], 'action' => '/AvatarPreview?f=character' . '&id=' . (string) $item['_id'] . "&v=" . $json, 'value' => ''); } } return $output; }
function mobile_store_brandlist() { $start_from = (int) func_arg(0); $limit = (int) func_arg(1); $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Assets'); $lilo_mongo->selectCollection('Brand'); $temp_data = $lilo_mongo->find_pagging(array(), $start_from, $limit, array()); $count = $lilo_mongo->count(); $data = array(); if ($temp_data) { foreach ($temp_data as $dt) { $brand_id = !isset($dt['brand_id']) ? "" : $dt['brand_id']; $website = !isset($dt['website']) ? "" : $dt['website']; $picture = !isset($dt['picture']) ? "" : $dt['picture']; $data[] = array('brand_id' => $brand_id, 'website' => $website, 'title' => $dt['name'], 'picture' => $picture, 'action' => '/Store?f=home', 'value' => ''); } } $output = array('count' => $count, 'data' => $data); return json_encode($output); }
function mobile_social_listcommentnews() { $news_id = func_arg(0); $start_from = func_arg(1); $limit = func_arg(2); $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Social'); $lilo_mongo->selectCollection('NewsComments'); $temp_data = $lilo_mongo->find_pagging(array("news_id" => $news_id), $start_from, $limit, array("datetime" => -1)); $output['count'] = $lilo_mongo->count(array("news_id" => $news_id)); if ($temp_data) { foreach ($temp_data as $dt) { $datatemp_user = _detail_user($dt['user_id']); $tglcreate = ""; if ($dt['datetime'] != "") { $tglcreate = date('Y-m-d H:i:s', $dt['datetime']->sec); } $output['data'][] = array('_id' => (string) $dt['_id'], 'userName' => $datatemp_user['userName'], 'picture' => $datatemp_user['picture'], 'sex' => $datatemp_user['sex'], 'userId' => $dt['user_id'], 'datetime' => $tglcreate, 'comment' => $dt['comment']); } } return json_encode($output); }
function mobile_avatar_collections() { $user_id = func_arg(0); $start_from = func_arg(1); $limit = func_arg(2); $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Users'); $lilo_mongo->selectCollection('AvatarCollection'); $data = $lilo_mongo->find_pagging(array('user_id' => $user_id), $start_from, $limit, array()); $output = array(); if ($data) { foreach ($data as $tampung) { $tgl = ""; if ($tampung['date_add'] != "") { $tgl = date('Y-m-d H:i:s', $tampung['date_add']->sec); } $defconfigurasi = !isset($tampung['configuration']) ? "" : $tampung['configuration']; $conf_array = json_decode(str_replace("'", '"', $defconfigurasi)); $output[] = array('_id' => !isset($tampung['_id']) ? "" : (string) $tampung['_id'], 'subject' => !isset($tampung['subject']) ? "" : $tampung['subject'], 'descriptions' => !isset($tampung['descriptions']) ? "" : $tampung['descriptions'], 'configuration' => $conf_array, 'date_add' => $tgl); } } return json_encode($output); }