<?php
//this page brings out a static form editing a project  



if($_GET['act'] == 'add_supplementry_programmes_courses')
{
	  //$id_array = $_POST['id']; // return array
	  //$id_count = count($_POST['id']); // count array
	  
	  $id = $_GET['id'];
	  
?>

<div class="well">

      <ul class="tabs"> 
        <li><a href="#view1">Attach Course to Programmes (supplementary)</a></li> 
      </ul> 
      <div class="tabcontents"> 
          <div id="view1" class="row">
          
          
            <?php 
		
			//for($i=0; $i < $id_count; $i++) 
			//{
			  //$id = $id_array[$i];
			  $q = "SELECT  `programme_id`,`programme_type_id`, `id`, `department_id`,  `course_id`, `seen_as_elective`, `session_id`,
			   `level`, `status`, `token`
			   FROM programmes_courses_nce 
			   WHERE token = '$id'
			   GROUP BY token
			   ";
			  $r = mysql_query($q);
					
			  if(!$r) { die(mysql_error()); }
			
				  
				  if(mysql_num_rows($r) > 0)
				  {//begin if result exist
					  while($row = mysql_fetch_array($r, MYSQL_ASSOC))
					  {//begin while
			?>
        				
        
        
              <!-- form cut to the toolbar add programmes courses -->
              <div class="col-lg-12">
              
                  <div class="col-lg-8">
              
               
                  
                          <fieldset> 
                              <legend><span class="ast">*</span> indicate required fields </legend>
        
                             
                         	  <div class="form-group">
                                <label class="col-sm-3 control-label" for="level">Level</label>
                                <div class="col-sm-9">
                                   <div class="input-group">
                                    
                                  <select  class="form-control input-sm" name="level"  id="level" disabled>
                                    <option value="0" >-- Choose Year --</option>
                                    <option value="I" <?php if($row['level'] == 'I') echo 'selected'; ?>>Year One</option>
                                    <option value="II" <?php if($row['level'] == 'II') echo 'selected'; ?>>Year Two</option>
                                    <option value="III" <?php if($row['level'] == 'III') echo 'selected'; ?>>Year Three</option>
                                    <option value="PRE" <?php if($row['level'] == 'PRE') echo 'selected'; ?>>PRE</option>

                                  </select>
                          			<div class="input-group-addon"><span class="ast">*</span></div>
                                    
                                    </div>
                                   
                                </div>
                                
                              </div>
                              
                              
                              <div class="form-group">
                                <label class="col-sm-3 control-label" for="programme_type">Programme Type</label>
                                <div class="col-sm-9">
                                  <div class="input-group">
                                
                                  <select id="search_prog_type_id" class="form-control input-sm" name="programme_type" disabled>
                                  <?php  echo select_programme_type($row['programme_type_id']); ?>
                                  </select>
                                    
                                 
                                      <div class="input-group-addon"><span class="ast">*</span></div>
                                    
                                    </div>
                                    
                                     <span class="help-block">PRE-NCE / NCE or DEG</span>
                                </div>
                                
                              </div>
                          
                         
                         
                         
                          
                             <div class="form-group">
                            <label class="col-sm-3 control-label" for="search_department_id">Department</label>
                            <div class="col-sm-9">
                            
                              <div  class="input-group">
                              <select  class="form-control input-sm" name="search_department"  id="search_department_id" disabled >
                               <option value="0"> ---- Choose Department --- </option> 
                              <?php  echo select_department($row['department_id']); ?>
                                
                               </select>
                            
                                  	<div class="input-group-addon"><span class="ast">*</span></div>
                                    
                                    </div>
                                </div>
                            
                          	</div>
                            
                          
                            
                            
                            <div class="form-group" id="show_programme">
                            <label class="col-sm-3 control-label" for="programme_id">Programme</label>
                            	<div  class="col-sm-9"  ><!---->
                          
                         	    <!--<img src="images/loader.gif"  id="loader1" alt="please wait" />-->	
                          		   <div class="input-group">
                                      <select   name="programmes"   class="form-control input-sm" disabled>
      
                                   
                                      <?php  echo select_programme($row['programme_id']); ?>
                                      </select>	
                                  
                                  	<div class="input-group-addon"><span class="ast">*</span></div>
                                    
                                    </div> 
                             	</div>
                              
                         
                            
                          	</div>	
                            
                          
                          
                          	 <div class="form-group">
                            <label class="col-sm-3 control-label" for="courses">Choose courses from departments / levels</label>
                              <div class="col-sm-9" style="min-height:200px; min-width:200px; height:auto;">
                              
                               
                          
                                <br><br>
                            	<div class="input-group">
                                <div class="input-group-addon"> Level <span class="ast">*</span></div>
                                <select  class="form-control input-sm" name="level2"  id="levl">
                                    <option value="0" >-- Choose Year --</option>
                                    <option value="I" <?php if($row['level'] == 'I') echo 'selected'; ?>>Year One</option>
                                    <option value="II" <?php if($row['level'] == 'II') echo 'selected'; ?>>Year Two</option>
                                    <option value="III" <?php if($row['level'] == 'III') echo 'selected'; ?>>Year Three</option>
                                    <option value="PRE" <?php if($row['level'] == 'PRE') echo 'selected'; ?>>PRE</option>

                                   
                                  </select>
                               
                                </div>    <!-- / level -->
                                
                                
                                <br>
                                
                                  <div class="input-group">
                                	<div class="input-group-addon"> Department <span class="ast">*</span></div>
                                  
                                    <select  class="form-control input-sm" name="department2"  id="search_department_id2" >
                                     <option value="0"> ---- Choose Department --- </option> 
                                    <?php  echo select_department($row['department']); ?>
                                      
                                     </select>
                                  
                                  </div>
                                  
                                  <br>
                                  <p align="center"><img src="images/loader.gif"  id="loader2" alt="please wait" />	</p>
                         
                                  
                                  <div id="show_courses">
                                  	 
                                  </div><!-- / show courses -->
                            
                                
                                 <span class="help-block">Here select level and department you want to pick a course from, then check the courses</span>
                              </div>
                              
                              
                              
                              
                             
                          
                              
                             
                            </div>   
                      
                               
                         
                         
                                    
                       <div class="form-group">
                            <label class="col-sm-3 control-label" for="gender">Status</label>
                            <div class="col-sm-9">
                            
                              <select id="status" class="form-control input-sm" name="status" required>
                                
                              <?php  echo select_status($row['status']); ?>
                                
                               </select>
                            
                               
                            </div>
                            
                          </div>	
                                 
                           
                         
                           
                           
                    
                              					
                  </div><!-- /col-lg- 6 -->
                  <div class="col-lg-4">
                  		<br /> <br />
                  	         
                          
                          
                          
                          
                             
                         <h4>Instructions on how to add  courses to programmes /level (courses to offer)</h4>
                    
                        <ol class="list-group">
                        <li class="list-group-item">1-  First level, is the level that you want to set the courses <b>FOR</b></li>
                        <li class="list-group-item">2 - First department is the department you want to set the courses <b>FOR</b> </li>
                        <li class="list-group-item">3 - Programme is the programme you want to set the courses <b>FOR</b> </li>
                       
                       
                       
                          <ul class="list-list-group">
                            
                             
                             <li class="list-group-item"> 3a- Second level is the level you want to choose the course(s) <b>FROM</b>
                             </li>
                             
                             <li class="list-group-item"> 3b- Second department is the department you want to choose the course(s) <b>FROM</b></li>
                             <li class="list-group-item"> 3c- Check list all the courses you want to attach as (courses to offer by a particular programme per level)
                             </li>
                             
                              <li class="list-group-item"> 3d- Finally, by the right hand side of every course, there is a button to switch yes,
                               if a course is taken as an elective in every attachments.
                             </li>
                          
                            </ul> 
                        
                        </li>
                      
                        <li class="list-group-item">4- Users must beware of status functionality - "when to publish and when not to publish".</li>
                        </ol>
                          
                          
                       
                                
							
                                
					  
                      
                         <input type="hidden" value="update_programmes_courses" name="act" />
                         <input type="hidden" value="TRUE" name="update_programmes_courses" /><!-- pass value for editing -->
                         <input type="hidden" value="<?php echo $row['token']; ?>" name="programmes_courses" id='programmes_courses' />
                  		 <input type="hidden" value="<?php echo $row['level']; ?>" name="level"  />
                         <input type="hidden" value="<?php echo $row['department_id']; ?>" name="search_department"  />
                         <input type="hidden" value="<?php echo $row['programme_id']; ?>" name="programmes"  />
                         <input type="hidden" value="<?php echo $row['programme_type_id']; ?>" name="programme_type"  />
                 
                  </div><!-- /col-lg- 6 -->
                  </fieldset>
              
              
                
               
			</div><!-- / col-lg -12 -->
							
 		</form>
        
        <?php
				  }//end of if
				  }//end of while
	
			//  }//end of for loop
	?>


        
        </div> 
      </div>
</div>

<?php 

}//end of if post edit project
?>
