[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11428] property: filter controll to locations
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11428] property: filter controll to locations |
Date: |
Mon, 04 Nov 2013 14:16:29 +0000 |
Revision: 11428
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11428
Author: sigurdne
Date: 2013-11-04 14:16:29 +0000 (Mon, 04 Nov 2013)
Log Message:
-----------
property: filter controll to locations
Modified Paths:
--------------
trunk/controller/inc/class.hook_helper.inc.php
trunk/controller/inc/class.socontrol.inc.php
trunk/controller/inc/class.uicalendar.inc.php
trunk/controller/js/controller/ajax.js
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
trunk/controller/templates/base/css/base.css
Modified: trunk/controller/inc/class.hook_helper.inc.php
===================================================================
--- trunk/controller/inc/class.hook_helper.inc.php 2013-11-04 11:41:05 UTC
(rev 11427)
+++ trunk/controller/inc/class.hook_helper.inc.php 2013-11-04 14:16:29 UTC
(rev 11428)
@@ -268,14 +268,25 @@
// $my_planned_controls_HTML .= "<ul
style='overflow:hidden;'>";
- $_row_class = '"on"';
foreach($my_planned_controls as $planned_date_ts =>
$planned_controls_on_date)
{
foreach($planned_controls_on_date as
$my_planned_control)
{
- $my_planned_controls_HTML .= "<tr class
= {$_row_class}>";
- $_row_class = $_row_class = '"on"' ?
'"off"' : '"on"';
+ switch ($_row_class)
+ {
+ case 'on':
+ $_row_class = 'off';
+ break;
+ case 'off':
+ $_row_class = 'on';
+ break;
+ default:
+ $_row_class = 'on';
+ }
+
+ $my_planned_controls_HTML .= "<tr class
= '{$_row_class}'>";
+
$deadline_ts = $my_planned_control[0];
$my_control = $my_planned_control[1];
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2013-11-04 11:41:05 UTC
(rev 11427)
+++ trunk/controller/inc/class.socontrol.inc.php 2013-11-04 14:16:29 UTC
(rev 11428)
@@ -608,7 +608,7 @@
$title = $this->unmarshal($this->db->f('title',
true), 'string');
$location_code =
$this->unmarshal($this->db->f('location_code', true), 'string');
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code,'extra' => array('noattrib' => true)));
$location_arr = explode('-', $location_code);
$loc_name_arr = array();
Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php 2013-11-04 11:41:05 UTC
(rev 11427)
+++ trunk/controller/inc/class.uicalendar.inc.php 2013-11-04 14:16:29 UTC
(rev 11428)
@@ -451,11 +451,27 @@
$control_id = phpgw::get_var('control_id', 'int');
$control = $this->so_control->get_single($control_id);
$year = phpgw::get_var('year', 'int');
+ $location_code = phpgw::get_var('location_code');
+ $locations_list = array();
+
if (is_numeric($control_id) & $control_id > 0)
{
$locations_for_control_array =
$this->so_control->get_locations_for_control($control_id);
$components_for_control_array =
$this->so_control->get_components_for_control($control_id);
+ foreach ($locations_for_control_array as
$location)
+ {
+ $locations_list[] = array
+ (
+ 'id' =>
$location['location_code'],
+ 'name' =>
$location['loc_name'],
+ 'selected' =>
$location_code == $location['location_code'] ? 1 : 0
+ );
+ }
+
+ reset($locations_for_control_array);
+ unset($location);
+
}
// Validates year. If year is not set, current year is
chosen
@@ -469,12 +485,18 @@
$locations_with_calendar_array = array();
+
// LOCATIONS: Process aggregated values for controls
with repeat type day or week
if ($control->get_repeat_type() <=
controller_control::REPEAT_TYPE_WEEK)
{
foreach ($locations_for_control_array as
$location)
{
$curr_location_code =
$location['location_code'];
+
+ if(!$location_code ||
$curr_location_code != $location_code)
+ {
+ continue;
+ }
$cl_criteria = new
controller_check_list();
$cl_criteria->set_control_id($control->get_id());
@@ -523,6 +545,11 @@
{
$curr_location_code =
$location['location_code'];
+ if(!$location_code ||
$curr_location_code != $location_code)
+ {
+ continue;
+ }
+
$repeat_type =
$control->get_repeat_type();
$check_lists_array =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $repeat_type);
@@ -578,12 +605,14 @@
$data = array
(
+ 'locations_list'
=> $locations_list,
'my_locations'
=> $my_locations,
'control'
=> $control->toArray(),
'heading_array'
=> $heading_array,
'locations_with_calendar_array' =>
$locations_with_calendar_array,
'components_with_calendar_array' =>
$components_with_calendar_array,
'current_year'
=> $year,
+ 'location_code'
=> $location_code
);
self::render_template_xsl(array('calendar/view_calendar_year_for_locations',
'calendar/check_list_status_manager',
@@ -599,11 +628,25 @@
$control = $this->so_control->get_single($control_id);
$year = intval(phpgw::get_var('year'));
$month = intval(phpgw::get_var('month'));
+ $location_code = phpgw::get_var('location_code');
if (is_numeric($control_id) & $control_id > 0)
{
$locations_for_control_array =
$this->so_control->get_locations_for_control($control_id);
$components_for_control_array =
$this->so_control->get_components_for_control($control_id);
+ foreach ($locations_for_control_array as
$location)
+ {
+ $locations_list[] = array
+ (
+ 'id' =>
$location['location_code'],
+ 'name' =>
$location['loc_name'],
+ 'selected' =>
$location_code == $location['location_code'] ? 1 : 0
+ );
+ }
+
+ reset($locations_for_control_array);
+ unset($location);
+
}
// Validates year. If year is not set, current year is
chosen
@@ -624,6 +667,11 @@
{
$curr_location_code =
$location['location_code'];
+ if(!$location_code || $curr_location_code !=
$location_code)
+ {
+ continue;
+ }
+
$repeat_type = $control->get_repeat_type();
$check_lists_array =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $control->get_repeat_type());
@@ -655,16 +703,18 @@
$heading_array =
month_calendar::get_heading_array($year, $month);
$data = array
- (
- 'control' => $control->toArray(),
- 'my_locations' => $my_locations,
- 'property_array' => $property_array,
- 'location_array' => $location_array,
- 'heading_array' => $heading_array,
- 'locations_with_calendar_array' =>
$locations_with_calendar_array,
- 'components_with_calendar_array' =>
$components_with_calendar_array,
- 'current_year' => $year,
- 'current_month_nr' => $month,
+ (
+ 'control'
=> $control->toArray(),
+ 'my_locations'
=> $my_locations,
+ 'property_array'
=> $property_array,
+ 'location_array'
=> $location_array,
+ 'heading_array'
=> $heading_array,
+ 'locations_with_calendar_array' =>
$locations_with_calendar_array,
+ 'components_with_calendar_array' =>
$components_with_calendar_array,
+ 'current_year'
=> $year,
+ 'current_month_nr'
=> $month,
+ 'locations_list'
=> $locations_list,
+ 'location_code'
=> $location_code
);
self::render_template_xsl(array('calendar/view_calendar_month_for_locations',
'calendar/check_list_status_manager',
Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js 2013-11-04 11:41:05 UTC (rev
11427)
+++ trunk/controller/js/controller/ajax.js 2013-11-04 14:16:29 UTC (rev
11428)
@@ -574,6 +574,23 @@
window.location.href = requestUrl;
}
+ else if(location_code != "" & period_type ==
'view_year_for_locations')
+ {
+ var control_id =
$(thisForm).find("input[name='control_id']").val();
+ var oArgs =
{menuaction:'controller.uicalendar.view_calendar_year_for_locations'};
+ var baseUrl = phpGWLink('index.php', oArgs, false);
+ var requestUrl = baseUrl + "&location_code=" +
location_code + "&year=" + year + "&control_id=" + control_id;
+ window.location.href = requestUrl;
+ }
+ else if(location_code != "" & period_type ==
'view_month_for_locations')
+ {
+ var control_id =
$(thisForm).find("input[name='control_id']").val();
+ var oArgs =
{menuaction:'controller.uicalendar.view_calendar_month_for_locations'};
+ var baseUrl = phpGWLink('index.php', oArgs, false);
+ var requestUrl = baseUrl + "&location_code=" +
location_code + "&year=" + year + "&control_id=" + control_id;
+ window.location.href = requestUrl;
+ }
+
});
// CALENDAR FILTERS
Modified:
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
===================================================================
---
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
2013-11-04 11:41:05 UTC (rev 11427)
+++
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
2013-11-04 14:16:29 UTC (rev 11428)
@@ -3,12 +3,46 @@
<xsl:variable name="date_format"><xsl:value-of
select="php:function('get_phpgw_info', 'user|preferences|common|dateformat')"
/></xsl:variable>
<xsl:variable name="month_str">month <xsl:value-of select="current_month_nr"/>
capitalized</xsl:variable>
<xsl:variable name="session_url">&<xsl:value-of
select="php:function('get_phpgw_session_url')" /></xsl:variable>
+<xsl:variable name="location_code"><xsl:value-of select="location_code"
/></xsl:variable>
<div id="main_content">
<div id="control_plan">
<div class="top">
<h1>Kontrollplan for <xsl:value-of
select="control/title"/></h1>
<h3>Oversikt for <span class="month"><xsl:value-of
select="php:function('lang', $month_str)" /></span><span
class="year"><xsl:value-of select="current_year"/></span></h3>
+ <div id="choose-my-location" class="select-box">
+ <label>Velg en lokasjon</label>
+ <form action="#">
+ <input type="hidden"
name="period_type" value="view_month_for_locations" />
+ <input type="hidden"
name="year">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="current_year"/>
+ </xsl:attribute>
+ </input>
+ <input type="hidden"
name="control_id">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="//control/id"/>
+ </xsl:attribute>
+ </input>
+ <select id="choose-my-location"
class="select-location">
+ <option>Velg bygg</option>
+ <xsl:for-each
select="locations_list">
+ <option>
+ <xsl:if
test="selected = 1">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute
name="value">
+ <xsl:value-of
select="id"/>
+ </xsl:attribute>
+ <xsl:value-of
select="id"/>
+ <xsl:text> -
</xsl:text>
+ <xsl:value-of
disable-output-escaping="yes" select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </form>
+ </div>
+
</div>
<div class="middle">
<!-- ===================== ICON COLOR MAP
================= -->
Modified:
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
===================================================================
---
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
2013-11-04 11:41:05 UTC (rev 11427)
+++
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
2013-11-04 14:16:29 UTC (rev 11428)
@@ -2,7 +2,9 @@
<xsl:template match="data" xmlns:php="http://php.net/xsl">
<xsl:variable name="date_format"><xsl:value-of
select="php:function('get_phpgw_info', 'user|preferences|common|dateformat')"
/></xsl:variable>
<xsl:variable name="session_url">&<xsl:value-of
select="php:function('get_phpgw_session_url')" /></xsl:variable>
+<xsl:variable name="location_code"><xsl:value-of select="location_code"
/></xsl:variable>
+
<div id="main_content">
<div id="control_plan">
@@ -10,6 +12,39 @@
<h1>Kontrollplan for <xsl:value-of
select="control/title"/></h1>
<h3>Periode: <xsl:value-of select="current_year"/></h3>
+ <div id="choose-my-location" class="select-box">
+ <label>Velg en lokasjon</label>
+ <form action="#">
+ <input type="hidden"
name="period_type" value="view_year_for_locations" />
+ <input type="hidden"
name="year">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="current_year"/>
+ </xsl:attribute>
+ </input>
+ <input type="hidden"
name="control_id">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="//control/id"/>
+ </xsl:attribute>
+ </input>
+ <select id="choose-my-location"
class="select-location">
+ <option>Velg bygg</option>
+ <xsl:for-each
select="locations_list">
+ <option>
+ <xsl:if
test="selected = 1">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute
name="value">
+ <xsl:value-of
select="id"/>
+ </xsl:attribute>
+ <xsl:value-of
select="id"/>
+ <xsl:text> -
</xsl:text>
+ <xsl:value-of
disable-output-escaping="yes" select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </form>
+ </div>
+
</div>
<div class="middle">
@@ -42,6 +77,8 @@
<xsl:number/>
<xsl:text>&control_id=</xsl:text>
<xsl:value-of select="//control/id"/>
+
<xsl:text>&location_code=</xsl:text>
+
<xsl:value-of select="$location_code"/>
<xsl:value-of select="$session_url"/>
</xsl:attribute>
@@ -108,6 +145,8 @@
<xsl:number/>
<xsl:text>&control_id=</xsl:text>
<xsl:value-of select="//control/id"/>
+
<xsl:text>&location_code=</xsl:text>
+
<xsl:value-of select="$location_code"/>
<xsl:value-of select="$session_url"/>
</xsl:attribute>
Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css 2013-11-04 11:41:05 UTC
(rev 11427)
+++ trunk/controller/templates/base/css/base.css 2013-11-04 14:16:29 UTC
(rev 11428)
@@ -1339,7 +1339,6 @@
#calendar .location-name, #calendar .component-type {
width: 150px;
text-align: left;
- white-space: nowrap;
}
#calendar .frequency {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11428] property: filter controll to locations,
Sigurd Nes <=