public function addTask(Request $req, $name_liste)
 {
     $param = $req::all();
     if ($param['task'] != "" && strtotime($param['date']) != 0) {
         $tache = new \App\Tache();
         $tache->name_user = Auth::user()->email;
         $tache->name_liste = $name_liste;
         $tache->etat_tache = "No";
         $tache->tache = $param['task'];
         $tache->date = $param['date'];
         $tache->save();
         // Update nombre de tâche de Liste
         $log = Auth::user()->email;
         $liste = new \App\Liste();
         $liste = Liste::where('name_liste', $name_liste)->where('name_user', $log)->first();
         $liste->tache_tot = $liste->tache_tot + 1;
         $liste->save();
         return redirect()->route('index');
     } else {
         //
         //$this->fail = 'erreur';
         //echo $this->fail ;
         if (Auth::check()) {
             $log = Auth::user()->email;
             $todo = DB::table('listes')->where('name_user', $log)->get();
         } else {
             $todo = null;
         }
         $this->erreur = "yes";
         return view('index', ['todo' => $todo, 'erreur' => $this->erreur]);
     }
 }
 public function ajouttache(Requests\reqcreertache $req)
 {
     $param = $req->all();
     //verif voir Requests\reqcreertache
     //Stocker dans la bdd
     $tache = new \App\Tache();
     $tache->nom = $param['inputtacheprincipal'];
     $tache->idutilisateur = Auth::user()->id;
     $tache->description = $param['descriptionprincipal'];
     $tache->save();
     //Redirection vers accueil
     return redirect()->route('listtaches')->with('status', 'OK, c\'est enregistré');
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $taches = Tache::all();
     $test = true;
     foreach ($taches as $tache) {
         if ($tache->sprint_id == $id) {
             if ($tache->developer_id == Auth::id() && $tache->state == 1) {
                 $tache->update(['state' => 2]);
                 $tachesn = Tache::where('us_story_id', $tache->us_story_id)->get();
                 foreach ($tachesn as $tachen) {
                     if ($tachen->state != 2) {
                         $test = false;
                         break;
                     }
                 }
                 $userstory = Userstory::findOrFail($tache->us_story_id);
                 /*  if($test == true){
                         $userstory->update(['status'=> 1]);
                     }
                     else{
                         $userstory->update(['status'=> 0]);
                     }*/
             }
         }
     }
     return redirect(route('kanban.taches.show', $id));
     // return view('kanban.taches.show',compact('id'));
     //     return redirect(route('kanban.taches.index',$id));
 }
 public function show($idProject, $key = null)
 {
     if ($key != null) {
         if (Visitor::where("Key", $key)->where("project_id", $idProject)->get() != null) {
             $userstories = DB::table('userstory')->where('project_id', $idProject)->get();
             return view("Backlog")->with('userstories', $userstories)->with('idProject', $idProject)->with('key', $key);
         }
     } else {
         //pour verifier les us  terminé
         $userstories = Userstory::where('project_id', '=', $idProject)->get();
         foreach ($userstories as $us) {
             $ntaches = Tache::where('us_story_id', '=', $us->id)->get();
             $nbrtaches = Tache::where('us_story_id', '=', $us->id)->count();
             if ($nbrtaches != 0) {
                 $i = 0;
                 foreach ($ntaches as $tache) {
                     if ($tache->state == 2) {
                         $i = $i + 1;
                     }
                 }
                 if ($i == $nbrtaches && $us->status == 0) {
                     $userstories = Userstory::where('id', '=', $us->id)->update(["status" => 1]);
                 }
             }
         }
         //pour récuperer les USs
         $userstories = Userstory::where('project_id', '=', $idProject)->get();
         return view("Backlog")->with('userstories', $userstories)->with('idProject', $idProject)->with('key', $key);
     }
 }
Exemple #5
0
 /**
  * Fonction permettant de tester la
  * suppression d'un membre d'un projet
  *
  * @return void
  */
 public function testMoveTask()
 {
     $tache = Tache::create(['description' => 'Ma tache', 'code' => "MoncodeTest", 'start_date' => '2015-11-15', 'end_date' => '2015-11-30', 'us_story_id' => '1']);
     $take = new TakeTacheController();
     $take->edit($tache->id);
     $tacheUpdated = Tache::where("code", "MoncodeTest")->get()->first();
     $this->assertEquals(1, $tacheUpdated->state);
     $tacheUpdated->delete();
 }
 public function supprimertache(Requests\reqsupprimertache $req)
 {
     $param = $req->all();
     //verif voir Requests\reqsupprimertache
     //Stocker dans la bdd
     $tache = Tache::find($param['id']);
     $tache->delete();
     //Redirection vers accueil
     return redirect()->route('listtaches')->with('status', 'OK, c\'est modifier');
 }
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     //verifier si la tache exist
     if ($tacheencours = Tache::find($this->idtacheprincipal)) {
         //verifier si l'utilisateur est bien celui qui est loggué
         if (Auth::user()->id == $tacheencours->idutilisateur) {
             return true;
         }
     }
     return false;
 }
Exemple #8
0
 public function authorize()
 {
     if ($current_tache = Tache::find($this->id)) {
         if ($current_liste = Liste::find($current_tache->id_liste)) {
             if (Auth::user()->id == $current_liste->id_user) {
                 return true;
             }
         }
     }
     return false;
 }
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     //verifier que la tache exist
     if ($tacheencours = Tache::find($this->id)) {
         //verifier que la soustache appartient bien a l'utilisateur logué
         if (Auth::user()->id == $tacheencours->idutilisateur) {
             return true;
         }
     }
     return false;
 }
Exemple #10
0
 /**
  * Add test.
  *
  * @return void
  */
 public function testAdd()
 {
     $tache1 = Tache::create(['description' => 'yes you can !', 'code' => hash('ripemd160', 'Your task you can love it before you can do it !!'), 'start_date' => '2015-10-29', 'end_date' => '2015-10-30', 'us_story_id' => '1', 'predecessors' => '1 2 4']);
     $tache2 = Tache::create(['description' => 'yes you can !', 'code' => hash('ripemd160', 'Your task is good, do it for you before all !!'), 'start_date' => '2015-10-29', 'end_date' => '2015-10-30', 'us_story_id' => '1', 'predecessors' => '1 2 4']);
     $this->assertEquals(2, Tache::all()->count());
     $tache2->update(['description' => 'yours is yours', 'code' => hash('ripemd160', 'Your task is good, do it !!'), 'start_date' => '2015-11-01', 'end_date' => '2015-11-06', 'us_story_id' => '1', 'predecessors' => '1 2 5']);
     $this->assertEquals('yours is yours', $tache2->description);
     $this->assertEquals('2015-11-01', $tache2->start_date);
     $this->assertEquals('2015-11-06', $tache2->end_date);
     $this->assertEquals(2, Tache::all()->count());
     $tache2->delete();
     Tache::destroy($tache2->id);
     $this->assertEquals(1, Tache::all()->count());
 }
Exemple #11
0
 public function finish($idProject, $idUs)
 {
     $ntaches = Tache::where('us_story_id', '=', $idUs)->get();
     $nbrtaches = Tache::where('us_story_id', '=', $idUs)->count();
     $i = 0;
     foreach ($ntaches as $tache) {
         if ($tache->state == 2) {
             $i = $i + 1;
         }
     }
     if ($i == $nbrtaches) {
         $userstories = Userstory::where('id', '=', $idUs)->update(["status" => 1]);
         return Redirect::action("UsController@isFinish", [$idProject]);
     } else {
         return Redirect::action("BacklogController@show", [$idProject]);
     }
 }
Exemple #12
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $ntaches = Tache::all();
     $whoDoWhat = array();
     $taches = array();
     $i = 0;
     foreach ($ntaches as $tache) {
         if ($tache->sprint_id == $id) {
             $taches[$i] = $tache;
             if ($tache->developer_id != null) {
                 // $whoDoWhat[Developer::findOrFail($tache->developer_id)->attributesToArray()['FirstName']] = $tache;
                 $whoDoWhat[$tache->id] = Developer::findOrFail($tache->developer_id)->attributesToArray()['FirstName'];
             }
         }
         $i++;
         //dd($whoDoWhat);
     }
     return view('kanban.index', compact('taches', 'id', 'whoDoWhat'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $taches = Tache::all();
     return view('tachesv.index', ['taches' => $taches]);
 }
 public function AfficheEditSousTache($id)
 {
     $user = Auth::user()->id;
     $tache = Tache::where('UserId', $id)->where('id', $id);
     $id = $id;
     return view('Page/ModifierSousTache', compact('id'));
 }
Exemple #15
0
 public function createTache(TacheCreateRequest $req)
 {
     $tache = new Tache($req->all());
     $tache->save();
     return redirect()->back()->with('status', 'Tâche sauvegardée !');
 }
 public function editTask(Request $req, $name_liste, $tache)
 {
     $param = $req::all();
     if ($param['task'] != "" && strtotime($param['date']) != 0) {
         $log = Auth::user()->email;
         $liste = Tache::where('name_user', $log)->where('name_liste', $name_liste)->where('tache', $tache)->first();
         var_dump($liste);
         $liste->tache = $param['task'];
         $liste->date = $param['date'];
         $liste->save();
         return redirect()->route('index');
     } else {
         //
         //$this->fail = 'erreur';
         //echo $this->fail ;
         return redirect()->route('index');
     }
 }
Exemple #17
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $handle = fopen(public_path('D3/app/pert.js'), "r+");
     ftruncate($handle, 0);
     $file_start = "loadData(\n\t{\n\t\t name: 'PERT Diagram',\n\t\t nodes: [\n";
     $file_half = "\t\t ],\n\t\t links:[\n";
     $file_end = "\t\t ]\n\t}\n);";
     $pred = array();
     $succ = array();
     $gaph = array();
     file_put_contents(public_path('D3/app/pert.js'), $file_start, FILE_APPEND | LOCK_EX);
     $taches = Tache::all();
     //Calculate duration of tasks
     foreach ($taches as $tache) {
         if ($tache->sprint_id == $id) {
             $duree[$tache->code] = abs(strtotime($tache->start_date) - strtotime($tache->end_date)) / 60 / 60 / 24;
         }
     }
     //Extract predecessors
     foreach ($taches as $tache) {
         if ($tache->sprint_id == $id) {
             $pred[$tache->code] = explode(",", $tache->predecessors);
         }
     }
     //successors from predecessors
     $m = 0;
     foreach ($taches as $tache) {
         if ($tache->sprint_id == $id) {
             for ($i = 0; $i < count($pred[$tache->code]); $i++) {
                 if (!empty($tache->code)) {
                     $succ[$pred[$tache->code][$i]][$m] = $tache->code;
                     $m++;
                 }
             }
         }
     }
     $listEtat = array();
     $listArc = array();
     static $j = 1;
     $k = 0;
     //$graph = array();
     file_put_contents(public_path('D3/app/pert.js'), "\t\t\t{ id: 'node0', value: { label: 'Start | 0 | 0' } },\n", FILE_APPEND | LOCK_EX);
     $etatInit = new Etat(0, 0, 0);
     $etatFin = new Etat(0, 0, 0);
     foreach ($taches as $tache) {
         if ($tache->sprint_id == $id) {
             if (empty($tache->predecessors)) {
                 $listEtat[$j] = new Etat($duree[$tache->code], 0, $j);
                 $listArc[$j] = new Arc($etatInit, $listEtat[$j], $tache, true);
                 //$graph[$k][$j] = $tache;
                 $j++;
             } else {
                 for ($i = 1; $i <= count($listEtat); $i++) {
                     if (array_key_exists($listArc[$i]->getTache()->code, $succ)) {
                         if (in_array($tache->code, $succ[$listArc[$i]->getTache()->code]) == true) {
                             $etatI = new Etat($duree[$tache->code] + $duree[$listArc[$i]->getTache()->code], $duree[$tache->code] + $duree[$listArc[$i]->getTache()->code], $j);
                             array_push($listEtat, $etatI);
                             array_push($listArc, new Arc($listArc[$i]->getDestination(), $etatI, $tache, true));
                             $j++;
                         }
                     }
                 }
             }
         }
     }
     //dd($listEtat);
     //dd($listArc);
     //dd($graph);
     $pert = new Pert($listEtat, null, $listArc, $etatInit, $etatFin);
     $pert->calculAuPlusTot();
     $pert->calculatePlusTard();
     $listEtat = $pert->etats;
     $listArc = $pert->arcReals;
     for ($i = 1; $i <= count($listEtat); $i++) {
         file_put_contents(public_path('D3/app/pert.js'), "\t\t\t{ id: 'node" . $i . "', value: { label: '" . $i . " | " . $listEtat[$i]->getAuPlusTot() . " | " . $listEtat[$i]->getAuPlusTard() . "' } },\n", FILE_APPEND | LOCK_EX);
     }
     file_put_contents(public_path('D3/app/pert.js'), $file_half, FILE_APPEND | LOCK_EX);
     for ($i = 1; $i <= count($listArc); $i++) {
         file_put_contents(public_path('D3/app/pert.js'), "\t\t\t{ u: 'node" . $listArc[$i]->getSource()->getNom() . "', v: 'node" . $listArc[$i]->getDestination()->getNom() . "', value: { label: '" . $listArc[$i]->getTache()->code . "[" . $duree[$listArc[$i]->getTache()->code] . "]' } },\n", FILE_APPEND | LOCK_EX);
     }
     file_put_contents(public_path('D3/app/pert.js'), $file_end, FILE_APPEND | LOCK_EX);
     return redirect()->to('project/pert?../D3/app/pert.js');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $tache = Tache::findOrNew($id)->developer()->associate(Auth::user());
     $tachet = $tache->attributesToArray();
     $tachet['state'] = 1;
     $tache->update($tachet);
     Session::flash('success', "It's yours now");
     return redirect(route('taketache.taches.show', $tache->sprint_id));
 }
Exemple #19
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $tache = Tache::findOrFail($id);
     $sprint_id = $tache->sprint_id;
     DB::table('tache')->delete($id);
     Session::flash('success2', "You Task was deleted with success !");
     return redirect(route('taches.taches.show', $sprint_id));
 }
 public function delete($id)
 {
     $tache = new Tache();
     $tache = Tache::find($id);
     $tache->delete();
     return redirect('/membres/espace_membre');
 }