/** * Returns either a screen or a list of hotspots for that screen depending on what the action is * @param string $uuid * @param string $action */ public function screen_get($uuid = '', $action = '') { validate_team_read(get_team_id()); $screen = validate_screen_uuid($uuid); if ($action && $action === 'hotspots') { $hotspots = $this->Hotspot->get_for_screen($screen->id); $this->response(decorate_hotspots($hotspots)); } else { if ($action && $action === 'comments') { $comments = $this->Comment->get_for_screen($screen->id); $this->response(decorate_comments($comments)); } else { if ($action && $action === 'drawings') { $drawings = $this->Drawing->get_for_screen($screen->id); $this->response(decorate_drawings($drawings)); } else { $this->response($this->decorate_object($screen)); } } } }
/** * VIDEOS * @param $object * @return mixed */ function decorate_video($object, $shallow = false) { $CI =& get_instance(); $CI->load->model(array('Project', 'Hotspot', 'Comment', 'Drawing')); if (isset($object->project_id)) { $object->project_uuid = $CI->Project->get_uuid($object->project_id); } if (isset($object->creator_id)) { $object->creator_uuid = $CI->User->get_uuid($object->creator_id); } $object->url = file_url($object->url, FILE_TYPE_VIDEO); if (!$shallow) { $hotspots = $CI->Hotspot->get_for_video($object->id); $object->hotspots = decorate_hotspots($hotspots); $drawings = $CI->Drawing->get_for_video($object->id); $object->drawings = decorate_drawings($drawings); $comments = $CI->Comment->get_for_video($object->id); $object->comments = decorate_comments($comments); } $object->ordering = intval($object->ordering); $object->file_size = floatval($object->file_size); unset($object->deleted, $object->project_id, $object->id, $object->creator_id); return $object; }
/** * Returns either a video or a list of hotspots for that video depending on what the action is * @param string $uuid * @param string $action */ public function video_get($uuid = '', $action = '') { $video = validate_video_uuid($uuid); if ($action && $action === 'hotspots') { $hotspots = $this->Hotspot->get_for_video($video->id); $this->response(decorate_hotspots($hotspots)); } else { if ($action && $action === 'comments') { $comments = $this->Comment->get_for_video($video->id); $this->response(decorate_comments($comments)); } else { if ($action && $action === 'drawings') { $drawings = $this->Drawing->get_for_video($video->id); $this->response(decorate_drawings($drawings)); } else { $this->response($this->decorate_object($video)); } } } }