fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9668]


From: Torstein
Subject: [Fmsystem-commits] [9668]
Date: Tue, 26 Jun 2012 11:41:58 +0000

Revision: 9668
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9668
Author:   vator
Date:     2012-06-26 11:41:58 +0000 (Tue, 26 Jun 2012)
Log Message:
-----------


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

Modified: trunk/controller/inc/class.socontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_item.inc.php   2012-06-26 11:38:39 UTC 
(rev 9667)
+++ trunk/controller/inc/class.socontrol_item.inc.php   2012-06-26 11:41:58 UTC 
(rev 9668)
@@ -148,19 +148,22 @@
                        return $control_item;
                }
                
-               public function get_single_with_options($id){
+               public function get_single_with_options($id, $return_type = 
"return_object"){
                        $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";
-                                                                               
        
+
+                       echo "I get_single_with_options";
+                       
                        $this->db->query($sql);
                        
                        $counter = 0;
                        $control_item = null;
-                       while ($this->db->next_record()) {
-                               
-                               if( $counter == 0 ){
+                       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'));
@@ -173,21 +176,37 @@
                                        
$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) != ''){
+
+                               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();
+                                       if($return_type == "return_object")
+                                       {
+                                               $options_array[] = 
$control_item_option->toArray();
+                                       }
+                                       else
+                                       {
+                                               $options_array[] = 
$control_item_option;
+                                       }
                                }
-                               
+                       
                                $counter++;
                        }
+                       
                        $control_item->set_options_array( $options_array );
                        
-                       return $control_item->toArray();
+                       if($return_type == "return_object")
+                       {
+                               return $control_item;
+                       }
+                       else
+                       {
+                               return $control_item->toArray();
+                       }
                }
 
                function get_control_item_array($start = 0, $results = 1000, 
$sort = null, $dir = '', $query = null, $search_option = null, $filters = 
array())

Modified: trunk/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_item.inc.php   2012-06-26 11:38:39 UTC 
(rev 9667)
+++ trunk/controller/inc/class.uicontrol_item.inc.php   2012-06-26 11:41:58 UTC 
(rev 9668)
@@ -286,13 +286,12 @@
                 */
                public function view()
                {
-                       $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('view');
                        //Retrieve the control_item object
                        $control_item_id = (int)phpgw::get_var('id');
                
                        if(isset($control_item_id) && $control_item_id > 0)
                        {
-                               $control_item = 
$this->so->get_single($control_item_id);
+                               $control_item = 
$this->so->get_single_with_options($control_item_id, "return_array");
                        }
                        else
                        {
@@ -300,12 +299,12 @@
                                return;
                        }
        
+                       print_r($control_item_array);
+                       
                        $category = 
execMethod('phpgwapi.categories.return_single', 
$control_item->get_control_area_id());
                        
$control_item->set_control_area_name($category[0]['name']);
                        
-                       /*
-                        * hack to fix display of   char 
-                        */
+                       /* Hack to fix display of   char */
                        $control_item->set_what_to_do(str_replace(" ", " 
",$control_item->get_what_to_do()));
                        $control_item->set_how_to_do(str_replace(' ', ' ', 
$control_item->get_how_to_do()));
                        
@@ -316,8 +315,8 @@
                                'value_id'                      => 
!empty($control_item) ? $control_item->get_id() : 0,
                                'control_item'  => $control_item_array,
                        );
-
-                       self::render_template_xsl('control_item/control_item', 
$data);
+                       
+                       
//self::render_template_xsl('control_item/control_item', $data);
                }
                
                public function query()




reply via email to

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