[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9948] Formatering fra Netbeans
From: |
Torstein |
Subject: |
[Fmsystem-commits] [9948] Formatering fra Netbeans |
Date: |
Fri, 31 Aug 2012 09:06:17 +0000 |
Revision: 9948
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9948
Author: vator
Date: 2012-08-31 09:06:16 +0000 (Fri, 31 Aug 2012)
Log Message:
-----------
Formatering fra Netbeans
Modified Paths:
--------------
trunk/controller/inc/component/class.check_list_status_info.inc.php
trunk/controller/inc/component/class.check_list_status_manager.inc.php
trunk/controller/inc/component/class.date_generator.inc.php
trunk/controller/inc/component/class.month_calendar.inc.php
trunk/controller/inc/component/class.status_agg_month_info.inc.php
trunk/controller/inc/component/class.year_calendar.inc.php
trunk/controller/inc/component/class.year_calendar_agg.inc.php
trunk/controller/inc/helper/class.check_list_status_updater.inc.php
trunk/controller/inc/helper/class.date_helper.inc.php
trunk/controller/inc/helper/class.location_finder.inc.php
trunk/controller/inc/model/class.check_item.inc.php
trunk/controller/inc/model/class.check_item_case.inc.php
trunk/controller/inc/model/class.check_list.inc.php
trunk/controller/inc/model/class.component.inc.php
trunk/controller/inc/model/class.control.inc.php
trunk/controller/inc/model/class.control_area.inc.php
trunk/controller/inc/model/class.control_group.inc.php
trunk/controller/inc/model/class.control_group_list.inc.php
trunk/controller/inc/model/class.control_item.inc.php
trunk/controller/inc/model/class.control_item_list.inc.php
trunk/controller/inc/model/class.control_item_option.inc.php
trunk/controller/inc/model/class.control_location.inc.php
trunk/controller/inc/model/class.document.inc.php
trunk/controller/inc/model/class.model.inc.php
trunk/controller/inc/model/class.procedure.inc.php
trunk/controller/templates/base/add_component_to_control.xsl
trunk/controller/templates/base/add_component_to_control_group.xsl
trunk/controller/templates/base/app_data.xsl
trunk/controller/templates/base/calendar/calendar_filters.xsl
trunk/controller/templates/base/calendar/check_list_status_manager.xsl
trunk/controller/templates/base/calendar/icon_color_map.xsl
trunk/controller/templates/base/calendar/nav_calendar_month.xsl
trunk/controller/templates/base/calendar/nav_calendar_year.xsl
trunk/controller/templates/base/calendar/select_buildings_on_property.xsl
trunk/controller/templates/base/calendar/select_my_locations.xsl
trunk/controller/templates/base/calendar/view_calendar_month.xsl
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
trunk/controller/templates/base/calendar/view_calendar_year.xsl
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
trunk/controller/templates/base/case/create_case_message.xsl
trunk/controller/templates/base/case/view_case_message.xsl
trunk/controller/templates/base/check_list/add_case.xsl
trunk/controller/templates/base/check_list/add_check_list.xsl
trunk/controller/templates/base/check_list/cases_tab_menu.xsl
trunk/controller/templates/base/check_list/check_list_tab_menu.xsl
trunk/controller/templates/base/check_list/edit_check_list.xsl
trunk/controller/templates/base/check_list/print_check_list.xsl
trunk/controller/templates/base/check_list/view_cases_for_check_list.xsl
trunk/controller/templates/base/check_list/view_check_list.xsl
trunk/controller/templates/base/check_list/view_check_lists.xsl
trunk/controller/templates/base/check_list/view_closed_cases.xsl
trunk/controller/templates/base/check_list/view_control_details.xsl
trunk/controller/templates/base/check_list/view_control_info.xsl
trunk/controller/templates/base/check_list/view_control_items.xsl
trunk/controller/templates/base/check_list/view_open_cases.xsl
trunk/controller/templates/base/common.xsl
trunk/controller/templates/base/component.xsl
trunk/controller/templates/base/config.tpl
trunk/controller/templates/base/control/control.xsl
trunk/controller/templates/base/control/control_tabs.xsl
trunk/controller/templates/base/control/controls_datatable.xsl
trunk/controller/templates/base/control_component.xsl
trunk/controller/templates/base/control_component_tabs.xsl
trunk/controller/templates/base/control_group/control_group.xsl
trunk/controller/templates/base/control_group/control_group_items.xsl
trunk/controller/templates/base/control_group/control_group_tabs.xsl
trunk/controller/templates/base/control_group/control_groups.xsl
trunk/controller/templates/base/control_group/control_groups_datatable.xsl
trunk/controller/templates/base/control_group_component_tabs.xsl
trunk/controller/templates/base/control_item/choose_control_items.xsl
trunk/controller/templates/base/control_item/control_item.xsl
trunk/controller/templates/base/control_item/control_item_option.xsl
trunk/controller/templates/base/control_item/control_items_datatable.xsl
trunk/controller/templates/base/control_item/sort_check_list.xsl
trunk/controller/templates/base/control_item/view_control_item_list.xsl
trunk/controller/templates/base/control_location/control_location_tabs.xsl
trunk/controller/templates/base/control_location/control_locations.xsl
trunk/controller/templates/base/control_location/register_control_to_component.xsl
trunk/controller/templates/base/control_location/register_control_to_location.xsl
trunk/controller/templates/base/control_location/view_locations_for_control.xsl
trunk/controller/templates/base/css/base.css
trunk/controller/templates/base/datatable.xsl
trunk/controller/templates/base/procedure/print_procedure.xsl
trunk/controller/templates/base/procedure/procedure_documents.xsl
trunk/controller/templates/base/procedure/procedure_item.xsl
trunk/controller/templates/base/procedure/procedure_tabs.xsl
trunk/controller/templates/base/procedure/procedures_datatable.xsl
trunk/controller/templates/base/procedure/view_procedures_for_control.xsl
trunk/controller/templates/base/view_component_for_control.xsl
trunk/controller/templates/base/view_component_for_control_group.xsl
trunk/controller/templates/base/yui_booking_i18n.xsl
Modified: trunk/controller/inc/component/class.check_list_status_info.inc.php
===================================================================
--- trunk/controller/inc/component/class.check_list_status_info.inc.php
2012-08-31 08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/component/class.check_list_status_info.inc.php
2012-08-31 09:06:16 UTC (rev 9948)
@@ -1,150 +1,163 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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$
- */
- class check_list_status_info
- {
- private $check_list_id;
- private $control_id;
- private $status;
- private $status_text;
- private $deadline_date_ts;
- private $deadline_date_txt;
- private $info_text;
- private $location_code;
- private $component_id;
- private $location_id;
- private $type;
- private $num_open_cases;
-
- public function __construct(){}
-
- public function set_check_list_id($check_list_id)
- {
- $this->check_list_id = $check_list_id;
- }
-
- public function get_check_list_id() { return
$this->check_list_id; }
-
- public function set_control_id($control_id)
- {
- $this->control_id = $control_id;
- }
-
- public function get_control_id() { return $this->control_id; }
-
- public function set_status($status)
- {
- $this->status = $status;
- }
-
- public function get_status() { return $this->status; }
-
- public function set_status_text($status_text)
- {
- $this->status_text = $status_text;
- }
-
- public function get_status_text() { return $this->status_text; }
-
- public function set_deadline_date_ts($deadline_date_ts)
- {
- $this->deadline_date_ts = $deadline_date_ts;
- }
-
- public function get_deadline_date_ts() { return
$this->deadline_date_ts; }
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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$
+ */
+class check_list_status_info {
- public function set_deadline_date_txt($deadline_date_txt)
- {
- $this->deadline_date_txt = $deadline_date_txt;
- }
-
- public function get_deadline_date_txt() { return
$this->deadline_date_txt; }
-
- public function set_info_text($info_text)
- {
- $this->info_text = $info_text;
- }
-
- public function get_info_text() { return $this->info_text; }
-
- public function set_location_code($location_code)
- {
- $this->location_code = $location_code;
- }
-
- public function get_location_code() { return
$this->location_code; }
-
- public function set_location_id($location_id)
- {
- $this->location_id = $location_id;
- }
-
- public function get_location_id() { return $this->location_id; }
-
- public function set_component_id($component_id)
- {
- $this->component_id = $component_id;
- }
-
- public function get_component_id() { return
$this->component_id; }
-
- public function get_type() { return $this->type; }
-
- public function set_type($type)
- {
- $this->type = $type;
- }
-
- public function set_num_open_cases($num_open_cases)
- {
- $this->num_open_cases = $num_open_cases;
- }
-
- public function get_num_open_cases() { return
$this->num_open_cases; }
-
-
- public function serialize()
- {
- return array(
- 'check_list_id' => $this->get_check_list_id(),
- 'control_id' => $this->get_control_id(),
- 'status' => $this->get_status(),
- 'status_text' => $this->get_status_text(),
- 'deadline_date_ts' =>
$this->get_deadline_date_ts(),
- 'deadline_date_txt' =>
$this->get_deadline_date_txt(),
- 'info_text' => $this->get_info_text(),
- 'location_code' => $this->get_location_code(),
- 'location_id' => $this->get_location_id(),
- 'component_id' => $this->get_component_id(),
- 'type' => $this->get_type(),
- 'num_open_cases' => $this->get_num_open_cases()
- );
- }
- }
+ private $check_list_id;
+ private $control_id;
+ private $status;
+ private $status_text;
+ private $deadline_date_ts;
+ private $deadline_date_txt;
+ private $info_text;
+ private $location_code;
+ private $component_id;
+ private $location_id;
+ private $type;
+ private $num_open_cases;
+
+ public function __construct() {
+
+ }
+
+ public function set_check_list_id($check_list_id) {
+ $this->check_list_id = $check_list_id;
+ }
+
+ public function get_check_list_id() {
+ return $this->check_list_id;
+ }
+
+ public function set_control_id($control_id) {
+ $this->control_id = $control_id;
+ }
+
+ public function get_control_id() {
+ return $this->control_id;
+ }
+
+ public function set_status($status) {
+ $this->status = $status;
+ }
+
+ public function get_status() {
+ return $this->status;
+ }
+
+ public function set_status_text($status_text) {
+ $this->status_text = $status_text;
+ }
+
+ public function get_status_text() {
+ return $this->status_text;
+ }
+
+ public function set_deadline_date_ts($deadline_date_ts) {
+ $this->deadline_date_ts = $deadline_date_ts;
+ }
+
+ public function get_deadline_date_ts() {
+ return $this->deadline_date_ts;
+ }
+
+ public function set_deadline_date_txt($deadline_date_txt) {
+ $this->deadline_date_txt = $deadline_date_txt;
+ }
+
+ public function get_deadline_date_txt() {
+ return $this->deadline_date_txt;
+ }
+
+ public function set_info_text($info_text) {
+ $this->info_text = $info_text;
+ }
+
+ public function get_info_text() {
+ return $this->info_text;
+ }
+
+ public function set_location_code($location_code) {
+ $this->location_code = $location_code;
+ }
+
+ public function get_location_code() {
+ return $this->location_code;
+ }
+
+ public function set_location_id($location_id) {
+ $this->location_id = $location_id;
+ }
+
+ public function get_location_id() {
+ return $this->location_id;
+ }
+
+ public function set_component_id($component_id) {
+ $this->component_id = $component_id;
+ }
+
+ public function get_component_id() {
+ return $this->component_id;
+ }
+
+ public function get_type() {
+ return $this->type;
+ }
+
+ public function set_type($type) {
+ $this->type = $type;
+ }
+
+ public function set_num_open_cases($num_open_cases) {
+ $this->num_open_cases = $num_open_cases;
+ }
+
+ public function get_num_open_cases() {
+ return $this->num_open_cases;
+ }
+
+ public function serialize() {
+ return array(
+ 'check_list_id' => $this->get_check_list_id(),
+ 'control_id' => $this->get_control_id(),
+ 'status' => $this->get_status(),
+ 'status_text' => $this->get_status_text(),
+ 'deadline_date_ts' => $this->get_deadline_date_ts(),
+ 'deadline_date_txt' => $this->get_deadline_date_txt(),
+ 'info_text' => $this->get_info_text(),
+ 'location_code' => $this->get_location_code(),
+ 'location_id' => $this->get_location_id(),
+ 'component_id' => $this->get_component_id(),
+ 'type' => $this->get_type(),
+ 'num_open_cases' => $this->get_num_open_cases()
+ );
+ }
+
+}
Modified: trunk/controller/inc/component/class.check_list_status_manager.inc.php
===================================================================
--- trunk/controller/inc/component/class.check_list_status_manager.inc.php
2012-08-31 08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/component/class.check_list_status_manager.inc.php
2012-08-31 09:06:16 UTC (rev 9948)
@@ -1,111 +1,100 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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: class.check_list_status_info.inc.php 8885 2012-02-16
07:41:15Z vator $
- */
- include_class('controller', 'check_list_status_info', 'inc/component/');
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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: class.check_list_status_info.inc.php 8885 2012-02-16
07:41:15Z vator $
+ */
+include_class('controller', 'check_list_status_info', 'inc/component/');
- class check_list_status_manager
- {
- private $check_list;
- private $type;
-
- public function __construct($check_list, $type) {
- $this->check_list = $check_list;
- $this->type = $type;
- }
-
- function get_status_for_check_list() {
- $check_list_status_info = new check_list_status_info();
-
- $todays_date_ts = $this->get_todays_date_ts();
-
- if( $this->check_list->get_id() == 0){
-
- if($this->check_list->get_deadline() <
$todays_date_ts){
- $status = "CONTROL_NOT_DONE";
- }else{
- $status = "CONTROL_REGISTERED";
- }
- }else {
- if($this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date()
> 0 & $this->check_list->get_deadline() >= $todays_date_ts)
- {
- $status = "CONTROL_PLANNED";
- }
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_deadline() <
$todays_date_ts )
- {
- $status =
"CONTROL_NOT_DONE_WITH_CHECKLIST";
- }
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date()
> 0 & $this->check_list->get_deadline() < $todays_date_ts )
- {
- $status =
"CONTROL_NOT_DONE_WITH_PLANNED_DATE";
- }
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() >
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() ==
0)
- {
- $status =
"CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS";
- }
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() <
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() ==
0)
- {
- $status =
"CONTROL_DONE_IN_TIME_WITHOUT_ERRORS";
- }
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_num_open_cases() >
0){
- $status = "CONTROL_DONE_WITH_ERRORS";
-
-
$check_list_status_info->set_num_open_cases($this->check_list->get_num_open_cases());
- }
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_CANCELED)
- {
- $status = "CONTROL_CANCELED";
- }
-
- $check_list_status_info->set_check_list_id(
$this->check_list->get_id() );
- }
-
- $check_list_status_info->set_control_id(
$this->check_list->get_control_id() );
- $check_list_status_info->set_deadline_date_txt(
date("d/m-Y", $this->check_list->get_deadline()) );
- $check_list_status_info->set_deadline_date_ts(
$this->check_list->get_deadline() );
- $check_list_status_info->set_type( $this->type );
-
- if($this->type == "component"){
- $check_list_status_info->set_component_id(
$this->check_list->get_component_id() );
- $check_list_status_info->set_location_id(
$this->check_list->get_location_id() );
- }else {
- $check_list_status_info->set_location_code(
$this->check_list->get_location_code() );
- }
-
- $check_list_status_info->set_status($status);
-
- return $check_list_status_info;
- }
-
- public static function get_todays_date_ts(){
- $todays_date_ts = mktime(0,0,0,date("m"), date("d"),
date("Y"));
-
- return $todays_date_ts;
- }
- }
+class check_list_status_manager {
+
+ private $check_list;
+ private $type;
+
+ public function __construct($check_list, $type) {
+ $this->check_list = $check_list;
+ $this->type = $type;
+ }
+
+ function get_status_for_check_list() {
+ $check_list_status_info = new check_list_status_info();
+
+ $todays_date_ts = $this->get_todays_date_ts();
+
+ if ($this->check_list->get_id() == 0) {
+
+ if ($this->check_list->get_deadline() < $todays_date_ts) {
+ $status = "CONTROL_NOT_DONE";
+ } else {
+ $status = "CONTROL_REGISTERED";
+ }
+ } else {
+ if ($this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date()
> 0 & $this->check_list->get_deadline() >= $todays_date_ts) {
+ $status = "CONTROL_PLANNED";
+ } else if ($this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_deadline() <
$todays_date_ts) {
+ $status = "CONTROL_NOT_DONE_WITH_CHECKLIST";
+ } else if ($this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date()
> 0 & $this->check_list->get_deadline() < $todays_date_ts) {
+ $status = "CONTROL_NOT_DONE_WITH_PLANNED_DATE";
+ } else if ($this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() >
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() ==
0) {
+ $status = "CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS";
+ } else if ($this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() <
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() ==
0) {
+ $status = "CONTROL_DONE_IN_TIME_WITHOUT_ERRORS";
+ } else if ($this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_num_open_cases() >
0) {
+ $status = "CONTROL_DONE_WITH_ERRORS";
+
+
$check_list_status_info->set_num_open_cases($this->check_list->get_num_open_cases());
+ } else if ($this->check_list->get_status() ==
controller_check_list::STATUS_CANCELED) {
+ $status = "CONTROL_CANCELED";
+ }
+
+ $check_list_status_info->set_check_list_id($this->check_list->get_id());
+ }
+
+
$check_list_status_info->set_control_id($this->check_list->get_control_id());
+ $check_list_status_info->set_deadline_date_txt(date("d/m-Y",
$this->check_list->get_deadline()));
+
$check_list_status_info->set_deadline_date_ts($this->check_list->get_deadline());
+ $check_list_status_info->set_type($this->type);
+
+ if ($this->type == "component") {
+
$check_list_status_info->set_component_id($this->check_list->get_component_id());
+
$check_list_status_info->set_location_id($this->check_list->get_location_id());
+ } else {
+
$check_list_status_info->set_location_code($this->check_list->get_location_code());
+ }
+
+ $check_list_status_info->set_status($status);
+
+ return $check_list_status_info;
+ }
+
+ public static function get_todays_date_ts() {
+ $todays_date_ts = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
+
+ return $todays_date_ts;
+ }
+
+}
Modified: trunk/controller/inc/component/class.date_generator.inc.php
===================================================================
--- trunk/controller/inc/component/class.date_generator.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/component/class.date_generator.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -4,19 +4,18 @@
* repeat type(day, week, month, year) and repeat interval
*/
-class date_generator
-{
- private $start_date;
- private $end_date;
- private $period_start_date;
- private $period_end_date;
- private $repeat_type;
- private $repeat_interval;
-
- private $calendar_array = array();
+class date_generator {
- public function __construct($start_date, $end_date, $period_start_date,
$period_end_date, $repeat_type, $repeat_interval){
- $this->start_date = $start_date;
+ private $start_date;
+ private $end_date;
+ private $period_start_date;
+ private $period_end_date;
+ private $repeat_type;
+ private $repeat_interval;
+ private $calendar_array = array();
+
+ public function __construct($start_date, $end_date, $period_start_date,
$period_end_date, $repeat_type, $repeat_interval) {
+ $this->start_date = $start_date;
$this->end_date = $end_date;
$this->period_start_date = $period_start_date;
$this->period_end_date = $period_end_date;
@@ -25,122 +24,96 @@
$this->generate_calendar();
}
-
- function generate_calendar(){
- $control_start_date = $this->find_control_start_date();
- $control_end_date = $this->end_date;
-
- if($control_end_date == null)
- {
- $control_end_date = $this->period_end_date;
- }
-
- $period_start_date = $this->find_start_date_for_period(
$control_start_date );
-
- $interval_date = $period_start_date;
-
- while(($interval_date < $this->period_end_date) &&
($interval_date <= $control_end_date))
- {
- $this->calendar_array[] = $interval_date;
-
- if($this->repeat_type == 0)
- {
- $interval_date = mktime(0,0,0, date("m",
$interval_date), date("d", $interval_date)+$this->repeat_interval, date("Y",
$interval_date));
- }
- else if($this->repeat_type == 1)
- {
- $interval_date = mktime(0,0,0, date("m",
$interval_date), date("d", $interval_date) + ($this->repeat_interval * 7),
date("Y", $interval_date));
- }
- else if($this->repeat_type == 2)
- {
- $month = date("m",
$interval_date)+$this->repeat_interval;
- $year = date("Y", $interval_date);
- if($month > 12){
- $month = $month % 12;
- $year += 1;
- }
-
- $num_days_in_month =
cal_days_in_month(CAL_GREGORIAN, $month, $year);
- $interval_date = mktime(0,0,0, $month,
$num_days_in_month, $year);
- }
- else if($this->repeat_type == 3)
- {
- $interval_date = mktime(0,0,0, date("m",
$interval_date), date("d", $interval_date), date("Y",
$interval_date)+$this->repeat_interval);
- }
- }
+
+ function generate_calendar() {
+ $control_start_date = $this->find_control_start_date();
+ $control_end_date = $this->end_date;
+
+ if ($control_end_date == null) {
+ $control_end_date = $this->period_end_date;
+ }
+
+ $period_start_date =
$this->find_start_date_for_period($control_start_date);
+
+ $interval_date = $period_start_date;
+
+ while (($interval_date < $this->period_end_date) && ($interval_date <=
$control_end_date)) {
+ $this->calendar_array[] = $interval_date;
+
+ if ($this->repeat_type == 0) {
+ $interval_date = mktime(0, 0, 0, date("m", $interval_date), date("d",
$interval_date) + $this->repeat_interval, date("Y", $interval_date));
+ } else if ($this->repeat_type == 1) {
+ $interval_date = mktime(0, 0, 0, date("m", $interval_date), date("d",
$interval_date) + ($this->repeat_interval * 7), date("Y", $interval_date));
+ } else if ($this->repeat_type == 2) {
+ $month = date("m", $interval_date) + $this->repeat_interval;
+ $year = date("Y", $interval_date);
+ if ($month > 12) {
+ $month = $month % 12;
+ $year += 1;
+ }
+
+ $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $year);
+ $interval_date = mktime(0, 0, 0, $month, $num_days_in_month, $year);
+ } else if ($this->repeat_type == 3) {
+ $interval_date = mktime(0, 0, 0, date("m", $interval_date), date("d",
$interval_date), date("Y", $interval_date) + $this->repeat_interval);
+ }
+ }
}
-
- public function find_control_start_date(){
-
- if( $this->repeat_type == 0 )
- {
- $control_start_date = $this->start_date;
- }
- else if( $this->repeat_type == 1 )
- {
- $control_start_date = $this->start_date;
-
- while(date("l", $control_start_date) != "Sunday")
- {
- $num_days_in_month =
cal_days_in_month(CAL_GREGORIAN, date("m", $control_start_date), date("y",
$control_start_date));
-
- if($num_days_in_month <= date("d",
$control_start_date) )
- {
- $control_start_date = mktime(0,0,0,
date("m", $control_start_date)+1, 1, date("Y", $control_start_date));
- }
- else
- {
- $control_start_date = mktime(0,0,0,
date("m", $control_start_date), date("d", $control_start_date)+1, date("Y",
$control_start_date));
- }
- }
- }
- else if( $this->repeat_type == 2 ){
- $num_days_in_month = cal_days_in_month(CAL_GREGORIAN,
date("m", $this->start_date), date("y", $this->start_date));
- $control_start_date = mktime(0,0,0, date("m",
$this->start_date), $num_days_in_month, date("y", $this->start_date));
- }
- else if( $this->repeat_type == 3 ){
- $num_days_in_month = cal_days_in_month(CAL_GREGORIAN,
12, date("y", $this->start_date));
- $control_start_date = mktime(0,0,0, 12,
$num_days_in_month, date("y", $this->start_date));
- }
-
- return $control_start_date;
+
+ public function find_control_start_date() {
+
+ if ($this->repeat_type == 0) {
+ $control_start_date = $this->start_date;
+ } else if ($this->repeat_type == 1) {
+ $control_start_date = $this->start_date;
+
+ while (date("l", $control_start_date) != "Sunday") {
+ $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, date("m",
$control_start_date), date("y", $control_start_date));
+
+ if ($num_days_in_month <= date("d", $control_start_date)) {
+ $control_start_date = mktime(0, 0, 0, date("m", $control_start_date)
+ 1, 1, date("Y", $control_start_date));
+ } else {
+ $control_start_date = mktime(0, 0, 0, date("m",
$control_start_date), date("d", $control_start_date) + 1, date("Y",
$control_start_date));
+ }
+ }
+ } else if ($this->repeat_type == 2) {
+ $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, date("m",
$this->start_date), date("y", $this->start_date));
+ $control_start_date = mktime(0, 0, 0, date("m", $this->start_date),
$num_days_in_month, date("y", $this->start_date));
+ } else if ($this->repeat_type == 3) {
+ $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 12, date("y",
$this->start_date));
+ $control_start_date = mktime(0, 0, 0, 12, $num_days_in_month, date("y",
$this->start_date));
+ }
+
+ return $control_start_date;
}
-
- public function find_start_date_for_period( $trail_period_start_date )
- {
- while( $trail_period_start_date < $this->period_start_date )
- {
- if($this->repeat_type == 0)
- {
- $trail_period_start_date = mktime(0,0,0,
date("m", $trail_period_start_date), date("d", $trail_period_start_date) +
$this->repeat_interval, date("Y", $trail_period_start_date));
- }
- else if($this->repeat_type == 1)
- {
- $trail_period_start_date = mktime(0,0,0,
date("m", $trail_period_start_date), date("d", $trail_period_start_date) +
($this->repeat_interval * 7), date("Y", $trail_period_start_date));
- }
- else if($this->repeat_type == 2)
- {
- $month = date("m", $trail_period_start_date) +
$this->repeat_interval;
- $year = date("Y", $trail_period_start_date);
-
- if($month > 12){
- $month = $month % 12;
- $year += 1;
- }
- $num_days_in_month =
cal_days_in_month(CAL_GREGORIAN, $month, $year);
- $trail_period_start_date = mktime(0,0,0,
$month, $num_days_in_month, $year);
- }
- else if($this->repeat_type == 3)
- {
- $trail_period_start_date = mktime(0,0,0,
date("m", $trail_period_start_date), date("d", $trail_period_start_date),
date("Y", $trail_period_start_date)+$this->repeat_interval);
- }
- }
-
- return $trail_period_start_date;
- }
-
- public function get_dates(){
- return $this->calendar_array;
- }
+ public function find_start_date_for_period($trail_period_start_date) {
+ while ($trail_period_start_date < $this->period_start_date) {
+ if ($this->repeat_type == 0) {
+ $trail_period_start_date = mktime(0, 0, 0, date("m",
$trail_period_start_date), date("d", $trail_period_start_date) +
$this->repeat_interval, date("Y", $trail_period_start_date));
+ } else if ($this->repeat_type == 1) {
+ $trail_period_start_date = mktime(0, 0, 0, date("m",
$trail_period_start_date), date("d", $trail_period_start_date) +
($this->repeat_interval * 7), date("Y", $trail_period_start_date));
+ } else if ($this->repeat_type == 2) {
+ $month = date("m", $trail_period_start_date) + $this->repeat_interval;
+ $year = date("Y", $trail_period_start_date);
+
+ if ($month > 12) {
+ $month = $month % 12;
+ $year += 1;
+ }
+
+ $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $year);
+ $trail_period_start_date = mktime(0, 0, 0, $month, $num_days_in_month,
$year);
+ } else if ($this->repeat_type == 3) {
+ $trail_period_start_date = mktime(0, 0, 0, date("m",
$trail_period_start_date), date("d", $trail_period_start_date), date("Y",
$trail_period_start_date) + $this->repeat_interval);
+ }
+ }
+
+ return $trail_period_start_date;
+ }
+
+ public function get_dates() {
+ return $this->calendar_array;
+ }
+
}
Modified: trunk/controller/inc/component/class.month_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.month_calendar.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/component/class.month_calendar.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -1,123 +1,115 @@
<?php
+
phpgw::import_class('controller.socheck_list');
include_class('controller', 'date_generator', 'inc/component/');
include_class('controller', 'check_list_status_info', 'inc/component/');
include_class('controller', 'check_list_status_manager', 'inc/component/');
-
+
/* This class transforms controls with checklists or controls with aggregated
number of open cases,
-* and puts these values in a calendar array for each control
-*/
+ * and puts these values in a calendar array for each control
+ */
class month_calendar {
- private $year;
- private $month;
- private $control;
- private $type;
- private $component;
- private $location_code;
- private $calendar_array = array();
-
- public function __construct($control, $year, $month, $component,
$location_code, $type){
+
+ private $year;
+ private $month;
+ private $control;
+ private $type;
+ private $component;
+ private $location_code;
+ private $calendar_array = array();
+
+ public function __construct($control, $year, $month, $component,
$location_code, $type) {
$this->control = $control;
- $this->year = $year;
+ $this->year = $year;
$this->month = $month;
$this->component = $component;
$this->location_code = $location_code;
$this->type = $type;
-
+
$this->init_calendar();
}
-
+
/* Initializes calendar by setting status for each month in calendar array.
- * - CONTROL_NOT_DONE if month date is in the past
- * - CONTROL_REGISTERED if month date is in the future */
- function init_calendar(){
- $ctr_start_date_ts = $this->control->get_start_date();
+ * - CONTROL_NOT_DONE if month date is in the past
+ * - CONTROL_REGISTERED if month date is in the future */
+
+ function init_calendar() {
+ $ctr_start_date_ts = $this->control->get_start_date();
$ctr_end_date_ts = $this->control->get_end_date();
$period_start_date_ts = $this->get_start_date_month_ts($this->year,
$this->month);
$period_end_date_ts = $this->get_next_start_date_month_ts($this->year,
$this->month);
$repeat_type = $this->control->get_repeat_type();
$repeat_interval = $this->control->get_repeat_interval();
- $num_days_in_month = cal_days_in_month(CAL_GREGORIAN,
$this->month, $this->year);
-
- for($i=1;$i<=$num_days_in_month;$i++)
- {
- $this->calendar_array[$i] = null;
- }
-
- $date_generator = new date_generator($ctr_start_date_ts,
$ctr_end_date_ts, $period_start_date_ts, $period_end_date_ts, $repeat_type,
$repeat_interval);
- $dates_array = $date_generator->get_dates();
-
- // Set status for control on each date to NOT DONE or REGISTERED
- foreach($dates_array as $date_ts)
- {
- $check_list = new controller_check_list();
- $check_list->set_deadline( $date_ts );
- $check_list->set_control_id( $this->control->get_id() );
-
- if($this->type == "component")
- {
- $check_list->set_component_id( $this->component->get_id() );
- $check_list->set_location_id(
$this->component->get_location_id() );
- $check_list_status_manager = new check_list_status_manager(
$check_list, "component" );
- }
- else
- {
- $check_list->set_location_code( $this->location_code );
- $check_list_status_manager = new check_list_status_manager(
$check_list, "location" );
- }
-
- $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
-
- $this->calendar_array[ date("j", $date_ts) ]["status"] =
$check_list_status_info->get_status();
- $this->calendar_array[ date("j", $date_ts) ]["info"] =
$check_list_status_info->serialize();
- }
- }
-
- public function build_calendar( $check_lists_array )
- {
- foreach($check_lists_array as $check_list){
- $check_list_status_manager = new
check_list_status_manager( $check_list );
- $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
-
- $this->calendar_array[ date("j",
$check_list->get_deadline()) ]["status"] =
$check_list_status_info->get_status();
- $this->calendar_array[ date("j",
$check_list->get_deadline()) ]["info"] = $check_list_status_info->serialize();
- }
-
- return $this->calendar_array;
- }
-
- public static function get_heading_array($year, $month)
- {
- $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $month,
$year);
- $heading_array = array();
-
- for($i=1;$i<=$num_days_in_month;$i++)
- {
- $heading_array[$i] = "$i";
- }
-
- return $heading_array;
- }
-
- public static function get_start_date_month_ts($year, $month){
- return strtotime("$month/01/$year");
- }
-
- public static function get_next_start_date_month_ts($year, $month)
- {
- if(($month + 1) > 12)
- {
- $to_month = 1;
- $to_year = $year + 1;
- }
- else
- {
- $to_month = $month + 1;
- $to_year = $year;
- }
-
- return strtotime("$to_month/01/$to_year");
- }
+ $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $this->month,
$this->year);
+
+ for ($i = 1; $i <= $num_days_in_month; $i++) {
+ $this->calendar_array[$i] = null;
+ }
+
+ $date_generator = new date_generator($ctr_start_date_ts, $ctr_end_date_ts,
$period_start_date_ts, $period_end_date_ts, $repeat_type, $repeat_interval);
+ $dates_array = $date_generator->get_dates();
+
+ // Set status for control on each date to NOT DONE or REGISTERED
+ foreach ($dates_array as $date_ts) {
+ $check_list = new controller_check_list();
+ $check_list->set_deadline($date_ts);
+ $check_list->set_control_id($this->control->get_id());
+
+ if ($this->type == "component") {
+ $check_list->set_component_id($this->component->get_id());
+ $check_list->set_location_id($this->component->get_location_id());
+ $check_list_status_manager = new
check_list_status_manager($check_list, "component");
+ } else {
+ $check_list->set_location_code($this->location_code);
+ $check_list_status_manager = new
check_list_status_manager($check_list, "location");
+ }
+
+ $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
+
+ $this->calendar_array[date("j", $date_ts)]["status"] =
$check_list_status_info->get_status();
+ $this->calendar_array[date("j", $date_ts)]["info"] =
$check_list_status_info->serialize();
+ }
+ }
+
+ public function build_calendar($check_lists_array) {
+ foreach ($check_lists_array as $check_list) {
+ $check_list_status_manager = new check_list_status_manager($check_list);
+ $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
+
+ $this->calendar_array[date("j", $check_list->get_deadline())]["status"]
= $check_list_status_info->get_status();
+ $this->calendar_array[date("j", $check_list->get_deadline())]["info"] =
$check_list_status_info->serialize();
+ }
+
+ return $this->calendar_array;
+ }
+
+ public static function get_heading_array($year, $month) {
+ $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $year);
+ $heading_array = array();
+
+ for ($i = 1; $i <= $num_days_in_month; $i++) {
+ $heading_array[$i] = "$i";
+ }
+
+ return $heading_array;
+ }
+
+ public static function get_start_date_month_ts($year, $month) {
+ return strtotime("$month/01/$year");
+ }
+
+ public static function get_next_start_date_month_ts($year, $month) {
+ if (($month + 1) > 12) {
+ $to_month = 1;
+ $to_year = $year + 1;
+ } else {
+ $to_month = $month + 1;
+ $to_year = $year;
+ }
+
+ return strtotime("$to_month/01/$to_year");
+ }
+
}
\ No newline at end of file
Modified: trunk/controller/inc/component/class.status_agg_month_info.inc.php
===================================================================
--- trunk/controller/inc/component/class.status_agg_month_info.inc.php
2012-08-31 08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/component/class.status_agg_month_info.inc.php
2012-08-31 09:06:16 UTC (rev 9948)
@@ -1,59 +1,63 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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: class.check_list_status_info.inc.php 8571 2012-01-15
13:46:27Z vator $
- */
- class status_agg_month_info
- {
- private $month_nr;
- private $agg_open_cases;
-
- public function __construct(){}
-
- public function set_month_nr($month_nr)
- {
- $this->month_nr = $month_nr;
- }
-
- public function get_month_nr() { return $this->month_nr; }
-
- public function set_agg_open_cases($agg_open_cases)
- {
- $this->agg_open_cases = $agg_open_cases;
- }
-
- public function get_agg_open_cases() { return
$this->agg_open_cases; }
-
- public function serialize()
- {
- return array(
- 'agg_open_cases' => $this->get_agg_open_cases(),
- 'month_nr' => $this->get_month_nr()
- );
- }
- }
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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: class.check_list_status_info.inc.php 8571 2012-01-15
13:46:27Z vator $
+ */
+class status_agg_month_info {
+
+ private $month_nr;
+ private $agg_open_cases;
+
+ public function __construct() {
+
+ }
+
+ public function set_month_nr($month_nr) {
+ $this->month_nr = $month_nr;
+ }
+
+ public function get_month_nr() {
+ return $this->month_nr;
+ }
+
+ public function set_agg_open_cases($agg_open_cases) {
+ $this->agg_open_cases = $agg_open_cases;
+ }
+
+ public function get_agg_open_cases() {
+ return $this->agg_open_cases;
+ }
+
+ public function serialize() {
+ return array(
+ 'agg_open_cases' => $this->get_agg_open_cases(),
+ 'month_nr' => $this->get_month_nr()
+ );
+ }
+
+}
Modified: trunk/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/component/class.year_calendar.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -1,125 +1,117 @@
<?php
+
phpgw::import_class('controller.socheck_list');
include_class('controller', 'date_generator', 'inc/component/');
include_class('controller', 'date_generator', 'inc/component/');
include_class('controller', 'check_list_status_info', 'inc/component/');
include_class('controller', 'check_list_status_manager', 'inc/component/');
include_class('controller', 'check_list', 'inc/model/');
-
class year_calendar {
- private $year;
- private $control;
- private $type;
- private $component;
- private $location_code;
- private $calendar_array = array();
-
- public function __construct($control, $year, $component, $location_code,
$type)
- {
+
+ private $year;
+ private $control;
+ private $type;
+ private $component;
+ private $location_code;
+ private $calendar_array = array();
+
+ public function __construct($control, $year, $component, $location_code,
$type) {
$this->year = $year;
$this->control = $control;
$this->component = $component;
$this->location_code = $location_code;
$this->type = $type;
-
+
$this->init_calendar();
}
-
+
/* Initializes calendar by setting status for each month in calendar array.
* - CONTROL_NOT_DONE if month date is in the past
- * - CONTROL_REGISTERED if month date is in the future */
- function init_calendar()
- {
- // Sets null values for twelve months in calendar array
- for($i = 1;$i <= 12;$i++)
- {
- $this->calendar_array[$i] = null;
+ * - CONTROL_REGISTERED if month date is in the future */
+
+ function init_calendar() {
+ // Sets null values for twelve months in calendar array
+ for ($i = 1; $i <= 12; $i++) {
+ $this->calendar_array[$i] = null;
}
-
+
$ctr_start_date_ts = $this->control->get_start_date();
$ctr_end_date_ts = $this->control->get_end_date();
$period_start_date_ts = $this->get_start_date_year_ts($this->year);
- $period_end_date_ts = $this->get_start_date_year_ts($this->year+1);
+ $period_end_date_ts = $this->get_start_date_year_ts($this->year + 1);
$repeat_type = $this->control->get_repeat_type();
$repeat_interval = $this->control->get_repeat_interval();
-
+
// Generates dates for time period with specified interval
$date_generator = new date_generator($ctr_start_date_ts, $ctr_end_date_ts,
$period_start_date_ts, $period_end_date_ts, $repeat_type, $repeat_interval);
$dates_array = $date_generator->get_dates();
-
+
// Set status for control on each date to NOT DONE or REGISTERED
- foreach($dates_array as $date_ts)
- {
- $check_list = new controller_check_list();
- $check_list->set_deadline( $date_ts );
- $check_list->set_control_id( $this->control->get_id() );
-
- if($this->type == "component")
- {
- $check_list->set_component_id( $this->component->get_id() );
- $check_list->set_location_id(
$this->component->get_location_id() );
- $check_list_status_manager = new check_list_status_manager(
$check_list, "component" );
- }
- else
- {
- $check_list->set_location_code( $this->location_code );
- $check_list_status_manager = new check_list_status_manager(
$check_list, "location" );
- }
-
- $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
-
- $month_nr = date("n", $date_ts);
-
- $this->calendar_array[ $month_nr ]["status"] =
$check_list_status_info->get_status();
- $this->calendar_array[ $month_nr ]["info"] =
$check_list_status_info->serialize();
- }
- }
-
- public function build_calendar( $check_lists_array )
- {
- foreach($check_lists_array as $check_list)
- {
- $check_list_status_manager = new
check_list_status_manager( $check_list );
- $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
+ foreach ($dates_array as $date_ts) {
+ $check_list = new controller_check_list();
+ $check_list->set_deadline($date_ts);
+ $check_list->set_control_id($this->control->get_id());
- $month_nr = date("n",
$check_list_status_info->get_deadline_date_ts());
-
- $this->calendar_array[ $month_nr ]["status"] =
$check_list_status_info->get_status();
- $this->calendar_array[ $month_nr ]["info"] =
$check_list_status_info->serialize();
- }
-
- return $this->calendar_array;
- }
-
- public function build_agg_month_calendar(
$agg_open_cases_pr_month_array )
- {
-
- foreach($agg_open_cases_pr_month_array as
$status_agg_month_info)
- {
- $status = "CONTROLS_DONE_WITH_ERRORS";
-
-
$this->calendar_array[$status_agg_month_info->get_month_nr()]["status"] =
$status;
-
$this->calendar_array[$status_agg_month_info->get_month_nr()]["info"]["agg_open_errors"]
= $status_agg_month_info->get_agg_open_cases();
- }
-
- return $this->calendar_array;
- }
-
- public static function get_heading_array(){
-
- $heading_array = array();
-
- for($i=1;$i<=12;$i++){
- $heading_array[$i] = "$i";
- }
-
- return $heading_array;
- }
-
- public static function get_start_date_year_ts($year){
- $start_date_year_ts = strtotime("01/01/$year");
-
- return $start_date_year_ts;
- }
+ if ($this->type == "component") {
+ $check_list->set_component_id($this->component->get_id());
+ $check_list->set_location_id($this->component->get_location_id());
+ $check_list_status_manager = new
check_list_status_manager($check_list, "component");
+ } else {
+ $check_list->set_location_code($this->location_code);
+ $check_list_status_manager = new
check_list_status_manager($check_list, "location");
+ }
+
+ $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
+
+ $month_nr = date("n", $date_ts);
+
+ $this->calendar_array[$month_nr]["status"] =
$check_list_status_info->get_status();
+ $this->calendar_array[$month_nr]["info"] =
$check_list_status_info->serialize();
+ }
+ }
+
+ public function build_calendar($check_lists_array) {
+ foreach ($check_lists_array as $check_list) {
+ $check_list_status_manager = new check_list_status_manager($check_list);
+ $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
+
+ $month_nr = date("n", $check_list_status_info->get_deadline_date_ts());
+
+ $this->calendar_array[$month_nr]["status"] =
$check_list_status_info->get_status();
+ $this->calendar_array[$month_nr]["info"] =
$check_list_status_info->serialize();
+ }
+
+ return $this->calendar_array;
+ }
+
+ public function build_agg_month_calendar($agg_open_cases_pr_month_array) {
+
+ foreach ($agg_open_cases_pr_month_array as $status_agg_month_info) {
+ $status = "CONTROLS_DONE_WITH_ERRORS";
+
+ $this->calendar_array[$status_agg_month_info->get_month_nr()]["status"]
= $status;
+
$this->calendar_array[$status_agg_month_info->get_month_nr()]["info"]["agg_open_errors"]
= $status_agg_month_info->get_agg_open_cases();
+ }
+
+ return $this->calendar_array;
+ }
+
+ public static function get_heading_array() {
+
+ $heading_array = array();
+
+ for ($i = 1; $i <= 12; $i++) {
+ $heading_array[$i] = "$i";
+ }
+
+ return $heading_array;
+ }
+
+ public static function get_start_date_year_ts($year) {
+ $start_date_year_ts = strtotime("01/01/$year");
+
+ return $start_date_year_ts;
+ }
+
}
\ No newline at end of file
Modified: trunk/controller/inc/component/class.year_calendar_agg.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar_agg.inc.php
2012-08-31 08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/component/class.year_calendar_agg.inc.php
2012-08-31 09:06:16 UTC (rev 9948)
@@ -1,110 +1,93 @@
<?php
+
phpgw::import_class('controller.socheck_list');
include_class('controller', 'date_generator', 'inc/component/');
include_class('controller', 'check_list_status_info', 'inc/component/');
include_class('controller', 'check_list_status_manager', 'inc/component/');
include_class('controller', 'check_list', 'inc/model/');
-
class year_calendar_agg {
- private $year;
- private $control;
- private $location_code;
- private $view;
-
- private $calendar_array = array();
-
- public function __construct($control, $year, $location_code, $view)
- {
+
+ private $year;
+ private $control;
+ private $location_code;
+ private $view;
+ private $calendar_array = array();
+
+ public function __construct($control, $year, $location_code, $view) {
$this->year = $year;
$this->control = $control;
$this->location_code = $location_code;
$this->view = $view;
-
+
$this->init_calendar();
}
-
- function init_calendar()
- {
- $start_month_nr = $this->get_start_month_for_control(
$this->control, $this->year );
- $end_month_nr = $this->get_end_month_for_control(
$this->control, $this->year );
-
- for($month_nr = 1;$month_nr <= 12;$month_nr++)
- {
- if( ($month_nr < $start_month_nr) || ($month_nr > $end_month_nr) )
- {
- $this->calendar_array[ $month_nr ] = null;
- }
- else if( ($month_nr < date("m")) && (date("Y",
$this->control->get_start_date()) == $this->year) )
- {
- $this->calendar_array[ $month_nr ]["status"] =
"CONTROLS_NOT_DONE";
- $this->calendar_array[ $month_nr ]["info"] = array("view" =>
$this->view, "control_id" => $this->control->get_id(), "location_code" =>
$this->location_code, "year" => $this->year, "month" => $month_nr);
- }
- else
- {
- $this->calendar_array[ $month_nr ]["status"] =
"CONTROLS_REGISTERED";
- $this->calendar_array[ $month_nr ]["info"] = array("view" =>
$this->view, "control_id" => $this->control->get_id(), "location_code" =>
$this->location_code, "year" => $this->year, "month" => $month_nr);
- }
+
+ function init_calendar() {
+ $start_month_nr = $this->get_start_month_for_control($this->control,
$this->year);
+ $end_month_nr = $this->get_end_month_for_control($this->control,
$this->year);
+
+ for ($month_nr = 1; $month_nr <= 12; $month_nr++) {
+ if (($month_nr < $start_month_nr) || ($month_nr > $end_month_nr)) {
+ $this->calendar_array[$month_nr] = null;
+ } else if (($month_nr < date("m")) && (date("Y",
$this->control->get_start_date()) == $this->year)) {
+ $this->calendar_array[$month_nr]["status"] = "CONTROLS_NOT_DONE";
+ $this->calendar_array[$month_nr]["info"] = array("view" =>
$this->view, "control_id" => $this->control->get_id(), "location_code" =>
$this->location_code, "year" => $this->year, "month" => $month_nr);
+ } else {
+ $this->calendar_array[$month_nr]["status"] = "CONTROLS_REGISTERED";
+ $this->calendar_array[$month_nr]["info"] = array("view" =>
$this->view, "control_id" => $this->control->get_id(), "location_code" =>
$this->location_code, "year" => $this->year, "month" => $month_nr);
+ }
}
- }
-
- public function build_calendar( $agg_open_cases_pr_month_array )
- {
- foreach($agg_open_cases_pr_month_array as
$status_agg_month_info)
- {
- $status = "CONTROLS_DONE_WITH_ERRORS";
-
-
$this->calendar_array[$status_agg_month_info->get_month_nr()]["status"] =
$status;
-
$this->calendar_array[$status_agg_month_info->get_month_nr()]["info"]["agg_open_errors"]
= $status_agg_month_info->get_agg_open_cases();
- }
-
- return $this->calendar_array;
- }
-
- public static function get_heading_array(){
-
- $heading_array = array();
-
- for($i=1;$i<=12;$i++){
- $heading_array[$i] = "$i";
- }
-
- return $heading_array;
- }
-
- function get_start_month_for_control($control, $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());
- }
- else
- {
- $from_month = 1;
- }
-
- return $from_month;
- }
-
- function get_end_month_for_control($control, $year)
- {
- // Checks if control ends in the year that is displayed
- if( date("Y", $control->get_end_date()) == $year )
- {
- $to_month = date("n", $control->get_end_date());
- }
- else
- {
- $to_month = 12;
- }
-
- return $to_month;
- }
-
- public static function get_start_date_year_ts($year){
- $start_date_year_ts = strtotime("01/01/$year");
-
- return $start_date_year_ts;
- }
+ }
+
+ public function build_calendar($agg_open_cases_pr_month_array) {
+ foreach ($agg_open_cases_pr_month_array as $status_agg_month_info) {
+ $status = "CONTROLS_DONE_WITH_ERRORS";
+
+ $this->calendar_array[$status_agg_month_info->get_month_nr()]["status"]
= $status;
+
$this->calendar_array[$status_agg_month_info->get_month_nr()]["info"]["agg_open_errors"]
= $status_agg_month_info->get_agg_open_cases();
+ }
+
+ return $this->calendar_array;
+ }
+
+ public static function get_heading_array() {
+
+ $heading_array = array();
+
+ for ($i = 1; $i <= 12; $i++) {
+ $heading_array[$i] = "$i";
+ }
+
+ return $heading_array;
+ }
+
+ function get_start_month_for_control($control, $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());
+ } else {
+ $from_month = 1;
+ }
+
+ return $from_month;
+ }
+
+ function get_end_month_for_control($control, $year) {
+ // Checks if control ends in the year that is displayed
+ if (date("Y", $control->get_end_date()) == $year) {
+ $to_month = date("n", $control->get_end_date());
+ } else {
+ $to_month = 12;
+ }
+
+ return $to_month;
+ }
+
+ public static function get_start_date_year_ts($year) {
+ $start_date_year_ts = strtotime("01/01/$year");
+
+ return $start_date_year_ts;
+ }
+
}
\ No newline at end of file
Modified: trunk/controller/inc/helper/class.check_list_status_updater.inc.php
===================================================================
--- trunk/controller/inc/helper/class.check_list_status_updater.inc.php
2012-08-31 08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/helper/class.check_list_status_updater.inc.php
2012-08-31 09:06:16 UTC (rev 9948)
@@ -1,46 +1,46 @@
<?php
- phpgw::import_class('controller.socheck_list');
- phpgw::import_class('controller.socheck_item');
-
- include_class('controller', 'check_list', 'inc/model/');
- include_class('controller', 'check_item', 'inc/model/');
- class check_list_status_updater {
-
- public function __construct()
- {
- $this->so_check_list =
CreateObject('controller.socheck_list');
- $this->so_check_item =
CreateObject('controller.socheck_item');
- }
-
- public function update_check_list_status( $check_list_id )
- {
- $check_list = $this->so_check_list->get_single(
$check_list_id );
-
- $check_items =
$this->so_check_item->get_check_items_with_cases($check_list_id,
$control_item_type = null, $status = null, $messageStatus = null,
"return_object");
-
- $num_open_cases = 0;
- $num_pending_cases = 0;
-
- foreach($check_items as $check_item){
- foreach($check_item->get_cases_array() as
$case){
-
- if($case->get_status() ==
controller_check_item_case::STATUS_OPEN){
- $num_open_cases++;
- }
-
- if($case->get_status() ==
controller_check_item_case::STATUS_PENDING){
- $num_pending_cases++;
- }
- }
- }
-
- if($num_open_cases > 0)
-
$check_list->set_status(controller_check_list::STATUS_DONE);
-
- $check_list->set_num_open_cases($num_open_cases);
- $check_list->set_num_pending_cases($num_pending_cases);
-
- $this->so_check_list->store($check_list);
- }
+phpgw::import_class('controller.socheck_list');
+phpgw::import_class('controller.socheck_item');
+
+include_class('controller', 'check_list', 'inc/model/');
+include_class('controller', 'check_item', 'inc/model/');
+
+class check_list_status_updater {
+
+ public function __construct() {
+ $this->so_check_list = CreateObject('controller.socheck_list');
+ $this->so_check_item = CreateObject('controller.socheck_item');
+ }
+
+ public function update_check_list_status($check_list_id) {
+ $check_list = $this->so_check_list->get_single($check_list_id);
+
+ $check_items =
$this->so_check_item->get_check_items_with_cases($check_list_id,
$control_item_type = null, $status = null, $messageStatus = null,
"return_object");
+
+ $num_open_cases = 0;
+ $num_pending_cases = 0;
+
+ foreach ($check_items as $check_item) {
+ foreach ($check_item->get_cases_array() as $case) {
+
+ if ($case->get_status() == controller_check_item_case::STATUS_OPEN) {
+ $num_open_cases++;
+ }
+
+ if ($case->get_status() == controller_check_item_case::STATUS_PENDING)
{
+ $num_pending_cases++;
+ }
+ }
+ }
+
+ if ($num_open_cases > 0)
+ $check_list->set_status(controller_check_list::STATUS_DONE);
+
+ $check_list->set_num_open_cases($num_open_cases);
+ $check_list->set_num_pending_cases($num_pending_cases);
+
+ $this->so_check_list->store($check_list);
+ }
+
}
\ No newline at end of file
Modified: trunk/controller/inc/helper/class.date_helper.inc.php
===================================================================
--- trunk/controller/inc/helper/class.date_helper.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/helper/class.date_helper.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -1,24 +1,28 @@
<?php
- class date_helper {
-
- public function __construct(){}
-
- public static function get_timestamp_from_date( $date_string, $format
){
-
- if( $format == "d/m-Y" ){
- $pos_day = strpos($date_string, "/");
- $day = date_helper::substring($date_string, 0,
$pos_day);
-
- $pos_month = strpos($date_string, "-");
- $month = date_helper::substring($date_string,
$pos_day+1, $pos_month);
-
- $year = date_helper::substring($date_string,
$pos_month+1, strlen($date_string));
- return mktime(0, 0, 0, $month, $day, $year);
- }
- }
-
- public function substring($string, $from, $to){
- return substr($string, $from, $to - $from);
- }
+class date_helper {
+
+ public function __construct() {
+
+ }
+
+ public static function get_timestamp_from_date($date_string, $format) {
+
+ if ($format == "d/m-Y") {
+ $pos_day = strpos($date_string, "/");
+ $day = date_helper::substring($date_string, 0, $pos_day);
+
+ $pos_month = strpos($date_string, "-");
+ $month = date_helper::substring($date_string, $pos_day + 1, $pos_month);
+
+ $year = date_helper::substring($date_string, $pos_month + 1,
strlen($date_string));
+
+ return mktime(0, 0, 0, $month, $day, $year);
+ }
+ }
+
+ public function substring($string, $from, $to) {
+ return substr($string, $from, $to - $from);
+ }
+
}
\ No newline at end of file
Modified: trunk/controller/inc/helper/class.location_finder.inc.php
===================================================================
--- trunk/controller/inc/helper/class.location_finder.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/helper/class.location_finder.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -1,51 +1,50 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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: class.uicontrol_group.inc.php 8267 2011-12-11 12:27:18Z
sigurdne $
- */
- phpgw::import_class('property.solocation');
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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: class.uicontrol_group.inc.php 8267 2011-12-11 12:27:18Z
sigurdne $
+ */
+phpgw::import_class('property.solocation');
- class location_finder
- {
- private $so;
-
- public function __construct()
- {
- $this->so = CreateObject('property.solocation');
- }
+class location_finder {
- function get_responsibilities($data = array())
- {
- $data['filter_role_on_contact'] =
$GLOBALS['phpgw']->accounts->get($data['user_id'])->person_id;
- $locations = $this->so->read($data);
-
- $total_records = $this->so->total_records;
-
- return $locations;
- }
- }
+ private $so;
+
+ public function __construct() {
+ $this->so = CreateObject('property.solocation');
+ }
+
+ function get_responsibilities($data = array()) {
+ $data['filter_role_on_contact'] =
$GLOBALS['phpgw']->accounts->get($data['user_id'])->person_id;
+ $locations = $this->so->read($data);
+
+ $total_records = $this->so->total_records;
+
+ return $locations;
+ }
+
+}
Modified: trunk/controller/inc/model/class.check_item.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_item.inc.php 2012-08-31 08:31:33 UTC
(rev 9947)
+++ trunk/controller/inc/model/class.check_item.inc.php 2012-08-31 09:06:16 UTC
(rev 9948)
@@ -1,108 +1,108 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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$
- */
- include_class('controller', 'model', 'inc/model/');
-
- class controller_check_item extends controller_model
- {
- public static $so;
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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$
+ */
+include_class('controller', 'model', 'inc/model/');
- protected $id;
- protected $control_item_id;
- protected $check_list_id;
-
- // Objects
- protected $control_item;
- protected $cases_array = array();
-
- /**
- * Constructor. Takes an optional ID. If a contract is
created from outside
- * the database the ID should be empty so the database can add
one according to its logic.
- *
- * @param int $id the id of this composite
- */
- public function __construct(int $id = null)
- {
- $this->id = (int)$id;
- }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id() { return $this->id; }
+class controller_check_item extends controller_model {
- public function set_control_item_id($control_item_id)
- {
- $this->control_item_id = $control_item_id;
- }
-
- public function get_control_item_id() { return
$this->control_item_id; }
-
- public function set_check_list_id($check_list_id)
- {
- $this->check_list_id = $check_list_id;
- }
-
- public function get_check_list_id() { return
$this->check_list_id; }
-
-
- // ================= Getters and setters for objects
=================
-
- public function set_control_item($control_item)
- {
- $this->control_item = $control_item;
- }
-
- public function get_control_item() { return
$this->control_item; }
-
- public function set_cases_array($cases_array)
- {
- $this->cases_array = $cases_array;
- }
-
- public function get_cases_array() { return $this->cases_array; }
-
-
- /**
- * Get a static reference to the storage object associated with
this model object
- *
- * @return the storage object
- */
- public static function get_so()
- {
-/* if (self::$so == null) {
- self::$so =
CreateObject('controller.socontrol_item');
- }
-
- return self::$so;*/
- }
- }
+ public static $so;
+ protected $id;
+ protected $control_item_id;
+ protected $check_list_id;
+ // Objects
+ protected $control_item;
+ protected $cases_array = array();
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is created from outside
+ * the database the ID should be empty so the database can add one according
to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+ public function __construct(int $id = null) {
+ $this->id = (int) $id;
+ }
+
+ public function set_id($id) {
+ $this->id = $id;
+ }
+
+ public function get_id() {
+ return $this->id;
+ }
+
+ public function set_control_item_id($control_item_id) {
+ $this->control_item_id = $control_item_id;
+ }
+
+ public function get_control_item_id() {
+ return $this->control_item_id;
+ }
+
+ public function set_check_list_id($check_list_id) {
+ $this->check_list_id = $check_list_id;
+ }
+
+ public function get_check_list_id() {
+ return $this->check_list_id;
+ }
+
+ // ================= Getters and setters for objects =================
+
+ public function set_control_item($control_item) {
+ $this->control_item = $control_item;
+ }
+
+ public function get_control_item() {
+ return $this->control_item;
+ }
+
+ public function set_cases_array($cases_array) {
+ $this->cases_array = $cases_array;
+ }
+
+ public function get_cases_array() {
+ return $this->cases_array;
+ }
+
+ /**
+ * Get a static reference to the storage object associated with this model
object
+ *
+ * @return the storage object
+ */
+ public static function get_so() {
+ /* if (self::$so == null) {
+ self::$so = CreateObject('controller.socontrol_item');
+ }
+
+ return self::$so; */
+ }
+
+}
Modified: trunk/controller/inc/model/class.check_item_case.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_item_case.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/model/class.check_item_case.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -1,140 +1,151 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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: class.check_item.inc.php 8478 2012-01-03 12:36:37Z
vator $
- */
- include_class('controller', 'model', 'inc/model/');
-
- class controller_check_item_case extends controller_model
- {
- public static $so;
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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: class.check_item.inc.php 8478 2012-01-03 12:36:37Z vator $
+ */
+include_class('controller', 'model', 'inc/model/');
- const STATUS_OPEN = 0;
- const STATUS_CLOSED = 1;
- const STATUS_PENDING = 2;
-
- protected $id;
- protected $check_item_id;
- protected $status;
- protected $location_id; // FOREKOMST I
MELDINGSREGISTERET
- protected $location_item_id; // MELDINGS ID
- protected $descr;
- protected $user_id;
- protected $entry_date;
- protected $modified_date;
- protected $modified_by;
- protected $measurement;
-
- /**
- * Constructor. Takes an optional ID. If a contract is
created from outside
- * the database the ID should be empty so the database can add
one according to its logic.
- *
- * @param int $id the id of this composite
- */
- public function __construct(int $id = null)
- {
- $this->id = (int)$id;
- }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id() { return $this->id; }
+class controller_check_item_case extends controller_model {
- public function set_check_item_id($check_item_id)
- {
- $this->check_item_id = $check_item_id;
- }
-
- public function get_check_item_id() { return
$this->check_item_id; }
-
- public function set_status($status)
- {
- $this->status = (int)$status;
- }
-
- public function get_status() { return (int)$this->status; }
-
- public function get_location_id() { return
(int)$this->location_id; }
-
- public function set_location_id($location_id)
- {
- $this->location_id = $location_id;
- }
-
- public function get_location_item_id() { return
(int)$this->location_item_id; }
-
- public function set_location_item_id($location_item_id)
- {
- $this->location_item_id = $location_item_id;
- }
+ public static $so;
- public function get_descr() { return $this->descr; }
-
- public function set_descr($descr)
- {
- $this->descr = $descr;
- }
-
- public function get_user_id() { return (int)$this->user_id; }
-
- public function set_user_id($user_id)
- {
- $this->user_id = $user_id;
- }
-
- public function get_entry_date() { return
(int)$this->entry_date; }
-
- public function set_entry_date($entry_date)
- {
- $this->entry_date = $entry_date;
- }
-
- public function get_modified_date() { return
(int)$this->modified_date; }
-
- public function set_modified_date($modified_date)
- {
- $this->modified_date = $modified_date;
- }
-
- public function get_modified_by() { return
(int)$this->modified_by; }
-
- public function set_modified_by($modified_by)
- {
- $this->modified_by = $modified_by;
- }
-
- public function get_measurement() { return $this->measurement; }
-
- public function set_measurement($measurement)
- {
- $this->measurement = $measurement;
- }
- }
+ const STATUS_OPEN = 0;
+ const STATUS_CLOSED = 1;
+ const STATUS_PENDING = 2;
+
+ protected $id;
+ protected $check_item_id;
+ protected $status;
+ protected $location_id; // FOREKOMST I MELDINGSREGISTERET
+ protected $location_item_id; // MELDINGS ID
+ protected $descr;
+ protected $user_id;
+ protected $entry_date;
+ protected $modified_date;
+ protected $modified_by;
+ protected $measurement;
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is created from outside
+ * the database the ID should be empty so the database can add one according
to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+ public function __construct(int $id = null) {
+ $this->id = (int) $id;
+ }
+
+ public function set_id($id) {
+ $this->id = $id;
+ }
+
+ public function get_id() {
+ return $this->id;
+ }
+
+ public function set_check_item_id($check_item_id) {
+ $this->check_item_id = $check_item_id;
+ }
+
+ public function get_check_item_id() {
+ return $this->check_item_id;
+ }
+
+ public function set_status($status) {
+ $this->status = (int) $status;
+ }
+
+ public function get_status() {
+ return (int) $this->status;
+ }
+
+ public function get_location_id() {
+ return (int) $this->location_id;
+ }
+
+ public function set_location_id($location_id) {
+ $this->location_id = $location_id;
+ }
+
+ public function get_location_item_id() {
+ return (int) $this->location_item_id;
+ }
+
+ public function set_location_item_id($location_item_id) {
+ $this->location_item_id = $location_item_id;
+ }
+
+ public function get_descr() {
+ return $this->descr;
+ }
+
+ public function set_descr($descr) {
+ $this->descr = $descr;
+ }
+
+ public function get_user_id() {
+ return (int) $this->user_id;
+ }
+
+ public function set_user_id($user_id) {
+ $this->user_id = $user_id;
+ }
+
+ public function get_entry_date() {
+ return (int) $this->entry_date;
+ }
+
+ public function set_entry_date($entry_date) {
+ $this->entry_date = $entry_date;
+ }
+
+ public function get_modified_date() {
+ return (int) $this->modified_date;
+ }
+
+ public function set_modified_date($modified_date) {
+ $this->modified_date = $modified_date;
+ }
+
+ public function get_modified_by() {
+ return (int) $this->modified_by;
+ }
+
+ public function set_modified_by($modified_by) {
+ $this->modified_by = $modified_by;
+ }
+
+ public function get_measurement() {
+ return $this->measurement;
+ }
+
+ public function set_measurement($measurement) {
+ $this->measurement = $measurement;
+ }
+
+}
Modified: trunk/controller/inc/model/class.check_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_list.inc.php 2012-08-31 08:31:33 UTC
(rev 9947)
+++ trunk/controller/inc/model/class.check_list.inc.php 2012-08-31 09:06:16 UTC
(rev 9948)
@@ -1,245 +1,249 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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$
- */
- include_class('controller', 'model', 'inc/model/');
-
- class controller_check_list extends controller_model
- {
- public static $so;
-
- const STATUS_NOT_DONE = 0;
- const STATUS_DONE = 1;
- const STATUS_CANCELED = 3;
-
- protected $id;
- protected $control_id;
- protected $status;
- protected $comment;
- protected $deadline;
- protected $planned_date;
- protected $completed_date;
- protected $location_code;
- protected $component_id;
- protected $location_id;
-
- // Aggregate fields. Fields not in a table
- protected $num_open_cases;
- protected $num_pending_cases;
-
- // Objects
- protected $check_item_array = array();
- // Array that contains error messages. Is populted in function
validate
- protected $error_msg_array = array();
-
- protected $control;
-
- /**
- * Constructor. Takes an optional ID. If a contract is
created from outside
- * the database the ID should be empty so the database can add
one according to its logic.
- *
- * @param int $id the id of this composite
- */
- public function __construct(int $id = null)
- {
- $this->id = (int)$id;
- }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id() { return $this->id; }
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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$
+ */
+include_class('controller', 'model', 'inc/model/');
- public function set_control_id($control_id)
- {
- $this->control_id = $control_id;
- }
-
- public function get_control_id() { return $this->control_id; }
-
- public function set_status($status)
- {
- $this->status = $status;
- }
-
- public function get_status() { return $this->status; }
-
- public function set_comment($comment)
- {
- $this->comment = $comment;
- }
-
- public function get_comment() { return $this->comment; }
-
- public function set_deadline($deadline)
- {
- $this->deadline = $deadline;
- }
-
- public function get_deadline() { return $this->deadline; }
-
- public function set_check_item_array($check_item_array)
- {
- $this->check_item_array = $check_item_array;
- }
-
- public function get_check_item_array() { return
$this->check_item_array; }
-
- public function set_planned_date($planned_date)
- {
- $this->planned_date = $planned_date;
- }
-
- public function get_planned_date() { return
$this->planned_date; }
-
- public function set_completed_date($completed_date)
- {
- $this->completed_date = $completed_date;
- }
-
- public function get_completed_date() { return
$this->completed_date; }
-
- public function set_location_code($location_code)
- {
- $this->location_code = $location_code;
- }
-
- public function get_location_code() { return
$this->location_code; }
-
- public function set_component_id($component_id)
- {
- $this->component_id = $component_id;
- }
-
- public function get_component_id() { return
$this->component_id; }
-
- public function set_location_id($location_id)
- {
- $this->location_id = $location_id;
- }
-
- public function get_location_id() { return $this->location_id; }
+class controller_check_list extends controller_model {
- public function get_num_open_cases() { return
$this->num_open_cases; }
-
- public function set_num_open_cases($num_open_cases)
- {
- $this->num_open_cases = $num_open_cases;
- }
+ public static $so;
- public function get_num_pending_cases() { return
$this->num_pending_cases; }
-
- public function set_num_pending_cases($num_pending_cases)
- {
- $this->num_pending_cases = $num_pending_cases;
- }
-
- public function set_control($control)
- {
- $this->control = $control;
- }
-
- public function get_control() { return $this->control; }
-
- public function get_error_msg_array() { return
$this->error_msg_array; }
-
- public function set_error_msg_array( $error_msg_array )
- {
- $this->error_msg_array = $error_msg_array;
- }
-
- public function serialize()
- {
- return array(
- 'id'
=> $this->get_id(),
- 'control_id' =>
$this->get_control_id(),
- 'status'
=> $this->get_status(),
- 'comment' =>
$this->get_comment(),
- 'deadline' =>
$this->get_deadline(),
- 'planned_date' =>
$this->get_planned_date(),
- 'completed_date' =>
$this->get_completed_date(),
- 'location_code' =>
$this->get_location_code(),
- 'component_id' =>
$this->get_component_id(),
- 'location_id' =>
$this->get_location_id(),
- 'num_open_cases' =>
$this->get_num_open_cases()
- );
- }
-
- public function validate()
- {
- $status = true;
-
- // Validate CONTROL ID
- if( empty( $this->control_id ) )
- {
- $status = false;
- $this->error_msg_array['control_id'] = "error_msg_4";
- }
-
- // Validate STATUS
- if( $this->status != 0 and $this->status != 1 )
- {
- $status = false;
- $this->error_msg_array['status'] = "error_msg_2";
- }
-
- // Validate STATUS ON PLANNED DATE
- if( $this->status == 0 and ( $this->planned_date == ''
or $this->planned_date == 0) )
- {
- $status = false;
- $this->error_msg_array['status'] = "error_msg_7";
- }
+ const STATUS_NOT_DONE = 0;
+ const STATUS_DONE = 1;
+ const STATUS_CANCELED = 3;
- // Validate COMPLETED DATE when STATUS:DONE
- if( ($this->status ==
controller_check_list::STATUS_DONE) && empty($this->completed_date) )
- {
- $status = false;
- $this->error_msg_array['completed_date'] =
"error_msg_5";
- }
-
- // Validate DEADLINE
- if( empty( $this->deadline ) )
- {
- $status = false;
- $this->error_msg_array['deadline'] = "error_msg_1";
- }
-
- // Validate connection to COMPONENT/LOCATION
- if( empty( $this->location_code ) && empty(
$this->component_id ) )
- {
- echo "FAILED: " . $this->location_code;
- $status = false;
- $this->error_msg_array['location_code'] = "error_msg_6";
- }
-
- return $status;
- }
- }
+ protected $id;
+ protected $control_id;
+ protected $status;
+ protected $comment;
+ protected $deadline;
+ protected $planned_date;
+ protected $completed_date;
+ protected $location_code;
+ protected $component_id;
+ protected $location_id;
+ // Aggregate fields. Fields not in a table
+ protected $num_open_cases;
+ protected $num_pending_cases;
+ // Objects
+ protected $check_item_array = array();
+ // Array that contains error messages. Is populted in function validate
+ protected $error_msg_array = array();
+ protected $control;
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is created from outside
+ * the database the ID should be empty so the database can add one according
to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+ public function __construct(int $id = null) {
+ $this->id = (int) $id;
+ }
+
+ public function set_id($id) {
+ $this->id = $id;
+ }
+
+ public function get_id() {
+ return $this->id;
+ }
+
+ public function set_control_id($control_id) {
+ $this->control_id = $control_id;
+ }
+
+ public function get_control_id() {
+ return $this->control_id;
+ }
+
+ public function set_status($status) {
+ $this->status = $status;
+ }
+
+ public function get_status() {
+ return $this->status;
+ }
+
+ public function set_comment($comment) {
+ $this->comment = $comment;
+ }
+
+ public function get_comment() {
+ return $this->comment;
+ }
+
+ public function set_deadline($deadline) {
+ $this->deadline = $deadline;
+ }
+
+ public function get_deadline() {
+ return $this->deadline;
+ }
+
+ public function set_check_item_array($check_item_array) {
+ $this->check_item_array = $check_item_array;
+ }
+
+ public function get_check_item_array() {
+ return $this->check_item_array;
+ }
+
+ public function set_planned_date($planned_date) {
+ $this->planned_date = $planned_date;
+ }
+
+ public function get_planned_date() {
+ return $this->planned_date;
+ }
+
+ public function set_completed_date($completed_date) {
+ $this->completed_date = $completed_date;
+ }
+
+ public function get_completed_date() {
+ return $this->completed_date;
+ }
+
+ public function set_location_code($location_code) {
+ $this->location_code = $location_code;
+ }
+
+ public function get_location_code() {
+ return $this->location_code;
+ }
+
+ public function set_component_id($component_id) {
+ $this->component_id = $component_id;
+ }
+
+ public function get_component_id() {
+ return $this->component_id;
+ }
+
+ public function set_location_id($location_id) {
+ $this->location_id = $location_id;
+ }
+
+ public function get_location_id() {
+ return $this->location_id;
+ }
+
+ public function get_num_open_cases() {
+ return $this->num_open_cases;
+ }
+
+ public function set_num_open_cases($num_open_cases) {
+ $this->num_open_cases = $num_open_cases;
+ }
+
+ public function get_num_pending_cases() {
+ return $this->num_pending_cases;
+ }
+
+ public function set_num_pending_cases($num_pending_cases) {
+ $this->num_pending_cases = $num_pending_cases;
+ }
+
+ public function set_control($control) {
+ $this->control = $control;
+ }
+
+ public function get_control() {
+ return $this->control;
+ }
+
+ public function get_error_msg_array() {
+ return $this->error_msg_array;
+ }
+
+ public function set_error_msg_array($error_msg_array) {
+ $this->error_msg_array = $error_msg_array;
+ }
+
+ public function serialize() {
+ return array(
+ 'id' => $this->get_id(),
+ 'control_id' => $this->get_control_id(),
+ 'status' => $this->get_status(),
+ 'comment' => $this->get_comment(),
+ 'deadline' => $this->get_deadline(),
+ 'planned_date' => $this->get_planned_date(),
+ 'completed_date' => $this->get_completed_date(),
+ 'location_code' => $this->get_location_code(),
+ 'component_id' => $this->get_component_id(),
+ 'location_id' => $this->get_location_id(),
+ 'num_open_cases' => $this->get_num_open_cases()
+ );
+ }
+
+ public function validate() {
+ $status = true;
+
+ // Validate CONTROL ID
+ if (empty($this->control_id)) {
+ $status = false;
+ $this->error_msg_array['control_id'] = "error_msg_4";
+ }
+
+ // Validate STATUS
+ if ($this->status != 0 and $this->status != 1) {
+ $status = false;
+ $this->error_msg_array['status'] = "error_msg_2";
+ }
+
+ // Validate STATUS ON PLANNED DATE
+ if ($this->status == 0 and ( $this->planned_date == '' or
$this->planned_date == 0)) {
+ $status = false;
+ $this->error_msg_array['status'] = "error_msg_7";
+ }
+
+ // Validate COMPLETED DATE when STATUS:DONE
+ if (($this->status == controller_check_list::STATUS_DONE) &&
empty($this->completed_date)) {
+ $status = false;
+ $this->error_msg_array['completed_date'] = "error_msg_5";
+ }
+
+ // Validate DEADLINE
+ if (empty($this->deadline)) {
+ $status = false;
+ $this->error_msg_array['deadline'] = "error_msg_1";
+ }
+
+ // Validate connection to COMPONENT/LOCATION
+ if (empty($this->location_code) && empty($this->component_id)) {
+ echo "FAILED: " . $this->location_code;
+ $status = false;
+ $this->error_msg_array['location_code'] = "error_msg_6";
+ }
+
+ return $status;
+ }
+
+}
Modified: trunk/controller/inc/model/class.component.inc.php
===================================================================
--- trunk/controller/inc/model/class.component.inc.php 2012-08-31 08:31:33 UTC
(rev 9947)
+++ trunk/controller/inc/model/class.component.inc.php 2012-08-31 09:06:16 UTC
(rev 9948)
@@ -1,148 +1,157 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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: class.control.inc.php 9548 2012-06-11 12:40:52Z vator $
- */
- include_class('controller', 'model', 'inc/model/');
- include_class('controller', 'date_helper', 'inc/helper/');
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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: class.control.inc.php 9548 2012-06-11 12:40:52Z vator $
+ */
+include_class('controller', 'model', 'inc/model/');
+include_class('controller', 'date_helper', 'inc/helper/');
- class controller_component extends controller_model
- {
- protected $type;
- protected $id;
- protected $location_id;
- protected $guid;
- protected $xml;
- // Not a table column
- protected $xml_short_desc;
- protected $type_str;
- protected $location_code;
- protected $p_location_code;
- protected $loc_1;
- protected $address;
-
- // Objects
- protected $controls_array = array();
-
- /**
- * Constructor. Takes an optional ID. If a contract is
created from outside
- * the database the ID should be empty so the database can add
one according to its logic.
- *
- * @param int $id the id of this composite
- */
-
- public function set_type($type)
- {
- $this->type = $type;
- }
-
- public function get_type() { return $this->type; }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id() { return $this->id; }
-
- public function set_location_id($location_id)
- {
- $this->location_id = $location_id;
- }
-
- public function get_location_id() { return $this->location_id; }
-
- public function set_guid($guid)
- {
- $this->guid = $guid;
- }
-
- public function get_guid() { return $this->guid; }
-
- public function set_xml($xml)
- {
- $this->xml = $xml;
- }
-
- public function get_xml() { return $this->xml; }
-
- public function set_xml_short_desc($xml_short_desc)
- {
- $this->xml_short_desc = $xml_short_desc;
- }
-
- public function get_xml_short_desc() { return
$this->xml_short_desc; }
-
- public function set_location_code($location_code)
- {
- $this->location_code = $location_code;
- }
-
- public function get_location_code() { return
$this->location_code; }
-
- public function set_loc_1($loc_1)
- {
- $this->loc_1 = $loc_1;
- }
-
- public function get_loc_1() { return $this->loc_1; }
-
- public function set_address($address)
- {
- $this->address = $address;
- }
-
- public function get_address() { return $this->address; }
-
- public function set_type_str($type_str)
- {
- $this->type_str = $type_str;
- }
-
- public function get_type_str() { return $this->type_str; }
-
- public function set_controls_array($controls_array)
- {
- $this->controls_array = $controls_array;
- }
-
- public function get_controls_array() { return
$this->controls_array; }
-
- public function serialize()
- {
- return array(
- 'type' => $this->get_type(),
- 'id' => $this->get_id(),
- 'guid' => $this->get_guid(),
- 'xml' => $this->get_xml(),
- 'location_code' => $this->get_location_code(),
- 'loc_1' => $this->get_loc_1(),
- 'address' => $this->get_address()
- );
- }
- }
+class controller_component extends controller_model {
+
+ protected $type;
+ protected $id;
+ protected $location_id;
+ protected $guid;
+ protected $xml;
+ // Not a table column
+ protected $xml_short_desc;
+ protected $type_str;
+ protected $location_code;
+ protected $p_location_code;
+ protected $loc_1;
+ protected $address;
+ // Objects
+ protected $controls_array = array();
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is created from outside
+ * the database the ID should be empty so the database can add one according
to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+ public function set_type($type) {
+ $this->type = $type;
+ }
+
+ public function get_type() {
+ return $this->type;
+ }
+
+ public function set_id($id) {
+ $this->id = $id;
+ }
+
+ public function get_id() {
+ return $this->id;
+ }
+
+ public function set_location_id($location_id) {
+ $this->location_id = $location_id;
+ }
+
+ public function get_location_id() {
+ return $this->location_id;
+ }
+
+ public function set_guid($guid) {
+ $this->guid = $guid;
+ }
+
+ public function get_guid() {
+ return $this->guid;
+ }
+
+ public function set_xml($xml) {
+ $this->xml = $xml;
+ }
+
+ public function get_xml() {
+ return $this->xml;
+ }
+
+ public function set_xml_short_desc($xml_short_desc) {
+ $this->xml_short_desc = $xml_short_desc;
+ }
+
+ public function get_xml_short_desc() {
+ return $this->xml_short_desc;
+ }
+
+ public function set_location_code($location_code) {
+ $this->location_code = $location_code;
+ }
+
+ public function get_location_code() {
+ return $this->location_code;
+ }
+
+ public function set_loc_1($loc_1) {
+ $this->loc_1 = $loc_1;
+ }
+
+ public function get_loc_1() {
+ return $this->loc_1;
+ }
+
+ public function set_address($address) {
+ $this->address = $address;
+ }
+
+ public function get_address() {
+ return $this->address;
+ }
+
+ public function set_type_str($type_str) {
+ $this->type_str = $type_str;
+ }
+
+ public function get_type_str() {
+ return $this->type_str;
+ }
+
+ public function set_controls_array($controls_array) {
+ $this->controls_array = $controls_array;
+ }
+
+ public function get_controls_array() {
+ return $this->controls_array;
+ }
+
+ public function serialize() {
+ return array(
+ 'type' => $this->get_type(),
+ 'id' => $this->get_id(),
+ 'guid' => $this->get_guid(),
+ 'xml' => $this->get_xml(),
+ 'location_code' => $this->get_location_code(),
+ 'loc_1' => $this->get_loc_1(),
+ 'address' => $this->get_address()
+ );
+ }
+
+}
Modified: trunk/controller/inc/model/class.control.inc.php
===================================================================
--- trunk/controller/inc/model/class.control.inc.php 2012-08-31 08:31:33 UTC
(rev 9947)
+++ trunk/controller/inc/model/class.control.inc.php 2012-08-31 09:06:16 UTC
(rev 9948)
@@ -1,360 +1,362 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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$
- */
- include_class('controller', 'model', 'inc/model/');
- include_class('controller', 'date_helper', 'inc/helper/');
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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$
+ */
+include_class('controller', 'model', 'inc/model/');
+include_class('controller', 'date_helper', 'inc/helper/');
- class controller_control extends controller_model
- {
- public static $so;
-
- const REPEAT_TYPE_DAY = 0;
- const REPEAT_TYPE_WEEK = 1;
- const REPEAT_TYPE_MONTH = 2;
- const REPEAT_TYPE_YEAR = 3;
-
- protected $id;
- protected $title;
- protected $description;
- protected $start_date;
- protected $end_date;
- protected $repeat_type;
- protected $repeat_type_label;
- protected $repeat_interval;
- protected $procedure_id;
- protected $procedure_name;
- protected $enabled;
- protected $requirement_id;
- protected $costresponsibility_id;
- protected $responsibility_id;
- protected $responsibility_name;
- protected $control_area_id;
- protected $control_area_name;
+class controller_control extends controller_model {
- // Objects
- protected $check_lists_array = array();
- // Array that contains open cases for a month
- protected $agg_open_cases_pr_month_array = array();
- // Array that contains error messages. Is populted in function
validate
- protected $error_msg_array;
-
- /**
- * Constructor. Takes an optional ID. If a contract is
created from outside
- * the database the ID should be empty so the database can add
one according to its logic.
- *
- * @param int $id the id of this composite
- */
- public function __construct(int $id = null)
- {
- $this->id = (int)$id;
- }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id() { return $this->id; }
-
- public function set_title($title)
- {
- $this->title = $title;
- }
-
- public function get_title() { return $this->title; }
-
- public function set_description($description)
- {
- $this->description = $description;
- }
-
- public function get_description() { return $this->description; }
-
- public function set_end_date($end_date)
- {
- $this->end_date = $end_date;
- }
-
- public function get_end_date() { return $this->end_date; }
-
- public function set_start_date($start_date)
- {
- $this->start_date = $start_date;
- }
-
- public function get_start_date() { return $this->start_date; }
-
- public function set_repeat_type($repeat_type)
- {
- $this->repeat_type = $repeat_type;
- }
-
- public function get_repeat_type() { return $this->repeat_type; }
-
- public function set_repeat_type_label(int $repeat_type = null)
- {
- switch($repeat_type)
- {
- case controller_control::REPEAT_TYPE_DAY:
- $this->repeat_type_label =
lang('repeat_type_day');
- break;
- case controller_control::REPEAT_TYPE_WEEK:
- $this->repeat_type_label =
lang('repeat_type_week');
- break;
- case controller_control::REPEAT_TYPE_MONTH:
- $this->repeat_type_label =
lang('repeat_type_month');
- break;
- case controller_control::REPEAT_TYPE_YEAR;
- $this->repeat_type_label =
lang('repeat_type_year');
- break;
- default:
- $this->repeat_type_label =
lang('repeat_type_none');
- break;
- }
- }
-
- public function get_repeat_type_label() { return
$this->repeat_type_label; }
-
- public function set_repeat_interval($repeat_interval)
- {
- $this->repeat_interval = $repeat_interval;
- }
-
- public function get_repeat_interval() { return
$this->repeat_interval; }
-
- public function set_procedure_id($procedure_id)
- {
- $this->procedure_id = $procedure_id;
- }
-
- public function get_procedure_id() { return
$this->procedure_id; }
-
- public function set_procedure_name($procedure_name)
- {
- $this->procedure_name = $procedure_name;
- }
-
- public function get_procedure_name() { return
$this->procedure_name; }
-
- public function set_enabled($enabled)
- {
- $this->enabled = $enabled;
- }
-
- public function get_enabled() { return $this->enabled; }
-
- public function set_requirement_id($requirement_id)
- {
- $this->requirement_id = $requirement_id;
- }
-
- public function get_requirement_id() { return
$this->requirement_id; }
-
- public function
set_costresponsibility_id($costresponsibility_id)
- {
- $this->costresponsibility_id = $costresponsibility_id;
- }
-
- public function get_costresponsibility_id() { return
$this->costresponsibility_id; }
-
- public function set_responsibility_id($responsibility_id)
- {
- $this->responsibility_id = $responsibility_id;
- }
-
- public function get_responsibility_id() { return
$this->responsibility_id; }
-
- public function set_responsibility_name($responsibility_name)
- {
- $this->responsibility_name = $responsibility_name;
- }
-
- public function get_responsibility_name() { return
$this->responsibility_name; }
-
- public function set_control_area_id($control_area_id)
- {
- $this->control_area_id = $control_area_id;
- }
-
- public function get_control_area_id() { return
$this->control_area_id; }
-
- public function set_control_area_name($control_area_name)
- {
- $this->control_area_name = $control_area_name;
- }
-
- public function get_control_area_name() { return
$this->control_area_name; }
-
- public function set_check_lists_array($check_lists_array)
- {
- $this->check_lists_array = $check_lists_array;
- }
-
- public function get_check_lists_array() { return
$this->check_lists_array; }
-
- public function
set_agg_open_cases_pr_month_array($agg_open_cases_pr_month_array)
- {
- $this->agg_open_cases_pr_month_array =
$agg_open_cases_pr_month_array;
- }
-
- public function get_agg_open_cases_pr_month_array() { return
$this->agg_open_cases_pr_month_array; }
-
- public function get_error_msg_array() { return
$this->error_msg_array; }
-
- public function set_error_msg_array( $error_msg_array )
- {
- $this->error_msg_array = $error_msg_array;
- }
-
- /**
- * Get a static reference to the storage object associated with
this model object
- *
- * @return the storage object
- */
- public static function get_so()
- {
- if (self::$so == null)
- {
- self::$so =
CreateObject('controller.socontrol');
- }
-
- return self::$so;
- }
-
- public function populate()
- {
-
$this->set_title(phpgw::get_var('title','string'));
-
$this->set_description(phpgw::get_var('description','html'));
-
- if(phpgw::get_var('start_date','string') != '')
- {
- $start_date_ts =
date_helper::get_timestamp_from_date( phpgw::get_var('start_date','string'),
"d/m-Y" );
- $this->set_start_date($start_date_ts);
- }else
- $this->set_start_date(0);
-
- if( phpgw::get_var('end_date','string') != '')
- {
- $end_date_ts =
date_helper::get_timestamp_from_date( phpgw::get_var('end_date','string'),
"d/m-Y" );
- $this->set_end_date( $end_date_ts );
- }else
- {
- $this->set_end_date( 0 );
- }
-
-
$this->set_repeat_type(phpgw::get_var('repeat_type','string'));
-
$this->set_repeat_interval(phpgw::get_var('repeat_interval','string'));
-
$this->set_procedure_id(phpgw::get_var('procedure_id','int'));
-
$this->set_control_area_id(phpgw::get_var('control_area_id','int'));
-
$this->set_responsibility_id(phpgw::get_var('responsibility_id','int'));
- }
-
- public function serialize()
- {
- return array(
- 'id' => $this->get_id(),
- 'title' => $this->get_title(),
- 'description' => $this->get_description(),
- 'start_date' => $this->get_start_date(),
- 'end_date' => $this->get_end_date(),
- 'procedure_id' => $this->get_procedure_id(),
- 'procedure_name' => $this->get_procedure_name(),
- 'control_area_id' =>
$this->get_control_area_id(),
- 'control_area_name' =>
$this->get_control_area_name(),
- 'repeat_type' => $this->get_repeat_type(),
- 'repeat_interval' =>
$this->get_repeat_interval(),
- 'responsibility_name' =>
$this->get_responsibility_name()
- );
- }
-
- public function validate()
- {
- $status = true;
-
- // Validate CONTROL AREA
- if( empty( $this->control_area_id ) &&
(intval($this->control_area_id) == 0) )
- {
- $status = false;
- $this->error_msg_array['control_area_id'] =
"error_msg_2";
- }
-
- // Validate PROCEDURE
- if( empty( $this->procedure_id ) &&
(intval($this->procedure_id) == 0) )
- {
- $status = false;
- $this->error_msg_array['procedure_id'] = "error_msg_2";
- }
-
- // Validate TITLE
- if( empty($this->title) )
- {
- $status = false;
- $this->error_msg_array['title'] = "error_msg_1";
- }
-
- // Validate START DATE
- if( empty($this->start_date) )
- {
- $status = false;
- $this->error_msg_array['start_date'] = "error_msg_1";
- }
+ public static $so;
- // Validate END DATE
- if( !empty($this->end_date) && ($this->end_date <
$this->start_date) )
- {
- $status = false;
- $this->error_msg_array['end_date'] = "error_msg_3";
- }
-
- // Validate REPEAT TYPE
- if( $this->repeat_type == "" )
- {
- $status = false;
- $this->error_msg_array['repeat_type'] = "error_msg_2";
- }
+ const REPEAT_TYPE_DAY = 0;
+ const REPEAT_TYPE_WEEK = 1;
+ const REPEAT_TYPE_MONTH = 2;
+ const REPEAT_TYPE_YEAR = 3;
- // Validate REPEAT INTERVAL
- if( ($this->repeat_interval == "") ||
(intval($this->repeat_interval) < 1) )
- {
- $status = false;
- $this->error_msg_array['repeat_interval'] =
"error_msg_1";
- }
-
- // Validate RESPONSIBILITY
- if( $this->responsibility_id == "" ||
(!is_numeric($this->responsibility_id)) )
- {
- $status = false;
- $this->error_msg_array['responsibility_id'] =
"error_msg_2";
- }
-
-
- return $status;
- }
- }
+ protected $id;
+ protected $title;
+ protected $description;
+ protected $start_date;
+ protected $end_date;
+ protected $repeat_type;
+ protected $repeat_type_label;
+ protected $repeat_interval;
+ protected $procedure_id;
+ protected $procedure_name;
+ protected $enabled;
+ protected $requirement_id;
+ protected $costresponsibility_id;
+ protected $responsibility_id;
+ protected $responsibility_name;
+ protected $control_area_id;
+ protected $control_area_name;
+ // Objects
+ protected $check_lists_array = array();
+ // Array that contains open cases for a month
+ protected $agg_open_cases_pr_month_array = array();
+ // Array that contains error messages. Is populted in function validate
+ protected $error_msg_array;
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is created from outside
+ * the database the ID should be empty so the database can add one according
to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+ public function __construct(int $id = null) {
+ $this->id = (int) $id;
+ }
+
+ public function set_id($id) {
+ $this->id = $id;
+ }
+
+ public function get_id() {
+ return $this->id;
+ }
+
+ public function set_title($title) {
+ $this->title = $title;
+ }
+
+ public function get_title() {
+ return $this->title;
+ }
+
+ public function set_description($description) {
+ $this->description = $description;
+ }
+
+ public function get_description() {
+ return $this->description;
+ }
+
+ public function set_end_date($end_date) {
+ $this->end_date = $end_date;
+ }
+
+ public function get_end_date() {
+ return $this->end_date;
+ }
+
+ public function set_start_date($start_date) {
+ $this->start_date = $start_date;
+ }
+
+ public function get_start_date() {
+ return $this->start_date;
+ }
+
+ public function set_repeat_type($repeat_type) {
+ $this->repeat_type = $repeat_type;
+ }
+
+ public function get_repeat_type() {
+ return $this->repeat_type;
+ }
+
+ public function set_repeat_type_label(int $repeat_type = null) {
+ switch ($repeat_type) {
+ case controller_control::REPEAT_TYPE_DAY:
+ $this->repeat_type_label = lang('repeat_type_day');
+ break;
+ case controller_control::REPEAT_TYPE_WEEK:
+ $this->repeat_type_label = lang('repeat_type_week');
+ break;
+ case controller_control::REPEAT_TYPE_MONTH:
+ $this->repeat_type_label = lang('repeat_type_month');
+ break;
+ case controller_control::REPEAT_TYPE_YEAR;
+ $this->repeat_type_label = lang('repeat_type_year');
+ break;
+ default:
+ $this->repeat_type_label = lang('repeat_type_none');
+ break;
+ }
+ }
+
+ public function get_repeat_type_label() {
+ return $this->repeat_type_label;
+ }
+
+ public function set_repeat_interval($repeat_interval) {
+ $this->repeat_interval = $repeat_interval;
+ }
+
+ public function get_repeat_interval() {
+ return $this->repeat_interval;
+ }
+
+ public function set_procedure_id($procedure_id) {
+ $this->procedure_id = $procedure_id;
+ }
+
+ public function get_procedure_id() {
+ return $this->procedure_id;
+ }
+
+ public function set_procedure_name($procedure_name) {
+ $this->procedure_name = $procedure_name;
+ }
+
+ public function get_procedure_name() {
+ return $this->procedure_name;
+ }
+
+ public function set_enabled($enabled) {
+ $this->enabled = $enabled;
+ }
+
+ public function get_enabled() {
+ return $this->enabled;
+ }
+
+ public function set_requirement_id($requirement_id) {
+ $this->requirement_id = $requirement_id;
+ }
+
+ public function get_requirement_id() {
+ return $this->requirement_id;
+ }
+
+ public function set_costresponsibility_id($costresponsibility_id) {
+ $this->costresponsibility_id = $costresponsibility_id;
+ }
+
+ public function get_costresponsibility_id() {
+ return $this->costresponsibility_id;
+ }
+
+ public function set_responsibility_id($responsibility_id) {
+ $this->responsibility_id = $responsibility_id;
+ }
+
+ public function get_responsibility_id() {
+ return $this->responsibility_id;
+ }
+
+ public function set_responsibility_name($responsibility_name) {
+ $this->responsibility_name = $responsibility_name;
+ }
+
+ public function get_responsibility_name() {
+ return $this->responsibility_name;
+ }
+
+ public function set_control_area_id($control_area_id) {
+ $this->control_area_id = $control_area_id;
+ }
+
+ public function get_control_area_id() {
+ return $this->control_area_id;
+ }
+
+ public function set_control_area_name($control_area_name) {
+ $this->control_area_name = $control_area_name;
+ }
+
+ public function get_control_area_name() {
+ return $this->control_area_name;
+ }
+
+ public function set_check_lists_array($check_lists_array) {
+ $this->check_lists_array = $check_lists_array;
+ }
+
+ public function get_check_lists_array() {
+ return $this->check_lists_array;
+ }
+
+ public function
set_agg_open_cases_pr_month_array($agg_open_cases_pr_month_array) {
+ $this->agg_open_cases_pr_month_array = $agg_open_cases_pr_month_array;
+ }
+
+ public function get_agg_open_cases_pr_month_array() {
+ return $this->agg_open_cases_pr_month_array;
+ }
+
+ public function get_error_msg_array() {
+ return $this->error_msg_array;
+ }
+
+ public function set_error_msg_array($error_msg_array) {
+ $this->error_msg_array = $error_msg_array;
+ }
+
+ /**
+ * Get a static reference to the storage object associated with this model
object
+ *
+ * @return the storage object
+ */
+ public static function get_so() {
+ if (self::$so == null) {
+ self::$so = CreateObject('controller.socontrol');
+ }
+
+ return self::$so;
+ }
+
+ public function populate() {
+ $this->set_title(phpgw::get_var('title', 'string'));
+ $this->set_description(phpgw::get_var('description', 'html'));
+
+ if (phpgw::get_var('start_date', 'string') != '') {
+ $start_date_ts =
date_helper::get_timestamp_from_date(phpgw::get_var('start_date', 'string'),
"d/m-Y");
+ $this->set_start_date($start_date_ts);
+ }else
+ $this->set_start_date(0);
+
+ if (phpgw::get_var('end_date', 'string') != '') {
+ $end_date_ts =
date_helper::get_timestamp_from_date(phpgw::get_var('end_date', 'string'),
"d/m-Y");
+ $this->set_end_date($end_date_ts);
+ } else {
+ $this->set_end_date(0);
+ }
+
+ $this->set_repeat_type(phpgw::get_var('repeat_type', 'string'));
+ $this->set_repeat_interval(phpgw::get_var('repeat_interval', 'string'));
+ $this->set_procedure_id(phpgw::get_var('procedure_id', 'int'));
+ $this->set_control_area_id(phpgw::get_var('control_area_id', 'int'));
+ $this->set_responsibility_id(phpgw::get_var('responsibility_id', 'int'));
+ }
+
+ public function serialize() {
+ return array(
+ 'id' => $this->get_id(),
+ 'title' => $this->get_title(),
+ 'description' => $this->get_description(),
+ 'start_date' => $this->get_start_date(),
+ 'end_date' => $this->get_end_date(),
+ 'procedure_id' => $this->get_procedure_id(),
+ 'procedure_name' => $this->get_procedure_name(),
+ 'control_area_id' => $this->get_control_area_id(),
+ 'control_area_name' => $this->get_control_area_name(),
+ 'repeat_type' => $this->get_repeat_type(),
+ 'repeat_interval' => $this->get_repeat_interval(),
+ 'responsibility_name' => $this->get_responsibility_name()
+ );
+ }
+
+ public function validate() {
+ $status = true;
+
+ // Validate CONTROL AREA
+ if (empty($this->control_area_id) && (intval($this->control_area_id) ==
0)) {
+ $status = false;
+ $this->error_msg_array['control_area_id'] = "error_msg_2";
+ }
+
+ // Validate PROCEDURE
+ if (empty($this->procedure_id) && (intval($this->procedure_id) == 0)) {
+ $status = false;
+ $this->error_msg_array['procedure_id'] = "error_msg_2";
+ }
+
+ // Validate TITLE
+ if (empty($this->title)) {
+ $status = false;
+ $this->error_msg_array['title'] = "error_msg_1";
+ }
+
+ // Validate START DATE
+ if (empty($this->start_date)) {
+ $status = false;
+ $this->error_msg_array['start_date'] = "error_msg_1";
+ }
+
+ // Validate END DATE
+ if (!empty($this->end_date) && ($this->end_date < $this->start_date)) {
+ $status = false;
+ $this->error_msg_array['end_date'] = "error_msg_3";
+ }
+
+ // Validate REPEAT TYPE
+ if ($this->repeat_type == "") {
+ $status = false;
+ $this->error_msg_array['repeat_type'] = "error_msg_2";
+ }
+
+ // Validate REPEAT INTERVAL
+ if (($this->repeat_interval == "") || (intval($this->repeat_interval) <
1)) {
+ $status = false;
+ $this->error_msg_array['repeat_interval'] = "error_msg_1";
+ }
+
+ // Validate RESPONSIBILITY
+ if ($this->responsibility_id == "" ||
(!is_numeric($this->responsibility_id))) {
+ $status = false;
+ $this->error_msg_array['responsibility_id'] = "error_msg_2";
+ }
+
+
+ return $status;
+ }
+
+}
Modified: trunk/controller/inc/model/class.control_area.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_area.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/model/class.control_area.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -1,35 +1,35 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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$
- */
- include_class('controller', 'model', 'inc/model/');
- /*
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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$
+ */
+include_class('controller', 'model', 'inc/model/');
+/*
class controller_control_area extends controller_model
{
public static $so;
Modified: trunk/controller/inc/model/class.control_group.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_group.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/model/class.control_group.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -1,175 +1,177 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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$
- */
- include_class('controller', 'model', 'inc/model/');
-
- class controller_control_group extends controller_model
- {
- public static $so;
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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$
+ */
+include_class('controller', 'model', 'inc/model/');
- protected $id;
- protected $group_name;
- protected $procedure_id;
- protected $procedure_name;
- protected $control_area_id;
- protected $control_area_name;
- protected $building_part_id;
- protected $building_part_descr;
- protected $order_nr;
-
- /**
- * Constructor. Takes an optional ID. If a contract is
created from outside
- * the database the ID should be empty so the database can add
one according to its logic.
- *
- * @param int $id the id of this composite
- */
- public function __construct(int $id = null)
- {
- $this->id = (int)$id;
- }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id() { return $this->id; }
+class controller_control_group extends controller_model {
- public function set_group_name($group_name)
- {
- $this->group_name = $group_name;
- }
-
- public function get_group_name(){ return $this->group_name; }
-
- public function set_procedure_id($procedure_id)
- {
- $this->procedure_id = $procedure_id;
- }
-
- public function get_procedure_id(){ return $this->procedure_id;
}
-
- public function set_procedure_name($procedure_name)
- {
- $this->procedure_name = $procedure_name;
- }
-
- public function get_procedure_name(){ return
$this->procedure_name; }
-
- public function set_control_area_id($control_area_id)
- {
- $this->control_area_id = $control_area_id;
- }
-
- public function get_control_area_id(){ return
$this->control_area_id; }
-
- public function set_control_area_name($control_area_name)
- {
- $this->control_area_name = $control_area_name;
- }
-
- public function get_control_area_name(){ return
$this->control_area_name; }
-
- public function set_building_part_id($building_part_id)
- {
- $this->building_part_id = $building_part_id;
- }
-
- public function get_building_part_id(){ return
$this->building_part_id; }
-
- public function set_building_part_descr($building_part_descr)
- {
- $this->building_part_descr = $building_part_descr;
- }
-
- public function get_building_part_descr(){ return
$this->building_part_descr; }
-
- public function set_order_nr($order_nr)
- {
- $this->order_nr = $order_nr;
- }
-
- public function get_order_nr(){ return $this->order_nr; }
+ public static $so;
+ protected $id;
+ protected $group_name;
+ protected $procedure_id;
+ protected $procedure_name;
+ protected $control_area_id;
+ protected $control_area_name;
+ protected $building_part_id;
+ protected $building_part_descr;
+ protected $order_nr;
- public function serialize()
- {
- $result = array();
- $result['id'] = $this->get_id();
- $result['group_name'] = $this->get_group_name();
- $result['procedure'] = $this->get_procedure_name();
- $result['control_area'] =
$this->get_control_area_name();
- $result['building_part'] =
$this->get_building_part_descr();
- $result['order_nr'] = $this->get_order_nr();
-
- return $result;
- }
-
- public function toArray()
- {
+ /**
+ * Constructor. Takes an optional ID. If a contract is created from outside
+ * the database the ID should be empty so the database can add one according
to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+ public function __construct(int $id = null) {
+ $this->id = (int) $id;
+ }
+ public function set_id($id) {
+ $this->id = $id;
+ }
+
+ public function get_id() {
+ return $this->id;
+ }
+
+ public function set_group_name($group_name) {
+ $this->group_name = $group_name;
+ }
+
+ public function get_group_name() {
+ return $this->group_name;
+ }
+
+ public function set_procedure_id($procedure_id) {
+ $this->procedure_id = $procedure_id;
+ }
+
+ public function get_procedure_id() {
+ return $this->procedure_id;
+ }
+
+ public function set_procedure_name($procedure_name) {
+ $this->procedure_name = $procedure_name;
+ }
+
+ public function get_procedure_name() {
+ return $this->procedure_name;
+ }
+
+ public function set_control_area_id($control_area_id) {
+ $this->control_area_id = $control_area_id;
+ }
+
+ public function get_control_area_id() {
+ return $this->control_area_id;
+ }
+
+ public function set_control_area_name($control_area_name) {
+ $this->control_area_name = $control_area_name;
+ }
+
+ public function get_control_area_name() {
+ return $this->control_area_name;
+ }
+
+ public function set_building_part_id($building_part_id) {
+ $this->building_part_id = $building_part_id;
+ }
+
+ public function get_building_part_id() {
+ return $this->building_part_id;
+ }
+
+ public function set_building_part_descr($building_part_descr) {
+ $this->building_part_descr = $building_part_descr;
+ }
+
+ public function get_building_part_descr() {
+ return $this->building_part_descr;
+ }
+
+ public function set_order_nr($order_nr) {
+ $this->order_nr = $order_nr;
+ }
+
+ public function get_order_nr() {
+ return $this->order_nr;
+ }
+
+ public function serialize() {
+ $result = array();
+ $result['id'] = $this->get_id();
+ $result['group_name'] = $this->get_group_name();
+ $result['procedure'] = $this->get_procedure_name();
+ $result['control_area'] = $this->get_control_area_name();
+ $result['building_part'] = $this->get_building_part_descr();
+ $result['order_nr'] = $this->get_order_nr();
+
+ return $result;
+ }
+
+ public function toArray() {
+
// Alternative 1
// return get_object_vars($this);
-
// Alternative 2
- $exclude = array
- (
- 'get_field', // feiler (foreldreklassen)
- 'get_so',//unødvendig
- );
-
- $class_methods = get_class_methods($this);
- $control_group_arr = array();
- foreach ($class_methods as $class_method)
- {
- if( stripos($class_method , 'get_' ) === 0 &&
!in_array($class_method, $exclude))
- {
- $_class_method_part = explode('get_',
$class_method);
-
$control_group_arr[$_class_method_part[1]] = $this->$class_method();
- }
- }
+ $exclude = array
+ (
+ 'get_field', // feiler (foreldreklassen)
+ 'get_so', //unødvendig
+ );
+ $class_methods = get_class_methods($this);
+ $control_group_arr = array();
+ foreach ($class_methods as $class_method) {
+ if (stripos($class_method, 'get_') === 0 && !in_array($class_method,
$exclude)) {
+ $_class_method_part = explode('get_', $class_method);
+ $control_group_arr[$_class_method_part[1]] = $this->$class_method();
+ }
+ }
+
// _debug_array($control_group_arr);
- return $control_group_arr;
- }
-
- /**
- * Get a static reference to the storage object associated with
this model object
- *
- * @return the storage object
- */
- public static function get_so()
- {
- if (self::$so == null) {
- self::$so =
CreateObject('controller.socontrol_group');
- }
-
- return self::$so;
- }
- }
+ return $control_group_arr;
+ }
+
+ /**
+ * Get a static reference to the storage object associated with this model
object
+ *
+ * @return the storage object
+ */
+ public static function get_so() {
+ if (self::$so == null) {
+ self::$so = CreateObject('controller.socontrol_group');
+ }
+
+ return self::$so;
+ }
+
+}
Modified: trunk/controller/inc/model/class.control_group_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_group_list.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/model/class.control_group_list.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -1,106 +1,106 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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$
- */
- include_class('controller', 'model', 'inc/model/');
-
- class controller_control_group_list extends controller_model
- {
- public static $so;
-
- protected $id;
- protected $control_id;
- protected $control_group_id;
- protected $order_nr;
-
- /**
- * Constructor. Takes an optional ID. If a contract is
created from outside
- * the database the ID should be empty so the database can add
one according to its logic.
- *
- * @param int $id the id of this composite
- */
- public function __construct(int $id = null)
- {
- $this->id = (int)$id;
- }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id() { return $this->id; }
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink 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$
+ */
+include_class('controller', 'model', 'inc/model/');
- public function set_control_id($control_id)
- {
- $this->control_id = $control_id;
- }
-
- public function get_control_id() { return $this->control_id; }
-
- public function set_control_group_id($control_group_id)
- {
- $this->control_group_id = $control_group_id;
- }
-
- public function get_control_group_id() { return
$this->control_group_id; }
-
- public function set_order_nr($order_nr)
- {
- $this->order_nr = $order_nr;
- }
-
- public function get_order_nr() { return $this->order_nr; }
-
- /**
- * Get a static reference to the storage object associated with
this model object
- *
- * @return the storage object
- */
- public static function get_so()
- {
- if (self::$so == null)
- {
- self::$so =
CreateObject('controller.socontrol_group_list');
- }
-
- return self::$so;
- }
-
- public function serialize()
- {
- $result = array();
- $result['id'] = $this->get_id();
- $result['control_id'] = $this->get_control_id();
- $result['control_group_id'] =
$this->get_control_group_id();
- $result['order_nr'] = $this->get_order_nr();
-
- return $result;
- }
- }
+class controller_control_group_list extends controller_model {
+
+ public static $so;
+ protected $id;
+ protected $control_id;
+ protected $control_group_id;
+ protected $order_nr;
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is created from outside
+ * the database the ID should be empty so the database can add one according
to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+ public function __construct(int $id = null) {
+ $this->id = (int) $id;
+ }
+
+ public function set_id($id) {
+ $this->id = $id;
+ }
+
+ public function get_id() {
+ return $this->id;
+ }
+
+ public function set_control_id($control_id) {
+ $this->control_id = $control_id;
+ }
+
+ public function get_control_id() {
+ return $this->control_id;
+ }
+
+ public function set_control_group_id($control_group_id) {
+ $this->control_group_id = $control_group_id;
+ }
+
+ public function get_control_group_id() {
+ return $this->control_group_id;
+ }
+
+ public function set_order_nr($order_nr) {
+ $this->order_nr = $order_nr;
+ }
+
+ public function get_order_nr() {
+ return $this->order_nr;
+ }
+
+ /**
+ * Get a static reference to the storage object associated with this model
object
+ *
+ * @return the storage object
+ */
+ public static function get_so() {
+ if (self::$so == null) {
+ self::$so = CreateObject('controller.socontrol_group_list');
+ }
+
+ return self::$so;
+ }
+
+ public function serialize() {
+ $result = array();
+ $result['id'] = $this->get_id();
+ $result['control_id'] = $this->get_control_id();
+ $result['control_group_id'] = $this->get_control_group_id();
+ $result['order_nr'] = $this->get_order_nr();
+
+ return $result;
+ }
+
+}
Modified: trunk/controller/inc/model/class.control_item.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_item.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/model/class.control_item.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -1,212 +1,212 @@
<?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$
- */
- include_class('controller', 'model', 'inc/model/');
-
- class controller_control_item extends controller_model
- {
- public static $so;
-
- public $type_array = array("control_item_type_1",
"control_item_type_2", "control_item_type_3", "control_item_type_4");
-
- protected $id;
- protected $title;
- protected $required;
- protected $what_to_do;
- protected $how_to_do;
- protected $control_group_id;
- protected $control_group_name;
- protected $control_area_id;
- protected $control_area_name;
- protected $type;
-
- protected $options_array;
- protected $error_msg_array;
-
- /**
- * Constructor. Takes an optional ID. If a contract is
created from outside
- * the database the ID should be empty so the database can add
one according to its logic.
- *
- * @param int $id the id of this composite
- */
- public function __construct(int $id = null)
- {
- $this->id = (int)$id;
- }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id() { return $this->id; }
+/**
+ * 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$
+ */
+include_class('controller', 'model', 'inc/model/');
- public function set_title($title)
- {
- $this->title = $title;
- }
-
- public function get_title() { return $this->title; }
-
- public function set_required($required)
- {
- $this->required = $required;
- }
-
- public function get_required() { return $this->required; }
-
- public function set_what_to_do($what_to_do)
- {
- $this->what_to_do = $what_to_do;
- }
-
- public function get_what_to_do() { return $this->what_to_do; }
-
- public function set_how_to_do($how_to_do)
- {
- $this->how_to_do = $how_to_do;
- }
-
- public function get_how_to_do() { return $this->how_to_do; }
-
- public function set_control_group_id($control_group_id)
- {
- $this->control_group_id = $control_group_id;
- }
-
- public function get_control_group_id() { return
$this->control_group_id; }
-
- public function set_control_group_name($control_group_name)
- {
- $this->control_group_name = $control_group_name;
- }
-
- public function get_control_group_name() { return
$this->control_group_name; }
-
- public function set_control_area_id($control_area_id)
- {
- $this->control_area_id = $control_area_id;
- }
-
- public function get_control_area_id() { return
$this->control_area_id; }
-
- public function set_control_area_name($control_area_name)
- {
- $this->control_area_name = $control_area_name;
- }
-
- public function get_control_area_name() { return
$this->control_area_name; }
-
- public function set_type($type)
- {
- $this->type = $type;
- }
-
- public function get_type() { return $this->type; }
-
- public function set_options_array($options_array)
- {
- $this->options_array = $options_array;
- }
-
- public function get_options_array() { return
$this->options_array; }
-
- public function get_control_item_types()
- {
- return array_values( $this->type_array );
- }
-
- public function get_error_msg_array() { return
$this->error_msg_array; }
-
- public function set_error_msg_array( $error_msg_array )
- {
- $this->error_msg_array = $error_msg_array;
- }
-
- /**
- * Get a static reference to the storage object associated with
this model object
- *
- * @return the storage object
- */
- public static function get_so()
- {
- if (self::$so == null)
- {
- self::$so =
CreateObject('controller.socontrol_item');
- }
-
- return self::$so;
- }
-
- public function serialize()
- {
- $result = array();
- $result['id'] = $this->get_id();
- $result['title'] = $this->get_title();
- $result['required'] = $this->get_required();
- $result['what_to_do'] = $this->get_what_to_do();
- $result['how_to_do'] = $this->get_how_to_do();
- $result['control_group'] =
$this->get_control_group_name();
- $result['control_area'] =
$this->get_control_area_name();
- $result['control_area'] =
$this->get_control_area_name();
-
- return $result;
- }
-
- public function validate()
- {
- $status = true;
-
- if( $this->title == '')
- {
- $status = false;
- $this->error_msg_array['title'] = "error_msg_1";
- }
+class controller_control_item extends controller_model {
- if( $this->what_to_do == '' | strlen( $this->what_to_do ) ==
0 )
- {
- $status = false;
- $this->error_msg_array['what_to_do'] = "error_msg_1";
- }
-
- if( $this->how_to_do == '')
- {
- $status = false;
- $this->error_msg_array['how_to_do'] = "error_msg_1";
- }
-
- if( $this->control_area_id == '' &&
intval($this->control_area_id) > 0)
- {
- $status = false;
- $this->error_msg_array['control_area_id'] =
"error_msg_2";
- }
- return $status;
- }
- }
\ No newline at end of file
+ public static $so;
+ public $type_array = array("control_item_type_1", "control_item_type_2",
"control_item_type_3", "control_item_type_4");
+ protected $id;
+ protected $title;
+ protected $required;
+ protected $what_to_do;
+ protected $how_to_do;
+ protected $control_group_id;
+ protected $control_group_name;
+ protected $control_area_id;
+ protected $control_area_name;
+ protected $type;
+ protected $options_array;
+ protected $error_msg_array;
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is created from outside
+ * the database the ID should be empty so the database can add one according
to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+ public function __construct(int $id = null) {
+ $this->id = (int) $id;
+ }
+
+ public function set_id($id) {
+ $this->id = $id;
+ }
+
+ public function get_id() {
+ return $this->id;
+ }
+
+ public function set_title($title) {
+ $this->title = $title;
+ }
+
+ public function get_title() {
+ return $this->title;
+ }
+
+ public function set_required($required) {
+ $this->required = $required;
+ }
+
+ public function get_required() {
+ return $this->required;
+ }
+
+ public function set_what_to_do($what_to_do) {
+ $this->what_to_do = $what_to_do;
+ }
+
+ public function get_what_to_do() {
+ return $this->what_to_do;
+ }
+
+ public function set_how_to_do($how_to_do) {
+ $this->how_to_do = $how_to_do;
+ }
+
+ public function get_how_to_do() {
+ return $this->how_to_do;
+ }
+
+ public function set_control_group_id($control_group_id) {
+ $this->control_group_id = $control_group_id;
+ }
+
+ public function get_control_group_id() {
+ return $this->control_group_id;
+ }
+
+ public function set_control_group_name($control_group_name) {
+ $this->control_group_name = $control_group_name;
+ }
+
+ public function get_control_group_name() {
+ return $this->control_group_name;
+ }
+
+ public function set_control_area_id($control_area_id) {
+ $this->control_area_id = $control_area_id;
+ }
+
+ public function get_control_area_id() {
+ return $this->control_area_id;
+ }
+
+ public function set_control_area_name($control_area_name) {
+ $this->control_area_name = $control_area_name;
+ }
+
+ public function get_control_area_name() {
+ return $this->control_area_name;
+ }
+
+ public function set_type($type) {
+ $this->type = $type;
+ }
+
+ public function get_type() {
+ return $this->type;
+ }
+
+ public function set_options_array($options_array) {
+ $this->options_array = $options_array;
+ }
+
+ public function get_options_array() {
+ return $this->options_array;
+ }
+
+ public function get_control_item_types() {
+ return array_values($this->type_array);
+ }
+
+ public function get_error_msg_array() {
+ return $this->error_msg_array;
+ }
+
+ public function set_error_msg_array($error_msg_array) {
+ $this->error_msg_array = $error_msg_array;
+ }
+
+ /**
+ * Get a static reference to the storage object associated with this model
object
+ *
+ * @return the storage object
+ */
+ public static function get_so() {
+ if (self::$so == null) {
+ self::$so = CreateObject('controller.socontrol_item');
+ }
+
+ return self::$so;
+ }
+
+ public function serialize() {
+ $result = array();
+ $result['id'] = $this->get_id();
+ $result['title'] = $this->get_title();
+ $result['required'] = $this->get_required();
+ $result['what_to_do'] = $this->get_what_to_do();
+ $result['how_to_do'] = $this->get_how_to_do();
+ $result['control_group'] = $this->get_control_group_name();
+ $result['control_area'] = $this->get_control_area_name();
+ $result['control_area'] = $this->get_control_area_name();
+
+ return $result;
+ }
+
+ public function validate() {
+ $status = true;
+
+ if ($this->title == '') {
+ $status = false;
+ $this->error_msg_array['title'] = "error_msg_1";
+ }
+
+ if ($this->what_to_do == '' | strlen($this->what_to_do) == 0) {
+ $status = false;
+ $this->error_msg_array['what_to_do'] = "error_msg_1";
+ }
+
+ if ($this->how_to_do == '') {
+ $status = false;
+ $this->error_msg_array['how_to_do'] = "error_msg_1";
+ }
+
+ if ($this->control_area_id == '' && intval($this->control_area_id) > 0) {
+ $status = false;
+ $this->error_msg_array['control_area_id'] = "error_msg_2";
+ }
+ return $status;
+ }
+
+}
\ No newline at end of file
Modified: trunk/controller/inc/model/class.control_item_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_item_list.inc.php 2012-08-31
08:31:33 UTC (rev 9947)
+++ trunk/controller/inc/model/class.control_item_list.inc.php 2012-08-31
09:06:16 UTC (rev 9948)
@@ -1,96 +1,96 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink 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
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9948] Formatering fra Netbeans,
Torstein <=