示例#1
0
 public static function getUsersChat($code)
 {
     $user = UserController::getUser(Auth::user());
     $sectionCodes = null;
     if ($user instanceof Teacher) {
         $sectionCodes = SectionCode::where('teacher_id', new MongoId($user->_id))->where('status', true)->where('code', $code)->first();
     } else {
         if ($user instanceof Student) {
             $sectionCodes = SectionCode::whereIn('students_id', array(new MongoId($user->_id)))->where('status', true)->where('code', $code)->first();
         }
     }
     return $sectionCodes;
 }
示例#2
0
 /**
  * Reset password for the student
  * 
  * @return View
  */
 public function resetPassword()
 {
     $user = User::first(['_id' => trim(Input::get('_id'))]);
     $user->password = Hash::make(Input::get('password'));
     $user->save();
     $info = UserController::getUser($user);
     $data = array('name' => strtoupper($info->name));
     Mail::send('emails.confirm-reset-password', $data, function ($message) {
         $message->to(strtolower(trim(Input::get('email'))))->subject(Lang::get('forget-password.reset_succes'));
     });
     $user = BlockedUser::where('user', $user->user)->first();
     if (isset($user->_id)) {
         $user->delete();
         if (Session::has($user->user)) {
             Session::forget($user->user);
         }
     }
     return Redirect::to('/')->with('message', Lang::get('register_student.password_changed'));
 }
示例#3
0
if (isset($_POST['action'])) {
    // instantiate classes to call functions from
    $UserController = new UserController();
    $ProjectController = new ProjectController();
    $PageController = new PageController();
    // handle which function to call
    switch ($_POST['action']) {
        // User Methods
        case "createUser":
            $UserController->createUser();
            break;
        case "deleteUser":
            $UserController->deleteUser();
            break;
        case "getUser":
            $UserController->getUser();
            break;
        case "checkLoggedIn":
            $UserController->checkLoggedIn();
            break;
        case "isAdmin":
            $UserController->isAdmin();
            break;
        case "login":
            $UserController->login();
            break;
        case "logout":
            $UserController->logout();
            break;
            // Project Methods
        // Project Methods
示例#4
0
$stats = MessageController::getStats();
?>
			<ul class="nav navbar-top-links navbar-right user-menu" id="user-menu">
				<li class="dropdown">
					<a href="#" class="settings dropdown-toggle" data-toggle="dropdown">
						<i class="fa fa-envelope" style="color: #0097A7;"></i>
						@if($stats['unread'] > 0)
							<span id="unread" class="badge bg-pink">{{$stats['unread']}}</span>
						@endif
					</a>
					<ul class="dropdown-menu inbox dropdown-user">
						@foreach($unreadMessages as $index => $message)
							<li class="popups" id="{{$index+1}}">
								<a>
									<?php 
$user = UserController::getUser(User::first($message->from));
?>

									@if($user->profile_image === null)
										<img src="images/140x140.png" class="avatar" alt="avatar"></td>
									@else
										<img src="{{Lang::get('show_image').'?src='.storage_path().$user->profile_image}}" class="avatar"/>
									@endif    
									<input type="hidden" id="id{{$index+1}}" value="{{$message->_id}}">
									<div>
										<span class="username">{{$user->name}}</span> 
										<span class="time pull-right"> 
											<i class="fa fa-clock-o"></i> 
											{{MessageController::getDate($message->sent_date)}}
										</span>
									</div>
示例#5
0
								<tr>
									<td>{{$key + 1}}</td>
									<td>{{$assignment->description}}</td>
									<td>{{MessageController::getDate($assignment->date_assigned)}}</td>
									<td>{{MessageController::getDate($assignment->deadline, false)}}</td>
									<td>
										<?php 
$user = User::first($assignment->assigned_to);
$user = UserController::getUser($user);
?>
										{{$user->name.' '.$user->last_name}}
									</td>
									<td>
										<?php 
$user = User::first($assignment->assigned_by);
$user = UserController::getUser($user);
?>
										{{$user->name.' '.$user->last_name}}
									</td>
									<td>{{$assignment->score}}</td>
									<td>{{$assignment->rated}}</td>
								</tr>
							@endforeach
						</tbody>
					</table>
				@else
					<p>{{Lang::get('teacher_master.activity')}}</p>
				@endif
			</div>
		</div>
	</div>
示例#6
0
    if (Auth::guest()) {
        return Request::ajax() ? Response::make('Unauthorized', 401) : Redirect::guest('/');
    }
});
Route::filter('university', function () {
    if (!UserController::getUser(Auth::user()) instanceof University) {
        return Request::ajax() ? Response::make('Unauthorized', 401) : View::make('error.403');
    }
});
Route::filter('student', function () {
    if (!UserController::getUser(Auth::user()) instanceof Student) {
        return Request::ajax() ? Response::make('Unauthorized', 401) : View::make('error.403');
    }
});
Route::filter('teacher', function () {
    if (!UserController::getUser(Auth::user()) instanceof Teacher) {
        return Request::ajax() ? Response::make('Unauthorized', 401) : View::make('error.403');
    }
});
Route::filter('auth.basic', function () {
    return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
示例#7
0
 /**
  * Checks whether the recipient isn't the same user
  * 
  * @param  $id MongoId
  * @return Boolean
  */
 public static function searchOrigin($id)
 {
     $message = UserController::getUser(Auth::user())->messages()->find($id);
     if ($message->from !== Auth::id()) {
         return true;
     } else {
         return null;
     }
 }