fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7591]


From: Torstein
Subject: [Fmsystem-commits] [7591]
Date: Thu, 15 Sep 2011 05:48:35 +0000

Revision: 7591
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7591
Author:   vator
Date:     2011-09-15 05:48:34 +0000 (Thu, 15 Sep 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.menu.inc.php
    trunk/controller/inc/class.socontrol.inc.php
    trunk/controller/inc/class.uicontrol.inc.php
    trunk/controller/inc/model/class.control.inc.php
    trunk/controller/setup/phpgw_no.lang
    trunk/controller/setup/setup.inc.php
    trunk/controller/setup/tables_current.inc.php
    trunk/controller/templates/base/control.php

Added Paths:
-----------
    trunk/controller/inc/class.socontrol_group.inc.php
    trunk/controller/inc/class.socontrol_item.inc.php
    trunk/controller/inc/class.uicontrol_item.inc.php
    trunk/controller/templates/base/control_item.php
    trunk/controller/templates/base/unit_list_partial.php

Modified: trunk/controller/inc/class.menu.inc.php
===================================================================
--- trunk/controller/inc/class.menu.inc.php     2011-09-14 19:24:58 UTC (rev 
7590)
+++ trunk/controller/inc/class.menu.inc.php     2011-09-15 05:48:34 UTC (rev 
7591)
@@ -12,7 +12,7 @@
                                'controller' => array
                                (
                                        'text'  => lang('Controller'),
-                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'activitycalendar.uiactivities.index') ),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol.index') ),
                     'image'    => array('property', 'location'),
                                        'order' => 10,
                                        'group' => 'office'
@@ -27,20 +27,12 @@
                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol.index') ),
                                  'image'       => array('property', 
'location_1'),
                                ),
-                               'organizationList' => array
+                               'control_item' => array
                                (
-                                       'text'  => lang('OrganizationList'),
-                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'activitycalendar.uiorganization.index') ),
-                           'image'     => array('property', 'location_tenant'),
-                                       'children'      => array(
-                                                               
'changed_organizations' => array
-                                                               (
-                                                                       'text'  
=> lang('changed_org_group'),
-                                                                       'url'   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'activitycalendar.uiorganization.changed_organizations') ),
-                                                                       'image' 
=> array('property', 'location_tenant')
-                                                               )
-                                                       )
-                               )      
+                                       'text'  => lang('Control_item'),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol_item.index') ),
+                                 'image'       => array('property', 
'location_1'),
+                               )     
                        );
                        
                        $menus['folders'] = 
phpgwapi_menu::get_categories('bergen');

Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php        2011-09-14 19:24:58 UTC 
(rev 7590)
+++ trunk/controller/inc/class.socontrol.inc.php        2011-09-15 05:48:34 UTC 
(rev 7591)
@@ -31,8 +31,6 @@
                
                $title = $control->get_title();
                
-               var_dump("i add");
-               
                $sql = "INSERT INTO controller_control (title) VALUES 
('$title')";
                $result = $this->db->query($sql, __LINE__,__FILE__);
 
@@ -67,8 +65,8 @@
                        'description = ' . 
$this->marshal($control->get_description(), 'string'),
                        'start_date = ' . 
$this->marshal($control->get_start_date(), 'int'),
                        'end_date = ' . 
$this->marshal($control->get_end_date(), 'int'),
-                       'repeat_date = ' . 
$this->marshal($control->get_repeat_date(), 'int'),
                        'repeat_day = ' . 
$this->marshal($control->get_repeat_day(), 'int'),
+                       'repeat_type = ' . 
$this->marshal($control->get_repeat_type(), 'int'),
                        'repeat_interval = ' . 
$this->marshal($control->get_repeat_interval(), 'int'),
                
                );

Added: trunk/controller/inc/class.socontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_group.inc.php                          
(rev 0)
+++ trunk/controller/inc/class.socontrol_group.inc.php  2011-09-15 05:48:34 UTC 
(rev 7591)
@@ -0,0 +1,176 @@
+<?php
+phpgw::import_class('controller.socommon');
+
+include_class('controller', 'control_group', 'inc/model/');
+
+class controller_socontrol_group extends controller_socommon
+{
+       protected static $so;
+
+       /**
+        * Get a static reference to the storage object associated with this 
model object
+        *
+        * @return controller_soparty the storage object
+        */
+       public static function get_instance()
+       {
+               if (self::$so == null) {
+                       self::$so = CreateObject('controller.socontrol_group');
+               }
+               return self::$so;
+       }
+
+       /**
+        * Function for adding a new activity to the database. Updates the 
activity object.
+        *
+        * @param activitycalendar_activity $activity the party to be added
+        * @return bool true if successful, false otherwise
+        */
+       function add(&$control_group)
+       {
+               
+               $control_group = $control_group->get_control_group();
+               
+               $sql = "INSERT INTO controller_control_group (group_name) 
VALUES ('$title')";
+               $result = $this->db->query($sql, __LINE__,__FILE__);
+
+               if(isset($result)) {
+                       // Set the new party ID
+                       
$control_group->set_id($this->db->get_last_insert_id('controller_control_group',
 'id'));
+                       // Forward this request to the update method
+                       return $this->update($control_group);
+               }
+               else
+               {
+                       return false;
+               }
+               
+       }
+
+       /**
+        * Update the database values for an existing activity object.
+        *
+        * @param $activity the activity to be updated
+        * @return boolean true if successful, false otherwise
+        */
+
+       function update($control_group)
+       {       
+               $id = intval($control_group->get_id());
+                       
+               $values = array(
+                       '$group_name = ' . 
$this->marshal($control_group->get_group_name(), 'string')
+               );
+               
+               //var_dump('UPDATE activity_activity SET ' . join(',', $values) 
. " WHERE id=$id");
+               $result = $this->db->query('UPDATE controller_control_group SET 
' . join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+               
+               return isset($result);
+       }
+       
+       /**
+        * Get single procedure
+        * 
+        * @param       $id     id of the procedure to return
+        * @return a controller_procedure
+        */
+       function get_single($id)
+       {
+               $id = (int)$id;
+               
+               $sql = "SELECT p.* FROM controller_control_group p WHERE p.id = 
" . $id;
+               $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+               $this->db->next_record();
+               
+               $control_group = new 
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
+               
$control_group->set_group_name($this->unmarshal($this->db->f('group_name', 
true), 'string'));
+               
+               return $control_group;
+       }
+       
+       /**
+        * 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_group_array($start = 0, $results = 1000, $sort = 
null, $dir = '', $query = null, $search_option = null, $filters = array())
+       {
+               $results = array();
+               
+               //$condition = $this->get_conditions($query, 
$filters,$search_option);
+               $order = $sort ? "ORDER BY $sort $dir ": '';
+               
+               //$sql = "SELECT * FROM controller_procedure WHERE $condition 
$order";
+               $sql = "SELECT * FROM controller_control_group $order";
+               $this->db->limit_query($sql, $start, __LINE__, __FILE__, 
$limit);
+               
+               while ($this->db->next_record()) {
+                       $control_group = new 
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
+                       
$control_group->set_group_name($this->unmarshal($this->db->f('group_name', 
true), 'string'));
+                       
+                       $results[] = $control_group;
+               }
+               
+               return $results;
+       }       
+       
+       function get_id_field_name($extended_info = false)
+       {
+               /*
+               if(!$extended_info)
+               {
+                       $ret = 'id';
+               }
+               else
+               {
+                       $ret = array
+                       (
+                               'table'                 => 'activity', // alias
+                               'field'                 => 'id',
+                               'translated'    => 'id'
+                       );
+               }
+               */
+               return $ret;
+       }
+
+       protected function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean $return_count)
+       {
+               
+               
+       }
+       
+       function populate(int $control_group_id, &$control_group)
+       {
+               /*
+               if($control_group == null) {
+                       $control_group = new activitycalendar_activity((int) 
$activity_id);
+
+                       
$control_group->set_title($this->unmarshal($this->db->f('title'), 'string'));
+                       
$control_group->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                       
$control_group->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
+                       
$control_group->set_district($this->unmarshal($this->db->f('district'), 'int'));
+                       
$control_group->set_office($this->unmarshal($this->db->f('office'), 'int'));
+                       
$control_group->set_category($this->unmarshal($this->db->f('category'), 'int'));
+                       
$control_group->set_state($this->unmarshal($this->db->f('state'), 'int'));
+                       
$control_group->set_target($this->unmarshal($this->db->f('target'), 'string'));
+                       
$control_group->set_description($this->unmarshal($this->db->f('description'), 
'string'));
+                       
$control_group->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
+                       
$control_group->set_internal_arena($this->unmarshal($this->db->f('internal_arena'),
 'string'));
+                       
$control_group->set_time($this->unmarshal($this->db->f('time'), 'string'));
+                       
$control_group->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
 'int'));
+                       
$control_group->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
 'bool')));
+                       
$control_group->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
+                       
+                       
+               }
+               */
+               return $control_group;
+       }
+       
+}

Added: trunk/controller/inc/class.socontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_item.inc.php                           
(rev 0)
+++ trunk/controller/inc/class.socontrol_item.inc.php   2011-09-15 05:48:34 UTC 
(rev 7591)
@@ -0,0 +1,190 @@
+<?php
+phpgw::import_class('controller.socommon');
+
+include_class('controller', 'control_item', 'inc/model/');
+
+class controller_socontrol_item extends controller_socommon
+{
+       protected static $so;
+
+       /**
+        * Get a static reference to the storage object associated with this 
model object
+        *
+        * @return controller_soparty the storage object
+        */
+       public static function get_instance()
+       {
+               if (self::$so == null) {
+                       self::$so = CreateObject('controller.socontrol_item');
+               }
+               return self::$so;
+       }
+
+       /**
+        * Function for adding a new activity to the database. Updates the 
activity object.
+        *
+        * @param activitycalendar_activity $activity the party to be added
+        * @return bool true if successful, false otherwise
+        */
+       function add(&$control_item)
+       {
+               
+               $title = $control_item->get_title();
+               
+               $sql = "INSERT INTO controller_control_item (title) VALUES 
('$title')";
+               $result = $this->db->query($sql, __LINE__,__FILE__);
+
+               if(isset($result)) {
+                       // Set the new party ID
+                       
$control_item->set_id($this->db->get_last_insert_id('controller_control_item', 
'id'));
+                       // Forward this request to the update method
+                       return $this->update($control_item);
+               }
+               else
+               {
+                       return false;
+               }
+               
+       }
+
+       /**
+        * Update the database values for an existing activity object.
+        *
+        * @param $activity the activity to be updated
+        * @return boolean true if successful, false otherwise
+        */
+
+       function update($control_item)
+       {       
+               $id = intval($control_item->get_id());
+                       
+               $values = array(
+                       '$purpose = ' . 
$this->marshal($control_item->get_purpose(), 'string'),
+                       'responsibility = ' . 
$this->marshal($control_item->get_responsibility(), 'int'),
+                       'description = ' . 
$this->marshal($control_item->get_description(), 'int'),
+                       'reference = ' . 
$this->marshal($control_item->get_reference(), 'int'),
+                       'attachment = ' . 
$this->marshal($control_item->get_attachment(), 'int')
+               );
+               
+               //var_dump('UPDATE activity_activity SET ' . join(',', $values) 
. " WHERE id=$id");
+               $result = $this->db->query('UPDATE controller_control_item SET 
' . join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+               
+               return isset($result);
+       }
+       
+       /**
+        * Get single procedure
+        * 
+        * @param       $id     id of the procedure to return
+        * @return a controller_procedure
+        */
+       function get_single($id)
+       {
+               $id = (int)$id;
+               
+               $sql = "SELECT p.* FROM controller_control_item p WHERE p.id = 
" . $id;
+               $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+               $this->db->next_record();
+               
+               $control_item = new 
controller_control_item($this->unmarshal($this->db->f('id', true), 'int'));
+               $control_item->set_title($this->unmarshal($this->db->f('title', 
true), 'string'));
+               
$control_item->set_purpose($this->unmarshal($this->db->f('purpose', true), 
'string'));
+               
$control_item->set_responsibility($this->unmarshal($this->db->f('responsibility',
 true), 'string'));
+               
$control_item->set_description($this->unmarshal($this->db->f('description', 
true), 'string'));
+               
$control_item->set_reference($this->unmarshal($this->db->f('reference', true), 
'string'));
+               
$control_item->set_attachment($this->unmarshal($this->db->f('attachment', 
true), 'string'));
+               
+               return $control_item;
+       }
+       
+       /**
+        * 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();
+               
+               //$condition = $this->get_conditions($query, 
$filters,$search_option);
+               $order = $sort ? "ORDER BY $sort $dir ": '';
+               
+               //$sql = "SELECT * FROM controller_procedure WHERE $condition 
$order";
+               $sql = "SELECT * FROM controller_control_item $order";
+               $this->db->limit_query($sql, $start, __LINE__, __FILE__, 
$limit);
+               
+               while ($this->db->next_record()) {
+                       $control_item = new 
controller_control_item($this->unmarshal($this->db->f('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), 
'boolean'));
+                       
$control_item->set_what_to_desc($this->unmarshal($this->db->f('what_to_desc', 
true), 'string'));
+                       
$control_item->set_how_to_desc($this->unmarshal($this->db->f('how_to_desc', 
true), 'string'));
+                       
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
+                       
$control_item->set_control_type_id($this->unmarshal($this->db->f('control_type_id',
 true), 'int'));
+                       
+                       $results[] = $control_item;
+               }
+               
+               return $results;
+       }       
+       
+       function get_id_field_name($extended_info = false)
+       {
+               /*
+               if(!$extended_info)
+               {
+                       $ret = 'id';
+               }
+               else
+               {
+                       $ret = array
+                       (
+                               'table'                 => 'activity', // alias
+                               'field'                 => 'id',
+                               'translated'    => 'id'
+                       );
+               }
+               */
+               return $ret;
+       }
+
+       protected function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean $return_count)
+       {
+               
+               
+       }
+       
+       function populate(int $control_item_id, &$control_item)
+       {
+               /*
+               if($control_item == null) {
+                       $control_item = new activitycalendar_activity((int) 
$activity_id);
+
+                       
$control_item->set_title($this->unmarshal($this->db->f('title'), 'string'));
+                       
$control_item->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                       
$control_item->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
+                       
$control_item->set_district($this->unmarshal($this->db->f('district'), 'int'));
+                       
$control_item->set_office($this->unmarshal($this->db->f('office'), 'int'));
+                       
$control_item->set_category($this->unmarshal($this->db->f('category'), 'int'));
+                       
$control_item->set_state($this->unmarshal($this->db->f('state'), 'int'));
+                       
$control_item->set_target($this->unmarshal($this->db->f('target'), 'string'));
+                       
$control_item->set_description($this->unmarshal($this->db->f('description'), 
'string'));
+                       
$control_item->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
+                       
$control_item->set_internal_arena($this->unmarshal($this->db->f('internal_arena'),
 'string'));
+                       
$control_item->set_time($this->unmarshal($this->db->f('time'), 'string'));
+                       
$control_item->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
 'int'));
+                       
$control_item->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
 'bool')));
+                       
$control_item->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
+                       
+                       
+               }
+               */
+               return $control_item;
+       }
+       
+}

Modified: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php        2011-09-14 19:24:58 UTC 
(rev 7590)
+++ trunk/controller/inc/class.uicontrol.inc.php        2011-09-15 05:48:34 UTC 
(rev 7591)
@@ -20,7 +20,7 @@
                public function __construct()
                {
                        parent::__construct();
-                       
+
                        $this->so = CreateObject('controller.socontrol');
                        $this->so_proc = CreateObject('controller.soprocedure');
                        $this->bo = CreateObject('property.boevent',true);
@@ -28,21 +28,27 @@
                
                public function index()
                {
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"controller::control";
+                       
                        $repeat_type = $this->bo->get_rpt_type_list();
                        $repeat_day = $this->bo->get_rpt_day_list();
 
                        if(isset($_POST['save_control'])) // The user has 
pressed the save button
                        {
-                               if(isset($control)) // If an control object is 
created
+                               if(isset($control)) // Edit control
                                {
                                        
$control->set_title(phpgw::get_var('title'));
-                                       $control->set_description($desc);
+                                       
$control->set_description(phpgw::get_var('description'));
                                        $control->set_start_date( strtotime( 
phpgw::get_var('start_date')  ) );
                                        $control->set_end_date( strtotime( 
phpgw::get_var('end_date') ) );
+                                       $control->set_repeat_day( strtotime( 
phpgw::get_var('repeat_day') ) );
+                                       $control->set_repeat_type( strtotime( 
phpgw::get_var('repeat_type') ) );
+                                       $control->set_repeat_interval( 
strtotime( phpgw::get_var('repeat_interval') ) );
+                                       $control->set_enabled( true );
                                                                        
                                        $this->so->add($control);
                                }
-                               else 
+                               else // Add new control
                                {
 
                                        $control = new controller_control();
@@ -54,7 +60,7 @@
                                        $control->set_repeat_day( strtotime( 
phpgw::get_var('repeat_day') ) );
                                        $control->set_repeat_type( strtotime( 
phpgw::get_var('repeat_type') ) );
                                        $control->set_repeat_interval( 
strtotime( phpgw::get_var('repeat_interval') ) );
-                                       
+                                       $control->set_enabled( true );
                                                                        
                                        $this->so->add($control);
                                }

Added: trunk/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_item.inc.php                           
(rev 0)
+++ trunk/controller/inc/class.uicontrol_item.inc.php   2011-09-15 05:48:34 UTC 
(rev 7591)
@@ -0,0 +1,88 @@
+<?php
+       phpgw::import_class('controller.uicommon');
+       phpgw::import_class('property.boevent');
+       phpgw::import_class('controller.socontrol');
+       phpgw::import_class('controller.socontrol_item');
+       phpgw::import_class('controller.socontrol_group');
+       
+       include_class('controller', 'control', 'inc/model/');
+
+       class controller_uicontrol_item extends controller_uicommon
+       {
+               private $bo; 
+               private $so;
+               private $so_proc; 
+               
+               public $public_functions = array
+               (
+                       'index' =>      true
+               );
+
+               public function __construct()
+               {
+                       parent::__construct();
+
+                       $this->so = CreateObject('controller.socontrol');
+                       $this->so_control_item = 
CreateObject('controller.socontrol_item');
+                       $this->so_control_group = 
CreateObject('controller.socontrol_group');
+                       $this->bo = CreateObject('property.boevent',true);
+               }
+               
+               public function index()
+               {
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"controller::control";
+                       
+                       $repeat_type = $this->bo->get_rpt_type_list();
+                       $repeat_day = $this->bo->get_rpt_day_list();
+
+                       if(isset($_POST['save_control'])) // The user has 
pressed the save button
+                       {
+                               if(isset($control)) // Edit control
+                               {
+                                       
$control->set_title(phpgw::get_var('title'));
+                                       
$control->set_description(phpgw::get_var('description'));
+                                       $control->set_start_date( strtotime( 
phpgw::get_var('start_date')  ) );
+                                       $control->set_end_date( strtotime( 
phpgw::get_var('end_date') ) );
+                                       $control->set_repeat_day( strtotime( 
phpgw::get_var('repeat_day') ) );
+                                       $control->set_repeat_type( strtotime( 
phpgw::get_var('repeat_type') ) );
+                                       $control->set_repeat_interval( 
strtotime( phpgw::get_var('repeat_interval') ) );
+                                       $control->set_enabled( true );
+                                                                       
+                                       $this->so->add($control);
+                               }
+                               else // Add new control
+                               {
+
+                                       $control = new controller_control();
+                                       
+                                       
$control->set_title(phpgw::get_var('title'));
+                                       
$control->set_description(phpgw::get_var('description'));
+                                       $control->set_start_date( strtotime( 
phpgw::get_var('start_date')  ) );
+                                       $control->set_end_date( strtotime( 
phpgw::get_var('end_date') ) );
+                                       $control->set_repeat_day( strtotime( 
phpgw::get_var('repeat_day') ) );
+                                       $control->set_repeat_type( strtotime( 
phpgw::get_var('repeat_type') ) );
+                                       $control->set_repeat_interval( 
strtotime( phpgw::get_var('repeat_interval') ) );
+                                       $control->set_enabled( true );
+                                                                       
+                                       $this->so->add($control);
+                               }
+                       }
+                       
+                       $control_item_array = 
$this->so_control_item->get_control_item_array();
+                       $control_group_array = 
$this->so_control_group->get_control_group_array();
+                       
+                       $this->render('control_item.php', array
+                                               (
+                                               'editable' => true,
+                                               'control_item_array' => 
$control_item_array,
+                                               'control_group_array' => 
$control_group_array 
+                                               )
+                                       );
+               }
+                                       
+               public function query()
+               {
+                       var_dump("Er i uicontrol");
+
+               }       
+       }
\ No newline at end of file

Modified: trunk/controller/inc/model/class.control.inc.php
===================================================================
--- trunk/controller/inc/model/class.control.inc.php    2011-09-14 19:24:58 UTC 
(rev 7590)
+++ trunk/controller/inc/model/class.control.inc.php    2011-09-15 05:48:34 UTC 
(rev 7591)
@@ -10,7 +10,11 @@
                protected $description;
                protected $start_date;
                protected $end_date;
-               
+               protected $repeat_day;
+               protected $repeat_type;
+               protected $repeat_interval;
+               protected $enabled;
+                               
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
                 * the database the ID should be empty so the database can add 
one according to its logic.
@@ -57,7 +61,34 @@
                
                public function get_start_date() { return $this->start_date; }
                
+               public function set_repeat_day($repeat_day)
+               {
+                       $this->repeat_day = $repeat_day;
+               }
                
+               public function get_repeat_day() { return $this->repeat_day; }
+               
+               public function set_repeat_type($repeat_type)
+               {
+                       $this->repeat_type = $repeat_type;
+               }
+                                       
+               public function get_repeat_type() { return $this->repeat_type; }
+               
+               public function set_repeat_interval($repeat_interval)
+               {
+                       $this->repeat_interval = $repeat_interval;
+               }
+               
+               public function get_repeat_interval() { return 
$this->repeat_interval; }
+               
+               public function set_enabled($enabled)
+               {
+                       $this->enabled = $enabled;
+               }
+               
+               public function get_enabled() { return $this->enabled; }
+                               
                /**
                 * Get a static reference to the storage object associated with 
this model object
                 * 

Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang        2011-09-14 19:24:58 UTC (rev 
7590)
+++ trunk/controller/setup/phpgw_no.lang        2011-09-15 05:48:34 UTC (rev 
7591)
@@ -35,7 +35,7 @@
 select_date    controller      no      Velg dato
 year controller        no      År
 location_code  controller      no      Enhetsnummer
-included_units controller      no      Leieobjektets enheter
+included_units controller      no      Kontrollens enheter
 floor  controller      no      Etasje
 section        controller      no      Seksjon
 room   controller      no      Rom
@@ -306,7 +306,6 @@
 in_operation   controller      no      I drift
 inactive_party controller      no      Kontraktspart er inaktiv
 inactive       controller      no      Inaktiv
-included_units controller      no      Leieobjektets enheter
 internal       controller      no      Interne kontraktsparter
 interval       controller      no      Intervall
 Invalid location code for the building.        controller      no      Ugyldig 
objektnummer for bygg.
@@ -627,4 +626,6 @@
 year   controller      no      År
 yes    controller      no      Ja
 your_notifications     controller      no      Dine varsler
-control_items  controller      no      Kontrollpunkt
\ No newline at end of file
+control_items  controller      no      Kontrollpunkt
+Control_item   controller      no      Kontrollpunkt
+

Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php        2011-09-14 19:24:58 UTC (rev 
7590)
+++ trunk/controller/setup/setup.inc.php        2011-09-15 05:48:34 UTC (rev 
7591)
@@ -35,11 +35,12 @@
        (
                'controller_control',
                'controller_control_schedule',
-               'controller_control_point_list',
-               'controller_control_point',
+               'controller_control_item_list',
+               'controller_control_item',
                'controller_control_group',
-               'controller_check_point',
-               'controller_check_list'
+               'controller_check_item',
+               'controller_check_list',
+               'controller_procedure',
+               'controller_control_type'
        );
-       
-?>
+?>
\ No newline at end of file

Modified: trunk/controller/setup/tables_current.inc.php
===================================================================
--- trunk/controller/setup/tables_current.inc.php       2011-09-14 19:24:58 UTC 
(rev 7590)
+++ trunk/controller/setup/tables_current.inc.php       2011-09-15 05:48:34 UTC 
(rev 7591)
@@ -7,7 +7,6 @@
                                'description' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => True),
                                'start_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'end_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
-                               'frequency_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'procedure_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'requirement_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'costResponsibility_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => True),
@@ -17,7 +16,6 @@
                                'equipment_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'location_code' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'repeat_type' => array('type' => 'int', 
'precision' => 2, 'nullable' => True),
-                               'repeat_day' => array('type' => 'int', 
'precision' => 2, 'nullable' => True),
                                'repeat_interval' => array('type' => 'int', 
'precision' => 2, 'nullable' => True),
                                'enabled' => array('type' => 'int', 'precision' 
=> 2, 'nullable' => True)
                        ),
@@ -26,17 +24,6 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-               'controller_control_schedule' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
-                               'control_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'schedule_time' => array('type' => 'int', 
'precision' => 8, 'nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
                'controller_control_item_list' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
@@ -114,5 +101,15 @@
                        'fk' => array(),
                        'ix' => array(),
                        'uc' => array()
+               ),
+               'controller_control_type' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'title' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
                )
        );

Modified: trunk/controller/templates/base/control.php
===================================================================
--- trunk/controller/templates/base/control.php 2011-09-14 19:24:58 UTC (rev 
7590)
+++ trunk/controller/templates/base/control.php 2011-09-15 05:48:34 UTC (rev 
7591)
@@ -7,10 +7,6 @@
 
 <div class="identifier-header">
 <h1><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/32x32/actions/go-home.png" /> <?php echo lang('control') ?></h1>
-       <div>
-               <button onclick="javascript:window.location.href ='<?php echo 
$cancel_link;?>;'">&laquo;&nbsp;<?php //echo 
lang('composite_back');?></button><br/>
-               <label><?php echo lang('name') ?> </label><?php //echo 
$composite->get_name() ?>
-       </div>
 </div>
 
 
@@ -41,7 +37,7 @@
                                                <label 
for="description">Beskrivelse</label>
                                        </dt>
                                        <dd>
-                                               <input type="text" 
name="description" id="description" value="" />
+                                               <textarea cols="70" rows="5" 
name="description" id="description" value="" /></textarea>
                                        </dd>
                                        <dt>
                                                <label 
for="start_date">Startdato</label>
@@ -50,7 +46,7 @@
                                                <?php
                                                        $start_date = "-";
                                                        $start_date_yui = 
date('Y-m-d');
-                                                       $start_date_cal = 
$GLOBALS['phpgw']->yuical->add_listener('date_start', $start_date);
+                                                       $start_date_cal = 
$GLOBALS['phpgw']->yuical->add_listener('start_date', $start_date);
                                                
                                                        echo $start_date_cal;
                                                ?>
@@ -61,28 +57,16 @@
                                        <dd>
                                                <?php
                                                        $end_date = "";
-                                                       $end_date_yui;
-                                                       $end_date_cal =  
$GLOBALS['phpgw']->yuical->add_listener('date_end');
+                                                       $end_date_yui = 
date('Y-m-d');
+                                                       $end_date_cal =  
$GLOBALS['phpgw']->yuical->add_listener('end_date', $end_date);
                                                
                                                        echo $end_date_cal;
                                                ?>
                                        </dd>
                                        <dt>
-                                               <label>Dag</label>
+                                               <label>Frekvenstype</label>
                                        </dt>
                                        <dd>
-                                               <input type="checkbox" 
value="0" name="repeat_day[]" title="Mandag">Mandag
-                                               <input type="checkbox" 
value="1" name="repeat_day[]" title="Tirsdag">Tirsdag
-                                               <input type="checkbox" 
value="2" name="repeat_day[]" title="Onsdag">Onsdag
-                                               <input type="checkbox" 
value="3" name="repeat_day[]" title="Torsdag">Torsdag
-                                               <input type="checkbox" 
value="4" name="repeat_day[]" title="Fredag">Fredag
-                                               <input type="checkbox" 
value="5" name="repeat_day[]" title="Lørdag">Lørdag
-                                               <input type="checkbox" 
value="6" name="repeat_day[]" title="Søndag">Søndag
-                                       </dd>
-                                       <dt>
-                                               <label>Type</label>
-                                       </dt>
-                                       <dd>
                                                <select id="repeat_type" 
name="repeat_type">
                                                        <option value="0">Ikke 
angitt</option>
                                                        <option 
value="1">Daglig</option>
@@ -93,10 +77,10 @@
                                                </select>
                                        </dd>
                                        <dt>
-                                               <label>Intervall</label>
+                                               <label>Frekvens</label>
                                        </dt>
                                        <dd>
-                                               <input type="text" 
name="repeat_interval" value="" />
+                                               <input size="2" type="text" 
name="repeat_interval" value="" />
                                        </dd>
                                        <dt>
                                                <label>Prosedyre</label>
@@ -108,7 +92,6 @@
                                                                        echo 
"<option value='" . $procedure->get_id() . "'>" . $procedure->get_title() . 
"</option>";
                                                                }
                                                        ?>
-                                                       
                                                </select>
                                        </dd>
                                </dl>
@@ -129,8 +112,9 @@
                                        $list_id = 'included_units';
                                        //$url_add_on = 
'&amp;control_id='.$control->get_id();
                                        unset($extra_cols);
-                                       include('unit_list_partial.php');
+                                       //include('unit_list_partial.php');
        
+                               $editable = 'true';
                                        
                    if ($editable) { 
                                    echo '<h3>'.lang('all_locations').'</h3>';

Added: trunk/controller/templates/base/control_item.php
===================================================================
--- trunk/controller/templates/base/control_item.php                            
(rev 0)
+++ trunk/controller/templates/base/control_item.php    2011-09-15 05:48:34 UTC 
(rev 7591)
@@ -0,0 +1,74 @@
+<?php  
+       //include common logic for all templates
+       include("common.php");
+?>
+
+<div class="identifier-header">
+<h1><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/32x32/actions/go-home.png" /> <?php echo lang('Control_item') ?></h1>
+</div>
+
+<div class="yui-content">
+               <div id="details">
+                       <form action="#" method="post">
+                               <input type="hidden" name="id" value="<?php 
if(!empty($control)){ echo $control->get_id(); } else { echo '0'; }  ?>"/>
+                               <dl class="proplist-col">
+                                       <dt>
+                                               <label 
for="title">Tittel</label>
+                                       </dt>
+                                       <dd>
+                                               <input type="text" name="title" 
id="title" value="" />
+                                       </dd>
+                                       <dt>
+                                               <label 
for="required">Obligatorisk</label>
+                                       </dt>
+                                       <dd>
+                                               <input type="checkbox" value="" 
/>
+                                       </dd>
+                                       <dt>
+                                               <label for="what_to_do">Hva 
skal utføres</label>
+                                       </dt>
+                                       <dd>
+                                               <textarea id="what_to_do" 
rows="5" cols="60"></textarea>
+                                       </dd>
+                                       <dt>
+                                               <label 
for="how_to_do">Utførelsesbeskrivelse</label>
+                                       </dt>
+                                       <dd>
+                                               <textarea id="how_to_do" 
rows="5" cols="60"></textarea>
+                                       </dd>
+                                       <dt>
+                                               <label 
for="control_group">Kontrollgruppe</label>
+                                       </dt>
+                                       <dd>
+                                               <select id="control_group" 
name="control_group">
+                                                       <?php 
+                                                               foreach 
($control_group_array as $control_group) {
+                                                                       echo 
"<option value='" . $control_group->get_id() . "'>" . 
$control_group->get_title() . "</option>";
+                                                               }
+                                                       ?>
+                                               </select>
+                                       </dd>
+                                       <dt>
+                                               <label 
for="control_type">Kontrolltype</label>
+                                       </dt>
+                                       <dd>
+                                               <select id="control_type" 
name="control_type">
+                                                       <?php 
+                                                               foreach 
($control_type_array as $control_type) {
+                                                                       echo 
"<option value='" . $control_type->get_id() . "'>" . $control_type->get_title() 
. "</option>";
+                                                               }
+                                                       ?>
+                                               </select>
+                                       </dd>                           
+                               </dl>
+                               
+                               <div class="form-buttons">
+                                       <?php
+                                               echo '<input type="submit" 
name="save_control" value="' . lang('save') . '"/>';
+                                       ?>
+                               </div>
+                               
+                       </form>
+                                               
+               </div>
+</div>
\ No newline at end of file

Added: trunk/controller/templates/base/unit_list_partial.php
===================================================================
--- trunk/controller/templates/base/unit_list_partial.php                       
        (rev 0)
+++ trunk/controller/templates/base/unit_list_partial.php       2011-09-15 
05:48:34 UTC (rev 7591)
@@ -0,0 +1,146 @@
+<script type="text/javascript">
+       //Add listener resetting form: redirects browser to call index  again
+       YAHOO.util.Event.addListener(
+               'ctrl_reset_button',
+               'click',
+               function(e)
+               {
+               YAHOO.util.Event.stopEvent(e);
+       window.location = 'index.php?menuaction=rental.uicomposite.edit';
+               }
+       );
+
+       var formatArea = function(elCell, oRecord, oColumn, oData) {
+               if (oData != undefined && oData != 0) {
+                       elCell.innerHTML = YAHOO.util.Number.format( oData,
+                       {
+                               suffix: " <?php echo 
isset($config->config_data['area_suffix']) && 
$config->config_data['area_suffix'] ? $config->config_data['area_suffix'] : 
'kvm'; ?>",
+                               thousandsSeparator: "<?php echo 
isset($GLOBALS['phpgw_info']['user']['preferences']['rental']['thousands_separator'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['rental']['thousands_separator'] 
? 
$GLOBALS['phpgw_info']['user']['preferences']['rental']['thousands_separator'] 
: '.'; ?>",
+                               decimalSeparator: "<?php echo 
isset($GLOBALS['phpgw_info']['user']['preferences']['rental']['decimal_separator'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['rental']['decimal_separator'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['rental']['decimal_separator'] : 
',';?>",
+                               decimalPlaces: <?php echo 
isset($GLOBALS['phpgw_info']['user']['preferences']['rental']['area_decimal_places'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['rental']['area_decimal_places'] 
? 
$GLOBALS['phpgw_info']['user']['preferences']['rental']['area_decimal_places'] 
: 2; ?>
+                   });
+               }
+       }
+       
+       //Columns for added areas datatable
+       var columnDefs = [{
+               key: "location_code",
+               label: "<?php echo lang('object_number') ?>",
+               sortable: true
+       },
+       {
+               key: "loc1_name",
+               label: "<?php echo lang('property') ?>",
+               sortable: false
+       },
+       {
+               key: "loc2_name",
+               label: "<?php echo lang('building') ?>",
+               sortable: false
+       },
+       {
+               key: "loc3_name",
+               label: "<?php echo lang('floor') ?>",
+               sortable: false
+       },
+       {
+               key: "loc4_name",
+               label: "<?php echo lang('section') ?>",
+               sortable: false
+       },
+       {
+               key: "loc5_name",
+               label: "<?php echo lang('room') ?>",
+               sortable: false
+       },
+       {
+               key: "address",
+               label: "<?php echo lang('address') ?>",
+         sortable: false
+       },
+       {
+               key: "area_gros",
+               label: "<?php echo lang('area_gros') ?>",
+               formatter: formatArea,
+         sortable: false
+       },
+       {
+               key: "area_net",
+               label: "<?php echo lang('area_net') ?>",
+               formatter: formatArea,
+         sortable: false
+       },
+       {
+               key: "actions",
+               hidden: true
+       },
+       {
+               key: "labels",
+               hidden: true
+       },
+       {
+               key: "ajax",
+               hidden: true
+       }];
+
+       <?php
+                       if(isset($extra_cols)){
+                               foreach($extra_cols as $col){
+                                       $literal = "{key: \"".$col["key"]."\",
+                                                       label: 
\"".$col["label"]."\"}";
+                                       if($col["index"]){
+                                               echo 
"columnDefs.splice(".$col["index"].", 0,".$literal.");";
+                                       } else {
+                                               echo 
"columnDefs.push($literal);";
+                                       }
+                               }
+                       }
+               ?>
+
+       // Initiating the data source
+       setDataSource(
+                       
'index.php?menuaction=rental.uiunit.query&amp;phpgw_return_as=json<?php echo 
$url_add_on ?>&amp;editable=<?php echo $editable ? "true" : "false"; ?>',
+                       columnDefs,
+                       '<?php echo $list_id ?>_form',
+                       [],
+                       '<?php echo $list_id ?>_container',
+                       '<?php echo $list_id ?>_paginator',
+                       '<?php echo $list_id ?>',
+                       new Array(<?php
+                                       if(isset($related)){
+                                               foreach($related as $r){
+                                                       echo "\"".$r."\"";
+                                               }
+                                       }
+                               ?>)
+       );
+</script>
+<?php
+       if($list_form)
+       {
+?>
+<form id="<?php echo $list_id ?>_form" method="GET">
+       <fieldset>
+               <!-- Filters -->
+               <h3><?php echo lang('filters') ?></h3>
+               <?
+               // TODO: We should get the levels dynamically
+               ?>
+               <label for="ctrl_toggle_level"><?php echo lang('level') 
?></label>
+               <select name="level" id="<?php echo $list_id 
?>_ctrl_toggle_level">
+                       <option value="1"><?php echo lang('property') 
?></option>
+                       <option value="2" selected="selected"><?php echo 
lang('building') ?></option>
+                       <option value="3"><?php echo lang('floor') ?></option>
+                       <option value="4"><?php echo lang('section') ?></option>
+                       <option value="5"><?php echo lang('room') ?></option>
+               </select>
+
+               <label class="toolbar_element_label" for="available_date"><?php 
echo lang('available_at') ?></label>
+               <?php echo 
$GLOBALS['phpgw']->yuical->add_listener("{$list_id}_available_date", 
$notification_date); ?>
+       </fieldset>
+</form>
+<?php 
+       }
+?>
+<div id="<?php echo $list_id ?>_paginator" class="paginator"></div>
+<div id="<?php echo $list_id ?>_container" class="datatable_container"></div>




reply via email to

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