fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8631]


From: Torstein
Subject: [Fmsystem-commits] [8631]
Date: Sat, 21 Jan 2012 11:20:00 +0000

Revision: 8631
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8631
Author:   vator
Date:     2012-01-21 11:20:00 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.uicalendar.inc.php
    trunk/controller/inc/class.uicheck_list.inc.php

Added Paths:
-----------
    trunk/controller/inc/class.uicontrol_location.inc.php

Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php       2012-01-21 11:16:26 UTC 
(rev 8630)
+++ trunk/controller/inc/class.uicalendar.inc.php       2012-01-21 11:20:00 UTC 
(rev 8631)
@@ -240,7 +240,8 @@
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                }
                
-               
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+                * 
                public function view_check_lists_for_location()
                {
                        $control_id = phpgw::get_var('control_id');
@@ -272,7 +273,10 @@
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                        
self::render_template_xsl('view_check_lists_for_location', $data);
                }
-                               
+               */
+
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+                * 
                public function view_check_lists_for_control()
                {
                        $control_id = phpgw::get_var('id');
@@ -291,7 +295,10 @@
                        
                        self::render_template_xsl('view_check_lists', $data);
                }
+               */
                
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+                * 
                public function view_control_items_for_control()
                {
                        $control_id = phpgw::get_var('control_id');
@@ -317,6 +324,7 @@
                                                                
                        self::render_template_xsl('view_check_list', $data);
                }
+               */
                
                public function save_check_items(){
                        $check_item_ids = phpgw::get_var('check_item_ids');
@@ -336,7 +344,9 @@
                        
                        $this->redirect(array('menuaction' => 
'controller.uicheck_list.view_check_list', 'check_list_id'=>$check_list_id));   
  
                }
-               /*
+               
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+                * 
                public function save_check_list(){
                        $control_id = phpgw::get_var('control_id');
                        $control = $this->so_control->get_single($control_id);
@@ -380,6 +390,9 @@
                        $this->redirect(array('menuaction' => 
'controller.uicheck_list.view_check_list_for_control', 
'control_id'=>$control_id));       
                }
                */
+               
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+                * 
                public function make_check_list_for_control(){
                        $control_id = phpgw::get_var('control_id');
                        $control = $this->so_control->get_single($control_id);
@@ -422,7 +435,10 @@
                        
                        $this->redirect(array('menuaction' => 
'controller.uicheck_list.view_check_list_for_control', 
'control_id'=>$control_id));       
                }
+               */
                
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+                * 
                public function query()
                {
                        $params = array(
@@ -463,6 +479,7 @@
                                $control = $this->so->get_single($control_id);
                        }
 */
+               /*
                        $result_objects = $this->so->get($start_index, 
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type, 
$filters);
                        $object_count = $this->so->get_count($search_for, 
$search_type, $filters);
                        //var_dump($result_objects);
@@ -483,4 +500,7 @@
 
                        return $this->yui_results($results);
                }
+               */
+               
+               public function query(){}
        }
\ No newline at end of file

Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php     2012-01-21 11:16:26 UTC 
(rev 8630)
+++ trunk/controller/inc/class.uicheck_list.inc.php     2012-01-21 11:20:00 UTC 
(rev 8631)
@@ -177,7 +177,9 @@
 
                        self::render_template_xsl('datatable', $data);
                }
-
+               
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+               * 
                public function view_check_list()
                {
                        $check_list_id = phpgw::get_var('check_list_id');
@@ -193,7 +195,8 @@
 
                        self::render_template_xsl('view_check_list', $data);
                }
-
+               */
+       
                // Returns check list info as JSON
                public function get_check_list_info()
                {
@@ -255,7 +258,9 @@
                        else
                                return json_encode( array( "saveStatus" => 
"not_updated" ) );
                }
-
+               
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+               * 
                public function control_calendar_status_overview()
                {
                        $control_id = phpgw::get_var('control_id');
@@ -274,7 +279,8 @@
 
                        
self::render_template_xsl('control_calendar_status_overview', $data);
                }
-
+               */
+               
                public function view_control_items(){
                        $check_list_id = phpgw::get_var('check_list_id');
                        $check_list = 
$this->so_check_list->get_single($check_list_id);
@@ -456,7 +462,9 @@
                        
                        self::render_template_xsl( 
array('check_list/cases_tab_menu', 'check_list/view_measurements'), $data );
                }
-                               
+
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+               * 
                public function view_check_lists_for_control()
                {
                        $control_id = phpgw::get_var('id');
@@ -475,7 +483,10 @@
 
                        self::render_template_xsl('view_check_lists', $data);
                }
-
+               */
+               
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+               * 
                public function view_control_items_for_control()
                {
                        $control_id = phpgw::get_var('control_id');
@@ -501,7 +512,8 @@
 
                        self::render_template_xsl('view_check_list', $data);
                }
-
+               */
+               
                public function save_check_items(){
                        $check_item_ids = phpgw::get_var('check_item_ids');
                        $check_list_id = phpgw::get_var('check_list_id');
@@ -621,8 +633,10 @@
 
                        $this->redirect(array('menuaction' => 
'controller.uicheck_list.view_check_list_for_control', 
'control_id'=>$control_id));
                }
-*/
+               */
                
+               /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker 
denne... Kanskje den bør slettes...
+                * 
                public function make_check_list_for_control(){
                        $control_id = phpgw::get_var('control_id');
                        $control = $this->so_control->get_single($control_id);
@@ -665,7 +679,8 @@
 
                        $this->redirect(array('menuaction' => 
'controller.uicheck_list.view_check_list_for_control', 
'control_id'=>$control_id));
                }
-
+               */
+               
                public function query()
                {
                        $params = array(

Added: trunk/controller/inc/class.uicontrol_location.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_location.inc.php                       
        (rev 0)
+++ trunk/controller/inc/class.uicontrol_location.inc.php       2012-01-21 
11:20:00 UTC (rev 8631)
@@ -0,0 +1,364 @@
+<?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.uicheck_list_for_location.inc.php 8628 2012-01-21 
10:42:05Z vator $
+       */
+       
+       phpgw::import_class('phpgwapi.yui');
+       phpgw::import_class('controller.uicommon');
+       phpgw::import_class('controller.socontrol_area');
+       
+       include_class('controller', 'check_list', 'inc/model/');
+       include_class('controller', 'date_generator', 'inc/component/');
+       include_class('controller', 'status_checker', 'inc/helper/');
+       include_class('controller', 'date_helper', 'inc/helper/');
+               
+       class controller_uicontrol_location extends controller_uicommon
+       {
+               var $cat_id;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $filter;
+               var $currentapp;
+               var $type_id;
+               var $location_code;
+               
+               private $so_control_area;
+               private $so_control;
+               private $so_check_list;
+               private $so_control_item;
+               private $so_check_item;
+               private $so_procedure;
+       
+               var $public_functions = array(
+                                                                               
'index' => true,
+                                                                               
'view_locations_for_control'    => true,
+                                                                               
'add_location_to_control'               => true,
+                                                                               
'add_check_list'                                => true,
+                                                                               
'save_check_list'                               => true,
+                                                                               
'edit_check_list'                               => true,
+                                                                               
'create_case_message'                   => true,
+                                                                               
'view_control_info'                     => true,
+                                                                               
'view_cases_for_check_list'             => true
+                                                                       );
+
+               function __construct()
+               {
+                       parent::__construct();
+                       
+                       $this->bo                                       = 
CreateObject('property.bolocation',true);
+                       $this->bocommon                         = & 
$this->bo->bocommon;
+                       $this->so_control_area          = 
CreateObject('controller.socontrol_area');
+                       $this->so_control                       = 
CreateObject('controller.socontrol');
+                       $this->so_check_list            = 
CreateObject('controller.socheck_list');
+                       $this->so_control_item          = 
CreateObject('controller.socontrol_item');
+                       $this->so_check_item            = 
CreateObject('controller.socheck_item');
+                       $this->so_procedure                     = 
CreateObject('controller.soprocedure');
+                       
+                       $this->type_id                          = 
$this->bo->type_id;
+                       
+                       $this->start                            = 
$this->bo->start;
+                       $this->query                            = 
$this->bo->query;
+                       $this->sort                                     = 
$this->bo->sort;
+                       $this->order                            = 
$this->bo->order;
+                       $this->filter                           = 
$this->bo->filter;
+                       $this->cat_id                           = 
$this->bo->cat_id;
+                       $this->part_of_town_id          = 
$this->bo->part_of_town_id;
+                       $this->district_id                      = 
$this->bo->district_id;
+                       $this->status                           = 
$this->bo->status;
+                       $this->allrows                          = 
$this->bo->allrows;
+                       $this->lookup                           = 
$this->bo->lookup;
+                       $this->location_code            = 
$this->bo->location_code;
+                       
+                       
self::set_active_menu('controller::control::location_for_check_list');
+               }       
+       
+               function index()
+               {
+                       if(phpgw::get_var('phpgw_return_as') == 'json') {
+                               return $this->query();
+                       }
+                       $building_types  = 
execMethod('property.soadmin_location.read',array());
+                       
+                       $type_id = 1;
+                       
+                       $category_types = 
$this->bocommon->select_category_list(array(
+                                                                               
                                                                
'format'=>'filter',
+                                                                               
                                                                'selected' => 
$this->cat_id,
+                                                                               
                                                                'type' 
=>'location',
+                                                                               
                                                                'type_id' 
=>$type_id,
+                                                                               
                                                                'order'=>'descr'
+                                                                               
                                                        ));
+                       
+                       $district_list  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                       $default_value = array ('id'=>'','name'=>lang('no 
district'));
+                       array_unshift($district_list,$default_value);
+                       
+                       $part_of_town_list =  
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+                       $default_value = array ('id'=>'','name'=>lang('no part 
of town'));
+                       array_unshift($part_of_town_list,$default_value);
+                       
+                       $_role_criteria = array
+                                       (
+                                               'type'          => 
'responsibility_role',
+                                               'filter'        => 
array('location' => ".location.{$type_id}"),
+                                               'order'         => 'name'
+                                       );
+
+                       $responsibility_roles_list =   
execMethod('property.sogeneric.get_list',$_role_criteria);
+                       $default_value = array ('id'=>'','name'=>lang('no 
role'));
+                       array_unshift ($responsibility_roles,$default_value);
+                       
+                       $control_areas_array = 
$this->so_control_area->get_control_areas_as_array();
+                       $controls_array = 
$this->so_control->get_controls_by_control_area($control_areas_array[0]['id']);
+                       $control_id = $control_areas_array[0]['id'];
+                       
+                       if($control_id == null)
+                               $control_id = 0;
+                       
+                       $tabs = array( array(
+                                               'label' => 
lang('View_locations_for_control')
+                                       ), array(
+                                               'label' => 
lang('Add_locations_for_control'),
+                                               'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list_for_location.add_location_to_control'))
+                                       ));
+                       
+                       $data = array(
+                               'tabs'                                  => 
$GLOBALS['phpgw']->common->create_tabs($tabs, 0),
+                               'view'                                  => 
"view_locations_for_control",
+                               'control_area_array'    => $control_areas_array,
+                               'control_array'                 => 
$control_array,
+                               'locations_table' => array(
+                                       'source' => 
self::link(array('menuaction' => 
'controller.uicontrol.get_locations_for_control', 'control_id' => $control_id 
,'phpgw_return_as' => 'json')),
+                                       'field' => array(
+                                               array(
+                                                       'key' => 'id',
+                                                       'label' => 
lang('ControlId'),
+                                                       'sortable'      => true,
+                                               ),
+                                               array(
+                                                       'key'   =>      'title',
+                                                       'label' =>      
lang('Property name'),
+                                                       'sortable'      =>      
false
+                                               ),
+                                               array(
+                                                       'key' => 
'location_code',
+                                                       'label' => 
lang('location_code'),
+                                                       'sortable'      => false
+                                               ),
+                                               array(
+                                                       'key' => 'loc1_name',
+                                                       'label' => 
lang('Location_name'),
+                                                       'sortable'      => false
+                                               ),
+                                               array(
+                                                       'key' => 'actions',
+                                                       'hidden' => true
+                                               ),
+                                               array(
+                                                       'key' => 'labels',
+                                                       'hidden' => true
+                                               ),
+                                               array(
+                                                       'key' => 'ajax',
+                                                       'hidden' => true
+                                               ),array(
+                                                       'key' => 'parameters',
+                                                       'hidden' => true
+                                               )                               
                
+                                       )
+                               )
+                       );
+                       
+                       phpgwapi_yui::load_widget('paginator');
+                       
+                       self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
+                       self::add_javascript('controller', 'controller', 
'jquery.js');
+                       self::add_javascript('controller', 'controller', 
'ajax.js');
+
+                       
self::render_template_xsl(array('control_location_tabs', 'common', 
'view_locations_for_control'), $data);               
+               }
+               
+               function add_location_to_control()
+               {
+                       if(phpgw::get_var('phpgw_return_as') == 'json') {
+                               return $this->query();
+                       }
+                       $building_types  = 
execMethod('property.soadmin_location.read',array());
+                       
+                       $type_id = 1;
+                       
+                       $category_types = 
$this->bocommon->select_category_list(array(
+                                                                               
                                                                
'format'=>'filter',
+                                                                               
                                                                'selected' => 
$this->cat_id,
+                                                                               
                                                                'type' 
=>'location',
+                                                                               
                                                                'type_id' 
=>$type_id,
+                                                                               
                                                                'order'=>'descr'
+                                                                               
                                                        ));
+                       
+                       $district_list  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                       $default_value = array ('id'=>'','name'=>lang('no 
district'));
+                       array_unshift($district_list,$default_value);
+                       
+                       $part_of_town_list =  
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+                       $default_value = array ('id'=>'','name'=>lang('no part 
of town'));
+                       array_unshift($part_of_town_list,$default_value);
+                       
+                       $_role_criteria = array
+                                       (
+                                               'type'          => 
'responsibility_role',
+                                               'filter'        => 
array('location' => ".location.{$type_id}"),
+                                               'order'         => 'name'
+                                       );
+
+                       $responsibility_roles_list = 
execMethod('property.sogeneric.get_list',$_role_criteria);
+                       $default_value = array ('id'=>'','name'=>lang('no 
role'));
+                       array_unshift ($responsibility_roles,$default_value);
+                       
+                       $control_areas_array = 
$this->so_control_area->get_control_areas_as_array();
+                       
+                       $tabs = array( array(
+                                               'label' => 
lang('View_locations_for_control'),
+                                               'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list_for_location.index'))
+                       
+                                       ), array(
+                                               'label' => 
lang('Add_locations_for_control')
+                                       ));
+                                       
+                       $data = array(
+                               'tabs'                                          
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 1),
+                               'view'                                          
=> "add_location_to_control",
+                               'control_filters'                       => 
array(
+                                       'control_area_array'            => 
$control_areas_array,
+                                       'control_array'                         
=> $control_array
+                               ),
+                               'filter_form'                           => 
array(
+                                       'building_types'                        
=> $building_types,
+                                       'category_types'                        
=> $category_types,
+                                       'district_list'                         
=> $district_list,
+                                       'part_of_town_list'             => 
$part_of_town_list
+                               ),
+                               'datatable' => array(
+                                       'source' => 
self::link(array('menuaction' => 'controller.uicheck_list_for_location.index', 
'phpgw_return_as' => 'json')),
+                                       'field' => array(
+                                               array(
+                                                       'key' => 
'location_code',
+                                                       'label' => 
lang('Property'),
+                                                       'sortable'      => true,
+                                                       'formatter' => 
'YAHOO.portico.formatLink'
+                                               ),
+                                               array(
+                                                       'key'   =>      
'loc1_name',
+                                                       'label' =>      
lang('Property name'),
+                                                       'sortable'      =>      
false
+                                               ),
+                                               array(
+                                                       'key' => 'adresse1',
+                                                       'label' => 
lang('Address'),
+                                                       'sortable'      => false
+                                               ),
+                                               array(
+                                                       'key' => 'postnummer',
+                                                       'label' => lang('Zip 
code'),
+                                                       'sortable'      => false
+                                               ),
+                                               array(
+                                                       'key' => 'actions',
+                                                       'hidden' => true
+                                               ),
+                                               array(
+                                                       'key' => 'labels',
+                                                       'hidden' => true
+                                               ),
+                                               array(
+                                                       'key' => 'ajax',
+                                                       'hidden' => true
+                                               ),array(
+                                                       'key' => 'parameters',
+                                                       'hidden' => true
+                                               )                               
                
+                                       )
+                               )
+                       );
+                       
+                       phpgwapi_yui::load_widget('paginator');
+                       
+                       self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
+                       self::add_javascript('controller', 'controller', 
'jquery.js');
+                       self::add_javascript('controller', 'controller', 
'ajax.js');
+
+                       
self::render_template_xsl(array('control_location_tabs', 'common', 
'add_location_to_control'), $data);          
+               }
+               
+               public function query(){
+                       $type_id = phpgw::get_var('type_id');
+                       $return_results = phpgw::get_var('results', 'int', 
'REQUEST', 0);
+                       
+                       $type_id = $type_id ? $type_id : 1;
+                       
+                       $location_list = array();
+
+                       $this->bo->sort = "ASC";
+                       $this->bo->start = phpgw::get_var('startIndex');
+                       
+                       $location_list = $this->bo->read(array('user_id' => 
$user_id, 'role_id' =>$role_id, 
'type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,
+                                                                               
                   'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run' 
=>$dry_run));
+
+                       $rows_total = $this->bo->read(array('type_id' => 
$type_id, 'allrows' => true));
+                       
+                       foreach($location_list as $location)
+                       {
+                               $results['results'][]= $location;       
+                       }
+                       
+                       $results['total_records'] = count($rows_total);
+                       $results['start'] = $this->start;
+                       $results['sort'] = 'location_code';
+                       $results['dir'] = "ASC";
+                                               
+                       array_walk($results['results'], array($this, 
'add_actions'), array($type));
+                                                       
+                       return $this->yui_results($results);
+               }
+                       
+               public function add_actions(&$value, $key, $params)
+               {
+                       unset($value['query_location']);
+                       
+                       $value['ajax'] = array();
+                       $value['actions'] = array();
+                       $value['labels'] = array();
+                       $value['parameters'] = array();
+                       
+                       $value['ajax'][] = true;
+                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uicontrol.add_location_to_control', 'location_code' => 
$value['location_code'])));
+                       $value['labels'][] = lang('add_location');
+                       $value['parameters'][] = "control_id";
+               }
+       }




reply via email to

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