/** * 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 inventaire() { if (Auth::user()) { $id = Auth::user()->id; } $taches = Tache::all()->where('UserId', $id); //select where userid=$id $list = ListTache::all()->where('UserId', $id); return view('Page/Inventaire', compact('taches', 'list')); }
/** * 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()); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $ntaches = Tache::all(); $taches = array(); $i = 0; foreach ($ntaches as $tache) { if ($tache->sprint_id == $id) { $taches[$i] = $tache; } $i++; //dd($whoDoWhat); } return view('taches.index', compact('taches', 'id')); }
/** * 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]); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { /* $ntaches = Tache::all(); $ntaches = Tache::all(); $descriptions = Tache::lists('description','id'); $user = Auth::user(); $taches = array(); $i = 0; $cpt = 0; foreach($ntaches as $tache){ if($tache->sprint_id == $id) { if($tache->developer_id == Auth::id() && $tache->state == 1){ Session::flash('fail',"You have already a task, please finish your task !"); $taches= array(); break; } else if($tache->state != 1){ $taches[$i] = $tache ; } foreach($taches as $tache){ $pred[$tache->code] = explode(",",$tache->predecessors); } for($i= 0 ; $i < count($pred[$tache->code]); $i++){ if(!empty($tache->code)){ $j=0; foreach($ntaches as $tac){ if($tac->code==$pred[$tache->code][$i] ){ if( $tac->state !=2){ $depend[$tache->id][$j]=$pred[$tache->code][$i]; } else{ $depend[$tache->id][$j]=null; } $j++; } } } } } $i++; } //dd($whoDoWhat); //dd($taches); // return view('kanban.index', ['taches' => $taches, 'results'=> $whoDoWhat, 'id'=> $id]); return view('taketache.index',compact('taches','descriptions','user','id','depend'));*/ $ntaches = Tache::all(); $descriptions = Tache::lists('description', 'id'); $user = Auth::user(); $taches = array(); $i = 0; $cpt = 0; foreach ($ntaches as $tache) { if ($tache->sprint_id == $id) { if ($tache->developer_id == Auth::id() && $tache->state == 1) { Session::flash('fail', "You have already a task, please finish your task !"); $taches = array(); break; } else { if ($tache->state != 1) { $taches[$i] = $tache; } } } $i++; } //dd($whoDoWhat); //dd($taches); // return view('kanban.index', ['taches' => $taches, 'results'=> $whoDoWhat, 'id'=> $id]); return view('taketache.index', compact('taches', 'descriptions', 'user', 'id')); }
/** * 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'); }