public function show($id)
 {
     try {
         $iteration = Iterations::findOrFail($id);
         $iterations = Iterations::where('projectid', '=', $iteration->projectid)->get();
         $project = Project::findOrFail($iteration->projectid);
         $issues = Issue::where('iterationid', '=', $id)->get();
         //$issues = $iteration->issues;
         $countIssues = sizeof($issues);
         $categories = Category::all();
         $idCategory = 0;
         $totalPoints = $issues->sum('points');
         $materiales = Material::all();
         $personal = PersonalType::all();
         $team = Teams::where('projectid', '=', $project->id)->get()->first();
         $members = DB::table('memberof')->where('teamid', '=', $team->id)->get();
         $hasmembers = sizeof($members) > 0 ? true : false;
         $users = array();
         foreach ($members as $member) {
             $users[] = User::findOrFail($member->usersid);
             echo $hasmembers;
         }
         $this->layout->content = View::make('layouts.iterations.show')->with('iteration', $iteration)->with('iterations', $iterations)->with('issues', $issues)->with('categories', $categories)->with('idCategory', $idCategory)->with('countIssues', $countIssues)->with('totalPoints', $totalPoints)->with('project', $project)->with('materiales', $materiales)->with('personal', $personal)->with('hasmembers', $hasmembers)->with('members', $members)->with('users', $users)->with('message', '');
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         return Redirect::to('/projects/')->with('message', 'Error al crear la iteración');
     }
 }
 /**
  *
  */
 public function summary($id)
 {
     $iterationAux;
     //try {
     $project = Project::findOrFail($id);
     $iterations = Iterations::where('projectid', '=', $id)->get();
     //foreach($iterations as $var){
     //  $iterationAux = $iterationAux . var_dump($var);
     //}
     //}catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
     //}
     //die;
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     JpGraph\JpGraph::module('line');
     $datay = array(20, 30, 50, 80);
     $datay2 = array(30, 95, 70, 40);
     $datazero = array(0, 0, 0, 0);
     // Create the graph.
     $graph = new Graph(800, 500);
     $graph->title->Set('Example with 2 scale bars : ' . $project->name . ' : ' . $id . ' : ' . sizeof($iterations));
     // Setup Y and Y2 scales with some "grace"
     $graph->SetScale("textlin");
     $graph->SetY2Scale("lin");
     //$graph->yaxis->scale->SetGrace(30);
     //$graph->y2axis->scale->SetGrace(30);
     //$graph->ygrid->Show(true,true);
     $graph->ygrid->SetColor('gray', 'lightgray@0.5');
     // Setup graph colors
     $graph->SetMarginColor('white');
     $graph->y2axis->SetColor('darkred');
     // Create the "dummy" 0 bplot
     $bplotzero = new BarPlot($datazero);
     // Create the "Y" axis group
     $ybplot1 = new BarPlot($datay);
     $ybplot1->value->Show();
     $ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
     // Create the "Y2" axis group
     $ybplot2 = new BarPlot($datay2);
     $ybplot2->value->Show();
     $ybplot2->value->SetColor('darkred');
     $ybplot2->SetFillColor('darkred');
     $y2bplot = new GroupBarPlot(array($bplotzero, $ybplot2));
     // Add the grouped bar plots to the graph
     $graph->Add($ybplot);
     $graph->AddY2($y2bplot);
     $datax = array('A', 'B', 'C', 'D');
     $graph->xaxis->SetTickLabels($datax);
     // .. and finally stroke the image back to browser
     $graph->Stroke();
 }
 public function line_budget($id)
 {
     $iterationAux;
     $project = Project::findOrFail($id);
     $iterations = Iterations::where('projectid', '=', $id)->get();
     $string_iterations;
     $dataBudgetEstimated = array();
     $dataBudgetReal = array();
     $dataIterationName = array();
     $dataBudgetEstimated[] = 0;
     $dataBudgetReal[] = 0;
     $dataIterationName[] = '';
     foreach ($iterations as $var) {
         $dataBudgetEstimated[] = $var->estimatedBudget;
         $dataBudgetReal[] = $var->realBudget;
         $dataIterationName[] = $var->name;
     }
     //$string_iterations = implode(";", $iterations);
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     JpGraph\JpGraph::module('line');
     // Some (random) data
     $ydata = array(0, 11, 3, 8, 12, 5, 1, 9, 13, 5, 7);
     $ydata2 = array(0, 1, 19, 15, 7, 22, 14, 5, 9, 21, 13);
     // Size of the overall graph
     $width = 800;
     $height = 400;
     // Create the graph and set a scale.
     // These two calls are always required
     $graph = new Graph($width, $height);
     $graph->SetScale('intlin');
     $graph->SetShadow();
     // Setup margin and titles
     //$graph->img->SetMargin(40,30,40,40);
     $graph->SetMargin(40, 50, 40, 40);
     $graph->title->Set('GRAFICO LINEAL');
     $graph->subtitle->Set('(Presupuesto)');
     $graph->title->SetFont(FF_FONT1, FS_BOLD);
     //$graph->xaxis->title->Set('Operator');
     //$graph->yaxis->title->Set('# of calls');
     $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->SetTickLabels($dataIterationName);
     // Create the first data series
     $lineplot = new LinePlot($dataBudgetEstimated);
     $lineplot->SetWeight(2);
     // Two pixel wide
     $lineplot->mark->SetType(MARK_SQUARE);
     $lineplot->mark->SetWidth(7);
     $lineplot->mark->SetColor('orange');
     //$lineplot->mark->SetColor('#A519B5');
     $lineplot->mark->SetFillColor('orange');
     //$lineplot->mark->SetFillColor('#A519B5');
     // Add the plot to the graph
     $graph->Add($lineplot);
     $lineplot->value->Show();
     //$lineplot->value->SetColor("#A519B5");
     $lineplot->value->SetColor("orange");
     $lineplot->SetLegend('Presupuesto estimado');
     // Create the second data series
     $lineplot2 = new LinePlot($dataBudgetReal);
     /*
         MARK_SQUARE, A filled square
         MARK_UTRIANGLE, A triangle pointed upwards
         MARK_DTRIANGLE, A triangle pointed downwards
         MARK_DIAMOND, A diamond
         MARK_CIRCLE, A circle
         MARK_FILLEDCIRCLE, A filled circle
         MARK_CROSS, A cross
         MARK_STAR, A star
         MARK_X, An 'X'
         MARK_LEFTTRIANGLE, A half triangle, vertical line to left (used as group markers for Gantt charts)
         MARK_RIGHTTRIANGLE, A half triangle, vertical line to right (used as group markers for Gantt charts)
         MARK_FLASH, A Zig-Z
     */
     //$lineplot2->SetWeight( 2 );   // Two pixel wide
     //$lineplot2->mark->SetType(MARK_DIAMOND);
     //$lineplot2->mark->SetColor('#A519B5');
     //$lineplot2->mark->SetFillColor('#A519B5');
     $lineplot2->mark->SetType(MARK_DIAMOND);
     $lineplot2->mark->SetWidth(10);
     $lineplot2->mark->SetColor('#A519B5');
     //$lineplot2->mark->SetColor('orange');
     $lineplot2->mark->SetFillColor('#A519B5');
     //$lineplot2->mark->SetFillColor('orange');
     // Add the second plot to the graph
     $graph->Add($lineplot2);
     $lineplot2->SetColor("#00D053");
     $lineplot2->SetLegend('Presupuesto real');
     $lineplot2->value->Show();
     //        $lineplot2->value->SetColor("orange");
     $lineplot2->value->SetColor("#A519B5");
     $graph->legend->SetFrameWeight(2);
     $graph->legend->SetFont(FF_FONT1, FS_BOLD);
     // Display the graph
     $graph->Stroke();
 }