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



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


<div class="well">

      <ul class="tabs"> 
        <li><a href="#view1">User Group 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 user_groups WHERE user_group_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 -->
        					 
                	<div class="col-lg-12">
                    
                        <div class="col-lg-6">
                    
                                <fieldset> 
                                    <legend><span class="ast">*</span> indicate required fields </legend>
                                    
                            <div class="form-group">
                                    <label for="title" class="col-sm-4 control-label">Title</label>
                                    <div class="col-sm-8">
                                      <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>
                                       <span class="help-block"> e.g: _users  </span>
                                    </div>
                                 </div>
                                   
                             <br/>
                             
                              <div class="form-group">
                                <label for="header_menu" class="col-sm-4 control-label">Header Menu Privileges</label>
                                <div class="col-sm-8">
                                  <div class="input-group">
                                  <input  id="header_menu" class="form-control input-sm" type="text" placeholder="Header Menu"  name="header_menu"
                                  value="<?php echo $row['header_menu']; ?>"   required></input>
                                  <div class="input-group-addon"> <span class="ast">*</span></div>
                                  
                                  </div>
                                   <span class="help-block"> e.g: 1,2,3,4,  </span>
                                </div>
                             </div>
                             
                                 <br/>
                             <div class="clearfix"></div>
                               <div class="form-group">
                                <label for="toolbar_menu" class="col-sm-4 control-label">Toolbar Menu Privileges</label>
                                <div class="col-sm-8">
                                  <div class="input-group">
                                  <input  id="toolbar_menu" class="form-control input-sm" type="text" placeholder="Tool Menu"  name="toolbar_menu"
                                  value="<?php echo $row['toolbar_menu']; ?>"   required></input>
                                  <div class="input-group-addon"> <span class="ast">*</span></div>
                                   
                                  </div>
                                   <span class="help-block"> e.g: 1,2,3,4,  </span>
                                </div>
                             </div>
                                    <br/>   
							<div class="form-group">
                                <label for="home_menu" class="col-sm-4 control-label">Home Menu Privileges</label>
                                <div class="col-sm-8">
                                  <div class="input-group">
                                  <input  id="home_menu" class="form-control input-sm" type="text" placeholder="Home Menu"  name="home_menu"
                                  value="<?php echo $row['home_menu']; ?>"   required></input>
                                  <div class="input-group-addon"> <span class="ast">*</span></div>
                                   
                                  </div>
                                   <span class="help-block"> e.g: 1,2,3,4,  </span>
                                </div>
                             </div>
                                 <br/> <br/>
                                 <div class="form-group">
                                <label for="textarea" class="col-sm-4 control-label" >Description</label>
                                  <div class="col-sm-8"> 
                                   <div class="input-group">
                                  <textarea cols = "70" rows = "10" name="description" class="form-control rte1" action="#" >
                                  <?php  echo $row['description']; ?> </textarea> 
                                    </div>
                                </div>
                              </div>
                           
                       
                   
                    
             
                   
                                
                      <input type="hidden" value="update_user_groups" name="act" />
                      <input type="hidden" value="TRUE" name="update_user_groups" /><!-- pass value for editing -->
                      <input type="hidden" value="<?php echo $row['user_group_id']; ?>" name="user_group" id='user_group' />
                      <!-- pass id value incase he didnt fill well den bring bk for editing -->
      
		  
               
							          
                      </fieldset>
                   
                   
                     </div><!-- /col-lg- 6 -->
                     
                     <div class="col-lg-6"> </div><!-- /col-lg- 6 -->
                      
                    
                   
                </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 associated
?>
