2015-06-16 11:15:59 +00:00
|
|
|
angular.module('SeHub')
|
|
|
|
.controller('homeController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
|
|
|
{
|
2015-06-20 11:58:30 +00:00
|
|
|
$scope.isStudent = false;
|
2015-06-20 11:21:32 +00:00
|
|
|
$scope.addMsg = false;
|
|
|
|
$scope.msgToPost = "";
|
|
|
|
$scope.oldText = "";
|
2015-06-22 10:06:56 +00:00
|
|
|
$scope.messages = [];
|
2015-06-23 16:04:41 +00:00
|
|
|
$scope.msg = {};
|
|
|
|
|
|
|
|
$rootScope.seToken = $cookies['com.sehub.www'];
|
|
|
|
var token = $rootScope.seToken;
|
2015-06-20 11:21:32 +00:00
|
|
|
|
|
|
|
var imagePath = $scope.user.avatar_url;
|
2015-06-23 16:04:41 +00:00
|
|
|
//var campusName = '';
|
|
|
|
// $scope.campusName = '';
|
|
|
|
|
2015-06-20 11:21:32 +00:00
|
|
|
$scope.phones = [
|
|
|
|
{ type: 'Home', number: '(972) 865-82861' },
|
|
|
|
{ type: 'Cell', number: '(972) 5251-32309' },
|
|
|
|
];
|
2015-06-17 20:16:49 +00:00
|
|
|
|
2015-06-23 16:04:41 +00:00
|
|
|
|
|
|
|
|
2015-06-20 11:21:32 +00:00
|
|
|
if($scope.user.isLecturer)
|
|
|
|
{
|
2015-06-20 11:58:30 +00:00
|
|
|
$scope.isStudent = false;
|
2015-06-20 11:21:32 +00:00
|
|
|
console.log("Lecturer Mode!");
|
2015-06-23 16:04:41 +00:00
|
|
|
// console.log($scope.campusName);
|
2015-06-20 11:21:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-06-20 11:58:30 +00:00
|
|
|
$scope.isStudent = true;
|
2015-06-20 11:21:32 +00:00
|
|
|
console.log("Student Mode!");
|
|
|
|
}
|
|
|
|
|
2015-06-24 18:35:21 +00:00
|
|
|
// apiService.getCourseByCampusName(token).success(function(data)
|
2015-06-23 16:04:41 +00:00
|
|
|
// {
|
2015-06-24 18:35:21 +00:00
|
|
|
// console.log("Campus Name is ON! " + token)
|
2015-06-23 16:04:41 +00:00
|
|
|
// $scope.course = data;
|
2015-06-24 18:35:21 +00:00
|
|
|
// }).error(function(err)
|
2015-06-23 16:04:41 +00:00
|
|
|
// {
|
2015-06-24 18:35:21 +00:00
|
|
|
// console.log("Error ===> " + err + " ===> getCourseByCampusName")
|
2015-06-23 16:04:41 +00:00
|
|
|
// });
|
|
|
|
|
|
|
|
|
2015-06-20 11:21:32 +00:00
|
|
|
$scope.addMessageClicked = function()
|
|
|
|
{
|
|
|
|
$scope.addMsg = true; // Reveal the "POST" Button
|
|
|
|
}
|
2015-06-22 10:06:56 +00:00
|
|
|
$scope.postMessageClicked = function() // Posting the message itself
|
2015-06-20 11:21:32 +00:00
|
|
|
{
|
2015-06-27 09:45:44 +00:00
|
|
|
|
|
|
|
|
2015-06-22 10:06:56 +00:00
|
|
|
if($scope.msg.msgToAdd != null)
|
2015-06-20 11:21:32 +00:00
|
|
|
{
|
2015-06-27 09:45:44 +00:00
|
|
|
jsonNewMsg = {
|
|
|
|
'courseName': 'A', // TODO Should be ===> $scope.course.courseName
|
|
|
|
'message': $scope.msg.msgToAdd
|
|
|
|
};
|
|
|
|
|
|
|
|
// console.log("J: " + jsonNewMsg.toString() + "msg: " + $scope.msg.msgToAdd);
|
|
|
|
|
|
|
|
// apiService.createMessage(token, jsonNewMsg).success(function(data)
|
|
|
|
// {
|
|
|
|
// console.log("create Msg!");
|
|
|
|
// }).error(function(err)
|
|
|
|
// {
|
|
|
|
// console.log("Error: " + err);
|
|
|
|
// });
|
|
|
|
|
|
|
|
/*
|
|
|
|
'courseName': 'Advance Math',
|
|
|
|
'message': 'The lecture today is canceled'
|
|
|
|
*/
|
|
|
|
|
2015-06-22 10:06:56 +00:00
|
|
|
console.log($scope.msg.msgToAdd);
|
|
|
|
$scope.messages.push({"text": $scope.msg.msgToAdd});
|
2015-06-20 11:21:32 +00:00
|
|
|
}
|
2015-06-22 10:06:56 +00:00
|
|
|
$scope.msg.msgToAdd = null;
|
2015-06-20 11:21:32 +00:00
|
|
|
}
|
2015-06-16 11:15:59 +00:00
|
|
|
|
2015-06-20 11:21:32 +00:00
|
|
|
$scope.clearAllClicked = function() // Clear Screen from text
|
|
|
|
{
|
2015-06-22 10:06:56 +00:00
|
|
|
$scope.messages = [];
|
2015-06-20 11:21:32 +00:00
|
|
|
}
|
2015-06-17 21:04:36 +00:00
|
|
|
|
2015-06-22 10:06:56 +00:00
|
|
|
$scope.chooseCourseClicked = function()
|
|
|
|
{
|
|
|
|
console.log("choose course Clicked!!");
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.chooseProjectClicked = function()
|
|
|
|
{
|
|
|
|
console.log("choose project Clicked!!");
|
|
|
|
}
|
|
|
|
|
2015-06-20 11:21:32 +00:00
|
|
|
// animation
|
|
|
|
$scope.isEnterd = top.setIsEnterd;
|
2015-06-16 11:15:59 +00:00
|
|
|
}]);
|