Jelajahi Sumber

minor - added background color to done advances - partial BT#578

Cristian Fasanando 15 tahun lalu
induk
melakukan
b52436f922

+ 16 - 0
main/attendance/index.php

@@ -188,6 +188,22 @@ $htmlHeadXtra[] = '<script language="javascript">
 				 $("#div_result").html(datos);
 				}
 			});
+			
+			// clean all radios
+			for (var i=0; i<$("input[@name=\'done_thematic\']").length;i++) {
+				var id_radio_thematic = $("input[@name=\'done_thematic\']").get(i).id;								
+				$("#td_"+id_radio_thematic).css({"background-color":"#FFF"});				
+			}
+			
+			// set background to previous radios 
+			for (var i=0; i<$("input[@name=\'done_thematic\']").length;i++) {
+				var id_radio_thematic = $("input[@name=\'done_thematic\']").get(i).id;								
+				$("#td_"+id_radio_thematic).css({"background-color":"#E5EDF9"});
+				if ($("input[@name=\'done_thematic\']").get(i).value == selected_value) {
+					break;
+				}
+			}		
+
 		}
 		
 		

+ 22 - 17
main/attendance/thematic.php

@@ -58,7 +58,7 @@ if ($action == 'thematic_list') {
 	if (!empty($thematic_id)) {
 		echo '<div style="text-align:right;">'.get_lang('Progress').': <strong>'.$total_average_of_advances.'</strong>%</div><br />';
 	} else {
-		echo '<div style="text-align:right;">'.get_lang('Progress').': <span id="div_result"><strong>'.$total_average_of_advances.'</strong></span>%</div><br />';
+		echo '<div style="text-align:right;">'.get_lang('Progress').': <strong><span id="div_result">'.$total_average_of_advances.'</span></strong>%</div><br />';
 	}
 	
 	// display thematic data
@@ -73,8 +73,7 @@ if ($action == 'thematic_list') {
 				echo '<td><div><strong>'.$thematic['title'].'</strong></div><div>'.$thematic['content'].'</div></td>';
 				
 				// display thematic plan data
-				echo '<td>';
-					//echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_plan_list&thematic_id='.$thematic['id'].$param_gradebook.'">'.Display::return_icon('info.gif',get_lang('ThematicPlan'),array('style'=>'vertical-align:middle')).' '.get_lang('EditThematicPlan').'</a></div><br />';
+				echo '<td>';					
 					if (api_is_allowed_to_edit(null, true)) {
 						echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_plan_list&thematic_id='.$thematic['id'].$param_gradebook.'">'.Display::return_icon('lp_quiz.png',get_lang('EditThematicPlan'),array('style'=>'vertical-align:middle')).'</a></div><br />';
 					}
@@ -88,40 +87,46 @@ if ($action == 'thematic_list') {
 				echo '</td>';
 				
 				// display thematic advance data
-				echo '<td>';
-					//echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_advance_list&thematic_id='.$thematic['id'].$param_gradebook.'">'.Display::return_icon('porcent.png',get_lang('ThematicAdvance'),array('style'=>'vertical-align:middle')).' '.get_lang('EditThematicAdvance').'</a></div><br />';
+				echo '<td>';					
 					if (api_is_allowed_to_edit(null, true)) {
 						echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_advance_list&thematic_id='.$thematic['id'].$param_gradebook.'">'.Display::return_icon('lp_quiz.png',get_lang('EditThematicAdvance'),array('style'=>'vertical-align:middle')).'</a></div><br />';
-					}
-					if (!empty($thematic_advance_data[$thematic['id']])) {
-						echo '<table width="100%">';					
+					}					
+					echo '<table width="100%">';
+
+						if (!empty($thematic_advance_data[$thematic['id']])) {						
 							foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
 								echo '<tr>';
 								echo '<td width="90%">';
 									echo '<div><strong>'.api_get_local_time($thematic_advance['start_date']).'</strong></div>';
 									echo '<div>'.$thematic_advance['content'].'</div>';
-									echo '<div>'.get_lang('Hours').' : '.$thematic_advance['duration'].'</div>';
+									echo '<div>'.get_lang('DurationInHours').' : '.$thematic_advance['duration'].'</div>';
 								echo '</td>';
 								if (empty($thematic_id) && api_is_allowed_to_edit(null, true)) {
 									$checked = '';
 									if ($last_done_thematic_advance == $thematic_advance['id']) {
 										$checked = 'checked';
-									}								
-									echo '<td><center><input type="radio" name="thematic_done" value="'.$thematic_advance['id'].'" '.$checked.' onclick="update_done_thematic_advance(this.value)"></center></td>';
+									}
+									$style = '';
+									if ($thematic_advance['done_advance'] == 1) {
+										$style = ' style="background-color:#E5EDF9" ';
+									} else {
+										$style = ' style="background-color:#fff" ';
+									}														
+									echo '<td id="td_done_thematic_'.$thematic_advance['id'].'" '.$style.'><center><input type="radio" id="done_thematic_'.$thematic_advance['id'].'" name="done_thematic" value="'.$thematic_advance['id'].'" '.$checked.' onclick="update_done_thematic_advance(this.value)"></center></td>';									
 								} else {
 									if ($thematic_advance['done_advance'] == 1) {
 										echo '<td><center>'.get_lang('Done').'</center></td>';	
 									} else {
 										echo '<td><center>-</center></td>';
-									}
-									
+									}									
 								}
 								echo '</tr>';							 
 							}
-						echo '</table>';
-					} else {
-						echo '<div><em>'.get_lang('StillDoNotHaveAThematicAdvance').'</em></div>';
-					}				
+						} else {
+							echo '<tr><td width="90%"><div><em>'.get_lang('StillDoNotHaveAThematicAdvance').'</em></div></td><td>&nbsp;</td>';
+						}									
+					echo '</table>';
+							
 				echo '</td>';				
 				echo '</tr>';				
 			}

+ 7 - 0
main/attendance/thematic_controller.php

@@ -263,6 +263,13 @@ class ThematicController
 		    			$thematic->set_thematic_advance_attributes($thematic_advance_id, $thematic_id,  $attendance_id, $content, $start_date, $duration);	    				    								
 						$affected_rows = $thematic->thematic_advance_save();				    			
 			        	
+			        	if ($affected_rows) {
+			        		// get last done thematic advance before move thematic list
+							$last_done_thematic_advance = $thematic->get_last_done_thematic_advance();
+							// update done advances with de current thematic list
+							$update_done_advances = $thematic->update_done_thematic_advances($last_done_thematic_advance);
+			        	}
+			        	
 						unset($_SESSION['thematic_advance_token']);	        
 			        	$action = 'thematic_advance_list';		
 		    		}