public function getDelete($id = null)
 {
     if (!is_null($id)) {
         $id = SiteHelpers::encryptID($id, true);
         TechnologyModel::where('id', $id)->delete();
         return Redirect::to('technology')->with('message', SiteHelpers::alert('success', "Data deleted esuccessfully"));
     }
 }
 public function getAdd($id = null)
 {
     $data['technology'] = TechnologyModel::all();
     if ($id == null) {
         $new = new PlotModel();
         $new->name = "";
         $new->id_tech = "";
         $data['row'] = $new;
     } else {
         $id = SiteHelpers::encryptID($id, true);
         $data['row'] = PlotModel::where('id', $id)->first();
         $data['plot'] = PlotDataModel::where('id_plot', $id)->get();
     }
     //        print_r ($data['row']);exit();
     //        print_r  ($data['row']['name']);exit();
     return View::make('files.form', $data);
 }
 public function postFinalpresentation()
 {
     $id_result = Input::get('id_result');
     $resulted = AutomateModel::where('id', $id_result)->first();
     //        $range_name_id = Input::get('range_name_id');
     $result = LogChartModel::where('id_result', $id_result)->get();
     $objPHPPowerPoint = new PhpPowerpoint();
     // Set properties
     //        echo date('H:i:s') . ' Set properties' . EOL;
     $objPHPPowerPoint->getProperties()->setCreator('HAT Developer')->setLastModifiedBy('HAT Developer')->setTitle('Sample 07 Title')->setSubject('Sample 07 Subject')->setDescription('Sample 07 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
     // Remove first slide
     //        echo date('H:i:s') . ' Remove first slide' . EOL;
     $objPHPPowerPoint->removeSlideByIndex(0);
     // Set Style
     $oFill = new Fill();
     //        $oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20'));
     $oShadow = new Shadow();
     $oShadow->setVisible(true)->setDirection(45)->setDistance(10);
     //FIRST SLIDE
     $currentSlide = $this->createTemplatedSlide($objPHPPowerPoint);
     // local function
     // Create a shape (text)
     // Create a shape (text)
     $shape = $currentSlide->createRichTextShape();
     $shape->setHeight(600)->setWidth(930)->setOffsetX(40)->setOffsetY(300);
     $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT)->setMarginLeft(25)->setIndent(-25);
     $shape->getActiveParagraph()->getFont()->setSize(18)->setColor(new Color('E07116'));
     //        $shape->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET);
     $shape->createTextRun($resulted->info);
     //END OF FIRST SLIDE
     $index = 0;
     //        print_r('here'); exit();
     foreach ($result as $file) {
         //            echo $file->filename.'<br>';
         $currentSlide = $this->createTemplatedSlide($objPHPPowerPoint);
         $shape = $currentSlide->createDrawingShape();
         $shape->setName('Result Chart')->setDescription('PHPPowerPoint logo')->setPath(public_path($file->filename))->setHeight(450)->setWidth(650)->setOffsetX(100)->setOffsetY(160);
         $shape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
         $shape = $currentSlide->createRichTextShape();
         $shape->setHeight(50)->setWidth(930)->setOffsetX(20)->setOffsetY(45);
         $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setMarginLeft(25)->setIndent(-25);
         $shape->getActiveParagraph()->getFont()->setSize(23)->setColor(new Color('D66204'));
         //        $shape->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET);
         $title = explode(',', $file->title);
         $plot_data = PlotDataModel::where('id_plot', $file->id_plot)->get();
         $plot_name = PlotModel::where('id', $file->id_plot)->first();
         $technya = TechnologyModel::where('id', $plot_name->id_tech)->first();
         if ($technya->name == 'UMTS') {
             $shape->createTextRun(str_ireplace('ch', 'UARFCN', $title[1]) . ' Histogram');
         } else {
             if ($technya->name == 'LTE') {
                 $shape->createTextRun(str_ireplace('ch', 'LARFCN', $title[1]) . ' Histogram');
             } else {
                 $shape->createTextRun(str_ireplace('ch', 'ARFCN', $title[1]) . ' Histogram');
             }
         }
         $co = count($plot_data);
         $shape = $currentSlide->createTableShape(1);
         $shape->setWidth(150);
         $shape->setOffsetX(760);
         $shape->setOffsetY(200);
         $row = $shape->createRow();
         $row->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('EEF0EB'))->setEndColor(new Color('EEF0EB'));
         $row->nextCell()->createTextRun($plot_name->name);
         $i = 2;
         foreach ($plot_data as $rw) {
             $row = $shape->createRow();
             if ($i % 2 == 0) {
                 $row->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('DCEBCA'))->setEndColor(new Color('DCEBCA'));
             } else {
                 $row->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('EEF0EB'))->setEndColor(new Color('EEF0EB'));
             }
             $row->nextCell()->createTextRun($rw->start . ' to ' . $rw->end);
             $i++;
         }
         $index++;
     }
     // Save file
     $named = date('Ymdhis_') . $this->toAscii($resulted->info);
     $this->write($objPHPPowerPoint, $named, $this->writers);
     $resultsave = AutomateModel::find($id_result);
     $resultsave->file_result = date('Y-m-d') . '/' . $named;
     $resultsave->save();
     Session::flash('message', SiteHelpers::alert('success', Lang::get('Process has completed, check the result on table bellow')));
     return Redirect::to('/automate');
 }