ソースを参照

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.
コミット
c0fb558bd9

+ 20
- 17
app/controllers/AnnualPlansController.php ファイルの表示

@@ -43,7 +43,7 @@ class AnnualPlansController extends \BaseController
43 43
   public function viewAllPlans($program_id)
44 44
   {
45 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 49
     return View::make('local.managers.sCoords.view-annual-plans', compact('title', 'program_id', 'annual_plans'));
@@ -67,6 +67,7 @@ class AnnualPlansController extends \BaseController
67 67
     $semester = Input::get('semester');
68 68
     $typ_objective = Input::get('typ_objective');
69 69
     $transformative = Input::get('transformative');
70
+    $comments = Input::get("comments");
70 71
     $annual_id = Input::get("annual_id") + 0;
71 72
     $id = Auth::user()['id'];
72 73
 
@@ -77,7 +78,7 @@ class AnnualPlansController extends \BaseController
77 78
       $obj = $typ_objective[$i] + 0;
78 79
       $trans = $transformative[$i] + 0;
79 80
       $sem = $semester[$i] + 0;
80
-
81
+      $comment = $comments[$i];
81 82
       //if it was continued
82 83
       if ($real == 1) $real = 2;
83 84
       else $real = 1;
@@ -88,14 +89,14 @@ class AnnualPlansController extends \BaseController
88 89
 
89 90
       $queryUpdate = DB::select("select * from annual_report_transformative where annual_trans_id = {$annual_trans_id}");
90 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 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 97
     return;
97 98
   }
98
-  public function index()
99
+  /*public function index()
99 100
   {
100 101
     $title = 'Annual Plans';
101 102
     $user = Auth::user();
@@ -120,7 +121,7 @@ class AnnualPlansController extends \BaseController
120 121
     }
121 122
 
122 123
     return View::make('local.managers.shared.index_annual_plans', compact('title', 'quinquenniums', 'programs', 'current_quinquennium'));
123
-  }
124
+  }*/
124 125
   public function adminIndex($school_id)
125 126
   {
126 127
     $title = "Annual Plans";
@@ -133,26 +134,24 @@ class AnnualPlansController extends \BaseController
133 134
   {
134 135
     $title = "Annual Plans";
135 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 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 145
     Log::info($annual_plans);
147 146
     $outcomes = array();
148 147
     $allSemesterOrder = array();
149
-    foreach ($annual_plans as $an_plan) {
148
+    /*foreach ($annual_plans as $an_plan) {
150 149
       Log::info($an_plan->id);
151 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 151
       $allSemesterOrder[$an_plan->id]["first"] = DB::select("select * from semesters where id = {$an_plan->semester_start}")[0];
153 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 153
       $allSemesterOrder[$an_plan->id]["second"] = DB::select("select * from semesters where id = {$an_plan->semester_end}")[0];
155
-    }
154
+    }*/
156 155
     $alltyp = DB::select('select * from three_year_plan order by id desc');
157 156
     $current_typ = $current_typ->id;
158 157
     return View::make('local.managers.sCoords.annual-plans', compact('title', 'annual_plans', 'current_typ', 'program', 'outcomes', 'allSemesterOrder', 'alltyp'));
@@ -161,7 +160,11 @@ class AnnualPlansController extends \BaseController
161 160
   public function fetchInfo()
162 161
   {
163 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 169
     $years = explode('-', $an_plan->academic_year);
167 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,7 +205,7 @@ class AnnualPlansController extends \BaseController
202 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 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 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 210
     $typ_info['transformative_actions'] = DB::select("select * from transformative_actions where by_professor =0 and is_custom=0");
208 211
     foreach ($typ_info['objectives'] as $objective) {
@@ -311,7 +314,7 @@ class AnnualPlansController extends \BaseController
311 314
     $an_id = Input::get('id');
312 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 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 ファイルの表示

@@ -1,6 +1,7 @@
1 1
 <?php
2 2
 
3
-class AuthController extends \BaseController {
3
+class AuthController extends \BaseController
4
+{
4 5
 
5 6
 	/**
6 7
 	 * Display a listing of the resource.
@@ -10,7 +11,7 @@ class AuthController extends \BaseController {
10 11
 	 */
11 12
 	public function showLogin()
12 13
 	{
13
-		$title ="Online Learning Assessment System";
14
+		$title = "Online Learning Assessment System";
14 15
 		return View::make('global.login', compact('title'));
15 16
 	}
16 17
 
@@ -20,17 +21,16 @@ class AuthController extends \BaseController {
20 21
 		$validator = Validator::make(
21 22
 			Input::all(),
22 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 34
 			try {
35 35
 				// User input
36 36
 				$username = str_replace('@upr.edu', '', Input::get('email'));
@@ -51,14 +51,14 @@ class AuthController extends \BaseController {
51 51
 				$result = radius_send_request($radius);
52 52
 
53 53
 				switch ($result) {
54
-					// Credentials are correct
54
+						// Credentials are correct
55 55
 					case RADIUS_ACCESS_ACCEPT:
56 56
 
57 57
 						return $this->processLogin();
58 58
 						break;
59 59
 					case RADIUS_ACCESS_REJECT:
60 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 62
 							return $this->processLogin();
63 63
 						}
64 64
 
@@ -67,32 +67,27 @@ class AuthController extends \BaseController {
67 67
 						Session::flash('message', 'Incorrect email/password combination.');
68 68
 						return Redirect::action('AuthController@showLogin');
69 69
 						break;
70
-					// Throw exception in case of any other error
70
+						// Throw exception in case of any other error
71 71
 					default:
72 72
 						throw new Exception("-", 1);
73 73
 						break;
74 74
 				}
75
-
76
-			}
77
-			catch(Exception $e){
75
+			} catch (Exception $e) {
78 76
 				// Tell user access is denied and return to login page.
79 77
 				Session::flash('status', 'danger');
80 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 79
 				return Redirect::action('AuthController@showLogin');
82 80
 			}
83 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 92
 			Session::flash('status', 'danger');
98 93
 			Session::flash('message', $message);
@@ -100,19 +95,18 @@ class AuthController extends \BaseController {
100 95
 		}
101 96
 	}
102 97
 
103
-	private function processLogin(){
98
+	private function processLogin()
99
+	{
104 100
 		// Get user record in OLAS database, if it exists
105 101
 		$user = User::where('email', Input::get('email'))->first();
106 102
 
107 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 105
 			// Log in user and direct to main page
111 106
 			Auth::login($user);
112 107
 
113 108
 			// Get last visible AND running term;
114
-			$semester = Semester::
115
-				where('is_visible', 1)
109
+			$semester = Semester::where('is_visible', 1)
116 110
 				->where('start', '<=', date('Y-m-d H:i:s'))
117 111
 				->orderBy('start', 'DESC')
118 112
 				->first();
@@ -125,7 +119,7 @@ class AuthController extends \BaseController {
125 119
 			$semesters_info = array();
126 120
 
127 121
 			$semesters_ids[] = $semester->id;
128
-			$semesters_info[] = $semester->name.' ('.$semester->code.')';
122
+			$semesters_info[] = $semester->name . ' (' . $semester->code . ')';
129 123
 
130 124
 			// Put semesters information arrays into Session
131 125
 			Session::forget('semesters_ids');
@@ -136,12 +130,13 @@ class AuthController extends \BaseController {
136 130
 
137 131
 			// Record last login
138 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 140
 				return Redirect::action('UsersController@edit');
146 141
 			}
147 142
 
@@ -163,9 +158,7 @@ class AuthController extends \BaseController {
163 158
 					return Redirect::intended('professor');
164 159
 					break;
165 160
 			}
166
-		}
167
-		else
168
-		{
161
+		} else {
169 162
 			// Tell user access is denied and return to login page.
170 163
 			Session::flash('status', 'danger');
171 164
 			Session::flash('message', 'You are not an authorized user. You may request access by contacting oeae.uprrp.edu.');
@@ -178,7 +171,5 @@ class AuthController extends \BaseController {
178 171
 		Auth::logout();
179 172
 		Session::flush();
180 173
 		return Redirect::action('AuthController@showLogin');
181
-
182 174
 	}
183
-
184 175
 }

+ 16
- 1
app/controllers/CriteriaController.php ファイルの表示

@@ -54,10 +54,25 @@ class CriteriaController extends \BaseController
54 54
     {
55 55
         $json_to_send = array();
56 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 71
         $num_scales = Input::get('numberOfScale');
58 72
         $criterionID = Input::get('id');
73
+
59 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 ファイルの表示

@@ -320,7 +320,7 @@ class Objective2Controller extends \BaseController
320 320
 		$userProgram = DB::select("select program_user.program_id from program_user where user_id = {$userProgram}");
321 321
 
322 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 325
 		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
326 326
 
@@ -337,7 +337,7 @@ class Objective2Controller extends \BaseController
337 337
 		$userSchool = Auth::user()['school_id'];
338 338
 		Log::info($userSchool);
339 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 342
 		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
343 343
 		$programs = Program::where("school_id", "=", $userSchool)->orderBy('name', 'ASC')->get();

+ 4
- 4
app/controllers/RubricsController.php ファイルの表示

@@ -34,8 +34,8 @@ class RubricsController extends \BaseController
34 34
         $criteria = Criterion::orderBy('name', 'ASC')->get();
35 35
         $rubric = $activity->rubric;
36 36
         Log::info($rubric);
37
-        Log::info($activity->rubric_id);
38
-        Log::info($activity->rubric[0]->id);
37
+
38
+
39 39
 
40 40
         return View::make('local.professors.rubrics', compact('title', 'templates', 'outcomes', 'criteria', 'rubrics', 'activity', 'rubric'));
41 41
     }
@@ -94,7 +94,7 @@ class RubricsController extends \BaseController
94 94
         $rubric->user_id = Auth::id();
95 95
         $rubric->num_scales = count($scales[0]);
96 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 99
         if ($rubric->save()) {
100 100
 
@@ -182,7 +182,7 @@ class RubricsController extends \BaseController
182 182
 
183 183
         $rubric->num_scales = count($scales[0]);
184 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 188
         DB::beginTransaction();

+ 28
- 3
app/controllers/TemplatesController.php ファイルの表示

@@ -139,8 +139,12 @@ class TemplatesController extends \BaseController
139 139
 		$criteria = Input::get('criteria');
140 140
 
141 141
 		$max_score = Input::get('max_score');
142
+		$copyright = Input::get('copyright');
143
+		$notes = Input::get('notes');
142 144
 		Log::info($scales);
143 145
 		Log::info($criteria);
146
+		Log::info($copyright);
147
+		Log::info($notes);
144 148
 
145 149
 
146 150
 		$template->num_scales = count($scales[0]);
@@ -149,7 +153,12 @@ class TemplatesController extends \BaseController
149 153
 		if ($template->save()) {
150 154
 			$templateId = $template->id;
151 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 162
 				$template_criterion_id = DB::table('template_criterion')->where('template_id', '=', $templateId)
154 163
 					->where('criterion_id', '=', $criterion_id)->first();
155 164
 
@@ -200,7 +209,17 @@ class TemplatesController extends \BaseController
200 209
 				->where('template_criterion_scale.template_criterion_id', '=', $temp_crit->id)
201 210
 				->orderBy('position', 'ASC')
202 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 223
 		Log::info($template_info);
205 224
 
206 225
 		return json_encode($template_info);
@@ -254,8 +273,11 @@ class TemplatesController extends \BaseController
254 273
 		$criteria = Input::get('criteria');
255 274
 
256 275
 		$max_score = Input::get('max_score');
276
+		$copyright = Input::get('copyright');
277
+		$notes = Input::get('notes');
257 278
 		Log::info($scales);
258 279
 		Log::info(Input::all());
280
+
259 281
 		$template->num_scales = count($scales[0]);
260 282
 		$template->max_score = $max_score;
261 283
 		//$division = $max_score / count($scales[0]);
@@ -264,8 +286,11 @@ class TemplatesController extends \BaseController
264 286
 			$templateId = $template->id;
265 287
 			DB::delete("delete from template_criterion where template_id ={$template->id}");
266 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 294
 				$template_criterion_id = DB::table('template_criterion')->where('template_id', '=', $templateId)
270 295
 					->where('criterion_id', '=', $criterion_id)->first();
271 296
 				DB::delete("delete from template_criterion_scale where template_criterion_id ={$template_criterion_id->id}");

+ 51
- 3
app/controllers/ThreeYearPlanController.php ファイルの表示

@@ -5,11 +5,51 @@ use Illuminate\Database\Eloquent\Collection;
5 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 40
   // load the Three year Plan page
9 41
   public function threeYearsReport()
10 42
   {
11 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 53
     // el ID de los semestres que el usuario tiene seleccionado.
14 54
     $semesters_ids = Session::get('semesters_ids');
15 55
     // buscar informacion de los semestres seleccionados
@@ -27,7 +67,7 @@ class ThreeYearPlanController extends \BaseController
27 67
     $program_id = $program_id[0]->program_id;
28 68
     $outcomes = DB::table('outcomes')->where('deactivation_date', '=', null)->orderBy('name', 'ASC')->get();
29 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,9 +580,17 @@ class ThreeYearPlanController extends \BaseController
540 580
       if (count($firstSemester) && count($secondSemester)) {
541 581
         Log::info($firstSemester);
542 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 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 596
       $count++;

+ 4
- 1
app/routes.php ファイルの表示

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

+ 34
- 0
app/views/global/view-three-year-plan.blade.php ファイルの表示

@@ -99,6 +99,40 @@
99 99
           <li data-cycle-id="{{$typ->id}}" class="list-group-item">{{$typ->year_start}}-{{$typ->year_end}}</li>
100 100
         @endforeach
101 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 136
     </div>
103 137
 
104 138
     <div class="col-md-9">

+ 1
- 1
app/views/local/managers/pCoords/objectives.blade.php ファイルの表示

@@ -114,7 +114,7 @@
114 114
                     <div id='assocOutcomeGroup'>
115 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 119
                     </div>
120 120
                 </div>

+ 4
- 1
app/views/local/managers/sCoords/view-annual-plans.blade.php ファイルの表示

@@ -88,6 +88,7 @@
88 88
       semester = [];
89 89
       typ_objective = [];
90 90
       transformative =[];
91
+      comments = [];
91 92
       for(i = 0; i<counter;i++){
92 93
         realized.push($('input[name="seHizo'+i+'"]:checked').val());
93 94
         logrado.push( $('input[name="logro'+i+'"]:checked').val());
@@ -95,6 +96,7 @@
95 96
         typ_objective.push($('input[name="objective_'+i+'"]').val());
96 97
         semester.push($('input[name="what_semester_'+i+'"]').val());
97 98
         transformative.push($('input[name="transformative_'+i+'"]').val());
99
+        comments.push($('textarea[name="comment2'+i+'"]').val())
98 100
       }
99 101
         
100 102
 
@@ -106,7 +108,8 @@
106 108
         semester:semester,
107 109
         typ_objective: typ_objective,
108 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 ファイルの表示

@@ -280,7 +280,7 @@
280 280
 
281 281
         <div id="copyright-info">
282 282
             <hr>
283
-            <p class="small"><strong>Copyright Information</strong></p>
283
+            <p class="small"><strong>Outcomes Evaluated</strong></p>
284 284
             <ul id="copyright-list" class="list-unstyled small">
285 285
             </ul>
286 286
             <hr>
@@ -404,7 +404,15 @@ function addCriterion()
404 404
         function(data)
405 405
         {
406 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 417
             var subcriteria = '';
410 418
             if(data.criterion.subcriteria){
@@ -418,9 +426,9 @@ function addCriterion()
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 433
             else
426 434
             {
@@ -438,13 +446,17 @@ function addCriterion()
438 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 454
             str +='<th><span class="glyphicon glyphicon-remove icon-btn" aria-hidden="true"></span></th></tr>';
443 455
 
444 456
             $('table tbody').append(str);
445 457
 
446 458
             // Build copyright list
447
-            buildCopyrightList();
459
+            buildOutcomeList();
448 460
 
449 461
             // Enable X-Edtable on this new row
450 462
             $('.editable').editable({
@@ -494,7 +506,7 @@ function fetchCriterion(criterion)
494 506
 }
495 507
 
496 508
 // Build list from copyright info in rubric
497
-function buildCopyrightList()
509
+function buildOutcomeList()
498 510
 {
499 511
     // Empty the copyright list
500 512
     $('#copyright-list').empty();
@@ -503,7 +515,59 @@ function buildCopyrightList()
503 515
     {
504 516
         var criterion = $(this);
505 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 572
             var copyright = criterion.data('criterion-copyright');
509 573
 
@@ -550,18 +614,18 @@ function buildCopyrightList()
550 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 629
 function refreshSelects()
566 630
 {
567 631
     $('#select-template').selectpicker('refresh');
@@ -664,7 +728,7 @@ function loadTemplate()
664 728
             // Set the contents of the rubric
665 729
             var temp_criterion = data.criterion;
666 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 732
                 current_criterion = temp_criterion[temp_c]
669 733
                 var subcriteria ='';
670 734
                 if(current_criterion.subcriteria){
@@ -692,12 +756,21 @@ function loadTemplate()
692 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 767
                 str+='<th><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></th></tr>';
697 768
 
698 769
     $('table tbody').append(str);
699 770
 
700
-    buildCopyrightList();
771
+    
772
+
773
+    
701 774
 
702 775
                 // Enable X-Edtable on this new row
703 776
                 $('.editable').editable({
@@ -752,7 +825,7 @@ function loadTemplate()
752 825
                 $('table tbody').append(str);
753 826
 
754 827
                 // Build copyright list
755
-                buildCopyrightList();
828
+                buildOutcomeList();
756 829
 
757 830
                 // Enable X-Edtable on this new row
758 831
                 $('.editable').editable({
@@ -777,7 +850,38 @@ function loadTemplate()
777 850
             });
778 851
 
779 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 886
         'json',
783 887
     );
@@ -865,13 +969,19 @@ $('#select-template').on('change', function()
865 969
 
866 970
         //If user is admin, or the templates id matches user's, or the template
867 971
         // id's school matches user, allow editing
868
-        var selected = $('#select-template').find(':selected');
972
+        /*var selected = $('#select-template').find(':selected');
869 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 979
         if(
871 980
             {{ Auth::user()->role }}==1
872 981
             || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1)
873 982
             || ({{ Auth::user()->role }}==3
874
-                && $.inArray(selected.data('template-program-id'), programs)
983
+                && programs.includes(selected.data('template-program-id'))
984
+
875 985
                 && selected.data('admin')!=1
876 986
             )
877 987
         )
@@ -888,7 +998,7 @@ $('#select-template').on('change', function()
888 998
 
889 999
         // Enable print button
890 1000
         $('#button-print-rubric').prop('disabled', false);
891
-
1001
+*/
892 1002
     }
893 1003
 
894 1004
 });
@@ -923,7 +1033,7 @@ function changeTable(){
923 1033
                 counter++;
924 1034
             }
925 1035
             }
926
-            newScaleHeaders += '<th></th>';
1036
+            newScaleHeaders += '<th>Copyright</th><th>Notes</th><th></th>';
927 1037
             
928 1038
             $("#criterion-header").html(newScaleHeaders);
929 1039
             $('#allCriteria').html(' ');
@@ -995,7 +1105,7 @@ $('.save').on('click', function(e)
995 1105
 
996 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 1110
             emptyFields=true;
1001 1111
         }
@@ -1034,6 +1144,8 @@ $('.save').on('click', function(e)
1034 1144
     scalesMaxArray =[];
1035 1145
     scalesMinArray =[];
1036 1146
     scales_id =[];
1147
+    copyright = [];
1148
+    notes = [];
1037 1149
 
1038 1150
     
1039 1151
     var amount_of_scales =parseInt($('#number_of_scales').find(':selected').val())+2;
@@ -1047,6 +1159,10 @@ $('.save').on('click', function(e)
1047 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 1166
             scales.push(each_criterion_scale);
1051 1167
 
1052 1168
             
@@ -1078,7 +1194,9 @@ $('.save').on('click', function(e)
1078 1194
                 is_visible: $('input[name=is_visible]:checked').val(),
1079 1195
                 criteria : criteria,
1080 1196
                 scales: scales,
1081
-                max_score : max
1197
+                max_score : max,
1198
+                copyright : copyright,
1199
+                notes :notes
1082 1200
 
1083 1201
             },
1084 1202
             function(data)
@@ -1107,7 +1225,9 @@ $('.save').on('click', function(e)
1107 1225
                 is_visible: $('input[name=is_visible]:checked').val(),
1108 1226
                 criteria : criteria,
1109 1227
                 scales: scales,
1110
-                max_score : max
1228
+                max_score : max,
1229
+                copyright :copyright,
1230
+                notes:notes
1111 1231
             },
1112 1232
             function(data)
1113 1233
             {
@@ -1147,7 +1267,7 @@ $('table').on('click', 'span.glyphicon-remove', function(e)
1147 1267
         $('#rubric-container').hide();
1148 1268
     }
1149 1269
 
1150
-    buildCopyrightList();
1270
+    buildOutcomeList();
1151 1271
 });
1152 1272
 
1153 1273
 // When print button is clicked, redirect to print page

+ 8
- 0
app/views/local/professors/assessment.blade.php ファイルの表示

@@ -538,6 +538,14 @@ function toggleSaveButton()
538 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 549
 // When any score changes, calculate percentages
542 550
 $('select').on('change', function(e)
543 551
 {

+ 76
- 61
app/views/local/professors/rubrics.blade.php ファイルの表示

@@ -93,12 +93,15 @@
93 93
     </table>
94 94
 
95 95
     <div id="copyright-info">
96
+      
97
+
96 98
       <hr>
97
-      <p class="small"><strong>Copyright Information</strong></p>
99
+      <p class="small"><strong>Outcome Information</strong></p>
98 100
       <ul id="copyright-list" class="list-unstyled small">
99 101
       </ul>
100 102
       <hr>
101 103
     </div>
104
+    
102 105
 
103 106
     @if($activity->outcomes_attempted!=NULL)
104 107
     <div class="alert alert-info" role="alert">This activity has already been assessed. Changing the rubric will delete all saved scores.</div>
@@ -141,7 +144,7 @@ function changeTable(){
141 144
                 counter++;
142 145
             }
143 146
             }
144
-            newScaleHeaders += '';
147
+            newScaleHeaders += '<th>Copyright</th><th>Notes</th>';
145 148
             
146 149
             $("#criterion-header").html(newScaleHeaders);
147 150
             
@@ -211,65 +214,67 @@ function fetchCriteria(outcome)
211 214
 }
212 215
 
213 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 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 279
 // Load a template
275 280
 
@@ -298,7 +303,7 @@ function loadTemplate()
298 303
             // Set the contents of the rubric
299 304
             var temp_criterion = data.criterion;
300 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 307
                 current_criterion = temp_criterion[temp_c]
303 308
                 var subcriteria ='';
304 309
                 if(current_criterion.subcriteria){
@@ -326,12 +331,19 @@ function loadTemplate()
326 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 342
                 str+='</tr>';
331 343
 
332 344
     $('table tbody').append(str);
333 345
 
334
-    buildCopyrightList();
346
+    buildOutcomeList();
335 347
 
336 348
                 
337 349
 
@@ -382,7 +394,7 @@ function loadTemplate()
382 394
                 $('table tbody').append(str);
383 395
 
384 396
                 // Build copyright list
385
-                buildCopyrightList();
397
+                buildOutcomeList();
386 398
 
387 399
                 // Enable X-Edtable on this new row
388 400
                 $('.editable').editable({
@@ -400,7 +412,7 @@ function loadTemplate()
400 412
           
401 413
 
402 414
             // Build Copyright List
403
-            buildCopyrightList();
415
+            buildOutcomeList();
404 416
         }, 
405 417
         'json',
406 418
     );
@@ -461,7 +473,7 @@ function loadTemplate()
461 473
       });
462 474
 
463 475
       // Build Copyright List
464
-      buildCopyrightList();
476
+      buildOutcomeList();
465 477
     }
466 478
   );
467 479
 }
@@ -500,9 +512,12 @@ $('#button-save-rubric').on('click', function(e)
500 512
     criteria.push($(this).data('criterion-id'));
501 513
     each_criterion_scale =[];
502 514
     $(this).children('td').each(function(index){
503
-      if(index!=0)
515
+      if(index!=0 )
504 516
       each_criterion_scale.push($(this).text());
517
+      
505 518
     })
519
+each_criterion_scale.pop();
520
+each_criterion_scale.pop();
506 521
     scales.push(each_criterion_scale);
507 522
     /*
508 523
       criterionObject.id = $(this).data('criterion-id');