コード例 #1
0
ファイル: projects.php プロジェクト: gitanton/cono-rest
 /**
  * Returns a single project referenced by their uuid
  * @param string $uuid
  */
 public function project_get($uuid = '', $action = '')
 {
     validate_team_read(get_team_id());
     $project = validate_project_uuid($uuid);
     if ($action && $action === 'comments') {
         $comments = $this->Comment->get_for_project($project->id);
         $this->response(decorate_comments($comments));
     } else {
         if ($action === 'history') {
             $this->get_project_history($uuid);
         } else {
             $this->Project_Statistic->view_project($project->id);
             $this->response($this->decorate_object($project));
         }
     }
 }
コード例 #2
0
ファイル: screens.php プロジェクト: gitanton/cono-rest
 /**
  * Provides the ability to search for a list of comments on a given screen
  * @param $screen
  */
 private function search_comments($screen)
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('filter', 'Filter', 'trim|required|xss_clean');
     if ($this->form_validation->run() == FALSE) {
         json_error('There was a problem with your submission: ' . validation_errors(' ', ' '));
     } else {
         $filter = json_decode($this->post('filter', TRUE));
         if ($filter) {
             $filter->screen_id = $screen->id;
             $comments = decorate_comments($this->Comment->search($filter));
             $this->response($comments);
         } else {
             json_error("Could not read the filter parameter.  Please send valid json");
         }
     }
 }
コード例 #3
0
/**
 * 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;
}
コード例 #4
0
ファイル: users.php プロジェクト: gitanton/cono-rest
 /**
  *
  * @SWG\Api(
  *   path="/tasks",
  *   description="API for user actions",
  * @SWG\Operation(
  *    method="GET",
  *    type="Array[Comment]",
  *    summary="Gets the tasks for the current user",
  *   )
  * )
  */
 function tasks_get()
 {
     $this->validate_user();
     $this->load->model(array('Comment'));
     $comments = $this->Comment->get_tasks_for_user(get_user_id());
     $this->response(decorate_comments($comments));
 }