fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7890]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7890]
Date: Tue, 18 Oct 2011 08:15:58 +0000

Revision: 7890
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7890
Author:   erikhl
Date:     2011-10-18 08:15:57 +0000 (Tue, 18 Oct 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.socontrol.inc.php
    trunk/controller/inc/class.soprocedure.inc.php
    trunk/controller/inc/class.uicontrol.inc.php
    trunk/controller/inc/class.uiprocedure.inc.php
    trunk/controller/inc/model/class.control.inc.php
    trunk/controller/setup/phpgw_no.lang
    trunk/controller/templates/base/control.xsl
    trunk/controller/templates/base/control_tabs.xsl
    trunk/controller/templates/base/procedure_item.xsl

Added Paths:
-----------
    trunk/controller/templates/base/control_equipment.xsl
    trunk/controller/templates/base/control_locations.xsl

Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php        2011-10-18 08:15:23 UTC 
(rev 7889)
+++ trunk/controller/inc/class.socontrol.inc.php        2011-10-18 08:15:57 UTC 
(rev 7890)
@@ -155,6 +155,8 @@
 
                $tables = "controller_control";
                //$joins = " {$this->left_join} rental_document_types ON 
(rental_document.type_id = rental_document_types.id)";
+               $joins = " {$this->left_join} controller_control_area ON 
(controller_control.control_area_id = controller_control_area.id)";
+               $joins .= " {$this->left_join} controller_procedure ON 
(controller_control.procedure_id = controller_procedure.id)";
                
                if($return_count)
                {
@@ -162,7 +164,7 @@
                }
                else
                {
-                       $cols = 'id, title, description, start_date, end_date, 
procedure_id, requirement_id, costresponsibility_id, responsibility_id, 
equipment_type_id, equipment_id, location_code, repeat_type, repeat_interval, 
enabled ';
+                       $cols = 'controller_control.id, 
controller_control.title, controller_control.description, 
controller_control.start_date, controller_control.end_date, procedure_id, 
control_area_id, requirement_id, costresponsibility_id, responsibility_id, 
equipment_type_id, equipment_id, location_code, repeat_type, repeat_interval, 
enabled, controller_control_area.title AS control_area_name, 
controller_procedure.title AS procedure_name ';
                }
                
                $dir = $ascending ? 'ASC' : 'DESC';
@@ -170,9 +172,13 @@
                {
                        $sort_field = 'controller_control.title';
                }
+               else if($sort_field == 'id')
+               {
+                       $sort_field = 'controller_control.id';
+               }
                $order = $sort_field ? "ORDER BY {$this->marshal($sort_field, 
'field')} $dir ": '';
                
-               return "SELECT {$cols} FROM {$tables} WHERE {$condition} 
{$order}";
+               return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
                
        }
        
@@ -186,10 +192,12 @@
                        
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
                        
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
                        
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
+                       
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
                        
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
                        
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
                        
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
                        
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
+                       
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
 //                     
$control->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
                        
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
 true), 'int'));
                        
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true), 
'int'));
@@ -211,7 +219,10 @@
        {
                $id = (int)$id;
                
-               $sql = "SELECT c.* FROM controller_control c WHERE c.id = " . 
$id;
+               $joins = " {$this->left_join} controller_control_area ON 
(c.control_area_id = controller_control_area.id)";
+               $joins .= " {$this->left_join} controller_procedure ON 
(c.procedure_id = controller_procedure.id)";
+               
+               $sql = "SELECT c.*, controller_control_area.title AS 
control_area_name, controller_procedure.title AS procedure_name FROM 
controller_control c {$joins} WHERE c.id = " . $id;
                $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
                $this->db->next_record();
                
@@ -222,10 +233,12 @@
                
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
                
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
                
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
+               
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
                
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
                
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
                
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
                
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
+               
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
 //                     
$control->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
                
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
 true), 'int'));
                
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true), 
'int'));

Modified: trunk/controller/inc/class.soprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.soprocedure.inc.php      2011-10-18 08:15:23 UTC 
(rev 7889)
+++ trunk/controller/inc/class.soprocedure.inc.php      2011-10-18 08:15:57 UTC 
(rev 7890)
@@ -34,7 +34,9 @@
                                'responsibility',
                                'description',
                                'reference',
-                               'attachment'
+                               'attachment',
+                               'start_date',
+                               'end_date'
                );
                        
                $values = array(
@@ -43,7 +45,9 @@
                        $this->marshal($procedure->get_responsibility(), 
'string'),
                        $this->marshal($procedure->get_description(), 'string'),
                        $this->marshal($procedure->get_reference(), 'string'),
-                       $this->marshal($procedure->get_attachment(), 'string')
+                       $this->marshal($procedure->get_attachment(), 'string'),
+                       $this->marshal($procedure->get_start_date(), 'int'),
+                       $this->marshal($procedure->get_end_date(), 'int')
                );
                
                $result = $this->db->query('INSERT INTO controller_procedure (' 
. join(',', $cols) . ') VALUES (' . join(',', $values) . ')', 
__LINE__,__FILE__);
@@ -76,7 +80,9 @@
                        'responsibility = ' . 
$this->marshal($procedure->get_responsibility(), 'string'),
                        'description = ' . 
$this->marshal($procedure->get_description(), 'string'),
                        'reference = ' . 
$this->marshal($procedure->get_reference(), 'string'),
-                       'attachment = ' . 
$this->marshal($procedure->get_attachment(), 'string')
+                       'attachment = ' . 
$this->marshal($procedure->get_attachment(), 'string'),
+                       'start_date = ' . 
$this->marshal($procedure->get_start_date(), 'int'),
+                       'end_date = ' . 
$this->marshal($procedure->get_end_date(), 'int')
                );
                
                $result = $this->db->query('UPDATE controller_procedure SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
@@ -105,6 +111,8 @@
                
$procedure->set_description($this->unmarshal($this->db->f('description', true), 
'string'));
                
$procedure->set_reference($this->unmarshal($this->db->f('reference', true), 
'string'));
                
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true), 
'string'));
+               
$procedure->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
+               
$procedure->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
                
                return $procedure;
        }
@@ -128,6 +136,8 @@
                        
$procedure->set_description($this->unmarshal($this->db->f('description', true), 
'string'));
                        
$procedure->set_reference($this->unmarshal($this->db->f('reference', true), 
'string'));
                        
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true), 
'string'));
+                       
$procedure->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
+                       
$procedure->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
                        
                        $results[] = $procedure;
                }
@@ -154,6 +164,8 @@
                        
$procedure->set_description($this->unmarshal($this->db->f('description', true), 
'string'));
                        
$procedure->set_reference($this->unmarshal($this->db->f('reference', true), 
'string'));
                        
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true), 
'string'));
+                       
$procedure->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
+                       
$procedure->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
                        
                        $results[] = $procedure->toArray();;
                }
@@ -312,7 +324,7 @@
                }
                else
                {
-                       $cols .= "controller_procedure.id, 
controller_procedure.title, controller_procedure.purpose, 
controller_procedure.responsibility, controller_procedure.description, 
controller_procedure.reference, controller_procedure.attachment ";
+                       $cols .= "controller_procedure.id, 
controller_procedure.title, controller_procedure.purpose, 
controller_procedure.responsibility, controller_procedure.description, 
controller_procedure.reference, controller_procedure.attachment, 
controller_procedure.start_date, controller_procedure.end_date ";
                }
                $dir = $ascending ? 'ASC' : 'DESC';
                $order = $sort_field ? "ORDER BY {$this->marshal($sort_field, 
'field')} $dir ": '';
@@ -334,6 +346,8 @@
                        
$procedure->set_description($this->unmarshal($this->db->f('description'), 
'string'));
                        
$procedure->set_reference($this->unmarshal($this->db->f('reference'), 
'string'));
                        
$procedure->set_attachment($this->unmarshal($this->db->f('attachment'), 
'string'));
+                       
$procedure->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
+                       
$procedure->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
                }
                
                return $procedure;

Modified: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php        2011-10-18 08:15:23 UTC 
(rev 7889)
+++ trunk/controller/inc/class.uicontrol.inc.php        2011-10-18 08:15:57 UTC 
(rev 7890)
@@ -121,7 +121,7 @@
                                                ),
                                                array(
                                                        'key'   =>      'title',
-                                                       'label' =>      
lang('Control title'),
+                                                       'label' =>      
lang('Title'),
                                                        'sortable'      =>      
false
                                                ),
                                                array(
@@ -130,11 +130,16 @@
                                                        'sortable'      => false
                                                ),
                                                array(
-                                                       'key' => 
'control_area_id',
+                                                       'key' => 
'control_area_name',
                                                        'label' => 
lang('Control area'),
                                                        'sortable'      => false
                                                ),
                                                array(
+                                                       'key' => 
'procedurename',
+                                                       'label' => 
lang('Procedure'),
+                                                       'sortable'      => false
+                                               ),
+                                               array(
                                                        'key' => 'link',
                                                        'hidden' => true
                                                )
@@ -165,6 +170,16 @@
                        {
                                $this->edit_control_groups();
                        }
+                       // Save locations and show tab control items
+                       else if( isset($_POST['save_control_locations']) || 
phpgw::get_var('view') == "view_control_locations")
+                       {
+                               $this->edit_control_locations();
+                       }
+                       // Save equipment and show tab control items
+                       else if( isset($_POST['save_control_equipment']) || 
phpgw::get_var('view') == "view_control_equipment")
+                       {
+                               $this->edit_control_equipment();
+                       }
                        // Save control items and show tab receipt
                        else if( isset($_POST['save_control_items']) )
                        {
@@ -198,6 +213,10 @@
                                                ), array(
                                                        'label' => 
lang('Control_groups')
                                                ), array(
+                                                       'label' => 
lang('Control_locations')
+                                               ), array(
+                                                       'label' => 
lang('Control_equipment')
+                                               ), array(
                                                        'label' => 
lang('Control_items')
                                                ), array(
                                                        'label' => 
lang('Receipt')
@@ -212,7 +231,7 @@
                                'control_areas_array'           => 
$control_areas_array,
                                'procedures_array'                      => 
$procedures_array,
                                'start_date'                            => 
$GLOBALS['phpgw']->yuical->add_listener('start_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 time())),
-                               'end_date'                                      
=> 
$GLOBALS['phpgw']->yuical->add_listener('end_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 time()))
+                               'end_date'                                      
=> 
$GLOBALS['phpgw']->yuical->add_listener('end_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 ''))
                        );
                        
                        self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
@@ -251,14 +270,15 @@
                                                array(
                                                        'label' => 
lang('Details'),
                                                        'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control", 'control_id' => 
$control_id))
-                                               ), 
-                                               array(
+                                               ), array(
                                                        'label' => 
lang('Control_groups')
-                                               ), 
-                                               array(
+                                               ), array(
+                                                       'label' => 
lang('Control_locations')
+                                               ), array(
+                                                       'label' => 
lang('Control_equipment')
+                                               ), array(
                                                        'label' => 
lang('Control_items')
-                                               ), 
-                                               array(
+                                               ), array(
                                                        'label' => 
lang('Receipt')
                                                )
                                        );
@@ -305,11 +325,13 @@
                                                        'label' => 
lang('Control_groups'),
                                                        'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_groups", 
                                                                                
                                                                               
'control_id' => $control_id, 'control_group_ids' => $control_group_ids))
-                                               ), 
-                                               array(
+                                               ), array(
+                                                       'label' => 
lang('Control_locations')
+                                               ), array(
+                                                       'label' => 
lang('Control_equipment')
+                                               ), array(
                                                        'label' => 
lang('Control_items')
-                                               ), 
-                                               array(
+                                               ), array(
                                                        'label' => 
lang('Receipt')
                                                )
                                        );
@@ -317,7 +339,7 @@
                        
                        $data = array
                        (
-                               'tabs'                                          
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 2),
+                               'tabs'                                          
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 4),
                                'view'                                          
=> 'control_items',
                                'control_group_ids'                     => 
implode($control_group_ids, ","),
                                'control_id'                            => 
$control_id,
@@ -389,20 +411,26 @@
                                                        'label' => 
lang('Control_groups'),
                                                        'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_groups", 
                                                                                
                                                                               
'control_id' => $control_id, 'control_group_ids' => $control_group_ids))
-                                               ), 
-                                               array(
+                                               ), array(
+                                                       'label' => 
lang('Control_locations'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_locations", 
+                                                                               
                                                                               
'control_id' => $control_id, 'location_ids' => $location_ids))
+                                               ), array(
+                                                       'label' => 
lang('Control_equipment'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_equipment", 
+                                                                               
                                                                               
'control_id' => $control_id, 'location_ids' => $euqipment_ids))
+                                               ), array(
                                                        'label' => 
lang('Control_items'),
                                                        'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_items", 
                                                                                
                                                                               
'control_id' => $control_id, 'control_group_ids' => $control_group_ids))
-                                               ), 
-                                               array(
+                                               ), array(
                                                        'label' => 
lang('Receipt')
                                                )
                                        );
                        
                        $data = array
                        (
-                               'tabs'                                  => 
$GLOBALS['phpgw']->common->create_tabs($tabs, 3),
+                               'tabs'                                  => 
$GLOBALS['phpgw']->common->create_tabs($tabs, 5),
                                'view'                                  => 
"receipt",
                                'control_id'                    => $control_id,
                                'control_receipt_items' => 
$saved_groups_with_items_array
@@ -448,7 +476,112 @@
                        self::render_template_xsl(array('control_tabs', 
'control_items_receipt'), $data);
                }
                
+               public function edit_control_locations(){
+                       
+                       $control_id = phpgw::get_var('control_id', 'int');
+                       
+                       $control_group_ids = array();
+                       $control_group_ids = 
phpgw::get_var('control_group_ids');
+
+                       $groups_with_control_items = array();
+                                       
+                       // Fetching control items for each control group and 
populates array
+                       foreach ($control_group_ids as $control_group_id)
+                       {       
+                               $group_control_items_array = 
$this->so_control_item->get_control_items_as_array($control_group_id);
+                               
+                               $control_group = 
$this->so_control_group->get_single($control_group_id);
+                               
+                               $groups_with_control_items[] = 
array("control_group" => $control_group->toArray(), "group_control_items" => 
$group_control_items_array);
+                       }                       
+                       
+                       $tabs = array(
+                                               array(
+                                                       'label' => 
lang('Details'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control", 'control_id' => 
$control_id))
+                                               ), 
+                                                       array(
+                                                       'label' => 
lang('Control_groups'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_groups", 
+                                                                               
                                                                               
'control_id' => $control_id, 'control_group_ids' => $control_group_ids))
+                                               ), array(
+                                                       'label' => 
lang('Control_locations'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_locations", 
+                                                                               
                                                                               
'control_id' => $control_id, 'location_ids' => $location_ids))
+                                               ), array(
+                                                       'label' => 
lang('Control_equipment')
+                                               ), array(
+                                                       'label' => 
lang('Control_items')
+                                               ), array(
+                                                       'label' => 
lang('Receipt')
+                                               )
+                                       );
+                       
+                       
+                       $data = array
+                       (
+                               'tabs'                                          
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 4),
+                               'view'                                          
=> 'control_items',
+                               'control_group_ids'                     => 
implode($control_group_ids, ","),
+                               'control_id'                            => 
$control_id,
+                               'location_ids'                          => 
implode($location_ids, ","),
+                       );
+                       
+                       self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
+                       self::add_javascript('controller', 'controller', 
'jquery.js');
+                       self::add_javascript('controller', 'controller', 
'custom_ui.js');
+                       self::render_template_xsl(array('control_tabs', 
'control_items'), $data);
+               }
                
+               public function edit_control_equipment(){
+                       
+                       $control_id = phpgw::get_var('control_id', 'int');
+                       
+                       $equipment_ids = array();
+                       $equipment_ids = phpgw::get_var('equipment_ids');
+
+                       $groups_with_control_items = array();
+                                       
+                       $tabs = array(
+                                               array(
+                                                       'label' => 
lang('Details'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control", 'control_id' => 
$control_id))
+                                               ), 
+                                                       array(
+                                                       'label' => 
lang('Control_groups'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_groups", 
+                                                                               
                                                                               
'control_id' => $control_id, 'control_group_ids' => $control_group_ids))
+                                               ), array(
+                                                       'label' => 
lang('Control_locations'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_locations", 
+                                                                               
                                                                               
'control_id' => $control_id, 'location_ids' => $location_ids))
+                                               ), array(
+                                                       'label' => 
lang('Control_equipment'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_euqipment", 
+                                                                               
                                                                               
'control_id' => $control_id, 'equipmentids' => $equipment_ids))
+                                               ), array(
+                                                       'label' => 
lang('Control_items')
+                                               ), array(
+                                                       'label' => 
lang('Receipt')
+                                               )
+                                       );
+                       
+                       
+                       $data = array
+                       (
+                               'tabs'                                          
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 4),
+                               'view'                                          
=> 'control_items',
+                               'control_group_ids'                     => 
implode($control_group_ids, ","),
+                               'control_id'                            => 
$control_id,
+                               'groups_with_control_items'     => 
$groups_with_control_items                   
+                       );
+                       
+                       self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
+                       self::add_javascript('controller', 'controller', 
'jquery.js');
+                       self::add_javascript('controller', 'controller', 
'custom_ui.js');
+                       self::render_template_xsl(array('control_tabs', 
'control_items'), $data);
+               }
+               
                public function query()
                {
                        $params = array(
@@ -486,10 +619,10 @@
                        $control_id = phpgw::get_var('control_id');
                        if(isset($control_id))
                        {
-                               $control = $this->so->get_single($control_id);
+                               $control = 
$this->so_control->get_single($control_id);
                        }
 
-                       $result_objects = $this->so->get($start_index, 
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type, 
$filters);
+                       $result_objects = $this->so_control->get($start_index, 
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type, 
$filters);
                        //var_dump($result_objects);
                                                                
                        $results = array();
@@ -517,7 +650,7 @@
                        {
                                if(isset($control_id) && $control_id > 0)
                                {
-                                       $control = 
$this->so->get_single($control_id);
+                                       $control = 
$this->so_control->get_single($control_id);
                                }
                                else
                                {
@@ -528,16 +661,29 @@
                                $control_array = $control->toArray();
                                //var_dump($control);
                        
-                               $tabs = array
-                               (
-                                       'details'       => array('label' => 
lang('Details'), 'link' => '#details'),
-                                       'control_groups'                => 
array('label' => lang('Control_groups'), 'link' => '#control_groups'),
-                                       'control_items'         => 
array('label' => lang('Control_items'), 'link' => '#control_items')
-                               );
+                               $tabs = array(
+                                               array(
+                                                       'label' => 
lang('Details'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control", 'control_id' => 
$control_id))
+                                               ), 
+                                               array(
+                                                       'label' => 
lang('Control_groups'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_groups", 
+                                                                               
                                                                               
'control_id' => $control->get_id(), 'control_group_ids' => $control_group_ids))
+                                               ), array(
+                                                       'label' => 
lang('Control_locations')
+                                               ), array(
+                                                       'label' => 
lang('Control_equipment')
+                                               ), array(
+                                                       'label' => 
lang('Control_items'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.index', 'view' => "view_control_items", 
+                                                                               
                                                                               
'control_id' => $control->get_id(), 'control_group_ids' => $control_group_ids))
+                                               )
+                                       );
                                
                                $add_document_link = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uiexample.index') );
                                        
-                               $procedure_array = 
$this->so_proc->get_procedure_array();
+                               $procedure_array = 
$this->so_procedure->get_procedures();
                                        
                                foreach ($procedure_array as $procedure)
                                {
@@ -550,14 +696,20 @@
                                {
                                        $control_area_options[] = 
$control_area->toArray();
                                }
+
+                               if($control->get_start_date() && 
$control->get_start_date() != null)
+                                       $control_start_date = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$control->get_start_date());
+                               if($control->get_end_date() && 
$control->get_end_date() != null)
+                                       $control_end_date       = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$control->get_end_date());
                                
                                phpgwapi_yui::tabview_setup('control_tabview');
                                
                                $data = array
                                (
                                        'tabs'                                  
        => phpgwapi_yui::tabview_generate($tabs, 'details'),
-                                       'start_date'                            
=> 
$GLOBALS['phpgw']->yuical->add_listener('start_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 time())),
-                                       'end_date'                              
        => 
$GLOBALS['phpgw']->yuical->add_listener('end_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 time())),
+                                       'view'                                  
        => 'control_details',
+                                       'start_date'                            
=> $control_start_date,
+                                       'end_date'                              
        => $control_end_date,
                                        'value_id'                              
        => !empty($control) ? $control->get_id() : 0,
                                        'img_go_home'                           
=> 'rental/templates/base/images/32x32/actions/go-home.png',
                                        'control'                               
        => $control_array,

Modified: trunk/controller/inc/class.uiprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.uiprocedure.inc.php      2011-10-18 08:15:23 UTC 
(rev 7889)
+++ trunk/controller/inc/class.uiprocedure.inc.php      2011-10-18 08:15:57 UTC 
(rev 7890)
@@ -111,6 +111,8 @@
                                        
$procedure->set_description(phpgw::get_var('description','html'));
                                        
$procedure->set_reference(phpgw::get_var('reference'));
                                        
$procedure->set_attachment(phpgw::get_var('attachment'));
+                                       
$procedure->set_start_date(strtotime(phpgw::get_var('start_date_hidden')));
+                                       
$procedure->set_end_date(strtotime(phpgw::get_var('end_date_hidden')));
                                        
                                        if(isset($procedure_id) && 
$procedure_id > 0)
                                        {
@@ -164,6 +166,8 @@
                                $data = array
                                (
                                        'value_id'                              
=> !empty($procedure) ? $procedure->get_id() : 0,
+                                       'start_date'                    => 
$GLOBALS['phpgw']->yuical->add_listener('start_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 ($procedure->get_start_date())?$procedure->get_start_date():time())),
+                                       'end_date'                              
=> 
$GLOBALS['phpgw']->yuical->add_listener('end_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 ($procedure->get_end_date())?$procedure->get_end_date():'')),
                                        'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
                                        'editable'                              
=> true,
                                        'procedure'                             
=> $procedure_array,
@@ -224,6 +228,10 @@
                                }
                                
                                $procedure_array = $procedure->toArray();
+                               if($procedure->get_start_date() && 
$procedure->get_start_date() != null)
+                                       $procedure_start_date = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$procedure->get_start_date());
+                               if($procedure->get_end_date() && 
$procedure->get_end_date() != null)
+                                       $procedure_end_date     = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$procedure->get_end_date());
                                //_debug_array($procedure_array);
        
                                $data = array
@@ -231,6 +239,8 @@
                                        'value_id'                              
=> !empty($procedure) ? $procedure->get_id() : 0,
                                        'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
                                        'procedure'                             
=> $procedure_array,
+                                       'start_date'                    => 
$procedure_start_date,
+                                       'end_date'                              
=> $procedure_end_date
                                );
        
        

Modified: trunk/controller/inc/model/class.control.inc.php
===================================================================
--- trunk/controller/inc/model/class.control.inc.php    2011-10-18 08:15:23 UTC 
(rev 7889)
+++ trunk/controller/inc/model/class.control.inc.php    2011-10-18 08:15:57 UTC 
(rev 7890)
@@ -13,6 +13,7 @@
                protected $repeat_type;
                protected $repeat_interval;
                protected $procedure_id;
+               protected $procedure_name;
                protected $enabled;
                protected $requirement_id;
                protected $costresponsibility_id;
@@ -21,6 +22,7 @@
                protected $equipment_type_id;
                protected $location_code;
                protected $control_area_id;
+               protected $control_area_name;
 
                /*
                var $validate = array(
@@ -104,6 +106,13 @@
                
                public function get_procedure_id() { return 
$this->procedure_id; }
                
+               public function set_procedure_name($procedure_name)
+               {
+                       $this->procedure_name = $procedure_name;
+               }
+               
+               public function get_procedure_name() { return 
$this->procedure_name; }
+               
                public function set_enabled($enabled)
                {
                        $this->enabled = $enabled;
@@ -160,6 +169,13 @@
                
                public function get_control_area_id() { return 
$this->control_area_id; }
                
+               public function set_control_area_name($control_area_name)
+               {
+                       $this->control_area_name = $control_area_name;
+               }
+               
+               public function get_control_area_name() { return 
$this->control_area_name; }
+               
                /**
                 * Get a static reference to the storage object associated with 
this model object
                 * 
@@ -193,7 +209,9 @@
                                'start_date' => $this->get_start_date(),
                                'end_date' => $this->get_end_date(),
                                'procedure_id' => $this->get_procedure_id(),
-                               'control_area_id' => 
$this->get_control_area_id()
+                               'procedure_name' => $this->get_procedure_name(),
+                               'control_area_id' => 
$this->get_control_area_id(),
+                               'control_area_name' => 
$this->get_control_area_name()
                                );
                }
        }

Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang        2011-10-18 08:15:23 UTC (rev 
7889)
+++ trunk/controller/setup/phpgw_no.lang        2011-10-18 08:15:57 UTC (rev 
7890)
@@ -230,6 +230,8 @@
 Procedure description  controller      no      Beskrivelse
 Procedure reference    controller      no      Referanse
 Procedure attachment   controller      no      Vedlegg
+Procedure start date   controller      no      Start dato
+Procedure end date     controller      no      Slutt dato
 New control item       controller      no      Nytt kontrollpunkt
 Control item title     controller      no      Tittel
 Control_group  controller      no      Kontrollgruppe
@@ -248,4 +250,9 @@
 New control group      controller      no      Ny kontrollgruppe
 Control group title    controller      no      Tittel
 Building part  controller      no      Bygningsdel
-remove controller      no      Fjern valgte elementer
\ No newline at end of file
+remove controller      no      Fjern valgte elementer
+Locations      controller      no      Lokasjoner
+Equipment      controller      no      Utstyr
+Control_locations      controller      no      Lokasjoner
+Control_equipment      controller      no      Utstyr
+New control    controller      no      Ny kontroll
\ No newline at end of file

Modified: trunk/controller/templates/base/control.xsl
===================================================================
--- trunk/controller/templates/base/control.xsl 2011-10-18 08:15:23 UTC (rev 
7889)
+++ trunk/controller/templates/base/control.xsl 2011-10-18 08:15:57 UTC (rev 
7890)
@@ -34,7 +34,7 @@
                                                </select>
                                        </xsl:when>
                                        <xsl:otherwise>
-                                               <xsl:value-of 
select="control/control_area_id" />
+                                               <xsl:value-of 
select="control/control_area_name" />
                                        </xsl:otherwise>
                                </xsl:choose>
                                </dd>
@@ -62,7 +62,7 @@
                                                </select>
                                        </xsl:when>
                                        <xsl:otherwise>
-                                               <xsl:value-of 
select="control/procedure_id" />
+                                               <xsl:value-of 
select="control/procedure_name" />
                                        </xsl:otherwise>
                                </xsl:choose>
                                </dd>

Added: trunk/controller/templates/base/control_equipment.xsl
===================================================================
--- trunk/controller/templates/base/control_equipment.xsl                       
        (rev 0)
+++ trunk/controller/templates/base/control_equipment.xsl       2011-10-18 
08:15:57 UTC (rev 7890)
@@ -0,0 +1,23 @@
+<xsl:template name="control_equipment" xmlns:php="http://php.net/xsl";>
+
+<div class="yui-content">
+       <div>
+                 
+          <!-- ===========================  CHOOSE EQUIPMENT  
=============================== -->
+          <h2>Velg Utstyrskategori/utstyr</h2>
+          
+               <h4 class="expand_header"><div class="expand_all">Vis 
alle</div><div class="collapse_all">Skjul alle</div></h4>
+               <form id="frm_control_items" action="#" method="post">  
+               
+               <xsl:variable name="control_id"><xsl:value-of 
select="control_id"/></xsl:variable>
+               <input type="hidden" name="control_id" value="{control_id}" />  
        
+               <strong>Velg utstyrskategori/utstyr</strong>    
+               <div class="form-buttons">
+                       <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>
+                       <input type="submit" name="save_control_equipment" 
value="{$lang_save}" title = "{$lang_save}" />
+               </div>
+               </form>
+                                                               
+       </div>
+</div>
+</xsl:template>
\ No newline at end of file


Property changes on: trunk/controller/templates/base/control_equipment.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/controller/templates/base/control_locations.xsl
===================================================================
--- trunk/controller/templates/base/control_locations.xsl                       
        (rev 0)
+++ trunk/controller/templates/base/control_locations.xsl       2011-10-18 
08:15:57 UTC (rev 7890)
@@ -0,0 +1,23 @@
+<xsl:template name="control_locations" xmlns:php="http://php.net/xsl";>
+
+<div class="yui-content">
+       <div>
+                 
+          <!-- ===========================  CHOOSE CONTROL LOCATIONS  
=============================== -->
+          <h2>Velg Byggkategori/Eiendom/Bygg</h2>
+          
+               <h4 class="expand_header"><div class="expand_all">Vis 
alle</div><div class="collapse_all">Skjul alle</div></h4>
+               <form id="frm_control_items" action="#" method="post">  
+               
+               <xsl:variable name="control_id"><xsl:value-of 
select="control_id"/></xsl:variable>
+               <input type="hidden" name="control_id" value="{control_id}" />  
        
+               <strong>Liste over byggkategorier/eiendommer/bygg el.</strong>
+               <div class="form-buttons">
+                       <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>
+                       <input type="submit" name="save_control_locations" 
value="{$lang_save}" title = "{$lang_save}" />
+               </div>
+               </form>
+                                                               
+       </div>
+</div>
+</xsl:template>
\ No newline at end of file


Property changes on: trunk/controller/templates/base/control_locations.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/controller/templates/base/control_tabs.xsl
===================================================================
--- trunk/controller/templates/base/control_tabs.xsl    2011-10-18 08:15:23 UTC 
(rev 7889)
+++ trunk/controller/templates/base/control_tabs.xsl    2011-10-18 08:15:57 UTC 
(rev 7890)
@@ -18,6 +18,20 @@
                        <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
                        <xsl:call-template name="control_groups" />
                </xsl:when>
+               <xsl:when test="view = 'control_locations'">
+                       <div class="identifier-header">
+                               <h1><xsl:value-of select="php:function('lang', 
'Control_locations')"/></h1>
+                       </div>
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                       <xsl:call-template name="control_locations" />
+               </xsl:when>
+               <xsl:when test="view = 'control_equipment'">
+                       <div class="identifier-header">
+                               <h1><xsl:value-of select="php:function('lang', 
'Control_equipment')"/></h1>
+                       </div>
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                       <xsl:call-template name="control_equipment" />
+               </xsl:when>
                <xsl:when test="view = 'control_items'">
                        <div class="identifier-header">
                                <h1><xsl:value-of select="php:function('lang', 
'Control_items')"/></h1>

Modified: trunk/controller/templates/base/procedure_item.xsl
===================================================================
--- trunk/controller/templates/base/procedure_item.xsl  2011-10-18 08:15:23 UTC 
(rev 7889)
+++ trunk/controller/templates/base/procedure_item.xsl  2011-10-18 08:15:57 UTC 
(rev 7890)
@@ -68,6 +68,18 @@
                                        </xsl:choose>
                                        </dd>
                                        <dt>
+                                               <label 
for="start_date"><xsl:value-of select="php:function('lang','Procedure start 
date')" /></label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:value-of 
disable-output-escaping="yes" select="start_date"/>
+                                       </dd>
+                                       <dt>
+                                               <label 
for="end_date"><xsl:value-of select="php:function('lang','Procedure end date')" 
/></label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:value-of 
disable-output-escaping="yes" select="end_date"/>
+                                       </dd>
+                                       <dt>
                                                <label 
for="reference"><xsl:value-of select="php:function('lang','Procedure 
Reference')" /></label>
                                        </dt>
                                        <dd>




reply via email to

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