Browse Source

Code cleanup for ticket plugin (2) - refs #6715

Yannick Warnier 11 years ago
parent
commit
b75aabddda
2 changed files with 20 additions and 20 deletions
  1. 7 7
      plugin/ticket/src/tutor.php
  2. 13 13
      plugin/ticket/src/tutor_report.lib.php

+ 7 - 7
plugin/ticket/src/tutor.php

@@ -39,7 +39,7 @@ $(document).ready(function (){
 });	
 		
 		
-function mostrarContenido(div){
+function showContent(div){
 	if($("div#"+div).attr("class")=="blackboard_hide"){
 		$("div#"+div).attr("class","blackboard_show");
 		$("div#"+div).attr("style","");
@@ -57,12 +57,12 @@ function save() {
 	 $.ajax({
 		contentType: "application/x-www-form-urlencoded",
 		beforeSend: function(objeto) {
-		$("div#confirmation").html("<img src=\'../../../main/inc/lib/javascript/indicator.gif\' />"); },
+		$("div#confirmation").html("<img src=\"'.api_get_path(WEB_LIBRARY_PATH).'javascript/indicator.gif\" />"); },
 		type: "POST",
 		url: "update_report.php",
 		data: "work_id="+work_id+"&forum_id="+forum_id+"&rs_id="+rs_id,
-		success: function(datos) {
-			$("div#confirmation").html(datos);
+		success: function(data) {
+			$("div#confirmation").html(data);
 			 location.reload();
 		}
 	});
@@ -94,16 +94,16 @@ function save() {
 </style>';
 
 $course_code = api_get_course_id();
-$resultado = inicializarReporte($course_code);
+$results = initializeReport($course_code);
 if(isset($_GET['action'])){
-	Export::export_table_xls($resultado['exportar'],"REPORTE ALUMNOS CURSO".$course_code);
+	Export::export_table_xls($results['export'],"COURSE_USER_REPORT".$course_code);
 }else{
 	Display::display_header();
 	api_protect_course_script();
 	if (!api_is_allowed_to_edit()){
 		api_not_allowed();
 	}
-	echo $resultado['mostrar'];
+	echo $results['show'];
 	Display::display_footer();
 }
 ?>

+ 13 - 13
plugin/ticket/src/tutor_report.lib.php

@@ -8,7 +8,7 @@
  * @param $course_code
  * @return array|bool
  */
-function inicializarReporte($course_code)
+function initializeReport($course_code)
 {
 	$course_info = api_get_course_info($course_code);
 	$table_reporte_semanas = Database::get_main_table('rp_reporte_semanas');
@@ -58,7 +58,7 @@ function inicializarReporte($course_code)
 		IN (SELECT DISTINCT CONCAT(f.poster_id,',',rs.id)
 		FROM $table_post f  JOIN $table_reporte_semanas rs ON f.thread_id = rs.forum_id)");
 
-		return mostrarResultados($course_info,$weeksCount,$page);
+		return showResults($course_info,$weeksCount,$page);
 	}
 	
 }
@@ -69,7 +69,7 @@ function inicializarReporte($course_code)
  * @param $page
  * @return array
  */
-function mostrarResultados($courseInfo,$weeksCount, $page)
+function showResults($courseInfo,$weeksCount, $page)
 {
     $course_code = $courseInfo['code'];
     $tableWeeklyReport = Database::get_main_table('rp_reporte_semanas');
@@ -106,21 +106,21 @@ function mostrarResultados($courseInfo,$weeksCount, $page)
         if ($rowe['week_id'] > (($page-1)*7) &&  $rowe['week_id'] <= (7*$page)){
             $ids[$rowe['week_id']] = $rowe['id'];
             $line.='<th>
-                <a href="#" onClick="mostrarContenido('."'tarea".$rowe['week_id']."'".');">Work'.$rowe['week_id'].'
+                <a href="#" onClick="showContent('."'tarea".$rowe['week_id']."'".');">Work'.$rowe['week_id'].'
                         <div class="blackboard_hide" id="tarea'.$rowe['week_id'].'">'.$rowe['work_title'].'</div>
                 </a></th>';
             $line.= '<th>
-                <a href="#" onClick="mostrarContenido('."'foro".$rowe['week_id']."'".');">Forum'.$rowe['week_id'].'
+                <a href="#" onClick="showContent('."'foro".$rowe['week_id']."'".');">Forum'.$rowe['week_id'].'
                         <div class="blackboard_hide" id="foro'.$rowe['week_id'].'">'.$rowe['thread_title'].'</div>
                 </a>
                 </th>';
             /*$fila.= '<th>
-                <a href="#" onClick="mostrarContenido('."'eval".$rowe['week_id']."'".');">Eval'.$rowe['week_id'].'
+                <a href="#" onClick="showContent('."'eval".$rowe['week_id']."'".');">Eval'.$rowe['week_id'].'
                     <div class="blackboard_hide" id="eval'.$rowe['week_id'].'">'.$rowe['eval_title'].'</div>
                 </a>
                 </th>';
             $fila.= '<th>
-                <a href="#" onClick="mostrarContenido('."'pc".$rowe['week_id']."'".');">PC'.$rowe['week_id'].'
+                <a href="#" onClick="showContent('."'pc".$rowe['week_id']."'".');">PC'.$rowe['week_id'].'
                     <div class="blackboard_hide" id="pc'.$rowe['week_id'].'">'.$rowe['pc_title'].'</div>
                 </a>
                 </th>';*/
@@ -150,7 +150,7 @@ function mostrarResultados($courseInfo,$weeksCount, $page)
     $html .= '<tr>
             <th ></th>';
     for ($i=(7*$page-6); $i <= $page*7;$i++) {
-        $html .= '<th colspan="2">Semana '.$i.'<a href="assign_tickets.php?id='.$ids[$i].'" class="ajax">'.Display::return_icon('edit.png', get_lang('Edit'),  array('width'=>'16','height'=>'16'), 22).'</a></th>';
+        $html .= '<th colspan="2">Week '.$i.'<a href="assign_tickets.php?id='.$ids[$i].'" class="ajax">'.Display::return_icon('edit.png', get_lang('Edit'),  array('width'=>'16','height'=>'16'), 22).'</a></th>';
     }
     $html .=  '</tr>';
     $html .= $line;
@@ -167,17 +167,17 @@ function mostrarResultados($courseInfo,$weeksCount, $page)
         if ($row['week_id'] > (($page-1)*7) &&  $row['week_id'] <= (7*$page) ) {
             $results[$row['username']][$row['week_id']] = $row;
             if (count($results[$row['username']]) == 7 ) {
-                $html.= mostrarResultadoAlumno($results[$row['username']],$page);
+                $html.= showStudentResult($results[$row['username']],$page);
             }
         }
         if (count($resultadose[$row['username']]) == $weeksCount ) {
-                $tableExport[] = mostrarResultadoAlumnoExportar($resultadose[$row['username']],$weeksCount);
+                $tableExport[] = showStudentResultExport($resultadose[$row['username']],$weeksCount);
         }
     }
     $html .= '
           </table>';
 
-    return array('mostrar'=>$html,'exportar'=>$tableExport);
+    return array('show'=>$html,'export'=>$tableExport);
 }
 
 /**
@@ -185,7 +185,7 @@ function mostrarResultados($courseInfo,$weeksCount, $page)
  * @param $pagina
  * @return string
  */
-function mostrarResultadoAlumno($datos,$pagina)
+function showStudentResult($datos,$pagina)
 {
     $inicio = (7*$pagina-6);
     $fila = '<tr>';
@@ -204,7 +204,7 @@ function mostrarResultadoAlumno($datos,$pagina)
  * @param $numero_semanas
  * @return array
  */
-function mostrarResultadoAlumnoExportar($data ,$numero_semanas)
+function showStudentResultExport($data ,$numero_semanas)
 {
     $fila = array();
     $fila[] = utf8_decode($data[1]['username']);