[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11374] frontend: try to ease the workload to find da
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11374] frontend: try to ease the workload to find data |
Date: |
Tue, 15 Oct 2013 14:29:33 +0000 |
Revision: 11374
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11374
Author: sigurdne
Date: 2013-10-15 14:29:33 +0000 (Tue, 15 Oct 2013)
Log Message:
-----------
frontend: try to ease the workload to find data
Modified Paths:
--------------
trunk/frontend/inc/class.borental.inc.php
trunk/frontend/inc/class.uifrontend.inc.php
trunk/frontend/templates/base/frontend.xsl
Added Paths:
-----------
trunk/frontend/inc/class.sorental.inc.php
Modified: trunk/frontend/inc/class.borental.inc.php
===================================================================
--- trunk/frontend/inc/class.borental.inc.php 2013-10-15 11:04:52 UTC (rev
11373)
+++ trunk/frontend/inc/class.borental.inc.php 2013-10-15 14:29:33 UTC (rev
11374)
@@ -81,6 +81,9 @@
public static function get_property_locations($array)
{
+// _debug_array($array);die();
+ // return self::get_property_locations_lean($array);
+
$property_locations = array();
$property_locations_active = array();
@@ -92,7 +95,8 @@
$location_id_in = array_search('contract_type_innleie', $types);
$location_id_ex = array_search('contract_type_eksternleie',
$types);
- foreach($array as $row){
+ foreach($array as $row)
+ {
/*
* 1. hent alle kontraktsparter som har org unit id (foreløpig
bruker vi result_unit_number i rentalparty)
* 2. hent alle kontrakter på kontraktspartene
@@ -207,7 +211,6 @@
phpgwapi_cache::session_set('frontend',
'rented_area_per_location', $rented_area_per_location);
phpgwapi_cache::session_set('frontend',
'total_price_per_location', $rented_price_per_location);
-
//Serialize the properties
$serialized_properties = array();
foreach($property_locations as $key => $property_location)
@@ -217,7 +220,100 @@
$serialized_properties[] =
$property_location->serialize();
}
}
+
return $serialized_properties;
}
+
+ /**
+ *
+ * @param integer $org_unit_ids
+ */
+ public static function get_property_locations_lean($array)
+ {
+
+ $property_locations = array();
+ $property_locations_active = array();
+
+ $total_price_all_buildings = 0;
+ $total_rented_area_all_builings = 0;
+
+ $types =
rental_socontract::get_instance()->get_fields_of_responsibility();
+ $location_id_internal =
array_search('contract_type_internleie', $types);
+ $location_id_in = array_search('contract_type_innleie', $types);
+ $location_id_ex = array_search('contract_type_eksternleie',
$types);
+
+ foreach($array as $row)
+ {
+ /*
+ * 1. hent alle kontraktsparter som har org unit id (foreløpig
bruker vi result_unit_number i rentalparty)
+ * 2. hent alle kontrakter på kontraktspartene
+ * 3. hent alle leieobjekt på kontraktene
+ * 4. hent ut bygg-ider, location_code, fra leieobjektet
+ */
+ if(is_array($row))
+ {
+ if(!isset($row['ORG_UNIT_ID']) ||
$row['ORG_UNIT_ID'] == '')
+ {
+ continue;
+ }
+ $parties =
rental_soparty::get_instance()->get(null, null, null, null, null, null,
array('org_unit_id' => $row['ORG_UNIT_ID']));
+ }
+ else
+ {
+ $parties =
rental_soparty::get_instance()->get(null, null, null, null, null, null,
array('email' => $row));
+ }
+
+ $contracts = array();
+ $composites = array();
+
+ $soparty = CreateObject('frontend.sorental');
+
+
+ //For all parties connected to the internal
organization unit
+ foreach($parties as $party_id => $party)
+ {
+ $locations =
$soparty->get_location($party_id);
+
+
+ }
+ }
+
+ // contracts -> composite -> units -> location_code
+
+
+
+_debug_array(count($parties));die();
+
+ /*
+ Array
+(
+ [0] => Array
+ (
+ [loc1_name] => DIVERSE SKOLER
+ [loc2_name] => DIVERSE SKOLE
+ [location_code] => 2000-01
+ [address] =>
+ [area_net] => 0
+ [area_gros] => 0
+ )
+
+ [1] => Array
+ (
+ [loc1_name] => BERGEN RÅDHUS
+ [loc2_name] => BERGEN RÅDHUS NYE
+ [location_code] => 1102-01
+ [address] => Rådhusgaten 10
+ [area_net] => 0
+ [area_gros] => 11277
+ )
+
+)
+
+ */
+
+
+
+ }
+
}
Added: trunk/frontend/inc/class.sorental.inc.php
===================================================================
--- trunk/frontend/inc/class.sorental.inc.php (rev 0)
+++ trunk/frontend/inc/class.sorental.inc.php 2013-10-15 14:29:33 UTC (rev
11374)
@@ -0,0 +1,139 @@
+<?php
+ /**
+ * Common so-functions, database related helpers
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2012 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 core
+ * @version $Id: class.socommon_core.inc.php 11370 2013-10-11 15:29:50Z
sigurdne $
+ */
+
+ /*
+ This program is free software: you can redistribute it and/or
modify
+ it under the terms of the GNU Lesser General Public License as
published by
+ the Free Software Foundation, either version 2 of the License,
or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public
License
+ along with this program. If not, see
<http://www.gnu.org/licenses/>.
+ */
+
+
+
+
+ /**
+ * Description
+ * @package frontend
+ */
+
+ class frontend_sorental
+ {
+ /**
+ * @var int $_total_records total number of records found
+ */
+ protected $_total_records = 0;
+
+
+ /**
+ * @var int $_receipt feedback on actions
+ */
+ protected $_receipt = array();
+
+
+ /**
+ * @var object $_db reference to the global database object
+ */
+ protected $_db;
+
+ /**
+ * @var string $_join SQL JOIN statement
+ */
+ protected $_join;
+
+ /**
+ * @var string $_join SQL LEFT JOIN statement
+ */
+ protected $_left_join;
+
+ /**
+ * @var string $_like SQL LIKE statement
+ */
+ protected $_like;
+
+ protected $_global_lock = false;
+
+ public function __construct()
+ {
+ $this->account =
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->_db = &
$GLOBALS['phpgw']->db;
+ $this->_join = & $this->_db->join;
+ $this->_like = & $this->_db->like;
+ $this->_left_join = & $this->_db->left_join;
+ }
+
+ /**
+ * Magic get method
+ *
+ * @param string $varname the variable to fetch
+ *
+ * @return mixed the value of the variable sought - null if not
found
+ */
+ public function __get($varname)
+ {
+ switch ($varname)
+ {
+ case 'total_records':
+ return $this->_total_records;
+ break;
+ case 'receipt':
+ return $this->_receipt;
+ break;
+ default:
+ return null;
+ }
+ }
+
+ public function get_location($party_id)
+ {
+ $party_id = (int) $party_id;
+
+ _debug_array($party_id);
+
+ //FIXME something clever
+ $sql = "SELECT * FROM somewhere WHERE id={$party_id}";
+
+ $this->_db->query($sql,__LINE__,__FILE__);
+
+ $values = array();
+ while ($this->_db->next_record())
+ {
+ $values = array
+ (
+ 'location_code' =>
$this->_db->f('location_code', true),
+ );
+ }
+
+/*
+ [loc1_name] => BERGEN RÅDHUS
+ [loc2_name] => BERGEN RÅDHUS NYE
+ [location_code] => 1102-01
+ [address] => Rådhusgaten 10
+ [area_net] => 0
+ [area_gros] => 11277
+*/
+
+
+ return $values;
+
+ }
+
+
+
+ }
Modified: trunk/frontend/inc/class.uifrontend.inc.php
===================================================================
--- trunk/frontend/inc/class.uifrontend.inc.php 2013-10-15 11:04:52 UTC (rev
11373)
+++ trunk/frontend/inc/class.uifrontend.inc.php 2013-10-15 14:29:33 UTC (rev
11374)
@@ -88,7 +88,7 @@
$property_locations_update = false;
/* If the user has selected an organisational unit or
all units */
- if(isset($param_selected_org_unit))
+ if(isset($param_selected_org_unit) &&
$param_selected_org_unit)
{
//Specify which unit(s)
if($param_selected_org_unit == 'all')
@@ -123,7 +123,7 @@
}
/* If the user selects a organisational unit in rental
module */
- else if(isset($param_only_org_unit))
+ else if(isset($param_only_org_unit) &&
$param_only_org_unit)
{
//TODO: check permissions
if($use_fellesdata){
@@ -176,7 +176,8 @@
$this->header_state['selected_org_unit'] = 'all';
//Update locations
- $property_locations =
frontend_borental::get_property_locations($org_units);
+ //FIXME Sigurd 15. okt 2013: deselect
'all' on initial view
+ //$property_locations =
frontend_borental::get_property_locations($org_units);
}
else
{
Modified: trunk/frontend/templates/base/frontend.xsl
===================================================================
--- trunk/frontend/templates/base/frontend.xsl 2013-10-15 11:04:52 UTC (rev
11373)
+++ trunk/frontend/templates/base/frontend.xsl 2013-10-15 14:29:33 UTC (rev
11374)
@@ -45,14 +45,16 @@
<select
size="3" onchange="this.form.submit()" name="org_unit_id">
<xsl:choose>
<xsl:when test="selected_org_unit = 'all'">
-
<option value="all" selected="selected"><xsl:value-of
select="php:function('lang', 'all_organisational_units')"/></option>
+
<!-- <option value="all" selected="selected"><xsl:value-of
select="php:function('lang', 'all_organisational_units')"/></option> -->
+
<option value="" selected="selected"><xsl:value-of
select="php:function('lang', 'select')"/></option>
<xsl:for-each select="org_unit">
<xsl:sort select="ORG_NAME"/>
<option value="{ORG_UNIT_ID}"><xsl:value-of
select="ORG_NAME"/></option>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
-
<option value="all"><xsl:value-of select="php:function('lang',
'all_organisational_units')"/></option>
+ <!--
<option value="all"><xsl:value-of select="php:function('lang',
'all_organisational_units')"/></option> -->
+
<option value=""><xsl:value-of select="php:function('lang',
'select')"/></option>
<xsl:for-each select="org_unit">
<xsl:sort select="ORG_NAME"/>
<xsl:choose>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11374] frontend: try to ease the workload to find data,
Sigurd Nes <=