fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14627] refactor custom fields


From: Sigurd Nes
Subject: [Fmsystem-commits] [14627] refactor custom fields
Date: Thu, 07 Jan 2016 09:50:45 +0000

Revision: 14627
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14627
Author:   sigurdne
Date:     2016-01-07 09:50:44 +0000 (Thu, 07 Jan 2016)
Log Message:
-----------
refactor custom fields

Modified Paths:
--------------
    branches/dev-syncromind/booking/inc/class.uireports.inc.php

Added Paths:
-----------
    branches/dev-syncromind/booking/inc/class.custom_fields.inc.php

Added: branches/dev-syncromind/booking/inc/class.custom_fields.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.custom_fields.inc.php             
                (rev 0)
+++ branches/dev-syncromind/booking/inc/class.custom_fields.inc.php     
2016-01-07 09:50:44 UTC (rev 14627)
@@ -0,0 +1,78 @@
+<?php
+       /**
+        * phpGroupWare custom fields
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 Free Software Foundation 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v2 or later
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+        * @package phpgroupware
+        * @subpackage booking
+        * @version $Id: class.custom_fields.inc.php 14622 2016-01-05 08:54:38Z 
sigurdne $
+        */
+       /*
+         This program 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.
+
+         This program 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 Lesser General Public License for more details.
+
+         You should have received a copy of the GNU General Public License
+         along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       /*
+        * Import the parent class
+        */
+       phpgw::import_class('phpgwapi.custom_fields');
+
+       /**
+        * Custom Fields
+        *
+        * @package phpgroupware
+        * @subpackage booking
+        */
+       class booking_custom_fields extends phpgwapi_custom_fields
+       {
+
+               /**
+                * Constructor
+                *
+                * @param string $appname the name of the module using the 
custom fields
+                *
+                * @return void
+                */
+               public function __construct($appname = null)
+               {
+                       parent::__construct($appname);
+               }
+
+               /**
+                *
+                * @param type $location
+                * @return  array the grouped attributes
+                */
+               public function get_fields($location)
+               {
+                       $appname         = 'booking';
+                       $attributes      = parent::find($appname, $location, 0, 
'', 'ASC', 'attrib_sort', true, true);
+                       return $this->get_field_groups($appname, $location, 
$attributes);
+               }
+
+               /**
+                * Arrange attributes within groups
+                *
+                * @param string  $location    the name of the location of the 
attribute
+                * @param array   $attributes  the array of the attributes to 
be grouped
+                *
+                * @return array the grouped attributes
+                */
+               private function get_field_groups($appname, $location, 
$attributes = array())
+               {
+                       return parent::get_attribute_groups($appname, 
$location, $attributes);
+               }
+       }
\ No newline at end of file

Modified: branches/dev-syncromind/booking/inc/class.uireports.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uireports.inc.php 2016-01-06 
13:56:49 UTC (rev 14626)
+++ branches/dev-syncromind/booking/inc/class.uireports.inc.php 2016-01-07 
09:50:44 UTC (rev 14627)
@@ -502,7 +502,7 @@
 
 
                        $location                        = 
".application.{$top_level_activity}";
-                       $organized_fields        = 
$this->get_attributes($location);
+                       $organized_fields        = 
ExecMethod('booking.custom_fields.get_fields', $location);
                        $variable_vertical       = '';
                        $variable_horizontal = '';
                        foreach($organized_fields as $group)
@@ -544,31 +544,6 @@
                        );
                }
 
-               /**
-                *
-                * @param type $location
-                * @return  array the grouped attributes
-                */
-               private function get_attributes($location)
-               {
-                       $appname         = 'booking';
-                       $attributes      = 
$GLOBALS['phpgw']->custom_fields->find($appname, $location, 0, '', 'ASC', 
'attrib_sort', true, true);
-                       return $this->get_attribute_groups($appname, $location, 
$attributes);
-               }
-
-               /**
-                * Arrange attributes within groups
-                *
-                * @param string  $location    the name of the location of the 
attribute
-                * @param array   $attributes  the array of the attributes to 
be grouped
-                *
-                * @return array the grouped attributes
-                */
-               private function get_attribute_groups($appname, $location, 
$attributes = array())
-               {
-                       return 
$GLOBALS['phpgw']->custom_fields->get_attribute_groups($appname, $location, 
$attributes);
-               }
-
                public function participants()
                {
                        
self::set_active_menu('booking::reportcenter::participants');




reply via email to

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