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



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


<div class="well">

      <ul class="tabs"> 
        <li><a href="#view1">Department 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 departments 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">
            
             
            		<?php /*?><input type="hidden" name="MAX_IMAGE_FILE_SIZE" value="MAX_IMAGE_FILE_SIZE" />
                    <input type="hidden" name="MAX_STAFF_PDF_FILE_SIZE" value="MAX_STAFF_PDF_FILE_SIZE" />
                    <input type="hidden" name="MAX_PDF_FILE_SIZE" value="MAX_PDF_FILE_SIZE" />
                    <input type="hidden" name="MAX_HOD_FILE_SIZE" value="MAX_HOD_FILE_SIZE" />  
             	<?php */?>
             			<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 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>	
						     
                         
                           
                 <?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 if(isset($row['history_introduction'])){echo $row['history_introduction'];} ?>
                              </textarea>
                            </div>
                          </div>
                          
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="image">Department Logo</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 50kb., Image must be atleast 150px to 150px  . </span>
                                  
                               
                                </div>
                                
                              </div>
                              
                             <div class="form-group">
                              <label for="code" class="col-sm-3 control-label">Department Location </label>
                              <div class="col-sm-9">
                             
                                <input  id="location" class="form-control input-sm" type="text" placeholder="Location"  name="location" 
                                value="<?php if(isset($row['location'])) echo $row['location']; ?>" ></input>
                            
                                 <span class="help-block"> e.g Complex B. </span>
                                  
                              </div>
                           </div>
                           
                            <div class="form-group">
                              <label for="contacts" class="col-sm-3 control-label">Phone Contacts </label>
                              <div class="col-sm-9">
                             
                                <input  id="contacts" class="form-control input-sm" type="text" placeholder="Contacts"  name="contacts" 
                                value="<?php if(isset($row['phone_contacts'])) echo $row['phone_contacts']; ?>" ></input>
                            
                                 <span class="help-block"> e.g +234 8076306088, +234 8097667783. </span>
                                  
                              </div>
                           </div>
                        
                        <div class="form-group">
                              <label for="email" class="col-sm-3 control-label">Department's Email </label>
                              <div class="col-sm-9">
                             
                                <input  id="email" class="form-control input-sm" type="text" placeholder="Email"  name="email" 
                                value="<?php if(isset($row['email'])) echo $row['email']; ?>" ></input>
                            
                                
                                  
                              </div>
                           </div>
                           
                              
                           <div class="form-group">
                          <label class="col-sm-3 control-label" for="faculty">Faculty</label>
                          <div class="col-sm-9">
                          
                            <select id="faculty" class="form-control input-sm" name="faculty" required>
                             <option value="0"> ---- Choose Faculty --- </option> 
                            <?php  echo select_faculty($row['faculty_id']); ?>
                              
                             </select>
                          
                             
                          </div>
                          
                        </div>	
                         <div class="form-group">
                                  <label class="col-sm-3 control-label" for="image">Staff List</label>
                                  <div class="col-sm-9">
                                 
                                  <input    name="staff_pdf_file" class="form-control input-sm"  type="file"  ></input>
                                
                                 
                              
                                  <span class="text-danger"><?php if(isset( $_SESSION['staff_pdf_file_result_message'])){echo  $_SESSION['staff_pdf_file_result_message'];} ?></span>
                                            
                                  
                                    <span class="help-block"> Attach if any. </span>
                                    <span class="help-block"> Upload  PDF less than 30kb., PDF file should contain the list of all staff . </span>
                                    
                                 
                                  </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="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>
                              
                              
                         <div class="form-group">
                              <label for="hod" class="col-sm-3 control-label">HOD's Name </label>
                              <div class="col-sm-9">
                             
                                <input  id="hod_name" class="form-control input-sm" type="text" placeholder="HOD's Name"  name="hod_name" 
                                value="<?php if(isset($row['hod_name'])) echo $row['hod_name']; ?>" ></input>
                            
                                
                                    <span class="help-block"> e.g: PROF. OBIALOM CHILOM </span>
                              </div>
                           </div>
                           
                        <div class="form-group">
                            <label class="col-sm-3 control-label" for="image">HOD's Image</label>
                            <div class="col-sm-9">
                           
                            <input    name="hod_image" class="form-control input-sm"  type="file"  ></input>
                          
                           
                        
                            <span class="text-danger"><?php if(isset( $_SESSION['hod_image_result_message'])){echo  $_SESSION['hod_image_result_message'];} ?></span>
                  
                            
                              <span class="help-block"> Attach image if any. </span>
                              <span class="help-block"> Upload  Image less than 50kb., Image must be atleast 180px to 180px  . </span>
                              
                           
                            </div>
                       
                       <?php */?>
                       
                      		
							
                                
                                
                                <input type="hidden" value="update_departments" name="act" />
                                <input type="hidden" value="TRUE" name="update_departments" /><!-- pass value for editing -->
                                <input type="hidden" value="<?php echo $row['id']; ?>" name="departments" id='departments' />
                                <!-- pass id value incase he didnt fill well den bring bk for editing -->
                                
                                
                                 
                           	<?php /*?>	<input type="hidden" value="TRUE" name="upload" /><!-- ddepartment logo  -->
                                <input type="hidden" value="TRUE" name="upload_staff_pdf_list" /><!-- staff pdf list details -->
                            	<input type="hidden" value="TRUE" name="upload_pdf_details" /><!-- pdf more details -->
                              	<input type="hidden" value="TRUE" name="upload_hod_image" /><!-- hod_image  -->
                  <?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
?>
