phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r576 - in trunk/rapport_avance: . doc include include/te


From: phpcompta-dev
Subject: [Phpcompta-dev] r576 - in trunk/rapport_avance: . doc include include/template
Date: Wed, 13 Nov 2013 15:47:33 +0100 (CET)

Author: danydb
Date: 2013-11-13 15:47:32 +0100 (Wed, 13 Nov 2013)
New Revision: 576

Added:
   trunk/rapport_avance/ajax_listing_display_definition.php
   trunk/rapport_avance/include/class_rapav_listing_param.php
   trunk/rapport_avance/include/template/rapav_listing_definition.php
Removed:
   trunk/rapport_avance/include/ajax_listing_display_definition.php
Modified:
   trunk/rapport_avance/doc/listing-db.dia
   trunk/rapport_avance/include/class_rapav_listing.php
   trunk/rapport_avance/include/class_rapport_avance_sql.php
Log:
Listing : definition

Copied: trunk/rapport_avance/ajax_listing_display_definition.php (from rev 575, 
trunk/rapport_avance/include/ajax_listing_display_definition.php)
===================================================================
--- trunk/rapport_avance/ajax_listing_display_definition.php                    
        (rev 0)
+++ trunk/rapport_avance/ajax_listing_display_definition.php    2013-11-13 
14:47:32 UTC (rev 576)
@@ -0,0 +1,19 @@
+<?php
+
+require_once 'include/class_rapav_listing.php';
+$obj=new Rapav_Listing($id);
+ob_start();
+$obj->display();
+$obj->button_add_param();
+$response = ob_get_flush();
+ob_end_clean();
+$html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<ctl></ctl>
+<code>$html</code>
+</data>
+EOF;
+?>        
\ No newline at end of file

Modified: trunk/rapport_avance/doc/listing-db.dia
===================================================================
(Binary files differ)

Deleted: trunk/rapport_avance/include/ajax_listing_display_definition.php
===================================================================
--- trunk/rapport_avance/include/ajax_listing_display_definition.php    
2013-11-12 14:15:12 UTC (rev 575)
+++ trunk/rapport_avance/include/ajax_listing_display_definition.php    
2013-11-13 14:47:32 UTC (rev 576)
@@ -1,19 +0,0 @@
-<?php
-
-require_once 'include/class_rapav_listing.php';
-$obj=new Rapav_Listing($id);
-ob_start();
-$obj->display();
-$obj->button_add_param();
-$response = ob_get_flush();
-ob_end_clean();
-$html = escape_xml($response);
-header('Content-type: text/xml; charset=UTF-8');
-echo <<<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<data>
-<ctl></ctl>
-<code>$html</code>
-</data>
-EOF;
-?>        
\ No newline at end of file

Modified: trunk/rapport_avance/include/class_rapav_listing.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing.php        2013-11-12 
14:15:12 UTC (rev 575)
+++ trunk/rapport_avance/include/class_rapav_listing.php        2013-11-13 
14:47:32 UTC (rev 576)
@@ -14,9 +14,11 @@
 require_once 'class_rapport_avance_sql.php';
 
 class Rapav_Listing {
-
+    private $Data; /*!< RAPAV_Listing_SQL */
+    private $a_detail; /*!< array of RAPAV_Listing_Param corresponding to the 
listing*/
     function __construct($p_id = -1) {
         $this->Data = new RAPAV_Listing_SQL($p_id);
+        $this->a_detail=array();
     }
 
     /**
@@ -192,8 +194,17 @@
     function display()
     {
         // Load all listing_parameter
-
+        $this->load_detail();
+        
         // Display them avec an anchor to update / delete (javascript)
+        include_once 'template/rapav_listing_definition.php';
     }
-
+    
+    function load_detail()
+    {
+        if ( $this->Data->getp('id') == -1) 
+            throw new Exception ("Undefined objet ".__FILE__.':'.__LINE__);
+        $this->a_detail=  
RAPAV_Listing_Param::get_listing_detail($this->Data->getp('id'));
+        
+    }
 }

Added: trunk/rapport_avance/include/class_rapav_listing_param.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing_param.php                  
        (rev 0)
+++ trunk/rapport_avance/include/class_rapav_listing_param.php  2013-11-13 
14:47:32 UTC (rev 576)
@@ -0,0 +1,102 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * @brief Manage the tables rapport_advanced.listing_param_detail and
+ * rapport_advanced.listing_param. The data are in Param and Detail
+ *
+ * @author danydb
+ */
+require_once 'class_rapport_avance_sql.php';
+
+class RAPAV_Listing_Param {
+    private  $Param;  /*!< RAPAV_Listing_Param_SQL */
+    private  $Detail;  /*!< RAPAV_Listing_Param_Detail_SQL */
+    
+    /**
+     * constructor, initialize Data with a RAPAV_Listing_Param_SQL
+     * @param p_id is the primary key of Listing_Param : which is the FK for 
the detail
+     * 
+     */
+    function __construct($p_id=-1) {
+        global $cn;
+        $this->Param = new RAPAV_Listing_Param_SQL($p_id);
+        $this->Detail=new RAPAV_Listing_Param_Detail_SQL();
+        if ( $p_id !=-1)
+        {
+            $this->load_detail();
+        }
+    }
+    /**
+     * Set the id of Param and load from database 
+     * @param type $p_id
+     */
+    function set_id ($p_id)
+    {
+        $this->Param->setp('id',$p_id);
+        $this->load();
+       
+    }
+    /**
+     * Retrieve data from listing_param_detail
+     * and set Param and Detail
+     * @see load_detail
+     */
+    function load()
+    {
+        $this->Param->load();
+        $this->load_detail();
+        
+    }
+    /**
+     * Retrieve data from listing_param_detail
+     */
+    function load_detail()
+    {
+       $id=$this->Param->getp('id');
+       
+       if ( $id !=-1)
+        {
+            $pk_detail=$cn->get_value(' select fp_id from 
+                    rapport_advanced.listing_param_detail
+                    where
+                    lp_id = $1',array($id));
+            
+            if ($cn->count() != 0)    {
+                $this->Detail->setp('id',-1);
+                return;
+            }
+            
+            $this->Detail->setp('id',$pk_detail);
+            
+            $this->Detail->load();
+            
+        }
+    }
+    /**
+     * Get all data from listing_param and listing_param_detail 
+     * for a listing
+     * @param $p_id Listing::l_id
+     * @return  array of object RAPAV_Listing_Param
+     */
+    static function get_listing_detail ($p_id)
+    {
+       global $cn;
+       $a_listing_param=array();
+       
+       $a_param_id=$cn->get_array('select lp_id 
+               from rapport_advanced.listing_param 
+               where l_id=$1 order by l_order'.array($p_id));
+       
+       for ($i=0;$i<count($a_param_id);$i++)
+       {
+           $a_listing_param[]=new 
RAPAV_Listing_Param($a_param_id['lp_id'][$i]);
+       }
+       return $a_listing_param;
+    }
+}

Modified: trunk/rapport_avance/include/class_rapport_avance_sql.php
===================================================================
--- trunk/rapport_avance/include/class_rapport_avance_sql.php   2013-11-12 
14:15:12 UTC (rev 575)
+++ trunk/rapport_avance/include/class_rapport_avance_sql.php   2013-11-13 
14:47:32 UTC (rev 576)
@@ -324,7 +324,7 @@
     {
 
 
-        $this->table = "rapport_advanced.listing_param_detail";
+        $this->table = "rapport_advanced.listing_param";
         $this->primary_key = "fp_id";
 
         $this->name = array(
@@ -352,7 +352,7 @@
     }
 
 }
-class RAPAV_Listing_Param_Detail extends Phpcompta_Sql
+class RAPAV_Listing_Param_Detail_SQL extends Phpcompta_Sql
 {
 
     function __construct($p_id = -1)

Added: trunk/rapport_avance/include/template/rapav_listing_definition.php
===================================================================
--- trunk/rapport_avance/include/template/rapav_listing_definition.php          
                (rev 0)
+++ trunk/rapport_avance/include/template/rapav_listing_definition.php  
2013-11-13 14:47:32 UTC (rev 576)
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * @file
+ * @brief show a list and all of its parameters and detail
+ * 
+ */
+
+?>
+<table class="result">
+    <tr>
+        <th>
+            Code
+        </th>
+        <th>
+            Commentaire
+        </th>
+        <th>
+            Formules
+        </th>
+        <th>
+            action
+        </th>
+    </tr>
+<?php 
+    $nb=count($this->a_detail);
+    for ($i=0;$i<$nb;$i++):
+?>
+    <tr>
+        <td>
+           <?php $this->a_detail[$i]->Param->getp('code'); ?>
+        </td>
+        <td>
+           <?php $this->a_detail[$i]->Param->getp('comment'); ?>
+        </td>
+        <td>
+            Formule
+        </td>
+        <td>
+            Efface / modifie
+        </td>
+        
+    </tr>
+
+
+<?php
+    endfor;
+?>   
+</table>    
\ No newline at end of file



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]