Esempio n. 1
0
 /**
  * Get content of an experience
  * @param String $experienceId: id of the SharcExperience
  * @param String $designerId: id of the designer           
  */
 public static function getExperienceSnapshotForKmlSlat($designerId, $experienceId)
 {
     $response = array();
     try {
         //Check if the designerId owns the experience
         $rs = SharcExperience::where('id', $experienceId)->where('designerId', $designerId)->get();
         if ($rs->count() == 0) {
             //Not exists
             $response["status"] = FAILED;
             $response["data"] = EXPERIENCE_NOT_EXIST;
             return $response;
         } else {
             $response = ExperienceService::getExperienceSnapshotDetails($designerId, $experienceId);
         }
     } catch (Exception $e) {
         $response["status"] = ERROR;
         $response["data"] = Utils::getExceptionMessage($e);
     }
     return $response;
 }
Esempio n. 2
0
 /**
  * Get number of new reponses for notification purpose only
  * @param String $experienceId: id of the SharcExperience
  * @param String $designerId: id of the designer           
  */
 public static function getResponsesCount($designerId, $experienceId)
 {
     $response = array();
     try {
         //Check if the designerId owns the experience
         if ($designerId == ADMIN_ID) {
             //admin
             $ex = SharcExperience::find($experienceId);
             $designerId = $ex->designerId;
         }
         $rs = SharcExperience::where('id', $experienceId)->where('designerId', $designerId)->get();
         if ($rs->count() == 0) {
             //Not exists
             $response["status"] = FAILED;
             $response["data"] = EXPERIENCE_NOT_EXIST;
             return $response;
         } else {
             $response["status"] = SUCCESS;
             //Get all responses
             $objResponses = SharcResponse::where('experienceId', $experienceId)->where('status', 'waiting')->get();
             $response["data"] = $objResponses->count();
             return $response;
         }
     } catch (Exception $e) {
         $response["status"] = ERROR;
         $response["data"] = Utils::getExceptionMessage($e);
     }
     return $response;
 }