fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9669]


From: Torstein
Subject: [Fmsystem-commits] [9669]
Date: Tue, 26 Jun 2012 12:42:15 +0000

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


Modified Paths:
--------------
    trunk/controller/inc/class.socontrol_item.inc.php
    trunk/controller/inc/class.socontrol_item_option.inc.php
    trunk/controller/inc/class.uicontrol_item.inc.php
    trunk/controller/templates/base/control_item/control_item.xsl

Modified: trunk/controller/inc/class.socontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_item.inc.php   2012-06-26 11:41:58 UTC 
(rev 9668)
+++ trunk/controller/inc/class.socontrol_item.inc.php   2012-06-26 12:42:14 UTC 
(rev 9669)
@@ -154,8 +154,6 @@
                        $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;
@@ -176,21 +174,21 @@
                                        
$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'));
-                               
+
                                        if($return_type == "return_object")
                                        {
-                                               $options_array[] = 
$control_item_option->toArray();
+                                               $options_array[] = 
$control_item_option;
                                        }
                                        else
                                        {
-                                               $options_array[] = 
$control_item_option;
+                                               $options_array[] = 
$control_item_option->toArray();
                                        }
                                }
                        

Modified: trunk/controller/inc/class.socontrol_item_option.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_item_option.inc.php    2012-06-26 
11:41:58 UTC (rev 9668)
+++ trunk/controller/inc/class.socontrol_item_option.inc.php    2012-06-26 
12:42:14 UTC (rev 9669)
@@ -96,6 +96,21 @@
                        return $control_item_option;
                }
                
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('controller.socontrol_item_option');
+                       }
+                       
+                       return self::$so;
+               }
+               
                function get_id_field_name(){}
                function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean 
$return_count){}
                function populate(int $object_id, &$object){}

Modified: trunk/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_item.inc.php   2012-06-26 11:41:58 UTC 
(rev 9668)
+++ trunk/controller/inc/class.uicontrol_item.inc.php   2012-06-26 12:42:14 UTC 
(rev 9669)
@@ -291,32 +291,29 @@
                
                        if(isset($control_item_id) && $control_item_id > 0)
                        {
-                               $control_item = 
$this->so->get_single_with_options($control_item_id, "return_array");
+                               $control_item_array = 
$this->so->get_single_with_options($control_item_id, "return_array");
                        }
                        else
                        {
                                
$this->render('permission_denied.php',array('error' => 
lang('invalid_request')));
                                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']);
+                       $category = 
execMethod('phpgwapi.categories.return_single', 
$control_item_array['control_area_id']);
+                       $control_item_array['control_area_name'] = 
$category[0]['name'];
                        
                        /* 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()));
+                       $control_item_array['what_to_do'] = 
str_replace(" ", " ",$control_item_array['what_to_do']);
+                       $control_item_array['how_to_do'] = 
str_replace(' ', ' ', $control_item_array['how_to_do']);
                        
-                       $control_item_array = $control_item->toArray();
-
                        $data = array
                        (
                                'value_id'                      => 
!empty($control_item) ? $control_item->get_id() : 0,
                                'control_item'  => $control_item_array,
+                               'view'                                  => true
                        );
                        
-                       
//self::render_template_xsl('control_item/control_item', $data);
+                       self::render_template_xsl('control_item/control_item', 
$data);
                }
                
                public function query()

Modified: trunk/controller/templates/base/control_item/control_item.xsl
===================================================================
--- trunk/controller/templates/base/control_item/control_item.xsl       
2012-06-26 11:41:58 UTC (rev 9668)
+++ trunk/controller/templates/base/control_item/control_item.xsl       
2012-06-26 12:42:14 UTC (rev 9669)
@@ -63,6 +63,20 @@
                                        <div class="styleWrp">
                                                <xsl:variable 
name="control_item_type"><xsl:value-of select="control_item/type" 
/></xsl:variable>
                                                <xsl:choose>
+                                                       <xsl:when test="view">
+                                                       
+                                                               <xsl:variable 
name="lang_type"><xsl:value-of select="control_item/type" /></xsl:variable>
+                                                               <xsl:value-of 
select="php:function('lang', $lang_type)" />
+                                                               
+                                                               <h3>Verdier i 
liste</h3>
+                                                               
+                                                               <!-- 
==============  RADIOBUTTONS FOR CHOOSING CONTROL ITEM TYPE  ==============  -->
+                                                               <ul>
+                                                               <xsl:for-each 
select="control_item/options_array">
+                                                                       
<li><xsl:value-of select="option_value" /></li>
+                                                               </xsl:for-each>
+                                                               </ul>
+                                                       </xsl:when>
                                                        <xsl:when 
test="editable">
                                                        
                                                                <!-- 
==============  RADIOBUTTONS FOR CHOOSING CONTROL ITEM TYPE  ==============  -->
@@ -213,8 +227,14 @@
                                                <input type="submit" 
name="cancel_control_item" value="{$lang_cancel}" title = "{$lang_cancel}" />
                                        </xsl:when>
                                        <xsl:otherwise>
-                                               <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
-                                               <input type="submit" 
name="edit_control_item" value="{$lang_edit}" title = "{$lang_edit}" />
+                                               <a class="btn">
+                                                       <xsl:attribute 
name="href">
+                                                               
<xsl:text>index.php?menuaction=controller.uicontrol_item.edit</xsl:text>
+                                                               
<xsl:text>&amp;id=</xsl:text>
+                                                               <xsl:value-of 
select="control_item/id"/>
+                                                       </xsl:attribute>
+                                                       <xsl:value-of 
select="php:function('lang', 'edit')" />
+                                               </a>
                                        </xsl:otherwise>
                                </xsl:choose>
                        </div>




reply via email to

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