<li class="select-current">

<?php 



$database->setBareQuery("SELECT parent FROM project WHERE id = '".$project[$i]."'");

$selected_client_id = $database->loadResult();

$time_dur = explode(".", $duration[$i]);

$hours = $time_dur[0];

if ($time_dur[1] == 5):

	$minutes = 30;
	
else:

	$minutes = 0;
	
endif;



?>



	<fieldset>
    
    	<select id="<?=$i?>-<?=$day?>-client" class="forms <?=$day?>" >
        
			<option value="default">Izaberi klijenta</option>
            
            <?php 
				
				$database->setBareQuery("SELECT id, name FROM client ORDER BY name");

				$clientid = $database->loadResultArray(0);
		
				$clientname = $database->loadResultArray(1);
		
				for($z = 0; $z < count($clientid); $z++): 
			
			?>
            <option value="<?=$clientid[$z]?>"<?php if($clientid[$z] == $selected_client_id) { echo " selected = 'selected'";}?>><?=$clientname[$z]?></option>
            
            <?php endfor; ?>
            
		</select>  
        
	</fieldset>
    
     <div id="project-holder-<?=$day?><?=$i?>">
    
<fieldset>
    
    	<select id="<?=$i?>-<?=$day?>-project" class="forms project" >
        
			<option value="default" selected="selected">Izaberi projekat</option>
            
                    
            <?php 
				
				$database->setBareQuery("SELECT id, name, project_num, project_year FROM project WHERE parent = '".$selected_client_id."' ORDER BY project_year DESC, project_num DESC");

				$project_id = $database->loadResultArray(0);
		
				$projectname = $database->loadResultArray(1);
				
				$projectnum = $database->loadResultArray(2);
				
				$projectyr = $database->loadResultArray(3);
		
				for($w = 0; $w < count($project_id); $w++): 
				
				if($projectnum[$w] < 100){if($projectnum[$w]<10){$visiblenum = '00'.$projectnum[$w];}else{$visiblenum = '0'.$projectnum[$w];}}
				else {$visiblenum = $projectnum[$w];}
			
			?>
            <option value="<?=$project_id[$w]?>"<?php if($project_id[$w] == $project[$i]) { echo " selected = 'selected'";}?>><?=$projectyr[$w].$visiblenum.' '.$projectname[$w]?></option>
            
            <?php endfor; ?>
            
		</select>  
    
    	
    
    </fieldset>
    
</div>
    
    <?php 
				if($day != 'saturday') {

				$date = $explode[2]."-".$explode[1]."-".$explode[0];

$database->setBareQuery("SELECT id, project, duration FROM task WHERE date = '".$date."' AND user = '".$user."'");

}

else {
	
	$weekend = explode("/", $explode[0]);
	
	$date = $explode[2]."-".$explode[1]."-".$weekend[0];
	
}

				
			
			?>

    

     
	<fieldset>
        
		<input type="text" value="<?=$description[$i]?>" class="forms input description" id="<?=$i?>-<?=$day?>-desc" />
       
	</fieldset> 
        
     <fieldset>

            <select id="<?=$i?>-<?=$day?>-hour" class="forms-duration <?=$day?>-time">
            
            	<option value="0">0</option>
            
            	<?php for($g = 1; $g < 15; $g++): ?>
        
				<option value="<?=$g?>"<?php if($g == $hours) { echo "selected = 'selected'"; $_SESSION[$day.$i] = $g; }?>><?=$g?></option>
                
                <?php endfor; ?>
            
       		</select>
            
            <span class="left"> sati </span>
       
       		<select id="<?=$i?>-<?=$day?>-minute" class="forms-duration <?=$day?>-time">
        
				<option value="0" <?php if($minutes == 0) { echo "selected = 'selected'"; $_SESSION[$day.$i.$minutes] = 0;}?>>0</option>
                
                <option value="0.5" <?php if($minutes == 30) { echo "selected = 'selected'"; $_SESSION[$day.$i.$minutes] = 30;}?>>30</option>
            
       		</select>
            
            <span class="left"> min. </span>
            
            </fieldset>
            
			<input type="hidden" id="<?=$i?>-<?=$day?>-status" value="old" />
      		
			


</form>

</li>
	
