fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16636]


From: nelson . guerra
Subject: [Fmsystem-commits] [16636]
Date: Wed, 26 Apr 2017 23:50:45 -0400 (EDT)

Revision: 16636
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16636
Author:   nelson224
Date:     2017-04-26 23:50:45 -0400 (Wed, 26 Apr 2017)
Log Message:
-----------


Modified Paths:
--------------
    branches/dev-syncromind-2/property/inc/class.uireport.inc.php

Modified: branches/dev-syncromind-2/property/inc/class.uireport.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uireport.inc.php       
2017-04-27 03:50:31 UTC (rev 16635)
+++ branches/dev-syncromind-2/property/inc/class.uireport.inc.php       
2017-04-27 03:50:45 UTC (rev 16636)
@@ -47,6 +47,8 @@
                        'save_dataset' => true,
                        'delete_dataset' => true,
                        'get_columns' => true,
+                       'get_columns_data' => true,
+                       'preview' => true,
                        'download' => true
                );
 
@@ -682,12 +684,69 @@
                        return $columns;
                }
                
-               public function get_columns_datos()
+               public function get_columns_data()
                {
                        $dataset_id = phpgw::get_var('dataset_id');
 
-                       $columns = $this->bo->get_columns($dataset_id);
+                       $columns = $this->get_columns();
                        
-                       return $columns;
+                       $html_table = '<table class="pure-table 
pure-table-bordered">';
+                       $html_table .= '<thead><tr>';
+                       foreach ($columns as $col)
+                       {
+                               $_check = '<input type="checkbox" id="c_'. 
$col['name'] .'" value="'. $col['name'] .'" onchange="build_check_groups(\''. 
$col['name'] .'\')"/>';
+                               $html_table .= "<th align='center'>". $_check." 
".$col['name'] ."</th>";
+                       }
+                       $html_table .= '</tr></thead>';
+
+                       $data = $this->bo->get_columns_data($dataset_id);
+                       
+                       foreach ($data as $row)
+                       {
+                               $html_table .= "<tr><td>" . 
implode('</td><td>', $row) . '</td></tr>';
+                       }
+                       $html_table .= '</table>';
+                       
+                       return array('columns'=>$columns, 
'preview_dataset'=>$html_table);
                }
+               
+               public function preview()
+               {
+                       if (!$_POST)
+                       {
+                               return $this->edit();
+                       }
+                       
+                       /*
+                        * Overrides with incoming data from POST
+                        */
+                       $values = $this->_populate();
+
+                       if ($this->receipt['error'])
+                       {
+                               $this->edit($values);
+                       }
+                       else
+                       {
+                               try
+                               {
+                                       $receipt = $this->bo->save($values);
+                                       $id = $receipt['id'];
+                               }
+                               catch (Exception $e)
+                               {
+                                       if ($e)
+                                       {
+                                               
phpgwapi_cache::message_set($e->getMessage(), 'error');
+                                               $this->edit($values);
+                                               return;
+                                       }
+                               }
+                               
+                               self::message_set($receipt);
+
+                               self::redirect(array('menuaction' => 
'property.uireport.edit', 'id' => $id));
+                       }
+               }
+               
        }
\ No newline at end of file




reply via email to

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