[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10721] Calendar view when no location is selected
From: |
Torstein |
Subject: |
[Fmsystem-commits] [10721] Calendar view when no location is selected |
Date: |
Tue, 29 Jan 2013 09:51:33 +0000 |
Revision: 10721
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10721
Author: vator
Date: 2013-01-29 09:51:33 +0000 (Tue, 29 Jan 2013)
Log Message:
-----------
Calendar view when no location is selected
Modified Paths:
--------------
trunk/controller/inc/class.uicalendar.inc.php
trunk/controller/templates/base/calendar/calendar_month_no_loc.xsl
trunk/controller/templates/base/calendar/calendar_year_no_loc.xsl
trunk/controller/templates/base/calendar/view_calendar_month.xsl
trunk/controller/templates/base/calendar/view_calendar_year.xsl
trunk/controller/templates/base/css/base.css
Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php 2013-01-29 09:35:43 UTC
(rev 10720)
+++ trunk/controller/inc/class.uicalendar.inc.php 2013-01-29 09:51:33 UTC
(rev 10721)
@@ -1,41 +1,41 @@
<?php
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
/**
- * Import the jQuery class
- */
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage controller
+ * @version $Id$
+ */
+ /**
+ * Import the jQuery class
+ */
phpgw::import_class('phpgwapi.jquery');
phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('controller.socheck_list');
-
+
include_class('controller', 'check_list', 'inc/model/');
include_class('controller', 'check_item', 'inc/model/');
include_class('controller', 'component', 'inc/model/');
@@ -45,9 +45,10 @@
include_class('controller', 'year_calendar', 'inc/component/');
include_class('controller', 'year_calendar_agg', 'inc/component/');
include_class('controller', 'month_calendar', 'inc/component/');
-
+
class controller_uicalendar extends phpgwapi_uicommon
{
+
private $so;
private $so_control;
private $so_control_group;
@@ -55,37 +56,36 @@
private $so_control_item;
private $so_check_list;
private $so_check_item;
-
public $public_functions = array
- (
- 'view_calendar_for_month'
=> true,
- 'view_calendar_for_year'
=> true,
- 'view_calendar_year_for_locations' => true,
- 'view_calendar_month_for_locations' => true
+ (
+ 'view_calendar_for_month' => true,
+ 'view_calendar_for_year' => true,
+ 'view_calendar_year_for_locations' => true,
+ 'view_calendar_month_for_locations' => true
);
public function __construct()
{
parent::__construct();
-
- $read = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_READ, 'controller'); //1
- $add = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_ADD, 'controller'); //2
- $edit = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_EDIT, 'controller'); //4
- $delete = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_DELETE, 'controller'); //8
-
- $manage = $GLOBALS['phpgw']->acl->check('.control',
16, 'controller'); //16
-
- $this->so
= CreateObject('controller.socheck_list');
- $this->so_control
= CreateObject('controller.socontrol');
- $this->so_control_group =
CreateObject('controller.socontrol_group');
- $this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
- $this->so_control_item =
CreateObject('controller.socontrol_item');
- $this->so_check_list
= CreateObject('controller.socheck_list');
- $this->so_check_item
= CreateObject('controller.socheck_item');
-
+
+ $read = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_READ, 'controller'); //1
+ $add = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_ADD, 'controller'); //2
+ $edit = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_EDIT, 'controller'); //4
+ $delete = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_DELETE, 'controller'); //8
+
+ $manage = $GLOBALS['phpgw']->acl->check('.control', 16,
'controller'); //16
+
+ $this->so = CreateObject('controller.socheck_list');
+ $this->so_control =
CreateObject('controller.socontrol');
+ $this->so_control_group =
CreateObject('controller.socontrol_group');
+ $this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
+ $this->so_control_item =
CreateObject('controller.socontrol_item');
+ $this->so_check_list =
CreateObject('controller.socheck_list');
+ $this->so_check_item =
CreateObject('controller.socheck_item');
+
self::set_active_menu('controller::location_check_list');
}
-
+
public function view_calendar_for_month()
{
$location_code = phpgw::get_var('location_code');
@@ -93,156 +93,170 @@
$month = phpgw::get_var('month');
$role = phpgw::get_var('role');
$repeat_type = phpgw::get_var('repeat_type');
-
+
// Validates year. If year is not set, current year is
chosen
$year = $this->validate_year($year);
-
+
// Validates month. If year is not set, current month
in current year is chosen
$month = $this->validate_month($month);
-
- // Validates year.
+
+ // Validates year.
$repeat_type =
$this->validate_repeat_type($repeat_type);
-
- // Validates role.
+
+ // Validates role.
$role = $this->validate_role($role);
-
+
// Gets timestamp value of first day in month
- $from_date_ts =
month_calendar::get_start_date_month_ts($year, intval( $month ));
+ $from_date_ts =
month_calendar::get_start_date_month_ts($year, intval($month));
// Gets timestamp value of first day in month
- $to_date_ts =
month_calendar::get_next_start_date_month_ts($year, intval( $month ));
+ $to_date_ts =
month_calendar::get_next_start_date_month_ts($year, intval($month));
// Validates location_code. If not set, first location
among assigned locations
$location_code =
$this->validate_location_code($location_code);
-
- $level = $this->get_location_level($location_code);
-
- $user_role = true;
- // Fetches buildings on property
- $buildings_on_property = $this->get_buildings_on_property($user_role,
$location_code, $level);
-
- // Fetches controls for location within specified time
period
- $controls_for_location_array =
$this->so_control->get_controls_by_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role );
-
- if($level == 1){
- // Fetches all controls for the components for
a location within time period
- $filter = "bim_item.location_code =
'$location_code' ";
- $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
- }else
+ if ($location_code != null && $location_code = "")
{
- // Fetches all controls for the components for
a location within time period
- $filter = "bim_item.location_code LIKE
'$location_code%' ";
- $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
- }
-
- // Fetches all control ids with check lists for
specified time period
- $control_id_with_check_list_array =
$this->so->get_check_lists_for_location($location_code, $from_date_ts,
$to_date_ts);
-
- // Loops through all controls for location and
populates controls with check lists
- $controls_with_check_list_array =
$this->populate_controls_with_check_lists($controls_for_location_array,
$control_id_with_check_list_array);
-
- $controls_calendar_array = array();
- foreach($controls_with_check_list_array as $control)
- {
- $month_calendar = new month_calendar($control,
$year, $month, null, $location_code, "location");
- $calendar_array =
$month_calendar->build_calendar( $control->get_check_lists_array() );
+ $level =
$this->get_location_level($location_code);
- $controls_calendar_array[] = array("control" =>
$control->toArray(), "calendar_array" => $calendar_array);
- }
-
- // COMPONENTS
- foreach($components_with_controls_array as $component)
- {
- $location_id = $component->get_location_id();
- $component_id = $component->get_id();
-
- $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
- $component->set_xml_short_desc( $short_desc );
-
- $controls_for_component_array =
$component->get_controls_array();
- $controls_components_calendar_array = array();
-
- foreach($controls_for_component_array as $control)
- {
- // Fetches control ids with check lists for
specified time period
- $control_id_with_check_list_array =
$this->so->get_check_lists_for_component($component->get_location_id(),
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=0");
+ $user_role = true;
- // Loops through all controls for
location and populates controls with check lists
- $controls_for_component_array =
$this->populate_controls_with_check_lists($controls_for_component_array,
$control_id_with_check_list_array);
-
- $month_calendar = new month_calendar(
$control, $year, $month, $component, null, "component" );
- $calendar_array =
$month_calendar->build_calendar( $control->get_check_lists_array() );
-
- $controls_components_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
- }
-
- $components_calendar_array[] = array("component" =>
$component->toArray(), "controls_calendar" =>
$controls_components_calendar_array);
- }
-
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
-
- $property_array =
execMethod('property.solocation.read', array('type_id' => 1, 'allrows' =>
true));
-
- // Gets array of locations assigned to current user
- $my_locations =
$this->get_my_assigned_locations($location_code);
-
- $heading_array =
month_calendar::get_heading_array($year, $month);
-
- $roles_array = $this->so_control->get_roles();
-
- $repeat_type_array = array(
-
array('id' => "0", 'value' => "Dag"),
-
array('id' => "1", 'value' => "Uke"),
-
array('id' => "2", 'value' => "Måned"),
-
array('id' => "3", 'value' => "År")
- );
-
- $data = array
- (
- 'buildings_on_property' =>
$buildings_on_property,
- 'my_locations'
=> $my_locations,
- 'property_array'
=> $property_array,
- 'current_location'
=> $location_array,
- 'heading_array'
=> $heading_array,
- 'controls_calendar_array' =>
$controls_calendar_array,
- 'components_calendar_array' =>
$components_calendar_array,
- 'location_level'
=> $level,
- 'roles_array'
=> $roles_array,
- 'repeat_type_array'
=> $repeat_type_array,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month,
- 'current_role'
=> $role,
- 'current_repeat_type' =>
$repeat_type
- );
-
+ // Fetches buildings on property
+ $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
- phpgwapi_jquery::load_widget('autocomplete');
+ // Fetches controls for location within
specified time period
+ $controls_for_location_array =
$this->so_control->get_controls_by_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role);
- self::add_javascript('controller', 'controller',
'ajax.js');
-
-
self::render_template_xsl(array('calendar/view_calendar_month',
'calendar/check_list_status_manager',
-
'calendar/icon_color_map', 'calendar/select_my_locations',
+ if ($level == 1)
+ {
+ // Fetches all controls for the
components for a location within time period
+ $filter = "bim_item.location_code =
'$location_code' ";
+ $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
+ }
+ else
+ {
+ // Fetches all controls for the
components for a location within time period
+ $filter = "bim_item.location_code LIKE
'$location_code%' ";
+ $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
+ }
+
+ // Fetches all control ids with check lists for
specified time period
+ $control_id_with_check_list_array =
$this->so->get_check_lists_for_location($location_code, $from_date_ts,
$to_date_ts);
+
+ // Loops through all controls for location and
populates controls with check lists
+ $controls_with_check_list_array =
$this->populate_controls_with_check_lists($controls_for_location_array,
$control_id_with_check_list_array);
+
+ $controls_calendar_array = array();
+ foreach ($controls_with_check_list_array as
$control)
+ {
+ $month_calendar = new
month_calendar($control, $year, $month, null, $location_code, "location");
+ $calendar_array =
$month_calendar->build_calendar($control->get_check_lists_array());
+
+ $controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
+ }
+
+ // COMPONENTS
+ foreach ($components_with_controls_array as
$component)
+ {
+ $location_id =
$component->get_location_id();
+ $component_id = $component->get_id();
+
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+
$component->set_xml_short_desc($short_desc);
+
+ $controls_for_component_array =
$component->get_controls_array();
+ $controls_components_calendar_array =
array();
+
+ foreach ($controls_for_component_array
as $control)
+ {
+ // Fetches control ids with
check lists for specified time period
+
$control_id_with_check_list_array =
$this->so->get_check_lists_for_component($component->get_location_id(),
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=0");
+
+ // Loops through all controls
for location and populates controls with check lists
+ $controls_for_component_array =
$this->populate_controls_with_check_lists($controls_for_component_array,
$control_id_with_check_list_array);
+
+ $month_calendar = new
month_calendar($control, $year, $month, $component, null, "component");
+ $calendar_array =
$month_calendar->build_calendar($control->get_check_lists_array());
+
+
$controls_components_calendar_array[] = array("control" => $control->toArray(),
"calendar_array" => $calendar_array);
+ }
+
+ $components_calendar_array[] =
array("component" => $component->toArray(), "controls_calendar" =>
$controls_components_calendar_array);
+ }
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ $property_array =
execMethod('property.solocation.read', array('type_id' => 1, 'allrows' =>
true));
+
+ // Gets array of locations assigned to current
user
+ $my_locations =
$this->get_my_assigned_locations($location_code);
+
+ $heading_array =
month_calendar::get_heading_array($year, $month);
+
+ $roles_array = $this->so_control->get_roles();
+
+ $repeat_type_array = array(
+ array('id' => "0", 'value' => "Dag"),
+ array('id' => "1", 'value' => "Uke"),
+ array('id' => "2", 'value' => "Måned"),
+ array('id' => "3", 'value' => "År")
+ );
+
+ $data = array
+ (
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'my_locations' => $my_locations,
+ 'property_array' => $property_array,
+ 'current_location' => $location_array,
+ 'heading_array' => $heading_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'components_calendar_array' =>
$components_calendar_array,
+ 'location_level' => $level,
+ 'roles_array' => $roles_array,
+ 'repeat_type_array' =>
$repeat_type_array,
+ 'current_year' => $year,
+ 'current_month_nr' => $month,
+ 'current_role' => $role,
+ 'current_repeat_type' => $repeat_type
+ );
+
+ phpgwapi_jquery::load_widget('autocomplete');
+ self::add_javascript('controller',
'controller', 'ajax.js');
+
self::render_template_xsl(array('calendar/view_calendar_month',
'calendar/check_list_status_manager',
+
'calendar/icon_color_map', 'calendar/select_my_locations',
'calendar/select_buildings_on_property', 'calendar/nav_calendar_month',
'calendar/calendar_filters'), $data);
+ }
+ else
+ {
+ $data = array(
+ 'current_year' => $year,
+ 'current_month_nr' => $month
+ );
+
+ phpgwapi_jquery::load_widget('autocomplete');
+ self::add_javascript('controller',
'controller', 'ajax.js');
+
+
self::render_template_xsl('calendar/calendar_month_no_loc', $data);
+ }
}
-
+
public function view_calendar_for_year()
{
$location_code = phpgw::get_var('location_code');
$year = phpgw::get_var('year');
$role = phpgw::get_var('role');
$repeat_type = phpgw::get_var('repeat_type');
-
+
// Validates year. If year is not set, current year is
chosen
$year = $this->validate_year($year);
- // Validates repeat type.
+ // Validates repeat type.
$repeat_type =
$this->validate_repeat_type($repeat_type);
-
- // Validates role.
+
+ // Validates role.
$role = $this->validate_role($role);
-
+
// Gets timestamp of first day in year
$from_date_ts = $this->get_start_date_year_ts($year);
@@ -251,162 +265,177 @@
// Array that will be populated with controls and
calendar objects that will be sent to view
$controls_calendar_array = array();
-
- // Validates location_code. If not set, first location among assigned
locations
+
+ // Validates location_code. If not set, first location
among assigned locations
$location_code =
$this->validate_location_code($location_code);
-
- $level = $this->get_location_level($location_code);
-
- $user_role = true;
- // Fetches buildings on property
- $buildings_on_property = $this->get_buildings_on_property($user_role,
$location_code, $level);
-
- // Fetches all controls for the location within time
period
- $controls_for_location_array =
$this->so_control->get_controls_by_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role);
-
- if($level == 1){
- // Fetches all controls for the components for
a location within time period
- $filter = "bim_item.location_code =
'$location_code' ";
- $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
- }else
+ if ($location_code != null && $location_code != "")
{
- // Fetches all controls for the components for
a location within time period
- $filter = "bim_item.location_code LIKE
'$location_code%' ";
- $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
- }
-
- // Loops through controls with repeat type day or week
- // and populates array that contains aggregated open
cases pr month.
- foreach($controls_for_location_array as $control)
- {
- if($control->get_repeat_type() ==
controller_control::REPEAT_TYPE_DAY | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_WEEK)
+ $level =
$this->get_location_level($location_code);
+
+ $user_role = true;
+
+ // Fetches buildings on property
+ $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
+
+ // Fetches all controls for the location within
time period
+ $controls_for_location_array =
$this->so_control->get_controls_by_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role);
+
+ if ($level == 1)
{
- $cl_criteria = new
controller_check_list();
-
$cl_criteria->set_control_id($control->get_id());
-
$cl_criteria->set_location_code($location_code);
-
- $from_month =
$this->get_start_month_for_control($control);
- $to_month =
$this->get_end_month_for_control($control);
-
- // Loops through controls and populates
aggregate open cases pr month array.
- $agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
-
- $year_calendar_agg = new
year_calendar_agg($control, $year, $location_code,
"VIEW_CONTROLS_FOR_LOCATION");
- $calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
-
- $controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
+ // Fetches all controls for the
components for a location within time period
+ $filter = "bim_item.location_code =
'$location_code' ";
+ $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
}
- }
-
- $repeat_type_expr = ">=2";
- // Fetches control ids with check lists for specified
time period
- $control_id_with_check_list_array =
$this->so->get_check_lists_for_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type_expr);
-
- // Loops through all controls for location and
populates controls with check lists
- $controls_for_location_array =
$this->populate_controls_with_check_lists($controls_for_location_array,
$control_id_with_check_list_array);
-
- foreach($controls_for_location_array as $control)
- {
- if($control->get_repeat_type() ==
controller_control::REPEAT_TYPE_MONTH | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_YEAR)
+ else
{
- $year_calendar = new
year_calendar($control, $year, null, $location_code, "location" );
- $calendar_array =
$year_calendar->build_calendar( $control->get_check_lists_array() );
-
- $controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
+ // Fetches all controls for the
components for a location within time period
+ $filter = "bim_item.location_code LIKE
'$location_code%' ";
+ $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
}
- }
-
- // COMPONENTS
- foreach($components_with_controls_array as $component)
- {
- $location_id = $component->get_location_id();
- $id = $component->get_id();
-
- $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $id));
- $component->set_xml_short_desc( $short_desc_arr );
-
- $controls_for_component_array =
$component->get_controls_array();
- $controls_components_calendar_array = array();
- // AGGREGATED VALUES PR MONTH: Puts aggregated
number of open cases for days and weeks in calendar array
- foreach($controls_for_component_array as $control)
- {
- if($control->get_repeat_type() ==
controller_control::REPEAT_TYPE_DAY | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_WEEK)
- {
- $cl_criteria = new
controller_check_list();
- $cl_criteria->set_control_id(
$control->get_id() );
- $cl_criteria->set_component_id(
$component->get_id() );
- $cl_criteria->set_location_id(
$component->get_location_id() );
-
- $from_month =
$this->get_start_month_for_control($control);
+ // Loops through controls with repeat type day
or week
+ // and populates array that contains aggregated
open cases pr month.
+ foreach ($controls_for_location_array as
$control)
+ {
+ if ($control->get_repeat_type() ==
controller_control::REPEAT_TYPE_DAY | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_WEEK)
+ {
+ $cl_criteria = new
controller_check_list();
+
$cl_criteria->set_control_id($control->get_id());
+
$cl_criteria->set_location_code($location_code);
+
+ $from_month =
$this->get_start_month_for_control($control);
$to_month =
$this->get_end_month_for_control($control);
-
- $agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
-
- $year_calendar_agg = new
year_calendar_agg( $control, $year, $location_code,
"VIEW_CONTROLS_FOR_LOCATION");
- $calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
- $controls_components_calendar_array[]
= array("control" => $control->toArray(), "calendar_array" => $calendar_array);
- }
- else
- {
- // Fetches control ids with check lists for
specified time period
-
$control_id_with_check_list_array =
$this->so->get_check_lists_for_component($component->get_location_id(),
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=2");
+ // Loops through controls and
populates aggregate open cases pr month array.
+ $agg_open_cases_pr_month_array
= $this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
- // Loops through all controls
for location and populates controls with check lists
- $controls_for_component_array =
$this->populate_controls_with_check_lists($controls_for_component_array,
$control_id_with_check_list_array);
+ $year_calendar_agg = new
year_calendar_agg($control, $year, $location_code,
"VIEW_CONTROLS_FOR_LOCATION");
+ $calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
- $year_calendar = new
year_calendar( $control, $year, $component, null, "component" );
- $calendar_array =
$year_calendar->build_calendar( $control->get_check_lists_array() );
-
-
$controls_components_calendar_array[] = array("control" => $control->toArray(),
"calendar_array" => $calendar_array);
- }
- }
-
- $components_calendar_array[] = array("component" =>
$component->toArray(), "controls_calendar" =>
$controls_components_calendar_array);
+ $controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
+ }
+ }
+
+ $repeat_type_expr = ">=2";
+ // Fetches control ids with check lists for
specified time period
+ $control_id_with_check_list_array =
$this->so->get_check_lists_for_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type_expr);
+
+ // Loops through all controls for location and
populates controls with check lists
+ $controls_for_location_array =
$this->populate_controls_with_check_lists($controls_for_location_array,
$control_id_with_check_list_array);
+
+ foreach ($controls_for_location_array as
$control)
+ {
+ if ($control->get_repeat_type() ==
controller_control::REPEAT_TYPE_MONTH | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_YEAR)
+ {
+ $year_calendar = new
year_calendar($control, $year, null, $location_code, "location");
+ $calendar_array =
$year_calendar->build_calendar($control->get_check_lists_array());
+
+ $controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
+ }
+ }
+
+ // COMPONENTS
+ foreach ($components_with_controls_array as
$component)
+ {
+ $location_id =
$component->get_location_id();
+ $id = $component->get_id();
+
+ $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $id));
+
$component->set_xml_short_desc($short_desc_arr);
+
+ $controls_for_component_array =
$component->get_controls_array();
+ $controls_components_calendar_array =
array();
+
+ // AGGREGATED VALUES PR MONTH: Puts
aggregated number of open cases for days and weeks in calendar array
+ foreach ($controls_for_component_array
as $control)
+ {
+ if ($control->get_repeat_type()
== controller_control::REPEAT_TYPE_DAY | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_WEEK)
+ {
+ $cl_criteria = new
controller_check_list();
+
$cl_criteria->set_control_id($control->get_id());
+
$cl_criteria->set_component_id($component->get_id());
+
$cl_criteria->set_location_id($component->get_location_id());
+
+ $from_month =
$this->get_start_month_for_control($control);
+ $to_month =
$this->get_end_month_for_control($control);
+
+
$agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
+
+ $year_calendar_agg =
new year_calendar_agg($control, $year, $location_code,
"VIEW_CONTROLS_FOR_LOCATION");
+ $calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
+
+
$controls_components_calendar_array[] = array("control" => $control->toArray(),
"calendar_array" => $calendar_array);
+ }
+ else
+ {
+ // Fetches control ids
with check lists for specified time period
+
$control_id_with_check_list_array =
$this->so->get_check_lists_for_component($component->get_location_id(),
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=2");
+
+ // Loops through all
controls for location and populates controls with check lists
+
$controls_for_component_array =
$this->populate_controls_with_check_lists($controls_for_component_array,
$control_id_with_check_list_array);
+
+ $year_calendar = new
year_calendar($control, $year, $component, null, "component");
+ $calendar_array =
$year_calendar->build_calendar($control->get_check_lists_array());
+
+
$controls_components_calendar_array[] = array("control" => $control->toArray(),
"calendar_array" => $calendar_array);
+ }
+ }
+
+ $components_calendar_array[] =
array("component" => $component->toArray(), "controls_calendar" =>
$controls_components_calendar_array);
+ }
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ // Gets array of locations assigned to current
user
+ $my_locations =
$this->get_my_assigned_locations($location_code);
+
+ $heading_array =
year_calendar::get_heading_array();
+
+ $roles_array = $this->so_control->get_roles();
+
+ $repeat_type_array = array(
+ array('id' => "0", 'value' => "Dag"),
+ array('id' => "1", 'value' => "Uke"),
+ array('id' => "2", 'value' => "Måned"),
+ array('id' => "3", 'value' => "År")
+ );
+
+ $data = array
+ (
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'my_locations' => $my_locations,
+ 'current_location' => $location_array,
+ 'heading_array' => $heading_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'components_calendar_array' =>
$components_calendar_array,
+ 'location_level' => $level,
+ 'roles_array' => $roles_array,
+ 'repeat_type_array' =>
$repeat_type_array,
+ 'current_year' => $year,
+ 'current_role' => $role,
+ 'current_repeat_type' => $repeat_type
+ );
+
+ phpgwapi_jquery::load_widget('autocomplete');
+ self::add_javascript('controller',
'controller', 'ajax.js');
+
+
self::render_template_xsl(array('calendar/view_calendar_year',
'calendar/check_list_status_manager',
+ 'calendar/icon_color_map',
'calendar/select_my_locations',
+
'calendar/select_buildings_on_property', 'calendar/nav_calendar_year',
+ 'calendar/calendar_filters'), $data);
}
-
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ else
+ {
+ $data = array(
+ 'current_year' => $year
+ );
- // Gets array of locations assigned to current user
- $my_locations =
$this->get_my_assigned_locations($location_code);
-
- $heading_array = year_calendar::get_heading_array();
-
- $roles_array = $this->so_control->get_roles();
-
- $repeat_type_array = array(
-
array('id' => "0", 'value' => "Dag"),
-
array('id' => "1", 'value' => "Uke"),
-
array('id' => "2", 'value' => "Måned"),
-
array('id' => "3", 'value' => "År")
- );
-
- $data = array
- (
- 'buildings_on_property' =>
$buildings_on_property,
- 'my_locations'
=> $my_locations,
- 'current_location' =>
$location_array,
- 'heading_array'
=> $heading_array,
- 'controls_calendar_array' =>
$controls_calendar_array,
- 'components_calendar_array' =>
$components_calendar_array,
- 'location_level'
=> $level,
- 'roles_array'
=> $roles_array,
- 'repeat_type_array'
=> $repeat_type_array,
- 'current_year'
=> $year,
- 'current_role'
=> $role,
- 'current_repeat_type' =>
$repeat_type
- );
-
-
self::render_template_xsl(array('calendar/view_calendar_year',
'calendar/check_list_status_manager',
-
'calendar/icon_color_map', 'calendar/select_my_locations',
-
'calendar/select_buildings_on_property', 'calendar/nav_calendar_year',
-
'calendar/calendar_filters'), $data);
-
- phpgwapi_jquery::load_widget('autocomplete');
+ phpgwapi_jquery::load_widget('autocomplete');
+ self::add_javascript('controller',
'controller', 'ajax.js');
- self::add_javascript('controller', 'controller',
'ajax.js');
+
self::render_template_xsl('calendar/calendar_year_no_loc', $data);
+ }
}
public function view_calendar_year_for_locations()
@@ -414,136 +443,136 @@
$control_id = phpgw::get_var('control_id');
$control = $this->so_control->get_single($control_id);
$year = phpgw::get_var('year');
-
- if(is_numeric($control_id) & $control_id > 0)
+
+ 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);
}
-
+
// Validates year. If year is not set, current year is
chosen
$year = $this->validate_year($year);
-
+
// Gets timestamp of first day in year
$from_date_ts = $this->get_start_date_year_ts($year);
// Gets timestamp of first day in next year
$to_date_ts = $this->get_end_date_year_ts($year);
-
+
$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 )
+
+ // 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)
+ foreach ($locations_for_control_array as
$location)
{
$curr_location_code =
$location['location_code'];
-
+
$cl_criteria = new
controller_check_list();
- $cl_criteria->set_control_id(
$control->get_id() );
- $cl_criteria->set_location_code(
$curr_location_code );
-
+
$cl_criteria->set_control_id($control->get_id());
+
$cl_criteria->set_location_code($curr_location_code);
+
$from_month =
$this->get_start_month_for_control($control);
$to_month =
$this->get_end_month_for_control($control);
-
+
// Loops through controls in
controls_for_location_array and populates aggregate open cases pr month array.
$agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
-
+
$year_calendar_agg = new
year_calendar_agg($control, $year, $curr_location_code,
"VIEW_LOCATIONS_FOR_CONTROL");
$calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
- $locations_with_calendar_array[] =
array( "location" => $location, "calendar_array" => $calendar_array );
+ $locations_with_calendar_array[] =
array("location" => $location, "calendar_array" => $calendar_array);
}
// COMPONENTS: Process aggregated values for
controls with repeat type day or week
- foreach( $components_for_control_array as $component )
- {
- $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component->get_location_id(), 'id' => $component->get_id()));
- $component->set_xml_short_desc( $short_desc_arr );
-
+ foreach ($components_for_control_array as
$component)
+ {
+ $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component->get_location_id(), 'id' => $component->get_id()));
+
$component->set_xml_short_desc($short_desc_arr);
+
$repeat_type =
$control->get_repeat_type();
$component_with_check_lists =
$this->so->get_check_lists_for_control_and_component($control_id,
$component->get_location_id(), $component->get_id(), $from_date_ts,
$to_date_ts, $repeat_type);
-
+
$cl_criteria = new
controller_check_list();
- $cl_criteria->set_control_id(
$control->get_id() );
- $cl_criteria->set_component_id(
$component->get_id());
- $cl_criteria->set_location_id(
$component->get_location_id() );
-
- $from_month =
$this->get_start_month_for_control($control);
+
$cl_criteria->set_control_id($control->get_id());
+
$cl_criteria->set_component_id($component->get_id());
+
$cl_criteria->set_location_id($component->get_location_id());
+
+ $from_month =
$this->get_start_month_for_control($control);
$to_month =
$this->get_end_month_for_control($control);
-
+
// Loops through controls in
controls_for_location_array and populates aggregate open cases pr month array.
$agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
-
- $year_calendar_agg = new
year_calendar_agg( $control, $year, $location_code,
"VIEW_LOCATIONS_FOR_CONTROL" );
+
+ $year_calendar_agg = new
year_calendar_agg($control, $year, $location_code,
"VIEW_LOCATIONS_FOR_CONTROL");
$calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
$components_with_calendar_array[] =
array("component" => $component->toArray(), "calendar_array" =>
$calendar_array);
}
}
// Process values for controls with repeat type month
or year
- else if( $control->get_repeat_type() >
controller_control::REPEAT_TYPE_WEEK )
+ else if ($control->get_repeat_type() >
controller_control::REPEAT_TYPE_WEEK)
{
- foreach( $locations_for_control_array as
$location )
+ foreach ($locations_for_control_array as
$location)
{
$curr_location_code =
$location['location_code'];
-
+
$repeat_type =
$control->get_repeat_type();
- $location_with_check_lists =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $repeat_type);
-
+ $location_with_check_lists =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $repeat_type);
+
$check_lists_array =
$location_with_check_lists["check_lists_array"];
-
+
$year_calendar = new
year_calendar($control, $year, null, $curr_location_code, "location");
- $calendar_array =
$year_calendar->build_calendar( $check_lists_array );
+ $calendar_array =
$year_calendar->build_calendar($check_lists_array);
$locations_with_calendar_array[] =
array("location" => $location, "calendar_array" => $calendar_array);
}
-
- foreach( $components_for_control_array as $component )
- {
+
+ foreach ($components_for_control_array as
$component)
+ {
$short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component->get_location_id(), 'id' => $component->get_id()));
- $component->set_xml_short_desc( $short_desc_arr );
-
+
$component->set_xml_short_desc($short_desc_arr);
+
$repeat_type =
$control->get_repeat_type();
- $component_with_check_lists =
$this->so->get_check_lists_for_control_and_component($control_id,
$component->get_location_id(), $component->get_id(), $from_date_ts,
$to_date_ts, $repeat_type);
-
+ $component_with_check_lists =
$this->so->get_check_lists_for_control_and_component($control_id,
$component->get_location_id(), $component->get_id(), $from_date_ts,
$to_date_ts, $repeat_type);
+
$check_lists_array =
$component_with_check_lists["check_lists_array"];
-
- $year_calendar = new year_calendar(
$control, $year, $component, null, "component" );
- $calendar_array =
$year_calendar->build_calendar( $check_lists_array );
+ $year_calendar = new
year_calendar($control, $year, $component, null, "component");
+ $calendar_array =
$year_calendar->build_calendar($check_lists_array);
+
$components_with_calendar_array[] =
array("component" => $component->toArray(), "calendar_array" =>
$calendar_array);
}
}
-
+
// Gets array of locations assigned to current user
$my_locations =
$this->get_my_assigned_locations($location_code);
-
+
$heading_array = year_calendar::get_heading_array();
-
+
$data = array
- (
- '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,
+ (
+ '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,
);
-
- self::render_template_xsl(
array('calendar/view_calendar_year_for_locations',
'calendar/check_list_status_manager',
-
'calendar/icon_color_map', 'calendar/select_my_locations',
'calendar/nav_calendar_year'), $data);
-
+
+
self::render_template_xsl(array('calendar/view_calendar_year_for_locations',
'calendar/check_list_status_manager',
+ 'calendar/icon_color_map',
'calendar/select_my_locations', 'calendar/nav_calendar_year'), $data);
+
phpgwapi_jquery::load_widget('core');
self::add_javascript('controller', 'controller',
'ajax.js');
}
-
+
public function view_calendar_month_for_locations()
{
$control_id = phpgw::get_var('control_id');
$control = $this->so_control->get_single($control_id);
- $year = intval( phpgw::get_var('year') );
- $month = intval( phpgw::get_var('month') );
-
- if(is_numeric($control_id) & $control_id > 0)
+ $year = intval(phpgw::get_var('year'));
+ $month = intval(phpgw::get_var('month'));
+
+ 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);
@@ -551,176 +580,176 @@
// Validates year. If year is not set, current year is
chosen
$year = $this->validate_year($year);
-
+
// Validates month. If year is not set, current month
in current year is chosen
$month = $this->validate_month($month);
-
+
// Gets timestamp value of first day in month
- $from_date_ts =
month_calendar::get_start_date_month_ts($year, intval( $month ));
+ $from_date_ts =
month_calendar::get_start_date_month_ts($year, intval($month));
// Gets timestamp value of first day in month
- $to_date_ts =
month_calendar::get_next_start_date_month_ts($year, intval( $month ));
-
+ $to_date_ts =
month_calendar::get_next_start_date_month_ts($year, intval($month));
+
$locations_with_calendar_array = array();
-
- foreach($locations_for_control_array as $location)
+
+ foreach ($locations_for_control_array as $location)
{
$curr_location_code =
$location['location_code'];
-
+
$repeat_type = $control->get_repeat_type();
- $location_with_check_lists =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $control->get_repeat_type());
-
+ $location_with_check_lists =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $control->get_repeat_type());
+
$check_lists_array =
$location_with_check_lists["check_lists_array"];
$month_calendar = new month_calendar($control,
$year, $month, null, $curr_location_code, "location");
- $calendar_array =
$month_calendar->build_calendar( $check_lists_array );
+ $calendar_array =
$month_calendar->build_calendar($check_lists_array);
$locations_with_calendar_array[] =
array("location" => $location, "calendar_array" => $calendar_array);
}
- foreach( $components_for_control_array as $component )
+ foreach ($components_for_control_array as $component)
{
$short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component->get_location_id(), 'id' => $component->get_id()));
- $component->set_xml_short_desc( $short_desc_arr );
-
+ $component->set_xml_short_desc($short_desc_arr);
+
$repeat_type = $control->get_repeat_type();
- $component_with_check_lists =
$this->so->get_check_lists_for_control_and_component($control_id,
$component->get_location_id(), $component->get_id(), $from_date_ts,
$to_date_ts, $control->get_repeat_type());
-
+ $component_with_check_lists =
$this->so->get_check_lists_for_control_and_component($control_id,
$component->get_location_id(), $component->get_id(), $from_date_ts,
$to_date_ts, $control->get_repeat_type());
+
$check_lists_array =
$component_with_check_lists["check_lists_array"];
-
- $month_calendar = new month_calendar( $control,
$year, $month, $component, null, "component" );
- $calendar_array =
$month_calendar->build_calendar( $check_lists_array );
-
+
+ $month_calendar = new month_calendar($control,
$year, $month, $component, null, "component");
+ $calendar_array =
$month_calendar->build_calendar($check_lists_array);
+
$components_with_calendar_array[] =
array("component" => $component->toArray(), "calendar_array" =>
$calendar_array);
}
-
+
// Gets array of locations assigned to current user
$my_locations =
$this->get_my_assigned_locations($location_code);
-
+
$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,
);
-
- self::render_template_xsl(
array('calendar/view_calendar_month_for_locations',
'calendar/check_list_status_manager',
-
'calendar/icon_color_map', 'calendar/select_my_locations',
'calendar/nav_calendar_month'), $data);
-
+
+
self::render_template_xsl(array('calendar/view_calendar_month_for_locations',
'calendar/check_list_status_manager',
+ 'calendar/icon_color_map',
'calendar/select_my_locations', 'calendar/nav_calendar_month'), $data);
+
phpgwapi_jquery::load_widget('core');
self::add_javascript('controller', 'controller',
'ajax.js');
}
-
+
public function
populate_controls_with_check_lists($controls_for_location_array,
$control_id_with_check_list_array)
{
$controls_with_check_list = array();
-
- foreach($controls_for_location_array as $control)
+
+ foreach ($controls_for_location_array as $control)
{
- foreach($control_id_with_check_list_array as
$control_id)
+ foreach ($control_id_with_check_list_array as
$control_id)
{
- if($control->get_id() ==
$control_id->get_id())
+ if ($control->get_id() ==
$control_id->get_id())
{
$control->set_check_lists_array($control_id->get_check_lists_array());
- }
+ }
}
-
+
$controls_with_check_list[] = $control;
}
-
+
return $controls_with_check_list;
}
-
- // Generates array of aggregated number of open cases for each
month in time period
- function build_agg_open_cases_pr_month_array( $cl_criteria,
$year, $from_month, $to_month )
+
+ // Generates array of aggregated number of open cases for each
month in time period
+ function build_agg_open_cases_pr_month_array($cl_criteria,
$year, $from_month, $to_month)
{
-
+
$agg_open_cases_pr_month_array = array();
-
+
// Fetches aggregate value for open cases in each month
in time period
- for($from_month; $from_month <= $to_month;
$from_month++)
+ for ($from_month; $from_month <= $to_month;
$from_month++)
{
$month_start_ts =
$this->get_month_start_ts($year, $from_month);
- $month_end_ts =
$this->get_month_start_ts($year, $from_month+1);
-
+ $month_end_ts =
$this->get_month_start_ts($year, $from_month + 1);
+
$num_open_cases_for_control_array = array();
-
- // Fetches aggregate value for open cases in a
month from db
- $num_open_cases_for_control_array =
$this->so_check_list->get_num_open_cases_for_control( $cl_criteria,
$month_start_ts, $month_end_ts );
-
+
+ // Fetches aggregate value for open cases in a
month from db
+ $num_open_cases_for_control_array =
$this->so_check_list->get_num_open_cases_for_control($cl_criteria,
$month_start_ts, $month_end_ts);
+
// If there is a aggregated value for the
month, add aggregated status object to agg_open_cases_pr_month_array
- if( !empty($num_open_cases_for_control_array) )
+ if (!empty($num_open_cases_for_control_array))
{
$status_agg_month_info = new
status_agg_month_info();
$status_agg_month_info->set_month_nr($from_month);
-
$status_agg_month_info->set_agg_open_cases(
$num_open_cases_for_control_array["count"] );
+
$status_agg_month_info->set_agg_open_cases($num_open_cases_for_control_array["count"]);
$agg_open_cases_pr_month_array[] =
$status_agg_month_info;
- }
+ }
}
-
+
return $agg_open_cases_pr_month_array;
}
-
+
function get_buildings_on_property($user_role, $location_code,
$level)
{
-
+
// Property level
- if($level == 1)
+ if ($level == 1)
{
$property_location_code = $location_code;
}
// Building level
- else if($level > 1)
+ else if ($level > 1)
{
$split_loc_code_array = explode('-',
$location_code);
$property_location_code =
$split_loc_code_array[0];
- }
-
- if($user_role)
- {
+ }
+
+ if ($user_role)
+ {
$criteria = array();
$criteria['location_code'] =
$property_location_code;
$criteria['field_name'] = 'loc2_name';
$criteria['child_level'] = '2';
-
- $buildings_on_property = execMethod('property.solocation.get_children',
$criteria);
- }
- else
- {
- $buildings_on_property =
execMethod('property.solocation.get_children', $property_location_code);
- }
-
- return $buildings_on_property;
+
+ $buildings_on_property =
execMethod('property.solocation.get_children', $criteria);
+ }
+ else
+ {
+ $buildings_on_property =
execMethod('property.solocation.get_children', $property_location_code);
+ }
+
+ return $buildings_on_property;
}
-
+
function get_start_month_for_control($control)
{
- // Checks if control starts in the year that is displayed
- if( date("Y", $control->get_start_date()) == $year )
+ // Checks if control starts in the year that is
displayed
+ if (date("Y", $control->get_start_date()) == $year)
{
- $from_month = date("n",
$control->get_start_date());
+ $from_month = date("n",
$control->get_start_date());
}
else
{
$from_month = 1;
}
-
+
return $from_month;
}
-
+
function get_end_month_for_control($control)
- {
+ {
// Checks if control ends in the year that is displayed
- if( date("Y", $control->get_end_date()) == $year )
+ if (date("Y", $control->get_end_date()) == $year)
{
$to_month = date("n", $control->get_end_date());
}
@@ -728,129 +757,136 @@
{
$to_month = 12;
}
-
+
return $to_month;
- }
-
+ }
+
function get_location_level($location_code)
{
$level = count(explode('-', $location_code));
return $level;
- }
-
+ }
+
function validate_location_code($location_code)
{
$criteria = array
- (
+ (
'user_id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
'type_id' => 1,
'role_id' => 0, // For å begrense til en
bestemt rolle - ellers listes alle roller for brukeren
'allrows' => false
);
-
+
$location_finder = new location_finder();
- $my_locations = $location_finder->get_responsibilities(
$criteria );
+ $my_locations =
$location_finder->get_responsibilities($criteria);
- if(empty($location_code)){
+ if (empty($location_code))
+ {
$location_code =
$my_locations[0]["location_code"];
}
-
+
return $location_code;
}
-
+
function get_my_assigned_locations($current_location_code)
{
$criteria = array
- (
- 'user_id' =>
$GLOBALS['phpgw_info']['user']['account_id'], //
+ (
+ 'user_id' =>
$GLOBALS['phpgw_info']['user']['account_id'], //
'type_id' => 1, // Nivå i bygningsregisteret
1:eiendom
'role_id' => 0, // For å begrense til en
bestemt rolle - ellers listes alle roller for brukeren
'allrows' => false
);
-
+
$location_finder = new location_finder();
- $my_locations = $location_finder->get_responsibilities(
$criteria );
-
+ $my_locations =
$location_finder->get_responsibilities($criteria);
+
$my_washed_locations = array();
-
- foreach($my_locations as $location)
+
+ foreach ($my_locations as $location)
{
- if($location['location_code'] !=
$current_location_code)
+ if ($location['location_code'] !=
$current_location_code)
{
$my_washed_locations[] = $location;
}
}
-
+
return $my_washed_locations;
}
-
+
function get_month_start_ts($year, $month)
{
- if($month > 12)
- {
- $year = $year + 1;
- $month = $month % 12;
+ if ($month > 12)
+ {
+ $year = $year + 1;
+ $month = $month % 12;
}
-
+
return strtotime("$month/01/$year");
}
-
+
function get_start_date_year_ts($year)
{
return strtotime("01/01/$year");
}
-
+
function get_end_date_year_ts($year)
{
$to_year = $year + 1;
$end_date_year_ts = strtotime("01/01/$to_year");
-
+
return $end_date_year_ts;
}
-
+
function validate_year($validate_year)
{
- if( empty( $validate_year ) )
+ if (empty($validate_year))
{
$validate_year = date("Y");
}
-
+
$validate_year = intval($validate_year);
-
+
return $validate_year;
}
-
+
function validate_repeat_type($validate_repeat_type)
{
- if( $validate_repeat_type != 0 & (empty(
$validate_repeat_type ) | ($validate_repeat_type > 3)) )
+ if ($validate_repeat_type != 0 &
(empty($validate_repeat_type) | ($validate_repeat_type > 3)))
{
$validate_repeat_type = '';
}
-
+
return $validate_repeat_type;
}
-
- function validate_role($validate_role)
+
+ function validate_role($validate_role)
{
- if( empty( $validate_role ) |
(!is_numeric($validate_role)) | ($validate_role < 1) )
+ if (empty($validate_role) |
(!is_numeric($validate_role)) | ($validate_role < 1))
{
$validate_role = '';
}
-
+
return $validate_role;
}
-
+
function validate_month($month)
{
- if( empty( $month ) ){
+ if (empty($month))
+ {
$month = date("n");
}
-
+
$month = intval($month);
-
+
return $month;
}
-
- public function query(){}
+
+ public function query()
+ {
+
+ }
+
}
+
Modified: trunk/controller/templates/base/calendar/calendar_month_no_loc.xsl
===================================================================
--- trunk/controller/templates/base/calendar/calendar_month_no_loc.xsl
2013-01-29 09:35:43 UTC (rev 10720)
+++ trunk/controller/templates/base/calendar/calendar_month_no_loc.xsl
2013-01-29 09:51:33 UTC (rev 10721)
@@ -64,24 +64,7 @@
<div id="main_content">
<div id="control_plan" class="month_view">
- <div class="top">
-
- <xsl:choose>
- <xsl:when test="current_location/child::node()">
- <xsl:choose>
- <xsl:when test="location_level = 1">
- <h1>Kontrollplan for eiendom: <xsl:value-of
select="current_location/loc1_name"/></h1>
- </xsl:when>
- <xsl:otherwise>
- <h1>Kontrollplan for bygg: <xsl:value-of
select="current_location/loc2_name"/></h1>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <h1>Eiendom/bygg ikke valgt</h1>
- </xsl:otherwise>
- </xsl:choose>
-
+ <div id="no-loc" class="top">
<h1>Eiendom/bygg ikke valgt</h1>
<h3>Månedsoversikt</h3>
@@ -107,49 +90,7 @@
</div>
<input type="text" value=""
id="search-location-name" />
</div>
-
- <!-- ===================== SELECT LIST FOR MY ASSIGNED
LOCATIONS ================= -->
- <div id="choose-my-location" class="select-box">
- <label>Velg et annet bygg/eiendom du har ansvar
for</label>
-
- <form action="#">
- <input type="hidden" name="period_type"
value="view_month" />
- <input type="hidden" name="year">
- <xsl:attribute name="value">
- <xsl:value-of select="current_year"/>
- </xsl:attribute>
- </input>
- <input type="hidden" name="month">
- <xsl:attribute name="value">
- <xsl:value-of
select="current_month_nr"/>
- </xsl:attribute>
- </input>
-
- <select id="choose_my_location"
class="selectLocation">
- <option>Velg bygg</option>
- <xsl:for-each
select="my_locations">
- <xsl:choose>
-
<xsl:when test="location_code = //current_location/location_code">
-
<option selected="SELECTED">
-
<xsl:attribute name="value"><xsl:value-of disable-output-escaping="yes"
select="location_code"/></xsl:attribute>
-
<xsl:value-of disable-output-escaping="yes" select="loc1_name"/>
-
</option>
-
</xsl:when>
-
<xsl:otherwise>
-
<option>
-
<xsl:attribute name="value"><xsl:value-of disable-output-escaping="yes"
select="location_code"/></xsl:attribute>
-
<xsl:value-of disable-output-escaping="yes" select="loc1_name"/>
-
</option>
-
</xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </select>
- </form>
- </div>
</div>
- <div class="middle">
-
- </div>
</div>
</div>
</xsl:template>
Modified: trunk/controller/templates/base/calendar/calendar_year_no_loc.xsl
===================================================================
--- trunk/controller/templates/base/calendar/calendar_year_no_loc.xsl
2013-01-29 09:35:43 UTC (rev 10720)
+++ trunk/controller/templates/base/calendar/calendar_year_no_loc.xsl
2013-01-29 09:51:33 UTC (rev 10721)
@@ -63,7 +63,7 @@
<div id="main_content">
<div id="control_plan" class="month_view">
- <div class="top">
+ <div id="no-loc" class="top">
<h1>Eiendom/bygg ikke valgt</h1>
<h3>Årsoversikt</h3>
@@ -90,45 +90,6 @@
</div>
<input type="text" value=""
id="search-location-name" />
</div>
-
- <!-- ===================== SELECT LIST FOR MY ASSIGNED
LOCATIONS ================= -->
- <div id="choose-my-location" class="select-box">
- <label>Velg et annet bygg/eiendom du har ansvar
for</label>
-
- <form action="#">
- <input type="hidden" name="period_type"
value="view_month" />
- <input type="hidden" name="year">
- <xsl:attribute name="value">
- <xsl:value-of select="current_year"/>
- </xsl:attribute>
- </input>
- <input type="hidden" name="month">
- <xsl:attribute name="value">
- <xsl:value-of
select="current_month_nr"/>
- </xsl:attribute>
- </input>
-
- <select id="choose_my_location"
class="selectLocation">
- <option>Velg bygg</option>
- <xsl:for-each
select="my_locations">
- <xsl:choose>
-
<xsl:when test="location_code = //current_location/location_code">
-
<option selected="SELECTED">
-
<xsl:attribute name="value"><xsl:value-of disable-output-escaping="yes"
select="location_code"/></xsl:attribute>
-
<xsl:value-of disable-output-escaping="yes" select="loc1_name"/>
-
</option>
-
</xsl:when>
-
<xsl:otherwise>
-
<option>
-
<xsl:attribute name="value"><xsl:value-of disable-output-escaping="yes"
select="location_code"/></xsl:attribute>
-
<xsl:value-of disable-output-escaping="yes" select="loc1_name"/>
-
</option>
-
</xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </select>
- </form>
- </div>
</div>
</div>
</div>
Modified: trunk/controller/templates/base/calendar/view_calendar_month.xsl
===================================================================
--- trunk/controller/templates/base/calendar/view_calendar_month.xsl
2013-01-29 09:35:43 UTC (rev 10720)
+++ trunk/controller/templates/base/calendar/view_calendar_month.xsl
2013-01-29 09:51:33 UTC (rev 10721)
@@ -1,345 +1,414 @@
+
<!-- $Id$ -->
<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="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="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>
-<script>
-<xsl:text>
+ <script>
+ <xsl:text>
-$(document).ready(function(){
+ $(document).ready(function(){
- var oArgs = {menuaction:'property.bolocation.get_locations_by_name'};
- var baseUrl = phpGWLink('index.php', oArgs, false);
+ var oArgs =
{menuaction:'property.bolocation.get_locations_by_name'};
+ var baseUrl = phpGWLink('index.php', oArgs, false);
- var location_type = $("#loc_type").val();
+ var location_type = $("#loc_type").val();
- $("#search-location-name").autocomplete({
- source: function( request, response ) {
+ $("#search-location-name").autocomplete({
+ source: function( request, response ) {
location_type = $("#loc_type").val();
-
+
$.ajax({
- url: baseUrl,
- dataType: "json",
- data: {
- location_name: request.term,
- level: location_type,
- phpgw_return_as: "json"
- },
- success: function( data ) {
- response( $.map( data, function( item )
{
- return {
- label: item.name,
- value:
item.location_code
- }
- }));
- }
+ url: baseUrl,
+ dataType: "json",
+ data: {
+ location_name: request.term,
+ level: location_type,
+ phpgw_return_as: "json"
+ },
+ success: function( data ) {
+ response( $.map( data, function( item ) {
+ return {
+ label: item.name,
+ value: item.location_code
+ }
+ }));
+ }
});
- },
- focus: function (event, ui) {
- $(event.target).val(ui.item.label);
- return false;
- },
- minLength: 1,
- select: function( event, ui ) {
- chooseLocation( ui.item.label, ui.item.value);
- }
- });
-});
+ },
+ focus: function (event, ui) {
+ $(event.target).val(ui.item.label);
+ return false;
+ },
+ minLength: 1,
+ select: function( event, ui ) {
+ chooseLocation( ui.item.label, ui.item.value);
+ }
+ });
+ });
+ function chooseLocation( label, value ){
+ var currentYear = $("#currentYear").val();
+ var currentMonth = $("#currentMonth").val();
-function chooseLocation( label, value ){
- var currentYear = $("#currentYear").val();
- var currentMonth = $("#currentMonth").val();
-
- var oArgs = {menuaction:'controller.uicalendar.view_calendar_for_year'};
- var baseUrl = phpGWLink('index.php', oArgs, false);
- var requestUrl = baseUrl + "&location_code=" + value +
"&year=" + currentYear + "&month=" + currentMonth;
-
- window.location.replace(requestUrl);
-}
+ var oArgs =
{menuaction:'controller.uicalendar.view_calendar_for_year'};
+ var baseUrl = phpGWLink('index.php', oArgs, false);
+ var requestUrl = baseUrl + "&location_code=" +
value + "&year=" + currentYear + "&month=" + currentMonth;
-</xsl:text>
+ window.location.replace(requestUrl);
+ }
-</script>
+ </xsl:text>
-<div id="main_content">
- <div id="control_plan" class="month_view">
- <div class="top">
- <xsl:choose>
- <xsl:when test="location_level = 1">
- <h1>Kontrollplan for eiendom:
<xsl:value-of select="current_location/loc1_name"/></h1>
- </xsl:when>
- <xsl:otherwise>
- <h1>Kontrollplan for bygg:
<xsl:value-of select="current_location/loc2_name"/></h1>
- </xsl:otherwise>
- </xsl:choose>
- <h3>Kalenderoversikt 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>
-
- <!-- ===================== SEARCH FOR LOCATION
================= -->
- <div id="search-location" class="select-box">
- <div id="choose-loc">
- <input id="loc_type" type="hidden" name="loc_type"
value="2" />
- <input type="hidden" id="currentYear">
- <xsl:attribute name="value">
+ </script>
+
+ <div id="main_content">
+ <div id="control_plan" class="month_view">
+ <div class="top">
+
+ <xsl:choose>
+ <xsl:when test="location_level = 1">
+ <h1>Kontrollplan for eiendom:
+ <xsl:value-of
select="current_location/loc1_name"/>
+ </h1>
+ </xsl:when>
+ <xsl:otherwise>
+ <h1>Kontrollplan for bygg:
+ <xsl:value-of
select="current_location/loc2_name"/>
+ </h1>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <h3>Kalenderoversikt for
+ <span class="month">
+ <xsl:value-of
select="php:function('lang', $month_str)" />
+ </span>
+ <span class="year">
<xsl:value-of
select="current_year"/>
- </xsl:attribute>
- </input>
- <input type="hidden" id="currentMonth">
- <xsl:attribute name="value">
- <xsl:value-of
select="current_month_nr"/>
- </xsl:attribute>
- </input>
- <label>Søk etter</label>
- <span>
- <a href="loc_type_2" class="btn
first active">Bygg</a>
- <a href="loc_type_1"
class="btn">Eiendom</a>
</span>
+ </h3>
+
+ <!-- ===================== SEARCH FOR LOCATION
================= -->
+ <div id="search-location" class="select-box">
+ <div id="choose-loc">
+ <input id="loc_type"
type="hidden" name="loc_type" value="2" />
+ <input type="hidden"
id="currentYear">
+ <xsl:attribute
name="value">
+ <xsl:value-of
select="current_year"/>
+ </xsl:attribute>
+ </input>
+ <input type="hidden"
id="currentMonth">
+ <xsl:attribute
name="value">
+ <xsl:value-of
select="current_month_nr"/>
+ </xsl:attribute>
+ </input>
+ <label>Søk etter</label>
+ <span>
+ <a href="loc_type_2"
class="btn first active">Bygg</a>
+ <a href="loc_type_1"
class="btn">Eiendom</a>
+ </span>
+ </div>
+ <input type="text" value=""
id="search-location-name" />
</div>
- <input type="text" value=""
id="search-location-name" />
- </div>
-
- <!-- ===================== SELECT LIST FOR MY ASSIGNED
LOCATIONS ================= -->
- <div id="choose-my-location" class="select-box">
- <label>Velg et annet bygg/eiendom du har ansvar
for</label>
-
- <form action="#">
- <input type="hidden" name="period_type"
value="view_month" />
- <input type="hidden" name="year">
- <xsl:attribute name="value">
- <xsl:value-of select="current_year"/>
- </xsl:attribute>
- </input>
- <input type="hidden" name="month">
- <xsl:attribute name="value">
- <xsl:value-of
select="current_month_nr"/>
- </xsl:attribute>
- </input>
-
- <select id="choose_my_location"
class="selectLocation">
- <option>Velg bygg</option>
- <xsl:for-each
select="my_locations">
+
+ <!-- ===================== SELECT LIST FOR MY
ASSIGNED LOCATIONS ================= -->
+ <div id="choose-my-location" class="select-box">
+ <label>Velg et annet bygg/eiendom du
har ansvar for</label>
+
+ <form action="#">
+ <input type="hidden"
name="period_type" value="view_month" />
+ <input type="hidden"
name="year">
+ <xsl:attribute
name="value">
+ <xsl:value-of
select="current_year"/>
+ </xsl:attribute>
+ </input>
+ <input type="hidden"
name="month">
+ <xsl:attribute
name="value">
+ <xsl:value-of
select="current_month_nr"/>
+ </xsl:attribute>
+ </input>
+
+ <select id="choose_my_location"
class="selectLocation">
+ <option>Velg
bygg</option>
+ <xsl:for-each
select="my_locations">
<xsl:choose>
<xsl:when test="location_code = //current_location/location_code">
<option selected="SELECTED">
-
<xsl:attribute name="value"><xsl:value-of disable-output-escaping="yes"
select="location_code"/></xsl:attribute>
+
<xsl:attribute name="value">
+
<xsl:value-of disable-output-escaping="yes"
select="location_code"/>
+
</xsl:attribute>
<xsl:value-of disable-output-escaping="yes" select="loc1_name"/>
</option>
</xsl:when>
<xsl:otherwise>
<option>
-
<xsl:attribute name="value"><xsl:value-of disable-output-escaping="yes"
select="location_code"/></xsl:attribute>
+
<xsl:attribute name="value">
+
<xsl:value-of disable-output-escaping="yes"
select="location_code"/>
+
</xsl:attribute>
<xsl:value-of disable-output-escaping="yes" select="loc1_name"/>
</option>
</xsl:otherwise>
</xsl:choose>
- </xsl:for-each>
- </select>
- </form>
+ </xsl:for-each>
+ </select>
+ </form>
+ </div>
</div>
- </div>
- <div class="middle">
-
- <!-- ===================== SHOW CALENDAR FOR YEAR
================= -->
- <a id="showYear">
- <xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
- <xsl:text>&year=</xsl:text>
- <xsl:value-of select="current_year"/>
- <xsl:text>&location_code=</xsl:text>
- <xsl:value-of
select="current_location/location_code"/>
- <xsl:value-of select="$session_url"/>
- </xsl:attribute>
- <img height="20"
src="controller/images/left_arrow_simple_light_blue.png" />Årsoversikt
- </a>
-
- <!-- ===================== CHOOSE ANOTHER BUILDING ON PROPERTY
================= -->
- <div id="choose-building" class="select-box">
- <xsl:if test="location_level > 1">
- <a>
- <xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
-
<xsl:text>&year=</xsl:text>
- <xsl:value-of
select="current_year"/>
-
<xsl:text>&location_code=</xsl:text>
- <xsl:value-of
select="current_location/loc1"/>
- <xsl:value-of
select="$session_url"/>
- </xsl:attribute>
- Vis kontrollplan for eiendom
- </a>
- </xsl:if>
+ <div class="middle">
- <label>Velg et annet bygg på eiendommen</label>
- <xsl:call-template
name="select_buildings_on_property" />
+ <!-- ===================== SHOW CALENDAR FOR
YEAR ================= -->
+ <a id="showYear">
+ <xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
+ <xsl:text>&year=</xsl:text>
+ <xsl:value-of
select="current_year"/>
+
<xsl:text>&location_code=</xsl:text>
+ <xsl:value-of
select="current_location/location_code"/>
+ <xsl:value-of
select="$session_url"/>
+ </xsl:attribute>
+ <img height="20"
src="controller/images/left_arrow_simple_light_blue.png" />Årsoversikt
+ </a>
+
+ <!-- ===================== CHOOSE ANOTHER
BUILDING ON PROPERTY ================= -->
+ <div id="choose-building" class="select-box">
+ <xsl:if test="location_level > 1">
+ <a>
+ <xsl:attribute
name="href">
+
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
+
<xsl:text>&year=</xsl:text>
+ <xsl:value-of
select="current_year"/>
+
<xsl:text>&location_code=</xsl:text>
+ <xsl:value-of
select="current_location/loc1"/>
+ <xsl:value-of
select="$session_url"/>
+ </xsl:attribute>
+ Vis kontrollplan for
eiendom
+ </a>
+ </xsl:if>
+
+ <label>Velg et annet bygg på
eiendommen</label>
+ <xsl:call-template
name="select_buildings_on_property" />
+ </div>
+
+ <!-- ===================== COLOR ICON MAP
================= -->
+ <xsl:call-template name="icon_color_map" />
+
+ <!-- ===================== FILTERS
================= -->
+ <xsl:call-template name="calendar_filters" >
+ <xsl:with-param
name="view_period">month</xsl:with-param>
+ </xsl:call-template>
+
+ <!-- ===================== CALENDAR NAVIGATION
================= -->
+ <xsl:call-template name="nav_calendar_month">
+ <xsl:with-param
name="view">VIEW_CONTROLS_FOR_LOCATION</xsl:with-param>
+ </xsl:call-template>
</div>
-
- <!-- ===================== COLOR ICON MAP
================= -->
- <xsl:call-template name="icon_color_map" />
-
- <!-- ===================== FILTERS =================
-->
- <xsl:call-template name="calendar_filters" >
- <xsl:with-param
name="view_period">month</xsl:with-param>
- </xsl:call-template>
-
- <!-- ===================== CALENDAR NAVIGATION
================= -->
- <xsl:call-template name="nav_calendar_month">
- <xsl:with-param
name="view">VIEW_CONTROLS_FOR_LOCATION</xsl:with-param>
- </xsl:call-template>
- </div>
-
- <div id="cal_wrp">
- <!-- ================================ BUILDINGS TABLE
==================================== -->
- <h2>Bygg/eiendom</h2>
- <table id="calendar" class="month">
- <tr class="heading">
- <th
class="title"><span>Tittel</span></th>
- <th
class="assigned"><span>Tildelt</span></th>
- <th
class="frequency"><span>Frekvens</span></th>
- <xsl:for-each select="heading_array">
- <th><span><xsl:value-of
select="."/></span></th>
- </xsl:for-each>
- </tr>
- <xsl:choose>
- <xsl:when
test="controls_calendar_array/child::node()">
- <xsl:for-each
select="controls_calendar_array">
- <tr>
- <xsl:choose>
- <xsl:when
test="(position() mod 2) != 1">
- <xsl:attribute
name="class">odd</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute
name="class">even</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- <td
class="title">
- <a class="show-control-details">
-
<xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicontrol.get_control_details</xsl:text>
-
<xsl:text>&control_id=</xsl:text>
-
<xsl:value-of select="control/id"/>
-
<xsl:text>&phpgw_return_as=stripped_html</xsl:text>
-
<xsl:value-of select="$session_url"/>
-
</xsl:attribute>
-
<xsl:value-of select="control/title"/>
- </a>
- </td>
- <td
class="assigned">
- <span><xsl:value-of
select="control/responsibility_name"/></span>
- </td>
- <td
class="frequency">
- <span>
-
<xsl:choose>
-
<xsl:when test="control/repeat_interval = 1">
-
<span class="pre">Hver</span>
-
</xsl:when>
-
<xsl:when test="control/repeat_interval = 2">
-
<span class="pre">Annenhver</span>
-
</xsl:when>
-
<xsl:when test="control/repeat_interval > 2">
-
<span class="pre">Hver</span><span><xsl:value-of
select="control/repeat_interval"/>.</span>
-
</xsl:when>
-
</xsl:choose>
-
- <span
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
- </span>
- </td>
-
- <xsl:for-each
select="calendar_array">
- <td>
-
<xsl:call-template name="check_list_status_manager" >
-
<xsl:with-param name="location_code"><xsl:value-of
select="//current_location/location_code"/></xsl:with-param>
-
</xsl:call-template>
- </td>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <tr class="cal_info_msg"><td
colspan="3"><xsl:value-of select="php:function('lang',
'error_msg_no_controls_in_period')" /></td></tr>
- </xsl:otherwise>
- </xsl:choose>
- </table>
-
- <!-- ================================ COMPONENTS TABLE
==================================== -->
- <h2 class="components">Komponenter</h2>
- <xsl:choose>
- <xsl:when
test="components_calendar_array/child::node()">
- <xsl:for-each select="components_calendar_array">
- <h3><xsl:value-of select="component/xml_short_desc"/></h3>
-
- <table id="calendar" class="month">
+
+ <div id="cal_wrp">
+ <!-- ================================
BUILDINGS TABLE ==================================== -->
+ <h2>Bygg/eiendom</h2>
+ <table id="calendar" class="month">
<tr class="heading">
- <th
class="title"><span>Tittel</span></th>
- <th
class="assigned"><span>Tildelt</span></th>
- <th
class="frequency"><span>Frekvens</span></th>
- <xsl:for-each select="//heading_array">
- <th><span><xsl:value-of
select="."/></span></th>
- </xsl:for-each>
+ <th class="title">
+ <span>Tittel</span>
+ </th>
+ <th class="assigned">
+ <span>Tildelt</span>
+ </th>
+ <th class="frequency">
+ <span>Frekvens</span>
+ </th>
+ <xsl:for-each
select="heading_array">
+ <th>
+ <span>
+
<xsl:value-of select="."/>
+ </span>
+ </th>
+ </xsl:for-each>
</tr>
-
- <xsl:for-each select="controls_calendar">
- <xsl:variable
name="control_id"><xsl:value-of select="control/id"/></xsl:variable>
- <tr>
- <xsl:choose>
- <xsl:when test="(position() mod 2) !=
1">
- <xsl:attribute
name="class">odd</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute
name="class">even</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- <td
class="title">
- <a id="showControlDetails">
-
<xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicontrol.get_control_details</xsl:text>
-
<xsl:text>&control_id=</xsl:text>
-
<xsl:value-of select="control/id"/>
-
<xsl:value-of select="$session_url"/>
-
</xsl:attribute>
-
<xsl:value-of select="control/title"/>
- </a>
+ <xsl:choose>
+ <xsl:when
test="controls_calendar_array/child::node()">
+ <xsl:for-each
select="controls_calendar_array">
+ <tr>
+
<xsl:choose>
+
<xsl:when test="(position() mod 2) != 1">
+
<xsl:attribute name="class">odd</xsl:attribute>
+
</xsl:when>
+
<xsl:otherwise>
+
<xsl:attribute name="class">even</xsl:attribute>
+
</xsl:otherwise>
+
</xsl:choose>
+ <td
class="title">
+
<a class="show-control-details">
+
<xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicontrol.get_control_details</xsl:text>
+
<xsl:text>&control_id=</xsl:text>
+
<xsl:value-of select="control/id"/>
+
<xsl:text>&phpgw_return_as=stripped_html</xsl:text>
+
<xsl:value-of select="$session_url"/>
+
</xsl:attribute>
+
<xsl:value-of select="control/title"/>
+
</a>
+ </td>
+ <td
class="assigned">
+
<span>
+
<xsl:value-of select="control/responsibility_name"/>
+
</span>
+ </td>
+ <td
class="frequency">
+
<span>
+
<xsl:choose>
+
<xsl:when test="control/repeat_interval = 1">
+
<span class="pre">Hver</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval = 2">
+
<span class="pre">Annenhver</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval > 2">
+
<span class="pre">Hver</span>
+
<span>
+
<xsl:value-of
select="control/repeat_interval"/>.
+
</span>
+
</xsl:when>
+
</xsl:choose>
+
+
<span class="val">
+
<xsl:value-of select="control/repeat_type_label"/>
+
</span>
+
</span>
+ </td>
+
+
<xsl:for-each select="calendar_array">
+
<td>
+
<xsl:call-template name="check_list_status_manager" >
+
<xsl:with-param name="location_code">
+
<xsl:value-of
select="//current_location/location_code"/>
+
</xsl:with-param>
+
</xsl:call-template>
+
</td>
+
</xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <tr
class="cal_info_msg">
+ <td colspan="3">
+
<xsl:value-of select="php:function('lang', 'error_msg_no_controls_in_period')"
/>
</td>
- <td
class="assigned">
-
<span><xsl:value-of select="control/responsibility_name"/></span>
- </td>
- <td
class="frequency">
- <span>
-
<xsl:choose>
-
<xsl:when test="control/repeat_interval = 1 and control/repeat_type < 3">
-
<span class="pre">Hver</span>
-
</xsl:when>
-
<xsl:when test="control/repeat_interval = 1 and control/repeat_type = 3">
-
<span class="pre">Hvert</span>
-
</xsl:when>
-
<xsl:when test="control/repeat_interval = 2">
-
<span class="pre">Annenhver</span>
-
</xsl:when>
-
<xsl:when test="control/repeat_interval > 2">
-
<span class="pre">Hver</span><span><xsl:value-of
select="control/repeat_interval"/>.</span>
-
</xsl:when>
-
</xsl:choose>
-
- <span
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
- </span>
- </td>
- <xsl:for-each
select="calendar_array">
- <td>
-
<xsl:call-template name="check_list_status_manager" >
-
<xsl:with-param name="location_code"><xsl:value-of
select="//current_location/location_code"/></xsl:with-param>
-
</xsl:call-template>
- </td>
+ </tr>
+ </xsl:otherwise>
+ </xsl:choose>
+ </table>
+
+ <!-- ================================
COMPONENTS TABLE ==================================== -->
+ <h2 class="components">Komponenter</h2>
+ <xsl:choose>
+ <xsl:when
test="components_calendar_array/child::node()">
+ <xsl:for-each
select="components_calendar_array">
+ <h3>
+ <xsl:value-of
select="component/xml_short_desc"/>
+ </h3>
+
+ <table id="calendar"
class="month">
+ <tr
class="heading">
+ <th
class="title">
+
<span>Tittel</span>
+ </th>
+ <th
class="assigned">
+
<span>Tildelt</span>
+ </th>
+ <th
class="frequency">
+
<span>Frekvens</span>
+ </th>
+
<xsl:for-each select="//heading_array">
+
<th>
+
<span>
+
<xsl:value-of select="."/>
+
</span>
+
</th>
+
</xsl:for-each>
+ </tr>
+
+ <xsl:for-each
select="controls_calendar">
+
<xsl:variable name="control_id">
+
<xsl:value-of select="control/id"/>
+
</xsl:variable>
+ <tr>
+
<xsl:choose>
+
<xsl:when test="(position() mod 2) != 1">
+
<xsl:attribute name="class">odd</xsl:attribute>
+
</xsl:when>
+
<xsl:otherwise>
+
<xsl:attribute name="class">even</xsl:attribute>
+
</xsl:otherwise>
+
</xsl:choose>
+
<td class="title">
+
<a id="showControlDetails">
+
<xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicontrol.get_control_details</xsl:text>
+
<xsl:text>&control_id=</xsl:text>
+
<xsl:value-of select="control/id"/>
+
<xsl:value-of select="$session_url"/>
+
</xsl:attribute>
+
<xsl:value-of select="control/title"/>
+
</a>
+
</td>
+
<td class="assigned">
+
<span>
+
<xsl:value-of select="control/responsibility_name"/>
+
</span>
+
</td>
+
<td class="frequency">
+
<span>
+
<xsl:choose>
+
<xsl:when test="control/repeat_interval = 1 and
control/repeat_type < 3">
+
<span class="pre">Hver</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval = 1 and
control/repeat_type = 3">
+
<span class="pre">Hvert</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval = 2">
+
<span class="pre">Annenhver</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval > 2">
+
<span class="pre">Hver</span>
+
<span>
+
<xsl:value-of
select="control/repeat_interval"/>.
+
</span>
+
</xsl:when>
+
</xsl:choose>
+
+
<span class="val">
+
<xsl:value-of select="control/repeat_type_label"/>
+
</span>
+
</span>
+
</td>
+
<xsl:for-each select="calendar_array">
+
<td>
+
<xsl:call-template name="check_list_status_manager" >
+
<xsl:with-param name="location_code">
+
<xsl:value-of
select="//current_location/location_code"/>
+
</xsl:with-param>
+
</xsl:call-template>
+
</td>
+
</xsl:for-each>
+ </tr>
</xsl:for-each>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <div id="calendar">
- <p class="no-comp-msg">Ingen
komponenter tilknyttet kontroll</p>
- </div>
- </xsl:otherwise>
- </xsl:choose>
+ </table>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <div id="calendar">
+ <p
class="no-comp-msg">Ingen komponenter tilknyttet kontroll</p>
+ </div>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
</div>
</div>
-</div>
</xsl:template>
Modified: trunk/controller/templates/base/calendar/view_calendar_year.xsl
===================================================================
--- trunk/controller/templates/base/calendar/view_calendar_year.xsl
2013-01-29 09:35:43 UTC (rev 10720)
+++ trunk/controller/templates/base/calendar/view_calendar_year.xsl
2013-01-29 09:51:33 UTC (rev 10721)
@@ -1,244 +1,163 @@
<!-- $Id$ -->
<xsl:template match="data" xmlns:php="http://php.net/xsl">
-<xsl:variable name="session_url">&<xsl:value-of
select="php:function('get_phpgw_session_url')" /></xsl:variable>
-
-<script>
-<xsl:text>
+ <xsl:variable name="session_url">&
+ <xsl:value-of select="php:function('get_phpgw_session_url')" />
+ </xsl:variable>
-$(document).ready(function(){
+ <script>
+ <xsl:text>
- var oArgs = {menuaction:'property.bolocation.get_locations_by_name'};
- var baseUrl = phpGWLink('index.php', oArgs, false);
+ $(document).ready(function(){
- var location_type = $("#loc_type").val();
+ var oArgs =
{menuaction:'property.bolocation.get_locations_by_name'};
+ var baseUrl = phpGWLink('index.php', oArgs, false);
- $("#search-location-name").autocomplete({
- source: function( request, response ) {
+ var location_type = $("#loc_type").val();
+
+ $("#search-location-name").autocomplete({
+ source: function( request, response ) {
location_type = $("#loc_type").val();
-
+
$.ajax({
- url: baseUrl,
- dataType: "json",
- data: {
- location_name: request.term,
- level: location_type,
- phpgw_return_as: "json"
- },
- success: function( data ) {
- response( $.map( data, function( item )
{
- return {
- label: item.name,
- value:
item.location_code
- }
- }));
- }
+ url: baseUrl,
+ dataType: "json",
+ data: {
+ location_name: request.term,
+ level: location_type,
+ phpgw_return_as: "json"
+ },
+ success: function( data ) {
+ response( $.map( data, function( item ) {
+ return {
+ label: item.name,
+ value: item.location_code
+ }
+ }));
+ }
});
- },
- focus: function (event, ui) {
- $(event.target).val(ui.item.label);
- return false;
- },
- minLength: 1,
- select: function( event, ui ) {
- chooseLocation( ui.item.label, ui.item.value);
- }
- });
-});
+ },
+ focus: function (event, ui) {
+ $(event.target).val(ui.item.label);
+ return false;
+ },
+ minLength: 1,
+ select: function( event, ui ) {
+ chooseLocation( ui.item.label, ui.item.value);
+ }
+ });
+ });
-function chooseLocation( label, value ){
- var currentYear = $("#currentYear").val();
-
- var oArgs = {menuaction:'controller.uicalendar.view_calendar_for_year'};
- var baseUrl = phpGWLink('index.php', oArgs, false);
- var requestUrl = baseUrl + "&location_code=" + value +
"&year=" + currentYear;
-
- window.location.replace(requestUrl);
-}
+ function chooseLocation( label, value ){
+ var currentYear = $("#currentYear").val();
-</xsl:text>
+ var oArgs =
{menuaction:'controller.uicalendar.view_calendar_for_year'};
+ var baseUrl = phpGWLink('index.php', oArgs, false);
+ var requestUrl = baseUrl + "&location_code=" +
value + "&year=" + currentYear;
-</script>
+ window.location.replace(requestUrl);
+ }
+ </xsl:text>
+ </script>
-<div id="main_content">
- <div id="control_plan">
- <div class="top">
- <xsl:choose>
- <xsl:when test="location_level = 1">
- <h1>Kontrollplan for eiendom:
<xsl:value-of select="current_location/loc1_name"/></h1>
- </xsl:when>
- <xsl:otherwise>
- <h1>Kontrollplan for bygg:
<xsl:value-of select="current_location/loc2_name"/></h1>
- </xsl:otherwise>
- </xsl:choose>
-
- <h3>Kalenderoversikt for <span
class="year"><xsl:value-of select="current_year"/></span></h3>
-
- <!-- ===================== SEARCH FOR LOCATION
================= -->
- <div id="search-location" class="select-box">
- <div id="choose-loc">
- <input id="loc_type" type="hidden"
name="loc_type" value="2" />
- <input type="hidden" id="currentYear">
- <xsl:attribute name="value">
- <xsl:value-of
select="current_year"/>
- </xsl:attribute>
- </input>
- <label>Søk etter</label>
- <span>
- <a href="loc_type_2" class="btn
first active">Bygg</a>
- <a href="loc_type_1"
class="btn">Eiendom</a>
+ <div id="main_content">
+ <div id="control_plan">
+ <div class="top">
+
+ <xsl:choose>
+ <xsl:when test="location_level = 1">
+ <h1>Kontrollplan for eiendom:
+ <xsl:value-of
select="current_location/loc1_name"/>
+ </h1>
+ </xsl:when>
+ <xsl:otherwise>
+ <h1>Kontrollplan for bygg:
+ <xsl:value-of
select="current_location/loc2_name"/>
+ </h1>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <h3>Kalenderoversikt for
+ <span class="year">
+ <xsl:value-of
select="current_year"/>
</span>
+ </h3>
+
+ <!-- ===================== SEARCH FOR LOCATION
================= -->
+ <div id="search-location" class="select-box">
+ <div id="choose-loc">
+ <input id="loc_type"
type="hidden" name="loc_type" value="2" />
+ <input type="hidden"
id="currentYear">
+ <xsl:attribute
name="value">
+ <xsl:value-of
select="current_year"/>
+ </xsl:attribute>
+ </input>
+ <label>Søk etter</label>
+ <span>
+ <a href="loc_type_2"
class="btn first active">Bygg</a>
+ <a href="loc_type_1"
class="btn">Eiendom</a>
+ </span>
+ </div>
+ <input type="text" value=""
id="search-location-name" />
</div>
- <input type="text" value=""
id="search-location-name" />
+
+ <!-- ===================== SELECT LIST FOR MY
LOCATIONS ================= -->
+ <div id="choose-my-location" class="select-box">
+ <label>Velg et annet bygg/eiendom du
har ansvar for</label>
+ <xsl:call-template
name="select_my_locations" />
+ </div>
</div>
-
- <!-- ===================== SELECT LIST FOR MY
LOCATIONS ================= -->
- <div id="choose-my-location" class="select-box">
- <label>Velg et annet bygg/eiendom du har ansvar
for</label>
- <xsl:call-template name="select_my_locations" />
+
+ <div class="middle">
+
+ <!-- ===================== CHOOSE ANOTHER
BUILDING ON PROPERTY ================= -->
+ <div id="choose-building" class="select-box">
+ <xsl:if test="location_level > 1">
+ <a>
+ <xsl:attribute
name="href">
+
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
+
<xsl:text>&year=</xsl:text>
+ <xsl:value-of
select="current_year"/>
+
<xsl:text>&location_code=</xsl:text>
+ <xsl:value-of
select="current_location/loc1"/>
+ <xsl:value-of
select="$session_url"/>
+ </xsl:attribute>
+ Vis kontrollplan for
eiendom
+ </a>
+ </xsl:if>
+
+ <label>Velg et annet bygg på
eiendommen</label>
+ <xsl:call-template
name="select_buildings_on_property" />
+ </div>
+
+
+ <!-- ===================== COLOR ICON MAP
================= -->
+ <xsl:call-template name="icon_color_map" />
+
+ <!-- ===================== FILTERS
================= -->
+ <xsl:call-template name="calendar_filters" >
+ <xsl:with-param
name="view_period">year</xsl:with-param>
+ </xsl:call-template>
+
+ <!-- ===================== CALENDAR NAVIGATION
================= -->
+ <xsl:call-template name="nav_calendar_year">
+ <xsl:with-param
name="view">VIEW_CONTROLS_FOR_LOCATION</xsl:with-param>
+ </xsl:call-template>
</div>
- </div>
-
- <div class="middle">
-
- <!-- ===================== CHOOSE ANOTHER BUILDING ON
PROPERTY ================= -->
- <div id="choose-building" class="select-box">
- <xsl:if test="location_level > 1">
- <a>
- <xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
-
<xsl:text>&year=</xsl:text>
- <xsl:value-of
select="current_year"/>
-
<xsl:text>&location_code=</xsl:text>
- <xsl:value-of
select="current_location/loc1"/>
- <xsl:value-of
select="$session_url"/>
- </xsl:attribute>
- Vis kontrollplan for eiendom
- </a>
- </xsl:if>
- <label>Velg et annet bygg på eiendommen</label>
- <xsl:call-template
name="select_buildings_on_property" />
- </div>
-
-
- <!-- ===================== COLOR ICON MAP
================= -->
- <xsl:call-template name="icon_color_map" />
-
- <!-- ===================== FILTERS =================
-->
- <xsl:call-template name="calendar_filters" >
- <xsl:with-param
name="view_period">year</xsl:with-param>
- </xsl:call-template>
-
- <!-- ===================== CALENDAR NAVIGATION
================= -->
- <xsl:call-template name="nav_calendar_year">
- <xsl:with-param
name="view">VIEW_CONTROLS_FOR_LOCATION</xsl:with-param>
- </xsl:call-template>
- </div>
-
- <div id="cal_wrp">
- <h2>Bygg/eiendom</h2>
- <table id="calendar" class="year">
- <tr class="heading">
- <th
class="title"><span>Tittel</span></th>
- <th
class="assigned"><span>Tildelt</span></th>
- <th
class="frequency"><span>Frekvens</span></th>
- <xsl:for-each select="heading_array">
- <th>
- <a>
- <xsl:attribute
name="href">
-
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
-
<xsl:text>&year=</xsl:text>
-
<xsl:value-of select="//current_year"/>
-
<xsl:text>&location_code=</xsl:text>
-
<xsl:value-of select="//current_location/location_code"/>
-
<xsl:text>&month=</xsl:text>
-
<xsl:number/>
-
<xsl:value-of select="$session_url"/>
- </xsl:attribute>
-
- <xsl:variable
name="month_str">short_month <xsl:number/> capitalized</xsl:variable>
- <xsl:value-of
select="php:function('lang', $month_str)" />
- </a>
+ <div id="cal_wrp">
+ <h2>Bygg/eiendom</h2>
+ <table id="calendar" class="year">
+ <tr class="heading">
+ <th class="title">
+ <span>Tittel</span>
</th>
- </xsl:for-each>
- </tr>
-
- <xsl:choose>
- <xsl:when
test="controls_calendar_array/child::node()">
- <xsl:for-each select="controls_calendar_array">
- <xsl:variable
name="control_id"><xsl:value-of select="control/id"/></xsl:variable>
- <tr>
- <xsl:choose>
- <xsl:when test="(position()
mod 2) != 1">
- <xsl:attribute
name="class">odd</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute
name="class">even</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- <td class="title">
- <a class="show-control-details">
-
<xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicontrol.get_control_details</xsl:text>
-
<xsl:text>&control_id=</xsl:text>
-
<xsl:value-of select="control/id"/>
-
<xsl:text>&phpgw_return_as=stripped_html</xsl:text>
-
<xsl:value-of select="$session_url"/>
-
</xsl:attribute>
-
<xsl:value-of select="control/title"/>
- </a>
- </td>
- <td class="assigned">
- <span><xsl:value-of
select="control/responsibility_name"/></span>
- </td>
- <td class="frequency">
- <span>
- <xsl:choose>
- <xsl:when
test="control/repeat_interval = 1 and control/repeat_type < 3">
- <span
class="pre">Hver</span>
- </xsl:when>
- <xsl:when
test="control/repeat_interval = 1 and control/repeat_type = 3">
- <span
class="pre">Hvert</span>
- </xsl:when>
- <xsl:when
test="control/repeat_interval = 2">
- <span
class="pre">Annenhver</span>
- </xsl:when>
- <xsl:when
test="control/repeat_interval > 2">
- <span
class="pre">Hver</span><span><xsl:value-of
select="control/repeat_interval"/>.</span>
- </xsl:when>
- </xsl:choose>
-
- <span class="val"><xsl:value-of
select="control/repeat_type_label"/></span>
- </span>
- </td>
- <xsl:for-each
select="calendar_array">
- <td>
-
<xsl:call-template name="check_list_status_manager" >
-
<xsl:with-param name="location_code"><xsl:value-of
select="//current_location/location_code"/></xsl:with-param>
-
</xsl:call-template>
- </td>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <tr class="cal_info_msg"><td
colspan="3"><xsl:value-of select="php:function('lang',
'error_msg_no_controls_in_period')" /></td></tr>
- </xsl:otherwise>
- </xsl:choose>
- </table>
-
- <h2 class="components">Komponenter</h2>
- <xsl:choose>
- <xsl:when
test="components_calendar_array/child::node()">
- <xsl:for-each select="components_calendar_array">
- <h3><xsl:value-of select="component/xml_short_desc"/></h3>
-
- <table id="calendar" class="year">
- <tr class="heading">
- <th
class="title"><span>Tittel</span></th>
- <th
class="assigned"><span>Tildelt</span></th>
- <th
class="frequency"><span>Frekvens</span></th>
- <xsl:for-each
select="//heading_array">
+ <th class="assigned">
+ <span>Tildelt</span>
+ </th>
+ <th class="frequency">
+ <span>Frekvens</span>
+ </th>
+ <xsl:for-each
select="heading_array">
<th>
<a>
<xsl:attribute name="href">
@@ -251,80 +170,214 @@
<xsl:number/>
<xsl:value-of select="$session_url"/>
</xsl:attribute>
-
-
<xsl:variable name="month_str">short_month <xsl:number/>
capitalized</xsl:variable>
+
+
<xsl:variable name="month_str">short_month
+
<xsl:number/> capitalized
+
</xsl:variable>
<xsl:value-of select="php:function('lang', $month_str)" />
- </a>
+ </a>
</th>
</xsl:for-each>
</tr>
-
- <xsl:for-each select="controls_calendar">
- <xsl:variable
name="control_id"><xsl:value-of select="control/id"/></xsl:variable>
-
- <tr>
- <xsl:choose>
- <xsl:when
test="(position() mod 2) != 1">
- <xsl:attribute
name="class">odd</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute
name="class">even</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- <td
class="title">
- <a class="show-control-details">
-
<xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicontrol.get_control_details</xsl:text>
-
<xsl:text>&control_id=</xsl:text>
-
<xsl:value-of select="control/id"/>
-
<xsl:text>&phpgw_return_as=stripped_html</xsl:text>
-
<xsl:value-of select="$session_url"/>
-
</xsl:attribute>
-
<xsl:value-of select="control/title"/>
- </a>
+
+ <xsl:choose>
+ <xsl:when
test="controls_calendar_array/child::node()">
+ <xsl:for-each
select="controls_calendar_array">
+ <xsl:variable
name="control_id">
+
<xsl:value-of select="control/id"/>
+ </xsl:variable>
+ <tr>
+
<xsl:choose>
+
<xsl:when test="(position() mod 2) != 1">
+
<xsl:attribute name="class">odd</xsl:attribute>
+
</xsl:when>
+
<xsl:otherwise>
+
<xsl:attribute name="class">even</xsl:attribute>
+
</xsl:otherwise>
+
</xsl:choose>
+ <td
class="title">
+
<a class="show-control-details">
+
<xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicontrol.get_control_details</xsl:text>
+
<xsl:text>&control_id=</xsl:text>
+
<xsl:value-of select="control/id"/>
+
<xsl:text>&phpgw_return_as=stripped_html</xsl:text>
+
<xsl:value-of select="$session_url"/>
+
</xsl:attribute>
+
<xsl:value-of select="control/title"/>
+
</a>
+ </td>
+ <td
class="assigned">
+
<span>
+
<xsl:value-of select="control/responsibility_name"/>
+
</span>
+ </td>
+ <td
class="frequency">
+
<span>
+
<xsl:choose>
+
<xsl:when test="control/repeat_interval = 1 and
control/repeat_type < 3">
+
<span class="pre">Hver</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval = 1 and
control/repeat_type = 3">
+
<span class="pre">Hvert</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval = 2">
+
<span class="pre">Annenhver</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval > 2">
+
<span class="pre">Hver</span>
+
<span>
+
<xsl:value-of
select="control/repeat_interval"/>.
+
</span>
+
</xsl:when>
+
</xsl:choose>
+
+
<span class="val">
+
<xsl:value-of select="control/repeat_type_label"/>
+
</span>
+
</span>
+ </td>
+
<xsl:for-each select="calendar_array">
+
<td>
+
<xsl:call-template name="check_list_status_manager" >
+
<xsl:with-param name="location_code">
+
<xsl:value-of
select="//current_location/location_code"/>
+
</xsl:with-param>
+
</xsl:call-template>
+
</td>
+
</xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <tr
class="cal_info_msg">
+ <td colspan="3">
+
<xsl:value-of select="php:function('lang', 'error_msg_no_controls_in_period')"
/>
</td>
- <td
class="assigned">
-
<span><xsl:value-of select="control/responsibility_name"/></span>
- </td>
- <td
class="frequency">
- <span>
-
<xsl:choose>
-
<xsl:when test="control/repeat_interval = 1 and control/repeat_type < 3">
-
<span class="pre">Hver</span>
-
</xsl:when>
-
<xsl:when test="control/repeat_interval = 1 and control/repeat_type = 3">
-
<span class="pre">Hvert</span>
-
</xsl:when>
-
<xsl:when test="control/repeat_interval = 2">
-
<span class="pre">Annenhver</span>
-
</xsl:when>
-
<xsl:when test="control/repeat_interval > 2">
-
<span class="pre">Hver</span><span><xsl:value-of
select="control/repeat_interval"/>.</span>
-
</xsl:when>
-
</xsl:choose>
-
- <span
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
- </span>
- </td>
- <xsl:for-each
select="calendar_array">
- <td>
-
<xsl:call-template name="check_list_status_manager" >
-
<xsl:with-param name="location_code"><xsl:value-of
select="//current_location/location_code"/></xsl:with-param>
-
</xsl:call-template>
- </td>
+ </tr>
+ </xsl:otherwise>
+ </xsl:choose>
+ </table>
+
+ <h2 class="components">Komponenter</h2>
+ <xsl:choose>
+ <xsl:when
test="components_calendar_array/child::node()">
+ <xsl:for-each
select="components_calendar_array">
+ <h3>
+ <xsl:value-of
select="component/xml_short_desc"/>
+ </h3>
+
+ <table id="calendar"
class="year">
+ <tr
class="heading">
+ <th
class="title">
+
<span>Tittel</span>
+ </th>
+ <th
class="assigned">
+
<span>Tildelt</span>
+ </th>
+ <th
class="frequency">
+
<span>Frekvens</span>
+ </th>
+
<xsl:for-each select="//heading_array">
+
<th>
+
<a>
+
<xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+
<xsl:text>&year=</xsl:text>
+
<xsl:value-of select="//current_year"/>
+
<xsl:text>&location_code=</xsl:text>
+
<xsl:value-of
select="//current_location/location_code"/>
+
<xsl:text>&month=</xsl:text>
+
<xsl:number/>
+
<xsl:value-of select="$session_url"/>
+
</xsl:attribute>
+
+
<xsl:variable name="month_str">short_month
+
<xsl:number/> capitalized
+
</xsl:variable>
+
<xsl:value-of select="php:function('lang', $month_str)" />
+
</a>
+
</th>
+
</xsl:for-each>
+ </tr>
+
+ <xsl:for-each
select="controls_calendar">
+
<xsl:variable name="control_id">
+
<xsl:value-of select="control/id"/>
+
</xsl:variable>
+
+ <tr>
+
<xsl:choose>
+
<xsl:when test="(position() mod 2) != 1">
+
<xsl:attribute name="class">odd</xsl:attribute>
+
</xsl:when>
+
<xsl:otherwise>
+
<xsl:attribute name="class">even</xsl:attribute>
+
</xsl:otherwise>
+
</xsl:choose>
+
<td class="title">
+
<a class="show-control-details">
+
<xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicontrol.get_control_details</xsl:text>
+
<xsl:text>&control_id=</xsl:text>
+
<xsl:value-of select="control/id"/>
+
<xsl:text>&phpgw_return_as=stripped_html</xsl:text>
+
<xsl:value-of select="$session_url"/>
+
</xsl:attribute>
+
<xsl:value-of select="control/title"/>
+
</a>
+
</td>
+
<td class="assigned">
+
<span>
+
<xsl:value-of select="control/responsibility_name"/>
+
</span>
+
</td>
+
<td class="frequency">
+
<span>
+
<xsl:choose>
+
<xsl:when test="control/repeat_interval = 1 and
control/repeat_type < 3">
+
<span class="pre">Hver</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval = 1 and
control/repeat_type = 3">
+
<span class="pre">Hvert</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval = 2">
+
<span class="pre">Annenhver</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval > 2">
+
<span class="pre">Hver</span>
+
<span>
+
<xsl:value-of
select="control/repeat_interval"/>.
+
</span>
+
</xsl:when>
+
</xsl:choose>
+
+
<span class="val">
+
<xsl:value-of select="control/repeat_type_label"/>
+
</span>
+
</span>
+
</td>
+
<xsl:for-each select="calendar_array">
+
<td>
+
<xsl:call-template name="check_list_status_manager" >
+
<xsl:with-param name="location_code">
+
<xsl:value-of
select="//current_location/location_code"/>
+
</xsl:with-param>
+
</xsl:call-template>
+
</td>
+
</xsl:for-each>
+ </tr>
</xsl:for-each>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <div id="calendar">
- <p class="no-comp-msg">Ingen
komponenter tilknyttet kontroll</p>
- </div>
- </xsl:otherwise>
- </xsl:choose>
+ </table>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <div id="calendar">
+ <p
class="no-comp-msg">Ingen komponenter tilknyttet kontroll</p>
+ </div>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </div>
</div>
-</div>
-</div>
</xsl:template>
Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css 2013-01-29 09:35:43 UTC
(rev 10720)
+++ trunk/controller/templates/base/css/base.css 2013-01-29 09:51:33 UTC
(rev 10721)
@@ -521,7 +521,7 @@
}
#control_item_details .styleWrp {
- background: none repeat scroll 0 0 #F2F8FF;
+ background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #DBE5EF;
border-radius: 4px;
padding: 10px;
@@ -666,6 +666,7 @@
padding: 0;
position: relative;
}
+
ul.items li.list_item{
position:relative;
z-index: 1;
@@ -679,18 +680,24 @@
padding: 5px;
}
-#control_items form{
- margin-bottom: 20px;
+#control_items form {
+ margin-bottom: 25px;
}
+#control_items ul{
+ margin-bottom: 10px;
+}
+
/* ======================================= DRAG LIST
========================================= */
.drag_group{
margin-bottom: 10px;
}
+
.drag_group a:hover{
cursor: move;
}
+
.drag_elem{
z-index: 100;
position:absolute;
@@ -709,6 +716,7 @@
margin-bottom: 6px;
margin-top: 0;
}
+
ul.expand_list h4 img {
height: 12px;
}
@@ -727,6 +735,7 @@
padding-left: 5px;
vertical-align: middle;
}
+
ul.expand_list .expand_item {
display: none;
}
@@ -744,10 +753,12 @@
margin: 10px 0 15px 0;
width: 120px;
}
+
.delete {
cursor: pointer;
margin-left: 5px;
}
+
.yui-navset .yui-content.tab_content {
padding: 20px;
}
@@ -1151,6 +1162,12 @@
margin-bottom: 10px;
}
+#no-loc #search-location {
+ clear: both;
+ float: left;
+ margin-bottom: 10px;
+}
+
#search-location-name {
margin: 2px 0 0;
width: 16em;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10721] Calendar view when no location is selected,
Torstein <=