Esempio n. 1
0
 public function getContentByType()
 {
     $roots = new Roots();
     $type = \Input::get('type');
     switch ($type) {
         case "File":
             $response = $roots->getFiles();
             break;
         case "Page":
             $response = $roots->getPages();
             break;
         case "Assignment":
             $req = new AssignmentsRequest(ActionType::GET, null, false);
             $response = $roots->assignments($req);
             $return = array();
             $i = 0;
             $assignments = array();
             foreach ($response as $item) {
                 $file = new \stdClass();
                 $file->id = $item->assignment_id;
                 $file->name = $item->name;
                 $assignments[] = $file;
                 $i++;
             }
             return $assignments;
         case "Quiz":
             $response = $roots->getQuizzes();
             break;
         case "ExternalTool":
             $response = $roots->getExternalTools();
             break;
         default:
             $response = [];
     }
     return json_encode($response);
 }