示例#1
0
文件: Api.php 项目: burbuja/indefero
 public function issueCreate($request, $match)
 {
     $views = new IDF_Views_Issue();
     $p = $views->create($request, $match, true);
     $out = array();
     if ($request->method == 'GET') {
         // We give the details of the form
         $out['doc'] = 'A POST request against this url will allow you to create a new issue.';
         if ($request->user->hasPerm('IDF.project-owner', $request->project) or $request->user->hasPerm('IDF.project-member', $request->project)) {
             $out['status'] = array();
             foreach (self::getTags($request->project) as $tag) {
                 $out['status'][] = $tag->name;
             }
         }
     } else {
         // We need to give back the results of the creation
         if (is_object($p) and 'IDF_Issue' == get_class($p)) {
             $out['mess'] = 'success';
             $out['issue'] = $p->id;
         } else {
             $out['mess'] = 'error';
             $out['errors'] = $p['form']->errors;
         }
     }
     return new Pluf_HTTP_Response_Json($out);
 }