コード例 #1
0
ファイル: FileController.php プロジェクト: nagyist/abge
 public function getIndex($idCourse, $idInscription)
 {
     $course = Courses::find($idCourse);
     $inscription = Inscriptions::find($idInscription);
     $files = $inscription->files;
     $array = array('course' => $course, 'inscription' => $inscription, 'files' => $files, 'route' => self::parseRoute($course->id, $idInscription), 'parent' => self::parseParent($course->id), 'ancestor' => self::$ancestor, 'msg_success' => Session::get('msg_success'), 'msg_error' => Session::get('msg_error'));
     return View::make('backend.inscriptions.files')->with($array);
 }
コード例 #2
0
ファイル: AdminController.php プロジェクト: Konaeu/ubicom
 public function courseDelete()
 {
     $course_id = Input::get('deleteId');
     Homework::where('course_id', '=', $course_id)->delete();
     Courseware::where('course_id', '=', $course_id)->delete();
     Courses::find($course_id)->delete();
     return Redirect::to('course-edit');
 }
コード例 #3
0
ファイル: UserTypeController.php プロジェクト: nagyist/abge
 public function getCreate($idCourse)
 {
     $course = Courses::find($idCourse);
     if ($course) {
         return View::make('backend.usertypes.create', array('course' => $course, 'route' => self::parseRoute($idCourse)));
     } else {
         return Redirect::to($this->parent)->with(array('msg_error' => Lang::get('messages.course_not_found')));
     }
 }
コード例 #4
0
ファイル: DateController.php プロジェクト: nagyist/abge
 public function getCreate($idCourse, $idUserType, $idDate = '')
 {
     $course = Courses::find($idCourse);
     if ($course) {
         $usertype = UserTypes::find($idUserType);
         if ($usertype) {
             return View::make('backend.dates.create', array('course' => $course, 'usertype' => $usertype, 'route' => self::parseRoute($idCourse, $idUserType)));
         } else {
             return Redirect::to(self::parseRoute($idCourse, $idUserType))->with(array('msg_error' => Lang::get('messages.usertype_not_found')));
         }
     } else {
         return Redirect::to($this->ancestor)->with(array('msg_error' => Lang::get('messages.course_not_found')));
     }
 }
コード例 #5
0
ファイル: HomeController.php プロジェクト: Konaeu/ubicom
 public function saveItem()
 {
     $cat_id = Input::get('cat_id');
     $item_id = Input::get('id');
     //获取表单
     if ($cat_id == 0) {
         //新闻编辑
         $title = Input::get('title');
         $content = Input::get('content');
         $abstract = Input::get('abstract');
         $item = News::find($item_id);
     } else {
         if ($cat_id == 1) {
             //项目编辑
             $title = Input::get('title');
             $content = Input::get('content');
             $abstract = Input::get('abstract');
             $begin_time = Input::get('begin_time');
             $end_time = Input::get('end_time');
             $item = Researches::find($item_id);
         } else {
             if ($cat_id == 2) {
                 //通知编辑
                 //
                 $title = Input::get('title');
                 $content = Input::get('content');
                 $item = Notices::find($item_id);
             } else {
                 if ($cat_id == 3) {
                     //课程编辑
                     $course_name = Input::get('course_name');
                     $course_info = Input::get('course_info');
                     $teacher_address = Input::get('teacher_address');
                     $teacher_mail = Input::get('teacher_mail');
                     $TA_name = Input::get('TA_name');
                     $TA_address = Input::get('TA_address');
                     $TA_mail = Input::get('TA_mail');
                     $item = Courses::find($item_id);
                     $homeworks = Courses::find($item_id)->homework;
                     $coursewares = Courses::find($item_id)->courseware;
                     $course_notices = Courses::find($item_id)->comments;
                     foreach ($course_notices as $notice) {
                         $update_notice = Comments::find($notice->id);
                         $update_notice->comment = Input::get('course_notice_content' . $notice->id);
                         $update_notice->updated_at = date("Y-m-d H:i:s");
                         $update_notice->save();
                     }
                     foreach ($homeworks as $homework) {
                         //对已有项进行编辑
                         $delete_or_not = Input::get('homework_delete' . $homework->id);
                         if ($delete_or_not) {
                             //如果标记为删除则将已有作业进行删除
                             $delete_item = Homework::find($homework->id);
                             $delete_item->delete();
                         } else {
                             $update_item = Homework::find($homework->id);
                             $update_item->homework_item = Input::get('homework_label' . $homework->id);
                             $update_item->submit_deadline = Input::get('homework_submit_time' . $homework->id);
                             $update_item->deliver_deadline = Input::get('homework_deliver_time' . $homework->id);
                             $update_item->updated_at = date("Y-m-d H:i:s");
                             $update_item->save();
                         }
                     }
                     foreach ($coursewares as $courseware) {
                         $update_item = Courseware::find($courseware->id);
                         $update_item->label = Input::get('courseware_label' . $courseware->id);
                         $update_file_source = 'courseware_ppt' . $courseware->id;
                         $new_source = HomeController::upload_course($item_id, $update_file_source);
                         if ($new_source != "") {
                             //跟新源的同时将旧的课件删除
                             HomeController::delete_file($update_item->source);
                             $update_item->source = $new_source;
                         } else {
                         }
                         $update_item->updated_at = date("Y-m-d H:i:s");
                         $update_item->save();
                     }
                 }
             }
         }
     }
     //保存数据
     if ($item) {
         //表中已经存在该条目
         if ($cat_id == 0) {
             //新闻编辑
             $item->title = $title;
             $item->content = $content;
             $item->abstract = $abstract;
             $item->save();
             return Redirect::to(URL::to('/news-detail', [$item_id]));
         } else {
             if ($cat_id == 1) {
                 //项目编辑
                 $item->title = $title;
                 $item->content = $content;
                 $item->abstract = $abstract;
                 $item->begin_time = $begin_time;
                 $item->end_time = $end_time;
                 $item->save();
                 return Redirect::to(URL::to('/research-detail', [$item_id]));
             } else {
                 if ($cat_id == 2) {
                     //通知编辑
                     $item->title = $title;
                     $item->content = $content;
                     $item->save();
                     return Redirect::to(URL::to('/notice-detail', [$item_id]));
                 } else {
                     if ($cat_id == 3) {
                         //课程编辑
                         $item->course_name = $course_name;
                         $item->course_info = $course_info;
                         $item->teacher_address = $teacher_address;
                         $item->teacher_mail = $teacher_mail;
                         $item->TA_name = $TA_name;
                         $item->TA_address = $TA_address;
                         $item->TA_mail = $TA_mail;
                         $item->save();
                         $course_notices_add_count = Input::get('course_notice_add_count');
                         if ($course_notices_add_count) {
                             //增加新的通知
                             for ($i = 1; $i <= $course_notices_add_count; $i++) {
                                 $add_or_not = Input::get('course_notice_add_or_not' . $i);
                                 if (!$add_or_not) {
                                     $notice = new Comments();
                                     $notice->course_id = $item_id;
                                     $notice->comment = Input::get('course_notice_add_content' . $i);
                                     $notice->created_at = date("Y-m-d H:i:s");
                                     $notice->updated_at = date("Y-m-d H:i:s");
                                     $notice->save();
                                 }
                             }
                         }
                         $homework_add_count = Input::get('homework_add_count');
                         if ($homework_add_count) {
                             //当添加了新的作业,将其添加到homework数据库中
                             for ($i = 1; $i <= $homework_add_count; $i++) {
                                 $add_or_not = Input::get('homework_add_or_not' . $i);
                                 if (!$add_or_not) {
                                     $homework = new Homework();
                                     $homework->course_id = $item_id;
                                     $homework->homework_item = Input::get('homework_add_item' . $i);
                                     $homework->submit_deadline = Input::get('homework_add_submit_time' . $i);
                                     $homework->deliver_deadline = Input::get('homework_add_deliver_time' . $i);
                                     $homework->created_at = date("Y-m-d H:i:s");
                                     $homework->updated_at = date("Y-m-d H:i:s");
                                     $homework->save();
                                 }
                             }
                         }
                         $courseware_add_count = Input::get('courseware_add_count');
                         if ($courseware_add_count) {
                             //当添加了新的课件,将其添加到courseware表中
                             for ($i = 1; $i <= $courseware_add_count; $i++) {
                                 $courseware = new Courseware();
                                 $courseware->course_id = $item_id;
                                 $courseware->label = Input::get('courseware_add_label' . $i);
                                 //先将课件上传到数据库中
                                 $file_source = 'courseware_add_source' . $i;
                                 $courseware->source = HomeController::upload_course($item_id, $file_source);
                                 $courseware->created_at = date("Y-m-d H:i:s");
                                 $courseware->updated_at = date("Y-m-d H:i:s");
                                 $courseware->save();
                             }
                         }
                         return Redirect::to(URL::to('/course', [$item_id]));
                     }
                 }
             }
         }
     } else {
         //对已有条目进行更新
         if ($cat_id == 0) {
             //新闻条目
             News::insert(['title' => $title, 'abstract' => $abstract, 'content' => $content]);
             $item = News::all()->last();
             return Redirect::to(URL::to('/news-detail', [$item->id]));
         } else {
             if ($cat_id == 1) {
                 //项目条目
                 Researches::insert(['title' => $title, 'abstract' => $abstract, 'content' => $content, 'begin_time' => $begin_time, 'end_time' => $end_time]);
                 $item = Researches::all()->last();
                 return Redirect::to(URL::to('/research-detail', [$item->id]));
             } else {
                 if ($cat_id == 2) {
                     //通知编辑
                     Notices::insert(['title' => $title, 'content' => $content]);
                     $item = Notices::all()->last();
                     return Redirect::to(URL::to('/notice-detail', [$item->id]));
                 } else {
                     if ($cat_id == 3) {
                         Courses::insert(['course_name' => $course_name, 'course_info' => $course_info, 'teacher_address' => $teacher_address, 'TA_name' => $TA_name, 'TA_address' => $TA_address]);
                         $item = Courses::all()->last();
                         return Redirect::to(URL::to('/course', [$item->id]));
                     }
                 }
             }
         }
     }
     //return View::make('/news-detail',[$item_id]);
 }
コード例 #6
0
 public function postTrabalhocadastro()
 {
     $course = Courses::find(Input::get('course'));
     $usertype = UserTypes::find(Input::get('usertype'));
     $estado = ORGStates::where('id_estado', '=', Input::get('estado'))->take(1)->get();
     $estado_empresa = ORGStates::where('id_estado', '=', Input::get('estado_empresa'))->take(1)->get();
     //dd(Input::all());
     $participant = new ORGParticipants();
     $participant->nome = Input::get('nome') != null ? Input::get('nome') : '';
     $participant->rg = Input::get('rg') != null ? Input::get('rg') : '';
     $participant->cpf = Input::get('cpf') != null ? Input::get('cpf') : '';
     $participant->endereco = Input::get('endereco') != null ? Input::get('endereco') : '';
     $participant->numero = Input::get('numero') != null ? Input::get('numero') : '';
     $participant->complemento = Input::get('complemento') != null ? Input::get('complemento') : '';
     $participant->cep = Input::get('cep') != null ? Input::get('cep') : '';
     $participant->cidade = Input::get('cidade') != null ? Input::get('cidade') : '';
     $participant->estado = isset($estado[0]->name_estado) ? $estado[0]->name_estado : '';
     /*$participant->empresa = Input::get('empresa') != null ? Input::get('empresa') : '';
     		$participant->cnpj = Input::get('cnpj_empresa') != null ? Input::get('cnpj_empresa') : '';
     		$participant->endereco_empresa = Input::get('endereco_empresa') != null ? Input::get('endereco_empresa') : '';
     		$participant->numero_empresa = Input::get('nome') != null ? Input::get('nome') : '';
     		$participant->complemento_empresa = Input::get('complemento_empresa') != null ? Input::get('complemento_empresa') : '';
     		$participant->cep_empresa = Input::get('cep_empresa') != null ? Input::get('cep_empresa') : '';
     		$participant->cidade_empresa = Input::get('cidade_empresa') != null ? Input::get('cidade_empresa') : '';
     		$participant->estado_empresa = isset($estado_empresa[0]->name_estado) ? $estado_empresa[0]->name_estado : '';
     		$participant->celular = Input::get('celular_empresa') != null ? Input::get('celular_empresa') : '';*/
     $participant->telefone = Input::get('telefone_empresa') != null ? Input::get('telefone_empresa') : '';
     $participant->email = Input::get('email') != null ? Input::get('email') : '';
     $participant->save();
     $user = new User();
     $user->email = $participant->email;
     if ($participant->nome != null) {
         $user->name = $participant->nome;
     } else {
         $user->name = "User without name";
     }
     $user->status = 'publish';
     $user->type = 'participant';
     $user->save();
     $participant = ORGParticipants::getByCPF($participant->cpf);
     $part = new Participants();
     $part->participant = $participant[0]->id_participante;
     $part->user = $user->id;
     $part->email = $participant[0]->email;
     $part->name = $participant[0]->nome;
     $part->cpf = $participant[0]->cpf;
     $part->status = 'publish';
     $part->type = 'participant';
     $part->save();
     Auth::user()->login($user);
     if ($inscription = Inscriptions::hasInscription(Auth::user()->user()->id, $course->id)) {
         $array = array('msg_success' => Lang::get('messages.login_welcome'), 'usertype' => $usertype, 'inscription' => $inscription);
         return Redirect::to($course->route . '/arquivos')->with($array);
     } else {
         $inscription = new Inscriptions();
         $inscription->id_course = $course->id;
         $inscription->id_user = Auth::user()->user()->id;
         $inscription->id_usertype = $usertype->id;
         $inscription->save();
         $array = array('usertype' => $usertype, 'inscription' => $inscription);
         return Redirect::to($course->route . '/arquivos')->with($array);
     }
 }
コード例 #7
0
ファイル: CourseController.php プロジェクト: nagyist/abge
 public function getDelete($id = '')
 {
     if ($id == '') {
         return Redirect::to($this->route)->with('msg_error', Lang::get('messages.courses_display_err'));
     } else {
         $course = Courses::find($id);
         $delete = Courses::destroy($id);
         if (!$delete) {
             return Redirect::to($this->route . '/trash')->with('msg_error', Lang::get('messages.courses_delete_err', array('title' => $course->title)));
         } else {
             return Redirect::to($this->route . '/trash')->with('msg_success', Lang::get('messages.courses_delete', array('title' => $course->title)));
         }
     }
 }
コード例 #8
0
 public function getExportinscriptions($idCourse)
 {
     $course = Courses::find($idCourse);
     $inscriptions = $course->inscriptions;
     $users = array();
     $trainings = ORGTrainings::all();
     $states = ORGStates::all();
     $towns = ORGTowns::all();
     $h = 0;
     foreach ($inscriptions as $ins) {
         # code...
         // var_dump($ins->id);
         if ($ins->user->type == "associate" || $ins->user->id == 127) {
             // var_dump($ins->user->id);
             // var_dump($ins->user->type);
             $tempuser = Associates::where('user', '=', $ins->user->id)->take(1)->get();
             $users[$ins->id] = $tempuser[0]->asociado;
         } elseif ($ins->user->type == "participant" && $ins->user->id != 127) {
             $tempuser = Participants::where('user', '=', $ins->user->id)->take(1)->get();
             // if($h>30)
             // 	dd($ins->user->id);
             // else
             // 	var_dump($tempuser[0]->id);
             $users[$ins->id] = $tempuser[0]->participante;
             // }
             /*if(isset($tempuser[0])):
             			$users[$ins->id]=$tempuser[0]->participante;
             		else:
             			var_dump($ins->user->type);
             			dd($ins->user->id);
             		endif;*/
         }
         $h++;
     }
     // foreach($inscriptions as $inscription):
     // 	// $total["name"] = $inscription->user->name;
     // 	// $total["email"] = $inscription->user->email;
     // 	// $total["paid"] = $inscription->paid;
     // 	// $total["date"] = date_format(date_create($inscription->created_at), 'd-m-Y');
     // 	// $total["type"] = $inscription->usertype->title;
     // 	$total= ["nome" => $inscription->user->name,
     // 			 "email" => $inscription->user->email,
     // 			 "paid" => $inscription->paid,
     // 			 "date" => date_format(date_create($inscription->created_at), 'd-m-Y'),
     // 			 "type" => $inscription->usertype->title
     // 			 ];
     // 	// break;
     // 	// array_push($total,$inscription->user->name,$inscription->user->email);
     // endforeach;
     // dd($inscriptions);
     Excel::create('Export Inscriptions ' . $course->title . "-" . rand(2, 700 * date("H")) . "-" . date("d-m-Y"), function ($excel) use($inscriptions, $users) {
         $excel->sheet('Excel sheet', function ($sheet) use($inscriptions, $users) {
             $sheet->setOrientation('portrait');
             $n = 2;
             // $sheet->appendRow(1,array("Codigo Asociado","Nome","RG","Email", "Telefone", "Celular", "CPF", "Tipo Pessoa","Pagamento", "Fecha", "User Type", "Endereço", "Complemento", "CEP", "Cidade", "Estado", "Empresa", "Endereço Empresa", "Complemento Empresa", "Telefone Empresa", "CNPJ", "Cargo" ));
             // $inscriptions = $inscriptions;
             foreach ($inscriptions as $inscription) {
                 // $total["name"] = $inscription->user->name;
                 // $total["email"] = $inscription->user->email;
                 // $total["paid"] = $inscription->paid;
                 // $total["date"] = date_format(date_create($inscription->created_at), 'd-m-Y');
                 // $total["type"] = $inscription->usertype->title;
                 if ($inscription->paid == 0) {
                     $paid = "Não";
                 } else {
                     $paid = "Sim";
                 }
                 if ($inscription->user->type == 'associate' || $inscription->user->id == 127) {
                     // if(isset($users[$inscription->id]->codigo_asoc)){
                     // 	var_dump($users[$inscription->id]->nombre_completo);
                     // }else{
                     // 	dd($inscription->user->id);
                     // }
                     $cod_aso = $users[$inscription->id]->codigo_asoc;
                     $nome = $users[$inscription->id]->nombre_completo;
                     $rg = "";
                     //No agregados
                     $incripcion_estadual = $users[$inscription->id]->inscripcion_estadual;
                     $incripcion_municipal = $users[$inscription->id]->inscripcion_municipal;
                     $data_nascimento = $users[$inscription->id]->data_nascimento;
                     $training = ORGTrainings::find($users[$inscription->id]->formacao);
                     if ($training) {
                         $training = $training->nome;
                     } else {
                         $training = "";
                     }
                     $categoria_titulo = ORGAssociateCategories::all();
                     foreach ($categoria_titulo as $cat) {
                         if ($users[$inscription->id]->categoria == $cat->id_categoria_asociado) {
                             $categoria_titulo = $cat->nombre_categoria;
                             break;
                         }
                     }
                     $logradouro_res = "";
                     $backyards = ORGBackyards::all();
                     foreach ($backyards as $backyard) {
                         if ($users[$inscription->id]->logradouro_res == $backyard->id_logradouro) {
                             $logradouro_res = $backyard->nombre;
                             break;
                         }
                     }
                     $logradouro_com = "";
                     foreach ($backyards as $backyard) {
                         if ($users[$inscription->id]->logradouro_com == $backyard->id_logradouro) {
                             $logradouro_res = $backyard->nombre;
                             break;
                         }
                     }
                     $barrio_res = $users[$inscription->id]->bairro_res;
                     $barrio_com = $users[$inscription->id]->bairro_com;
                     $pasaporte = $users[$inscription->id]->passaporte;
                     $website = $users[$inscription->id]->web_site;
                     $responsable = $users[$inscription->id]->responsavel;
                     $publicaciones = $users[$inscription->id]->publicacoes;
                     $nombre_cientifico = $users[$inscription->id]->nome_cientifico;
                     $num_res = $users[$inscription->id]->numero_res;
                     $num_com = $users[$inscription->id]->numero_com;
                     //Fin de no agregados
                     //Campos participants no agregados
                     $cidade_empresa = "";
                     $estado_empresa = "";
                     $cep_empresa = "";
                     $state = "";
                     //Fin de campos participants no agregados
                     $cpf = $users[$inscription->id]->cpf;
                     $razon_social = $users[$inscription->id]->razon_social;
                     $celular = $users[$inscription->id]->celular_res;
                     $tipo_pessoa = $users[$inscription->id]->tipo_pessoa;
                     $data_nascimento = $users[$inscription->id]->data_nascimento;
                     $email = $users[$inscription->id]->email;
                     $data_cadastro = $users[$inscription->id]->data_cadastro;
                     $empresa = $users[$inscription->id]->empresa;
                     $empresa_dir = $users[$inscription->id]->dir_com;
                     $empresa_com = $users[$inscription->id]->complemento_com;
                     $empresa_tel = $users[$inscription->id]->ddd_com . ' ' . $users[$inscription->id]->ddi_com . ' ' . $users[$inscription->id]->telefone_com;
                     $cnpj = $users[$inscription->id]->cnpj;
                     $cargo = $users[$inscription->id]->cargo;
                     $dir = $users[$inscription->id]->dir_res;
                     $cep = $users[$inscription->id]->cep_res;
                     $complemento = $users[$inscription->id]->complemento_res;
                     $telefone = $users[$inscription->id]->ddd_res . ' ' . $users[$inscription->id]->ddi_res . ' ' . $users[$inscription->id]->telefone_res;
                     $estado = '';
                     $cidade = '';
                 } elseif ($inscription->user->type == 'participant') {
                     $cod_aso = "";
                     $nome = $users[$inscription->id]->nome;
                     // Campos de asociados obligatorio
                     $incripcion_estadual = "";
                     $incripcion_municipal = "";
                     $data_nascimento = "";
                     $training = "";
                     $categoria_titulo = "";
                     $logradouro_res = "";
                     $logradouro_com = "";
                     $barrio_res = "";
                     $barrio_com = "";
                     $pasaporte = "";
                     $website = "";
                     $responsable = "";
                     $publicaciones = "";
                     $nombre_cientifico = "";
                     $num_res = $users[$inscription->id]->numero;
                     $num_com = $users[$inscription->id]->numero_empresa;
                     //fin de campos asociados obligatorios
                     //Campos participants no agregados
                     $cidade_empresa = $users[$inscription->id]->cidade_empresa;
                     $estado_empresa = $users[$inscription->id]->estado_empresa;
                     $cep_empresa = $users[$inscription->id]->cep_empresa;
                     $state = ORGStates::all();
                     foreach ($state as $sta) {
                         if ($users[$inscription->id]->estado == $sta->name_estado) {
                             $state = $users[$inscription->id]->estado;
                             break;
                         } elseif ($users[$inscription->id]->estado == $sta->id_estado) {
                             $state = $sta->name_estado;
                             break;
                         }
                     }
                     //Fin de campos participants no agregados
                     $cpf = $users[$inscription->id]->cpf;
                     $rg = $users[$inscription->id]->rg;
                     $razon_social = '';
                     $celular = $users[$inscription->id]->celular;
                     $tipo_pessoa = 'F';
                     $data_nascimento = $users[$inscription->id]->data_nascimento;
                     $email = $users[$inscription->id]->email;
                     $data_cadastro = $users[$inscription->id]->data_cadastro;
                     $empresa = $users[$inscription->id]->empresa;
                     $empresa_dir = $users[$inscription->id]->endereco_empresa;
                     $empresa_com = $users[$inscription->id]->complemento_empresa;
                     $empresa_tel = "";
                     $cnpj = $users[$inscription->id]->cnpj;
                     $cargo = "";
                     $dir = $users[$inscription->id]->dir_res;
                     $cep = $users[$inscription->id]->cep;
                     $complemento = $users[$inscription->id]->complemento;
                     $telefone = $users[$inscription->id]->telefone;
                     $estado = $state;
                     $cidade = $users[$inscription->id]->cidade;
                     $cidade_empresa = $users[$inscription->id]->cidade_empresa;
                 }
                 $sheet->appendRow(1, array("Codigo Asociado", "Nome", "RG", "Email", "Telefone", "Celular", "CPF", "Tipo Pessoa", "Pagamento", "Fecha", "User Type", "Inscription estadual", "Inscription municipal", "Data Nascimento", "Training", "Category Title", "Logradouro Residencia", "Endereço", "Complemento", "Número Res", "Barrio Res", "CEP", "Cidade", "Estado", "Empresa", "Logradouro Empresa", "Endereço Empresa", "Cidade Empresa", "CEP Empresa", "Complemento Empresa", "Número Empresa", "Barrio Empresa", "Telefone Empresa", "CNPJ", "Cargo", "Pasaporte", "Website", "Responsavel", "Nome Cientifico", "Publicacoes"));
                 $total = ["codigo" => $cod_aso, "nome" => $nome, "rg" => $rg, "email" => $email, "telefone" => $telefone, "celular" => $celular, "cpf" => $cpf, "tipo_pessoa" => $tipo_pessoa, "paid" => $paid, "date" => date_format(date_create($inscription->created_at), 'd-m-Y'), "type" => $inscription->usertype->title, "inscription_est" => $incripcion_estadual, "incripcion_municipal" => $incripcion_municipal, "data_nascimento" => $data_nascimento, "training" => $training, "categoria_titulo" => $categoria_titulo, "logradouro_res" => $logradouro_res, "dir" => $dir, "complemento" => $complemento, "num_res" => $num_res, "barrio_res" => $barrio_res, "cep" => $cep, "cidade" => $cidade, "estado" => $estado, "empresa" => $empresa, "logradouro_com" => $logradouro_com, "empresa_dir" => $empresa_dir, "cidade_empresa" => $cidade_empresa, "cep_empresa" => $cep_empresa, "empresa_com" => $empresa_com, "num_com" => $num_com, "barrio_com" => $barrio_com, "empresa_tel" => $empresa_tel, "cnpj" => $cnpj, "cargo" => $cargo, "pasaporte" => $pasaporte, "website" => $website, "responsable" => $responsable, "nome_cientifico" => $nombre_cientifico, "publicaciones" => $publicaciones];
                 $sheet->appendRow($n, $total);
                 // break;
                 $n++;
                 // array_push($total,$inscription->user->name,$inscription->user->email);
             }
         });
     })->export('xlsx');
     // Excel::create('Export Inscriptions '. $course->title ."-". rand(2, 700*date("H"))."-".date("d-m-Y"), function($excel) use ($total){
     //     $excel->sheet('Excel sheet', function($sheet) use ($total){
     //         $sheet->setOrientation('portrait');
     //         	// dd($total);
     //         	$sheet->fromArray($total, null, 'A1', true);
     //     });
     // })->export('xlsx');
 }
     		Session::put('school', $id);			
     		return View::make("teacher.courses")
     			->with("title", "Course")
     			->with("coursesByschool", $coursesByschool)
     			->with("countSprints", $countSprints)
     			->with("school", $id)
     			->with("studyroom", false)
     			->with("user", $user);*/
 }));
 //Route to sprint for Teacher
 Route::get("course/teacher_sprints/{course}", array("as" => "teacher/sprintsBycourse", function ($course) {
     $user = Auth::user();
     //$course = Input::get('course');
     $school = Session::get('school');
     $sprints = DB::table('sprints')->where('course', $course)->where('deleted_at', NULL)->get();
     $courseByID = Courses::find($course);
     return View::make("teacher.sprints")->with("title", "Sprint")->with("parent_title", "Course")->with("sprints", $sprints)->with("school", $school)->with("course", $course)->with("courseByID", $courseByID)->with("studyroom", false)->with("user", $user);
 }));
 Route::get("all_sprints", array("as" => "teacher/sprints", function () {
     $user = Auth::user();
     $courses = DB::select("SELECT DISTINCT(lms_classcourse.course) FROM lms_classcourse\n\t\t\t\tLEFT JOIN lms_schoolclass ON lms_schoolclass.class = lms_classcourse.class\n\t\t\t\tLEFT JOIN lms_schooluser ON lms_schooluser.school = lms_schoolclass.school\n\t\t\t\tWHERE lms_schooluser.user = "******"SELECT DISTINCT(lms_schoolclass.class) FROM lms_schoolclass\n\t\t\t\tLEFT JOIN lms_schooluser ON lms_schooluser.school = lms_schoolclass.school\n\t\t\t\tWHERE lms_schooluser.user = " . $user->id);
     $class_name = array();
     foreach ($classes as $class) {
コード例 #10
0
 public function postAuth()
 {
     $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'), 'type' => 'associate');
     $course = Courses::find(Input::get('course'));
     if (Auth::user()->attempt($credentials)) {
         if ($payment = ORGAssociateAnnuities::hasAnnuity(Auth::user()->user())) {
             return Redirect::to(self::$route . '/acusado');
         } else {
             return Redirect::to(self::$route . '/pagamento');
         }
     } else {
         $associate = Associates::getByEmail($credentials['email']);
         if (!empty($associate[0])) {
             $associate = $associate[0];
             if ($associate->password == md5($credentials['password'])) {
                 $user_finded = User::where('email', '=', $credentials['email'])->take(1)->get();
                 $user = null;
                 if (!empty($user_finded[0])) {
                     $user = $user_finded[0];
                     $user->password = Hash::make($credentials['password']);
                     $user->save();
                 } else {
                     $user = new User();
                     $user->email = $associate->email;
                     if ($associate->nombre_completo != null) {
                         $user->name = $associate->nombre_completo;
                     } else {
                         $user->name = "User without name";
                     }
                     $user->status = 'publish';
                     $user->type = 'associate';
                     $user->password = Hash::make($credentials['password']);
                     $user->save();
                     $associate->user = $user->id;
                     $associate->save();
                 }
                 Auth::user()->login($user);
                 if ($payment = ORGAssociateAnnuities::hasAnnuity(Auth::user()->user())) {
                     return Redirect::to(self::$route . '/acusado');
                 } else {
                     return Redirect::to(self::$route . '/pagamento');
                 }
             } else {
                 $associate = ORGAssociates::getByEmail($credentials['email']);
                 if (!empty($associate[0])) {
                     $associate = $associate[0];
                     if ($associate->senha == md5($credentials['password'])) {
                         $user = new User();
                         $user->email = $associate->email;
                         if ($associate->nombre_completo != null) {
                             $user->name = $associate->nombre_completo;
                         } else {
                             $user->name = "User without name";
                         }
                         $user->status = 'publish';
                         $user->type = 'associate';
                         $user->password = Hash::make($credentials['password']);
                         $user->save();
                         $assoc = new Associates();
                         $assoc->associate = $associate->id_asociado;
                         $assoc->user = $user->id;
                         $assoc->email = $associate->email;
                         if ($associate->nombre_completo != null) {
                             $assoc->name = $associate->nombre_completo;
                         } else {
                             $assoc->name = "User without name";
                         }
                         $assoc->cpf = $associate->cpf;
                         $assoc->password = $associate->senha;
                         $assoc->status = 'publish';
                         $assoc->type = 'associate';
                         $assoc->save();
                         Auth::user()->login($user);
                         if ($payment = ORGAssociateAnnuities::hasAnnuity(Auth::user()->user())) {
                             return Redirect::to(self::$route . '/acusado');
                         } else {
                             return Redirect::to(self::$route . '/pagamento');
                         }
                     } else {
                         return Redirec::to(self::$route . '/error');
                     }
                 } else {
                     return Redirec::to(self::$route . '/error');
                 }
                 return Redirec::to(self::$route . '/error');
             }
         } else {
             $associate = ORGAssociates::getByEmail($credentials['email']);
             if (!empty($associate[0])) {
                 $associate = $associate[0];
                 if ($associate->senha == md5($credentials['password'])) {
                     $user = new User();
                     $user->email = $associate->email;
                     if ($associate->nombre_completo != null) {
                         $user->name = $associate->nombre_completo;
                     } else {
                         $user->name = "User without name";
                     }
                     $user->status = 'publish';
                     $user->type = 'associate';
                     $user->password = Hash::make($credentials['password']);
                     $user->save();
                     $assoc = new Associates();
                     $assoc->associate = $associate->id_asociado;
                     $assoc->user = $user->id;
                     $assoc->email = $associate->email;
                     if ($associate->nombre_completo != null) {
                         $assoc->name = $associate->nombre_completo;
                     } else {
                         $assoc->name = "User without name";
                     }
                     $assoc->cpf = $associate->cpf;
                     $assoc->password = $associate->senha;
                     $assoc->status = 'publish';
                     $assoc->type = 'associate';
                     $assoc->save();
                     Auth::user()->login($user);
                     if ($payment = ORGAssociateAnnuities::hasAnnuity(Auth::user()->user())) {
                         return Redirect::to(self::$route . '/acusado');
                     } else {
                         return Redirect::to(self::$route . '/pagamento');
                     }
                 } else {
                     return Redirec::to(self::$route . '/error');
                 }
             } else {
                 return Redirec::to(self::$route . '/error');
             }
         }
     }
 }
コード例 #11
0
ファイル: ContentController.php プロジェクト: nagyist/abge
 public function postUpdate($idCourse, $idContent = '')
 {
     if ($idContent == '') {
         return Redirect::to(self::parseRoute($idCourse));
     } else {
         $content = CoursesSection::find($idContent);
         if (!$content) {
             return Redirect::to(self::parseRoute($idCourse));
         } else {
             $course = Courses::find($idCourse);
             if (Input::get('teachers') != null) {
                 $teachers = Input::get('teachers');
                 $course->teachers()->sync($teachers);
             } elseif (Input::get('promotioners') != null) {
                 $promotioners = Input::get('promotioners');
                 $course->promotioners()->sync($promotioners);
             } elseif (Input::get('helpers') != null) {
                 $helpers = Input::get('helpers');
                 $course->helpers()->sync($helpers);
             } elseif (Input::get('supporters') != null) {
                 $supporters = Input::get('supporters');
                 $course->supporters()->sync($supporters);
             }
             $content->content = Input::get('content');
             if ($content->save()) {
                 return Redirect::to(self::parseRoute($idCourse))->with('msg_success', Lang::get('messages.contents_update', array('title' => $content->title)));
             } else {
                 return Redirect::to(self::parseRoute($idCourse))->with('msg_error', Lang::get('messages.contents_update_err', array('title' => $content->title)));
             }
         }
     }
 }
コード例 #12
0
ファイル: Classes.php プロジェクト: Headrun-php/TLG
 static function getClassessByFranchiseeCourseId($franchiseeId, $franchiseeCourseId)
 {
     $courseMasterId = Courses::find($franchiseeCourseId);
     $franchiseeClasses = ClassesMaster::getClassesMasterForDropDown($courseMasterId->master_course_id);
     return $franchiseeClasses;
 }
 public function teacherDeleteAction()
 {
     $input = Input::all();
     $id = $input["id"];
     $user_id = $input["userID"];
     $course = Courses::find($id);
     if ($course->created_by == $user_id) {
         $course = Courses::find($id);
         $course->deleted_at = new DateTime(date('Y-m-d H:i:s'));
         $course->save();
         /*Courses::find($id)->delete();*/
     }
     DB::table('classcourse')->where('course', $id)->delete();
     return Redirect::route('teacher/sprints');
 }