PHP Classes

File: gestion/tool_vieweb.php

Recommend this page to a friend!
  Classes of Pierre FAUQUE   OPDS PHP Ebook Publisher Class   gestion/tool_vieweb.php   Download  
File: gestion/tool_vieweb.php
Role: Application script
Content type: text/plain
Description: Script of application
Class: OPDS PHP Ebook Publisher Class
Publish and distribute ebooks for download
Author: By
Last change:
Date: 4 years ago
Size: 5,577 bytes
 

Contents

Class file image Download
<?php
/*
// OPDS basic gestion (only add entities and relations, not modify)
// Version: 0.1
// Pierre FAUQUE, <pierre@fauque.net>
// Script: 2014, Script->Class: 2019, Gestion: may 2020
// Encoding: UTF-8
// Text editor: GNU/Linux Debian Vi
// File: tool_vieweb.php (v0.1)
// Role: Tools, to view all about a published ebook
*/

require("init.php");
require(
"lib_lddocs.php");
$idbook = $_GET["id"];
$idtype = $_GET["tf"];

$request = "SELECT * FROM ".TB_DOCS." WHERE iddoc=$idbook;";
$result = $cnx->query($request);
$r = $result->fetch();

function
newline($tring) { return str_replace("\n","<br/>",$tring); }
?><!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>View ebooks details</title>
<link rel="stylesheet" href="opds.css" type="text/css" />
<style type="text/css">
img { margin-top:2em; margin-left:5em; }
pre {font-family:arial; font-size:1em; }
</style>
</head>

<body>
<table border="0" width="100%">
<tr>
<td class="cmen">
<?php menu(); ?></td>
<td class="cont">
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<h1><?php echo "Details of : $r->title"; ?></h1>
<?php
// Keywords
$request = "SELECT keyword FROM ".TB_KW.",".TB_CLAS." WHERE ".TB_KW.".idkw=".TB_CLAS.".idkw AND iddoc=$idbook;";
$result = $cnx->query($request);
$r = $result->fetch();
$kws = $r->keyword; while($r = $result->fetch()) { $kws .= ", $r->keyword"; }

// Document, author
$request = "SELECT"
        
. " title,descd,issued,".TB_DOCS.".active as dact,"
        
. " cat,".TB_CAT.".active as cact,"
        
. " scat,".TB_SCAT.".active as scact,"
        
. " lname,fname,bdate,ddate,uri,bio "
        
. "FROM ".TB_DOCS.",".TB_CAT.",".TB_SCAT.",".TB_AUT.",".TB_WRIT." "
        
. "WHERE ".TB_DOCS.".idscat=".TB_SCAT.".idscat "
        
. "AND ".TB_SCAT.".idcat=".TB_CAT.".idcat "
        
. "AND ".TB_WRIT.".iddoc=".TB_DOCS.".iddoc "
        
. "AND ".TB_WRIT.".idaut=".TB_AUT.".idaut "
        
. "AND ".TB_DOCS.".iddoc=$idbook;";
$result = $cnx->query($request);
$r = $result->fetch(); // Author,

// Publication
$request = "SELECT filename,lang,thumb,descpe,updpe,type,format "
        
. "FROM ".TB_PUB.",".TB_TYP." "
        
. "WHERE ".TB_PUB.".idtype=".TB_TYP.".idtype "
        
. "AND iddoc=$idbook "
        
. "AND ".TB_PUB.".idtype=$idtype;";
$result = $cnx->query($request);
$p = $result->fetch();
?>

<table>

  <tr><td colspan="2" class="col2">Document</td></tr>

  <tr>
    <td class="label">Title</td>
    <td class="bkinfo"><?php echo $r->title; ?></td>
  </tr><tr>
    <td class="label">Description</td>
    <td class="bkinfo" style="width:600px;"><?php echo newline($r->descd); ?></td>
  </tr><tr>
    <td class="label">Issued</td>
    <td class="bkinfo"><?php if($r->issued == "0000-00-00") { echo "Unknown"; } else { echo $r->issued; } ?></td>
  </tr><tr>
    <td class="label">Status</td>
    <td class="bkinfo"><?php if($r->dact) { echo "Visible"; } else { echo "Hidden"; } ?></td>
  </tr><tr>
    <td class="label">Category</td>
    <td class="bkinfo"><?php echo $r->cat; if($r->cact) { echo " (Visible)"; } else { echo " (Hidden)"; } ?></td>
  </tr><tr>
    <td class="label">Subcategory</td>
    <td class="bkinfo"><?php echo $r->scat; if($r->scact) { echo " (Visible)"; } else { echo " (Hidden)"; } ?></td>
  </tr>

  <tr><td colspan="2" class="col2">Author</td></tr>

  <tr>
    <td class="label">Name</td>
    <td class="bkinfo"><?php echo trim("$r->fname $r->lname"); ?></td>
  </tr><tr>
    <td class="label">Date of birth</td>
    <td class="bkinfo"><?php if($r->bdate == "0000-00-00") { echo "Unknown"; } else { echo $r->bdate; } ?></td>
  </tr><tr>
    <td class="label">Date of death</td>
    <td class="bkinfo"><?php if($r->ddate == "0000-00-00") { echo "Unknown"; } else { echo $r->ddate; } ?></td>
  </tr><tr>
    <td class="label">Biography</td>
    <td class="bkinfo"><?php echo newline($r->bio); ?></td>
  </tr><tr>
    <td class="label">URL page</td>
    <td class="bkinfo"><a href="<?php echo $r->uri; ?>" target="_blank"><?php echo urldecode($r->uri); ?></a></td>
  </tr>

  <tr><td colspan="2" class="col2">Publication</td></tr>

  <tr>
    <td class="label">Language</td>
    <td class="bkinfo"><?php echo $p->lang; ?></td>
  </tr><tr>
    <td class="label">Type of ebook</td>
    <td class="bkinfo"><?php echo "$p->type / $p->format"; ?></td>
  </tr><tr>
    <td class="label">Ebook's filename</td>
    <td class="bkinfo"><?php echo $p->filename; ?></td>
  </tr><tr>
    <td class="label">Ebook's thumbnail</td>
    <td class="bkinfo"><?php echo $p->thumb; ?></td>
  </tr><tr>
    <td class="label">Publication description</td>
    <td class="bkinfo"><?php echo newline($p->descpe); ?></td>
  </tr><tr>
    <td class="label">Published on</td>
    <td class="bkinfo"><?php echo $p->updpe; ?></td>
  </tr>

  <tr><td colspan="2" class="col2">Keywords</td></tr>

  <tr>
    <td class="label">Keywords</td>
    <td class="bkinfo"><?php echo $kws; ?></td>
  </tr>

  <tr><td colspan="2" class="col2">Thumbnail</td></tr>

  <tr>
    <td class="label">Thumbnail</td>
    <td class="bkinfo"><img src="<?php echo "$rootsite$rootopds/$imgdir/$p->thumb"; ?>" width="200"></td>
  </tr>

</table>

<p>&nbsp;</p>
<p>&nbsp;</p>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>

</html>