public function addGroup() { $sectionCode = SectionCode::find(new MongoId(Input::get('section'))); if (isset($sectionCode->_id)) { $section = Subject::find($sectionCode->subject_id)->sections()->find($sectionCode->section_id); if (strcasecmp($section->current_code, $sectionCode->code) === 0) { $group = new Group(); $group->name = trim(ucfirst(Input::get('name'))); $group->teamleader_id = Auth::id(); $group->section_code_id = new MongoId($sectionCode->_id); $group->students_id = array(Auth::id()); $group->project_name = trim(strtolower(Input::get('project_name'))); $message = ""; if (Input::hasFile('avatar_file')) { $data = Input::get('avatar_data'); $image = new CropImage(null, $data, $_FILES['avatar_file']); $group->logo = $image->getURL(); } else { $group->logo = null; } try { $group->save(); } catch (MongoDuplicateKeyException $e) { return Redirect::back()->withErrors(array('error' => Lang::get('register_group.duplicated'))); } return Redirect::to(Lang::get('routes.add_group'))->with('message', Lang::get('register_group.success')); } else { $message = Lang::get('register_group.code_expired'); } } else { $message = Lang::get('register_group.code_fail'); } return Redirect::back()->withErrors(array('error' => $message)); }
public function dropTeamleaderSectionCode() { if (Request::ajax()) { $sectionCode = SectionCode::find(Input::get('code')); $sectionCode->pull('teamleaders_id', new MongoId(Input::get('student'))); return Response::json("00"); } }
public function approve() { if (Request::ajax()) { $pending = PendingEnrollment::find(Input::get('id')); SectionCode::find($pending->section_code_id)->push('students_id', $pending->student_id, true); $pending->delete(); return Response::json(array('code' => "00", 'stats' => MessageController::getStats())); } }
<div class="row"> @if(count($groups) > 0) @foreach ($groups as $index => $group) <div class="col-lg-6 col-md-6"> <div class="panel" style="background-color: {{ $colors[$index] }}; color: white;"> <div class="panel-heading"> <div class="row"> <div class="col-xs-3"> <i class="fa fa-group fa-5x"></i> <input type="hidden" value="{{storage_path()}}" id="url"> </div> <div class="col-xs-9 text-right"> <div class="huge"> <a href="#" id="{{$group->_id}}" class="group_name" style="text-transform: none; color: white;">{{$group->name}}</a></div> <?php $sectionCode = SectionCode::find($group->section_code_id); $subject = Subject::find($sectionCode->subject_id); $section = $subject->sections()->find($sectionCode->section_id); $name = $subject->name . ' - ' . $section->code; ?> <div> <span style="text-transform: uppercase;">{{$name}}</span> </div> </div> </div> </div> <div class="panel-footer" style="color: #000000;"> <?php $students = Student::whereIn('_id', $group->students_id)->get(); ?> @foreach ($students as $user)
<table id="tableOrder" class="table table-striped table-bordered table-hover tablesorter"> <thead> <tr> <th>#</th> <th>{{Lang::get('register_group.subject')}}</th> <th>{{Lang::get('register_group.section_code')}}</th> <th>{{Lang::get('register_group.section')}}</th> <th>{{Lang::get('register_group.student')}}</th> <th>{{Lang::get('register_group.approve')}}</th> <th>{{Lang::get('register_group.deny')}}</th> </tr> </thead> <tbody> @foreach($pending as $index => $item) <?php $section_code = SectionCode::find($item->section_code_id); $subject = Subject::find($section_code->subject_id); $section = $subject->sections()->find($section_code->section_id); $student = Student::find($item->student_id); ?> <tr id="{{$index+1}}"> <td>{{$index+1}}</td> <td>{{$subject->name}}</td> <td>{{$section->code}}</td> <td>{{$section_code->code}}</td> <td>{{$student->name.' '.$student->last_name.' - ('.$student->id_number.')'}}</td> <td style="width:6%"> <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#deleteModal" onclick="approve('{{$item->_id}}', {{$index+1}})"> {{Lang::get('register_group.approve')}} </button> </td>