license comprobation on student selection

parent 41f52e8f
...@@ -99,6 +99,23 @@ public class StudentFragmentGrid extends Fragment { ...@@ -99,6 +99,23 @@ public class StudentFragmentGrid extends Fragment {
if (this.nameStudents[i].equals(getString(R.string.addStudent))) if (this.nameStudents[i].equals(getString(R.string.addStudent)))
register_student(getActivity().getIntent().getIntExtra("sup_id", 0)); register_student(getActivity().getIntent().getIntExtra("sup_id", 0));
else { else {
// checks if license is valid for this user
if(licenseStudents[i].equals("expired")){
AlertDialog.Builder builder1 = new AlertDialog.Builder(getActivity());
builder1.setMessage(R.string.loginNoLicenseMsg);
builder1.setPositiveButton(
R.string.accept,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert11 = builder1.create();
alert11.show();
return;
}
new_user(i); new_user(i);
download_supervisors(PCBcontext.getPcbdb().getCurrentUser().get_id_stu()); download_supervisors(PCBcontext.getPcbdb().getCurrentUser().get_id_stu());
} }
...@@ -117,7 +134,7 @@ public class StudentFragmentGrid extends Fragment { ...@@ -117,7 +134,7 @@ public class StudentFragmentGrid extends Fragment {
alert.setView(edittext); alert.setView(edittext);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { alert.setPositiveButton(R.string.accept, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {
//What ever you want to do with the value //What ever you want to do with the value
String license = edittext.getText().toString().replaceAll("[^a-zA-Z0-9]", "").toUpperCase(); String license = edittext.getText().toString().replaceAll("[^a-zA-Z0-9]", "").toUpperCase();
...@@ -150,7 +167,7 @@ public class StudentFragmentGrid extends Fragment { ...@@ -150,7 +167,7 @@ public class StudentFragmentGrid extends Fragment {
} }
}); });
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { alert.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {
// what ever you want to do with No option. // what ever you want to do with No option.
} }
......
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