[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9959] Property: formatting
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9959] Property: formatting |
Date: |
Sun, 02 Sep 2012 18:55:52 +0000 |
Revision: 9959
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9959
Author: sigurdne
Date: 2012-09-02 18:55:51 +0000 (Sun, 02 Sep 2012)
Log Message:
-----------
Property: formatting
Modified Paths:
--------------
trunk/property/inc/class.boXport.inc.php
trunk/property/inc/class.boadmin.inc.php
trunk/property/inc/class.boadmin_entity.inc.php
trunk/property/inc/class.boadmin_location.inc.php
trunk/property/inc/class.boagreement.inc.php
Modified: trunk/property/inc/class.boXport.inc.php
===================================================================
--- trunk/property/inc/class.boXport.inc.php 2012-09-01 17:18:37 UTC (rev
9958)
+++ trunk/property/inc/class.boXport.inc.php 2012-09-02 18:55:51 UTC (rev
9959)
@@ -1,315 +1,320 @@
<?php
+
/**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 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/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007 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/bbb_/ekstern/
+ * @package property
+ * @subpackage admin
+ * @version $Id$
+ */
/**
* Description
* @package property
*/
-
class property_boXport
{
+
var $public_functions = array
- (
- 'import' => true,
- 'export' => true
- );
-
+ (
+ 'import' => true,
+ 'export' => true
+ );
var $start;
var $query;
var $sort;
var $order;
var $filter;
var $cat_id;
-
var $use_session = false;
- function property_boXport ($session=false)
+ function property_boXport( $session = false )
{
- $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
- $this->config =
CreateObject('phpgwapi.config','property');
+ $this->config = CreateObject( 'phpgwapi.config',
'property' );
- if($session)
+ if ( $session )
{
$this->read_sessiondata();
$this->use_session = true;
}
- $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
- $query = phpgw::get_var('query');
- $sort = phpgw::get_var('sort');
- $order = phpgw::get_var('order');
- $filter = phpgw::get_var('filter', 'int');
- $cat_id = phpgw::get_var('cat_id', 'int');
+ $start = phpgw::get_var( 'start', 'int', 'REQUEST', 0
);
+ $query = phpgw::get_var( 'query' );
+ $sort = phpgw::get_var( 'sort' );
+ $order = phpgw::get_var( 'order' );
+ $filter = phpgw::get_var( 'filter', 'int' );
+ $cat_id = phpgw::get_var( 'cat_id', 'int' );
- if($start || $start == 0)
+ if ( $start || $start == 0 )
{
$this->start = $start;
}
- if($query)
+ if ( $query )
{
- $this->query = $query;
+ $this->query = $query;
}
- if($sort)
+ if ( $sort )
{
- $this->sort = $sort;
+ $this->sort = $sort;
}
- if($order)
+ if ( $order )
{
- $this->order = $order;
+ $this->order = $order;
}
- if($filter)
+ if ( $filter )
{
- $this->filter = $filter;
+ $this->filter = $filter;
}
- $this->cat_id = $cat_id;
+ $this->cat_id = $cat_id;
}
function save_sessiondata()
{
- if ($this->use_session)
+ if ( $this->use_session )
{
- $data = array(
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
'filter' => $this->filter,
'cat_id' => $this->cat_id
);
- if($this->debug) { echo '<br>Save:';
_debug_array($data); }
-
$GLOBALS['phpgw']->session->appsession('session_data','export',$data);
+ if ( $this->debug )
+ {
+ echo '<br>Save:';
+ _debug_array( $data );
+ }
+ $GLOBALS['phpgw']->session->appsession(
'session_data', 'export', $data );
}
}
function read_sessiondata()
{
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','export');
+ $data = $GLOBALS['phpgw']->session->appsession(
'session_data', 'export' );
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->filter = $data['filter'];
- $this->cat_id = $data['cat_id'];
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
+ $this->filter = $data['filter'];
+ $this->cat_id = $data['cat_id'];
}
- function select_import_conv($selected='')
+ function select_import_conv( $selected = '' )
{
- $dir_handle = @opendir(PHPGW_SERVER_ROOT .
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}");
- $i=0; $myfilearray = array();
- while ($file = readdir($dir_handle))
+ $dir_handle = @opendir( PHPGW_SERVER_ROOT .
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}" );
+ $i = 0;
+ $myfilearray = array();
+ while ( $file = readdir( $dir_handle ) )
{
- if ((substr($file, 0, 1) != '.') &&
is_file(PHPGW_SERVER_ROOT .
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}") )
+ if ( (substr( $file, 0, 1 ) != '.') && is_file(
PHPGW_SERVER_ROOT .
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}" ) )
{
$myfilearray[$i] = $file;
$i++;
}
}
- closedir($dir_handle);
- sort($myfilearray);
+ closedir( $dir_handle );
+ sort( $myfilearray );
- for ($i=0;$i<count($myfilearray);$i++)
+ for ( $i = 0; $i < count( $myfilearray ); $i++ )
{
- $fname = preg_replace('/_/','
',$myfilearray[$i]);
- $sel_file = '';
- if ($myfilearray[$i]==$selected)
+ $fname = preg_replace( '/_/', ' ',
$myfilearray[$i] );
+ $sel_file = '';
+ if ( $myfilearray[$i] == $selected )
{
$sel_file = 'selected';
}
$conv_list[] = array
(
- 'id' =>
$myfilearray[$i],
- 'name' => $fname,
- 'selected' => $sel_file
- );
+ 'id' => $myfilearray[$i],
+ 'name' => $fname,
+ 'selected' => $sel_file
+ );
}
- for ($i=0;$i<count($conv_list);$i++)
+ for ( $i = 0; $i < count( $conv_list ); $i++ )
{
- if ($conv_list[$i]['selected'] != 'selected')
+ if ( $conv_list[$i]['selected'] != 'selected' )
{
- unset($conv_list[$i]['selected']);
+ unset( $conv_list[$i]['selected'] );
}
}
return $conv_list;
-
}
- function select_export_conv($selected='')
+ function select_export_conv( $selected = '' )
{
- $dir_handle = @opendir(PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}");
- $i=0; $myfilearray = array();
- while ($file = readdir($dir_handle))
+ $dir_handle = @opendir( PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}" );
+ $i = 0;
+ $myfilearray = array();
+ while ( $file = readdir( $dir_handle ) )
{
- if ((substr($file, 0, 1) != '.') &&
is_file(PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}") )
+ if ( (substr( $file, 0, 1 ) != '.') && is_file(
PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}" ) )
{
$myfilearray[$i] = $file;
$i++;
}
}
- closedir($dir_handle);
- sort($myfilearray);
+ closedir( $dir_handle );
+ sort( $myfilearray );
- for ($i=0;$i<count($myfilearray);$i++)
+ for ( $i = 0; $i < count( $myfilearray ); $i++ )
{
- $fname = preg_replace('/_/','
',$myfilearray[$i]);
- $sel_file = '';
- if ($myfilearray[$i]==$selected)
+ $fname = preg_replace( '/_/', ' ',
$myfilearray[$i] );
+ $sel_file = '';
+ if ( $myfilearray[$i] == $selected )
{
$sel_file = 'selected';
}
$conv_list[] = array
(
- 'id' =>
$myfilearray[$i],
- 'name' => $fname,
- 'selected' => $sel_file
- );
+ 'id' => $myfilearray[$i],
+ 'name' => $fname,
+ 'selected' => $sel_file
+ );
}
- for ($i=0;$i<count($conv_list);$i++)
+ for ( $i = 0; $i < count( $conv_list ); $i++ )
{
- if ($conv_list[$i]['selected'] != 'selected')
+ if ( $conv_list[$i]['selected'] != 'selected' )
{
- unset($conv_list[$i]['selected']);
+ unset( $conv_list[$i]['selected'] );
}
}
return $conv_list;
-
}
- function select_rollback_file($selected='')
+ function select_rollback_file( $selected = '' )
{
$this->config->read();
$file_catalog =
$this->config->config_data['export_path'];
- $dir_handle = @opendir($file_catalog);
- $i=0; $myfilearray = '';
- while ($file = readdir($dir_handle))
+ $dir_handle = @opendir( $file_catalog );
+ $i = 0;
+ $myfilearray = '';
+ while ( $file = readdir( $dir_handle ) )
{
- if ((substr($file, 0, 1) != '.') &&
is_file("{$file_catalog}/{$file}") )
+ if ( (substr( $file, 0, 1 ) != '.') && is_file(
"{$file_catalog}/{$file}" ) )
{
$myfilearray[$i] = $file;
$i++;
}
}
- closedir($dir_handle);
- @sort($myfilearray);
+ closedir( $dir_handle );
+ @sort( $myfilearray );
- for ($i=0;$i<count($myfilearray);$i++)
+ for ( $i = 0; $i < count( $myfilearray ); $i++ )
{
- $fname = preg_replace('/_/','
',$myfilearray[$i]);
- $sel_file = '';
- if ($myfilearray[$i]==$selected)
+ $fname = preg_replace( '/_/', ' ',
$myfilearray[$i] );
+ $sel_file = '';
+ if ( $myfilearray[$i] == $selected )
{
$sel_file = 'selected';
}
$rollback_list[] = array
(
- 'id' =>
$myfilearray[$i],
- 'name' => $fname,
- 'selected' => $sel_file
- );
+ 'id' => $myfilearray[$i],
+ 'name' => $fname,
+ 'selected' => $sel_file
+ );
}
- for ($i=0;$i<count($rollback_list);$i++)
+ for ( $i = 0; $i < count( $rollback_list ); $i++ )
{
- if ($rollback_list[$i]['selected'] !=
'selected')
+ if ( $rollback_list[$i]['selected'] !=
'selected' )
{
- unset($rollback_list[$i]['selected']);
+ unset( $rollback_list[$i]['selected'] );
}
}
return $rollback_list;
-
}
- function import($invoice_common,$download)
+ function import( $invoice_common, $download )
{
include (PHPGW_SERVER_ROOT .
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$invoice_common['conv_type']}");
$invoice = new import_conv;
- $buffer = $invoice->import($invoice_common,$download);
- if ($download)
+ $buffer = $invoice->import( $invoice_common, $download
);
+ if ( $download )
{
- $header = $invoice->header;
- $import = $invoice->import;
- $buffer= array(
- 'table' => $buffer,
- 'header' => $header,
- 'import' => $import
+ $header = $invoice->header;
+ $import = $invoice->import;
+ $buffer = array(
+ 'table' => $buffer,
+ 'header' => $header,
+ 'import' => $import
);
}
return $buffer;
}
- function export($data)
+ function export( $data )
{
- $conv_type = $data['conv_type'];
- $download = $data['download'];
- $pre_transfer = $data['pre_transfer'];
- $force_period_year = $data['force_period_year'];
+ $conv_type = $data['conv_type'];
+ $download = $data['download'];
+ $pre_transfer = $data['pre_transfer'];
+ $force_period_year = $data['force_period_year'];
include(PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$conv_type}");
$invoice = new export_conv;
- $buffer =
$invoice->overfor($download,$pre_transfer,$force_period_year);
+ $buffer = $invoice->overfor( $download, $pre_transfer,
$force_period_year );
return $buffer;
}
- function
rollback($conv_type,$role_back_date,$rollback_file,$rollback_voucher)
+ function rollback( $conv_type, $role_back_date, $rollback_file,
+ $rollback_voucher )
{
include (PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$conv_type}");
$invoice = new export_conv;
- $buffer =
$invoice->RullTilbake($role_back_date,$rollback_file,$rollback_voucher);
+ $buffer = $invoice->RullTilbake( $role_back_date,
$rollback_file,
+
$rollback_voucher );
return $buffer;
-
}
- function export_cron($data)
+ function export_cron( $data )
{
- if($data['enabled']==1)
+ if ( $data['enabled'] == 1 )
{
- $receipt = $this->export($data);
- // if(isset($data['manual']))
+ $receipt = $this->export( $data );
+ //
if(isset($data['manual']))
{
- _debug_array($receipt);
+ _debug_array( $receipt );
}
}
}
- }
+ }
\ No newline at end of file
Modified: trunk/property/inc/class.boadmin.inc.php
===================================================================
--- trunk/property/inc/class.boadmin.inc.php 2012-09-01 17:18:37 UTC (rev
9958)
+++ trunk/property/inc/class.boadmin.inc.php 2012-09-02 18:55:51 UTC (rev
9959)
@@ -1,38 +1,38 @@
<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008 Free Software
Foundation, Inc. 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 property
- * @subpackage admin
- * @version $Id$
- */
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008 Free Software
Foundation, Inc. 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 property
+ * @subpackage admin
+ * @version $Id$
+ */
/*
- 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 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 General Public License for more details.
+ 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 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/>.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* FIXME I need a proper description
* @package property
*/
-
class property_boadmin
{
+
var $start;
var $query;
var $filter;
@@ -42,14 +42,14 @@
var $offset;
var $acl_app;
- function property_boadmin($session='')
+ function property_boadmin($session = '')
{
// $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject('property.soadmin');
- $this->acl = &
$GLOBALS['phpgw']->acl;
- $this->bocommon =
CreateObject('property.bocommon');
- $this->right = array(1,2,4,8,16);
- $this->account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->so =
CreateObject('property.soadmin');
+ $this->acl = & $GLOBALS['phpgw']->acl;
+ $this->bocommon = CreateObject('property.bocommon');
+ $this->right = array(1, 2, 4, 8, 16);
+ $this->account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
if ($session)
{
@@ -57,122 +57,120 @@
$this->use_session = true;
}
- $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
- $query = phpgw::get_var('query');
- $sort = phpgw::get_var('sort');
- $order = phpgw::get_var('order');
- $filter = phpgw::get_var('filter', 'int');
- $cat_id = phpgw::get_var('cat_id', 'string');
- $permission = phpgw::get_var('permission');
- // $location =
get_var('location',array('POST','GET')); // don't work for some reason...
- $module = phpgw::get_var('module');
- $granting_group = phpgw::get_var('granting_group',
'int');
- $allrows = phpgw::get_var('allrows', 'bool');
- $acl_app = 'property';
//get_var('acl_app',array('POST','GET'));
+ $start = phpgw::get_var('start',
'int', 'REQUEST', 0);
+ $query = phpgw::get_var('query');
+ $sort = phpgw::get_var('sort');
+ $order = phpgw::get_var('order');
+ $filter = phpgw::get_var('filter',
'int');
+ $cat_id = phpgw::get_var('cat_id',
'string');
+ $permission = phpgw::get_var('permission');
+ // $location =
get_var('location',array('POST','GET')); // don't work for some reason...
+ $module = phpgw::get_var('module');
+ $granting_group = phpgw::get_var('granting_group',
'int');
+ $allrows = phpgw::get_var('allrows',
'bool');
+ $acl_app = 'property';
//get_var('acl_app',array('POST','GET'));
if ($start)
{
- $this->start=$start;
+ $this->start = $start;
}
else
{
- $this->start=0;
+ $this->start = 0;
}
- if(isset($query))
+ if (isset($query))
{
$this->query = $query;
}
- if(isset($filter))
+ if (isset($filter))
{
$this->filter = $filter;
}
- if(isset($sort))
+ if (isset($sort))
{
$this->sort = $sort;
}
- if(isset($order))
+ if (isset($order))
{
$this->order = $order;
}
- if(isset($cat_id))
+ if (isset($cat_id))
{
$this->cat_id = $cat_id;
}
- if(isset($module))
+ if (isset($module))
{
$this->location = $module;
}
- if(isset($granting_group))
+ if (isset($granting_group))
{
$this->granting_group = $granting_group;
}
$this->allrows = $allrows ? $allrows : '';
- if(isset($acl_app))
+ if (isset($acl_app))
{
$this->acl_app = $acl_app;
}
}
-
function read_sessiondata()
{
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','fm_admin');
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data', 'fm_admin');
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- $this->location = $data['location'];
- $this->granting_group = $data['granting_group'];
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->filter = $data['filter'];
+ $this->sort =
$data['sort'];
+ $this->order = $data['order'];
+ $this->cat_id = $data['cat_id'];
+ $this->location = $data['location'];
+ $this->granting_group = $data['granting_group'];
}
function save_sessiondata($data)
{
if ($this->use_session)
{
-
$GLOBALS['phpgw']->session->appsession('session_data','fm_admin',$data);
+
$GLOBALS['phpgw']->session->appsession('session_data', 'fm_admin', $data);
}
}
-
- function select_category_list($format='',$selected='')
+ function select_category_list($format = '', $selected = '')
{
- switch($format)
+ switch ($format)
{
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
}
- $categories[0]['id'] = 'groups';
- $categories[0]['name'] = lang('Groups');
- $categories[1]['id'] = 'accounts';
- $categories[1]['name'] = lang('Users');
+ $categories[0]['id'] = 'groups';
+ $categories[0]['name'] = lang('Groups');
+ $categories[1]['id'] = 'accounts';
+ $categories[1]['name'] = lang('Users');
- return
$this->bocommon->select_list($selected,$categories);
+ return $this->bocommon->select_list($selected,
$categories);
}
- function set_permission2($values,$r_processed, $grantor = -1,
$type = 0)
+ function set_permission2($values, $r_processed, $grantor = -1,
$type = 0)
{
- if ( !is_array($values) )
+ if (!is_array($values))
{
// return;
}
$totalacl = array();
- foreach ( $values as $rowinfo => $perm )
+ foreach ($values as $rowinfo => $perm)
{
- list($user_id,$rights) = explode('_', $rowinfo);
+ list($user_id, $rights) = explode('_',
$rowinfo);
- if ( !isset($totalacl[$user_id]) )
+ if (!isset($totalacl[$user_id]))
{
$totalacl[$user_id] = 0;
}
@@ -181,10 +179,10 @@
}
$user_checked = array();
- foreach ( $totalacl as $user_id => $rights )
+ foreach ($totalacl as $user_id => $rights)
{
- $user_checked[] = $user_id;
- $this->acl->set_account_id($user_id, true,
$this->acl_app, $this->location, $account_type = 'accounts');
+ $user_checked[] = $user_id;
+ $this->acl->set_account_id($user_id, true,
$this->acl_app, $this->location, $account_type = 'accounts');
$this->acl->delete($this->acl_app,
$this->location, $grantor, $type);
$this->acl->add($this->acl_app,
$this->location, $rights, $grantor, $type);
$this->acl->save_repository($this->acl_app,
$this->location);
@@ -199,13 +197,13 @@
$user_delete = $r_processed;
}
- $users_at_location =
$this->acl->get_accounts_at_location($this->acl_app, $this->location, $grantor
,$type);
+ $users_at_location =
$this->acl->get_accounts_at_location($this->acl_app, $this->location, $grantor,
$type);
- if(is_array($user_delete) && count($user_delete)>0)
+ if (is_array($user_delete) && count($user_delete) > 0)
{
foreach ($user_delete as $user_id)
{
- if(isset($users_at_location[$user_id])
&& $users_at_location[$user_id])
+ if (isset($users_at_location[$user_id])
&& $users_at_location[$user_id])
{
$this->acl->set_account_id($user_id, true);
$this->acl->delete($this->acl_app, $this->location, $grantor, $type);
@@ -215,31 +213,31 @@
}
}
- function set_permission($values,$r_processed,$set_grant =
false,$initials='')
+ function set_permission($values, $r_processed, $set_grant =
false, $initials = '')
{
$this->acl->enable_inheritance =
phpgw::get_var('enable_inheritance', 'bool', 'POST');
- if($initials)
+ if ($initials)
{
$this->so->set_initials($initials);
}
$process = explode('_', $r_processed);
- if ( !isset($values['right']) ||
!is_array($values['right']) )
+ if (!isset($values['right']) ||
!is_array($values['right']))
{
$values['right'] = array();
}
- if ( !isset($values['mask']) ||
!is_array($values['mask']) )
+ if (!isset($values['mask']) ||
!is_array($values['mask']))
{
$values['mask'] = array();
}
$grantor = -1;
- if($set_grant)
+ if ($set_grant)
{
- if($this->granting_group)
+ if ($this->granting_group)
{
$grantor = $this->granting_group;
}
@@ -251,28 +249,28 @@
$this->set_permission2($values['right'], $process,
$grantor, 0);
$this->set_permission2($values['mask'], $process,
$grantor, 1);
- $cleared = $this->bocommon->reset_fm_cache_userlist();
- $receipt['message'][] = array('msg' =>
lang('permissions are updated!'));
- $receipt['message'][] = array('msg' => lang('%1
userlists cleared from cache',$cleared));
+ $cleared =
$this->bocommon->reset_fm_cache_userlist();
+ $receipt['message'][] = array('msg' =>
lang('permissions are updated!'));
+ $receipt['message'][] = array('msg' => lang('%1
userlists cleared from cache', $cleared));
phpgwapi_cache::user_clear('phpgwapi', 'menu', -1);
return $receipt;
}
- function get_user_list($type='',$get_grants='')
+ function get_user_list($type = '', $get_grants = '')
{
- if($type == 'groups')
+ if ($type == 'groups')
{
$check_account_type = array('accounts');
- $acl_account_type = 'accounts';
- $valid_users =
$GLOBALS['phpgw']->acl->get_ids_for_location('run', phpgwapi_acl::READ,
'property');
+ $acl_account_type = 'accounts';
+ $valid_users =
$GLOBALS['phpgw']->acl->get_ids_for_location('run', phpgwapi_acl::READ,
'property');
}
else
{
- $check_account_type =
array('groups','accounts');
- $acl_account_type = 'both';
- $_valid_users =
$GLOBALS['phpgw']->acl->get_user_list_right(phpgwapi_acl::READ, 'run',
$this->acl_app);
- $valid_users = array();
- foreach($_valid_users as $_user)
+ $check_account_type = array('groups',
'accounts');
+ $acl_account_type = 'both';
+ $_valid_users =
$GLOBALS['phpgw']->acl->get_user_list_right(phpgwapi_acl::READ, 'run',
$this->acl_app);
+ $valid_users = array();
+ foreach ($_valid_users as $_user)
{
$valid_users[] = $_user['account_id'];
}
@@ -281,9 +279,9 @@
}
$grantor = -1;
- if($get_grants)
+ if ($get_grants)
{
- if($this->granting_group)
+ if ($this->granting_group)
{
$grantor = $this->granting_group;
}
@@ -293,20 +291,20 @@
}
}
- if($this->location == '.invoice')
+ if ($this->location == '.invoice')
{
- $this->right =
array(1,2,4,8,16,32,64,128);
+ $this->right = array(1, 2, 4, 8, 16, 32, 64,
128);
}
- $right=$this->right;
+ $right = $this->right;
- $allusers =
$GLOBALS['phpgw']->accounts->get_list($type, -1,$this->sort, $this->order,
$this->query);
+ $allusers =
$GLOBALS['phpgw']->accounts->get_list($type, -1, $this->sort, $this->order,
$this->query);
// $allusers =
array_intersect_key($allusers, $valid_users);
- foreach($allusers as $user)
+ foreach ($allusers as $user)
{
- if(!in_array($user->id, $valid_users))
+ if (!in_array($user->id, $valid_users))
{
unset($allusers[$user->id]);
}
@@ -315,53 +313,53 @@
reset($allusers);
$this->total_records = count($allusers);
- $length =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ $length =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
if ($this->allrows)
{
$this->start = 0;
- $length = $this->total_records;
+ $length = $this->total_records;
}
- $allusers = array_slice($allusers, $this->start ,
$length, true);
+ $allusers = array_slice($allusers, $this->start,
$length, true);
$user_list = array();
- if ( isset($allusers) && is_array($allusers))
+ if (isset($allusers) && is_array($allusers))
{
- $j=0;
- foreach($allusers as $account)
+ $j = 0;
+ foreach ($allusers as $account)
{
- $user_list[$j]['account_id']
= $account->id;
- $user_list[$j]['account_lid']
= $account->lid;
- $user_list[$j]['account_firstname']
= $account->firstname;
- $user_list[$j]['account_lastname']
= $account->lastname;
+ $user_list[$j]['account_id']
= $account->id;
+ $user_list[$j]['account_lid']
= $account->lid;
+ $user_list[$j]['account_firstname']
= $account->firstname;
+ $user_list[$j]['account_lastname']
= $account->lastname;
- if($this->location == '.invoice')
+ if ($this->location == '.invoice')
{
- $user_list[$j]['initials']
= $this->so->get_initials($account->id);
+ $user_list[$j]['initials'] =
$this->so->get_initials($account->id);
}
$this->acl->set_account_id($account->id, true, $this->acl_app, $this->location,
$acl_account_type);
- $count_right=count($right);
+ $count_right = count($right);
- for ( $i = 0; $i < $count_right; ++$i )
+ for ($i = 0; $i < $count_right; ++$i)
{
-
if($this->acl->check_rights($this->location,
$right[$i],$this->acl_app,$grantor,0,$check_account_type))
+ if
($this->acl->check_rights($this->location, $right[$i], $this->acl_app,
$grantor, 0, $check_account_type))
{
-
if($this->acl->account_type == 'g')
+ if
($this->acl->account_type == 'g')
{
$user_list[$j]['right'][$right[$i]] = 'from_group';
}
else
{
-
$user_list[$j]['right'][$right[$i]] = 'checked';
+
$user_list[$j]['right'][$right[$i]] = 'checked';
}
$user_list[$j]['result'][$right[$i]] = 'checked';
}
-
if($this->acl->check_rights($this->location,
$right[$i],$this->acl_app,$grantor,1,$check_account_type))
+ if
($this->acl->check_rights($this->location, $right[$i], $this->acl_app,
$grantor, 1, $check_account_type))
{
-
if($this->acl->account_type == 'g')
+ if
($this->acl->account_type == 'g')
{
$user_list[$j]['mask'][$right[$i]] = 'from_group';
}
@@ -386,8 +384,9 @@
return $fm_ids;
}
- function edit_id($values='')
+ function edit_id($values = '')
{
return $this->so->edit_id($values);
}
+
}
Modified: trunk/property/inc/class.boadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.boadmin_entity.inc.php 2012-09-01 17:18:37 UTC
(rev 9958)
+++ trunk/property/inc/class.boadmin_entity.inc.php 2012-09-02 18:55:51 UTC
(rev 9959)
@@ -1,42 +1,43 @@
<?php
+
/**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 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/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007 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/bbb_/ekstern/
+ * @package property
+ * @subpackage admin
+ * @version $Id$
+ */
/**
* Description
* @package property
*/
-
class property_boadmin_entity
{
+
/**
- * @var integer $start info for pagination
- */
+ * @var integer $start info for pagination
+ */
public $start;
/**
@@ -57,8 +58,8 @@
/**
* @var string $type entity set
*/
+ public $type;
- public $type;
/**
* @var integer $entity_id entity type
*/
@@ -78,292 +79,295 @@
* @var object $custom reference to custom fields object
*/
protected $custom;
-
var $public_functions = array
+ (
+ 'read' => true,
+ 'read_single' => true,
+ 'save' => true,
+ 'delete' => true,
+ 'check_perms' => true
+ );
+ var $type_app = array
(
- 'read' => true,
- 'read_single' => true,
- 'save' => true,
- 'delete' => true,
- 'check_perms' => true
- );
+ 'entity' => 'property',
+ 'catch' => 'catch'
+ );
- var $type_app = array
- (
- 'entity' => 'property',
- 'catch' => 'catch'
- );
-
- function __construct($session=false)
+ function __construct( $session = false )
{
- $this->bocommon =
CreateObject('property.bocommon');
- $this->custom =
createObject('property.custom_fields');
+ $this->bocommon = CreateObject( 'property.bocommon' );
+ $this->custom = createObject(
'property.custom_fields' );
- if ($session)
+ if ( $session )
{
$this->read_sessiondata();
$this->use_session = true;
}
- $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
- $query = phpgw::get_var('query');
- $sort = phpgw::get_var('sort');
- $order = phpgw::get_var('order');
- $type = phpgw::get_var('type');
- $cat_id = phpgw::get_var('cat_id', 'int');
- $allrows = phpgw::get_var('allrows', 'bool');
- $entity_id = phpgw::get_var('entity_id', 'int');
+ $start = phpgw::get_var( 'start', 'int',
'REQUEST', 0 );
+ $query = phpgw::get_var( 'query' );
+ $sort = phpgw::get_var( 'sort' );
+ $order = phpgw::get_var( 'order' );
+ $type = phpgw::get_var( 'type' );
+ $cat_id = phpgw::get_var( 'cat_id', 'int' );
+ $allrows = phpgw::get_var( 'allrows', 'bool' );
+ $entity_id = phpgw::get_var( 'entity_id', 'int' );
- $this->start = $start ? $start : 0;
- $this->query = isset($query) ?
$query : $this->query;
- $this->sort = isset($sort)
&& $sort ? $sort : '';
- $this->order = isset($order) &&
$order ? $order : '';
- $this->type = isset($type)
&& $type && isset($this->type_app[$type]) ? $type : 'entity';
- $this->cat_id = isset($cat_id) &&
$cat_id ? $cat_id : '';
- $this->entity_id = isset($entity_id) &&
$entity_id ? $entity_id : '';
- $this->allrows = isset($allrows) &&
$allrows ? $allrows : '';
- $this->so =
CreateObject('property.soadmin_entity','', '', $this->bocommon);
- $this->so->type = $this->type;
- $this->so->type_app = $this->type_app;
-
+ $this->start = $start ? $start : 0;
+ $this->query = isset( $query ) ? $query :
$this->query;
+ $this->sort = isset( $sort ) &&
$sort ? $sort : '';
+ $this->order = isset( $order ) && $order ?
$order : '';
+ $this->type = isset( $type ) &&
$type && isset( $this->type_app[$type] ) ? $type : 'entity';
+ $this->cat_id = isset( $cat_id ) && $cat_id
? $cat_id : '';
+ $this->entity_id = isset( $entity_id ) &&
$entity_id ? $entity_id : '';
+ $this->allrows = isset( $allrows ) &&
$allrows ? $allrows : '';
+ $this->so = CreateObject(
'property.soadmin_entity', '', '',
+ $this->bocommon
);
+ $this->so->type = $this->type;
+ $this->so->type_app = $this->type_app;
}
-
- function save_sessiondata($data)
+ function save_sessiondata( $data )
{
- if ($this->use_session)
+ if ( $this->use_session )
{
-
$GLOBALS['phpgw']->session->appsession('session_data','standard_e',$data);
+ $GLOBALS['phpgw']->session->appsession(
'session_data', 'standard_e', $data );
}
}
function read_sessiondata()
{
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_e');
+ $data = $GLOBALS['phpgw']->session->appsession(
'session_data', 'standard_e' );
- $this->start =
isset($data['start'])?$data['start']:'';
- $this->query =
isset($data['query'])?$data['query']:'';
- $this->sort =
isset($data['sort'])?$data['sort']:'';
- $this->order =
isset($data['order'])?$data['order']:'';
- $this->cat_id =
isset($data['cat_id'])?$data['cat_id']:'';
- $this->entity_id =
isset($data['entity_id'])?$data['entity_id']:'';
- $this->allrows =
isset($data['allrows'])?$data['allrows']:'';
+ $this->start = isset( $data['start'] ) ?
$data['start'] : '';
+ $this->query = isset( $data['query'] ) ?
$data['query'] : '';
+ $this->sort = isset( $data['sort'] ) ?
$data['sort'] : '';
+ $this->order = isset( $data['order'] ) ?
$data['order'] : '';
+ $this->cat_id = isset( $data['cat_id'] ) ?
$data['cat_id'] : '';
+ $this->entity_id = isset( $data['entity_id'] ) ?
$data['entity_id'] : '';
+ $this->allrows = isset( $data['allrows'] ) ?
$data['allrows'] : '';
}
- function get_location_level_list($selected='')
+ function get_location_level_list( $selected = '' )
{
- $soadmin_location =
CreateObject('property.soadmin_location');
- $location_types =
$soadmin_location->select_location_type();
- $max_location_type=count($location_types);
+ $soadmin_location = CreateObject(
'property.soadmin_location' );
+ $location_types =
$soadmin_location->select_location_type();
+ $max_location_type = count( $location_types );
- for ($i=1; $i<=$max_location_type; $i++)
+ for ( $i = 1; $i <= $max_location_type; $i++ )
{
- $location[$i]['id'] = $i;
- $location[$i]['name'] = $i . '-' .
$location_types[($i-1)]['name'];
+ $location[$i]['id'] = $i;
+ $location[$i]['name'] = $i . '-' .
$location_types[($i - 1)]['name'];
}
- return
$this->bocommon->select_list($selected,$location);
-
+ return $this->bocommon->select_list( $selected,
$location );
}
- function get_entity_list($selected='')
+ function get_entity_list( $selected = '' )
{
- $list = $this->so->read(array('allrows'=>true));
- return
$this->bocommon->select_multi_list($selected,$list);
+ $list = $this->so->read( array('allrows' => true) );
+ return $this->bocommon->select_multi_list( $selected,
$list );
}
- function get_entity_list_2($selected='')
+ function get_entity_list_2( $selected = '' )
{
- $list[0]['id']='project';
- $list[0]['name']='project';
- $list[1]['id']='ticket';
- $list[1]['name']='ticket';
- $list[2]['id']='document';
- $list[2]['name']='document';
- $list[3]['id']='request';
- $list[3]['name']='request';
- $list[4]['id']='investment';
- $list[4]['name']='investment';
- $list[5]['id']='s_agreement';
- $list[5]['name']='service agreement';
- return
$this->bocommon->select_multi_list($selected,$list);
+ $list[0]['id'] = 'project';
+ $list[0]['name'] = 'project';
+ $list[1]['id'] = 'ticket';
+ $list[1]['name'] = 'ticket';
+ $list[2]['id'] = 'document';
+ $list[2]['name'] = 'document';
+ $list[3]['id'] = 'request';
+ $list[3]['name'] = 'request';
+ $list[4]['id'] = 'investment';
+ $list[4]['name'] = 'investment';
+ $list[5]['id'] = 's_agreement';
+ $list[5]['name'] = 'service agreement';
+ return $this->bocommon->select_multi_list( $selected,
$list );
}
- function get_entity_list_3($selected='')
+ function get_entity_list_3( $selected = '' )
{
- $list[0]['id']='ticket';
- $list[0]['name']='ticket';
- $list[1]['id']='request';
- $list[1]['name']='request';
- return
$this->bocommon->select_multi_list($selected,$list);
+ $list[0]['id'] = 'ticket';
+ $list[0]['name'] = 'ticket';
+ $list[1]['id'] = 'request';
+ $list[1]['name'] = 'request';
+ return $this->bocommon->select_multi_list( $selected,
$list );
}
function read()
{
- $entity = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,'allrows'=>$this->allrows));
+ $entity = $this->so->read( array('start'
=> $this->start, 'query' => $this->query, 'sort'
=> $this->sort, 'order' => $this->order, 'allrows' =>
$this->allrows) );
$this->total_records = $this->so->total_records;
return $entity;
}
- function read_category($entity_id)
+ function read_category( $entity_id )
{
- $category = $this->so->read_category(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,
- 'order' =>
$this->order,'allrows'=>$this->allrows,'entity_id'=>$entity_id));
+ $category = $this->so->read_category( array('start'
=> $this->start, 'query' => $this->query, 'sort'
=> $this->sort,
+ 'order' => $this->order, 'allrows'
=> $this->allrows, 'entity_id' => $entity_id) );
$this->total_records = $this->so->total_records;
return $category;
}
- function read_single($id)
+ function read_single( $id )
{
- return $this->so->read_single($id);
+ return $this->so->read_single( $id );
}
- function read_single_category($entity_id,$cat_id)
+ function read_single_category( $entity_id, $cat_id )
{
- return
$this->so->read_single_category($entity_id,$cat_id);
+ return $this->so->read_single_category( $entity_id,
$cat_id );
}
- function save($values,$action='')
+ function save( $values, $action = '' )
{
- if ($action=='edit')
+ if ( $action == 'edit' )
{
- if ($values['id'] != '')
+ if ( $values['id'] != '' )
{
- $receipt =
$this->so->edit_entity($values);
+ $receipt = $this->so->edit_entity(
$values );
}
}
else
{
- $receipt = $this->so->add_entity($values);
- execMethod('phpgwapi.menu.clear');
+ $receipt = $this->so->add_entity( $values );
+ execMethod( 'phpgwapi.menu.clear' );
}
return $receipt;
}
- function save_category($values,$action='')
+ function save_category( $values, $action = '' )
{
- if ($action=='edit')
+ if ( $action == 'edit' )
{
- if ($values['id'] != '')
+ if ( $values['id'] != '' )
{
- $receipt =
$this->so->edit_category($values);
+ $receipt = $this->so->edit_category(
$values );
}
}
else
{
- $receipt = $this->so->add_category($values);
- execMethod('phpgwapi.menu.clear');
- if(isset($values['category_template']) &&
$values['category_template'] && isset($receipt['id']) && $receipt['id'])
+ $receipt = $this->so->add_category( $values );
+ execMethod( 'phpgwapi.menu.clear' );
+ if ( isset( $values['category_template'] ) &&
$values['category_template'] && isset( $receipt['id'] ) && $receipt['id'] )
{
$values2 = array
(
- 'entity_id'
=> $values['entity_id'],
- 'cat_id'
=> $receipt['id'],
- 'category_template'
=> $values['category_template'],
- 'selected'
=> $values['template_attrib']
- );
+ 'entity_id'
=> $values['entity_id'],
+ 'cat_id'
=> $receipt['id'],
+ 'category_template' =>
$values['category_template'],
+ 'selected'
=> $values['template_attrib']
+ );
-
$this->_add_attrib_from_template($values2);
+ $this->_add_attrib_from_template(
$values2 );
}
}
return $receipt;
}
- protected function _add_attrib_from_template($values)
+ protected function _add_attrib_from_template( $values )
{
- $template_info = explode('_',
$values['category_template']);
- $template_entity_id = $template_info[0];
- $template_cat_id = $template_info[1];
+ $template_info = explode( '_',
$values['category_template'] );
+ $template_entity_id = $template_info[0];
+ $template_cat_id = $template_info[1];
- $attrib_group_list =
$this->read_attrib_group($template_entity_id, $template_cat_id, true);
+ $attrib_group_list = $this->read_attrib_group(
$template_entity_id,
+
$template_cat_id, true );
- foreach ($attrib_group_list as $attrib_group)
+ foreach ( $attrib_group_list as $attrib_group )
{
$group = array
(
- 'appname' =>
$this->type_app[$this->type],
- 'location' =>
".{$this->type}.{$values['entity_id']}.{$values['cat_id']}",
- 'group_name' =>
$attrib_group['name'],
- 'descr' =>
$attrib_group['descr'],
- 'remark' =>
$attrib_group['remark']
- );
- $this->custom->add_group($group);
+ 'appname' =>
$this->type_app[$this->type],
+ 'location' =>
".{$this->type}.{$values['entity_id']}.{$values['cat_id']}",
+ 'group_name' => $attrib_group['name'],
+ 'descr' =>
$attrib_group['descr'],
+ 'remark' =>
$attrib_group['remark']
+ );
+ $this->custom->add_group( $group );
}
- $attrib_list =
$this->read_attrib($template_entity_id,$template_cat_id, true);
+ $attrib_list = $this->read_attrib( $template_entity_id,
$template_cat_id,
+ true
);
$template_attribs = array();
- foreach ($attrib_list as $attrib)
+ foreach ( $attrib_list as $attrib )
{
- if(in_array($attrib['id'],$values['selected']))
+ if ( in_array( $attrib['id'],
$values['selected'] ) )
{
- $template_attribs[] =
$this->read_single_attrib($template_entity_id,$template_cat_id,$attrib['id']);
+ $template_attribs[] =
$this->read_single_attrib( $template_entity_id,
+
$template_cat_id, $attrib['id'] );
}
}
- foreach ($template_attribs as $attrib)
+ foreach ( $template_attribs as $attrib )
{
- $attrib['appname'] =
$this->type_app[$this->type];
- $attrib['location'] =
".{$this->type}.{$values['entity_id']}.{$values['cat_id']}";
+ $attrib['appname'] =
$this->type_app[$this->type];
+ $attrib['location'] =
".{$this->type}.{$values['entity_id']}.{$values['cat_id']}";
$choices = array();
- if(isset($attrib['choice']) &&
$attrib['choice'])
+ if ( isset( $attrib['choice'] ) &&
$attrib['choice'] )
{
$choices = $attrib['choice'];
- unset($attrib['choice']);
+ unset( $attrib['choice'] );
}
- $id = $this->custom->add($attrib);
- if($choices)
+ $id = $this->custom->add( $attrib );
+ if ( $choices )
{
- foreach($choices as $choice)
+ foreach ( $choices as $choice )
{
- $attrib['new_choice'] =
$choice['value'];
- $attrib['id'] = $id;
- $this->custom->edit($attrib);
+ $attrib['new_choice'] =
$choice['value'];
+ $attrib['id']
= $id;
+ $this->custom->edit( $attrib );
}
}
}
}
- function
delete($cat_id='',$entity_id='',$attrib_id='',$acl_location='',$custom_function_id='',
$group_id ='')
+ function delete( $cat_id = '', $entity_id = '', $attrib_id = '',
+ $acl_location = '', $custom_function_id =
'', $group_id = '' )
{
- if(!$attrib_id && !$cat_id && $entity_id &&
!$custom_function_id && !$group_id)
+ if ( !$attrib_id && !$cat_id && $entity_id &&
!$custom_function_id && !$group_id )
{
- $this->so->delete_entity($entity_id);
- execMethod('phpgwapi.menu.clear');
+ $this->so->delete_entity( $entity_id );
+ execMethod( 'phpgwapi.menu.clear' );
}
- else if(!$attrib_id && $cat_id && $entity_id &&
!$custom_function_id && !$group_id)
+ else if ( !$attrib_id && $cat_id && $entity_id &&
!$custom_function_id && !$group_id )
{
- $this->so->delete_category($entity_id, $cat_id);
- execMethod('phpgwapi.menu.clear');
+ $this->so->delete_category( $entity_id, $cat_id
);
+ execMethod( 'phpgwapi.menu.clear' );
}
- else if($group_id && $cat_id && $entity_id &&
!$custom_function_id && !$attrib_id)
+ else if ( $group_id && $cat_id && $entity_id &&
!$custom_function_id && !$attrib_id )
{
-
$this->custom->delete_group($this->type_app[$this->type],
".{$this->type}.{$entity_id}.{$cat_id}", $group_id);
+ $this->custom->delete_group(
$this->type_app[$this->type],
+
".{$this->type}.{$entity_id}.{$cat_id}", $group_id );
}
- else if($attrib_id && $cat_id && $entity_id &&
!$custom_function_id && !$group_id)
+ else if ( $attrib_id && $cat_id && $entity_id &&
!$custom_function_id && !$group_id )
{
-
$this->custom->delete($this->type_app[$this->type],
".{$this->type}.{$entity_id}.{$cat_id}", $attrib_id);
- $this->so->delete_history($entity_id,
$cat_id,$attrib_id);
+ $this->custom->delete(
$this->type_app[$this->type],
+
".{$this->type}.{$entity_id}.{$cat_id}", $attrib_id );
+ $this->so->delete_history( $entity_id, $cat_id,
$attrib_id );
}
- else if($custom_function_id && $acl_location)
+ else if ( $custom_function_id && $acl_location )
{
-
$GLOBALS['phpgw']->custom_functions->delete($this->type_app[$this->type],
$acl_location,$custom_function_id);
+ $GLOBALS['phpgw']->custom_functions->delete(
$this->type_app[$this->type],
+
$acl_location, $custom_function_id );
}
}
- function get_attrib_group_list($entity_id,$cat_id, $selected)
+ function get_attrib_group_list( $entity_id, $cat_id, $selected )
{
- $group_list = $this->read_attrib_group($entity_id,
$cat_id, true);
+ $group_list = $this->read_attrib_group( $entity_id,
$cat_id, true );
- foreach($group_list as &$group)
+ foreach ( $group_list as &$group )
{
- if( $group['id'] == $selected )
+ if ( $group['id'] == $selected )
{
$group['selected'] = true;
}
@@ -372,208 +376,225 @@
return $group_list;
}
- function read_attrib_group($entity_id='',$cat_id='',$allrows='')
+ function read_attrib_group( $entity_id = '', $cat_id = '',
$allrows = '' )
{
- if($allrows)
+ if ( $allrows )
{
$this->allrows = $allrows;
}
- $attrib =
$this->custom->find_group($this->type_app[$this->type],
".{$this->type}.{$entity_id}.{$cat_id}", $this->start, $this->query,
$this->sort, $this->order, $this->allrows);
+ $attrib = $this->custom->find_group(
$this->type_app[$this->type],
+
".{$this->type}.{$entity_id}.{$cat_id}", $this->start, $this->query,
+
$this->sort, $this->order, $this->allrows );
$this->total_records = $this->custom->total_records;
return $attrib;
}
- function read_attrib($entity_id='',$cat_id='',$allrows='')
+ function read_attrib( $entity_id = '', $cat_id = '', $allrows =
'' )
{
- if($allrows)
+ if ( $allrows )
{
$this->allrows = $allrows;
}
- $attrib =
$this->custom->find($this->type_app[$this->type],
".{$this->type}.{$entity_id}.{$cat_id}", $this->start, $this->query,
$this->sort, $this->order, $this->allrows);
+ $attrib = $this->custom->find(
$this->type_app[$this->type],
+
".{$this->type}.{$entity_id}.{$cat_id}", $this->start, $this->query,
+ $this->sort,
$this->order, $this->allrows );
$this->total_records = $this->custom->total_records;
return $attrib;
}
- function read_single_attrib($entity_id,$cat_id,$id)
+ function read_single_attrib( $entity_id, $cat_id, $id )
{
- return $this->custom->get($this->type_app[$this->type],
".{$this->type}.{$entity_id}.{$cat_id}", $id, true);
+ return $this->custom->get( $this->type_app[$this->type],
+
".{$this->type}.{$entity_id}.{$cat_id}", $id, true );
}
- function read_single_attrib_group($entity_id,$cat_id,$id)
+ function read_single_attrib_group( $entity_id, $cat_id, $id )
{
- return
$this->custom->get_group($this->type_app[$this->type],
".{$this->type}.{$entity_id}.{$cat_id}", $id, true);
+ return $this->custom->get_group(
$this->type_app[$this->type],
+
".{$this->type}.{$entity_id}.{$cat_id}", $id, true );
}
- function resort_attrib_group($id,$resort)
+ function resort_attrib_group( $id, $resort )
{
- $this->custom->resort_group($id, $resort,
$this->type_app[$this->type],
".{$this->type}.{$this->entity_id}.{$this->cat_id}");
+ $this->custom->resort_group( $id, $resort,
$this->type_app[$this->type],
+
".{$this->type}.{$this->entity_id}.{$this->cat_id}" );
}
- function resort_attrib($id,$resort)
+ function resort_attrib( $id, $resort )
{
- $this->custom->resort($id, $resort,
$this->type_app[$this->type],
".{$this->type}.{$this->entity_id}.{$this->cat_id}");
+ $this->custom->resort( $id, $resort,
$this->type_app[$this->type],
+
".{$this->type}.{$this->entity_id}.{$this->cat_id}" );
}
- public function save_attrib_group($group, $action='')
+ public function save_attrib_group( $group, $action = '' )
{
$receipt = array();
- $group['appname'] = $this->type_app[$this->type];
- $group['location'] =
".{$this->type}.{$group['entity_id']}.{$group['cat_id']}";
- if ( $action=='edit' && $group['id'] )
+ $group['appname'] = $this->type_app[$this->type];
+ $group['location'] =
".{$this->type}.{$group['entity_id']}.{$group['cat_id']}";
+ if ( $action == 'edit' && $group['id'] )
{
- if ( $this->custom->edit_group($group) )
+ if ( $this->custom->edit_group( $group ) )
{
-
$receipt['message'][]=array('msg'=>lang('group has been updated'));
+ $receipt['message'][] = array('msg' =>
lang( 'group has been updated' ));
return $receipt;
}
- $receipt['error'][]=array('msg'=>lang('unable
to update group'));
+ $receipt['error'][] = array('msg' => lang(
'unable to update group' ));
return $receipt;
}
else
{
- $id = $this->custom->add_group($group);
+ $id = $this->custom->add_group( $group );
if ( $id <= 0 )
{
-
$receipt['error'][]=array('msg'=>lang('unable to add group'));
+ $receipt['error'][] = array('msg' =>
lang( 'unable to add group' ));
return $receipt;
}
else if ( $id == -1 )
{
- $receipt['id']= 0;
- $receipt['error'][]= array('msg' =>
lang('group already exists, please choose another name'));
- $receipt['error'][]= array('msg' =>
lang('Attribute group has NOT been saved'));
+ $receipt['id'] = 0;
+ $receipt['error'][] = array('msg'
=> lang( 'group already exists, please choose another
name' ));
+ $receipt['error'][] = array('msg'
=> lang( 'Attribute group has NOT been saved' ));
return $receipt;
}
- $receipt['id']= $id;
- $receipt['message'][]=array('msg'=>lang('group
has been created'));
+ $receipt['id'] = $id;
+ $receipt['message'][] = array('msg' => lang(
'group has been created' ));
return $receipt;
}
}
- public function save_attrib($attrib, $action='')
+
+ public function save_attrib( $attrib, $action = '' )
{
$receipt = array();
- $attrib['appname'] = $this->type_app[$this->type];
- $attrib['location'] =
".{$this->type}.{$attrib['entity_id']}.{$attrib['cat_id']}";
- if ( $action=='edit' && $attrib['id'] )
+ $attrib['appname'] = $this->type_app[$this->type];
+ $attrib['location'] =
".{$this->type}.{$attrib['entity_id']}.{$attrib['cat_id']}";
+ if ( $action == 'edit' && $attrib['id'] )
{
- if ( $this->custom->edit($attrib) )
+ if ( $this->custom->edit( $attrib ) )
{
- $receipt = $this->custom->receipt;
-
$receipt['message'][]=array('msg'=>lang('Field has been updated'));
+ $receipt
= $this->custom->receipt;
+ $receipt['message'][] = array('msg'
=> lang( 'Field has been updated' ));
return $receipt;
}
- $receipt['error'][]=array('msg'=>lang('Unable
to update field'));
+ $receipt['error'][] = array('msg' => lang(
'Unable to update field' ));
return $receipt;
}
else
{
- $id = $this->custom->add($attrib);
+ $id = $this->custom->add( $attrib );
if ( $id <= 0 )
{
-
$receipt['error'][]=array('msg'=>lang('Unable to add field'));
+ $receipt['error'][] = array('msg' =>
lang( 'Unable to add field' ));
return $receipt;
}
else if ( $id == -1 )
{
- $receipt['id']= 0;
- $receipt['error'][]= array('msg' =>
lang('field already exists, please choose another name'));
- $receipt['error'][]= array('msg' =>
lang('Attribute has NOT been saved'));
+ $receipt['id'] = 0;
+ $receipt['error'][] = array('msg'
=> lang( 'field already exists, please choose another
name' ));
+ $receipt['error'][] = array('msg'
=> lang( 'Attribute has NOT been saved' ));
return $receipt;
}
- $receipt['id']= $id;
- $receipt['message'][]=array('msg'=>lang('Custom
field has been created'));
+ $receipt['id'] = $id;
+ $receipt['message'][] = array('msg' => lang(
'Custom field has been created' ));
return $receipt;
}
}
- function
read_custom_function($entity_id='',$cat_id='',$allrows='', $acl_location='')
+ function read_custom_function( $entity_id = '', $cat_id = '',
$allrows = '',
+ $acl_location
= '' )
{
- if($allrows)
+ if ( $allrows )
{
$this->allrows = $allrows;
}
- if (!$acl_location && $entity_id && $cat_id)
+ if ( !$acl_location && $entity_id && $cat_id )
{
$acl_location =
".{$this->type}.{$entity_id}.{$cat_id}";
}
- $values =
$GLOBALS['phpgw']->custom_functions->find(array('start' => $this->start,'query'
=> $this->query,'sort' => $this->sort,'order' => $this->order,
- 'appname'=>
$this->type_app[$this->type],'location' =>
$acl_location,'allrows'=>$this->allrows));
+ $values = $GLOBALS['phpgw']->custom_functions->find(
array('start' => $this->start, 'query' =>
$this->query, 'sort' => $this->sort, 'order' =>
$this->order,
+ 'appname' =>
$this->type_app[$this->type], 'location' => $acl_location, 'allrows' =>
$this->allrows) );
$this->total_records =
$GLOBALS['phpgw']->custom_functions->total_records;
return $values;
}
- function resort_custom_function($id,$resort)
+ function resort_custom_function( $id, $resort )
{
$location =
".{$this->type}.{$this->entity_id}.{$this->cat_id}";
- return $GLOBALS['phpgw']->custom_functions->resort($id,
$resort, $this->type_app[$this->type], $location);
+ return $GLOBALS['phpgw']->custom_functions->resort(
$id, $resort,
+
$this->type_app[$this->type], $location );
}
- function save_custom_function($custom_function,$action='')
+ function save_custom_function( $custom_function, $action = '' )
{
- $custom_function['appname']=
$this->type_app[$this->type];
- if(!$custom_function['location'] &&
$custom_function['entity_id'] && $custom_function['cat_id'])
+ $custom_function['appname'] =
$this->type_app[$this->type];
+ if ( !$custom_function['location'] &&
$custom_function['entity_id'] && $custom_function['cat_id'] )
{
$custom_function['location'] =
".{$this->type}.{$custom_function['entity_id']}.{$custom_function['cat_id']}";
}
- if ($action=='edit')
+ if ( $action == 'edit' )
{
- if ($custom_function['id'] != '')
+ if ( $custom_function['id'] != '' )
{
- $receipt =
$GLOBALS['phpgw']->custom_functions->edit($custom_function);
+ $receipt =
$GLOBALS['phpgw']->custom_functions->edit( $custom_function );
}
}
else
{
- $receipt =
$GLOBALS['phpgw']->custom_functions->add($custom_function);
+ $receipt =
$GLOBALS['phpgw']->custom_functions->add( $custom_function );
}
return $receipt;
}
- function select_custom_function($selected='')
+ function select_custom_function( $selected = '' )
{
- $admin_custom = createObject('admin.bo_custom');
- return $admin_custom->select_custom_function($selected,
$this->type_app[$this->type]);
+ $admin_custom = createObject( 'admin.bo_custom' );
+ return $admin_custom->select_custom_function( $selected,
+
$this->type_app[$this->type] );
}
- function
read_single_custom_function($entity_id='',$cat_id='',$id,$location='')
+ function read_single_custom_function( $entity_id = '', $cat_id
= '', $id,
+
$location = '' )
{
- if (!$location && $entity_id && $cat_id)
+ if ( !$location && $entity_id && $cat_id )
{
$location =
".{$this->type}.{$entity_id}.{$cat_id}";
}
- return
$GLOBALS['phpgw']->custom_functions->get($this->type_app[$this->type],$location,$id);
+ return $GLOBALS['phpgw']->custom_functions->get(
$this->type_app[$this->type],
+
$location, $id );
}
- function get_path($entity_id, $node)
+ function get_path( $entity_id, $node )
{
- return $this->so->get_path($entity_id, $node);
+ return $this->so->get_path( $entity_id, $node );
}
- function read_category_tree2($entity_id)
+
+ function read_category_tree2( $entity_id )
{
- return $this->so->read_category_tree2($entity_id);
+ return $this->so->read_category_tree2( $entity_id );
}
- function get_children2($entity_id, $parent, $level,$reset =
false)
+
+ function get_children2( $entity_id, $parent, $level, $reset =
false )
{
- return $this->so->get_children2($entity_id, $parent,
$level,$reset);
+ return $this->so->get_children2( $entity_id, $parent,
$level, $reset );
}
function convert_to_eav()
{
return $this->so->convert_to_eav();
}
- }
+
+ }
\ No newline at end of file
Modified: trunk/property/inc/class.boadmin_location.inc.php
===================================================================
--- trunk/property/inc/class.boadmin_location.inc.php 2012-09-01 17:18:37 UTC
(rev 9958)
+++ trunk/property/inc/class.boadmin_location.inc.php 2012-09-02 18:55:51 UTC
(rev 9959)
@@ -1,39 +1,40 @@
<?php
+
/**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 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/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007 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/bbb_/ekstern/
+ * @package property
+ * @subpackage admin
+ * @version $Id$
+ */
/**
* Description
* @package property
*/
-
class property_boadmin_location
{
+
public $start;
public $query;
public $sort;
@@ -44,63 +45,61 @@
* @var object $custom reference to custom fields object
*/
protected $custom;
-
var $public_functions = array
- (
- 'read' => true,
- 'read_single' => true,
- 'save' => true,
- 'delete' => true,
- 'check_perms' => true
- );
+ (
+ 'read' => true,
+ 'read_single' => true,
+ 'save' => true,
+ 'delete' => true,
+ 'check_perms' => true
+ );
- function property_boadmin_location($session=false)
+ function property_boadmin_location( $session = false )
{
- $this->so =
CreateObject('property.soadmin_location');
- $this->bocommon = CreateObject('property.bocommon');
- $this->custom =
createObject('property.custom_fields');
+ $this->so = CreateObject(
'property.soadmin_location' );
+ $this->bocommon = CreateObject( 'property.bocommon' );
+ $this->custom = createObject(
'property.custom_fields' );
- if ($session)
+ if ( $session )
{
- // $this->read_sessiondata();
+ // $this->read_sessiondata();
$this->use_session = true;
}
- $start = phpgw::get_var('start', 'int',
'REQUEST', 0);
- $query = phpgw::get_var('query');
- $sort = phpgw::get_var('sort');
- $order = phpgw::get_var('order');
- $allrows = phpgw::get_var('allrows', 'bool');
+ $start = phpgw::get_var( 'start', 'int', 'REQUEST', 0
);
+ $query = phpgw::get_var( 'query' );
+ $sort = phpgw::get_var( 'sort' );
+ $order = phpgw::get_var( 'order' );
+ $allrows = phpgw::get_var( 'allrows', 'bool' );
- $this->start = $start ? $start : 0;
- $this->query = isset($query) ?
$query : $this->query;
- $this->sort = isset($sort)
&& $sort ? $sort : '';
- $this->order = isset($order) &&
$order ? $order : '';
- $this->allrows = isset($allrows) &&
$allrows ? $allrows : '';
+ $this->start = $start ? $start : 0;
+ $this->query = isset( $query ) ? $query :
$this->query;
+ $this->sort = isset( $sort ) && $sort ?
$sort : '';
+ $this->order = isset( $order ) && $order ? $order :
'';
+ $this->allrows = isset( $allrows ) && $allrows ?
$allrows : '';
}
-
- function save_sessiondata($data)
+ function save_sessiondata( $data )
{
- if ($this->use_session)
+ if ( $this->use_session )
{
-
$GLOBALS['phpgw']->session->appsession('session_data','standard_e',$data);
+ $GLOBALS['phpgw']->session->appsession(
'session_data', 'standard_e', $data );
}
}
function read_sessiondata()
{
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_e');
+ $data = $GLOBALS['phpgw']->session->appsession(
'session_data', 'standard_e' );
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
}
function read()
{
- $standard = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
+ $standard = $this->so->read( array('start' =>
$this->start, 'query' => $this->query, 'sort' => $this->sort,
'order' => $this->order) );
$this->total_records = $this->so->total_records;
@@ -110,90 +109,91 @@
function read_config()
{
- $standard = $this->so->read_config(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
+ $standard = $this->so->read_config( array('start' =>
$this->start, 'query' => $this->query, 'sort' => $this->sort, 'order' =>
$this->order) );
$this->total_records = $this->so->total_records;
-
return $standard;
}
- function read_config_single($column_name)
+ function read_config_single( $column_name )
{
- return $this->so->read_config_single($column_name);
+ return $this->so->read_config_single( $column_name );
}
- function read_single($id)
+ function read_single( $id )
{
- return $this->so->read_single($id);
+ return $this->so->read_single( $id );
}
- function save($standard)
+ function save( $standard )
{
- if (isset($standard['id']) && $standard['id'])
+ if ( isset( $standard['id'] ) && $standard['id'] )
{
- $receipt = $this->so->edit($standard);
-
+ $receipt = $this->so->edit( $standard );
}
else
{
- $receipt = $this->so->add($standard);
+ $receipt = $this->so->add( $standard );
}
return $receipt;
}
- function delete($type_id,$id,$attrib='',$group_id)
+ function delete( $type_id, $id, $attrib = '', $group_id )
{
- if($id && !$attrib)
+ if ( $id && !$attrib )
{
- $receipt = $this->so->delete($id);
+ $receipt = $this->so->delete( $id );
}
- else if($type_id && $id && $attrib)
+ else if ( $type_id && $id && $attrib )
{
- $ok = 0;
+ $ok = 0;
$receipt = array();
-
if($this->custom->delete('property',".location.{$type_id}", $id ,
"fm_location{$type_id}_history", true ))
+ if ( $this->custom->delete( 'property',
".location.{$type_id}", $id,
+
"fm_location{$type_id}_history", true ) )
{
$ok++;
}
-
if($this->custom->delete('property',".location.{$type_id}", $id ,
"fm_location{$type_id}" ))
+ if ( $this->custom->delete( 'property',
".location.{$type_id}", $id,
+
"fm_location{$type_id}" ) )
{
$ok++;
}
- if ($ok == 2)
+ if ( $ok == 2 )
{
- $receipt['message'][] = array('msg' =>
lang('attibute has been deleted'));
+ $receipt['message'][] = array('msg' =>
lang( 'attibute has been deleted' ));
}
else
{
- $receipt['error'][] = array('msg' =>
lang('something went wrong'));
+ $receipt['error'][] = array('msg' =>
lang( 'something went wrong' ));
}
}
- else if($type_id && $group_id)
+ else if ( $type_id && $group_id )
{
-
if($this->custom->delete_group('property',".location.{$type_id}", $group_id))
+ if ( $this->custom->delete_group( 'property',
".location.{$type_id}",
+
$group_id ) )
{
- $receipt['message'][] = array('msg' =>
lang('attibute group %1 has been deleted',$group_id));
+ $receipt['message'][] = array('msg' =>
lang( 'attibute group %1 has been deleted',
+
$group_id ));
}
else
{
- $receipt['error'][] = array('msg' =>
lang('something went wrong'));
+ $receipt['error'][] = array('msg' =>
lang( 'something went wrong' ));
}
}
return $receipt;
}
-
- function get_attrib_group_list($type_id, $selected)
+ function get_attrib_group_list( $type_id, $selected )
{
- $location = ".location.{$type_id}";
- $group_list = $this->read_attrib_group($location, true);
+ $location = ".location.{$type_id}";
+ $group_list = $this->read_attrib_group( $location,
true );
- foreach($group_list as &$group)
+ foreach ( $group_list as &$group )
{
- if( $group['id'] == $selected )
+ if ( $group['id'] == $selected )
{
$group['selected'] = true;
}
@@ -201,188 +201,189 @@
return $group_list;
}
- function read_attrib_group($location, $allrows='')
+ function read_attrib_group( $location, $allrows = '' )
{
- if($allrows)
+ if ( $allrows )
{
$this->allrows = $allrows;
}
- $attrib = $this->custom->find_group('property',
$location, $this->start, $this->query, $this->sort, $this->order,
$this->allrows);
+ $attrib =
$this->custom->find_group( 'property', $location, $this->start,
+
$this->query, $this->sort, $this->order, $this->allrows );
$this->total_records = $this->custom->total_records;
return $attrib;
}
- function read_single_attrib_group($location, $id)
+ function read_single_attrib_group( $location, $id )
{
- return $this->custom->get_group('property', $location,
$id, true);
+ return $this->custom->get_group( 'property', $location,
$id, true );
}
- function resort_attrib_group($location, $id, $resort)
+ function resort_attrib_group( $location, $id, $resort )
{
- $this->custom->resort_group($id, $resort, 'property',
$location);
+ $this->custom->resort_group( $id, $resort, 'property',
$location );
}
- public function save_attrib_group($group, $action='')
+ public function save_attrib_group( $group, $action = '' )
{
$group['appname'] = 'property';
- if ( $action=='edit' && $group['id'] )
+ if ( $action == 'edit' && $group['id'] )
{
- if ( $this->custom->edit_group($group) )
+ if ( $this->custom->edit_group( $group ) )
{
return array
- (
- 'msg' => array('msg'
=> lang('group has been updated'))
- );
+ (
+ 'msg' => array('msg' => lang(
'group has been updated' ))
+ );
}
- return array('error' => lang('Unable to update
group'));
+ return array('error' => lang( 'Unable to update
group' ));
}
else
{
- $id = $this->custom->add_group($group);
- if ( $id <= 0 )
+ $id = $this->custom->add_group( $group );
+ if ( $id <= 0 )
{
- return array('error' => lang('Unable to
add group'));
+ return array('error' => lang( 'Unable
to add group' ));
}
else if ( $id == -1 )
{
return array
+ (
+ 'id' => 0,
+ 'error' => array
(
- 'id' => 0,
- 'error' => array
- (
- array('msg' =>
lang('group already exists, please choose another name')),
- array('msg' =>
lang('Attribute group has NOT been saved'))
- )
- );
+ array('msg' => lang(
'group already exists, please choose another name' )),
+ array('msg' => lang(
'Attribute group has NOT been saved' ))
+ )
+ );
}
return array
- (
- 'id' => $id,
- 'msg' => array('msg' =>
lang('group has been created'))
- );
+ (
+ 'id' => $id,
+ 'msg' => array('msg' => lang( 'group
has been created' ))
+ );
}
}
-
- function read_attrib($type_id, $allrows = '')
+ function read_attrib( $type_id, $allrows = '' )
{
- if($allrows || phpgw::get_var('allrows') == 1)
+ if ( $allrows || phpgw::get_var( 'allrows' ) == 1 )
{
$this->allrows = true;
}
- $attrib = $this->custom->find('property', '.location.'
. $type_id, $this->start, $this->query, $this->sort, $this->order,
$this->allrows);
+ $attrib = $this->custom->find( 'property', '.location.'
. $type_id,
+ $this->start,
$this->query, $this->sort, $this->order, $this->allrows );
$this->total_records = $this->custom->total_records;
return $attrib;
}
- function read_single_attrib($type_id,$id)
+ function read_single_attrib( $type_id, $id )
{
- return $this->custom->get('property',
".location.{$type_id}", $id, true);
+ return $this->custom->get( 'property',
".location.{$type_id}", $id, true );
}
- function resort_attrib($data = array())
+ function resort_attrib( $data = array() )
{
- $resort = isset($data['resort'])?$data['resort']:'up';
- $type_id = isset($data['type_id'])?$data['type_id']:'';
- $id = (isset($data['id'])?$data['id']:'');
+ $resort = isset( $data['resort'] ) ? $data['resort'] :
'up';
+ $type_id = isset( $data['type_id'] ) ? $data['type_id']
: '';
+ $id = (isset( $data['id'] ) ? $data['id']
: '');
- if(!$type_id || !$id)
+ if ( !$type_id || !$id )
{
return;
}
- $this->custom->resort($id, $resort, 'property',
'.location.' . $type_id);
+ $this->custom->resort( $id, $resort, 'property',
'.location.' . $type_id );
}
- public function save_attrib($attrib,$action='')
+ public function save_attrib( $attrib, $action = '' )
{
- $attrib['appname'] = 'property';
- $attrib['location'] = '.location.' . $attrib['type_id'];
- $primary_table = 'fm_location' . $attrib['type_id'];
- $history_table = $primary_table . '_history';
+ $attrib['appname'] = 'property';
+ $attrib['location'] = '.location.' .
$attrib['type_id'];
+ $primary_table = 'fm_location' .
$attrib['type_id'];
+ $history_table = $primary_table . '_history';
- if ( $action=='edit' && $attrib['id'] )
+ if ( $action == 'edit' && $attrib['id'] )
{
- if ( $this->custom->edit($attrib,
$history_table, true) )
+ if ( $this->custom->edit( $attrib,
$history_table, true ) )
{
- $this->custom->edit($attrib,
$primary_table);
+ $this->custom->edit( $attrib,
$primary_table );
return array
- (
- 'msg' => array('msg'
=> lang('Field has been updated'))
- );
+ (
+ 'msg' => array('msg' => lang(
'Field has been updated' ))
+ );
}
- return array('error' => lang('Unable to update
field'));
+ return array('error' => lang( 'Unable to update
field' ));
}
else
{
- $id = $this->custom->add($attrib,
$primary_table);
- $this->custom->add($attrib, $history_table,
true);
- if ( $id <= 0 )
+ $id = $this->custom->add( $attrib,
$primary_table );
+ $this->custom->add( $attrib, $history_table,
true );
+ if ( $id <= 0 )
{
- return array('error' => lang('Unable to
add field'));
+ return array('error' => lang( 'Unable
to add field' ));
}
else if ( $id == -1 )
{
return array
+ (
+ 'id' => 0,
+ 'error' => array
(
- 'id' => 0,
- 'error' => array
- (
- array('msg' =>
lang('field already exists, please choose another name')),
- array('msg' =>
lang('Attribute has NOT been saved'))
- )
- );
+ array('msg' => lang(
'field already exists, please choose another name' )),
+ array('msg' => lang(
'Attribute has NOT been saved' ))
+ )
+ );
}
return array
- (
- 'id' => $id,
- 'msg' => array('msg' =>
lang('Custom field has been created'))
- );
+ (
+ 'id' => $id,
+ 'msg' => array('msg' => lang(
'Custom field has been created' ))
+ );
}
}
- function save_config($values='',$column_name='')
+ function save_config( $values = '', $column_name = '' )
{
- return $this->so->save_config($values,$column_name);
+ return $this->so->save_config( $values, $column_name );
}
- function select_location_type($selected='')
+ function select_location_type( $selected = '' )
{
- $location_types= $this->so->select_location_type();
- return
$this->bocommon->select_list($selected,$location_types);
+ $location_types = $this->so->select_location_type();
+ return $this->bocommon->select_list( $selected,
$location_types );
}
- function select_nullable($selected='')
+ function select_nullable( $selected = '' )
{
- $nullable[0]['id']= 'true';
- $nullable[0]['name']= lang('true');
- $nullable[1]['id']= 'false';
- $nullable[1]['name']= lang('false');
+ $nullable[0]['id'] = 'true';
+ $nullable[0]['name'] = lang( 'true' );
+ $nullable[1]['id'] = 'false';
+ $nullable[1]['name'] = lang( 'false' );
- return
$this->bocommon->select_list($selected,$nullable);
+ return $this->bocommon->select_list( $selected,
$nullable );
}
- function get_list_info($type_id='',$selected='')
+ function get_list_info( $type_id = '', $selected = '' )
{
- if($type_id)
+ if ( $type_id )
{
- $location_types=
$this->so->select_location_type();
+ $location_types =
$this->so->select_location_type();
- for ($i=0; $i<($type_id); $i++)
+ for ( $i = 0; $i < ($type_id); $i++ )
{
$location[$i] = $location_types[$i];
- unset($location[$i]['list_info']);
- if(isset($selected[($i+1)]) &&
$selected[($i+1)])
+ unset( $location[$i]['list_info'] );
+ if ( isset( $selected[($i + 1)] ) &&
$selected[($i + 1)] )
{
$location[$i]['selected'] =
'selected';
}
@@ -390,5 +391,5 @@
return $location;
}
}
- }
+ }
\ No newline at end of file
Modified: trunk/property/inc/class.boagreement.inc.php
===================================================================
--- trunk/property/inc/class.boagreement.inc.php 2012-09-01 17:18:37 UTC
(rev 9958)
+++ trunk/property/inc/class.boagreement.inc.php 2012-09-02 18:55:51 UTC
(rev 9959)
@@ -1,39 +1,40 @@
<?php
+
/**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 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/bbb_/ekstern/
- * @package property
- * @subpackage agreement
- * @version $Id$
- */
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007 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/bbb_/ekstern/
+ * @package property
+ * @subpackage agreement
+ * @version $Id$
+ */
/**
* Description
* @package property
*/
-
class property_boagreement
{
+
var $start;
var $query;
var $filter;
@@ -47,224 +48,234 @@
* @var object $custom reference to custom fields object
*/
protected $custom;
-
var $public_functions = array
(
- 'read' => true,
- 'read_single' => true,
- 'save' => true,
- 'delete' => true,
- 'check_perms' => true
- );
+ 'read' => true,
+ 'read_single' => true,
+ 'save' => true,
+ 'delete' => true,
+ 'check_perms' => true
+ );
- function property_boagreement($session=false)
+ function property_boagreement( $session = false )
{
- $this->so = CreateObject('property.soagreement');
- $this->bocommon = CreateObject('property.bocommon');
- $this->custom =
createObject('property.custom_fields');
+ $this->so = CreateObject(
'property.soagreement' );
+ $this->bocommon = CreateObject( 'property.bocommon' );
+ $this->custom = createObject(
'property.custom_fields' );
- if ($session)
+ if ( $session )
{
$this->read_sessiondata();
$this->use_session = true;
}
- $start = phpgw::get_var('start', 'int',
'REQUEST', 0);
- $query = phpgw::get_var('query');
- $sort = phpgw::get_var('sort');
- $order = phpgw::get_var('order');
- $filter = phpgw::get_var('filter', 'int');
- $cat_id = phpgw::get_var('cat_id', 'int');
- $vendor_id = phpgw::get_var('vendor_id', 'int');
- $allrows = phpgw::get_var('allrows', 'bool');
- $role = phpgw::get_var('role');
- $member_id = phpgw::get_var('member_id', 'int');
- $status_id = phpgw::get_var('status_id');
+ $start = phpgw::get_var( 'start', 'int',
'REQUEST', 0 );
+ $query = phpgw::get_var( 'query' );
+ $sort = phpgw::get_var( 'sort' );
+ $order = phpgw::get_var( 'order' );
+ $filter = phpgw::get_var( 'filter', 'int' );
+ $cat_id = phpgw::get_var( 'cat_id', 'int' );
+ $vendor_id = phpgw::get_var( 'vendor_id', 'int' );
+ $allrows = phpgw::get_var( 'allrows', 'bool' );
+ $role = phpgw::get_var( 'role' );
+ $member_id = phpgw::get_var( 'member_id', 'int' );
+ $status_id = phpgw::get_var( 'status_id' );
- $this->role = $role;
- $this->so->role = $role;
+ $this->role = $role;
+ $this->so->role = $role;
- $this->status_id =
isset($_REQUEST['status_id']) ? $status_id : $this->status_id;
- $this->start =
isset($_REQUEST['start']) ? $start : $this->start;
- $this->order =
isset($_REQUEST['order']) ? $order : $this->order;
- $this->sort =
isset($_REQUEST['sort']) ? $sort : $this->sort;
- $this->query =
isset($_REQUEST['query']) ? $query : $this->query;
- $this->vendor_id =
isset($_REQUEST['vendor_id']) ? $vendor_id : $this->vendor_id;
- $this->member_id =
isset($_REQUEST['member_id']) ? $member_id : $this->member_id;
- $this->cat_id =
isset($_REQUEST['cat_id']) ? $cat_id : $this->cat_id;
+ $this->status_id = isset( $_REQUEST['status_id'] ) ?
$status_id : $this->status_id;
+ $this->start = isset( $_REQUEST['start'] ) ? $start
: $this->start;
+ $this->order = isset( $_REQUEST['order'] ) ? $order
: $this->order;
+ $this->sort = isset( $_REQUEST['sort'] ) ?
$sort : $this->sort;
+ $this->query = isset( $_REQUEST['query'] ) ? $query
: $this->query;
+ $this->vendor_id = isset( $_REQUEST['vendor_id'] ) ?
$vendor_id : $this->vendor_id;
+ $this->member_id = isset( $_REQUEST['member_id'] ) ?
$member_id : $this->member_id;
+ $this->cat_id = isset( $_REQUEST['cat_id'] ) ?
$cat_id : $this->cat_id;
- if(!empty($filter))
+ if ( !empty( $filter ) )
{
$this->filter = $filter;
}
- if($allrows)
+ if ( $allrows )
{
$this->allrows = $allrows;
}
}
- function save_sessiondata($data)
+ function save_sessiondata( $data )
{
- if ($this->use_session)
+ if ( $this->use_session )
{
-
$GLOBALS['phpgw']->session->appsession('session_data','agreement',$data);
+ $GLOBALS['phpgw']->session->appsession(
'session_data', 'agreement', $data );
}
}
function read_sessiondata()
{
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','agreement');
+ $data = $GLOBALS['phpgw']->session->appsession(
'session_data', 'agreement' );
// _debug_array($data);die();
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- $this->vendor_id= $data['vendor_id'];
- $this->member_id= $data['member_id'];
- $this->status_id= $data['status_id'];
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->filter = $data['filter'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
+ $this->cat_id = $data['cat_id'];
+ $this->vendor_id = $data['vendor_id'];
+ $this->member_id = $data['member_id'];
+ $this->status_id = $data['status_id'];
}
- function check_perms($has, $needed)
+ function check_perms( $has, $needed )
{
return (!!($has & $needed) == true);
}
- function select_vendor_list($format='',$selected='')
+ function select_vendor_list( $format = '', $selected = '' )
{
- switch($format)
+ switch ( $format )
{
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('select_vendor'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_vendor'));
- break;
+ case 'select':
+ $GLOBALS['phpgw']->xslttpl->add_file(
array('select_vendor') );
+ break;
+ case 'filter':
+ $GLOBALS['phpgw']->xslttpl->add_file(
array('filter_vendor') );
+ break;
}
- $input_list= $this->so->select_vendor_list();
- $vendor_list=
$this->bocommon->select_list($selected,$input_list);
+ $input_list = $this->so->select_vendor_list();
+ $vendor_list = $this->bocommon->select_list( $selected,
$input_list );
return $vendor_list;
}
function read()
{
- $agreements = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
- 'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows,'member_id'=>$this->member_id,
- 'vendor_id'=>$this->vendor_id,
'status_id'=>$this->status_id));
+ $agreements = $this->so->read( array('start' =>
$this->start, 'query' => $this->query, 'sort' => $this->sort, 'order' =>
$this->order,
+ 'filter' => $this->filter, 'cat_id' =>
$this->cat_id, 'allrows' => $this->allrows, 'member_id' => $this->member_id,
+ 'vendor_id' => $this->vendor_id, 'status_id' =>
$this->status_id) );
$this->total_records = $this->so->total_records;
- $this->uicols = $this->so->uicols;
+ $this->uicols = $this->so->uicols;
- foreach ($agreements as &$agreement)
+ foreach ( $agreements as &$agreement )
{
- if($agreement['start_date'])
+ if ( $agreement['start_date'] )
{
- $agreement['start_date'] =
$GLOBALS['phpgw']->common->show_date($agreement['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $agreement['start_date'] =
$GLOBALS['phpgw']->common->show_date( $agreement['start_date'],
+
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] );
}
- if($agreement['termination_date'])
+ if ( $agreement['termination_date'] )
{
- $agreement['termination_date'] =
$GLOBALS['phpgw']->common->show_date($agreement['termination_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $agreement['termination_date'] =
$GLOBALS['phpgw']->common->show_date( $agreement['termination_date'],
+
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] );
}
- if($agreement['end_date'])
+ if ( $agreement['end_date'] )
{
- $agreement['end_date'] =
$GLOBALS['phpgw']->common->show_date($agreement['end_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $agreement['end_date'] =
$GLOBALS['phpgw']->common->show_date( $agreement['end_date'],
+
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] );
}
}
return $agreements;
}
- function read_details($id)
+ function read_details( $id )
{
- $list = $this->so->read_details(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
- 'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows,'member_id'=>$this->member_id,
- 'agreement_id'=>$id));
+ $list = $this->so->read_details( array('start' =>
$this->start, 'query' => $this->query, 'sort' => $this->sort, 'order' =>
$this->order,
+ 'filter' => $this->filter, 'cat_id' =>
$this->cat_id, 'allrows' => $this->allrows, 'member_id' => $this->member_id,
+ 'agreement_id' => $id) );
$this->total_records = $this->so->total_records;
- $this->uicols = $this->so->uicols;
+ $this->uicols = $this->so->uicols;
return $list;
}
- function read_prizing($data)
+ function read_prizing( $data )
{
- $list = $this->so->read_prizing($data);
+ $list =
$this->so->read_prizing( $data );
$this->total_records = $this->so->total_records;
- $this->uicols = $this->so->uicols;
+ $this->uicols = $this->so->uicols;
- for ($i=0; $i<count($list); $i++)
+ for ( $i = 0; $i < count( $list ); $i++ )
{
- $list[$i]['index_date'] =
$GLOBALS['phpgw']->common->show_date($list[$i]['index_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $list[$i]['index_date'] =
$GLOBALS['phpgw']->common->show_date( $list[$i]['index_date'],
+
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] );
}
return $list;
}
- function read_event($data)
+ function read_event( $data )
{
- $boalarm =
CreateObject('property.boalarm');
- $event = $this->so->read_single($data['agreement_id']);
- $event['alarm_date']=$event['termination_date'];
- $event['alarm'] =
$boalarm->read_alarms($type='agreement',$data['agreement_id']);
+ $boalarm = CreateObject(
'property.boalarm' );
+ $event =
$this->so->read_single( $data['agreement_id'] );
+ $event['alarm_date'] = $event['termination_date'];
+ $event['alarm'] = $boalarm->read_alarms( $type
= 'agreement',
+
$data['agreement_id'] );
return $event;
}
- function read_single($data)
+ function read_single( $data )
{
- $values['attributes'] = $this->custom->find('property',
'.agreement', 0, '', 'ASC', 'attrib_sort', true, true);
+ $values['attributes'] = $this->custom->find(
'property', '.agreement', 0, '',
+
'ASC', 'attrib_sort', true, true );
- if(isset($data['agreement_id']) &&
$data['agreement_id'])
+ if ( isset( $data['agreement_id'] ) &&
$data['agreement_id'] )
{
- $values =
$this->so->read_single($data['agreement_id'], $values);
+ $values = $this->so->read_single(
$data['agreement_id'], $values );
}
- $values = $this->custom->prepare($values, 'property',
'.agreement');
+ $values = $this->custom->prepare( $values, 'property',
'.agreement' );
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- if(isset($values['entry_date']) &&
$values['entry_date'])
+ if ( isset( $values['entry_date'] ) &&
$values['entry_date'] )
{
- $values['entry_date'] =
$GLOBALS['phpgw']->common->show_date($values['entry_date'],$dateformat);
+ $values['entry_date'] =
$GLOBALS['phpgw']->common->show_date( $values['entry_date'],
+
$dateformat );
}
- $values['start_date'] =
$GLOBALS['phpgw']->common->show_date($values['start_date'],$dateformat);
- $values['end_date'] =
$GLOBALS['phpgw']->common->show_date($values['end_date'],$dateformat);
- if(isset($values['termination_date']) &&
$values['termination_date'])
+ $values['start_date'] =
$GLOBALS['phpgw']->common->show_date( $values['start_date'],
+
$dateformat );
+ $values['end_date'] =
$GLOBALS['phpgw']->common->show_date( $values['end_date'],
+
$dateformat );
+ if ( isset( $values['termination_date'] ) &&
$values['termination_date'] )
{
- $values['termination_date']=
$GLOBALS['phpgw']->common->show_date($values['termination_date'],$dateformat);
+ $values['termination_date'] =
$GLOBALS['phpgw']->common->show_date( $values['termination_date'],
+
$dateformat );
}
- $vfs = CreateObject('phpgwapi.vfs');
- $vfs->override_acl = 1;
+ $vfs = CreateObject(
'phpgwapi.vfs' );
+ $vfs->override_acl = 1;
- $values['files'] = $vfs->ls (array(
- 'string' =>
"/property/agreement/{$data['agreement_id']}",
- 'relatives' => array(RELATIVE_NONE)));
+ $values['files'] = $vfs->ls( array(
+ 'string' =>
"/property/agreement/{$data['agreement_id']}",
+ 'relatives' => array(RELATIVE_NONE)) );
$vfs->override_acl = 0;
- if(!isset($values['files'][0]['file_id']) ||
!$values['files'][0]['file_id'])
+ if ( !isset( $values['files'][0]['file_id'] ) ||
!$values['files'][0]['file_id'] )
{
- unset($values['files']);
+ unset( $values['files'] );
}
return $values;
}
- function read_single_item($data)
+ function read_single_item( $data )
{
- $values['attributes'] = $this->custom->find('property',
'.agreement.detail', 0, '', 'ASC', 'attrib_sort', true, true);
- if(isset($data['agreement_id']) &&
$data['agreement_id'] && isset($data['id']) && $data['id'])
+ $values['attributes'] = $this->custom->find(
'property', '.agreement.detail',
+
0, '', 'ASC', 'attrib_sort', true, true );
+ if ( isset( $data['agreement_id'] ) &&
$data['agreement_id'] && isset( $data['id'] ) && $data['id'] )
{
- $values = $this->so->read_single_item($data,
$values);
+ $values = $this->so->read_single_item( $data,
$values );
}
- $values = $this->custom->prepare($values, 'property',
'.agreement.detail');
+ $values = $this->custom->prepare( $values, 'property',
'.agreement.detail' );
return $values;
}
@@ -276,93 +287,93 @@
*
* @return array the grouped attributes
*/
-
- public function get_attribute_groups($location, $attributes =
array())
+ public function get_attribute_groups( $location, $attributes =
array() )
{
- return $this->custom->get_attribute_groups('property',
$location, $attributes);
+ return $this->custom->get_attribute_groups( 'property',
$location,
+
$attributes );
}
- function save($values,$values_attribute='',$action='')
+ function save( $values, $values_attribute = '', $action = '' )
{
- $values['start_date'] =
$this->bocommon->date_to_timestamp($values['start_date']);
- $values['end_date'] =
$this->bocommon->date_to_timestamp($values['end_date']);
- $values['termination_date'] =
$this->bocommon->date_to_timestamp($values['termination_date']);
+ $values['start_date'] =
$this->bocommon->date_to_timestamp( $values['start_date'] );
+ $values['end_date'] =
$this->bocommon->date_to_timestamp( $values['end_date'] );
+ $values['termination_date'] =
$this->bocommon->date_to_timestamp( $values['termination_date'] );
- if(is_array($values_attribute))
+ if ( is_array( $values_attribute ) )
{
- $values_attribute =
$this->custom->convert_attribute_save($values_attribute);
+ $values_attribute =
$this->custom->convert_attribute_save( $values_attribute );
}
- if ($action=='edit')
- // if
($values['agreement_id'])
+ if ( $action == 'edit' )
+ // if ($values['agreement_id'])
{
- if ($values['agreement_id'] != 0)
+ if ( $values['agreement_id'] != 0 )
{
-
$receipt=$this->so->edit($values,$values_attribute);
+ $receipt = $this->so->edit( $values,
$values_attribute );
}
}
else
{
- $receipt =
$this->so->add($values,$values_attribute);
+ $receipt = $this->so->add( $values,
$values_attribute );
}
return $receipt;
}
- function save_item($values,$values_attribute='')
+ function save_item( $values, $values_attribute = '' )
{
//_debug_array($values);
- $values['m_cost'] =
str_replace(",",".",$values['m_cost']);
- $values['w_cost'] =
str_replace(",",".",$values['w_cost']);
- $values['total_cost'] = $values['m_cost'] +
$values['w_cost'];
+ $values['m_cost'] = str_replace( ",",
".", $values['m_cost'] );
+ $values['w_cost'] = str_replace( ",",
".", $values['w_cost'] );
+ $values['total_cost'] = $values['m_cost'] +
$values['w_cost'];
- if ($values['index_count'] > 0)
+ if ( $values['index_count'] > 0 )
{
- if ($values['id'] != 0)
+ if ( $values['id'] != 0 )
{
- $receipt=$this->so->edit_item($values);
+ $receipt = $this->so->edit_item(
$values );
}
}
else
{
- $receipt = $this->so->add_item($values);
+ $receipt = $this->so->add_item( $values );
}
return $receipt;
}
-
- function update($values)
+ function update( $values )
{
- $values['date'] =
$this->bocommon->date_to_timestamp($values['date']);
+ $values['date'] = $this->bocommon->date_to_timestamp(
$values['date'] );
- return $this->so->update($values);
+ return $this->so->update( $values );
}
- function delete_last_index($agreement_id,$id)
+ function delete_last_index( $agreement_id, $id )
{
- $this->so->delete_last_index($agreement_id,$id);
+ $this->so->delete_last_index( $agreement_id, $id );
}
- function delete_item($agreement_id,$activity_id)
+ function delete_item( $agreement_id, $activity_id )
{
- $this->so->delete_item($agreement_id,$activity_id);
+ $this->so->delete_item( $agreement_id, $activity_id );
}
- function delete($agreement_id='')
+ function delete( $agreement_id = '' )
{
- $this->so->delete($agreement_id);
+ $this->so->delete( $agreement_id );
}
- function column_list($selected='',$allrows='')
+ function column_list( $selected = '', $allrows = '' )
{
- if(!$selected)
+ if ( !$selected )
{
- $selected =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']["agreement_columns"])?$GLOBALS['phpgw_info']['user']['preferences']['property']["agreement_columns"]:'';
+ $selected = isset(
$GLOBALS['phpgw_info']['user']['preferences']['property']["agreement_columns"]
) ?
$GLOBALS['phpgw_info']['user']['preferences']['property']["agreement_columns"]
: '';
}
- $filter = array('list' => ''); // translates to "list
IS NULL"
- $columns = $this->custom->find('property','.agreement',
0, '','','',true, false, $filter);
+ $filter = array('list' => ''); // translates to "list
IS NULL"
+ $columns = $this->custom->find( 'property',
'.agreement', 0, '', '', '',
+ true, false,
$filter );
-
$column_list=$this->bocommon->select_multi_list($selected,$columns);
+ $column_list = $this->bocommon->select_multi_list(
$selected, $columns );
return $column_list;
}
@@ -372,43 +383,44 @@
return $this->so->request_next_id();
}
- function get_agreement_group_list($selected='')
+ function get_agreement_group_list( $selected = '' )
{
- $agreement_groups=
$this->so->get_agreement_group_list();
- return
$this->bocommon->select_list($selected,$agreement_groups);
+ $agreement_groups =
$this->so->get_agreement_group_list();
+ return $this->bocommon->select_list( $selected,
$agreement_groups );
}
- function read_group_activity($group_id='',$agreement_id='')
+ function read_group_activity( $group_id = '', $agreement_id =
'' )
{
- $activity_list =
$this->so->read_group_activity($group_id,$agreement_id);
- $this->uicols = $this->so->uicols;
+ $activity_list = $this->so->read_group_activity(
$group_id, $agreement_id );
+ $this->uicols = $this->so->uicols;
return $activity_list;
}
- function add_activity($values,$agreement_id)
+ function add_activity( $values, $agreement_id )
{
- return $this->so->add_activity($values,$agreement_id);
+ return $this->so->add_activity( $values, $agreement_id
);
}
- function select_status_list($format='',$selected='')
+ function select_status_list( $format = '', $selected = '' )
{
- switch($format)
+ switch ( $format )
{
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
- break;
+ case 'select':
+ $GLOBALS['phpgw']->xslttpl->add_file(
array('status_select') );
+ break;
+ case 'filter':
+ $GLOBALS['phpgw']->xslttpl->add_file(
array('status_filter') );
+ break;
}
- $status_entries= $this->so->select_status_list();
+ $status_entries = $this->so->select_status_list();
- return
$this->bocommon->select_list($selected,$status_entries);
+ return $this->bocommon->select_list( $selected,
$status_entries );
}
- function get_activity_descr($id)
+ function get_activity_descr( $id )
{
- return $this->so->get_activity_descr($id);
+ return $this->so->get_activity_descr( $id );
}
- }
+
+ }
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9959] Property: formatting,
Sigurd Nes <=