fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16536]


From: nelson . guerra
Subject: [Fmsystem-commits] [16536]
Date: Wed, 5 Apr 2017 00:46:32 -0400 (EDT)

Revision: 16536
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16536
Author:   nelson224
Date:     2017-04-05 00:46:31 -0400 (Wed, 05 Apr 2017)
Log Message:
-----------


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

Modified: branches/dev-syncromind-2/property/inc/class.soreport.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.soreport.inc.php       
2017-04-04 13:24:19 UTC (rev 16535)
+++ branches/dev-syncromind-2/property/inc/class.soreport.inc.php       
2017-04-05 04:46:31 UTC (rev 16536)
@@ -88,4 +88,166 @@
                        
                        return $values;
                }
+               
+               function read_single_dataset ( $id, $values = array() )
+               {
+                       $id = (int)$id;
+                       $sql = "SELECT * FROM fm_view_dataset WHERE id = {$id}";
+
+                       $this->db->query($sql, __LINE__, __FILE__);
+
+                       $values = array();
+                       if ($this->db->next_record())
+                       {
+                               $values = array
+                                       (
+                                       'id' => $this->db->f('id'),
+                                       'view_name' => 
$this->db->f('view_name'),
+                                       'dataset_name' => 
$this->db->f('dataset_name')
+                               );
+                       }
+
+                       return $values;
+               }
+               
+               function read_dataset ( $data )
+               {
+                       $start = isset($data['start']) && $data['start'] ? 
$data['start'] : 0;
+                       $query = isset($data['query']) ? $data['query'] : '';
+                       $sort = isset($data['sort']) && $data['sort'] ? 
$data['sort'] : 'DESC';
+                       $order = isset($data['order']) ? $data['order'] : '';
+                       $allrows = isset($data['allrows']) ? $data['allrows'] : 
'';
+                       $results = isset($data['results']) && $data['results'] 
? (int)$data['results'] : 0;
+                       
+                       if ($order)
+                       {
+                               $ordermethod = " ORDER BY $order $sort";
+                       }
+                       else
+                       {
+                               $ordermethod = " ORDER BY id DESC";
+                       }
+
+                       $where = 'WHERE';
+
+                       /*if ($dimb_id > 0)
+                       {
+                               $filtermethod .= " $where 
fm_budget.ecodimb={$dimb_id}";
+                               $where = 'AND';
+                       }*/
+
+                       if ($query)
+                       {
+                               $query = $this->db->db_addslashes($query);
+                               $querymethod = " $where ( dataset_name 
{$this->like} '%$query%')";
+                       }
+
+                       $sql = "SELECT fm_view_dataset.id, 
fm_view_dataset.view_name, fm_view_dataset.dataset_name"
+                               . " FROM fm_view_dataset"
+                               . " {$filtermethod} {$querymethod}";
+
+                       $sql_count = 'SELECT count(fm_view_dataset.id) AS cnt 
FROM fm_view_dataset';
+                       $this->db->query($sql_count, __LINE__, __FILE__);
+                       $this->db->next_record();
+                       $this->total_records_dataset = $this->db->f('cnt');
+
+                       if (!$allrows)
+                       {
+                               $this->db->limit_query($sql . $ordermethod, 
$start, __LINE__, __FILE__, $results);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . $ordermethod, __LINE__, 
__FILE__);
+                       }
+
+                       $values = array();
+                       while ($this->db->next_record())
+                       {
+                               $values[] = array
+                                       (
+                                       'id' => $this->db->f('id'),
+                                       'view_name' => 
$this->db->f('view_name'),
+                                       'dataset_name' => 
$this->db->f('dataset_name')
+                               );
+                       }
+
+                       return $values;
+               }
+               
+               function add_dataset ( $data )
+               {
+                       $receipt = array();
+                       $values_insert = array
+                               (
+                               'view_name' => $data['view_name'],
+                               'dataset_name' => 
$this->db->db_addslashes($data['dataset_name']),
+                               'owner_id' => 
$GLOBALS['phpgw_info']['user']['account_id'],
+                               'entry_date' => time()
+                       );
+                       
+                       $this->db->transaction_begin();
+
+                       $this->db->query("INSERT INTO fm_view_dataset (" . 
implode(',', array_keys($values_insert)) . ') VALUES ('
+                                       . 
$this->db->validate_insert(array_values($values_insert)) . ')', __LINE__, 
__FILE__);
+                       
+                       if ($this->db->transaction_commit())
+                       {
+                               $receipt['message'][] = array('msg' => 
lang('event has been saved'));
+                       }
+                       else
+                       {
+                               $receipt['error'][] = array('msg' => 
lang('event has not been saved'));
+                       }
+                       
+                       return $receipt;
+               }
+
+               function update_dataset ( $data )
+               {
+                       $receipt = array();
+
+                       $value_set = array
+                               (
+                               'view_name' => $data['view_name'],
+                               'dataset_name' => 
$this->db->db_addslashes($data['dataset_name']),
+                               'owner_id' => 
$GLOBALS['phpgw_info']['user']['account_id'],
+                               'entry_date' => time()
+                       );
+
+                       $value_set = $this->db->validate_update($value_set);
+
+                       $this->db->transaction_begin();
+                       
+                       $this->db->query("UPDATE fm_view_dataset SET 
{$value_set} WHERE id='" . $data['id'] . "'", __LINE__, __FILE__);
+
+                       $receipt['id'] = $data['id'];
+                       if ($this->db->transaction_commit())
+                       {
+                               $receipt['message'][] = array('msg' => 
lang('event has been updated'));
+                       }
+                       else
+                       {
+                               $receipt['error'][] = array('msg' => 
lang('event has not been updated'));
+                       }
+                       
+                       return $receipt;
+               }
+               
+               function delete_dataset ( $id )
+               {
+                       $id = (int)$id;
+
+                       $this->db->transaction_begin();
+                       
+                       $this->db->query("DELETE FROM fm_view_dataset WHERE id 
='{$id}'", __LINE__, __FILE__);
+                       $this->db->query("DELETE FROM fm_view_dataset_report 
WHERE dataset_id ='{$id}'", __LINE__, __FILE__);
+
+                       if ($this->db->transaction_commit())
+                       {
+                               return true;
+                       }
+                       
+                       return false;
+               }               
+               
        }
\ No newline at end of file




reply via email to

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