Location: PHPKode > projects > Opensheet > opensheet/include/draw.time.table.new.inc.php
<table style="width:100%;background:#EAF5BF;">
<?php
	
	$stats 	   = new Stats;
	$timesheet = new Timesheet;
	$projects   = new Projects;
	$overtimes = $stats->getOvertime($user_index,$year,$month);
	$days_month = $timesheet->getDays($year,$month);
	$emptyCells = $days_month['emptyCells'];
	$days_month = $days_month['days'];$days_month++;
	
	if(empty($overtimes)){$overtimes=$stats->getHolydays($year,$month);}
	#print_r($overtimes);
	
	if ($_SESSION['permissions']['admin'] == "1") {
		echo '<form Name="proj_table" action="" method="POST">';
		}elseif ($month == date('m') && $year == date('Y') ) {
			echo '<form Name="proj_table" action="" method="POST">';
		}
	
	if ($month == date('m') && $year == date('Y') ) {
		$projects_list=$timesheet->getProjectsFromBase($user_index,$year,$month);
		$tasks_list=$timesheet->getTasksFromBase($user_index,$year,$month);		
	}else {
		$projects_list=$timesheet->getProjectsFromSheet($user_index,$year,$month);
		$tasks_list=$timesheet->getTasksFromSheet($user_index,$year,$month);
	}

	foreach($project_types as $types ){
		if (isset($projects_list[$types])){	
		?>
	
  		<tr style="background:#B5D33C;">
        <td class="prj" scope="col"><?php echo gettext($types);?></td>
        <td class="index" scope="col"><?php echo gettext('index');?></td>
        <td class="aprv" scope="col"><img src="images/aprv.png"></td>
        <td class="time" scope="col"><?php echo gettext('summ');?></td>

		<?php
			for ($day='1';$day < $days_month;$day++){
				if ( $overtimes[$day]['holyday'] == 'Y' )  {
					echo '<td class="ptype_days_holyday" scope="col">'.$day.'</td>';
				}else {
					echo '<td class="ptype_days" scope="col">'.$day.'</td>';	
				}
			}
			for ($empty=0; $empty < $emptyCells; $empty++)
			{ # Empty dates here, waitin for langoliers
				echo '<td class="ptype_days" scope="col"></td>'; }
				echo "</tr>";
		
		}
		
		
		foreach ($projects_list[$types] as $project_id=>$value){
			$corr_project = $projects->getPrjUsrSummMonth($project_id,$user_index,$year,$month);
			if (isset($tasks_list[$project_id])){
	
		$key = $project_id;
				
				
		#include('include/accardion.inc.html');	#Добавляем скрипт для разворачивания - сворачивания списка
	
		?>
		<script>
				$(document).ready(function(event){
			    $("#<?php echo $key; ?>").click(function () {
      			$(".<?php echo $key; ?>").toggle();
         			 })
    	.css('cursor','pointer');
  });
  </script>
					<tr>
    					    <td class="prj" scope="col"><a href="#" id="<?php echo $key;?>"><img src="images/tasks_plus.png"></a>&nbsp <?php echo $corr_project[$project_id]['proj_name']; ?></td>
    					    <td class="index" scope="col"><div style="overflow:hidden; height: 18px;"><?php echo $corr_project[$project_id]['proj_index']; ?></div></td>
    					    <td class="aprv" scope="col"></td>
     					    <td class="time" scope="col"><div style="overflow:hidden; height: 18px;"><?php echo $corr_project[$project_id]['summ']; ?> </div></td>
				<?php 				
			for ($day='1';$day < $days_month;$day++){
				if ( $overtimes[$day]['holyday'] == 'Y' )  {
												echo '<td class="days_holyday" scope="col">'.$projects_list[$types][$project_id][$day].'</td>';
								}else {
												echo '<td  class="days" scope="col">'.$projects_list[$types][$project_id][$day].'</td>';	
				}
			}
			for ($empty=0; $empty < $emptyCells; $empty++)
			{ # Empty dates here, waitin for langoliers
				echo '<td class="ptype_days" scope="col"></td>'; }
				echo "</tr>";
		
		
		
		
		
		
		
		
						
					
			foreach($tasks_list[$project_id] as $task=>$day){		
			$corr_task = $projects->getTaskUsrSummMonth($task,$user_index,$year,$month);
			?>
							<tr class="<?php echo $key; ?>"  style="display:none;" >
    					    <td class="prj" scope="col"><div style="overflow:hidden; height: 18px;"><?php echo $corr_task[$task]['task_name']; ?></div></td>
    					    <td class="index" scope="col"><div style="overflow:hidden; height: 18px;"><?php echo $corr_task[$task]['task_index']; ?></div></td>
    					    <td class="aprv" scope="col"></td>
     					    <td class="time" scope="col"><div style="overflow:hidden; height: 18px;"><?php echo $corr_task[$task]['summ']; ?> </div></td>
				<?php 				
			for ($day='1';$day < $days_month;$day++){
				if ( $overtimes[$day]['holyday'] == 'Y' )  {
												echo '<td class="days_holyday" scope="col"><input name="hours[tasks]['.$project_id.']['.$task.']['.$day.']" class="cells_holyday" type="text" maxlength="2"  value="'.$tasks_list[$project_id][$task][$day].'"></td>';
								}else {
												echo '<td  class="days" scope="col"><input name="hours[tasks]['.$project_id.']['.$task.']['.$day.']" class="cells" type="text" maxlength="2"  value="'.$tasks_list[$project_id][$task][$day].'"></td>';	
				}
			}
			for ($empty=0; $empty < $emptyCells; $empty++)
			{ # Empty dates here, waitin for langoliers
				echo '<td class="ptype_days" scope="col"></td>'; }
				echo "</tr>";
				
				
			}			
						
		}else{
				?>
							<tr>
    					    <td class="prj" scope="col"><div style="overflow:hidden; height: 18px;"><?php echo $corr_project[$project_id]['proj_name']; ?></div></td>
    					    <td class="index" scope="col"><div style="overflow:hidden; height: 18px;"><?php echo $corr_project[$project_id]['proj_index']; ?></div></td>
    					    <td class="aprv" scope="col"></td>
     					    <td class="time" scope="col"><div style="overflow:hidden; height: 18px;"><?php echo $corr_project[$project_id]['summ']; ?> </div></td>
				<?php 				
			for ($day='1';$day < $days_month;$day++){
				if ( $overtimes[$day]['holyday'] == 'Y' )  {
												echo '<td class="days_holyday" scope="col"><input name="hours[projects]['.$project_id.']['.$day.']" class="cells_holyday" type="text" maxlength="2"  value="'.$projects_list[$types][$project_id][$day].'"></td>';
								}else {
												echo '<td  class="days" scope="col"><input name="hours[projects]['.$project_id.']['.$day.']" class="cells" type="text" maxlength="2"  value="'.$projects_list[$types][$project_id][$day].'"></td>';	
				}
			}
			for ($empty=0; $empty < $emptyCells; $empty++)
			{ # Empty dates here, waitin for langoliers
				echo '<td class="ptype_days" scope="col"></td>'; }
				echo "</tr>";
		
		}
				
				
				
	}
	}		
			?>
		<tr>
        <td class="prj" scope="col"><?php echo gettext('overtime'); ?></td>
        <td class="index" scope="col"></td>
        <td class="aprv" scope="col"></td>
        <td class="time" scope="col"><?php echo $overtime_hday_arr[50]['sum_over_hours']; ?></td>
		<?php 

			for ($day='1';$day < $days_month;$day++){
					if ( $overtimes[$day]['holyday'] == 'Y' )  {
													echo '<td class="days_holyday" scope="col">'.$overtimes[$day]['overtime'].'</td>';
									}else {
													echo '<td  class="days" scope="col">'.$overtimes[$day]['overtime'].'</td>';	
					}
				}
				for ($empty=0; $empty < $emptyCells; $empty++)
				{ # Empty dates here, waitin for langoliers
					echo '<td class="ptype_days" scope="col"></td>'; }
					echo "</tr>";
				?>

<tr>
        <td class="prj" scope="col"><?php echo gettext('All hours'); ?></td>
        <td class="index" scope="col"></td>
        <td class="aprv" scope="col"></td>
        <td class="time" scope="col"><?php echo $overtime_hday_arr[50]['sum_over_hours']; ?></td>
<?php 

for ($day='1';$day < $days_month;$day++){
				if ( $overtimes[$day]['holyday'] == 'Y' )  {
												echo '<td class="days_holyday" scope="col">'.$overtimes[$day]['all_hours'].'</td>';
								}else {
												echo '<td  class="days" scope="col">'.$overtimes[$day]['all_hours'].'</td>';	
				}
			}
			for ($empty=0; $empty < $emptyCells; $empty++)
			{ # Empty dates here, waitin for langoliers
				echo '<td class="ptype_days" scope="col"></td>'; }
				echo "</tr>";





	
?>
</table>
<input type="hidden" name="month" value="<?php echo $month;?>">
<input type="hidden" name="year" value="<?php echo $year;?>">
<input type="hidden" name="user_id" value="<?php echo $user_index;?>">
<br><center><input class="ok" type="submit" value="OK" /></center>
</form>
Return current item: Opensheet