Fixed Calender & login issues

This commit is contained in:
Sagi Dayan 2015-01-20 11:06:17 +02:00
parent d80c2661a1
commit 3eba59117b
7 changed files with 126 additions and 16 deletions

View file

@ -38,6 +38,7 @@ starter.factory('ApiService', ['$http', '$ionicPopup', '$ionicModal', function (
var password = window.localStorage['password'];
var notes = window.localStorage['notes'] || null;
var grades = window.localStorage['grades'] || null;
var request = "https://mipo.jce.ac.il/index.php/site/login?_dc=1419773997764&formValues=%7B%22form_fields%22%3A%7B%22name%22%3A%22"+username+"%22%2C%22pwd%22%3A%22"+password+"%22%7D%7D";
return $http.get(request).then(function(resp) {
@ -78,9 +79,20 @@ starter.factory('ApiService', ['$http', '$ionicPopup', '$ionicModal', function (
}
}, function(err) {
console.error('[JCE] [INFO] : in update - can\'t get Notes', err);
console.error('[JCE] [INFO] : in update - can\'t get Grades', err);
});
//Get Calendar
//https://mipo.jce.ac.il/index.php/site/timetable
$http.get("https://mipo.jce.ac.il/index.php/site/timetable").then(function(resp) {
console.log('Success', resp);
console.log("[JCE] [INFO] : in update - Got Calendar!");
window.localStorage['calendar'] = JSON.stringify(resp.data);
}, function(err) {
console.error('[JCE] [INFO] : in update - can\'t get Calendar', err);
});
}else{
window.localStorage['loggedIn'] = false;

View file

@ -40,12 +40,12 @@ app.run(function($ionicPlatform) {
}
})
.state('app.playlists', {
url: "/playlists",
.state('app.calendar', {
url: "/calendar",
views: {
'menuContent': {
templateUrl: "templates/playlists.html",
controller: 'PlaylistsCtrl'
templateUrl: "templates/calendar.html",
controller: 'CalendarCtrl'
}
}
})

View file

@ -209,8 +209,8 @@ angular.module('starter.controllers', [])
var localSettingsStr = window.localStorage['Settings'] || null;
if (localSettingsStr === null){
var settings_list = [ {text:"נעל גיליון ציונים", val: false}, //[0]
{text:"הצג מזג אויר", val: false} ]; //[1]
var settings_list = [ {text:"נעל גיליון ציונים", val: false}];//, //[0]
//{text:"הצג מזג אויר", val: false} ]; //[1]
console.log("[JCE] [info]: No settings found!");
}
else{
@ -246,6 +246,8 @@ angular.module('starter.controllers', [])
})
/*=============================================
= JCE News - controller =
=============================================*/
@ -261,6 +263,23 @@ angular.module('starter.controllers', [])
})
/*=============================================
= Calendar - controller =
=============================================*/
.controller('CalendarCtrl', function($scope, $stateParams, $http) {
var calendarStr = window.localStorage['calendar'] || null;
console.log(calendarStr);
if(calendarStr != null)
$scope.calendar = JSON.parse(calendarStr);
})

View file

@ -0,0 +1,84 @@
<ion-view view-title="מערכת שעות">
<ion-content>
<div class="page-content">
<h1><i class="icon ion-calendar"></i> מערכת שעות</h1>
<div class="list">
<div class="item item-divider">
יום ראשון
</div>
<div class="item avatar" ng-repeat="class in calendar | orderBy:['start_time'] | filter:{ day:1 , semester:1} ">
<h2>{{class.time}}</h2>
<h2>{{class.subject}}</h2>
<p>{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}</p>
</div>
<div class="item item-divider">
יום שני
</div>
<div class="item avatar" ng-repeat="class in calendar | orderBy:['start_time'] | filter:{ day:2 , semester:1} ">
<h2>{{class.time}}</h2>
<h2>{{class.subject}}</h2>
<p>{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}</p>
</div>
<div class="item item-divider">
יום שלישי
</div>
<div class="item avatar" ng-repeat="class in calendar | orderBy:['start_time'] | filter:{ day:3 , semester:1} ">
<h2>{{class.time}}</h2>
<h2>{{class.subject}}</h2>
<p>{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}</p>
</div>
<div class="item item-divider">
יום רביעי
</div>
<div class="item avatar" ng-repeat="class in calendar | orderBy:['start_time'] | filter:{ day:4 , semester:1} ">
<h2>{{class.time}}</h2>
<h2>{{class.subject}}</h2>
<p>{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}</p>
</div>
<div class="item item-divider">
יום חמישי
</div>
<div class="item avatar" ng-repeat="class in calendar | orderBy:['start_time'] | filter:{ day:5 , semester:1} ">
<h2>{{class.time}}</h2>
<h2>{{class.subject}}</h2>
<p>{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}</p>
</div>
<div class="item item-divider">
יום שישי
</div>
<div class="item avatar" ng-repeat="class in calendar | orderBy:['start_time'] | filter:{ day:6 , semester:1} ">
<h2>{{class.time}}</h2>
<h2>{{class.subject}}</h2>
<p>{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}</p>
</div>
</div>
</div>
</ion-content>
<!-- <div class="tabs tabs-icon-left">
<a class="tab-item">
<i class="icon ion-snowy"></i>
<img src="https://cdn1.iconfinder.com/data/icons/weather-icons-6/512/snow-512.png" alt="" class="icon">
Home
</a>
<a class="tab-item">
<i class="icon ion-thunderstorm"></i>
Favorites
</a>
<a class="tab-item">
<i class="icon ion-gear-a"></i>
Settings
</a>
</div> -->
</ion-view>

View file

@ -1,6 +1,6 @@
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="bar-stable bar-assertive">
<ion-nav-bar class="bar-stable bar-assertive" style="direction: rtl;">
<ion-nav-back-button>
</ion-nav-back-button>
@ -36,7 +36,7 @@
<ion-item nav-clear menu-close href="#" ng-click="openGrades()" ng-if="isLoggedIn">
<i class="icon ion-clipboard"></i> גיליון ציונים
</ion-item>
<ion-item nav-clear menu-close href="#/app/playlists" ng-if="isLoggedIn">
<ion-item nav-clear menu-close href="#/app/calendar" ng-if="isLoggedIn">
<i class="icon ion-calendar"></i> מערכת שעות
</ion-item>
<ion-item nav-clear menu-close href="#/app/settings" ng-if="isLoggedIn">

View file

@ -1,5 +0,0 @@
<ion-view view-title="Playlist">
<ion-content>
<h1>BETA</h1>
</ion-content>
</ion-view>

View file

@ -33,7 +33,7 @@
</p>
<p>
כל הקוד זמין בgithub <i class="icon ion-social-github"></i> - וכך גם הוראות הבניה והקימפול.
<br>הרישיון של תוכנה זו היא כדלקמן: "עשה מה שבא לך - לא מעניין אותי"
<br>הרישיון של תוכנה זו היא כדלקמן: "עשה מה שבא לך - לא מעניין אותי" - בקיצור תורידו ותשנו כמה שבא לכם. כל עזרה תתקבל בברכה
</p>