<?php

if ( !defined('INC_FILE_IHM_TASK') ) {
      define ('INC_FILE_IHM_TASK',1);

include('Inc/FctDivers.php');
include('Inc/Classes/bo/task.php');
include("Inc/Classes/bo/taskDescription.php");

class IHMTask
{
	
function affFormulaire(&$tabTaskDesc, &$timeValues)
{
  printf("\n<form method=\"post\" action=\"SaveTemps.php?idFD=%d\">",$_GET['idFD']);
  foreach ($tabTaskDesc as $task) {
    If ($task->type=='int') {
      printf("<input id=\"$task->id\" name=\"$task->name\"
      value=\"$task->name\"/> $task->title<br>");
    }				
  }		
printf("<input type=\"submit\" value=\"Valider\" /></form>");
}	
	
function Modif(&$task, &$taskDesc, $bgcolor) {
 If ($taskDesc->type=='int') {
   openDBCal($mdb2Cal);
   closeDB($mdb2Cal);
   printf("<td><a href=\"%s\">$task->id</a></td><td>$taskDesc->title</td>
        <td><input id=\"$taskDesc->id\" name=\"initLoad[]\" value=\"$task->initLoad\"/></td>
        <td><input id=\"$taskDesc->id\" name=\"raf[]\" value=\"$task->raf\"/></td>
        <td>%s</td>
        <td>$taskDesc->description</td>", "Tache.php?id=$task->id&domain=".$task->file->domain, ConvertMinToHours($task->used) );
   }				
}	

Function ShowMessages(&$file, &$obj, &$objDesc) {
  $dateNow=date("Ymd");
  $hourNow=date("H");
  printf("\n<p><font size=\"5\" color=\"BLUE\"><a href=\"saisie_temps.php?idFD=%d&domain=%d\">File %d</a> : %s</font></p>",$obj->idFD, $file->domain, $obj->idFD,$file->title);
  printf("\n<p>Task : <font size=\"4\" color=\"GREEN\">%s</font></p>", $objDesc->title);
  printf("\n<p><font size=\"4\" color=\"BROWN\">(Initial estimated load : %sh )</font>",$obj->initLoad);
  printf("\n<font size=\"4\" color=\"GREEN\"> -- ( raf : %sh )</font>",$obj->raf);
  printf("\n<font size=\"4\" color=\"RED\"> -- ( used : %s )</font></p>",ConvertMinToHoursAndMin($obj->used));
  printf("<a href=\"http://frtou-dev07/WebCalendar/edit_entry.php?date=$dateNow&hour=$hourNow&duration=30&name=$obj->id\">Add an activity for this task</a> ");

  if (is_array($obj->tabActivity)) {
    foreach($obj->tabActivity as $activity) {
        printf("\n<p>");
        printf("<br><font color=\"RED\">%s</font>", $activity->user);
        printf("<br><a href=\"http://frtou-dev07/WebCalendar/day.php?date=$activity->date\"> %s </a>", DateToExplicitDate($activity->date));
        printf("<font color=\"GREEN\"> %s </font>", TimeToExplicitTime($activity->timeBegin));
        printf("<font color=\"BLUE\"> - Duration : %s </font>", ConvertMinToHoursAndMin($activity->used));
        printf("\n<br>$activity->msg\n");
        printf("</p>");
    }
   }
	// l'objet file n'est plus dispo car je ne l'ai pas transmis. Il faudrait le faire,
	// grace a serialize() et unserialize()
	//printf("\n<p><a href=\"saisie_temps.php?idFD=%d&domain=%d\">Back to file %d</a></p>",$obj->idFD,$obj->file->id,$obj->idFD);
	//printf("\n<p>Back to file %d</a></p>",$obj->idFD,$_GET['domain'],$obj->idFD);
  }	
		
	
} // class

} // ifndef
?>
