<?php 
session_start();
require '../dao/Profile.php';
$success = "";
$err = "";
if (isset($_GET['id'])) {
	$id = $_GET['id'];

$class_list = $profile->get_class_list();
$all_staff = $profile->get_all_staff();
$subject_list = $profile->get_subject_list();
$load_classes = $profile->get_subjects($_SESSION['staff_id']);
$roles = $profile->get_all_roles();
$all_classes = $profile->get_all_classes();
?>
<option> -- Select a Class --</option>
														<?php 
														
														if ($all_classes) {
															
															$subject_name = "";	
															$class_name = "";
															foreach ($all_classes as $class) {
																$label = "";
															$if_assigned = $profile->verify_if_subject_assigned($id,$class['class_id']);
															  	if ($if_assigned) {
															  		$i=0;
															  		foreach($if_assigned as $assigned){
															  			$i++;
															  		$subject_name = $profile->get_subject($assigned['subject_id']);
															  		if($i<sizeof($if_assigned)){
															  			if ($assigned['staff_id']==$id) {
															  			$label .= '('.$subject_name[0]['subject_name'].'),';
															  		}else{
															  			$label .= $subject_name[0]['subject_name'];
															  		}
															  			
															  		}else{
															  			if ($assigned['staff_id']==$id) {
															  			$label .= '('.$subject_name[0]['subject_name'].')';
															  		}else{
															  			$label .= $subject_name[0]['subject_name'];
															  		}
															  		}
															  		}
															  		
															  	}
																$class_name = $profile->get_class($class['class_id']);
																?>
															  		
															<option value="<?php echo $class['class_id'] ?>"><?php echo $class_name[0]['class_name'] ?> - <span style="color: #F1DA91"><?php echo $label; ?></span></option>	

																<?php
															}
														}
														 ?>
<?php } ?>