Procházet zdrojové kódy

Antes de añadir a rúbricas

Arreglé algunos bugs de planes anuales, de objetivos, de three year plans. Hasta ahora, rubricas funciona. Al igual que hacer assessments.

ahora estoy arreglando my courses reports.
Gabriel Santiago Plaza před 3 roky
rodič
revize
c0fb558bd9

+ 20
- 17
app/controllers/AnnualPlansController.php Zobrazit soubor

43
   public function viewAllPlans($program_id)
43
   public function viewAllPlans($program_id)
44
   {
44
   {
45
     $title = "Annual Plans";
45
     $title = "Annual Plans";
46
-    $annual_plans = DB::select("select * from annual_plans  where program_id ={$program_id} order by id desc");
46
+    $annual_plans = DB::select("select semester_start, semester_end, program_id, annual_plans.id, academic_year from annual_plans, annual_cycle   where annual_plans.annual_cycle_id = annual_cycle.id and program_id ={$program_id} order by id desc");
47
 
47
 
48
 
48
 
49
     return View::make('local.managers.sCoords.view-annual-plans', compact('title', 'program_id', 'annual_plans'));
49
     return View::make('local.managers.sCoords.view-annual-plans', compact('title', 'program_id', 'annual_plans'));
67
     $semester = Input::get('semester');
67
     $semester = Input::get('semester');
68
     $typ_objective = Input::get('typ_objective');
68
     $typ_objective = Input::get('typ_objective');
69
     $transformative = Input::get('transformative');
69
     $transformative = Input::get('transformative');
70
+    $comments = Input::get("comments");
70
     $annual_id = Input::get("annual_id") + 0;
71
     $annual_id = Input::get("annual_id") + 0;
71
     $id = Auth::user()['id'];
72
     $id = Auth::user()['id'];
72
 
73
 
77
       $obj = $typ_objective[$i] + 0;
78
       $obj = $typ_objective[$i] + 0;
78
       $trans = $transformative[$i] + 0;
79
       $trans = $transformative[$i] + 0;
79
       $sem = $semester[$i] + 0;
80
       $sem = $semester[$i] + 0;
80
-
81
+      $comment = $comments[$i];
81
       //if it was continued
82
       //if it was continued
82
       if ($real == 1) $real = 2;
83
       if ($real == 1) $real = 2;
83
       else $real = 1;
84
       else $real = 1;
88
 
89
 
89
       $queryUpdate = DB::select("select * from annual_report_transformative where annual_trans_id = {$annual_trans_id}");
90
       $queryUpdate = DB::select("select * from annual_report_transformative where annual_trans_id = {$annual_trans_id}");
90
       if (!count($queryUpdate)) {
91
       if (!count($queryUpdate)) {
91
-        DB::insert("insert into annual_report_transformative (accomplished, cycle_of_life, semester_used, semester_continue, annual_trans_id, supervised_coordinator_id) values ({$logr},{$real},{$sem},{$cont},{$annual_trans_id}, {$id})");
92
+        DB::insert("insert into annual_report_transformative (accomplished, cycle_of_life, semester_used, semester_continue, annual_trans_id, supervised_coordinator_id, comments) values ({$logr},{$real},{$sem},{$cont},{$annual_trans_id}, {$id}, '{$comment}')");
92
       } else {
93
       } else {
93
-        DB::update("update annual_report_transformative set accomplished = {$logr}, cycle_of_life ={$real}, semester_used ={$sem}, semester_continue={$cont}, supervised_coordinator_id={$id} where annual_trans_id ={$annual_trans_id}");
94
+        DB::update("update annual_report_transformative set accomplished = {$logr}, cycle_of_life ={$real}, semester_used ={$sem}, semester_continue={$cont}, supervised_coordinator_id={$id}, comments = '{$comment}' where annual_trans_id ={$annual_trans_id}");
94
       }
95
       }
95
     }
96
     }
96
     return;
97
     return;
97
   }
98
   }
98
-  public function index()
99
+  /*public function index()
99
   {
100
   {
100
     $title = 'Annual Plans';
101
     $title = 'Annual Plans';
101
     $user = Auth::user();
102
     $user = Auth::user();
120
     }
121
     }
121
 
122
 
122
     return View::make('local.managers.shared.index_annual_plans', compact('title', 'quinquenniums', 'programs', 'current_quinquennium'));
123
     return View::make('local.managers.shared.index_annual_plans', compact('title', 'quinquenniums', 'programs', 'current_quinquennium'));
123
-  }
124
+  }*/
124
   public function adminIndex($school_id)
125
   public function adminIndex($school_id)
125
   {
126
   {
126
     $title = "Annual Plans";
127
     $title = "Annual Plans";
133
   {
134
   {
134
     $title = "Annual Plans";
135
     $title = "Annual Plans";
135
     //$typ_parts = DB::select("select * from typ_parts");
136
     //$typ_parts = DB::select("select * from typ_parts");
136
-    if (!$typ_id) {
137
-      $current_typ = DB::select("select * from three_year_plan where year_start <=" . date('Y') . " and year_end >=" . date('Y'))[0];
138
-    } else {
139
-      $current_typ = DB::select("select * from three_year_plan where id ={$typ_id}")[0];
140
-    }
137
+
138
+    $current_typ = DB::select("select * from three_year_plan where year_start <=" . date('Y') . " and year_end >=" . date('Y'))[0];
139
+
141
 
140
 
142
 
141
 
143
 
142
 
144
     $program = Program::where('id', '=', $program_id)->first();
143
     $program = Program::where('id', '=', $program_id)->first();
145
-    $annual_plans = DB::select("select * from annual_plans where program_id = {$program_id} order by id desc limit 5");
144
+    $annual_plans = DB::select("select academic_year, semester_start, semester_end, program_id, annual_plans.id as id from annual_plans, annual_cycle where program_id = {$program_id} and annual_cycle.id = annual_plans.annual_cycle_id order by annual_plans.id desc ");
146
     Log::info($annual_plans);
145
     Log::info($annual_plans);
147
     $outcomes = array();
146
     $outcomes = array();
148
     $allSemesterOrder = array();
147
     $allSemesterOrder = array();
149
-    foreach ($annual_plans as $an_plan) {
148
+    /*foreach ($annual_plans as $an_plan) {
150
       Log::info($an_plan->id);
149
       Log::info($an_plan->id);
151
       $outcomes[$an_plan->id]["first"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id = {$an_plan->semester_start} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id ={$current_typ->id} ))");
150
       $outcomes[$an_plan->id]["first"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id = {$an_plan->semester_start} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id ={$current_typ->id} ))");
152
       $allSemesterOrder[$an_plan->id]["first"] = DB::select("select * from semesters where id = {$an_plan->semester_start}")[0];
151
       $allSemesterOrder[$an_plan->id]["first"] = DB::select("select * from semesters where id = {$an_plan->semester_start}")[0];
153
       $outcomes[$an_plan->id]["second"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id ={$an_plan->semester_end} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id = {$current_typ->id} ))");
152
       $outcomes[$an_plan->id]["second"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id ={$an_plan->semester_end} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id = {$current_typ->id} ))");
154
       $allSemesterOrder[$an_plan->id]["second"] = DB::select("select * from semesters where id = {$an_plan->semester_end}")[0];
153
       $allSemesterOrder[$an_plan->id]["second"] = DB::select("select * from semesters where id = {$an_plan->semester_end}")[0];
155
-    }
154
+    }*/
156
     $alltyp = DB::select('select * from three_year_plan order by id desc');
155
     $alltyp = DB::select('select * from three_year_plan order by id desc');
157
     $current_typ = $current_typ->id;
156
     $current_typ = $current_typ->id;
158
     return View::make('local.managers.sCoords.annual-plans', compact('title', 'annual_plans', 'current_typ', 'program', 'outcomes', 'allSemesterOrder', 'alltyp'));
157
     return View::make('local.managers.sCoords.annual-plans', compact('title', 'annual_plans', 'current_typ', 'program', 'outcomes', 'allSemesterOrder', 'alltyp'));
161
   public function fetchInfo()
160
   public function fetchInfo()
162
   {
161
   {
163
     Log::info(Input::get('id'));
162
     Log::info(Input::get('id'));
164
-    $an_plan = DB::table("annual_plans")->where('id', '=', Input::get('id'))->first();
163
+    $an_plan = DB::table("annual_plans")
164
+      ->join('annual_cycle', 'annual_cycle.id', '=', 'annual_plans.annual_cycle_id')
165
+      ->where('annual_plans.id', '=', Input::get('id'))
166
+      ->select('annual_plans.id as id', 'program_id', 'academic_year', 'semester_start', 'semester_end')
167
+      ->first();
165
 
168
 
166
     $years = explode('-', $an_plan->academic_year);
169
     $years = explode('-', $an_plan->academic_year);
167
     $current_typ_program = DB::select("select * from typ_program where program_id = {$an_plan->program_id} and three_year_plan_id in (select id from three_year_plan where year_start <= {$years[0]} and year_end>= {$years[1]})")[0];
170
     $current_typ_program = DB::select("select * from typ_program where program_id = {$an_plan->program_id} and three_year_plan_id in (select id from three_year_plan where year_start <= {$years[0]} and year_end>= {$years[1]})")[0];
202
     //  $typ_info['courses_objective'][$objective->id] = DB::select("select * from courses where id in (SELECT course_id from typ_semester_courses where typ_semester_outcome_id in (select id from typ_semester_outcome where semester_id={$semester->id} and outcome_id =? and typ_program_id in (select id from typ_program where program_id = {$program_id})) and id in (select typ_semester_course_id from typ_semester_objectives where objective_id  = {$objective->id}))", array(Input::get('id')));
205
     //  $typ_info['courses_objective'][$objective->id] = DB::select("select * from courses where id in (SELECT course_id from typ_semester_courses where typ_semester_outcome_id in (select id from typ_semester_outcome where semester_id={$semester->id} and outcome_id =? and typ_program_id in (select id from typ_program where program_id = {$program_id})) and id in (select typ_semester_course_id from typ_semester_objectives where objective_id  = {$objective->id}))", array(Input::get('id')));
203
     //  $typ_info['criteria'][$objective->id] = DB::select("select * from criteria where id in (select criterion_id from criterion_objective_outcome where outcome_id = ? and objective_id = {$objective->id})", array(Input::get('id')));
206
     //  $typ_info['criteria'][$objective->id] = DB::select("select * from criteria where id in (select criterion_id from criterion_objective_outcome where outcome_id = ? and objective_id = {$objective->id})", array(Input::get('id')));
204
     //}
207
     //}
205
-    $annual_plan = DB::select("select id from annual_plans where (semester_start = {$semester->id} or semester_end ={$semester->id}) and program_id ={$program_id}")[0];
208
+    $annual_plan = DB::select("select annual_plans.id from annual_plans, annual_cycle where annual_plans.annual_cycle_id = annual_cycle.id and (semester_start = {$semester->id} or semester_end ={$semester->id}) and program_id ={$program_id}")[0];
206
     $typ_info['objectives'] = DB::select("select * from objectives where id in (select objective_id from typ_semester_objectives where typ_semester_outcome_id in(select id from typ_semester_outcome where outcome_id = ? and semester_id = {$semester->id} and typ_program_id in (select id from typ_program where program_id ={$program_id})))", array(Input::get('id')));
209
     $typ_info['objectives'] = DB::select("select * from objectives where id in (select objective_id from typ_semester_objectives where typ_semester_outcome_id in(select id from typ_semester_outcome where outcome_id = ? and semester_id = {$semester->id} and typ_program_id in (select id from typ_program where program_id ={$program_id})))", array(Input::get('id')));
207
     $typ_info['transformative_actions'] = DB::select("select * from transformative_actions where by_professor =0 and is_custom=0");
210
     $typ_info['transformative_actions'] = DB::select("select * from transformative_actions where by_professor =0 and is_custom=0");
208
     foreach ($typ_info['objectives'] as $objective) {
211
     foreach ($typ_info['objectives'] as $objective) {
311
     $an_id = Input::get('id');
314
     $an_id = Input::get('id');
312
     $program_id = Input::get('program_id');
315
     $program_id = Input::get('program_id');
313
 
316
 
314
-    $an_semesters = DB::select("select semester_start, semester_end, program_id from annual_plans where id ={$an_id} and program_id ={$program_id}")[0];
317
+    $an_semesters = DB::select("select semester_start, semester_end, program_id from annual_plans, annual_cycle where annual_plans.annual_cycle_id = annual_cycle.id and annual_plans.id ={$an_id} and program_id ={$program_id}")[0];
315
 
318
 
316
     $annual_plan['first']['outcomes'] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id = {$an_semesters->semester_start} and typ_program_id in(select id from typ_program where program_id ={$an_semesters->program_id}))");
319
     $annual_plan['first']['outcomes'] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id = {$an_semesters->semester_start} and typ_program_id in(select id from typ_program where program_id ={$an_semesters->program_id}))");
317
 
320
 

+ 33
- 42
app/controllers/AuthController.php Zobrazit soubor

1
 <?php
1
 <?php
2
 
2
 
3
-class AuthController extends \BaseController {
3
+class AuthController extends \BaseController
4
+{
4
 
5
 
5
 	/**
6
 	/**
6
 	 * Display a listing of the resource.
7
 	 * Display a listing of the resource.
10
 	 */
11
 	 */
11
 	public function showLogin()
12
 	public function showLogin()
12
 	{
13
 	{
13
-		$title ="Online Learning Assessment System";
14
+		$title = "Online Learning Assessment System";
14
 		return View::make('global.login', compact('title'));
15
 		return View::make('global.login', compact('title'));
15
 	}
16
 	}
16
 
17
 
20
 		$validator = Validator::make(
21
 		$validator = Validator::make(
21
 			Input::all(),
22
 			Input::all(),
22
 			array(
23
 			array(
23
-				'email'=>'required|email',
24
-    			'password'=>'required|min:4|max:16'
24
+				'email' => 'required|email',
25
+				'password' => 'required|min:4|max:16'
25
 			)
26
 			)
26
 		);
27
 		);
27
 
28
 
28
-		if(!$validator->fails())
29
-		{
30
-//			TODO: Remove this for production environment
31
-//             if (App::environment('local', 'staging')) {
32
-// 			    return $this->processLogin();
33
-//             }
29
+		if (!$validator->fails()) {
30
+			//			TODO: Remove this for production environment
31
+			if (App::environment('local', 'staging')) {
32
+				return $this->processLogin();
33
+			}
34
 			try {
34
 			try {
35
 				// User input
35
 				// User input
36
 				$username = str_replace('@upr.edu', '', Input::get('email'));
36
 				$username = str_replace('@upr.edu', '', Input::get('email'));
51
 				$result = radius_send_request($radius);
51
 				$result = radius_send_request($radius);
52
 
52
 
53
 				switch ($result) {
53
 				switch ($result) {
54
-					// Credentials are correct
54
+						// Credentials are correct
55
 					case RADIUS_ACCESS_ACCEPT:
55
 					case RADIUS_ACCESS_ACCEPT:
56
 
56
 
57
 						return $this->processLogin();
57
 						return $this->processLogin();
58
 						break;
58
 						break;
59
 					case RADIUS_ACCESS_REJECT:
59
 					case RADIUS_ACCESS_REJECT:
60
 						// If email is a workshop email,
60
 						// If email is a workshop email,
61
-						if(Input::get('email') == 'taller1@upr.edu' && Input::get('password') == 'o34eAvaluo'){
61
+						if (Input::get('email') == 'taller1@upr.edu' && Input::get('password') == 'o34eAvaluo') {
62
 							return $this->processLogin();
62
 							return $this->processLogin();
63
 						}
63
 						}
64
 
64
 
67
 						Session::flash('message', 'Incorrect email/password combination.');
67
 						Session::flash('message', 'Incorrect email/password combination.');
68
 						return Redirect::action('AuthController@showLogin');
68
 						return Redirect::action('AuthController@showLogin');
69
 						break;
69
 						break;
70
-					// Throw exception in case of any other error
70
+						// Throw exception in case of any other error
71
 					default:
71
 					default:
72
 						throw new Exception("-", 1);
72
 						throw new Exception("-", 1);
73
 						break;
73
 						break;
74
 				}
74
 				}
75
-
76
-			}
77
-			catch(Exception $e){
75
+			} catch (Exception $e) {
78
 				// Tell user access is denied and return to login page.
76
 				// Tell user access is denied and return to login page.
79
 				Session::flash('status', 'danger');
77
 				Session::flash('status', 'danger');
80
 				Session::flash('message', 'An error occurred while connecting to the authentication service. Please try again later. If the problem persists, contact the help desk at x. 80400 or the administrators at oeae.uprrp.edu.');
78
 				Session::flash('message', 'An error occurred while connecting to the authentication service. Please try again later. If the problem persists, contact the help desk at x. 80400 or the administrators at oeae.uprrp.edu.');
81
 				return Redirect::action('AuthController@showLogin');
79
 				return Redirect::action('AuthController@showLogin');
82
 			}
80
 			}
83
 			return Redirect::route('login');
81
 			return Redirect::route('login');
84
-		}
85
-		else
86
-		{
87
-            /** Prepare error message */
88
-            $message = '<ul>';
82
+		} else {
83
+			/** Prepare error message */
84
+			$message = '<ul>';
89
 
85
 
90
-            foreach ($validator->messages()->all('<li>:message</li>') as $validationError)
91
-            {
92
-                $message.=$validationError;
93
-            }
86
+			foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
87
+				$message .= $validationError;
88
+			}
94
 
89
 
95
-            $message.='</ul>';
90
+			$message .= '</ul>';
96
 
91
 
97
 			Session::flash('status', 'danger');
92
 			Session::flash('status', 'danger');
98
 			Session::flash('message', $message);
93
 			Session::flash('message', $message);
100
 		}
95
 		}
101
 	}
96
 	}
102
 
97
 
103
-	private function processLogin(){
98
+	private function processLogin()
99
+	{
104
 		// Get user record in OLAS database, if it exists
100
 		// Get user record in OLAS database, if it exists
105
 		$user = User::where('email', Input::get('email'))->first();
101
 		$user = User::where('email', Input::get('email'))->first();
106
 
102
 
107
 		// If user exists in the database AND is authorized
103
 		// If user exists in the database AND is authorized
108
-		if($user and $user->has_access)
109
-		{
104
+		if ($user and $user->has_access) {
110
 			// Log in user and direct to main page
105
 			// Log in user and direct to main page
111
 			Auth::login($user);
106
 			Auth::login($user);
112
 
107
 
113
 			// Get last visible AND running term;
108
 			// Get last visible AND running term;
114
-			$semester = Semester::
115
-				where('is_visible', 1)
109
+			$semester = Semester::where('is_visible', 1)
116
 				->where('start', '<=', date('Y-m-d H:i:s'))
110
 				->where('start', '<=', date('Y-m-d H:i:s'))
117
 				->orderBy('start', 'DESC')
111
 				->orderBy('start', 'DESC')
118
 				->first();
112
 				->first();
125
 			$semesters_info = array();
119
 			$semesters_info = array();
126
 
120
 
127
 			$semesters_ids[] = $semester->id;
121
 			$semesters_ids[] = $semester->id;
128
-			$semesters_info[] = $semester->name.' ('.$semester->code.')';
122
+			$semesters_info[] = $semester->name . ' (' . $semester->code . ')';
129
 
123
 
130
 			// Put semesters information arrays into Session
124
 			// Put semesters information arrays into Session
131
 			Session::forget('semesters_ids');
125
 			Session::forget('semesters_ids');
136
 
130
 
137
 			// Record last login
131
 			// Record last login
138
 			User::where('id', Auth::user()->id)
132
 			User::where('id', Auth::user()->id)
139
-				->update(array(
140
-					'last_login' => DB::raw('NOW()')
141
-				)
142
-			);
133
+				->update(
134
+					array(
135
+						'last_login' => DB::raw('NOW()')
136
+					)
137
+				);
143
 
138
 
144
-			if(!Auth::user()->office_phone){
139
+			if (!Auth::user()->office_phone) {
145
 				return Redirect::action('UsersController@edit');
140
 				return Redirect::action('UsersController@edit');
146
 			}
141
 			}
147
 
142
 
163
 					return Redirect::intended('professor');
158
 					return Redirect::intended('professor');
164
 					break;
159
 					break;
165
 			}
160
 			}
166
-		}
167
-		else
168
-		{
161
+		} else {
169
 			// Tell user access is denied and return to login page.
162
 			// Tell user access is denied and return to login page.
170
 			Session::flash('status', 'danger');
163
 			Session::flash('status', 'danger');
171
 			Session::flash('message', 'You are not an authorized user. You may request access by contacting oeae.uprrp.edu.');
164
 			Session::flash('message', 'You are not an authorized user. You may request access by contacting oeae.uprrp.edu.');
178
 		Auth::logout();
171
 		Auth::logout();
179
 		Session::flush();
172
 		Session::flush();
180
 		return Redirect::action('AuthController@showLogin');
173
 		return Redirect::action('AuthController@showLogin');
181
-
182
 	}
174
 	}
183
-
184
 }
175
 }

+ 16
- 1
app/controllers/CriteriaController.php Zobrazit soubor

54
     {
54
     {
55
         $json_to_send = array();
55
         $json_to_send = array();
56
         $json_to_send['criterion'] = DB::table('criteria')->where('id', '=', Input::get('id'))->first();
56
         $json_to_send['criterion'] = DB::table('criteria')->where('id', '=', Input::get('id'))->first();
57
+        $outcomeIDS = DB::table('criterion_objective_outcome')->where('criterion_id', '=', $json_to_send['criterion']->id)->lists('outcome_id');
58
+        Log::info($outcomeIDS);
59
+        $json_to_send['outcomes'] = DB::table('outcomes')->whereIn('id', $outcomeIDS)->get();
60
+        $outcomeStr = '';
61
+        if (count($json_to_send['outcomes']) == 1) {
62
+            $outcomeStr .= $json_to_send['outcomes'][0]->name;
63
+        } else {
64
+            foreach ($json_to_send['outcomes'] as $index => $outcome) {
65
+
66
+                $outcomeStr .= $outcome->name . ', ';
67
+            }
68
+            $outcomeStr = rtrim($outcomeStr, ',');
69
+        }
70
+        $json_to_send['outcomes'] = $outcomeStr;
57
         $num_scales = Input::get('numberOfScale');
71
         $num_scales = Input::get('numberOfScale');
58
         $criterionID = Input::get('id');
72
         $criterionID = Input::get('id');
73
+
59
         $json_to_send['scales'] = DB::select("select * from scales, template_criterion_scale where template_criterion_scale.template_criterion_id in (select id from template_criterion where template_criterion.template_id in (SELECT id FROM templates where num_scales = {$num_scales}) and template_criterion.criterion_id = {$criterionID}) and scales.id = template_criterion_scale.scale_id GROUP BY position order by position");
74
         $json_to_send['scales'] = DB::select("select * from scales, template_criterion_scale where template_criterion_scale.template_criterion_id in (select id from template_criterion where template_criterion.template_id in (SELECT id FROM templates where num_scales = {$num_scales}) and template_criterion.criterion_id = {$criterionID}) and scales.id = template_criterion_scale.scale_id GROUP BY position order by position");
60
-        Log::info("select * from scales, template_criterion_scale where template_criterion_scale.template_criterion_id in (select id from template_criterion where template_criterion.template_id in (SELECT id FROM templates where num_scales = {$num_scales}) and template_criterion.criterion_id = {$criterionID}) and scales.id = template_criterion_scale.scale_id GROUP BY position order by position");
75
+        $json_to_send['crit_info'] = DB::select("select copyright, notes from template_criterion where id in (select template_criterion_id from scales, template_criterion_scale where template_criterion_scale.template_criterion_id in (select id from template_criterion where template_criterion.template_id in (SELECT id FROM templates where num_scales = {$num_scales}) and template_criterion.criterion_id = {$criterionID}) and scales.id = template_criterion_scale.scale_id  GROUP BY position  order by position) limit 1");
61
 
76
 
62
 
77
 
63
 
78
 

+ 2
- 2
app/controllers/Objective2Controller.php Zobrazit soubor

320
 		$userProgram = DB::select("select program_user.program_id from program_user where user_id = {$userProgram}");
320
 		$userProgram = DB::select("select program_user.program_id from program_user where user_id = {$userProgram}");
321
 
321
 
322
 		$title = "Objective";
322
 		$title = "Objective";
323
-		$outcomes = Outcome::orderBy('name', 'ASC')->lists('name', 'id');
323
+		$outcomes = Outcome::where('deactivation_date', '=', null)->orderBy('name', 'ASC')->lists('name', 'id');
324
 
324
 
325
 		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
325
 		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
326
 
326
 
337
 		$userSchool = Auth::user()['school_id'];
337
 		$userSchool = Auth::user()['school_id'];
338
 		Log::info($userSchool);
338
 		Log::info($userSchool);
339
 		$title = "Objective";
339
 		$title = "Objective";
340
-		$outcomes = Outcome::orderBy('name', 'ASC')->lists('name', 'id');
340
+		$outcomes = Outcome::where('deactivation_date', '=', null)->orderBy('name', 'ASC')->lists('name', 'id');
341
 
341
 
342
 		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
342
 		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
343
 		$programs = Program::where("school_id", "=", $userSchool)->orderBy('name', 'ASC')->get();
343
 		$programs = Program::where("school_id", "=", $userSchool)->orderBy('name', 'ASC')->get();

+ 4
- 4
app/controllers/RubricsController.php Zobrazit soubor

34
         $criteria = Criterion::orderBy('name', 'ASC')->get();
34
         $criteria = Criterion::orderBy('name', 'ASC')->get();
35
         $rubric = $activity->rubric;
35
         $rubric = $activity->rubric;
36
         Log::info($rubric);
36
         Log::info($rubric);
37
-        Log::info($activity->rubric_id);
38
-        Log::info($activity->rubric[0]->id);
37
+
38
+
39
 
39
 
40
         return View::make('local.professors.rubrics', compact('title', 'templates', 'outcomes', 'criteria', 'rubrics', 'activity', 'rubric'));
40
         return View::make('local.professors.rubrics', compact('title', 'templates', 'outcomes', 'criteria', 'rubrics', 'activity', 'rubric'));
41
     }
41
     }
94
         $rubric->user_id = Auth::id();
94
         $rubric->user_id = Auth::id();
95
         $rubric->num_scales = count($scales[0]);
95
         $rubric->num_scales = count($scales[0]);
96
         $rubric->max_score = Input::get('max_score');
96
         $rubric->max_score = Input::get('max_score');
97
-        $defaultWeight = round(100 / $rubric->num_scales, 2);
97
+        $defaultWeight = round(100 / count($criteria), 2);
98
 
98
 
99
         if ($rubric->save()) {
99
         if ($rubric->save()) {
100
 
100
 
182
 
182
 
183
         $rubric->num_scales = count($scales[0]);
183
         $rubric->num_scales = count($scales[0]);
184
         $rubric->max_score = Input::get('max_score');
184
         $rubric->max_score = Input::get('max_score');
185
-        $defaultWeight = round(100 / $rubric->num_scales, 2);
185
+        $defaultWeight = round(100 / count($criteria), 2);
186
 
186
 
187
 
187
 
188
         DB::beginTransaction();
188
         DB::beginTransaction();

+ 28
- 3
app/controllers/TemplatesController.php Zobrazit soubor

139
 		$criteria = Input::get('criteria');
139
 		$criteria = Input::get('criteria');
140
 
140
 
141
 		$max_score = Input::get('max_score');
141
 		$max_score = Input::get('max_score');
142
+		$copyright = Input::get('copyright');
143
+		$notes = Input::get('notes');
142
 		Log::info($scales);
144
 		Log::info($scales);
143
 		Log::info($criteria);
145
 		Log::info($criteria);
146
+		Log::info($copyright);
147
+		Log::info($notes);
144
 
148
 
145
 
149
 
146
 		$template->num_scales = count($scales[0]);
150
 		$template->num_scales = count($scales[0]);
149
 		if ($template->save()) {
153
 		if ($template->save()) {
150
 			$templateId = $template->id;
154
 			$templateId = $template->id;
151
 			foreach ($criteria as $index => $criterion_id) {
155
 			foreach ($criteria as $index => $criterion_id) {
152
-				DB::insert("insert into template_criterion (`template_id`,`criterion_id`) values ({$templateId},{$criterion_id})");
156
+				$note = $notes[$index];
157
+				$copy = $copyright[$index];
158
+				if ($copy == "Empty") $copy = NULL;
159
+				if ($note == "Empty") $note = NULL;
160
+
161
+				DB::insert("insert into template_criterion (`template_id`,`criterion_id`, `copyright`, `notes`) values ({$templateId},{$criterion_id}, '{$copy}', '{$note}')");
153
 				$template_criterion_id = DB::table('template_criterion')->where('template_id', '=', $templateId)
162
 				$template_criterion_id = DB::table('template_criterion')->where('template_id', '=', $templateId)
154
 					->where('criterion_id', '=', $criterion_id)->first();
163
 					->where('criterion_id', '=', $criterion_id)->first();
155
 
164
 
200
 				->where('template_criterion_scale.template_criterion_id', '=', $temp_crit->id)
209
 				->where('template_criterion_scale.template_criterion_id', '=', $temp_crit->id)
201
 				->orderBy('position', 'ASC')
210
 				->orderBy('position', 'ASC')
202
 				->get();
211
 				->get();
212
+			$outcomeID = DB::table('criterion_objective_outcome')->where('criterion_id', '=', $temp_crit->criterion_id)
213
+				->lists('outcome_id');
214
+			$outcomes = DB::table('outcomes')->whereIn('id', $outcomeID)->get();
215
+			$outcomeStr = '';
216
+			foreach ($outcomes as $key => $outcome) {
217
+				$outcomeStr .= $outcome->name . ', ';
218
+			}
219
+			$outcomeStr = rtrim($outcomeStr, ',');
220
+			$temp_crit->outcomes = $outcomeStr;
203
 		}
221
 		}
222
+
204
 		Log::info($template_info);
223
 		Log::info($template_info);
205
 
224
 
206
 		return json_encode($template_info);
225
 		return json_encode($template_info);
254
 		$criteria = Input::get('criteria');
273
 		$criteria = Input::get('criteria');
255
 
274
 
256
 		$max_score = Input::get('max_score');
275
 		$max_score = Input::get('max_score');
276
+		$copyright = Input::get('copyright');
277
+		$notes = Input::get('notes');
257
 		Log::info($scales);
278
 		Log::info($scales);
258
 		Log::info(Input::all());
279
 		Log::info(Input::all());
280
+
259
 		$template->num_scales = count($scales[0]);
281
 		$template->num_scales = count($scales[0]);
260
 		$template->max_score = $max_score;
282
 		$template->max_score = $max_score;
261
 		//$division = $max_score / count($scales[0]);
283
 		//$division = $max_score / count($scales[0]);
264
 			$templateId = $template->id;
286
 			$templateId = $template->id;
265
 			DB::delete("delete from template_criterion where template_id ={$template->id}");
287
 			DB::delete("delete from template_criterion where template_id ={$template->id}");
266
 			foreach ($criteria as $index => $criterion_id) {
288
 			foreach ($criteria as $index => $criterion_id) {
267
-
268
-				DB::insert("insert into template_criterion (`template_id`,`criterion_id`) values ({$templateId},{$criterion_id})");
289
+				$copy = $copyright[$index];
290
+				$note = $notes[$index];
291
+				if ($copy == 'Empty') $copy = NULL;
292
+				if ($note == 'Empty') $note = NULL;
293
+				DB::insert("insert into template_criterion (`template_id`,`criterion_id`, `copyright`, `notes`) values ({$templateId},{$criterion_id}, '{$copy}', '{$note}')");
269
 				$template_criterion_id = DB::table('template_criterion')->where('template_id', '=', $templateId)
294
 				$template_criterion_id = DB::table('template_criterion')->where('template_id', '=', $templateId)
270
 					->where('criterion_id', '=', $criterion_id)->first();
295
 					->where('criterion_id', '=', $criterion_id)->first();
271
 				DB::delete("delete from template_criterion_scale where template_criterion_id ={$template_criterion_id->id}");
296
 				DB::delete("delete from template_criterion_scale where template_criterion_id ={$template_criterion_id->id}");

+ 51
- 3
app/controllers/ThreeYearPlanController.php Zobrazit soubor

5
 class ThreeYearPlanController extends \BaseController
5
 class ThreeYearPlanController extends \BaseController
6
 {
6
 {
7
 
7
 
8
+  public function create()
9
+  {
10
+    try {
11
+      $yearStart = Input::get('years') + 0;
12
+      $yearEnd = $yearStart + 3;
13
+      DB::insert("insert into three_year_plan (`year_start`, `year_end`) values ({$yearStart}, {$yearEnd})");
14
+      DB::commit();
15
+      $typ = DB::table('three_year_plan')->where('year_start', '=', $yearStart)
16
+        ->where('year_end', '=', $yearEnd)
17
+        ->first();
18
+      for ($i = $yearStart; $i < $yearEnd; $i++) {
19
+        $string = 'First Semester ' . $i . '-' . ($i + 1);
20
+        $string2 = 'Second Semester ' . $i . '-' . ($i + 1);
21
+
22
+        $Firstsemester = DB::table('semesters')->where('name', '=', $string)->first();
23
+        $secondSemester = DB::table('semesters')->where('name', '=', $string2)->first();
24
+        Log::info($Firstsemester->id);
25
+        Log::info($secondSemester->id);
26
+        Log::info($typ->id);
27
+        DB::insert("insert into typ_semesters (typ_id, semester_id) values ({$typ->id}, {$Firstsemester->id}), ({$typ->id}, {$secondSemester->id})");
28
+      }
29
+
30
+      Session::flash('status', 'success');
31
+      Session::flash('message', '<p> Cycle created.</p>');
32
+      return Redirect::to('three-years-plan');
33
+    } catch (Exception $e) {
34
+      Session::flash('status', 'danger');
35
+      Session::flash('message', "<p>Could not create cycle</p>");
36
+      Log::info($e);
37
+      return Redirect::to('three-years-plan');;
38
+    }
39
+  }
8
   // load the Three year Plan page
40
   // load the Three year Plan page
9
   public function threeYearsReport()
41
   public function threeYearsReport()
10
   {
42
   {
11
     $user_id = Auth::user()->id;
43
     $user_id = Auth::user()->id;
12
 
44
 
45
+    $last_year = DB::table('three_year_plan')->select('year_start')
46
+      ->orderBy('year_start', 'desc')->first();
47
+    if (!$last_year) {
48
+      $last_year = date('Y');
49
+    } else {
50
+      $last_year = $last_year->year_start;
51
+    }
52
+
13
     // el ID de los semestres que el usuario tiene seleccionado.
53
     // el ID de los semestres que el usuario tiene seleccionado.
14
     $semesters_ids = Session::get('semesters_ids');
54
     $semesters_ids = Session::get('semesters_ids');
15
     // buscar informacion de los semestres seleccionados
55
     // buscar informacion de los semestres seleccionados
27
     $program_id = $program_id[0]->program_id;
67
     $program_id = $program_id[0]->program_id;
28
     $outcomes = DB::table('outcomes')->where('deactivation_date', '=', null)->orderBy('name', 'ASC')->get();
68
     $outcomes = DB::table('outcomes')->where('deactivation_date', '=', null)->orderBy('name', 'ASC')->get();
29
     // se annadio la nueva variable
69
     // se annadio la nueva variable
30
-    return View::make('global.view-three-year-plan', compact('title', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
70
+    return View::make('global.view-three-year-plan', compact('title', 'last_year', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
31
   }
71
   }
32
 
72
 
33
 
73
 
540
       if (count($firstSemester) && count($secondSemester)) {
580
       if (count($firstSemester) && count($secondSemester)) {
541
         Log::info($firstSemester);
581
         Log::info($firstSemester);
542
         Log::info($secondSemester);
582
         Log::info($secondSemester);
543
-        $query = DB::select("select * from annual_plans where semester_start ={$firstSemester[0]->id} and semester_end ={$secondSemester[0]->id} and program_id = {$program_id}");
583
+        $query = DB::select("select * from annual_cycle where semester_start ={$firstSemester[0]->id} and semester_end ={$secondSemester[0]->id} ");
544
         if (!count($query)) {
584
         if (!count($query)) {
545
-          DB::insert("insert into annual_plans (academic_year, semester_start, semester_end, program_id) values ('{$yearStart}-{$yearStartPlusOne}', {$firstSemester[0]->id}, {$secondSemester[0]->id}, {$program_id})");
585
+          DB::insert("insert into annual_cycle (academic_year, semester_start, semester_end) values ('{$yearStart}-{$yearStartPlusOne}', {$firstSemester[0]->id}, {$secondSemester[0]->id})");
586
+        }
587
+        $an_cycle = DB::table('annual_cycle')->where('semester_start', '=', $firstSemester[0]->id)
588
+          ->where('semester_end', '=', $secondSemester[0]->id)
589
+          ->first();
590
+        $query = DB::table('annual_plans')->where("annual_cycle_id", '=', $an_cycle->id)
591
+          ->where('program_id', '=', $program_id)->first();
592
+        if (!$query) {
593
+          DB::insert("insert into annual_plans (`annual_cycle_id`, `program_id`) values ({$an_cycle->id}, {$program_id})");
546
         }
594
         }
547
       }
595
       }
548
       $count++;
596
       $count++;

+ 4
- 1
app/routes.php Zobrazit soubor

166
     /**
166
     /**
167
      * Shared Routes
167
      * Shared Routes
168
      */
168
      */
169
-
169
+    Route::post('createThreeYearCycle', array(
170
+        'as' => 'createThreeYearCycle',
171
+        'uses' => 'ThreeYearPlanController@create'
172
+    ));
170
     // Fetch all criteria associated to an outcome
173
     // Fetch all criteria associated to an outcome
171
     Route::post('fetchInfo', array(
174
     Route::post('fetchInfo', array(
172
         'as' => 'fetchInfo',
175
         'as' => 'fetchInfo',

+ 34
- 0
app/views/global/view-three-year-plan.blade.php Zobrazit soubor

99
           <li data-cycle-id="{{$typ->id}}" class="list-group-item">{{$typ->year_start}}-{{$typ->year_end}}</li>
99
           <li data-cycle-id="{{$typ->id}}" class="list-group-item">{{$typ->year_start}}-{{$typ->year_end}}</li>
100
         @endforeach
100
         @endforeach
101
       </div>
101
       </div>
102
+      <br>
103
+      <div>
104
+        <button type="button" class="btn btn-secondary" id = "three_year_button" data-toggle="modal" data-target="#three_year">Create Three Year Cycle</button>
105
+
106
+<!-- Modal -->
107
+<div id="three_year" class="modal fade" role="dialog">
108
+  <div class="modal-dialog">
109
+
110
+    <!-- Modal content-->
111
+    <div class="modal-content">
112
+      <div class="modal-header">
113
+        <button type="button" class="close" data-dismiss="modal">&times;</button>
114
+        <h4 class="modal-title">Create New Cycle</h4>
115
+      </div>
116
+      <div class="modal-body">
117
+        {{ Form::open(array('action' => 'ThreeYearPlanController@create' )) }}
118
+        <p>Select a new cycle. You cannot choose a cycle that has been created before</p>
119
+        <select name = 'years' class="form-control selectpicker">
120
+          @for ($i = (int)$last_year; $i<2100; $i++)
121
+          
122
+          <option value='{{$i}}' >{{$i}} - {{$i+3}} </option>
123
+          @endfor
124
+      </select>
125
+      </div>
126
+      <div class="modal-footer">
127
+        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
128
+        {{ Form::submit('Create Cycle', array('class' => 'btn btn-primary')) }}
129
+        {{ Form::close() }}
130
+      </div>
131
+    </div>
132
+
133
+  </div>
134
+</div>
135
+      </div>
102
     </div>
136
     </div>
103
 
137
 
104
     <div class="col-md-9">
138
     <div class="col-md-9">

+ 1
- 1
app/views/local/managers/pCoords/objectives.blade.php Zobrazit soubor

114
                     <div id='assocOutcomeGroup'>
114
                     <div id='assocOutcomeGroup'>
115
                         <label>Associated Outcome</label>
115
                         <label>Associated Outcome</label>
116
 
116
 
117
-                        {{ Form::select('assoc_outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome0']) }}
117
+                        {{ Form::select("assoc_outcome[]", $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome0']) }}
118
 
118
 
119
                     </div>
119
                     </div>
120
                 </div>
120
                 </div>

+ 4
- 1
app/views/local/managers/sCoords/view-annual-plans.blade.php Zobrazit soubor

88
       semester = [];
88
       semester = [];
89
       typ_objective = [];
89
       typ_objective = [];
90
       transformative =[];
90
       transformative =[];
91
+      comments = [];
91
       for(i = 0; i<counter;i++){
92
       for(i = 0; i<counter;i++){
92
         realized.push($('input[name="seHizo'+i+'"]:checked').val());
93
         realized.push($('input[name="seHizo'+i+'"]:checked').val());
93
         logrado.push( $('input[name="logro'+i+'"]:checked').val());
94
         logrado.push( $('input[name="logro'+i+'"]:checked').val());
95
         typ_objective.push($('input[name="objective_'+i+'"]').val());
96
         typ_objective.push($('input[name="objective_'+i+'"]').val());
96
         semester.push($('input[name="what_semester_'+i+'"]').val());
97
         semester.push($('input[name="what_semester_'+i+'"]').val());
97
         transformative.push($('input[name="transformative_'+i+'"]').val());
98
         transformative.push($('input[name="transformative_'+i+'"]').val());
99
+        comments.push($('textarea[name="comment2'+i+'"]').val())
98
       }
100
       }
99
         
101
         
100
 
102
 
106
         semester:semester,
108
         semester:semester,
107
         typ_objective: typ_objective,
109
         typ_objective: typ_objective,
108
         transformative:transformative, 
110
         transformative:transformative, 
109
-        annual_id: an_id}
111
+        annual_id: an_id,
112
+        comments: comments}
110
         )
113
         )
111
     }
114
     }
112
 
115
 

+ 151
- 31
app/views/local/managers/shared/rubrics.blade.php Zobrazit soubor

280
 
280
 
281
         <div id="copyright-info">
281
         <div id="copyright-info">
282
             <hr>
282
             <hr>
283
-            <p class="small"><strong>Copyright Information</strong></p>
283
+            <p class="small"><strong>Outcomes Evaluated</strong></p>
284
             <ul id="copyright-list" class="list-unstyled small">
284
             <ul id="copyright-list" class="list-unstyled small">
285
             </ul>
285
             </ul>
286
             <hr>
286
             <hr>
404
         function(data)
404
         function(data)
405
         {
405
         {
406
             // Append the fetched data
406
             // Append the fetched data
407
-            var str ='<tr data-criterion-id="'+data.criterion.id+'" data-criterion-copyright="'+data.criterion.copyright+'" data-criterion-notes="'+data.criterion.notes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
407
+            copyright = null;
408
+            notes = null;
409
+            if(data.crit_info.length){
410
+                copyright = data.crit_info[0].copyright;
411
+                notes = data.crit_info[0].notes;
412
+            }
413
+            
414
+            
415
+            var str ='<tr data-criterion-id="'+data.criterion.id+'" data-criterion-copyright="'+copyright+'" data-criterion-notes="'+notes+'" data-outcomes = "'+data.outcomes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
408
 
416
 
409
             var subcriteria = '';
417
             var subcriteria = '';
410
             if(data.criterion.subcriteria){
418
             if(data.criterion.subcriteria){
418
 
426
 
419
             }
427
             }
420
 
428
 
421
-            if(data.criterion.notes)
429
+            if(notes)
422
             {
430
             {
423
-                str+='<span><em data-toggle="tooltip" data-placement="top" title="'+data.criterion.notes+'">'+data.criterion.name+'</em></span><sup></sup>'+subcriteria+'</td>';
431
+                str+='<span><em data-toggle="tooltip" data-placement="top" title="'+notes+'">'+name+'</em></span><sup></sup>'+subcriteria+'</td>';
424
             }
432
             }
425
             else
433
             else
426
             {
434
             {
438
                 str+='<td class="editable" data-type="textarea"></td>';
446
                 str+='<td class="editable" data-type="textarea"></td>';
439
             }
447
             }
440
         }
448
         }
449
+        if(copyright== null) copyright= '';
450
+        if(notes == null)notes ='';
451
+        str += '<td class = "editable nullable" data-type = "textarea">'+copyright+'</td>';
452
+        str+= '<td class = "editable nullable" data-type = "textarea">'+notes+'</td>';
441
 
453
 
442
             str +='<th><span class="glyphicon glyphicon-remove icon-btn" aria-hidden="true"></span></th></tr>';
454
             str +='<th><span class="glyphicon glyphicon-remove icon-btn" aria-hidden="true"></span></th></tr>';
443
 
455
 
444
             $('table tbody').append(str);
456
             $('table tbody').append(str);
445
 
457
 
446
             // Build copyright list
458
             // Build copyright list
447
-            buildCopyrightList();
459
+            buildOutcomeList();
448
 
460
 
449
             // Enable X-Edtable on this new row
461
             // Enable X-Edtable on this new row
450
             $('.editable').editable({
462
             $('.editable').editable({
494
 }
506
 }
495
 
507
 
496
 // Build list from copyright info in rubric
508
 // Build list from copyright info in rubric
497
-function buildCopyrightList()
509
+function buildOutcomeList()
498
 {
510
 {
499
     // Empty the copyright list
511
     // Empty the copyright list
500
     $('#copyright-list').empty();
512
     $('#copyright-list').empty();
503
     {
515
     {
504
         var criterion = $(this);
516
         var criterion = $(this);
505
         // If there's copyright info
517
         // If there's copyright info
506
-        if(criterion.data('criterion-copyright')!=null)
518
+        if(criterion.data('outcomes')!=null){
519
+            var outcomes = criterion.data('outcomes');
520
+            if($('#copyright-list li').length>0)
521
+            {
522
+                var found = false;
523
+                $('#copyright-list li').each(function()
524
+                {
525
+                    // If found, give the string its number
526
+                    if(outcomes==$(this).find('span').text())
527
+                    {
528
+
529
+                        copyrightNumber = Number.parseInt($(this).find('sup').text());
530
+
531
+                        console.log('a: '+copyrightNumber);
532
+
533
+                        criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
534
+                        found =true;
535
+
536
+                        //to break
537
+                        return false;
538
+                    }
539
+                });
540
+
541
+                // Otherwise, give it the next number and append a new item to the
542
+                // list
543
+                if(!found)
544
+                {
545
+                    var copyrightNumber = $('#copyright-list li').length+1;
546
+
547
+                    console.log('b: '+copyrightNumber);
548
+                    console.log(criterion.children('td:nth-child(2)').find('sup').length);
549
+
550
+                    criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
551
+                    $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+outcomes+'<span></li>');
552
+                }
553
+            }
554
+            else
555
+            {
556
+                criterion.children('td:nth-child(2)').find('sup').text('1');
557
+                $('#copyright-list').append('<li><sup>1 </sup><span>'+outcomes+'<span></li>');
558
+            }
559
+        }
560
+    });
561
+
562
+    if($('#copyright-info li').length>0)
563
+    {
564
+    $('#copyright-info').show();
565
+    }
566
+    else
567
+    {
568
+       $('#copyright-info').hide();
569
+}}
570
+    /*        if(criterion.data('criterion-copyright')!=null)
507
         {
571
         {
508
             var copyright = criterion.data('criterion-copyright');
572
             var copyright = criterion.data('criterion-copyright');
509
 
573
 
550
                 $('#copyright-list').append('<li><sup>1 </sup><span>'+copyright+'<span></li>');
614
                 $('#copyright-list').append('<li><sup>1 </sup><span>'+copyright+'<span></li>');
551
             }
615
             }
552
         }
616
         }
553
-    });
554
-
555
-    if($('#copyright-info li').length>0)
556
-    {
557
-        $('#copyright-info').show();
558
-    }
559
-    else
560
-    {
561
-        $('#copyright-info').hide();
562
-    }
563
-}
617
+        });
564
 
618
 
619
+        if($('#copyright-info li').length>0)
620
+        {
621
+            $('#copyright-info').show();
622
+        }
623
+        else
624
+        {
625
+            $('#copyright-info').hide();
626
+        }
627
+        }
628
+    */
565
 function refreshSelects()
629
 function refreshSelects()
566
 {
630
 {
567
     $('#select-template').selectpicker('refresh');
631
     $('#select-template').selectpicker('refresh');
664
             // Set the contents of the rubric
728
             // Set the contents of the rubric
665
             var temp_criterion = data.criterion;
729
             var temp_criterion = data.criterion;
666
             for(temp_c in temp_criterion){
730
             for(temp_c in temp_criterion){
667
-                var str = '<tr data-criterion-id="'+temp_criterion[temp_c].criterion_id+'" data-criterion-copyright="'+temp_criterion[temp_c].copyright+'" data-criterion-notes="'+temp_criterion[temp_c].notes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
731
+                var str = '<tr data-criterion-id="'+temp_criterion[temp_c].criterion_id+'" data-criterion-copyright="'+temp_criterion[temp_c].copyright+'" data-criterion-notes="'+temp_criterion[temp_c].notes+'" data-outcomes = "'+temp_criterion[temp_c].outcomes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
668
                 current_criterion = temp_criterion[temp_c]
732
                 current_criterion = temp_criterion[temp_c]
669
                 var subcriteria ='';
733
                 var subcriteria ='';
670
                 if(current_criterion.subcriteria){
734
                 if(current_criterion.subcriteria){
692
                     str+='<td class="editable" data-id-value ="'+scale.scale_id+'" data-type="textarea">'+scale.description+'</td>';
756
                     str+='<td class="editable" data-id-value ="'+scale.scale_id+'" data-type="textarea">'+scale.description+'</td>';
693
 
757
 
694
                 }
758
                 }
695
-
759
+                copyright = temp_criterion[temp_c].copyright;
760
+                notes = temp_criterion[temp_c].notes;
761
+                if(copyright == null){
762
+                    copyright = '';
763
+                }
764
+                if(notes==null) notes ='';
765
+                str += '<td class = "editable" data-type = "textarea">'+copyright+'</td>';
766
+                str+= '<td class = "editable" data-type = "textarea">'+notes+'</td>';
696
                 str+='<th><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></th></tr>';
767
                 str+='<th><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></th></tr>';
697
 
768
 
698
     $('table tbody').append(str);
769
     $('table tbody').append(str);
699
 
770
 
700
-    buildCopyrightList();
771
+    
772
+
773
+    
701
 
774
 
702
                 // Enable X-Edtable on this new row
775
                 // Enable X-Edtable on this new row
703
                 $('.editable').editable({
776
                 $('.editable').editable({
752
                 $('table tbody').append(str);
825
                 $('table tbody').append(str);
753
 
826
 
754
                 // Build copyright list
827
                 // Build copyright list
755
-                buildCopyrightList();
828
+                buildOutcomeList();
756
 
829
 
757
                 // Enable X-Edtable on this new row
830
                 // Enable X-Edtable on this new row
758
                 $('.editable').editable({
831
                 $('.editable').editable({
777
             });
850
             });
778
 
851
 
779
             // Build Copyright List
852
             // Build Copyright List
780
-            buildCopyrightList();
853
+            buildOutcomeList();
854
+
855
+            var selected = $('#select-template').find(':selected');
856
+        var programs = {{ json_encode(Auth::user()->programs->lists('id')) }};
857
+        
858
+        var template_program = selected.data('template-program-id');
859
+      
860
+        
861
+
862
+        if(
863
+            {{ Auth::user()->role }}==1
864
+            || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1)
865
+            || ({{ Auth::user()->role }}==3
866
+                && programs.includes(selected.data('template-program-id'))
867
+
868
+                && selected.data('admin')!=1
869
+            )
870
+        )
871
+        {
872
+            $('#button-confirm-delete-rubric').prop('disabled', false);
873
+            $('#button-confirm-update-rubric').prop('disabled', false);
874
+        }
875
+        else
876
+        {
877
+            // Disable update and edit
878
+            $('#button-confirm-delete-rubric').prop('disabled', true);
879
+            $('#button-confirm-update-rubric').prop('disabled', true);
880
+        }
881
+
882
+        // Enable print button
883
+        $('#button-print-rubric').prop('disabled', false);
884
+
781
         }, 
885
         }, 
782
         'json',
886
         'json',
783
     );
887
     );
865
 
969
 
866
         //If user is admin, or the templates id matches user's, or the template
970
         //If user is admin, or the templates id matches user's, or the template
867
         // id's school matches user, allow editing
971
         // id's school matches user, allow editing
868
-        var selected = $('#select-template').find(':selected');
972
+        /*var selected = $('#select-template').find(':selected');
869
         var programs = {{ json_encode(Auth::user()->programs->lists('id')) }};
973
         var programs = {{ json_encode(Auth::user()->programs->lists('id')) }};
974
+        
975
+        var template_program = selected.data('template-program-id');
976
+        var dataset = selected.dataSet.templateProgramId;
977
+        
978
+
870
         if(
979
         if(
871
             {{ Auth::user()->role }}==1
980
             {{ Auth::user()->role }}==1
872
             || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1)
981
             || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1)
873
             || ({{ Auth::user()->role }}==3
982
             || ({{ Auth::user()->role }}==3
874
-                && $.inArray(selected.data('template-program-id'), programs)
983
+                && programs.includes(selected.data('template-program-id'))
984
+
875
                 && selected.data('admin')!=1
985
                 && selected.data('admin')!=1
876
             )
986
             )
877
         )
987
         )
888
 
998
 
889
         // Enable print button
999
         // Enable print button
890
         $('#button-print-rubric').prop('disabled', false);
1000
         $('#button-print-rubric').prop('disabled', false);
891
-
1001
+*/
892
     }
1002
     }
893
 
1003
 
894
 });
1004
 });
923
                 counter++;
1033
                 counter++;
924
             }
1034
             }
925
             }
1035
             }
926
-            newScaleHeaders += '<th></th>';
1036
+            newScaleHeaders += '<th>Copyright</th><th>Notes</th><th></th>';
927
             
1037
             
928
             $("#criterion-header").html(newScaleHeaders);
1038
             $("#criterion-header").html(newScaleHeaders);
929
             $('#allCriteria').html(' ');
1039
             $('#allCriteria').html(' ');
995
 
1105
 
996
     $('#allCriteria').children('td').each(function()
1106
     $('#allCriteria').children('td').each(function()
997
     {
1107
     {
998
-        if ($(this).text() == "" || $(this).text() == "Empty")
1108
+        if (($(this).text() == "" || $(this).text() == "Empty") && !($(this).hasClass('nullable')) )
999
         {
1109
         {
1000
             emptyFields=true;
1110
             emptyFields=true;
1001
         }
1111
         }
1034
     scalesMaxArray =[];
1144
     scalesMaxArray =[];
1035
     scalesMinArray =[];
1145
     scalesMinArray =[];
1036
     scales_id =[];
1146
     scales_id =[];
1147
+    copyright = [];
1148
+    notes = [];
1037
 
1149
 
1038
     
1150
     
1039
     var amount_of_scales =parseInt($('#number_of_scales').find(':selected').val())+2;
1151
     var amount_of_scales =parseInt($('#number_of_scales').find(':selected').val())+2;
1047
                each_criterion_scale.push($(this.children[i]).text());
1159
                each_criterion_scale.push($(this.children[i]).text());
1048
 
1160
 
1049
             }
1161
             }
1162
+            copyright.push($(this.children[i]).text());
1163
+            i+=1;
1164
+            notes.push($(this.children[i]).text());
1165
+
1050
             scales.push(each_criterion_scale);
1166
             scales.push(each_criterion_scale);
1051
 
1167
 
1052
             
1168
             
1078
                 is_visible: $('input[name=is_visible]:checked').val(),
1194
                 is_visible: $('input[name=is_visible]:checked').val(),
1079
                 criteria : criteria,
1195
                 criteria : criteria,
1080
                 scales: scales,
1196
                 scales: scales,
1081
-                max_score : max
1197
+                max_score : max,
1198
+                copyright : copyright,
1199
+                notes :notes
1082
 
1200
 
1083
             },
1201
             },
1084
             function(data)
1202
             function(data)
1107
                 is_visible: $('input[name=is_visible]:checked').val(),
1225
                 is_visible: $('input[name=is_visible]:checked').val(),
1108
                 criteria : criteria,
1226
                 criteria : criteria,
1109
                 scales: scales,
1227
                 scales: scales,
1110
-                max_score : max
1228
+                max_score : max,
1229
+                copyright :copyright,
1230
+                notes:notes
1111
             },
1231
             },
1112
             function(data)
1232
             function(data)
1113
             {
1233
             {
1147
         $('#rubric-container').hide();
1267
         $('#rubric-container').hide();
1148
     }
1268
     }
1149
 
1269
 
1150
-    buildCopyrightList();
1270
+    buildOutcomeList();
1151
 });
1271
 });
1152
 
1272
 
1153
 // When print button is clicked, redirect to print page
1273
 // When print button is clicked, redirect to print page

+ 8
- 0
app/views/local/professors/assessment.blade.php Zobrazit soubor

538
 // Events
538
 // Events
539
 // --------------------------------------------------------------------------
539
 // --------------------------------------------------------------------------
540
 
540
 
541
+
542
+$('input[name="weight[]"]').on('change', function(e){
543
+    $('.student-row').each(function(index)
544
+    {
545
+        percentagePerStudent($(this));
546
+    
547
+    });
548
+});
541
 // When any score changes, calculate percentages
549
 // When any score changes, calculate percentages
542
 $('select').on('change', function(e)
550
 $('select').on('change', function(e)
543
 {
551
 {

+ 76
- 61
app/views/local/professors/rubrics.blade.php Zobrazit soubor

93
     </table>
93
     </table>
94
 
94
 
95
     <div id="copyright-info">
95
     <div id="copyright-info">
96
+      
97
+
96
       <hr>
98
       <hr>
97
-      <p class="small"><strong>Copyright Information</strong></p>
99
+      <p class="small"><strong>Outcome Information</strong></p>
98
       <ul id="copyright-list" class="list-unstyled small">
100
       <ul id="copyright-list" class="list-unstyled small">
99
       </ul>
101
       </ul>
100
       <hr>
102
       <hr>
101
     </div>
103
     </div>
104
+    
102
 
105
 
103
     @if($activity->outcomes_attempted!=NULL)
106
     @if($activity->outcomes_attempted!=NULL)
104
     <div class="alert alert-info" role="alert">This activity has already been assessed. Changing the rubric will delete all saved scores.</div>
107
     <div class="alert alert-info" role="alert">This activity has already been assessed. Changing the rubric will delete all saved scores.</div>
141
                 counter++;
144
                 counter++;
142
             }
145
             }
143
             }
146
             }
144
-            newScaleHeaders += '';
147
+            newScaleHeaders += '<th>Copyright</th><th>Notes</th>';
145
             
148
             
146
             $("#criterion-header").html(newScaleHeaders);
149
             $("#criterion-header").html(newScaleHeaders);
147
             
150
             
211
 }
214
 }
212
 
215
 
213
 // Build list from copyright info in rubric
216
 // Build list from copyright info in rubric
214
-function buildCopyrightList()
217
+function buildOutcomeList()
215
 {
218
 {
216
-  // Empty the copyright list
217
-  $('#copyright-list').empty();
219
+    // Empty the copyright list
220
+    $('#copyright-list').empty();
218
 
221
 
219
-  $('tbody tr').each(function( index )
220
-  {
221
-    var criterion = $(this);
222
-    // If there's copyright info
223
-    if(criterion.data('criterion-copyright')!=null)
222
+    $('tbody tr').each(function( index )
224
     {
223
     {
225
-      var copyright = criterion.data('criterion-copyright');
224
+        var criterion = $(this);
225
+        // If there's copyright info
226
+        if(criterion.data('outcomes')!=null){
227
+            var outcomes = criterion.data('outcomes');
228
+            if($('#copyright-list li').length>0)
229
+            {
230
+                var found = false;
231
+                $('#copyright-list li').each(function()
232
+                {
233
+                    // If found, give the string its number
234
+                    if(outcomes==$(this).find('span').text())
235
+                    {
226
 
236
 
227
-      // If there is anything in the copyright list
228
-      if($('#copyright-list li').length>0)
229
-      {
230
-        // Check copyright list for the same copyright text
231
-        var found = false;
232
-        $('#copyright-list li').each(function()
233
-        {
234
-          // If found, give the string its number
235
-          if(copyright==$(this).find('span').text())
236
-          {
237
-            copyrightNumber = Number.parseInt($(this).find('sup').text());
238
-            criterion.children('td:nth-child(1)').find('sup').text(copyrightNumber);
239
-            found =true;
240
-
241
-            //to break
242
-            return false;
243
-          }
244
-        });
245
-
246
-        // Otherwise, give it the next number and append a new item to the
247
-        // list
248
-        if(!found)
249
-        {
250
-          var copyrightNumber = $('#copyright-list li').length+1;
251
-          criterion.children('td:nth-child(1)').find('sup').text(copyrightNumber);
252
-          $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+copyright+'<span></li>');
237
+                        copyrightNumber = Number.parseInt($(this).find('sup').text());
238
+
239
+                        console.log('a: '+copyrightNumber);
240
+
241
+                        criterion.children('td:nth-child(1)').find('sup').text(copyrightNumber);
242
+                        found =true;
243
+
244
+                        //to break
245
+                        return false;
246
+                    }
247
+                });
248
+
249
+                // Otherwise, give it the next number and append a new item to the
250
+                // list
251
+                if(!found)
252
+                {
253
+                    var copyrightNumber = $('#copyright-list li').length+1;
254
+
255
+                    console.log('b: '+copyrightNumber);
256
+                    console.log(criterion.children('td:nth-child(1)').find('sup').length);
257
+
258
+                    criterion.children('td:nth-child(1)').find('sup').text(copyrightNumber);
259
+                    $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+outcomes+'<span></li>');
260
+                }
261
+            }
262
+            else
263
+            {
264
+                criterion.children('td:nth-child(1)').find('sup').text('1');
265
+                $('#copyright-list').append('<li><sup>1 </sup><span>'+outcomes+'<span></li>');
266
+            }
253
         }
267
         }
254
-      }
255
-      // Otherwise, give it number 1 and append it
256
-      else
257
-      {
258
-        criterion.children('td:nth-child(1)').find('sup').text('1');
259
-        $('#copyright-list').append('<li><sup>1 </sup><span>'+copyright+'<span></li>');
260
-      }
261
-    }
262
-  });
268
+    });
263
 
269
 
264
-  if($('#copyright-info li').length>0)
265
-  {
270
+    if($('#copyright-info li').length>0)
271
+    {
266
     $('#copyright-info').show();
272
     $('#copyright-info').show();
267
-  }
268
-  else
269
-  {
270
-    $('#copyright-info').hide();
271
-  }
272
-}
273
+    }
274
+    else
275
+    {
276
+       $('#copyright-info').hide();
277
+}}
273
 
278
 
274
 // Load a template
279
 // Load a template
275
 
280
 
298
             // Set the contents of the rubric
303
             // Set the contents of the rubric
299
             var temp_criterion = data.criterion;
304
             var temp_criterion = data.criterion;
300
             for(temp_c in temp_criterion){
305
             for(temp_c in temp_criterion){
301
-                var str = '<tr data-criterion-id="'+temp_criterion[temp_c].criterion_id+'" data-criterion-copyright="'+temp_criterion[temp_c].copyright+'" data-criterion-notes="'+temp_criterion[temp_c].notes+'">';
306
+                var str = '<tr data-criterion-id="'+temp_criterion[temp_c].criterion_id+'" data-criterion-copyright="'+temp_criterion[temp_c].copyright+'" data-criterion-notes="'+temp_criterion[temp_c].notes+'" data-outcomes = "'+temp_criterion[temp_c].outcomes+'">';
302
                 current_criterion = temp_criterion[temp_c]
307
                 current_criterion = temp_criterion[temp_c]
303
                 var subcriteria ='';
308
                 var subcriteria ='';
304
                 if(current_criterion.subcriteria){
309
                 if(current_criterion.subcriteria){
326
                     str+='<td data-scale-id ="'+scale.id+'">'+scale.description+'</td>';
331
                     str+='<td data-scale-id ="'+scale.id+'">'+scale.description+'</td>';
327
 
332
 
328
                 }
333
                 }
329
-
334
+                copyright = temp_criterion[temp_c].copyright;
335
+                notes = temp_criterion[temp_c].notes;
336
+                if(copyright == null){
337
+                    copyright = '';
338
+                }
339
+                if(notes==null) notes ='';
340
+                str+= '<td >'+copyright+'</td>';
341
+                str+= '<td>'+notes+'</td>';
330
                 str+='</tr>';
342
                 str+='</tr>';
331
 
343
 
332
     $('table tbody').append(str);
344
     $('table tbody').append(str);
333
 
345
 
334
-    buildCopyrightList();
346
+    buildOutcomeList();
335
 
347
 
336
                 
348
                 
337
 
349
 
382
                 $('table tbody').append(str);
394
                 $('table tbody').append(str);
383
 
395
 
384
                 // Build copyright list
396
                 // Build copyright list
385
-                buildCopyrightList();
397
+                buildOutcomeList();
386
 
398
 
387
                 // Enable X-Edtable on this new row
399
                 // Enable X-Edtable on this new row
388
                 $('.editable').editable({
400
                 $('.editable').editable({
400
           
412
           
401
 
413
 
402
             // Build Copyright List
414
             // Build Copyright List
403
-            buildCopyrightList();
415
+            buildOutcomeList();
404
         }, 
416
         }, 
405
         'json',
417
         'json',
406
     );
418
     );
461
       });
473
       });
462
 
474
 
463
       // Build Copyright List
475
       // Build Copyright List
464
-      buildCopyrightList();
476
+      buildOutcomeList();
465
     }
477
     }
466
   );
478
   );
467
 }
479
 }
500
     criteria.push($(this).data('criterion-id'));
512
     criteria.push($(this).data('criterion-id'));
501
     each_criterion_scale =[];
513
     each_criterion_scale =[];
502
     $(this).children('td').each(function(index){
514
     $(this).children('td').each(function(index){
503
-      if(index!=0)
515
+      if(index!=0 )
504
       each_criterion_scale.push($(this).text());
516
       each_criterion_scale.push($(this).text());
517
+      
505
     })
518
     })
519
+each_criterion_scale.pop();
520
+each_criterion_scale.pop();
506
     scales.push(each_criterion_scale);
521
     scales.push(each_criterion_scale);
507
     /*
522
     /*
508
       criterionObject.id = $(this).data('criterion-id');
523
       criterionObject.id = $(this).data('criterion-id');