fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9446]


From: Torstein
Subject: [Fmsystem-commits] [9446]
Date: Tue, 29 May 2012 01:30:13 +0000

Revision: 9446
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9446
Author:   vator
Date:     2012-05-29 01:30:13 +0000 (Tue, 29 May 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.socontrol_item.inc.php

Modified: trunk/controller/inc/class.socontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_item.inc.php   2012-05-29 01:29:50 UTC 
(rev 9445)
+++ trunk/controller/inc/class.socontrol_item.inc.php   2012-05-29 01:30:13 UTC 
(rev 9446)
@@ -147,17 +147,49 @@
                        
                        return $control_item;
                }
+               
+               public function get_single_with_options($id){
+                       $sql  = "SELECT ci.id as ci_id, ci.*, cio.id as cio_id, 
cio.* ";
+                       $sql .= "FROM controller_control_item ci "; 
+                       $sql .= "LEFT JOIN controller_control_item_option as 
cio ON cio.control_item_id = ci.id ";
+                       $sql .= "WHERE ci.id = $id";
+                                                                               
        
+                       $this->db->query($sql);
+                       
+                       $counter = 0;
+                       $control_item = null;
+                       while ($this->db->next_record()) {
+                               
+                               if( $counter == 0 ){
+                                       $control_item = new 
controller_control_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
+                                       
$control_item->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
+                                       
$control_item->set_required($this->unmarshal($this->db->f('required', true), 
'bool'));
+                                       
$control_item->set_what_to_do($this->unmarshal($this->db->f('what_to_do', 
true), 'string'));
+                                       
$control_item->set_how_to_do($this->unmarshal($this->db->f('how_to_do', true), 
'string'));
+                                       
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
+                                       
$control_item->set_control_group_name($this->unmarshal($this->db->f('control_group_name',
 true), 'string'));
+                                       
$control_item->set_control_area_id($this->unmarshal($this->db->f('control_area_id')));
+                                       $category = 
execMethod('phpgwapi.categories.return_single', 
$this->unmarshal($this->db->f('control_area_id', true), 'int'));
+                                       
$control_item->set_control_area_name($category[0]['name']);
+                                       
$control_item->set_type($this->unmarshal($this->db->f('type', true), 'string'));
+                               }
+                               
+                               if($this->db->f('cio_id', true) != ''){
+                                       $control_item_option = new 
controller_control_item_option();
+                                       
$control_item_option->set_id($this->unmarshal($this->db->f('cio_id', true), 
'int'));
+                                       
$control_item_option->set_option_value($this->unmarshal($this->db->f('option_value',
 true), 'string'));
+                                       
$control_item_option->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
+                               
+                                       $options_array[] = 
$control_item_option->toArray();
+                               }
+                               
+                               $counter++;
+                       }
+                       $control_item->set_options_array( $options_array );
+                       
+                       return $control_item->toArray();
+               }
 
-               /**
-                * Get a list of procedure objects matching the specific filters
-                * 
-                * @param $start search result offset
-                * @param $results number of results to return
-                * @param $sort field to sort by
-                * @param $query LIKE-based query string
-                * @param $filters array of custom filters
-                * @return list of rental_composite objects
-                */
                function get_control_item_array($start = 0, $results = 1000, 
$sort = null, $dir = '', $query = null, $search_option = null, $filters = 
array())
                {
                        $results = array();
@@ -330,7 +362,7 @@
                        $results = array();
                        
                        $sql = "select ci.* from controller_control_item ci, 
controller_control_item_list cil where ci.control_group_id = 
{$control_group_id} and cil.control_id = {$control_id} and ci.id = 
cil.control_item_id";
-                       //var_dump($sql);
+
                        $this->db->query($sql, __LINE__, __FILE__);
                        
                        while($this->db->next_record())




reply via email to

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