コード例 #1
0
 public function createDesignation()
 {
     $in = Input::all();
     $rules = ['group' => 'required', 'deadline' => 'required', 'time' => 'required'];
     $validation = Validator::make($in, $rules);
     if ($validation->passes()) {
         $activity = GroupPageActivity::find($in['grouppageactivityID']);
         $gpaGroup = GroupPageActivityGroup::create(['grouppageactivityID' => $in['grouppageactivityID'], 'grouppageID' => $in['group'], 'deadline' => $in['deadline'] . ' ' . $in['time']]);
         if ($gpaGroup) {
             $gpPost = GroupPagePost::create(['grouppageID' => $in['group'], 'StudentID' => Auth::user()->StudentID, 'Message' => '<h5>Activity name:</h5>' . $activity->name . '<br/><h5>Description:</h5>' . $activity->description . '<br/><span class="timeago">Deadline: ' . date(MyDate::getDateFormat(), strtotime($in['deadline'])) . '</span><p>Kindly check your activities Tab</p>']);
             Notification::create(['StudentID' => Auth::user()->StudentID, 'grouppageID' => $in['group'], 'grouppageactivityID' => $in['grouppageactivityID'], 'grouppagepostID' => $gpPost->id, 'notificationEventTypeID' => 1, 'seen' => 0]);
         }
         return Redirect::to('/')->with('message', 'Group activity designation successful')->with('url', '/group/activities/view/' . $in['grouppageactivityID']);
     }
     return Redirect::to('/')->with('message', 'Error in group activity designation')->with('url', '/group/activities/view/' . $in['grouppageactivityID']);
 }
コード例 #2
0
 public function more()
 {
     $user = User::with('Course', 'Gender', 'userType')->where('StudentID', Auth::user()->StudentID)->first();
     $adminGroupPages = GroupPage::where('StudentID', Auth::user()->StudentID)->where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
     $groupPages = GroupPageMember::with('groupPages')->where('StudentID', Auth::user()->StudentID)->where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
     if (Auth::user()->UserTypeID == 2) {
         $files = Files::where('delFlag', 0)->where('folderID', 0)->where('OwnerID', Auth::user()->StudentID)->get();
         $fileFolders = FilesFolder::where('OwnerID', Auth::user()->StudentID)->where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
         $activities = GroupPageActivity::where('OwnerID', Auth::user()->StudentID)->where('delFlag', 0)->get();
         $quizzes = Quiz::where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
     } else {
         $activities = GroupPageActivityGroup::with('groupPage', 'groupPageActivityFiles')->where('deadline', '>', date('Y-m-d H:i:s'))->whereExists(function ($q) {
             $q->select(DB::raw(0))->from('grouppagemember')->whereRaw('grouppagemember.grouppageID = grouppageactivitygroup.grouppageID')->where('StudentID', Auth::user()->StudentID)->whereRaw('grouppagemember.delFlag = 0');
         })->orderBy('deadline', 'ASC')->get();
         $quizzes = QuizGroupPage::with('groupPageMember', 'groupPage', 'quiz')->where('delFlag', 0)->whereNotExists(function ($q) {
             $q->select(DB::raw(0))->from('quiztaken', 'grouppagemember')->where('quiztaken.OwnerID', Auth::user()->StudentID)->whereRaw('quiztaken.quizID = quizgrouppage.quizID')->where('delFlag', 0);
         })->get();
     }
     return View::make('validated.more', compact('user', 'adminGroupPages', 'groupPages', 'files', 'fileFolders', 'activities', 'quizzes'));
 }