File "res_forms.php"

Full Path: /home/ichhrkpd/public_html/idcm_old/application/views/res_forms.php
File size: 4.82 KB
MIME-type: text/html
Charset: utf-8

 <?php 
	 require_once('add_edit_res_forms.php');
	 $sl =1;
	 $res_data = isset($res_data) ? $res_data : array();
	 
	 
    $msg = isset($msg)?$msg:'';
	 $msg_type = isset($msg_type)?$msg_type:'';
	 $this->session->UnsetFlashData();	 
	 
 ?>
 

 
       <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Results & Forms
          </h1>
          
        </section>
 
        <section class="content">
          <div class="row">
          <?php //GPrint($rtype_data);?>
            <div class="col-xs-12">
              <div class="box">
                <div class="box-header">
                  <button class="btn btn-primary btn-xs pull-right" type="button"
            		data-rid="N"
            		data-edit= "N"
            		data-toggle="modal" 
            		data-target="#add_edit_res_forms" >
                    <i class="fa fa-plus"></i> Add
               	</button>
                </div><!-- /.box-header -->
                <div class="box-body"><div class="table-responsive">
                  <table id="example" class="table table-bordered table-hover">
                    <thead>
						<tr>
							<th>sl#</th>
							<th>Title</th>
							<th nowrap>Date</th>
							<th>Download</th>
							<th>Type</th>
							<th>Status</th>
							<th>Action</th>
						</tr>
                    </thead>
                    <tbody>
                    
                    <?php foreach ($res_data as $n){
                        $file_exists = 'N';
                    	$status = '';
                    	$type = '';
                    	if($n->status == 'A'){
                    		$status = "<span class='badge bg-green'>Active</span>";
                    	}else{
                    		$status = "<span class='badge bg-red'>Inactive</span>";
                    	}
                    	
                    	if($n->rtype == 'R'){
                    		$type = "<span class='badge bg-green'>Result</span>";
                    	}elseif($n->rtype == 'F'){
                    		$type = "<span class='badge bg-red'>Forms</span>";
                    	}elseif($n->rtype == 'D'){
                    		$type = "<span class='badge bg-aqua'>Document</span>";
                    	}else{
                    	    $type = "<span class='badge bg-yellow'>Unknown</span>";
                    	}
                    	
                    	$folder_name = base_url().'files/res_forms/';
        				$down_link = $folder_name . $n->rid .'.pdf';
        				$down_file_name = $n->rid.'.pdf';
        				$physical_link = BASEPATH."../files/res_forms/$down_file_name";
        			
        				if(file_exists($physical_link)){
        				    $file_exists = 'Y';
        				}
                    	?>  
                      <tr>
                      	<td><?php echo $sl; ?></td>
						<td><?php echo $n->rtitle; ?></td>
						<td nowrap><?php echo date('F d, Y', strtotime($n->rdate)); ?></td>
						<td>
						    <?php if($file_exists == 'Y'){ ?>
						        <a target='_blank' href="<?php echo $down_link; ?>" download><i class="fa fa-download"></i></a>
						    <?php }?>
						    
						 </td>
						  <td><?php echo $type;?></td>
                        <td><?php echo $status;?></td>
						<td nowrap>
							<button class="btn-xs btn-success" type="button"
			            		data-rid="<?php echo $n->rid; ?>"
			            		data-edit= "Y"
			            		data-toggle="modal" 
			            		data-target="#add_edit_res_forms" >
			                    <i class="fa fa-edit"></i> Edit
			               	</button>
				        </td>
                      </tr>
                    <?php $sl++;}?>  
                    </tbody>
                  </table></div>
                </div><!-- /.box-body -->
              </div><!-- /.box -->

             
            </div><!-- /.col -->
          </div><!-- /.row -->
        </section><!-- /.content -->
      </div>  
     
<script src="<?php echo base_url();?>lib/bootstrap/js/jquery.dataTables.min.js"></script>
        <script src="<?php echo base_url();?>lib/bootstrap/js/dataTables.bootstrap.min.js"></script>        
<script>
	$(document).ready(function() {
		$('#example').dataTable({
	        /* Disable initial sort */
	        "aaSorting": []
	    });
	    
		var toast_msg = '<?php echo $msg;?>';
		var msg_type = '<?php echo $msg_type;?>';
		if(toast_msg !== null && toast_msg !== '') {
            var shortCutFunction = msg_type;
            toastr.options = {
                positionClass: 'toast-bottom-right'
            };
            var $toast = toastr[shortCutFunction](toast_msg);
	    }	    
	    
	} );

	
</script>