示例#1
0
 public function store(Request $request)
 {
     $cfgGoogle = \Session::get('_ClientGoogle');
     if (isset($cfgGoogle)) {
         $user = \Auth::user();
         $data = $request->all();
         //dd($data);
         $rArtifacts = \App\Methodology::Join('phases', function ($join) {
             $join->on('phases.id_methodology', '=', 'methodologies.id');
         })->join('artifacts', function ($join) {
             $join->on('artifacts.id_phase', '=', 'phases.id');
         })->select('methodologies.id as meth_id', 'methodologies.name as meth_name', 'phases.id as pha_id', 'phases.name as pha_name', 'artifacts.id as art_id', 'artifacts.name as art_name', 'artifacts.start as art_start', 'artifacts.delivery as art_delivery')->where('artifacts.active', true)->where('phases.active', true)->where('methodologies.active', true)->where('methodologies.id', $data['id_methodology'])->orderBy('artifacts.delivery', 'asce')->get();
         //dd($user);
         $eventCreate = array();
         $calendarGoogle = new \Google_Service_Calendar($cfgGoogle);
         foreach ($rArtifacts as $key => $artifact) {
             $start = date("c", strtotime($artifact->art_start));
             $end = date("c", strtotime($artifact->art_delivery));
             $event = new \Google_Service_Calendar_Event(array('summary' => $artifact->art_name, 'description' => $artifact->art_name, 'start' => array('dateTime' => $start, 'timeZone' => 'America/Mexico_City'), 'end' => array('dateTime' => $end, 'timeZone' => 'America/Mexico_City')));
             //dd($user->id);
             $table['id_student'] = $user->id;
             $table['id_period'] = intval($data['id_period']);
             $table['id_company'] = intval($data['id_company']);
             $table['id_methodology'] = $artifact->meth_id;
             //dd($artifact->pha_id);
             $table['id_phase'] = intval($artifact->pha_id);
             $table['id_artifact'] = intval($artifact->art_id);
             $table['name'] = $artifact->art_name;
             $table['start'] = $artifact->art_start;
             $table['delivery'] = $artifact->art_delivery;
             //	$artifact_current  = \App\Artifact::find(intval($artifact->art_id));
             //	dd($artifact_current);
             $calendarId = 'primary';
             $events = $calendarGoogle->events->insert($calendarId, $event);
             $table['id_calendar'] = $events->id;
             $table['htmlLink'] = $events->htmlLink;
             $tpmCal = new \App\Calendar($table);
             $tpmCal->save();
         }
         if ($request->ajax()) {
             return response()->json(array('status' => true, 'data' => 'The syn calendar is successful!'));
         }
     } else {
         if ($request->ajax()) {
             return response()->json(array('status' => false, 'data' => 'For sync calendar is need login with Google!'));
         }
     }
     //dd($data_calendar);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //period.company
     $data = explode('.', $id);
     $rArtifacts = array();
     $rMethodology = array();
     $rMethodology = \App\RegistryMethodology::where('id_period', $data[0])->where('id_company', $data[1])->get();
     if (count($rMethodology) > 0) {
         //dd($rMethodology[0]->id_methodology);
         $rArtifacts = \App\Methodology::Join('phases', function ($join) {
             $join->on('phases.id_methodology', '=', 'methodologies.id');
         })->join('artifacts', function ($join) {
             $join->on('artifacts.id_phase', '=', 'phases.id');
         })->select('methodologies.id as meth_id', 'methodologies.name as meth_name', 'phases.id as pha_id', 'phases.name as pha_name', 'artifacts.id as art_id', 'artifacts.name as art_name', 'artifacts.start as art_start', 'artifacts.delivery as art_delivery')->where('artifacts.active', true)->where('phases.active', true)->where('methodologies.active', true)->where('methodologies.id', $rMethodology[0]->id_methodology)->orderBy('artifacts.delivery', 'asce')->get();
         //	dd($rArtifacts);
     } else {
         $rMethodology = array();
     }
     return view('Admin.Evaluation.advance', ['rMethodology' => $rMethodology, 'rArtifacts' => $rArtifacts, 'data' => $data]);
     //
 }
示例#3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $methodology = \App\Methodology::lists('name', 'id');
     $currentuser = $this->user;
     $company = \App\RegistryCompany::Join('companies', function ($join) use($currentuser) {
         $join->on('companies.id', '=', 'registry_companies.id_company')->where('registry_companies.id_student', '=', $currentuser->id);
     })->select('companies.id', 'companies.name')->where('id_period', $id)->get();
     //dd($company[0]->name);
     if (count($company) > 0) {
         $teamwork = \App\RegistryCompany::Join('users', function ($join) use($company) {
             $join->on('users.id', '=', 'registry_companies.id_student')->where('registry_companies.id_company', '=', $company[0]->id);
         })->select('users.id', 'users.first_name', 'users.last_name', 'users.email')->where('id_period', $id)->get();
     } else {
         $teamwork = array();
     }
     if (count($company) > 0 && count($teamwork) > 0) {
         $account = \App\ConfigCorreo::where('id_company', '=', $company[0]->id)->where('id_period', '=', $id)->get();
         if (count($account) > 0) {
             $account = $account[0];
         } else {
             $account = array();
         }
     } else {
         $account = array();
     }
     if (count($company) > 0 && count($teamwork) > 0) {
         $methodology_use = \App\RegistryMethodology::where('id_company', '=', $company[0]->id)->where('id_period', '=', $id)->get();
         if (count($methodology_use) > 0) {
             $methodology_use = $methodology_use[0];
         } else {
             $methodology_use = array();
         }
     } else {
         $methodology_use = array();
     }
     //dd();
     return view("Admin.Course.Settings.setting", ['company' => $company, 'teamwork' => $teamwork, 'id' => $id, 'account' => $account, 'methodology' => $methodology, 'methodology_use' => $methodology_use]);
 }
示例#4
0
 public function findMethodology()
 {
     return \App\Methodology::lists('name', 'id');
 }
示例#5
0
文件: Phase.php 项目: JJHdez/OpenTpmW
 public function getMethodologyAttribute()
 {
     $methodology = \App\Methodology::where('id', $this->id_methodology)->get();
     return $methodology;
 }
示例#6
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //<!-- period.company.methodologies.artifact-->
     /*
     		$cfgGoogle = \Session::get('_ClientGoogle');
     		if(isset($cfgGoogle)){
     			$service =  new  \Google_Service_Drive($cfgGoogle);
     			$file = new \Google_Service_Drive_DriveFile();
     			$file->setTitle( 'Hello world!' );
     			$file->setMimeType( 'application/vnd.google-apps.document' );
     			$file = $service->files->insert( $file );
     			dd($file);
     		}
     		dd(3423);	*/
     $data = explode('.', $id);
     $user = \Auth::user();
     $rArtifact = \App\Methodology::Join('phases', function ($join) {
         $join->on('phases.id_methodology', '=', 'methodologies.id');
     })->join('artifacts', function ($join) {
         $join->on('artifacts.id_phase', '=', 'phases.id');
     })->leftJoin('calendars', function ($leftJoin) use($user, $data) {
         $leftJoin->on('calendars.id_phase', '=', 'phases.id')->where('calendars.id_artifact', '=', 'artifacts.id')->where('calendars.id_methodology', '=', 'methodologies.id')->where('calendars.id_student', '=', $user->id)->where('calendars.id_period', '=', $data[0])->where('calendars.id_company', '=', $data[1]);
     })->select('methodologies.id as meth_id', 'methodologies.name as meth_name', 'phases.id as pha_id', 'phases.name as pha_name', 'artifacts.id as art_id', 'artifacts.name as art_name', 'artifacts.start as art_start', 'artifacts.delivery as art_delivery', 'calendars.id_calendar as id_calendar', 'calendars.htmlLink as htmlLink')->where('artifacts.active', true)->where('phases.active', true)->where('methodologies.active', true)->where('methodologies.id', $data[2])->where('artifacts.id', $data[3])->get();
     if (count($rArtifact) > 0) {
         $rArtifact = $rArtifact[0];
     }
     $rDocs = \App\Doc::where('id_period', '=', $data[0])->where('id_methodology', '=', $data[2])->where('id_artifact', '=', $data[3])->where('id_company', '=', $data[1])->get();
     return view('Admin.Course.Advance.edit', ['rArtifact' => $rArtifact, 'data' => $data, 'rDocs' => $rDocs]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $methodologies = \App\Methodology::all();
     return view('Admin.Methodology.methodology', compact('methodologies', $methodologies));
 }