PHP Classes

File: fwphp/01mater/book/z_home.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/01mater/book/z_home.php  >  Download  
File: fwphp/01mater/book/z_home.php
Role: Example script
Content type: text/plain
Description: Example script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 3 months ago
Size: 3,840 bytes


Class file image Download
 * P R O D U C T S A N D S U P P L I E R S flat tbl display
 * <!-- (was and r o w c r e frm) -->

B12phpfw\module\book ;

B12phpfw\core\b12phpfw\Config_allsites as utl ; // init, setings, utilities
use B12phpfw\core\b12phpfw\Db_allsites as utldb ; // model (fns) for PDO CRUD all t b ls
// model (CRUDfns) for waybill compound module (more tbls) :
use B12phpfw\dbadapter\book\Tbl_crud as utl_module ;

$path_rel_img = '/vendor/b12phpfw/img/';

// t b l rows count :
$tbl='books'; //products, suppliers are authors
$rcount = utl_module::rrcnt($tbl) ; //Waybill items
<h2 style="text-align: center;">Books homepage</h2>

<div class="container">
  <b><span id="ajax_pgtitle_box">Product count : </span><?=$rcount?></b>
    <a href="<?=$pp1->cc_frm?>" class="btn_green">Add product (book)</a>
                        <button>Default Button</button>
                        <a href="#" class="button">Link Button</a>
                        <button class="button">Button</button>
                        <input type="button" class="button" value="Input Button">

  <!-- main content output : List of songs -->
  <div class="xxbox">
        <thead style="background-color: #ddd; font-weight: bold;">
    <td>Picture (Cover)</td><td>Product name (Title)</td><td>Mark (ISBN)</td><td>Producer (publisher)</td><td>Year</td>
    <td>Summary</td><td>On stock (Copies)</td><!--td>AddItm</td--><td>Edit product</td>


    // cursor products :
$c_products = utl_module::get_cursor($sellst='*', $qrywhere= "'1'='1'" // ORDER BY aname
, $binds=[], $other=['caller' => __FILE__ .' '.', ln '. __LINE__ ] ) ;
//foreach ($songs as $song)
while ( $r = utldb::rrnext($c_products) and isset($r->id) ):
$model_fns_akc = 'escp_all' ;
$r = utl::escp_row($r) ; //require(__DIR__ .'/model_fns.php') ;
$r->id = (int)$r->id ;
$r->author = (int)$r->author ;


        <?php if($r->coverMime) {
//for BLOB, see Working_with_BLOBs.php: <img src="showCover.php?book=<=$r->id>">
?><img width="200px" src="<?=$path_rel_img?><?=$r->coverimgname?>"><?php
} else { ?> no picture <?php } ?>

        <!-- $_SERVER['PHP_SELF'] is eg /fwphp/glomodul/z_examples/01_phpinfo.php
             link alias b1b2 tree
        <?=$r_supl->firstName .' '. $r_supl->lastName?>
<a href="?p=b1b2tree&id=<?=$r_supl->id?>">all books</a>

<a id="erase_row"
              onclick="var yes ; yes = jsmsgyn('Erase row <?=$r->id?>?','') ; if (yes == '1') { location.href= '<?=$pp1->dd.$r->id?>/'; }"
              title="Delete tbl row ID=<?=$r->id?>"
           ><span style="color: red">Del id <?=$r->id?></span></a>



      <td width="35%"><?=nl2br($r->summary)?></td>


      <!-- $pp1->uu_frm.QS?>?bookid=<=$r->id $pp1->module_url.QS.'i/uu/t/song/id/'.$id
      <td width="5%">
      <a href="<?=$pp1->uu_frm.$r->id?>" title="Edit book, product">Edit</a>


    <?php } endwhile ; ?>

    <p>This page is displayed by View script: <?=__FILE__?></p>



For more information send a message to info at phpclasses dot org.