Browse Source

corrigiendo bugs

parent
commit
793645227e

+ 1
- 0
app/controllers/CriteriaController.php View File

130
             ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
130
             ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
131
             ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
131
             ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
132
             ->where('outcome_id', '=', $outcome_id)
132
             ->where('outcome_id', '=', $outcome_id)
133
+            ->where('objectives.id', '<>', 0)
133
             ->whereIn('program_id', $program_ids)
134
             ->whereIn('program_id', $program_ids)
134
             ->select('objectives.*', 'objective_outcome.*')
135
             ->select('objectives.*', 'objective_outcome.*')
135
             ->distinct()
136
             ->distinct()

+ 8
- 1
app/controllers/Objective2Controller.php View File

228
 				}
228
 				}
229
 				foreach ($clean_input['outcome_id'] as $outcome_id) {
229
 				foreach ($clean_input['outcome_id'] as $outcome_id) {
230
 					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
230
 					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
231
-
232
 					/*if (!($objectiveOutcome->save())) {
231
 					/*if (!($objectiveOutcome->save())) {
233
 						Session::flash('status', 'danger');
232
 						Session::flash('status', 'danger');
234
 						Session::flash('message', '<p>Error creating objective. Please try again later.</p>');
233
 						Session::flash('message', '<p>Error creating objective. Please try again later.</p>');
235
 						return Redirect::to('objective')->withInput();
234
 						return Redirect::to('objective')->withInput();
236
 					}*/
235
 					}*/
237
 				}
236
 				}
237
+				DB::table('criterion_objective_outcome')
238
+				->join('program_criterion' , 'criterion_objective_outcome.criterion_id',"=",'program_criterion.criterion_id')
239
+				->whereIn('program_id',$clean_input['program_id'])
240
+				->whereIn('outcome_id',$clean_input['outcome_id'])
241
+				->where('objective_id','=',0)
242
+				->update(array('objective_id'=>$objectiveId));
243
+// 				update("update criterion_objective_outcome coo join program_criterion pc on coo.criterion_id=pc.criterion_id set 
244
+// 				objective_id= {$objectiveId} where program_id in (".$clean_input['program_id'].") and objective_id=0 and outcome_id in (".$clean_input['outcome_id'].")");
238
 
245
 
239
 				Session::flash('status', 'success');
246
 				Session::flash('status', 'success');
240
 				Session::flash('message', 'Objective created: "' . $objective->text . '".');
247
 				Session::flash('message', 'Objective created: "' . $objective->text . '".');

+ 2
- 1
app/controllers/OutcomesController.php View File

406
 
406
 
407
     public function fetchCriteria()
407
     public function fetchCriteria()
408
     {
408
     {
409
-
409
+// 		var_dump((Input::get('filter')));
410
+// 		exit();
410
         if (Input::get('filter')) {
411
         if (Input::get('filter')) {
411
             switch (Input::get('filter')) {
412
             switch (Input::get('filter')) {
412
                 case 'all':
413
                 case 'all':

+ 7
- 1
app/controllers/TemplatesController.php View File

378
 			->join('template_criterion', 'template_criterion.criterion_id', '=', 'criteria.id')
378
 			->join('template_criterion', 'template_criterion.criterion_id', '=', 'criteria.id')
379
 			->where("template_criterion.template_id", '=', Input::get('id'))
379
 			->where("template_criterion.template_id", '=', Input::get('id'))
380
 			->get();
380
 			->get();
381
+				Log::info(json_encode($template_info['criterion']));
382
+// 				Log::info(($temp_crit->program_ids));
381
 		foreach ($template_info['criterion'] as $temp_crit) {
383
 		foreach ($template_info['criterion'] as $temp_crit) {
382
 			$temp_crit->scales = DB::table('scales')
384
 			$temp_crit->scales = DB::table('scales')
383
 				->join('criterion_scale', 'criterion_scale.scale_id', '=', 'scales.id')
385
 				->join('criterion_scale', 'criterion_scale.scale_id', '=', 'scales.id')
388
 			$temp_crit->program_ids = json_encode(DB::table('program_criterion')
390
 			$temp_crit->program_ids = json_encode(DB::table('program_criterion')
389
 				->where('criterion_id', $temp_crit->id)
391
 				->where('criterion_id', $temp_crit->id)
390
 				->lists('program_id'));
392
 				->lists('program_id'));
393
+				
394
+						Log::info("ee".json_encode($temp_crit->program_ids));
395
+		
391
 			$temp_crit->objectives = DB::table('criterion_objective_outcome')
396
 			$temp_crit->objectives = DB::table('criterion_objective_outcome')
392
 				->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
397
 				->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
393
 				->where('criterion_id', $temp_crit->id)
398
 				->where('criterion_id', $temp_crit->id)
404
 			$outcomeStr = rtrim($outcomeStr, ',');
409
 			$outcomeStr = rtrim($outcomeStr, ',');
405
 			$temp_crit->outcomes = $outcomeStr;
410
 			$temp_crit->outcomes = $outcomeStr;
406
 		}
411
 		}
412
+		Log::info("ee2".json_encode($template_info));
407
 
413
 
408
 		$template_info['titles'] = DB::table('titles')
414
 		$template_info['titles'] = DB::table('titles')
409
 			->join('template_title', 'template_title.title_id', '=', 'titles.id')
415
 			->join('template_title', 'template_title.title_id', '=', 'titles.id')
411
 			->orderBy('position')
417
 			->orderBy('position')
412
 			->get();
418
 			->get();
413
 
419
 
414
-		Log::info($template_info);
420
+// 		Log::info(json_encode($template_info));
415
 
421
 
416
 		return json_encode($template_info);
422
 		return json_encode($template_info);
417
 	}
423
 	}

+ 10
- 6
app/views/local/managers/shared/rubrics_new.blade.php View File

528
         function(data)
528
         function(data)
529
         {
529
         {
530
             $('#select-criterion').empty();
530
             $('#select-criterion').empty();
531
-
531
+		console.log(data);
532
             // Append criteria
532
             // Append criteria
533
             data.forEach( function (arrayItem)
533
             data.forEach( function (arrayItem)
534
             {
534
             {
535
                 objectives = JSON.stringify(arrayItem.objectives);
535
                 objectives = JSON.stringify(arrayItem.objectives);
536
                 $('#select-criterion')
536
                 $('#select-criterion')
537
-                    .append('<option data-criterion-id="'+arrayItem.id+'" data-program-ids = "'+arrayItem.program_ids+'" data-assoc-objectives= '+"'"+objectives+"'"+'>'+arrayItem.name+'</option>');
537
+                    .append('<option data-criterion-id="'+arrayItem.id+'" data-program-ids = '+"'"+arrayItem.program_ids+"'"+' data-assoc-objectives= '+"'"+objectives+"'"+'>'+arrayItem.name+'</option>');
538
             });
538
             });
539
 
539
 
540
             // If there are no criteria assigned to the selected outcome, disable the
540
             // If there are no criteria assigned to the selected outcome, disable the
932
 
932
 
933
             // Set the contents of the rubric
933
             // Set the contents of the rubric
934
             var temp_criterion = data.criterion;
934
             var temp_criterion = data.criterion;
935
+               console.log(temp_criterion);
935
             for(temp_c in temp_criterion){
936
             for(temp_c in temp_criterion){
936
                 current_criterion = temp_criterion[temp_c]
937
                 current_criterion = temp_criterion[temp_c]
938
+               console.log(current_criterion.program_ids);
937
                 objectives = JSON.stringify(current_criterion.objectives);
939
                 objectives = JSON.stringify(current_criterion.objectives);
938
-               
939
-                var str = '<tr data-assoc-objectives= '+"'"+objectives+"'"+' data-program_ids = "'+current_criterion.program_ids+'" data-criterion-name = "'+current_criterion.name+'" 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>';
940
-                
940
+                //var str = '<tr data-assoc-objectives= '+"'"+objectives+"'"+' data-program_ids = "'+current_criterion.program_ids+'" data-criterion-name = "'+current_criterion.name+'" 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>';
941
+                var str = "<tr data-assoc-objectives= "+"'"+objectives+"'"+" data-program_ids = '"+current_criterion.program_ids+"' data-criterion-name = '"+current_criterion.name+"' 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>";
942
+                console.log(str);
943
+
941
                 var subcriteria ='';
944
                 var subcriteria ='';
942
                 if(current_criterion.subcriteria){
945
                 if(current_criterion.subcriteria){
943
                     var subcriteria_array = JSON.parse(current_criterion.subcriteria);
946
                     var subcriteria_array = JSON.parse(current_criterion.subcriteria);
967
                 str+= '<td>'+current_criterion.outcomes+'</td>'
970
                 str+= '<td>'+current_criterion.outcomes+'</td>'
968
   
971
   
969
                 str+='<th><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></th></tr>';
972
                 str+='<th><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></th></tr>';
973
+                console.log(str);
970
 
974
 
971
     $('table tbody').append(str);
975
     $('table tbody').append(str);
972
 
976
 
1412
             htmlString = '';
1416
             htmlString = '';
1413
             console.log($(this));
1417
             console.log($(this));
1414
 
1418
 
1415
-            program_ids = $(this).data('program-ids')
1419
+            program_ids = $(this).data('program_ids')
1416
             if(!program_ids.includes(program_id) ){
1420
             if(!program_ids.includes(program_id) ){
1417
                 title = "<h6>The following criteria and objectives will be matched with this program</h6>"
1421
                 title = "<h6>The following criteria and objectives will be matched with this program</h6>"
1418
                 htmlString += "<ol style='list-style-position: inside'>"
1422
                 htmlString += "<ol style='list-style-position: inside'>"