Commit 05bb6abf by Jose Antonio

Merge remote-tracking branch 'origin/develop' into develop

parents 140dd793 8c4294f9
...@@ -192,9 +192,9 @@ public class Device extends SQLiteOpenHelper { ...@@ -192,9 +192,9 @@ public class Device extends SQLiteOpenHelper {
* @return * @return
* @throws JSONException * @throws JSONException
*/ */
public Boolean isSupervisorOnLocal(int id_sup) throws JSONException{ public Boolean isSupervisorOnLocal(int id_sup,int id_stu) throws JSONException{
SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(" SELECT * FROM supervisor WHERE id = " + id_sup, null); Cursor cursor = db.rawQuery(" SELECT * FROM users_detail WHERE id_stu = " + id_stu+ " AND id_sup ="+id_sup, null);
if(cursor.moveToFirst()) if(cursor.moveToFirst())
return true; return true;
cursor.close(); cursor.close();
...@@ -213,7 +213,7 @@ public class Device extends SQLiteOpenHelper { ...@@ -213,7 +213,7 @@ public class Device extends SQLiteOpenHelper {
Hashtable<String, String> users = new Hashtable<>(3); Hashtable<String, String> users = new Hashtable<>(3);
Cursor cursor = db.rawQuery(" SELECT email_sup, name_sup, surname_sup,id_sup FROM users_detail WHERE id_stu = "+id_stu ,null); Cursor cursor = db.rawQuery(" SELECT email_sup, name_sup, surname_sup,id_sup FROM users_detail WHERE id_stu = "+id_stu ,null);
while (cursor.moveToNext()) while (cursor.moveToNext())
users.put(cursor.getString(0), cursor.getString(1)+", "+cursor.getString(2)+";"+cursor.getInt(3)); users.put(cursor.getString(0), cursor.getString(1) + ", " + cursor.getString(2) + ";" + cursor.getInt(3));
cursor.close(); cursor.close();
//db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ //db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ
return users; return users;
......
...@@ -243,7 +243,7 @@ public class StudentFragmentGrid extends Fragment{ ...@@ -243,7 +243,7 @@ public class StudentFragmentGrid extends Fragment{
try { try {
supervisor = supervisors.getJSONObject(i); supervisor = supervisors.getJSONObject(i);
idSupervisoresJSON.add(supervisor.getString("email")); idSupervisoresJSON.add(supervisor.getString("email"));
if(!PCBcontext.getDevice().isSupervisorOnLocal((int) supervisor.get("id"))) {//Para comprobar si ya existe en local if(!PCBcontext.getDevice().isSupervisorOnLocal((int) supervisor.get("id"),stu_id)) {//Para comprobar si ya existe en local
User currentUser = PCBcontext.getPcbdb().getCurrentUser(); User currentUser = PCBcontext.getPcbdb().getCurrentUser();
PCBcontext.getDevice().insertUser(new User(stu_id, currentUser.get_nickname_stu(), currentUser.get_pwd_stu() PCBcontext.getDevice().insertUser(new User(stu_id, currentUser.get_nickname_stu(), currentUser.get_pwd_stu()
, currentUser.get_name_stu(),currentUser.get_surname_stu(),currentUser.get_active_scene(), currentUser.get_url_img_stu() , currentUser.get_name_stu(),currentUser.get_surname_stu(),currentUser.get_active_scene(), currentUser.get_url_img_stu()
......
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_below="@+id/loginTopbarLayout" android:layout_below="@+id/loginTopbarLayout"
android:background="#eeeeee"
android:paddingTop="10dp"> android:paddingTop="10dp">
<fragment <fragment
......
...@@ -8,17 +8,17 @@ ...@@ -8,17 +8,17 @@
tools:context="com.yottacode.pictogram.tabletlibrary.gui.login.SplashScreenActivity" > tools:context="com.yottacode.pictogram.tabletlibrary.gui.login.SplashScreenActivity" >
<ImageView <ImageView
android:id="@+id/imageView2"
android:layout_width="400px" android:layout_width="400px"
android:layout_height="120px" android:layout_height="120px"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="44dp"
android:contentDescription="@string/app_name" android:contentDescription="@string/app_name"
android:orientation="vertical" android:orientation="vertical"
android:src="@drawable/yottacode_logo"
android:scaleX="0.5" android:scaleX="0.5"
android:scaleY="0.5" android:scaleY="0.5"
android:id="@+id/imageView2" android:src="@drawable/yottacode_logo" />
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="44dp" />
<ImageView <ImageView
android:layout_width="200px" android:layout_width="200px"
......
...@@ -3,5 +3,6 @@ ...@@ -3,5 +3,6 @@
android:id="@+id/loginStudentGridView" android:id="@+id/loginStudentGridView"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#eeeeee"
android:numColumns="5" android:numColumns="5"
android:stackFromBottom="false" /> android:stackFromBottom="false" />
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<ListView <ListView
android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@android:id/list" /> android:background="#eeeeee" />
</LinearLayout> </LinearLayout>
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<ListView <ListView
android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@android:id/list" /> android:background="#eeeeee" />
</LinearLayout> </LinearLayout>
...@@ -161,7 +161,7 @@ module.exports = { ...@@ -161,7 +161,7 @@ module.exports = {
student.supervision = 0; // requester is admin of the office student.supervision = 0; // requester is admin of the office
else if (stu_sup && !req.token.office) else if (stu_sup && !req.token.office)
student.supervision = 1; // requester is tutor of the studend student.supervision = 1; // requester is tutor of the studend
else if (stu_sup && req.token.office && student.office == req.token.office.id) else if (stu_sup && req.token.office)
student.supervision = 2; // requester is supervisor of student student.supervision = 2; // requester is supervisor of student
else if (req.token.isStudent && req.token.id == student.id) else if (req.token.isStudent && req.token.id == student.id)
student.supervision = 3 // requester is the student himself student.supervision = 3 // requester is the student himself
......
...@@ -41,7 +41,7 @@ function SignInCtrl($scope, ...@@ -41,7 +41,7 @@ function SignInCtrl($scope,
email: '', email: '',
logoUrl: '' logoUrl: ''
}, },
office_idx: -1 id_off: -1
}; };
}; };
...@@ -92,7 +92,12 @@ function SignInCtrl($scope, ...@@ -92,7 +92,12 @@ function SignInCtrl($scope,
return; return;
} }
if ($scope.formdata.role == 'therapist_nooffice' && $scope.formdata.office.country == '00') { if (($scope.formdata.role == 'therapist_office' || $scope.formdata.role == 'tutor_office') && $scope.formdata.id_off == -1) {
ngToast.danger({ content: $translate.instant('select_office') });
return;
}
if ($scope.formdata.role == 'therapist_nooffice' && $scope.formdata.office.country == '00') {
ngToast.danger({ content: $translate.instant('country_office_requested') }); ngToast.danger({ content: $translate.instant('country_office_requested') });
return; return;
} }
...@@ -112,10 +117,8 @@ function SignInCtrl($scope, ...@@ -112,10 +117,8 @@ function SignInCtrl($scope,
$scope.showdialog = true; $scope.showdialog = true;
if ($scope.formdata.office_idx != -1) { if ($scope.formdata.id_off == -1)
$scope.formdata.id_off = $scope.offices[$scope.formdata.office_idx].id; delete $scope.formdata.id_off;
delete $scope.formdata.office_idx;
}
if ($scope.formdata.role === 'tutor_nooffice') { if ($scope.formdata.role === 'tutor_nooffice') {
$scope.formdata.office.name = 'no_office'; $scope.formdata.office.name = 'no_office';
......
...@@ -223,9 +223,9 @@ ...@@ -223,9 +223,9 @@
<div class="form-group" id="office_selection"> <div class="form-group" id="office_selection">
<legend translate>office_center</legend> <legend translate>office_center</legend>
<select class="form-control" ng-model="formdata.office_idx" ng-required="formdata.role == 'therapist_office' || formdata.role == 'tutor_office'"> <select class="form-control" ng-model="formdata.id_off" ng-required="formdata.role == 'therapist_office' || formdata.role == 'tutor_office'">
<option selected disabled hidden value="-1">{{ 'select_office' | translate }}</option> <option selected disabled hidden value="-1">{{ 'select_office' | translate }}</option>
<option ng-repeat="office in offices | orderBy: 'name' track by $index" ng-value="$index"> {{ office.name }} </option> <option ng-repeat="office in offices | orderBy: 'name' track by office.id" ng-value="office.id"> {{ office.name }} </option>
</select> </select>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment