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



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


<div class="well">

      <ul class="tabs"> 
        <li><a href="#view1">Programme Details</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 * FROM programmes WHERE id = '$id'";
		  $r = mysqli_query(dbc(),$q);
				
		  if(!$r) { die(mysql_error()); }
		
			  
			  if(mysqli_num_rows($r) > 0)
			  {//begin if result exist
				  while($row = mysql_fetch_array($r, MYSQLI_ASSOC))
				  {//begin while
		?>
        						
                               
        	<!-- form cut to the toolbar add faculties -->
         	<div class="col-lg-12">
            
            	<div class="col-lg-6">
            <!--
             				<input type="hidden" name="MAX_IMAGE_FILE_SIZE" value="MAX_IMAGE_FILE_SIZE" />
                            <input type="hidden" name="MAX_CS_PDF_FILE_SIZE" value="MAX_CS_PDF_FILE_SIZE" />
                            <input type="hidden" name="MAX_PDF_FILE_SIZE" value="MAX_PDF_FILE_SIZE" />-->
             	
             			<fieldset> 
                            <legend><span class="ast">*</span> indicate required fields </legend>
      

                                                    
                          <div class="form-group">
                                <label for="title" class="col-sm-3 control-label">Title </label>
                                <div class="col-sm-9">
                                  <div class="input-group">
                                  <input  id="title" class="form-control input-sm" type="text" placeholder="Title"  name="title" 
                                 value="<?php echo $row['title']; ?>" required></input>
                                  <div class="input-group-addon"> <span class="ast">*</span></div>
                                  </div>
                                   
                                </div>
                             </div>
                             
                               <div class="form-group">
                              <label for="code" class="col-sm-3 control-label">Programme Code</label>
                              <div class="col-sm-9">
                              	<div class="input-group">
                                <input  id="code" class="form-control input-sm" type="text" placeholder="Programme Code"  name="code" 
                                value="<?php echo $row['code']; ?>" required></input>
                                <div class="input-group-addon"> <span class="ast">*</span></div>
                                </div>
                                    <span class="help-block"> e.g: Computer Science : CSC, Mathematics :MTH etc </span>
                              </div>
                           </div>
                           
                             <div class="form-group">
                              <label class="col-sm-3 control-label" for="department">Department</label>
                              <div class="col-sm-9">
                              
                                <select id="department" class="form-control input-sm" name="department" required>
                                 <option value="0"> ---- Choose Department --- </option> 
                               <?php select_department($row['department_id']); ?>
                                  
                                 </select>
                              
                                 
                              </div>
                              
                            </div>	
                            
                              <div class="form-group">
                              <label class="col-sm-3 control-label" for="programme_type">Programme Type</label>
                              <div class="col-sm-9">
                              
                                <select id="programme_type" class="form-control input-sm" name="programme_type" required>
                                <?php  echo select_programme_type($row['type_id']); ?>
                                </select>
                               <span class="help-block">Dip  or Ad Dip</span>
                              </div>
                              
                            </div>
                            
                            
                            
                            
                               <div class="form-group">
                                  <label for="utme_duration" class="col-sm-3 control-label">Duration</label>
                                  <div class="col-sm-9">
                                    <div class="input-group">
                                    <input  id="utme_duration" class="form-control input-sm" type="text" placeholder="Duration"  name="utme_duration" 
                                    value="<?php if(isset($row['duration'])) echo $row['duration']; ?>" required></input>
                                    <div class="input-group-addon"> <span class="ast">*</span></div>
                                    </div>
                                        <span class="help-block"> e.g: Enter 3 for 2yrs </span>
                                  </div>
                               </div>	
                               
                               
                                 <div class="form-group">
                                  <label for="utme_max_duration" class="col-sm-3 control-label">MAX Duration</label>
                                  <div class="col-sm-9">
                                    <div class="input-group">
                                    <input  id="utme_max_duration" class="form-control input-sm" type="text" placeholder="MAX Duration"  name="utme_max_duration" 
                                    value="<?php if(isset($row['maximum_duration'])) echo $row['maximum_duration']; ?>" required></input>
                                    <div class="input-group-addon"> <span class="ast">*</span></div>
                                    </div>
                                        
                                  </div>
                               </div>	
                           
                           <?php /*?>
                                 <div class="form-group">
                                  <label for="de_duration" class="col-sm-3 control-label">DE Duration</label>
                                  <div class="col-sm-9">
                                    <div class="input-group">
                                    <input  id="de_duration" class="form-control input-sm" type="text" placeholder="DE Duration"  name="de_duration" 
                                    value="<?php if(isset($row['de_duration'])) echo $row['de_duration']; ?>" required></input>
                                    <div class="input-group-addon"> <span class="ast">*</span></div>
                                    </div>
                                        <span class="help-block"> e.g: Enter 6 for 6yrs </span>
                                  </div>
                               </div>	
                           
                           
                           
                                 <div class="form-group">
                                  <label for="de_max_duration" class="col-sm-3 control-label">DE MAX Duration</label>
                                  <div class="col-sm-9">
                                    <div class="input-group">
                                    <input  id="de_max_duration" class="form-control input-sm" type="text" placeholder="DE MAX Duration"  name="de_max_duration" 
                                    value="<?php if(isset($row['de_maximum_duration'])) echo $row['de_maximum_duration']; ?>" required></input>
                                    <div class="input-group-addon"> <span class="ast">*</span></div>
                                    </div>
                                        <span class="help-block"> e.g: Enter 6 for 6yrs </span>
                                  </div>
                               </div>	<?php */?>
                               
                               
                                <div class="form-group">
                                  <label for="min_credit_load" class="col-sm-3 control-label">Minimum Credit Load</label>
                                  <div class="col-sm-9">
                                  
                                    <input  id="min_credit_load" class="form-control input-sm" type="text" placeholder="Minimum Credit Load"  name="min_credit_load" 
                                    value="<?php if(isset($row['minimum_credit_load'])) echo $row['minimum_credit_load']; ?>" required></input>
                                   
                                  </div>
                               </div>	
                               
                               
                               
                               
                               
                                <div class="form-group">
                                  <label for="max_credit_load" class="col-sm-3 control-label">Maximum Credit Load</label>
                                  <div class="col-sm-9">
                                   
                                    <input  id="max_credit_load" class="form-control input-sm" type="text" placeholder="Maximum Credit Load"  name="max_credit_load" 
                                    value="<?php if(isset($row['maximum_credit_load'])) echo $row['maximum_credit_load']; ?>" required></input>
                                   
                                       
                                  </div>
                               </div>	
                           
                           
                           
                           
                           
                        <?php /*?> <div class="form-group">
                          <label class="col-sm-3 control-label" for="philosophy">History / Philosophy</label>
                            <div class="col-sm-9">
                            
                              <textarea  id="" rows="3" class="form-control input-sm" name="philosophy" action="#" >
                              <?php echo $row['philosophy_history']; ?>
                              </textarea>
                            </div>
                          </div>
                          
                          
                          
                          
                           <div class="form-group">
                          <label class="col-sm-3 control-label" for="objectives">Objectives</label>
                            <div class="col-sm-9">
                            
                              <textarea  id="" rows="3" class="form-control input-sm" name="objectives" action="#" >
                              <?php if(isset($row['objectives'])){echo $row['objectives'];} ?>
                              </textarea>
                            </div>
                          </div>
                          
                       <?php */?>
						    
                     		</div><!-- /col-lg- 6 -->
                            <div class="col-lg-6">
                            
                            	   <br /><br />
                  
                  		  <?php /*?><div class="form-group">
                          <label class="col-sm-3 control-label" for="mission">Mission</label>
                            <div class="col-sm-9">
                            
                              <textarea  id="" rows="3" class="form-control input-sm" name="mission" action="#" >
                              <?php if(isset($row['mission'])){echo $row['mission'];} ?>
                              </textarea>
                            </div>
                          </div>
                          
                          
                          <div class="form-group">
                          <label class="col-sm-3 control-label" for="vision">Vision</label>
                            <div class="col-sm-9">
                            
                              <textarea  id="" rows="3" class="form-control input-sm" name="vision" action="#" >
                              <?php if(isset($row['vision'])){echo $row['vision'];} ?>
                              </textarea>
                            </div>
                          </div>
                          
                          
                          
                           <div class="form-group">
                          <label class="col-sm-3 control-label" for="entry_requirements">Entry Requirements</label>
                            <div class="col-sm-9">
                            
                              <textarea  id="" rows="3" class="form-control input-sm" name="entry_requirements" action="#" >
                              <?php if(isset($row['entry_requirements'])){echo $row['entry_requirements'];} ?>
                              </textarea>
                            </div>
                          </div>
                          
                           <div class="form-group">
                                <label class="col-sm-3 control-label" for="image">Programme Image</label>
                                <div class="col-sm-9">
                               
                                <input    name="image" class="form-control input-sm"  type="file"  ></input>
                              
                               
                                  <span class="text-danger"><?php if(isset( $_SESSION['image_result_message'])){echo  $_SESSION['image_result_message'];} ?></span>
                                
                                
                                  <span class="help-block"> Attach image if any. </span>
                                  <span class="help-block"> Upload  Image less than 100kb., Image must be atleast 1000px to 350px  . </span>
                                  
                               
                                </div>
                                
                              </div>
                              
                              
                           
                                
                           
                              
                                 <div class="form-group">
                                  <label class="col-sm-3 control-label" for="course_structures">Course Structures</label>
                                  <div class="col-sm-9">
                                 
                                  <input    name="cs_pdf_file" class="form-control input-sm"  type="file"  ></input>
                                
                                 
                              
                                  <span class="text-danger"><?php if(isset( $_SESSION['cs_pdf_file_result_message'])){echo  $_SESSION['cs_pdf_file_result_message'];} ?></span>
                                            
                                  
                                    <span class="help-block"> Attach if any. </span>
                                    <span class="help-block"> Upload  PDF less than 50kb., PDF file should contain break down of courses associated with the programme . </span>
                                    
                                 
                                  </div>
                                  
                                </div>      
                                   
                                
                                
                               <div class="form-group">
                                  <label class="col-sm-3 control-label" for="image">Detailed PDF File</label>
                                  <div class="col-sm-9">
                                 
                                  <input    name="pdf_file" class="form-control input-sm"  type="file"  ></input>
                                
                                 
                              
                                  <span class="text-danger"><?php if(isset( $_SESSION['pdf_file_result_message'])){echo  $_SESSION['pdf_file_result_message'];} ?></span>
                                            
                                  
                                    <span class="help-block"> Attach if any. </span>
                                    <span class="help-block"> Upload  PDF less than 30kb., PDF file can contain more information about the department . </span>
                                    
                                 
                                  </div>
                                  
                                </div>
                          <?php */?>  
                           
                               <div class="form-group">
                                <label class="col-sm-3 control-label" for="description">Note / Description</label>
                                  <div class="col-sm-9">
                                  
                                    <textarea  id="" rows="3" class="rte1 form-control input-sm" name="description" action="#" >
                                   <?php  echo $row['description']; ?>
                                    </textarea>
                                  </div>
                                </div>
                          
                          
                         
                        
                        
                                   
                               <div class="form-group">
                                <label class="col-sm-3 control-label" for="status">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>	
                        
								
                                
                                
                                <input type="hidden" value="update_programmes" name="act" />
                                <input type="hidden" value="TRUE" name="update_programmes" /><!-- pass value for editing -->
                                <input type="hidden" value="<?php echo $row['id']; ?>" name="programmes" id='programmes' />
                                <!-- pass id value incase he didnt fill well den bring bk for editing -->
                  				
                                
                                
                                
                               <?php /*?>       
                           		<input type="hidden" value="TRUE" name="upload" /><!--   -->
                                <input type="hidden" value="TRUE" name="upload_cs_pdf_list" /><!-- staff pdf list details -->
                            	<input type="hidden" value="TRUE" name="upload_pdf_details" /><!-- pdf more details -->    
		  <?php */?>
                            
                            
                            </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
?>
