<?php
    require_once "../include/config.php";
    require_once GLOBAL_INCLUDE_PATH."include/startup.php";
    $alltable = new AllTables();
    
    if(!adminchecklogin('', '', '', $G_userid)){
        $redirect = ADMIN_DIR."auth/login.php";
        header("location:".$redirect);
        exit();
    }

    if($G_userid > 0 && $G_userid != null && $G_userid != ''){
        $sql = "select * from ".VOLUMES_TABLE." order by volumeid DESC";
        $data = $alltable->getInfo('', $sql);
        $count = count($data);
        
        $record = '';
        
        if($count > 0){
            for($i=0;$i<$count;$i++){
                
                $volumeid = $data[$i]['volumeid'];
                $volumetitle = $data[$i]['volumename'];
                $volumeno = $data[$i]['volumeno'];
                
                $record .= "<tr>";
                    $record .= "<td>".($i+1)."</td>";
                    $record .= "<td>".$volumeno."</td>";
                    $record .= "<td><a href='add-volume.php?volumeid=".$volumeid."'>".$volumetitle."</a></td>";   
                    $record .= "<td><a href='add-volume.php?volumeid=".$volumeid."'><i class='fa fa-pencil'></i> Edit </a></td>";
                    //$record .= "<td><a href='".DOC_ROOT."blog/".$blogurl.".html' target='_blank'> <i class='fa fa-eye'></i> View </a></td>";
                   // $record .= "<td><a href='".DOC_ROOT."".$volumeurl.".htm' target='_blank'> <i class='fa fa-eye'></i> View </a></td>";
                $record .= "</tr>";
            }    
        }else{
            $record .= "<tr>";
                $record .= "<td colspan='4'>No Record Found..!</td>";
            $record .= "</tr>";
        }
        require_once "view-volumes1.html";    
    }else{
        $redirect = ADMIN_DIR."auth/login.php";
        header("location:".$redirect);
        exit();
    }   
?>