/** * @remotable */ public function isLoggedIn($isDesktop = false) { $user = $this->getCurrentUser(); $success = is_object($user); $permissions = false; $pageRef = $this->getPageInfo(); $setupOrder = 0; $contactValue = array(); $login = null; $contactID = null; $orgID = null; $CI = get_instance(); //loading all the data $rec->ID = $orgID; $locationAPI = new LocationAPI(); $activityAPI = new ActivityAPI(); $siteSpecificAPI = new SiteConfigurationAPI(); $contactAPI = new ContactAPI(); $dimensionAPI = new DimensionValueAPI(); $incidentActivityAPI = new IncidentActivityAPI(); $incidentCauseAPI = new IncidentCauseAPI(); $bodyPartAPI = new BodyPartAPI(); $footwearAPI = new FootwearAPI(); $noiseAPI = new NoiseAPI(); $weatherAPI = new WeatherAPI(); $animalAPI = new AnimalAPI(); $clientAPI = new ClientAPI(); $contactAPI = new ContactAPI(); $incidentAPI = new IncidentAPI(); $activityDetailAPI = new ActivityDetailAPI(); $observationAPI = new ObservationAPI(); $allergyAPI = new AllergyDetailAPI(); $conditionAPI = new ClientSpecialcondDetailAPI(); $residentAidAPI = new AidDetailAPI(); $residentInjuryAPI = new IncidentBodypartAPI(); $qolScores = new QolScoreValueAPI(); $aidAPI = new AidAPI(); $returnValue = array(); if ($success) { $contactValue = $this->getContactValue($user->contactID); $contactID = $user->contactID; $role = $this->getSessionValue("userRole"); $setupOrder = $role == 1 ? $user->lastSetupOrder : 999; $permissions = $this->getPermissions($role); $orgID = $user->orgID; $login = $user->login; } $returnValue = array("success" => $success, "permissions" => $permissions, "orgID" => $orgID, "pageRef" => $pageRef, "setupOrder" => $setupOrder, "contactValue" => $contactValue, "login" => $login, "contactID" => $contactID, "loggedUID" => $this->getUserID(), "sessionTimeOut" => $CI->session->sess_expiration); if ($success && !$isDesktop) { $returnValue["LocationList"] = $locationAPI->listAll($rec); $returnValue["ActivityValueList"] = $activityAPI->listAll($rec); $returnValue["SiteSpecific"] = $siteSpecificAPI->listAll($rec); $returnValue["UserList"] = $contactAPI->listAll($rec); $returnValue["DimensionList"] = $dimensionAPI->listAll($rec); $returnValue["IncidentActivityList"] = $incidentActivityAPI->listAll($rec); $returnValue["IncidentCauseList"] = $incidentCauseAPI->listAll($rec); $returnValue["FootwearList"] = $footwearAPI->listAll($rec); $returnValue["NoiseList"] = $noiseAPI->listAll($rec); $returnValue["WeatherList"] = $weatherAPI->listAll($rec); $returnValue["AnimalList"] = $animalAPI->listAll($rec); $returnValue["ResidentList"] = $clientAPI->listAll($rec); $returnValue["StaffList"] = $contactAPI->listAll($rec); $returnValue["IncidentList"] = $incidentAPI->listAll($rec); $returnValue["ActivityList"] = $activityDetailAPI->listAll($rec); $returnValue["ObservationList"] = $observationAPI->listAll($rec); $returnValue["AllergyList"] = $allergyAPI->listAll($rec); $returnValue["ConditionList"] = $conditionAPI->listAll($rec); $returnValue["ResidentAidList"] = $residentAidAPI->listAll($rec); $returnValue["ResidentInjuryList"] = $residentInjuryAPI->listAll($rec); $returnValue["BodyPartList"] = $bodyPartAPI->listAll($rec); $returnValue["QOLScoreList"] = $qolScores->listAll($rec); $rec->type = "aid"; $returnValue["AidList"] = $aidAPI->listAll($rec); } return $returnValue; }
// "No Content" status } private function deleteClient() { if ($this->get_request_method() != "DELETE") { $this->response('', 406); } $id = (int) $this->_request['id']; if ($id > 0) { $query = "DELETE FROM tblclient WHERE clientID = {$id}"; $r = $this->mysqli->query($query) or die($this->mysqli->error . __LINE__); $success = array('status' => "Success", "msg" => "Successfully deleted one record."); $this->response($this->json($success), 200); } else { $this->response('', 204); } // If no records "No Content" status } /* * Encode array into JSON */ private function json($data) { if (is_array($data)) { return json_encode($data); } } } // Initiiate Library $api = new ClientAPI(); $api->processApi();
* URL Guide * * {APP}/ajax/ - 모든 article을 불러옵니다. * {APP}/ajax/index/{nest_id}/ - {nest_id} 값을가진 둥지의 데이터를 가져옵니다. * {APP}/ajax/index/{nest_id}/{category_srl}/ - {nest_id}값과 {category_srl} 값을 가진 데이터를 가져옵니다. * {APP}/ajax/article/{article_srl}/ - {article_srl}값을 가진 article 데이터 하나를 가져옵니다. * {APP}/ajax/upLike/{article_srl}/ - {article_srl}값을 가진 article의 like 값을 1 올립니다. * * {APP}/ajax/?page={page} - {page} 페이지 번호로 article 데이터를 가져옵니다. * {APP}/ajax/?get={get} - {get}에 입력된 데이터만 가져옵니다. (nest,print_paginate,print_moreitem) * {APP}/ajax/?render={render} - {render}에 입력된 형식의 데이터로 가져옵니다. (text,html) * */ // set api require_once 'lib/ClientAPI.class.php'; $api = new ClientAPI(); // get datas switch ($_name) { case 'index': // set page number $page = isset($_GET['page']) && (int) $_GET['page'] > 1 ? (int) $_GET['page'] : 1; // set print data if (isset($_GET['get'])) { $get = explode(',', $_GET['get']); $printData = 'article'; $printData .= searchValueInArray($get, 'nest') ? ',nest,category' : ''; $printData .= searchValueInArray($get, 'print_paginate') ? ',nav_paginate' : ''; $printData .= searchValueInArray($get, 'print_moreitem') ? ',nav_more' : ''; } else { $printData = 'article'; $printData .= isset($_params['nest']) ? ',nest,category' : '';
foreach ($data->category as $k => $v) { if ($v['active'] && $v['srl'] > 0) { $data->category_name = $v['name']; break; } } } if ($data->state == 'error') { core\Goose::error(101, $data->message, __ROOT_URL__); } $loc_container = 'pages/index.php'; break; case 'article': // set api require_once 'lib/ClientAPI.class.php'; $api = new ClientAPI(); // set article_srl $article_srl = isset($_params['article']) ? (int) $_params['article'] : null; // set update hit $updateHit = $pref->json['article']['updateHit'] ? isCookieKey($pref->json['article']['cookiePrefix'] . 'hit-' . $article_srl, 7) : false; // get article $data = $api->view(['app_srl' => $pref->json['srl']['app'], 'article_srl' => $article_srl, 'contentType' => $pref->json['article']['type'], 'updateHit' => $updateHit, 'print_data' => $_GET['get'] ? $_GET['get'] : 'all']); if ($data->state == 'error') { core\Goose::error(101, $data->message, __ROOT_URL__); core\Goose::end(); } $loc_container = 'pages/article.php'; if ($_GET['popup']) { require_once $loc_container; core\Goose::end(); }
<?php require_once 'client.php'; $client = new ClientAPI(); # Authentication $data = $client->getClientKeys(); $token_auth = $data->access_token; $client_secret = $data->refresh_token; # Information $data = array(); $data['client_key'] = $client->client_key; $data['title'] = $_POST['title']; $data['email'] = $_POST['email']; $data['description'] = $_POST['description']; $data['currency'] = 'PHP'; $data['total'] = $_POST['first_item_price'] + $_POST['second_item_price'] + $_POST['third_item_price']; $data['urls']['callback'] = 'https://client/callback/url'; $data['urls']['postback'] = 'https://client/postback/iurl'; $data['ref_no'] = substr(crypt($data['client_key']), 6); $data['mobile_no'] = $_POST['mobile_no']; $data['items'][0]['name'] = $_POST['first_item_name']; $data['items'][0]['price'] = $_POST['first_item_price']; $data['items'][1]['name'] = $_POST['second_item_name']; $data['items'][1]['price'] = $_POST['second_item_price']; $data['items'][2]['name'] = $_POST['third_item_name']; $data['items'][2]['price'] = $_POST['third_item_price']; $data['info'][0]['title'] = 'Information I'; $data['info'][0]['value'] = $_POST['first_item_description']; $data['info'][1]['title'] = 'Information II'; $data['info'][1]['value'] = $_POST['second_item_description']; $data['info'][2]['title'] = 'Information III';