<?php

////////////////////// FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////

if (!function_exists('modal_diag')) {
	function modal_diag($settings){
if (array_key_exists('modal_id', $settings)) {
   $modal_id=$settings['modal_id'];
   }
   if (array_key_exists('modal_heading', $settings)) {
   $modal_heading=$settings['modal_heading'];
   }
   if (array_key_exists('label', $settings)) {
   $label=$settings['label'];
   }
   if (array_key_exists('input_id', $settings)) {
   $input_id=$settings['input_id'];
   }
   if (array_key_exists('input_name', $settings)) {
   $input_name=$settings['input_name'];
   }
   if (array_key_exists('btn_name', $settings)) {
   $btn_name=$settings['btn_name'];
   }
   if (array_key_exists('btn_id', $settings)) {
   $btn_id=$settings['btn_id'];
   }
   if (array_key_exists('parent_label', $settings)) {
   $parent_label=$settings['parent_label'];
   }
   if (array_key_exists('parent_ref', $settings)) {
   $parent_ref=$settings['parent_ref'];
   }
   if (array_key_exists('parent_encoding', $settings)) {
   $encoding=$settings['parent_encoding'];
   }
   if (array_key_exists('parent_id', $settings)) {
   $parent_form_id=$settings['parent_id'];
   }
   if (array_key_exists('parent_name', $settings)) {
   $parent_form_name=$settings['parent_name'];
   }
   if (array_key_exists('table_name', $settings)) {
   $table_name=$settings['table_name'];
   }
   if (array_key_exists('table_title', $settings)) {
   $table_title=$settings['table_title'];
   }
   if (array_key_exists('table_id', $settings)) {
   $table_id=$settings['table_id'];
   }
    
   ?>
   <!-- PAGE FUNCTION MODAL STARTS (c) i2d Technologies Website Engine -->
  <div id="<?php echo $modal_id; ?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                                    <h4 class="modal-title"><?php echo $modal_heading; ?></h4>
                                                </div>
                                                <div class="modal-body">
<?php                                                   
if(isset($parent_ref) && !empty($parent_ref)){ 
?>
												   <div class="row">
													<div class="col-md-12">
													
													
			

         <h5><?php echo $parent_label; ?></h5>
   
 <select class="form-control" tabindex="-1" aria-hidden="true" id="<?php echo $parent_form_id; ?>" 
 name="<?php echo $parent_form_name; ?>">
<?php
      
      
$db_settings_parent=array(
'ref_value'=>$parent_ref,
'table'=>$table_name,
'type'=>'3');

$loadresults_parent=db_fetch($db_settings_parent);

  foreach ($loadresults_parent as $item_parent) {
  $mot_parent=$item_parent[$table_title];
?>
<option value="<?php echo $item_parent[$table_id]; ?>"><?php if($encoding!=0){echo decode($mot_parent);}
  else {echo $mot_parent;} ?></option>
  <?php } ?>
  			  </select>
				  
              
              </div>
													
													</div>
<?php
}
?>

													
													<div class="row">
                                                        <div class="col-md-12">
                                                            <div class="form-group">
                                                                <label for="field-3" class="control-label"><?php echo $label; ?></label>
                                                                <input type="text" class="form-control" id="<?php echo $input_id; ?>" name="<?php echo $input_name; ?>">
                                                            </div>	
                                                        </div>
                                                    </div>
                                                    
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-default waves-effect" data-dismiss="modal">Close</button>
                                                    <button type="button" id="<?php echo $btn_id; ?>" name="<?php echo $btn_name; ?>" 
													class="btn btn-info waves-effect waves-light" data-dismiss="modal">Save changes</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div><!-- /.modal -->

                  
 <!-- PAGE FUNCTION MODAL ENDS (c) i2d Technologies Website Engine -->   
<?php   
}
}
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////
////////////////////// FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////

if (!function_exists('modal_diag_adv')) {
	function modal_diag_adv($settings){
if (array_key_exists('modal_id', $settings)) {
   $modal_id=$settings['modal_id'];
   }
   if (array_key_exists('modal_heading', $settings)) {
   $modal_heading=$settings['modal_heading'];
   }
   if (array_key_exists('label', $settings)) {
   $label=$settings['label'];
   }
   if (array_key_exists('input_id', $settings)) {
   $input_id=$settings['input_id'];
   }
   if (array_key_exists('input_name', $settings)) {
   $input_name=$settings['input_name'];
   }
   if (array_key_exists('btn_name', $settings)) {
   $btn_name=$settings['btn_name'];
   }
   if (array_key_exists('btn_id', $settings)) {
   $btn_id=$settings['btn_id'];
   }
   if (array_key_exists('parent_label', $settings)) {
   $parent_label=$settings['parent_label'];
   }
   if (array_key_exists('parent_ref', $settings)) {
   $parent_ref=$settings['parent_ref'];
   }
   if (array_key_exists('parent_encoding', $settings)) {
   $encoding=$settings['parent_encoding'];
   }
   if (array_key_exists('parent_id', $settings)) {
   $parent_form_id=$settings['parent_id'];
   }
   if (array_key_exists('parent_name', $settings)) {
   $parent_form_name=$settings['parent_name'];
   }
   if (array_key_exists('table_name', $settings)) {
   $table_name=$settings['table_name'];
   }
   if (array_key_exists('table_title', $settings)) {
   $table_title=$settings['table_title'];
   }
   if (array_key_exists('table_id', $settings)) {
   $table_id=$settings['table_id'];
   }
   if (array_key_exists('drop_id', $settings)) {
   $drop_id=$settings['drop_id'];
   }
   if (array_key_exists('child_table', $settings)) {
   $child_table=$settings['child_table'];
   }
   if (array_key_exists('child_table_title', $settings)) {
   $child_table_title=$settings['child_table_title'];
   }
   if (array_key_exists('child_table_id', $settings)) {
   $child_table_id=$settings['child_table_id'];
   }
   if (array_key_exists('parent_table', $settings)) {
   $parent_table=$settings['parent_table'];
   }
   if (array_key_exists('parent_table_idcol', $settings)) {
   $parent_table_idcol=$settings['parent_table_idcol'];
   }
   
    
   ?>
   <!-- PAGE FUNCTION MODAL STARTS (c) i2d Technologies Website Engine -->
  <div id="<?php echo $modal_id; ?>" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                                    <h4 class="modal-title"><?php echo $modal_heading; ?></h4>
                                                </div>
                                                <div class="modal-body">
<?php                                                   
if(isset($parent_ref) && !empty($parent_ref)){ 

$dropdown=array(

'label'=>$parent_label." :)",
'table'=>$child_table,
'table_title'=>$child_table_title,
'table_id_col'=>$child_table_id,
'this_table'=>$parent_table,
'this_table_field'=>$parent_table_idcol,
'ref'=>$parent_ref,
'remote_tbl_title_col'=>$child_table_title,
'add_new'=>'0',
'other_id_col'=>'0',

'encoding'=>'0');


?>
												   <div class="row">
													<div class="col-md-12">
													
													
			

<?php

dynamicdrop_modal($dropdown['label'],$dropdown['encoding'],$dropdown['ref'],$dropdown['table'],$dropdown['table_title'],$dropdown['table_id_col'],$drop_id);

?>         
   
   
 
				  
              
              </div>
													
													</div>
<?php
}
?>

													
													<div class="row">
                                                        <div class="col-md-12">
                                                            <div class="form-group">
                                                                <label for="field-3" class="control-label"><?php echo $label; ?></label>
                                                                <input type="text" class="form-control" id="<?php echo $input_id; ?>" name="<?php echo $input_name; ?>">
                                                            </div>	
                                                        </div>
                                                    </div>
                                                    
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-default waves-effect" data-dismiss="modal">Close</button>
                                                    <button type="button" id="<?php echo $btn_id; ?>" name="<?php echo $btn_name; ?>" 
													class="btn btn-info waves-effect waves-light" data-dismiss="modal">Save changes</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div><!-- /.modal -->

                  
 <!-- PAGE FUNCTION MODAL ENDS (c) i2d Technologies Website Engine -->   
<?php   
}
}
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////
////////////////////// FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////

if (!function_exists('del_modal')) {
	function del_modal($bg="0"){
   ?>
   <!-- PAGE FUNCTION DEL MODAL STARTS (c) i2d Technologies Website Engine -->
<?php if($bg!=0){ ?>
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true" style="display: none;" id="delmodal" data-backdrop="false">
<?php } else { ?>                       
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true" style="display: none;" id="delmodal">
<?php } ?>					   <div class="modal-dialog modal-sm">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                                    <h4 class="modal-title" id="mySmallModalLabel">Are You Sure?</h4>
                                                </div>
                                               
												    <div class="modal-footer">
                                                    <button type="button" class="btn btn-default waves-effect" data-dismiss="modal">Cancel</button>
                                                    <button type="button" id="yes_del" class="btn btn-danger waves-effect waves-light" data-dismiss="modal">Yes</button>
                                                </div>
                                            </div><!-- /.modal-content -->
                                        </div><!-- /.modal-dialog -->
                                    </div><!-- /.modal -->


 <!-- PAGE FUNCTION DEL MODAL ENDS (c) i2d Technologies Website Engine -->   
<?php   
}
}
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////
////////////////////// FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////

if (!function_exists('del_adv_modal')) {
	function del_adv_modal($bg="0"){
   ?>
   <!-- PAGE FUNCTION DEL MODAL STARTS (c) i2d Technologies Website Engine -->
<?php if($bg!=0){ ?>
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true" style="display: none;" id="delmodal" data-backdrop="false">
<?php } else { ?>                       
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true" style="display: none;" id="delmodal">
<?php } ?>					   <div class="modal-dialog modal-sm">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                                    <h4 class="modal-title" id="mySmallModalLabel">Are You Really Sure?</h4>
                                                </div>
                                               
												    <div class="modal-footer">
                                                    <button type="button" class="btn btn-default waves-effect" data-dismiss="modal">Cancel</button>
                                                    <button type="button" id="yes_del" class="btn btn-danger waves-effect waves-light" data-dismiss="modal">Yes</button>
                                                </div>
                                            </div><!-- /.modal-content -->
                                        </div><!-- /.modal-dialog -->
                                    </div><!-- /.modal -->


 <!-- PAGE FUNCTION DEL MODAL ENDS (c) i2d Technologies Website Engine -->   
<?php   
}
}
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////

















?>