PHP Classes

File: gestion/lib_lddocs.php

Recommend this page to a friend!
  Classes of Pierre FAUQUE   OPDS PHP Ebook Publisher Class   gestion/lib_lddocs.php   Download  
File: gestion/lib_lddocs.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: 1,882 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: lib_lddocs.php (v0.1)
// Role: Library, display a combo list of documents in the menu
*/

function LDdocs($idsel="") {
        global
$cnx,$colm;
       
$ld = "<div class=\"m\">Book details</div>"
           
. "<select name=\"iddocs\" onchange=\"javascript:window.location=this.value\" style=\"width:$colm"."px\">"
           
. "<option value=\"#\">--Document ?</option>";
   
$request = "SELECT ".TB_DOCS.".iddoc,title,issued,".TB_TYP.".idtype,type "
            
. "FROM ".TB_DOCS.",".TB_PUB.",".TB_TYP." "
            
. "WHERE ".TB_DOCS.".iddoc=".TB_PUB.".iddoc "
            
. "AND ".TB_PUB.".idtype=".TB_TYP.".idtype "
            
. "ORDER BY title;";
       
$result = $cnx->query($request);
        if(
$result->rowCount()==0) { return $ld."</select>"; }
        while(
$r=$result->fetch()) {
                if(
$r->iddoc==$idsel) { $sel = " selected"; } else { $sel = ""; }
                if(
$r->issued) { $issued = " ($r->issued)"; }
               
$ld .= "<option value=\"tool_vieweb.php?id=$r->iddoc&tf=$r->idtype\"$sel>$r->title$issued - $r->type</option>";
        }

   
$request = "SELECT count(title) AS nbd FROM ".TB_DOCS.";"; // Number of documents
   
$result = $cnx->query($request);
   
$r = $result->fetch();
   
$docs = "$r->nbd document";
    if(
$r->nbd > 1) { $docs .= "s"; }

   
$request = "SELECT count(filename) AS nbp FROM ".TB_PUB.";"; // Number of publications
   
$result = $cnx->query($request);
   
$r = $result->fetch();
   
$books = "$r->nbp ebook";
    if(
$r->nbp > 1) { $books .= "s"; }

        return
$ld."</select><br/><span style=\"font-size:0.8em\">($docs, $books)</span>";
}
?>