Example #1
0
 /**
  *
  * @SWG\Api(
  *   path="/projects/{project_uuid}/history/",
  *   description="API for project actions",
  * @SWG\Operation(
  *    method="GET",
  *    nickname="Project History",
  *    type="ProjectHistory",
  *    summary="Returns the history of a project",
  * @SWG\Parameter(
  *     name="project_uuid",
  *     description="The unique ID of the project",
  *     paramType="path",
  *     required=true,
  *     type="string"
  *     )
  *   )
  * )
  */
 private function get_project_history($uuid)
 {
     validate_team_read(get_team_id());
     $project = validate_project_uuid($uuid);
     $project_history = $this->Project_Statistic->get_project_history($project->id);
     $this->response($project_history);
 }
Example #2
0
 /**
  *
  * @SWG\Api(
  *   path="/project/{project_uuid}",
  *   description="API for activity actions",
  * @SWG\Operation(
  *    method="GET",
  *    type="array[Activity]",
  *    summary="Returns a list of the current activities that belong to the project in descending chronological order",
  *    @SWG\Parameter(
  *       name="page",
  *       description="The starting page # of the activities (defaults to 0)",
  *       paramType="query",
  *       required=false,
  *       type="integer"
  *     ),
  *    @SWG\Parameter(
  *       name="limit",
  *       description="The number of results to return per page (defaults to 20)",
  *       paramType="query",
  *       required=false,
  *       type="integer"
  *     ),
  *    @SWG\Parameter(
  *       name="project_uuid",
  *       description="The UUID of the project that this activity is attached to",
  *       paramType="path",
  *       required=true,
  *       type="string"
  *     ),
  *   )
  * )
  */
 public function project_get($uuid = '')
 {
     $project = validate_project_uuid($uuid);
     validate_team_read(get_team_id());
     $activities = $this->Activity->get_for_project($project->id, $this->get('page', TRUE), $this->get('limit', TRUE));
     $this->response($this->decorate_objects($activities));
 }
Example #3
0
 /**
  * Returns a single meeting referenced by their uuid
  * @param string $uuid
  */
 public function meeting_get($uuid = '', $action = '')
 {
     validate_team_read(get_team_id());
     if ($action) {
         if ($action == 'chat') {
             return $this->meeting_chat_get($uuid);
         } else {
             if ($action === 'delta') {
                 return $this->meeting_delta_get($uuid);
             } else {
                 if ($action === 'participants') {
                     return $this->meeting_participants($uuid);
                 }
             }
         }
     } else {
         $meeting = validate_meeting_uuid($uuid);
         $this->response($this->decorate_object($meeting));
     }
 }
Example #4
0
 /**
  *
  * @SWG\Api(
  *   path="/team/{uuid}",
  *   description="API for team actions",
  * @SWG\Operation(
  *    method="GET",
  *    type="Team",
  *    summary="Returns the active team for the currently logged in user (or the team specified by the uuid)",
  * @SWG\Parameter(
  *       name="uuid",
  *       description="The unique ID of the team",
  *       paramType="path",
  *       required=false,
  *       type="string"
  *       )
  *     ),
  * @SWG\Operation(
  *    method="PUT",
  *    type="Team",
  *    summary="Updates the active team for the currently logged in user (or the team specified by the uuid)",
  * @SWG\Parameter(
  *     name="uuid",
  *     description="Unique ID of the team",
  *     paramType="path",
  *     required=false,
  *     type="string"
  *     ),
  * @SWG\Parameter(
  *     name="body",
  *     description="Team object that needs to be updated",
  *     paramType="body",
  *     required=true,
  *     type="Team"
  *     )
  *   ),
  *   )
  * )
  */
 public function team_get($uuid = '')
 {
     if ($uuid) {
         $team = validate_team_uuid($uuid);
     } else {
         $team = $this->Team->load(get_team_id());
     }
     if (!$team) {
         json_error('There is no active team for that user');
         exit;
     }
     $this->response($this->decorate_object($team));
 }
Example #5
0
 /**
  * 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));
             }
         }
     }
 }
Example #6
0
 function add_data()
 {
     $this->load->library('uuid');
     $data = array('uuid' => $this->uuid->v4(), 'creator_id' => intval(get_user_id()), 'team_id' => intval(get_team_id()), 'archived' => 0, 'deleted' => 0, 'created' => timestamp_to_mysqldatetime(now()));
     return $data;
 }
Example #7
0
 /**
  * Deletes a hotspot by its uuid
  * @param string $uuid
  */
 public function hotspot_delete($uuid = '')
 {
     validate_team_read(get_team_id());
     $hotspot = validate_hotspot_uuid($uuid);
     activity_delete_hotspot($hotspot->id);
     $this->Hotspot->delete($hotspot->id);
     json_success("Hotspot deleted successfully.");
 }
Example #8
0
 /**
  * Returns a single message referenced by their uuid
  * @param string $uuid
  */
 public function message_get($uuid = '')
 {
     validate_team_read(get_team_id());
     $message = validate_message_uuid($uuid);
     $this->response($this->decorate_object($message));
 }
Example #9
0
 /**
  * Deletes a drawing by its uuid
  * @param string $uuid
  */
 public function drawing_delete($uuid = '')
 {
     validate_team_read(get_team_id());
     $drawing = validate_drawing_uuid($uuid);
     activity_delete_drawing($drawing->id);
     $this->Drawing->delete($drawing->id);
     json_success("Drawing deleted successfully.");
 }
Example #10
0
 /**
  * Returns a single user referenced by their uuid
  * @param string $uuid
  */
 public function user_get($uuid = '')
 {
     $this->load->model('Project');
     $this->validate_user();
     if (!$uuid) {
         $user = get_user();
     } else {
         $user = $this->User->load_by_uuid($uuid);
         $user->projects = $this->Project->get_for_user_team($user->id, get_team_id());
     }
     if (!$user) {
         json_error('There is no user with that id');
         exit;
     } else {
         $this->response($this->decorate_object($user));
     }
 }