fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [8283] Merge 8252:8282 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [8283] Merge 8252:8282 from trunk
Date: Tue, 13 Dec 2011 10:00:58 +0000

Revision: 8283
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8283
Author:   sigurdne
Date:     2011-12-13 10:00:58 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
Merge 8252:8282 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
    branches/Version-1_0-branch/bim/setup/setup.inc.php
    branches/Version-1_0-branch/bim/setup/tables_current.inc.php
    branches/Version-1_0-branch/bim/setup/tables_update.inc.php
    branches/Version-1_0-branch/controller/inc/class.menu.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
    
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
    
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
    
branches/Version-1_0-branch/controller/inc/class.uilocation_check_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
    
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_info.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.check_item.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control_area.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
    
branches/Version-1_0-branch/controller/inc/model/class.control_group_list.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
    
branches/Version-1_0-branch/controller/inc/model/class.control_item_list.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.model.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.schedule.inc.php
    branches/Version-1_0-branch/controller/index.php
    branches/Version-1_0-branch/controller/js/controller/ajax.js
    branches/Version-1_0-branch/controller/js/yahoo/common.js
    branches/Version-1_0-branch/controller/js/yahoo/control_tabs.js
    branches/Version-1_0-branch/controller/js/yahoo/datatable.js
    branches/Version-1_0-branch/controller/setup/default_records.inc.php
    branches/Version-1_0-branch/controller/setup/phpgw_no.lang
    branches/Version-1_0-branch/controller/setup/setup.inc.php
    branches/Version-1_0-branch/controller/setup/tables_current.inc.php
    branches/Version-1_0-branch/controller/setup/tables_update.inc.php
    
branches/Version-1_0-branch/controller/templates/base/add_location_to_control.xsl
    branches/Version-1_0-branch/controller/templates/base/app_data.xsl
    
branches/Version-1_0-branch/controller/templates/base/choose_control_items.xsl
    branches/Version-1_0-branch/controller/templates/base/common.php
    branches/Version-1_0-branch/controller/templates/base/common.xsl
    branches/Version-1_0-branch/controller/templates/base/control.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_check_lists.xsl
    branches/Version-1_0-branch/controller/templates/base/control_group.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_group_items.xsl
    branches/Version-1_0-branch/controller/templates/base/control_group_tabs.xsl
    branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
    branches/Version-1_0-branch/controller/templates/base/control_item.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_location_tabs.xsl
    branches/Version-1_0-branch/controller/templates/base/control_locations.xsl
    branches/Version-1_0-branch/controller/templates/base/control_tabs.xsl
    branches/Version-1_0-branch/controller/templates/base/datatable.xsl
    branches/Version-1_0-branch/controller/templates/base/edit_check_list.xsl
    branches/Version-1_0-branch/controller/templates/base/procedure_item.xsl
    branches/Version-1_0-branch/controller/templates/base/sort_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/tab_view_check_lists.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_month.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_year.xsl
    branches/Version-1_0-branch/controller/templates/base/view_check_list.xsl
    branches/Version-1_0-branch/controller/templates/base/view_check_lists.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_control_item_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_locations_for_control.xsl
    branches/Version-1_0-branch/controller/templates/base/yui_booking_i18n.xsl
    branches/Version-1_0-branch/phpgwapi/inc/class.locations.inc.php
    branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
    branches/Version-1_0-branch/property/inc/class.boresponsible.inc.php
    branches/Version-1_0-branch/property/inc/class.fileuploader.inc.php
    branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php
    branches/Version-1_0-branch/property/inc/class.soexportentity.inc.php
    branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.solocation.inc.php
    branches/Version-1_0-branch/property/inc/class.soresponsible.inc.php
    branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.uilocation.inc.php
    branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
    branches/Version-1_0-branch/property/inc/class.uiresponsible.inc.php
    branches/Version-1_0-branch/property/setup/phpgw_no.lang
    branches/Version-1_0-branch/property/setup/setup.inc.php
    branches/Version-1_0-branch/property/setup/tables_current.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/templates/base/invoice_reporting.xsl

Added Paths:
-----------
    branches/Version-1_0-branch/controller/inc/class.cat_hooks.inc.php
    
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
    branches/Version-1_0-branch/controller/inc/hook_home.inc.php
    branches/Version-1_0-branch/controller/js/yahoo/component_location.js
    
branches/Version-1_0-branch/controller/templates/base/add_component_to_control.xsl
    branches/Version-1_0-branch/controller/templates/base/component.xsl
    branches/Version-1_0-branch/controller/templates/base/config.tpl
    branches/Version-1_0-branch/controller/templates/base/control_component.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_component_tabs.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_component_for_control.xsl
    branches/Version-1_0-branch/phpgwapi/inc/class.wiki2html.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/wiki2html/
    branches/Version-1_0-branch/property/test_wiki.php

Removed Paths:
-------------
    
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_equipment.inc.php
    branches/Version-1_0-branch/controller/js/yahoo/equipment_location.js
    branches/Version-1_0-branch/controller/templates/base/control_equipment.xsl
    branches/Version-1_0-branch/controller/templates/base/equipment.xsl

Property Changed:
----------------
    branches/Version-1_0-branch/
    branches/Version-1_0-branch/controller/inc/class.menu.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
    
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
    
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
    
branches/Version-1_0-branch/controller/inc/class.uilocation_check_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
    
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_info.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.check_item.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control_area.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
    
branches/Version-1_0-branch/controller/inc/model/class.control_group_list.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
    
branches/Version-1_0-branch/controller/inc/model/class.control_item_list.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.model.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.schedule.inc.php
    branches/Version-1_0-branch/controller/index.php
    branches/Version-1_0-branch/controller/setup/default_records.inc.php
    branches/Version-1_0-branch/controller/setup/setup.inc.php
    branches/Version-1_0-branch/controller/setup/tables_current.inc.php
    branches/Version-1_0-branch/controller/setup/tables_update.inc.php
    
branches/Version-1_0-branch/controller/templates/base/add_location_to_control.xsl
    branches/Version-1_0-branch/controller/templates/base/app_data.xsl
    
branches/Version-1_0-branch/controller/templates/base/choose_control_items.xsl
    branches/Version-1_0-branch/controller/templates/base/common.php
    branches/Version-1_0-branch/controller/templates/base/common.xsl
    branches/Version-1_0-branch/controller/templates/base/control.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_check_lists.xsl
    branches/Version-1_0-branch/controller/templates/base/control_group.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_group_items.xsl
    branches/Version-1_0-branch/controller/templates/base/control_group_tabs.xsl
    branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
    branches/Version-1_0-branch/controller/templates/base/control_item.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_location_tabs.xsl
    branches/Version-1_0-branch/controller/templates/base/control_locations.xsl
    branches/Version-1_0-branch/controller/templates/base/control_tabs.xsl
    branches/Version-1_0-branch/controller/templates/base/datatable.xsl
    branches/Version-1_0-branch/controller/templates/base/edit_check_list.xsl
    branches/Version-1_0-branch/controller/templates/base/procedure_item.xsl
    branches/Version-1_0-branch/controller/templates/base/sort_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/tab_view_check_lists.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_month.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_year.xsl
    branches/Version-1_0-branch/controller/templates/base/view_check_list.xsl
    branches/Version-1_0-branch/controller/templates/base/view_check_lists.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_control_item_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_locations_for_control.xsl
    branches/Version-1_0-branch/controller/templates/base/yui_booking_i18n.xsl
    branches/Version-1_0-branch/property/help/EN/agreements.php
    branches/Version-1_0-branch/property/help/EN/document.php
    branches/Version-1_0-branch/property/help/EN/entities.php
    branches/Version-1_0-branch/property/help/EN/helpdesk.php
    branches/Version-1_0-branch/property/help/EN/invoice.php
    branches/Version-1_0-branch/property/help/EN/location.php
    branches/Version-1_0-branch/property/help/EN/overview.php
    branches/Version-1_0-branch/property/help/EN/project.php
    branches/Version-1_0-branch/property/help/EN/property.php
    branches/Version-1_0-branch/property/help/EN/requirement.php
    branches/Version-1_0-branch/property/help/index.php
    branches/Version-1_0-branch/property/inc/class.XmlToArray.inc.php
    branches/Version-1_0-branch/property/inc/class.boXport.inc.php
    branches/Version-1_0-branch/property/inc/class.boadmin.inc.php
    branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php
    branches/Version-1_0-branch/property/inc/class.boadmin_location.inc.php
    branches/Version-1_0-branch/property/inc/class.boagreement.inc.php
    branches/Version-1_0-branch/property/inc/class.boalarm.inc.php
    branches/Version-1_0-branch/property/inc/class.boasync.inc.php
    branches/Version-1_0-branch/property/inc/class.bobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
    branches/Version-1_0-branch/property/inc/class.bocustom.inc.php
    branches/Version-1_0-branch/property/inc/class.bodocument.inc.php
    branches/Version-1_0-branch/property/inc/class.boentity.inc.php
    branches/Version-1_0-branch/property/inc/class.boevent.inc.php
    branches/Version-1_0-branch/property/inc/class.bofiles.inc.php
    branches/Version-1_0-branch/property/inc/class.bogab.inc.php
    branches/Version-1_0-branch/property/inc/class.bogallery.inc.php
    branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.boifc.inc.php
    branches/Version-1_0-branch/property/inc/class.boinvestment.inc.php
    branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.bojasper.inc.php
    branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
    branches/Version-1_0-branch/property/inc/class.bolookup.inc.php
    branches/Version-1_0-branch/property/inc/class.bomigrate.inc.php
    branches/Version-1_0-branch/property/inc/class.bopricebook.inc.php
    branches/Version-1_0-branch/property/inc/class.boproject.inc.php
    branches/Version-1_0-branch/property/inc/class.borequest.inc.php
    branches/Version-1_0-branch/property/inc/class.boresponsible.inc.php
    branches/Version-1_0-branch/property/inc/class.bos_agreement.inc.php
    branches/Version-1_0-branch/property/inc/class.botemplate.inc.php
    branches/Version-1_0-branch/property/inc/class.botenant_claim.inc.php
    branches/Version-1_0-branch/property/inc/class.botts.inc.php
    branches/Version-1_0-branch/property/inc/class.bowo_hour.inc.php
    branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
    branches/Version-1_0-branch/property/inc/class.cat_hooks.inc.php
    branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
    branches/Version-1_0-branch/property/inc/class.custom_functions.inc.php
    branches/Version-1_0-branch/property/inc/class.db_mssql.inc.php
    branches/Version-1_0-branch/property/inc/class.db_oci8.inc.php
    branches/Version-1_0-branch/property/inc/class.fileuploader.inc.php
    branches/Version-1_0-branch/property/inc/class.historylog.inc.php
    branches/Version-1_0-branch/property/inc/class.hook_helper.inc.php
    branches/Version-1_0-branch/property/inc/class.import.inc.php
    branches/Version-1_0-branch/property/inc/class.interlink.inc.php
    branches/Version-1_0-branch/property/inc/class.menu.inc.php
    branches/Version-1_0-branch/property/inc/class.ods.inc.php
    branches/Version-1_0-branch/property/inc/class.soXport.inc.php
    branches/Version-1_0-branch/property/inc/class.soadmin.inc.php
    branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php
    branches/Version-1_0-branch/property/inc/class.soadmin_location.inc.php
    branches/Version-1_0-branch/property/inc/class.soagreement.inc.php
    branches/Version-1_0-branch/property/inc/class.soalarm.inc.php
    branches/Version-1_0-branch/property/inc/class.soasync.inc.php
    branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.socommon.inc.php
    branches/Version-1_0-branch/property/inc/class.socustom.inc.php
    branches/Version-1_0-branch/property/inc/class.sodocument.inc.php
    branches/Version-1_0-branch/property/inc/class.soentity.inc.php
    branches/Version-1_0-branch/property/inc/class.soevent.inc.php
    branches/Version-1_0-branch/property/inc/class.soexportentity.inc.php
    branches/Version-1_0-branch/property/inc/class.sogab.inc.php
    branches/Version-1_0-branch/property/inc/class.sogallery.inc.php
    branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.soinvestment.inc.php
    branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.sojasper.inc.php
    branches/Version-1_0-branch/property/inc/class.solocation.inc.php
    branches/Version-1_0-branch/property/inc/class.solookup.inc.php
    branches/Version-1_0-branch/property/inc/class.sopending_action.inc.php
    branches/Version-1_0-branch/property/inc/class.sopricebook.inc.php
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
    branches/Version-1_0-branch/property/inc/class.soresponsible.inc.php
    branches/Version-1_0-branch/property/inc/class.sos_agreement.inc.php
    branches/Version-1_0-branch/property/inc/class.sotemplate.inc.php
    branches/Version-1_0-branch/property/inc/class.sotenant_claim.inc.php
    branches/Version-1_0-branch/property/inc/class.sotts.inc.php
    branches/Version-1_0-branch/property/inc/class.sowo_hour.inc.php
    branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
    branches/Version-1_0-branch/property/inc/class.test.inc.php
    branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
    branches/Version-1_0-branch/property/inc/class.uiadmin.inc.php
    branches/Version-1_0-branch/property/inc/class.uiadmin_entity.inc.php
    branches/Version-1_0-branch/property/inc/class.uiadmin_location.inc.php
    branches/Version-1_0-branch/property/inc/class.uiagreement.inc.php
    branches/Version-1_0-branch/property/inc/class.uialarm.inc.php
    branches/Version-1_0-branch/property/inc/class.uiasync.inc.php
    branches/Version-1_0-branch/property/inc/class.uibudget.inc.php
    branches/Version-1_0-branch/property/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/property/inc/class.uicustom.inc.php
    branches/Version-1_0-branch/property/inc/class.uidebug_json.inc.php
    branches/Version-1_0-branch/property/inc/class.uidocument.inc.php
    branches/Version-1_0-branch/property/inc/class.uientity.inc.php
    branches/Version-1_0-branch/property/inc/class.uievent.inc.php
    branches/Version-1_0-branch/property/inc/class.uigab.inc.php
    branches/Version-1_0-branch/property/inc/class.uigallery.inc.php
    branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.uiifc.inc.php
    branches/Version-1_0-branch/property/inc/class.uiimport.inc.php
    branches/Version-1_0-branch/property/inc/class.uiinvestment.inc.php
    branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.uijasper.inc.php
    branches/Version-1_0-branch/property/inc/class.uilocation.inc.php
    branches/Version-1_0-branch/property/inc/class.uilookup.inc.php
    branches/Version-1_0-branch/property/inc/class.uimigrate.inc.php
    branches/Version-1_0-branch/property/inc/class.uipricebook.inc.php
    branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
    branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
    branches/Version-1_0-branch/property/inc/class.uiresponsible.inc.php
    branches/Version-1_0-branch/property/inc/class.uis_agreement.inc.php
    branches/Version-1_0-branch/property/inc/class.uitemplate.inc.php
    branches/Version-1_0-branch/property/inc/class.uitenant_claim.inc.php
    branches/Version-1_0-branch/property/inc/class.uitts.inc.php
    branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
    branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
    branches/Version-1_0-branch/property/inc/cron/cron.php
    
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
    branches/Version-1_0-branch/property/inc/cron/default/catch_ppc.php
    
branches/Version-1_0-branch/property/inc/cron/default/export_info_as_files.php
    
branches/Version-1_0-branch/property/inc/cron/default/forward_mail_as_sms.php
    branches/Version-1_0-branch/property/inc/cron/default/import_files.php
    
branches/Version-1_0-branch/property/inc/cron/default/import_from_scanner.php
    branches/Version-1_0-branch/property/inc/cron/default/lag_lang_filer.php
    
branches/Version-1_0-branch/property/inc/cron/default/oppdater_antall_leieobjekt.php
    
branches/Version-1_0-branch/property/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
    
branches/Version-1_0-branch/property/inc/cron/default/oppdater_utgaatt_objekt.php
    branches/Version-1_0-branch/property/inc/cron/default/organize_drawing.php
    
branches/Version-1_0-branch/property/inc/cron/default/synkroniser_med_boei.php
    branches/Version-1_0-branch/property/inc/cron/default/update_googlemap.php
    branches/Version-1_0-branch/property/inc/cron/default/update_phpgw.php
    
branches/Version-1_0-branch/property/inc/cron/default/update_workorder_status.php
    
branches/Version-1_0-branch/property/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
    
branches/Version-1_0-branch/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
    
branches/Version-1_0-branch/property/inc/custom/default/innflyttetdato_entity_2_11_BBB.php
    
branches/Version-1_0-branch/property/inc/custom/default/kalkuler_risiko_for_ros.php
    
branches/Version-1_0-branch/property/inc/custom/default/varsle_prosjektoordinator_ved_avsluttet_relatert_melding_BBB.php
    branches/Version-1_0-branch/property/inc/hook_config.inc.php
    branches/Version-1_0-branch/property/inc/hook_help.inc.php
    branches/Version-1_0-branch/property/inc/hook_home.inc.php
    branches/Version-1_0-branch/property/inc/hook_manual.inc.php
    branches/Version-1_0-branch/property/inc/hook_settings.inc.php
    branches/Version-1_0-branch/property/inc/hook_sidebox_menu.inc.php
    branches/Version-1_0-branch/property/inc/ods/ods.php
    branches/Version-1_0-branch/property/index.php
    branches/Version-1_0-branch/property/js/newdesign/CRUDTable.php
    branches/Version-1_0-branch/property/login.php
    branches/Version-1_0-branch/property/setup/default_records.inc.php
    branches/Version-1_0-branch/property/setup/setup.inc.php
    branches/Version-1_0-branch/property/setup/tables_current.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/templates/base/abook_form.xsl
    branches/Version-1_0-branch/property/templates/base/abook_view.xsl
    branches/Version-1_0-branch/property/templates/base/admin.xsl
    branches/Version-1_0-branch/property/templates/base/admin_entity.xsl
    branches/Version-1_0-branch/property/templates/base/admin_location.xsl
    branches/Version-1_0-branch/property/templates/base/agreement.xsl
    branches/Version-1_0-branch/property/templates/base/alarm.xsl
    branches/Version-1_0-branch/property/templates/base/alarm_form.xsl
    branches/Version-1_0-branch/property/templates/base/alarm_view.xsl
    branches/Version-1_0-branch/property/templates/base/app_data.xsl
    branches/Version-1_0-branch/property/templates/base/app_delete.xsl
    branches/Version-1_0-branch/property/templates/base/async.xsl
    branches/Version-1_0-branch/property/templates/base/attrib_history.xsl
    branches/Version-1_0-branch/property/templates/base/attributes_form.xsl
    branches/Version-1_0-branch/property/templates/base/attributes_view.xsl
    branches/Version-1_0-branch/property/templates/base/b_account_form.xsl
    branches/Version-1_0-branch/property/templates/base/b_account_view.xsl
    branches/Version-1_0-branch/property/templates/base/branch_select.xsl
    branches/Version-1_0-branch/property/templates/base/budget.xsl
    branches/Version-1_0-branch/property/templates/base/building_part_select.xsl
    branches/Version-1_0-branch/property/templates/base/calendar_info.xsl
    branches/Version-1_0-branch/property/templates/base/cat_filter.xsl
    branches/Version-1_0-branch/property/templates/base/cat_select.xsl
    branches/Version-1_0-branch/property/templates/base/cat_sub_select.xsl
    branches/Version-1_0-branch/property/templates/base/chapter_filter.xsl
    branches/Version-1_0-branch/property/templates/base/chapter_select.xsl
    branches/Version-1_0-branch/property/templates/base/choice.xsl
    branches/Version-1_0-branch/property/templates/base/columns.xsl
    branches/Version-1_0-branch/property/templates/base/config.tpl
    branches/Version-1_0-branch/property/templates/base/confirm_custom.xsl
    branches/Version-1_0-branch/property/templates/base/contact_form.xsl
    branches/Version-1_0-branch/property/templates/base/contact_view.xsl
    branches/Version-1_0-branch/property/templates/base/custom.xsl
    branches/Version-1_0-branch/property/templates/base/date_search.xsl
    branches/Version-1_0-branch/property/templates/base/dim_d_select.xsl
    branches/Version-1_0-branch/property/templates/base/document.xsl
    branches/Version-1_0-branch/property/templates/base/ecodimb_form.xsl
    branches/Version-1_0-branch/property/templates/base/ecodimb_view.xsl
    branches/Version-1_0-branch/property/templates/base/entity.xsl
    branches/Version-1_0-branch/property/templates/base/event.xsl
    branches/Version-1_0-branch/property/templates/base/event_form.xsl
    branches/Version-1_0-branch/property/templates/base/event_schedule.xsl
    branches/Version-1_0-branch/property/templates/base/event_schedule_week.xsl
    branches/Version-1_0-branch/property/templates/base/files.xsl
    branches/Version-1_0-branch/property/templates/base/fileuploader.xsl
    branches/Version-1_0-branch/property/templates/base/filter_district.xsl
    branches/Version-1_0-branch/property/templates/base/filter_filter.xsl
    branches/Version-1_0-branch/property/templates/base/filter_location.xsl
    branches/Version-1_0-branch/property/templates/base/filter_member_of.xsl
    branches/Version-1_0-branch/property/templates/base/filter_part_of_town.xsl
    branches/Version-1_0-branch/property/templates/base/filter_permission.xsl
    branches/Version-1_0-branch/property/templates/base/filter_select.xsl
    branches/Version-1_0-branch/property/templates/base/filter_submodule.xsl
    branches/Version-1_0-branch/property/templates/base/filter_vendor.xsl
    branches/Version-1_0-branch/property/templates/base/gab.xsl
    branches/Version-1_0-branch/property/templates/base/generic.xsl
    branches/Version-1_0-branch/property/templates/base/group_filter.xsl
    branches/Version-1_0-branch/property/templates/base/group_select.xsl
    branches/Version-1_0-branch/property/templates/base/grouping_select.xsl
    branches/Version-1_0-branch/property/templates/base/help.tpl
    branches/Version-1_0-branch/property/templates/base/help_data.xsl
    branches/Version-1_0-branch/property/templates/base/hour_data_view.xsl
    branches/Version-1_0-branch/property/templates/base/ifc.xsl
    branches/Version-1_0-branch/property/templates/base/import.xsl
    branches/Version-1_0-branch/property/templates/base/investment.xsl
    branches/Version-1_0-branch/property/templates/base/invoice.xsl
    branches/Version-1_0-branch/property/templates/base/invoice_reporting.xsl
    branches/Version-1_0-branch/property/templates/base/jasper.xsl
    branches/Version-1_0-branch/property/templates/base/location.xsl
    branches/Version-1_0-branch/property/templates/base/location_form.xsl
    branches/Version-1_0-branch/property/templates/base/location_view.xsl
    branches/Version-1_0-branch/property/templates/base/login.tpl
    branches/Version-1_0-branch/property/templates/base/lookup.xsl
    branches/Version-1_0-branch/property/templates/base/menu.xsl
    branches/Version-1_0-branch/property/templates/base/migrate.xsl
    branches/Version-1_0-branch/property/templates/base/nextmatchs.xsl
    branches/Version-1_0-branch/property/templates/base/no_access.xsl
    branches/Version-1_0-branch/property/templates/base/owner_filter.xsl
    branches/Version-1_0-branch/property/templates/base/owner_select.xsl
    branches/Version-1_0-branch/property/templates/base/preference_acl.tpl
    branches/Version-1_0-branch/property/templates/base/preference_acl_row.tpl
    branches/Version-1_0-branch/property/templates/base/preference_colspan.tpl
    branches/Version-1_0-branch/property/templates/base/pricebook.xsl
    branches/Version-1_0-branch/property/templates/base/project.xsl
    branches/Version-1_0-branch/property/templates/base/project_group_form.xsl
    branches/Version-1_0-branch/property/templates/base/project_group_view.xsl
    branches/Version-1_0-branch/property/templates/base/receipt.xsl
    branches/Version-1_0-branch/property/templates/base/request.xsl
    branches/Version-1_0-branch/property/templates/base/responsible.xsl
    branches/Version-1_0-branch/property/templates/base/s_agreement.xsl
    branches/Version-1_0-branch/property/templates/base/search_field.xsl
    branches/Version-1_0-branch/property/templates/base/search_field_grouped.xsl
    branches/Version-1_0-branch/property/templates/base/select_district.xsl
    branches/Version-1_0-branch/property/templates/base/select_location.xsl
    branches/Version-1_0-branch/property/templates/base/select_multi_user.xsl
    branches/Version-1_0-branch/property/templates/base/select_part_of_town.xsl
    branches/Version-1_0-branch/property/templates/base/select_permission.xsl
    branches/Version-1_0-branch/property/templates/base/select_submodule.xsl
    branches/Version-1_0-branch/property/templates/base/select_vendor.xsl
    branches/Version-1_0-branch/property/templates/base/status_filter.xsl
    branches/Version-1_0-branch/property/templates/base/status_select.xsl
    branches/Version-1_0-branch/property/templates/base/table_header.xsl
    branches/Version-1_0-branch/property/templates/base/template.xsl
    branches/Version-1_0-branch/property/templates/base/tenant_claim.xsl
    branches/Version-1_0-branch/property/templates/base/tenant_form.xsl
    branches/Version-1_0-branch/property/templates/base/tenant_view.xsl
    branches/Version-1_0-branch/property/templates/base/tolerance_select.xsl
    branches/Version-1_0-branch/property/templates/base/tts.xsl
    branches/Version-1_0-branch/property/templates/base/unit_select.xsl
    branches/Version-1_0-branch/property/templates/base/user_id_filter.xsl
    branches/Version-1_0-branch/property/templates/base/user_id_select.xsl
    branches/Version-1_0-branch/property/templates/base/user_lid_filter.xsl
    branches/Version-1_0-branch/property/templates/base/user_lid_select.xsl
    branches/Version-1_0-branch/property/templates/base/values.xsl
    branches/Version-1_0-branch/property/templates/base/vendor_form.xsl
    branches/Version-1_0-branch/property/templates/base/vendor_view.xsl
    branches/Version-1_0-branch/property/templates/base/wo_hour.xsl
    branches/Version-1_0-branch/property/templates/base/wo_hour_cat_filter.xsl
    branches/Version-1_0-branch/property/templates/base/wo_hour_cat_select.xsl
    branches/Version-1_0-branch/property/templates/base/workorder.xsl
    branches/Version-1_0-branch/property/templates/base/yui_property_i18n.xsl
    branches/Version-1_0-branch/property/templates/default/help.tpl
    branches/Version-1_0-branch/property/templates/default/preference_acl.tpl
    
branches/Version-1_0-branch/property/templates/default/preference_acl_row.tpl
    
branches/Version-1_0-branch/property/templates/default/preference_colspan.tpl
    branches/Version-1_0-branch/property/templates/verdilak/app_data.xsl


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2011-12-13 09:52:14 UTC (rev 8282)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2011-12-13 10:00:58 UTC (rev 8283)
@@ -415,7 +415,7 @@
        {
                //$activity = 
activitycalendar_soactivity::get_instance()->get_single($activity_id);
                $subject = lang('mail_subject_update');
-               $link_text = 
"http://www.bergen.kommune.no/portico/activitycalendarfrontend/?menuaction=activitycalendarfrontend.uiactivity.edit&id={$activity->get_id()}&secret={$activity->get_secret()}";
+               $link_text = 
"http://www.bergen.kommune.no/aktivby/registreringsskjema/endre/?menuaction=activitycalendarfrontend.uiactivity.edit&id={$activity->get_id()}&secret={$activity->get_secret()}";
                $office_name = 
activitycalendar_soactivity::get_instance()->get_office_name($activity->get_office());
                $body = lang('mail_body_update', $activity->get_id() . ', ' . 
$activity->get_title(), $link_text, $office_name);
                
@@ -451,7 +451,7 @@
        {
                //$subject = lang('mail_subject_update', $avtivity->get_id() . 
'-' . $activity->get_title(), $activity->get_link());
                $subject = lang('mail_subject_update');
-               $link_text = 
"http://www.bergen.kommune.no/portico/activitycalendarfrontend/?menuaction=activitycalendarfrontend.uiactivity.edit&id={$activity->get_id()}&secret={$activity->get_secret()}";
+               $link_text = 
"http://www.bergen.kommune.no/aktivby/registreringsskjema/endre/?menuaction=activitycalendarfrontend.uiactivity.edit&id={$activity->get_id()}&secret={$activity->get_secret()}";
                $office_name = 
activitycalendar_soactivity::get_instance()->get_office_name($activity->get_office());
                $body = lang('mail_body_update', $activity->get_id() . ', ' . 
$activity->get_title(), $link_text, $office_name);
        }

Modified: branches/Version-1_0-branch/bim/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/bim/setup/setup.inc.php 2011-12-13 09:52:14 UTC 
(rev 8282)
+++ branches/Version-1_0-branch/bim/setup/setup.inc.php 2011-12-13 10:00:58 UTC 
(rev 8283)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['bim']['name']                      = 'bim';
-       $setup_info['bim']['version']           = '0.9.17.503';
+       $setup_info['bim']['version']           = '0.9.17.504';
        $setup_info['bim']['app_order']         = 8;
        $setup_info['bim']['enable']            = 1;
        $setup_info['bim']['app_group']         = 'office';

Modified: branches/Version-1_0-branch/bim/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/bim/setup/tables_current.inc.php        
2011-12-13 09:52:14 UTC (rev 8282)
+++ branches/Version-1_0-branch/bim/setup/tables_current.inc.php        
2011-12-13 10:00:58 UTC (rev 8283)
@@ -17,7 +17,7 @@
                                'id' => array('type' => 'auto', 'precision' => 
4, 'nullable' => False),
                                'location_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
                                'is_ifc' => array('type' => 'int','precision' 
=> 2,'default' => 1,'nullable' => True),
-                               'name' => array('type' => 'varchar', 
'precision' => 64,'nullable' => False),
+                               'name' => array('type' => 'varchar', 
'precision' => 150,'nullable' => False),
                                'description' => array('type' => 'varchar', 
'precision' => 512,'nullable' => True)
                        ),
                        'pk' => array('id'),

Modified: branches/Version-1_0-branch/bim/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/bim/setup/tables_update.inc.php 2011-12-13 
09:52:14 UTC (rev 8282)
+++ branches/Version-1_0-branch/bim/setup/tables_update.inc.php 2011-12-13 
10:00:58 UTC (rev 8283)
@@ -67,5 +67,18 @@
                }
        }
        
-       
-       
+       /**
+       * Update bim version from 0.9.17.503 to 0.9.17.504
+       */
+       $test[] = '0.9.17.503';
+       function bim_upgrade0_9_17_503()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_bim_type','name',array('type' 
=> 'varchar','precision' => '150','nullable' => False));
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['bim']['currentver'] = 
'0.9.17.504';
+                       return $GLOBALS['setup_info']['bim']['currentver'];
+               }
+       }

Copied: branches/Version-1_0-branch/controller/inc/class.cat_hooks.inc.php 
(from rev 8282, trunk/controller/inc/class.cat_hooks.inc.php)
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.cat_hooks.inc.php          
                (rev 0)
+++ branches/Version-1_0-branch/controller/inc/class.cat_hooks.inc.php  
2011-12-13 10:00:58 UTC (rev 8283)
@@ -0,0 +1,91 @@
+<?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package controller
+       * @subpackage entity
+       * @version $Id$
+       */
+
+       /**
+       * hook management for categories
+       * @package controller
+       */
+       class controller_cat_hooks
+       {
+               
+               /**
+                * Handle a new category being added, create location to hold 
ACL-data
+                */
+               function cat_add($data)
+               {
+                       if ( isset($data['cat_owner']) && $data['cat_owner'] != 
-1 )
+                       {
+                               return false; //nothing needed to be done, we 
only care about global cats
+                       }
+
+                       $location = '';
+                       if($data['location_id'])
+                       {
+                               $location_info = 
$GLOBALS['phpgw']->locations->get_name($data['location_id']);
+                               $location = $location_info['location'];
+                       }
+                       
$GLOBALS['phpgw']->locations->add("{$location}.category.{$data['cat_id']}", 
$data['cat_name'], 'controller');
+
+               }
+
+               /**
+                * Handle a category being deleted, remove the location 
+                */
+               function cat_delete($data)
+               {
+                       if ( isset($data['cat_owner']) && $data['cat_owner'] != 
-1 )
+                       {
+                               return false; //nothing needed to be done, we 
only care about global cats
+                       }
+                       if($data['location_id'])
+                       {
+                               $location_info = 
$GLOBALS['phpgw']->locations->get_name($data['location_id']);
+                               $location = 
"{$location_info['location']}.category.{$data['cat_id']}";
+                               
$GLOBALS['phpgw']->locations->delete('controller', $location, false);
+                       }
+               }
+
+               /**
+                * Handle a category being edited, update the location info
+                */
+               function cat_edit($data)
+               {
+                       if ( isset($data['cat_owner']) && $data['cat_owner'] != 
-1 )
+                       {
+                               return false; //nothing needed to be done, we 
only care about global cats
+                       }
+
+                       if($data['location_id'])
+                       {
+                               $location_info = 
$GLOBALS['phpgw']->locations->get_name($data['location_id']);
+                               $location = 
"{$location_info['location']}.category.{$data['cat_id']}";
+                               
$GLOBALS['phpgw']->locations->update_description($location, $data['cat_name'], 
'controller');
+                       }
+               }
+       }

Modified: branches/Version-1_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2011-12-13 09:52:14 UTC (rev 8282)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2011-12-13 10:00:58 UTC (rev 8283)
@@ -1,122 +1,177 @@
-<?php
-       class controller_menu
-       {
-               function get_menu()
-               {
-                       $incoming_app = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'controller';
-                       $menus = array();
-
-                       $menus['navbar'] = array
-                       (
-                               'controller' => array
-                               (
-                                       'text'  => lang('Controller'),
-                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol.view_control_details') ),
-                    'image'    => array('property', 'location'),
-                                       'order' => 10,
-                                       'group' => 'office'
-                               )
-                       );
-                       
-                       
if($GLOBALS['phpgw']->acl->check('.usertype.superuser',PHPGW_ACL_ADD,'controller'))
-                       {
-                               $menus['navigation'] =  array
-                               (
-                                       'control' => array
-                                       (
-                                               'text'  => lang('Control'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol.control_list') ),
-                                   'image'     => array('property', 
'location_1'),
-                                               'children' => array(
-                                                                               
        'location_for_check_list' => array
-                                                                               
        (
-                                                                               
                'text'  => lang('Location'),
-                                                                               
                'url'   => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=> 'controller.uicheck_list_for_location.index') ),
-                                                                               
    'image'     => array('property', 'location_1')
-                                                                               
),
-                                                                               
'equipment_for_check_list' => array
-                                                                               
        (
-                                                                               
                'text'  => lang('Equipment'),
-                                                                               
                'url'   => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=> 'controller.uicheck_list_for_equipment.index') ),
-                                                                               
    'image'     => array('property', 'entity_1')
-                                                                               
)
-                                                                               
)
-                                       ),
-                                       'location_for_check_list' => array
-                                       (
-                                               'text'  => 
lang('location_connections'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicheck_list_for_location.index') ),
-                                   'image'     => array('property', 
'location_1')
-                               ),
-                                       'control_item' => array
-                                       (
-                                               'text'  => lang('Control_item'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol_item.index') ),
-                                   'image'     => array('property', 
'location_1')
-                               ),
-                               'control_group' => array
-                                       (
-                                               'text'  => 
lang('Control_group'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol_group.index') ),
-                                   'image'     => array('property', 
'location_1')
-                               ),
-                               'procedure' => array
-                                       (
-                                               'text'  => lang('Procedure'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uiprocedure.index') ),
-                                   'image'     => array('property', 
'location_1'),
-                                       ),    
-                                       'check_list' => array
-                                       (
-                                               'text'  => lang('Check_list'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicheck_list.index') ),
-                                   'image'     => array('property', 
'location_1'),
-                                       ),
-                                       'location_check_list' => array
-                                       (
-                                               'text'  => 
lang('Check_list_location'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uilocation_check_list.view_agg_check_lists_for_location', 'year' => 
'2011', 'month' => '10') ),
-                               'image' => array('property', 'location_1'),
-                                       )
-                               );
-                       }
-                       else
-                       {
-                               $menus['navigation'] =  array
-                               (    
-                                       'check_list' => array
-                                       (
-                                               'text'  => lang('Check_list'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicheck_list.index') ),
-                                   'image'     => array('property', 
'location_1'),
-                                       ),
-                                       'location_check_list' => array
-                                       (
-                                               'text'  => 
lang('Check_list_location'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uilocation_check_list.view_check_lists_for_location') ),
-                               'image' => array('property', 'location_1'),
-                                       ),
-                               );
-                       }
-                       
-                       if ( $GLOBALS['phpgw']->acl->check('run', 
phpgwapi_acl::READ, 'admin')
-                               || $GLOBALS['phpgw']->acl->check('admin', 
phpgwapi_acl::ADD, 'controller'))
-                       {
-                               $menus['admin'] = array
-                               (
-                                       'acl'   => array
-                                       (
-                                               'text'  => lang('Configure 
Access Permissions'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'preferences.uiadmin_acl.list_acl', 'acl_app' => 'controller') )
-                                       )
-                               );
-                       }
-                       
-                       $menus['folders'] = 
phpgwapi_menu::get_categories('bergen');
-
-                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$incoming_app;
-
-                       return $menus;
-               }
-       }
+<?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 controller_menu
+       {
+               function get_menu()
+               {
+                       $incoming_app = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'controller';
+                       $menus = array();
+
+                       $menus['navbar'] = array
+                       (
+                               'controller' => array
+                               (
+                                       'text'  => lang('Controller'),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol.view_control_details') ),
+                                       'image' => array('property', 
'location'),
+                                       'order' => 10,
+                                       'group' => 'office'
+                               )
+                       );
+
+                       
if($GLOBALS['phpgw']->acl->check('.usertype.superuser',PHPGW_ACL_ADD,'controller'))
+                       {
+                               $menus['navigation'] =  array
+                               (
+                                       'control' => array
+                                       (
+                                               'text'  => lang('Control'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol.control_list') ),
+                                               'image' => array('property', 
'location_1'),
+                                               'children' => array(
+                                                                               
        'location_for_check_list' => array
+                                                                               
        (
+                                                                               
                'text'  => lang('Location'),
+                                                                               
                'url'   => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=> 'controller.uicheck_list_for_location.index') ),
+                                                                               
                'image' => array('property', 'location_1')
+                                                                               
        ),
+                                                                               
        'component_for_check_list' => array
+                                                                               
        (
+                                                                               
                'text'  => lang('component'),
+                                                                               
                'url'   => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=> 'controller.uicheck_list_for_component.index') ),
+                                                                               
                'image' => array('property', 'entity_1')
+                                                                               
        )
+                                                                               
)
+                                       ),
+                                       'location_for_check_list' => array
+                                       (
+                                               'text'  => 
lang('location_connections'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicheck_list_for_location.index') ),
+                                               'image' => array('property', 
'location_1')
+                                       ),
+                                       'control_item' => array
+                                       (
+                                               'text'  => lang('Control_item'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol_item.index') ),
+                                               'image' => array('property', 
'location_1')
+                                       ),
+                                       'control_group' => array
+                                       (
+                                               'text'  => 
lang('Control_group'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol_group.index') ),
+                                               'image' => array('property', 
'location_1')
+                                       ),
+                                       'procedure' => array
+                                       (
+                                               'text'  => lang('Procedure'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uiprocedure.index') ),
+                                               'image' => array('property', 
'location_1'),
+                                       ),
+                                       'check_list' => array
+                                       (
+                                               'text'  => lang('Check_list'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicheck_list.index') ),
+                                               'image' => array('property', 
'location_1'),
+                                       ),
+                                       'location_check_list' => array
+                                       (
+                                               'text'  => 
lang('Check_list_location'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uilocation_check_list.view_agg_check_lists_for_location', 'year' => 
'2011', 'month' => '10') ),
+                                               'image' => array('property', 
'location_1'),
+                                       )
+                               );
+                       }
+                       else
+                       {
+                               $menus['navigation'] =  array
+                               (
+                                       'check_list' => array
+                                       (
+                                               'text'  => lang('Check_list'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicheck_list.index') ),
+                                               'image' => array('property', 
'location_1'),
+                                       ),
+                                       'location_check_list' => array
+                                       (
+                                               'text'  => 
lang('Check_list_location'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uilocation_check_list.view_check_lists_for_location') ),
+                                               'image' => array('property', 
'location_1'),
+                                       ),
+                               );
+                       }
+
+                       if ( $GLOBALS['phpgw']->acl->check('run', 
phpgwapi_acl::READ, 'admin')
+                               || $GLOBALS['phpgw']->acl->check('admin', 
phpgwapi_acl::ADD, 'controller'))
+                       {
+                               $menus['admin'] = array
+                               (
+                                       'index' => array
+                                       (
+                                               'text'  => 
lang('Configuration'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uiconfig.index', 'appname' => 'controller') )
+                                       ),
+                                       'acl'   => array
+                                       (
+                                               'text'  => lang('Configure 
Access Permissions'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'preferences.uiadmin_acl.list_acl', 'acl_app' => 'controller') )
+                                       ),
+                                       'control_cats'  => array
+                                       (
+                                               'text'  => lang('Control area'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uicategories.index', 'appname' => 'controller', 'location' => 
'.control', 'global_cats' => 'true', 'menu_selection' => 
'admin::controller::control_cats') )
+                                       ),
+                                       'responsible_matrix'    => array
+                                       (
+                                               'text'          => 
lang('responsible matrix'),
+                                               'url'           => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiresponsible.index', 'appname' => 'controller') )
+                                       ),
+                                       'responsibility_role'   => array
+                                       (
+                                               'text'  => lang('responsibility 
role'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'responsibility_role', 'appname' => 
'controller') )
+                                       ),
+                                       'role_at_location'      => array
+                                       (
+                                               'url'   =>      
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilocation.responsiblility_role', 'menu_selection' => 
'admin::controller::role_at_location') ),
+                                               'text'  =>      lang('role at 
location'),
+                                               'image' => array('property', 
'responsibility_role')
+                                       )
+                               );
+                       }
+
+                       $menus['folders'] = 
phpgwapi_menu::get_categories('bergen');
+
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$incoming_app;
+
+                       return $menus;
+               }
+       }


Property changes on: 
branches/Version-1_0-branch/controller/inc/class.menu.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2011-12-13 09:52:14 UTC (rev 8282)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2011-12-13 10:00:58 UTC (rev 8283)
@@ -1,99 +1,134 @@
-<?php
-phpgw::import_class('controller.socommon');
-
-include_class('controller', 'check_item', 'inc/model/');
-
-class controller_socheck_item extends controller_socommon
-{
-       protected static $so;
-
-       /**
-        * Get a static reference to the storage object associated with this 
model object
-        *
-        * @return controller_socontrol_group the storage object
-        */
-       public static function get_instance()
-       {
-               if (self::$so == null) {
-                       self::$so = CreateObject('controller.socheck_item');
-               }
-               return self::$so;
-       }
-       
-       function get_query(string $sort_field, boolean $ascending, string 
$search_for, string $search_type, array $filters, boolean $return_count){}
-
-       function populate(int $object_id, &$object){}
-       
-       function add(&$check_item)
-       {
-               $cols = array(
-                               'control_item_id',
-                               'status',
-                               'comment',
-                               'check_list_id'
-               );
-               
-               $values = array(
-                       $this->marshal($check_item->get_control_item_id(), 
'int'),
-                       $this->marshal($check_item->get_status(), 'bool'),
-                       $this->marshal($check_item->get_comment(), 'string'),
-                       $this->marshal($check_item->get_check_list_id(), 'int')
-               );
-               
-               $result = $this->db->query('INSERT INTO controller_check_item 
(' . join(',', $cols) . ') VALUES (' . join(',', $values) . ')', 
__LINE__,__FILE__);
-
-               return isset($result) ? 
$this->db->get_last_insert_id('controller_check_item', 'id') : 0;
-       }
-       
-       function update($check_item){
-               
-               $id = $check_item->get_id();
-
-               $values = array(
-                       'control_item_id = ' . 
$this->marshal($check_item->get_control_item_id(), 'int'),
-                       'status = ' . $this->marshal($check_item->get_status(), 
'bool'),
-                       'comment = ' . 
$this->marshal($check_item->get_comment(), 'string'),
-                       'check_list_id = ' . 
$this->marshal($check_item->get_check_list_id(), 'int')
-               );
-               
-               $result = $this->db->query('UPDATE controller_check_item SET ' 
. join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
-               
-               if( isset($result) ){
-                       return $id;     
-               }else{
-                       return 0;
-               }
-       }
-       
-       public function get_single($check_item_id){
-               $sql = "SELECT ci.*, coi.id as coi_id, coi.* ";
-               $sql .= "FROM controller_check_item ci, controller_control_item 
coi "; 
-               $sql .= "WHERE ci.id = $check_item_id ";
-               $sql .= "AND ci.control_item_id=coi.id";
-               
-               $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
-               
-               if($this->db->next_record()) {
-                       $check_item = new 
controller_check_item($this->unmarshal($this->db->f('id', true), 'int'));
-                       
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
-                       
$check_item->set_status($this->unmarshal($this->db->f('status', true), 'bool'));
-                       
$check_item->set_comment($this->unmarshal($this->db->f('comment', true), 
'string'));
-                       
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
-                       
-                       $control_item = new 
controller_control_item($this->unmarshal($this->db->f('coi_id', true), 'int'));
-                       $control_item->set_title($this->db->f('title', true), 
'string');
-                       $control_item->set_required($this->db->f('required', 
true), 'string');
-                       
$control_item->set_what_to_do($this->db->f('what_to_do', true), 'string');
-                       $control_item->set_how_to_do($this->db->f('how_to_do', 
true), 'string');
-                       
$control_item->set_control_group_id($this->db->f('control_group_id', true), 
'string');
-                       
-                       $check_item->set_control_item($control_item->toArray());
-                       
-                       return $check_item;
-               }else{
-                       return null;
-               }
-       }
-       
-       function get_id_field_name(){}  
-}
+<?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$
+       */
+
+       phpgw::import_class('controller.socommon');
+
+       include_class('controller', 'check_item', 'inc/model/');
+
+       class controller_socheck_item extends controller_socommon
+       {
+               protected static $so;
+
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                *
+                * @return controller_socontrol_group the storage object
+                */
+               public static function get_instance()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.socheck_item');
+                       }
+                       return self::$so;
+               }
+
+               function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean 
$return_count){}
+
+               function populate(int $object_id, &$object){}
+
+               function add(&$check_item)
+               {
+                       $cols = array(
+                                       'control_item_id',
+                                       'status',
+                                       'comment',
+                                       'check_list_id'
+                       );
+
+                       $values = array(
+                               
$this->marshal($check_item->get_control_item_id(), 'int'),
+                               $this->marshal($check_item->get_status(), 
'bool'),
+                               $this->marshal($check_item->get_comment(), 
'string'),
+                               
$this->marshal($check_item->get_check_list_id(), 'int')
+                       );
+
+                       $result = $this->db->query('INSERT INTO 
controller_check_item (' . join(',', $cols) . ') VALUES (' . join(',', $values) 
. ')', __LINE__,__FILE__);
+
+                       return isset($result) ? 
$this->db->get_last_insert_id('controller_check_item', 'id') : 0;
+               }
+
+               function update($check_item)
+               {
+                       $id = $check_item->get_id();
+
+                       $values = array(
+                               'control_item_id = ' . 
$this->marshal($check_item->get_control_item_id(), 'int'),
+                               'status = ' . 
$this->marshal($check_item->get_status(), 'bool'),
+                               'comment = ' . 
$this->marshal($check_item->get_comment(), 'string'),
+                               'check_list_id = ' . 
$this->marshal($check_item->get_check_list_id(), 'int')
+                       );
+
+                       $result = $this->db->query('UPDATE 
controller_check_item SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
+
+                       if( isset($result) )
+                       {
+                               return $id;
+                       }
+                       else
+                       {
+                               return 0;
+                       }
+               }
+
+               public function get_single($check_item_id)
+               {
+                       $sql = "SELECT ci.*, coi.id as coi_id, coi.* ";
+                       $sql .= "FROM controller_check_item ci, 
controller_control_item coi "; 
+                       $sql .= "WHERE ci.id = $check_item_id ";
+                       $sql .= "AND ci.control_item_id=coi.id";
+
+                       $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+
+                       if($this->db->next_record()) {
+                               $check_item = new 
controller_check_item($this->unmarshal($this->db->f('id', true), 'int'));
+                               
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
+                               
$check_item->set_status($this->unmarshal($this->db->f('status', true), 'bool'));
+                               
$check_item->set_comment($this->unmarshal($this->db->f('comment', true), 
'string'));
+                               
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
+
+                               $control_item = new 
controller_control_item($this->unmarshal($this->db->f('coi_id', true), 'int'));
+                               $control_item->set_title($this->db->f('title', 
true), 'string');
+                               
$control_item->set_required($this->db->f('required', true), 'string');
+                               
$control_item->set_what_to_do($this->db->f('what_to_do', true), 'string');
+                               
$control_item->set_how_to_do($this->db->f('how_to_do', true), 'string');
+                               
$control_item->set_control_group_id($this->db->f('control_group_id', true), 
'string');
+
+                               
$check_item->set_control_item($control_item->toArray());
+
+                               return $check_item;
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+
+               function get_id_field_name(){}
+       }


Property changes on: 
branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2011-12-13 09:52:14 UTC (rev 8282)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2011-12-13 10:00:58 UTC (rev 8283)
@@ -1,452 +1,507 @@
-<?php
-phpgw::import_class('controller.socommon');
-
-include_class('controller', 'check_list', 'inc/model/');
-
-class controller_socheck_list extends controller_socommon
-{
-       protected static $so;
-
-       /**
-        * Get a static reference to the storage object associated with this 
model object
-        *
-        * @return controller_socontrol_group the storage object
-        */
-       public static function get_instance()
-       {
-               if (self::$so == null) {
-                       self::$so = CreateObject('controller.socheck_list');
-               }
-               return self::$so;
-       }
-       
-       public function get_single($check_list_id){
-               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id FROM 
controller_check_list cl, controller_check_item ci WHERE cl.id = $check_list_id 
AND cl.id = ci.check_list_id;";
-               $this->db->query($sql);
-               
-               $counter = 0;
-               $check_list = null;
-               while ($this->db->next_record()) {
-                       
-                       if($counter == 0){
-                               $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
-                               
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'bool'));
-                               
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
-                               
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));     
-                       }
-                       
-                       $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
-                       
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
-                       
$check_item->set_status($this->unmarshal($this->db->f('ci_status', true), 
'bool'));
-                       
$check_item->set_comment($this->unmarshal($this->db->f('ci_comment', true), 
'string'));
-                       
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
-                       
-                       $check_items_array[] = $check_item->toArray();
-                       
-                       $counter++;
-               }
-               
-               if($check_list != null){
-                       $check_list->set_check_item_array($check_items_array);
-                       return $check_list->toArray();
-               }else {
-                       return null;
-               }
-       }
-               
-       public function get_single_with_control_items($check_list_id){
-               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, ";
-               $sql .= "ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id, "; 
-               $sql .= "coi.title as coi_id, coi.title as coi_title, 
coi.required as coi_required, coi.required as coi_required, ";
-               $sql .= "coi.what_to_do as coi_what_to_do, coi.how_to_do as 
coi_how_to_do, coi.control_group_id as coi_control_group_id "; 
-               $sql .= "FROM controller_check_list cl, controller_check_item 
ci, controller_control_item as coi "; 
-               $sql .= "WHERE cl.id = $check_list_id ";
-               $sql .= "AND cl.id = ci.check_list_id ";
-               $sql .= "AND ci.control_item_id=coi.id;";
-               
-               $this->db->query($sql);
-               
-               $counter = 0;
-               $check_list = null;
-               while ($this->db->next_record()) {
-                       
-                       if($counter == 0){
-                               $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
-                               
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'bool'));
-                               
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
-                               
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));     
-                       }
-                       
-                       $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
-                       
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
-                       
$check_item->set_status($this->unmarshal($this->db->f('ci_status', true), 
'bool'));
-                       
$check_item->set_comment($this->unmarshal($this->db->f('ci_comment', true), 
'string'));
-                       
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
-                       
-                       $control_item = new 
controller_control_item($this->unmarshal($this->db->f('coi_id', true), 'int'));
-                       $control_item->set_title($this->db->f('coi_title', 
true), 'string');
-                       
$control_item->set_required($this->db->f('coi_required', true), 'string');
-                       
$control_item->set_what_to_do($this->db->f('coi_what_to_do', true), 'string');
-                       
$control_item->set_how_to_do($this->db->f('coi_how_to_do', true), 'string');
-                       
$control_item->set_control_group_id($this->db->f('coi_control_group_id', true), 
'string');
-                       
-                       $check_item->set_control_item($control_item->toArray());
-                       
-                       $check_items_array[] = $check_item->toArray();
-                       
-                       $counter++;
-               }
-               
-               if($check_list != null){
-                       $check_list->set_check_item_array($check_items_array);
-                       return $check_list->toArray();
-               }else {
-                       return null;
-               }
-       }
-       
-       public function get_check_list(){
-
-               $current_time = time();
-       
-               $buffer_in_days = 3600*24*7*5;
-               
-               $buffer_time = $current_time - $buffer_in_days;
-               
-               $sql = "SELECT p.* FROM controller_control p WHERE 
$current_time >= p.start_date AND p.start_date > $buffer_time";
-               $this->db->query($sql);
-                       
-               while ($this->db->next_record()) {
-                       $start_date = date("d.m.Y",  
$this->db->f('start_date'));
-                       $end_date = date("d.m.Y",  $this->db->f('end_date'));
-                       
-                       $control = new 
controller_control($this->unmarshal($this->db->f('id', true), 'int'));
-
-                       
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
-                       
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
-                       $control->set_start_date($start_date);
-                       $control->set_end_date($end_date);
-                       
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
-                       
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
-                       
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
-                       
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
-                       
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
-                       
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
-                       
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
-                       
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
 true), 'int'));
-                       
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true), 
'int'));
-                       
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
-                       
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
-                       
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
-                               
-                       $results[] = $control->toArray(); 
-               }
-                               
-               return $results;
-       }
-       
-       function get_check_lists_for_control($control_id){
-               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, ";
-               $sql .= "ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id ";
-               $sql .= "FROM controller_check_list cl, controller_check_item 
ci ";
-               $sql .= "WHERE cl.control_id = $control_id ";
-               $sql .= "AND cl.id = ci.check_list_id "; 
-               $sql .= "ORDER BY cl.id;";
-               $this->db->query($sql);
-               
-               $check_list_id = 0;
-               $check_list = null;
-               while ($this->db->next_record()) {
-               
-                       if( $this->db->f('cl_id', true) != $check_list_id ){
-                               
-                               if($check_list_id != 0){
-                                       
$check_list->set_check_item_array($check_items_array);
-                                       $check_list_array[] = 
$check_list->toArray();
-                               }
-                               
-                               $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
-                               
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'bool'));
-                               
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
-                               
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));     
-
-                               $check_items_array = array();
-                       }
-                       
-                       $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
-                       
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
-                       
$check_item->set_status($this->unmarshal($this->db->f('ci_status', true), 
'bool'));
-                       
$check_item->set_comment($this->unmarshal($this->db->f('ci_comment', true), 
'string'));
-                       
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
-                       
-                       $check_items_array[] = $check_item->toArray();
-                       
-                       $check_list_id =  $check_list->get_id();
-               }
-               
-               if($check_list != null){
-                       $check_list->set_check_item_array($check_items_array);
-                       $check_list_array[] = $check_list->toArray();
-               
-                       return $check_list_array;
-               }else {
-                       return null;
-               }
-       }
-       
-       function get_agg_check_lists_for_location( $location_code, $from_date, 
$to_date ){
-               
-               $sql =  "SELECT c.id as c_id, title, cl.id as cl_id, 
c.repeat_type, c.repeat_interval, deadline, count(ci.id) ";
-               $sql .= "FROM controller_check_list cl, controller_control c, 
controller_check_item ci ";
-               $sql .= "WHERE cl.location_code = $location_code ";
-               $sql .= "AND c.repeat_type < 2 ";
-               $sql .= "AND cl.control_id = c.id ";
-               $sql .= "AND cl.id = ci.check_list_id ";
-               $sql .= "AND deadline BETWEEN $from_date AND $to_date ";
-               $sql .= "GROUP BY c.id, title, cl.id, cl.deadline, 
c.repeat_type, c.repeat_interval ";
-               $sql .= "ORDER BY c.id";
-
-               $this->db->query($sql);
-               
-               $control_id = 0;
-               $controls_array = array();
-               $check_list_array = array();
-               while ($this->db->next_record()) {
-                       
-                       if( $this->db->f('c_id', true) != $control_id ){
-                               if($control_id != 0){
-                                       $controls_array[] = array( "control" => 
$control_array, "check_list" => $check_list_array);
-                                       $check_list_array = array();
-                               }
-                               
-                               $control_array = array(
-                                                                               
"id"                      => $this->unmarshal($this->db->f('c_id', true), 
'int'),
-                                                                               
"title"                   => $this->unmarshal($this->db->f('title', true), 
'string'),
-                                                                               
"repeat_type"     => $this->unmarshal($this->db->f('repeat_type', true), 'int'),
-                                                                               
"repeat_interval" => $this->unmarshal($this->db->f('repeat_interval', true), 
'int')
-                                                                       );
-                       }
-
-                       $check_list_array[] = array(
-                                                                               
"cl_id"         => $this->db->f('cl_id', true),
-                                                                               
"deadline"      => $this->db->f('deadline', true),
-                                                                               
"count"         => $this->db->f('count', true)
-                                                                       );
-                       
-                       $control_id = $this->db->f('c_id', true);
-               }               
-               
-               if( !empty( $control_array ) ){
-                       $controls_array[] = array( "control" => $control_array, 
"check_list" => $check_list_array);
-                       
-                       return $controls_array;
-               }else {
-                       return null;
-               }       
-       }
-
-       function get_check_lists_for_location( $location_code, $from_date, 
$to_date, $repeat_type ){
-               $sql =  "SELECT c.id as c_id, cl.id as cl_id, cl.status as 
cl_status, cl.comment as cl_comment, ";
-               $sql .= "deadline, planned_date, completed_date, 
cl.location_code as cl_loc, c.* "; 
-               $sql .= "FROM controller_check_list cl, controller_control c ";
-               $sql .= "WHERE cl.location_code = $location_code ";
-               $sql .= "AND c.repeat_type = $repeat_type ";
-               $sql .= "AND cl.control_id = c.id ";
-               $sql .= "AND deadline BETWEEN $from_date AND $to_date";
-               $sql .= "ORDER BY c.id;";
-               
-               $this->db->query($sql);
-               
-               $control_id = 0;
-               $control = null;
-               while ($this->db->next_record()) {
-                       
-                       if( $this->db->f('c_id', true) != $control_id ){
-                               
-                               if($control_id != 0){
-                                       
$control->set_check_lists_array($check_lists_array);
-                                       $controls_array[] = $control;
-                               }
-                       
-                               $control = new 
controller_control($this->unmarshal($this->db->f('c_id', true), 'int'));
-                               
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
-                               
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
-                               
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
-                               
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
-                               
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
-                               
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
-                               
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
-                               
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
-                               
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
-                               
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
-                               
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
-                               
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
 true), 'int'));
-                               
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true), 
'int'));
-                               
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
-                               
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
-                               
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
-                                                               
-                               $check_lists_array = array();
-                       }
-
-                       $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
-                       
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'string'));
-                       
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
-                       
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));     
-                       
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date', 
true), 'int'));
-                       
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date', 
true), 'int'));
-                       
$check_list->set_location_code($this->unmarshal($this->db->f('cl_loc', true), 
'int'));
-               
-                       $check_lists_array[] = $check_list;
-
-                       $control_id =  $control->get_id();
-               }
-               
-               if($control != null){
-                       $control->set_check_lists_array($check_lists_array);
-                       $controls_array[] = $control;
-                       
-                       return $controls_array;
-               }else {
-                       return null;
-               }       
-       }
-       
-       function get_query(string $sort_field, boolean $ascending, string 
$search_for, string $search_type, array $filters, boolean $return_count)
-       {
-               $current_time = time();
-               $buffer_in_days = 3600*24*7*5;
-               $buffer_time = $current_time - $buffer_in_days;
-
-               $clauses = array('1=1');
-               $clauses[] = "{$current_time} >= p.start_date AND p.start_date 
> {$buffer_time}"; 
-               
-               $filter_clauses = array();
-               
-               // Search for based on search type
-               if($search_for)
-               {
-                       $search_for = $this->marshal($search_for,'field');
-                       $like_pattern = "'%".$search_for."%'";
-                       $like_clauses = array();
-                       switch($search_type){
-                               default:
-                                       $like_clauses[] = "p.title $this->like 
$like_pattern";
-                                       break;
-                       }
-                       
-                       if(count($like_clauses))
-                       {
-                               $clauses[] = '(' . join(' OR ', $like_clauses) 
. ')';
-                       }
-               }
-               //var_dump($filters);
-               if(isset($filters[$this->get_id_field_name()]))
-               {
-                       $filter_clauses[] = "p.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
-               }
-               
-               if(count($filter_clauses))
-               {
-                       $clauses[] = join(' AND ', $filter_clauses);
-               }
-               
-               $condition =  join(' AND ', $clauses);
-
-               $tables = "controller_control p";
-               //$joins = " {$this->left_join} rental_document_types ON 
(rental_document.type_id = rental_document_types.id)";
-               //$joins = " {$this->left_join} controller_control_area ON 
(controller_control.control_area_id = controller_control_area.id)";
-               //$joins .= " {$this->left_join} controller_procedure ON 
(controller_control.procedure_id = controller_procedure.id)";
-               
-               if($return_count)
-               {
-                       $cols = 'COUNT(DISTINCT(p.id)) AS count';
-               }
-               else
-               {
-                       $cols = 'p.* ';
-               }
-               
-               $dir = $ascending ? 'ASC' : 'DESC';
-               if($sort_field == 'id')
-               {
-                       $sort_field = 'p.id';
-               }
-               $order = $sort_field ? "ORDER BY {$this->marshal($sort_field, 
'field')} $dir ": '';
-               
-               return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
-       }
-
-       function populate(int $control_id, &$control)
-       {
-               
-                       
-               if($control == null) {
-                       $start_date = date("d.m.Y",  
$this->db->f('start_date'));
-                       $end_date = date("d.m.Y",  $this->db->f('end_date'));
-                       $control = new controller_control((int) $control_id);
-
-                       
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
-                       
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
-                       $control->set_start_date($start_date);
-                       $control->set_end_date($end_date);
-                       
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
-                       
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
-                       
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
-                       
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
-                       
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
-                       
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
-                       
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
-//                     
$control->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
-                       
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
 true), 'int'));
-                       
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true), 
'int'));
-                       
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
-                       
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
-                       
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
-               }
-               
-               return $control;
-       }
-       
-       function add(&$check_list)
-       {
-               $cols = array(
-                               'control_id',
-                               'status',
-                               'comment',
-                               'deadline'
-               );
-               
-               $values = array(
-                       $this->marshal($check_list->get_control_id(), 'int'),
-                       $this->marshal($check_list->get_status(), 'bool'),
-                       $this->marshal($check_list->get_comment(), 'string'),
-                       $this->marshal($check_list->get_deadline(), 'int')
-               );
-               
-               $result = $this->db->query('INSERT INTO controller_check_list 
(' . join(',', $cols) . ') VALUES (' . join(',', $values) . ')', 
__LINE__,__FILE__);
-
-               return isset($result) ? 
$this->db->get_last_insert_id('controller_check_list', 'id') : 0;
-       }
-       
-       function update($object){}
-       
-       function get_id_field_name($extended_info = false)
-       {
-               if(!$extended_info)
-               {
-                       $ret = 'id';
-               }
-               else
-               {
-                       $ret = array
-                       (
-                               'table'                 => 'control', // alias
-                               'field'                 => 'id',
-                               'translated'    => 'id'
-                       );
-               }
-               
-               return $ret;
-       }       
-}
+<?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$
+       */
+
+       phpgw::import_class('controller.socommon');
+
+       include_class('controller', 'check_list', 'inc/model/');
+
+       class controller_socheck_list extends controller_socommon
+       {
+               protected static $so;
+
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                *
+                * @return controller_socontrol_group the storage object
+                */
+               public static function get_instance()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('controller.socheck_list');
+                       }
+                       return self::$so;
+               }
+       
+               public function get_single($check_list_id)
+               {
+                       $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id FROM 
controller_check_list cl, controller_check_item ci WHERE cl.id = $check_list_id 
AND cl.id = ci.check_list_id;";
+                       $this->db->query($sql);
+               
+                       $counter = 0;
+                       $check_list = null;
+                       while ($this->db->next_record())
+                       {
+                               if($counter == 0)
+                               {
+                                       $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
+                                       
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'bool'));
+                                       
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
+                                       
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));
+                               }
+                       
+                               $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
+                               
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
+                               
$check_item->set_status($this->unmarshal($this->db->f('ci_status', true), 
'bool'));
+                               
$check_item->set_comment($this->unmarshal($this->db->f('ci_comment', true), 
'string'));
+                               
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
+                       
+                               $check_items_array[] = $check_item->toArray();
+                       
+                               $counter++;
+                       }
+               
+                       if($check_list != null)
+                       {
+                               
$check_list->set_check_item_array($check_items_array);
+                               return $check_list->toArray();
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+               
+               public function get_single_with_control_items($check_list_id)
+               {
+                       $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, ";
+                       $sql .= "ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id, "; 
+                       $sql .= "coi.title as coi_id, coi.title as coi_title, 
coi.required as coi_required, coi.required as coi_required, ";
+                       $sql .= "coi.what_to_do as coi_what_to_do, 
coi.how_to_do as coi_how_to_do, coi.control_group_id as coi_control_group_id "; 
+                       $sql .= "FROM controller_check_list cl, 
controller_check_item ci, controller_control_item as coi "; 
+                       $sql .= "WHERE cl.id = $check_list_id ";
+                       $sql .= "AND cl.id = ci.check_list_id ";
+                       $sql .= "AND ci.control_item_id=coi.id;";
+               
+                       $this->db->query($sql);
+               
+                       $counter = 0;
+                       $check_list = null;
+                       while ($this->db->next_record())
+                       {
+                               if($counter == 0)
+                               {
+                                       $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
+                                       
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'bool'));
+                                       
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
+                                       
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));
+                               }
+                       
+                               $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
+                               
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
+                               
$check_item->set_status($this->unmarshal($this->db->f('ci_status', true), 
'bool'));
+                               
$check_item->set_comment($this->unmarshal($this->db->f('ci_comment', true), 
'string'));
+                               
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
+                       
+                               $control_item = new 
controller_control_item($this->unmarshal($this->db->f('coi_id', true), 'int'));
+                               
$control_item->set_title($this->db->f('coi_title', true), 'string');
+                               
$control_item->set_required($this->db->f('coi_required', true), 'string');
+                               
$control_item->set_what_to_do($this->db->f('coi_what_to_do', true), 'string');
+                               
$control_item->set_how_to_do($this->db->f('coi_how_to_do', true), 'string');
+                               
$control_item->set_control_group_id($this->db->f('coi_control_group_id', true), 
'string');
+                       
+                               
$check_item->set_control_item($control_item->toArray());
+                       
+                               $check_items_array[] = $check_item->toArray();
+                       
+                               $counter++;
+                       }
+               
+                       if($check_list != null)
+                       {
+                               
$check_list->set_check_item_array($check_items_array);
+                               return $check_list->toArray();
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+       
+               public function get_check_list()
+               {
+                       $current_time = time();
+       
+                       $buffer_in_days = 3600*24*7*5;
+               
+                       $buffer_time = $current_time - $buffer_in_days;
+               
+                       $sql = "SELECT p.* FROM controller_control p WHERE 
$current_time >= p.start_date AND p.start_date > $buffer_time";
+                       $this->db->query($sql);
+                       
+                       while ($this->db->next_record())
+                       {
+                               $start_date = date("d.m.Y",  
$this->db->f('start_date'));
+                               $end_date = date("d.m.Y",  
$this->db->f('end_date'));
+                       
+                               $control = new 
controller_control($this->unmarshal($this->db->f('id', true), 'int'));
+
+                               
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+                               
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
+                               $control->set_start_date($start_date);
+                               $control->set_end_date($end_date);
+                               
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
+                               
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
+                               
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
+                               
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
+                               
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
+                               
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
+                               
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
+                               
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
 true), 'int'));
+                               
$control->set_component_id($this->unmarshal($this->db->f('component_id', true), 
'int'));
+                               
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
+                               
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
+                               
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
+                               
+                               $results[] = $control->toArray(); 
+                       }
+                               
+                       return $results;
+               }
+       
+               function get_check_lists_for_control($control_id)
+               {
+                       $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, ";
+                       $sql .= "ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id ";
+                       $sql .= "FROM controller_check_list cl, 
controller_check_item ci ";
+                       $sql .= "WHERE cl.control_id = $control_id ";
+                       $sql .= "AND cl.id = ci.check_list_id "; 
+                       $sql .= "ORDER BY cl.id;";
+                       $this->db->query($sql);
+               
+                       $check_list_id = 0;
+                       $check_list = null;
+                       while ($this->db->next_record())
+                       {
+                               if( $this->db->f('cl_id', true) != 
$check_list_id )
+                               {
+                                       if($check_list_id != 0)
+                                       {
+                                               
$check_list->set_check_item_array($check_items_array);
+                                               $check_list_array[] = 
$check_list->toArray();
+                                       }
+                               
+                                       $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
+                                       
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'bool'));
+                                       
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
+                                       
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));
+
+                                       $check_items_array = array();
+                               }
+                       
+                               $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
+                               
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
+                               
$check_item->set_status($this->unmarshal($this->db->f('ci_status', true), 
'bool'));
+                               
$check_item->set_comment($this->unmarshal($this->db->f('ci_comment', true), 
'string'));
+                               
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
+                       
+                               $check_items_array[] = $check_item->toArray();
+                       
+                               $check_list_id =  $check_list->get_id();
+                       }
+               
+                       if($check_list != null)
+                       {
+                               
$check_list->set_check_item_array($check_items_array);
+                               $check_list_array[] = $check_list->toArray();
+               
+                               return $check_list_array;
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+       
+               function get_agg_check_lists_for_location( $location_code, 
$from_date, $to_date )
+               {
+                       $sql =  "SELECT c.id as c_id, title, cl.id as cl_id, 
c.repeat_type, c.repeat_interval, deadline, count(ci.id) ";
+                       $sql .= "FROM controller_check_list cl, 
controller_control c, controller_check_item ci ";
+                       $sql .= "WHERE cl.location_code = $location_code ";
+                       $sql .= "AND c.repeat_type < 2 ";
+                       $sql .= "AND cl.control_id = c.id ";
+                       $sql .= "AND cl.id = ci.check_list_id ";
+                       $sql .= "AND deadline BETWEEN $from_date AND $to_date ";
+                       $sql .= "GROUP BY c.id, title, cl.id, cl.deadline, 
c.repeat_type, c.repeat_interval ";
+                       $sql .= "ORDER BY c.id";
+
+                       $this->db->query($sql);
+               
+                       $control_id = 0;
+                       $controls_array = array();
+                       $check_list_array = array();
+                       while ($this->db->next_record())
+                       {
+                               if( $this->db->f('c_id', true) != $control_id )
+                               {
+                                       if($control_id != 0)
+                                       {
+                                               $controls_array[] = array( 
"control" => $control_array, "check_list" => $check_list_array);
+                                               $check_list_array = array();
+                                       }
+                               
+                                       $control_array = array(
+                                                                               
        "id"                      => $this->unmarshal($this->db->f('c_id', 
true), 'int'),
+                                                                               
        "title"                   => $this->unmarshal($this->db->f('title', 
true), 'string'),
+                                                                               
        "repeat_type"     => $this->unmarshal($this->db->f('repeat_type', 
true), 'int'),
+                                                                               
        "repeat_interval" => $this->unmarshal($this->db->f('repeat_interval', 
true), 'int')
+                                                                               
);
+                               }
+
+                               $check_list_array[] = array(
+                                                                               
        "cl_id"         => $this->db->f('cl_id', true),
+                                                                               
        "deadline"      => $this->db->f('deadline', true),
+                                                                               
        "count"         => $this->db->f('count', true)
+                                                                               
);
+                       
+                               $control_id = $this->db->f('c_id', true);
+                       }       
+               
+                       if( !empty( $control_array ) )
+                       {
+                               $controls_array[] = array( "control" => 
$control_array, "check_list" => $check_list_array);
+                       
+                               return $controls_array;
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+
+               function get_check_lists_for_location( $location_code, 
$from_date, $to_date, $repeat_type )
+               {
+                       $sql =  "SELECT c.id as c_id, cl.id as cl_id, cl.status 
as cl_status, cl.comment as cl_comment, ";
+                       $sql .= "deadline, planned_date, completed_date, 
cl.location_code as cl_loc, c.* "; 
+                       $sql .= "FROM controller_check_list cl, 
controller_control c ";
+                       $sql .= "WHERE cl.location_code = $location_code ";
+                       $sql .= "AND c.repeat_type = $repeat_type ";
+                       $sql .= "AND cl.control_id = c.id ";
+                       $sql .= "AND deadline BETWEEN $from_date AND $to_date";
+                       $sql .= "ORDER BY c.id;";
+               
+                       $this->db->query($sql);
+               
+                       $control_id = 0;
+                       $control = null;
+                       while ($this->db->next_record())
+                       {
+                               if( $this->db->f('c_id', true) != $control_id )
+                               {
+                                       if($control_id != 0)
+                                       {
+                                               
$control->set_check_lists_array($check_lists_array);
+                                               $controls_array[] = $control;
+                                       }
+                       
+                                       $control = new 
controller_control($this->unmarshal($this->db->f('c_id', true), 'int'));
+                                       
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+                                       
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
+                                       
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
+                                       
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
+                                       
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
+                                       
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
+                                       
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
+                                       
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
+                                       
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
+                                       
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
+                                       
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
+                                       
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
 true), 'int'));
+                                       
$control->set_component_id($this->unmarshal($this->db->f('component_id', true), 
'int'));
+                                       
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
+                                       
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
+                                       
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
+                                                               
+                                       $check_lists_array = array();
+                               }
+
+                               $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
+                               
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'string'));
+                               
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
+                               
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));
+                               
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date', 
true), 'int'));
+                               
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date', 
true), 'int'));
+                               
$check_list->set_location_code($this->unmarshal($this->db->f('cl_loc', true), 
'int'));
+               
+                               $check_lists_array[] = $check_list;
+
+                               $control_id =  $control->get_id();
+                       }
+               
+                       if($control != null)
+                       {
+                               
$control->set_check_lists_array($check_lists_array);
+                               $controls_array[] = $control;
+                       
+                               return $controls_array;
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+       
+               function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean $return_count)
+               {
+                       $current_time = time();
+                       $buffer_in_days = 3600*24*7*5;
+                       $buffer_time = $current_time - $buffer_in_days;
+
+                       $clauses = array('1=1');
+                       $clauses[] = "{$current_time} >= p.start_date AND 
p.start_date > {$buffer_time}"; 
+               
+                       $filter_clauses = array();
+               
+                       // Search for based on search type
+                       if($search_for)
+                       {
+                               $search_for = 
$this->marshal($search_for,'field');
+                               $like_pattern = "'%".$search_for."%'";
+                               $like_clauses = array();
+                               switch($search_type){
+                                       default:
+                                               $like_clauses[] = "p.title 
$this->like $like_pattern";
+                                               break;
+                               }
+                       
+                               if(count($like_clauses))
+                               {
+                                       $clauses[] = '(' . join(' OR ', 
$like_clauses) . ')';
+                               }
+                       }
+                       //var_dump($filters);
+                       if(isset($filters[$this->get_id_field_name()]))
+                       {
+                               $filter_clauses[] = "p.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+                       }
+               
+                       if(count($filter_clauses))
+                       {
+                               $clauses[] = join(' AND ', $filter_clauses);
+                       }
+               
+                       $condition =  join(' AND ', $clauses);
+
+                       $tables = "controller_control p";
+                       //$joins = " {$this->left_join} rental_document_types 
ON (rental_document.type_id = rental_document_types.id)";
+                       //$joins = " {$this->left_join} controller_control_area 
ON (controller_control.control_area_id = controller_control_area.id)";
+                       //$joins .= " {$this->left_join} controller_procedure 
ON (controller_control.procedure_id = controller_procedure.id)";
+               
+                       if($return_count)
+                       {
+                               $cols = 'COUNT(DISTINCT(p.id)) AS count';
+                       }
+                       else
+                       {
+                               $cols = 'p.* ';
+                       }
+               
+                       $dir = $ascending ? 'ASC' : 'DESC';
+                       if($sort_field == 'id')
+                       {
+                               $sort_field = 'p.id';
+                       }
+                       $order = $sort_field ? "ORDER BY 
{$this->marshal($sort_field, 'field')} $dir ": '';
+               
+                       return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
+               }
+
+               function populate(int $control_id, &$control)
+               {               
+                       if($control == null)
+                       {
+                               $start_date = date("d.m.Y",  
$this->db->f('start_date'));
+                               $end_date = date("d.m.Y",  
$this->db->f('end_date'));
+                               $control = new controller_control((int) 
$control_id);
+
+                               
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+                               
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
+                               $control->set_start_date($start_date);
+                               $control->set_end_date($end_date);
+                               
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
+                               
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
+                               
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
+                               
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
+                               
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
+                               
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
+                               
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
+       //                      
$control->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
+                               
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
 true), 'int'));
+                               
$control->set_component_id($this->unmarshal($this->db->f('component_id', true), 
'int'));
+                               
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
+                               
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
+                               
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
+                       }
+               
+                       return $control;
+               }
+       
+               function add(&$check_list)
+               {
+                       $cols = array(
+                                       'control_id',
+                                       'status',
+                                       'comment',
+                                       'deadline'
+                       );
+               
+                       $values = array(
+                               $this->marshal($check_list->get_control_id(), 
'int'),
+                               $this->marshal($check_list->get_status(), 
'bool'),
+                               $this->marshal($check_list->get_comment(), 
'string'),
+                               $this->marshal($check_list->get_deadline(), 
'int')
+                       );
+               
+                       $result = $this->db->query('INSERT INTO 
controller_check_list (' . join(',', $cols) . ') VALUES (' . join(',', $values) 
. ')', __LINE__,__FILE__);
+
+                       return isset($result) ? 
$this->db->get_last_insert_id('controller_check_list', 'id') : 0;
+               }
+       
+               function update($object){}
+       
+               function get_id_field_name($extended_info = false)
+               {
+                       if(!$extended_info)
+                       {
+                               $ret = 'id';
+                       }
+                       else
+                       {
+                               $ret = array
+                               (
+                                       'table'                 => 'control', 
// alias
+                                       'field'                 => 'id',
+                                       'translated'    => 'id'
+                               );
+                       }
+               
+                       return $ret;
+               }
+       }


Property changes on: 
branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socommon.inc.php   
2011-12-13 09:52:14 UTC (rev 8282)
+++ branches/Version-1_0-branch/controller/inc/class.socommon.inc.php   
2011-12-13 10:00:58 UTC (rev 8283)
@@ -1,326 +1,354 @@
-<?php
-abstract class controller_socommon
-{
-       protected $db;
-       protected $like;
-       protected $join;
-       protected $left_join;
-       
-       public function __construct()
-       {
-               $this->db           = clone $GLOBALS['phpgw']->db;
-               $this->like                     = & $this->db->like;
-               $this->join                     = & $this->db->join;
-               $this->left_join        = & $this->db->left_join;
-       }
-       
-       /**
-        * Marshal values according to type
-        * @param $value the value
-        * @param $type the type of value
-        * @return database value
-        */
-       protected function marshal($value, $type)
-       {
-               if($value === null)
-               {
-                       return 'NULL';
-               }
-               else if($type == 'int')
-               {
-                       if($value == '')
-                       {
-                               return 'NULL';
-                       }
-                       return intval($value);
-               }
-               else if($type == 'float')
-               {
-                       return str_replace(',', '.', $value);
-               }
-               else if($type == 'field')
-               {
-                       return $this->db->db_addslashes($value);
-               }
-                               
-               return "'" . $this->db->db_addslashes($value) . "'";
-       }
-
-       /*
-       
-       /**
-        * Unmarchal database values according to type
-        * @param $value the field value
-        * @param $type a string dictating value type
-        * @return the php value
-        */
-       protected function unmarshal($value, $type)
-       {
-               if($type == 'bool')
-               {
-                       return (boolean)$value;
-               }
-               elseif($value === null || $value == 'NULL')
-               {
-                       return null;
-               }
-               elseif($type == 'int')
-               {
-                       return intval($value);
-               }
-        elseif($type == 'float')
-        {
-            return floatval($value);
-        }
-               return $value;
-       }
-
-       /**
-        * Get the count of the specified query. Query must return a signel 
column
-        * called count.
-        * 
-        * @param $sql the sql query
-        * @return the count value
-        */
-       protected function get_query_count($sql)
-       {
-               $result = $this->db->query($sql);
-               if($result && $this->db->next_record())
-               {
-                       return $this->unmarshal($this->db->f('count', true), 
'int');
-               } 
-       }
-       
-       /**
-        * Implementing classes must return an instance of itself.
-        *  
-        * @return the class instance.
-        */
-       public abstract static function get_instance();
-
-       /**
-        * Convenience method for getting one single object. Calls get() with 
the
-        * specified id as a filter.
-        * 
-        * @param $id int with id of object to return.
-        * @return object with the specified id, null if not found.
-        */
-       public function get_single(int $id)
-       {
-               $objects = $this->get(null, null, null, null, null, null, 
array($this->get_id_field_name() => $id));
-               if(count($objects) > 0)
-               {
-                       $keys = array_keys($objects);
-                       return $objects[$keys[0]];
-               }
-               return null;
-       }
-       
-       /**
-        * Method for retrieving the db-object (security "forgotten")
-        */
-       public function get_db(){
-               return $this->db;
-       }
-
-       /**
-        * Method for retreiving objects.
-        * 
-        * @param $start_index int with index of first object.
-        * @param $num_of_objects int with max number of objects to return.
-        * @param $sort_field string representing the object field to sort on.
-        * @param $ascending boolean true for ascending sort on sort field, 
false
-        * for descending.
-        * @param $search_for string with free text search query.
-        * @param $search_type string with the query type.
-        * @param $filters array with key => value of filters.
-        * @return array of objects. May return an empty
-        * array, never null. The array keys are the respective index numbers.
-        */
-       public function get(int $start_index, int $num_of_objects, string 
$sort_field, boolean $ascending, string $search_for, string $search_type, array 
$filters)
-       {       
-               $results = array();                     // Array to store 
result objects
-               $map = array();                         // Array to hold number 
of records per target object
-               $check_map = array();           // Array to hold the actual 
number of record read per target object
-               $object_ids = array();          // All of the object ids 
encountered
-               $added_object_ids = array();// All of the added objects ids
-               
-               // Retrieve information about the table name and the name and 
alias of id column
-               // $break_on_limit -    flag indicating whether to break the 
loop when the number of records 
-               //                                              for all the 
result objects are traversed
-               $id_field_name_info = $this->get_id_field_name(true);
-               if(is_array($id_field_name_info))
-               {
-                       $break_on_limit = true;
-                       $id_field_name = $id_field_name_info['translated'];
-               }
-               else
-               {
-                       $break_on_limit = false;
-                       $id_field_name = $id_field_name_info;
-               }
-
-               // Special case: Sort on id field. Always changed to the id 
field name.
-               // $break_when_num_of_objects_reached - flag indicating to 
break the loop when the number of 
-               //              results are reached and we are sure that the 
records are ordered by the id
-               if($sort_field == null || $sort_field == 'id' || $sort_field == 
'')
-               {
-                       $sort_field = $id_field_name;
-                       $break_when_num_of_objects_reached = true;
-               }
-               else
-               {
-                       $break_when_num_of_objects_reached = false;
-               }
-               
-               // Only allow positive start index
-               if($start_index < 0)
-               {
-                       $start_index = 0;
-               }
-               
-               // test-input for break on ordered queries
-               $db2 = clone($this->db);
-
-               $sql = $this->get_query($sort_field, $ascending, $search_for, 
$search_type, $filters, false);
-               
-               $sql_parts = explode('1=1',$sql); // Split the query to insert 
extra condition on test for break
-               $this->db->query($sql,__LINE__, __FILE__, false, true);
-               
-               while ($this->db->next_record()) // Runs through all of the 
results
-               {
-                       $should_populate_object = false; // Default value - we 
won't populate object    
-                       $result_id = 
$this->unmarshal($this->db->f($id_field_name), 'int'); // The id of object
-
-                       if(in_array($result_id, $added_object_ids)) // Object 
with this id already added
-                       {
-                               $should_populate_object = true; // We should 
populate this object as we already have it in our result array
-                       }
-                       else // Object isn't already added to array
-                       {
-                               if(!in_array($result_id, $object_ids)) // 
Haven't already added this id
-                               {
-                                       $object_ids[] = $result_id; // We have 
to add the new id
-                               }
-                               // We have to check if we should populate this 
object
-                               if(count($object_ids) > $start_index) // We're 
at index above start index
-                               {
-                                       if($num_of_objects == null || 
count($results) < $num_of_objects) // We haven't found all the objects we're 
looking for
-                                       {
-                                               $should_populate_object = true; 
// We should populate this object
-                                               $added_object_ids[] = 
$result_id; // We keep the id
-                                       }
-                               }
-                       }
-                       if($should_populate_object)
-                       {       
-                               $result = &$results[$result_id];
-                               $results[$result_id] = 
$this->populate($result_id,$result);
-                               $last_result_id = $result_id;
-                               $map[$result_id] = (int)$map[$result_id] +1;
-                       }
-                       
-                       //Stop looping when array not sorted on other then id 
and wanted number of results is reached
-                       if(count($results) == $num_of_objects  && 
$last_result_id != $result_id && $break_when_num_of_objects_reached)
-                       {
-                               break;
-                       }
-                       // else stop looping when wanted number of results is 
reached all records for result objects are read
-                       else if($break_on_limit && (count($results) == 
$num_of_objects)  && $last_result_id != $result_id)
-                       {
-                               $id_ok = 0;
-                               foreach ($map as $_result_id => $_count)
-                               {
-                                       if(!isset($check_map[$_result_id]))
-                                       {
-                                               // Query the number of records 
for the specific object in question
-                                               $sql2 = "{$sql_parts[0]} 1=1 
AND {$id_field_name_info['table']}.{$id_field_name_info['field']} = 
{$_result_id} {$sql_parts[1]}";
-                                               $db2->query($sql2,__LINE__, 
__FILE__);
-                                               $db2->next_record();
-                                               $check_map[$_result_id] = 
$db2->num_rows();
-                                       }
-                                       if(     $check_map[$_result_id] == 
$_count )
-                                       {
-                                               $id_ok++;
-                                       }
-                               }
-                               if($id_ok == $num_of_objects)
-                               {
-                                       break;
-                               }
-                       }
-               }
-               
-               return $results;
-       }
-       
-       /**
-        * Returns count of matching objects.
-        * 
-        * @param $search_for string with free text search query.
-        * @param $search_type string with the query type.
-        * @param $filters array with key => value of filters.
-        * @return int with object count.
-        */
-       public function get_count(string $search_for, string $search_type, 
array $filters)
-       {
-               return $this->get_query_count($this->get_query(null, null, 
$search_for, $search_type, $filters, true));
-       }
-       
-       /**
-        * Implementing classes must return the name of the field used in the 
query
-        * returned from get_query().
-        * 
-        * @return string with name of id field.
-        */
-       protected abstract function get_id_field_name();
-       
-       /**
-        * Returns SQL for retrieving matching objects or object count.
-        * 
-        * @param $start_index int with index of first object.
-        * @param $num_of_objects int with max number of objects to return.
-        * @param $sort_field string representing the object field to sort on.
-        * @param $ascending boolean true for ascending sort on sort field, 
false
-        * for descending.
-        * @param $search_for string with free text search query.
-        * @param $search_type string with the query type.
-        * @param $filters array with key => value of filters.
-        * @param $return_count boolean telling to return only the count of the
-        * matching objects, or the objects themself.
-        * @return string with SQL.
-        */
-
-       protected abstract function get_query(string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count);
-
-       protected abstract function populate(int $object_id, &$object);
-       
-       protected abstract function add(&$object);
-       
-       protected abstract function update($object);
-       
-       /**
-       * Store the object in the database.  If the object has no ID it is 
assumed to be new and
-       * inserted for the first time.  The object is then updated with the new 
insert id.
-       */
-       
-       public function store(&$object)
-       {
-               if ($object->validates()) {
-                       if ($object->get_id() > 0) {
-                               // We can assume this composite came from the 
database since it has an ID. Update the existing row
-                               return $this->update($object);
-                       }
-                       else
-                       {
-                               // This object does not have an ID, so will be 
saved as a new DB row
-                               return $this->add($object);
-                       }
-               }
-
-               // The object did not validate
-               return false;
-       }
-       
-}
-?>
\ No newline at end of file
+<?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$
+       */
+
+       abstract class controller_socommon
+       {
+               protected $db;
+               protected $like;
+               protected $join;
+               protected $left_join;
+
+               public function __construct()
+               {
+                       $this->db                  = clone 
$GLOBALS['phpgw']->db;
+                       $this->like                     = & $this->db->like;
+                       $this->join                     = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+               }
+
+               /**
+                * Marshal values according to type
+                * @param $value the value
+                * @param $type the type of value
+                * @return database value
+                */
+               protected function marshal($value, $type)
+               {
+                       if($value === null)
+                       {
+                               return 'NULL';
+                       }
+                       else if($type == 'int')
+                       {
+                               if($value == '')
+                               {
+                                       return 'NULL';
+                               }
+                               return intval($value);
+                       }
+                       else if($type == 'float')
+                       {
+                               return str_replace(',', '.', $value);
+                       }
+                       else if($type == 'field')
+                       {
+                               return $this->db->db_addslashes($value);
+                       }
+
+                       return "'" . $this->db->db_addslashes($value) . "'";
+               }
+
+               /*
+
+               /**
+                * Unmarchal database values according to type
+                * @param $value the field value
+                * @param $type a string dictating value type
+                * @return the php value
+                */
+               protected function unmarshal($value, $type)
+               {
+                       if($type == 'bool')
+                       {
+                               return (boolean)$value;
+                       }
+                       elseif($value === null || $value == 'NULL')
+                       {
+                               return null;
+                       }
+                       elseif($type == 'int')
+                       {
+                               return intval($value);
+                       }
+                       elseif($type == 'float')
+                       {
+                               return floatval($value);
+                       }
+                       return $value;
+               }
+
+               /**
+                * Get the count of the specified query. Query must return a 
signel column
+                * called count.
+                * 
+                * @param $sql the sql query
+                * @return the count value
+                */
+               protected function get_query_count($sql)
+               {
+                       $result = $this->db->query($sql);
+                       if($result && $this->db->next_record())
+                       {
+                               return $this->unmarshal($this->db->f('count', 
true), 'int');
+                       } 
+               }
+
+               /**
+                * Implementing classes must return an instance of itself.
+                *  
+                * @return the class instance.
+                */
+               public abstract static function get_instance();
+
+               /**
+                * Convenience method for getting one single object. Calls 
get() with the
+                * specified id as a filter.
+                * 
+                * @param $id int with id of object to return.
+                * @return object with the specified id, null if not found.
+                */
+               public function get_single(int $id)
+               {
+                       $objects = $this->get(null, null, null, null, null, 
null, array($this->get_id_field_name() => $id));
+                       if(count($objects) > 0)
+                       {
+                               $keys = array_keys($objects);
+                               return $objects[$keys[0]];
+                       }
+                       return null;
+               }
+
+               /**
+                * Method for retrieving the db-object (security "forgotten")
+                */
+               public function get_db(){
+                       return $this->db;
+               }
+
+               /**
+                * Method for retreiving objects.
+                * 
+                * @param $start_index int with index of first object.
+                * @param $num_of_objects int with max number of objects to 
return.
+                * @param $sort_field string representing the object field to 
sort on.
+                * @param $ascending boolean true for ascending sort on sort 
field, false
+                * for descending.
+                * @param $search_for string with free text search query.
+                * @param $search_type string with the query type.
+                * @param $filters array with key => value of filters.
+                * @return array of objects. May return an empty
+                * array, never null. The array keys are the respective index 
numbers.
+                */
+               public function get(int $start_index, int $num_of_objects, 
string $sort_field, boolean $ascending, string $search_for, string 
$search_type, array $filters)
+               {
+                       $results = array();                     // Array to 
store result objects
+                       $map = array();                         // Array to 
hold number of records per target object
+                       $check_map = array();           // Array to hold the 
actual number of record read per target object
+                       $object_ids = array();          // All of the object 
ids encountered
+                       $added_object_ids = array();// All of the added objects 
ids
+
+                       // Retrieve information about the table name and the 
name and alias of id column
+                       // $break_on_limit -    flag indicating whether to 
break the loop when the number of records 
+                       //                                              for all 
the result objects are traversed
+                       $id_field_name_info = $this->get_id_field_name(true);
+                       if(is_array($id_field_name_info))
+                       {
+                               $break_on_limit = true;
+                               $id_field_name = 
$id_field_name_info['translated'];
+                       }
+                       else
+                       {
+                               $break_on_limit = false;
+                               $id_field_name = $id_field_name_info;
+                       }
+
+                       // Special case: Sort on id field. Always changed to 
the id field name.
+                       // $break_when_num_of_objects_reached - flag indicating 
to break the loop when the number of 
+                       //              results are reached and we are sure 
that the records are ordered by the id
+                       if($sort_field == null || $sort_field == 'id' || 
$sort_field == '')
+                       {
+                               $sort_field = $id_field_name;
+                               $break_when_num_of_objects_reached = true;
+                       }
+                       else
+                       {
+                               $break_when_num_of_objects_reached = false;
+                       }
+
+                       // Only allow positive start index
+                       if($start_index < 0)
+                       {
+                               $start_index = 0;
+                       }
+
+                       // test-input for break on ordered queries
+                       $db2 = clone($this->db);
+
+                       $sql = $this->get_query($sort_field, $ascending, 
$search_for, $search_type, $filters, false);
+
+                       $sql_parts = explode('1=1',$sql); // Split the query to 
insert extra condition on test for break
+                       $this->db->query($sql,__LINE__, __FILE__, false, true);
+
+                       while ($this->db->next_record()) // Runs through all of 
the results
+                       {
+                               $should_populate_object = false; // Default 
value - we won't populate object
+                               $result_id = 
$this->unmarshal($this->db->f($id_field_name), 'int'); // The id of object
+
+                               if(in_array($result_id, $added_object_ids)) // 
Object with this id already added
+                               {
+                                       $should_populate_object = true; // We 
should populate this object as we already have it in our result array
+                               }
+                               else // Object isn't already added to array
+                               {
+                                       if(!in_array($result_id, $object_ids)) 
// Haven't already added this id
+                                       {
+                                               $object_ids[] = $result_id; // 
We have to add the new id
+                                       }
+                                       // We have to check if we should 
populate this object
+                                       if(count($object_ids) > $start_index) 
// We're at index above start index
+                                       {
+                                               if($num_of_objects == null || 
count($results) < $num_of_objects) // We haven't found all the objects we're 
looking for
+                                               {
+                                                       $should_populate_object 
= true; // We should populate this object
+                                                       $added_object_ids[] = 
$result_id; // We keep the id
+                                               }
+                                       }
+                               }
+                               if($should_populate_object)
+                               {
+                                       $result = &$results[$result_id];
+                                       $results[$result_id] = 
$this->populate($result_id,$result);
+                                       $last_result_id = $result_id;
+                                       $map[$result_id] = 
(int)$map[$result_id] +1;
+                               }
+
+                               //Stop looping when array not sorted on other 
then id and wanted number of results is reached
+                               if(count($results) == $num_of_objects  && 
$last_result_id != $result_id && $break_when_num_of_objects_reached)
+                               {
+                                       break;
+                               }
+                               // else stop looping when wanted number of 
results is reached all records for result objects are read
+                               else if($break_on_limit && (count($results) == 
$num_of_objects)  && $last_result_id != $result_id)
+                               {
+                                       $id_ok = 0;
+                                       foreach ($map as $_result_id => $_count)
+                                       {
+                                               
if(!isset($check_map[$_result_id]))
+                                               {
+                                                       // Query the number of 
records for the specific object in question
+                                                       $sql2 = 
"{$sql_parts[0]} 1=1 AND 
{$id_field_name_info['table']}.{$id_field_name_info['field']} = {$_result_id} 
{$sql_parts[1]}";
+                                                       
$db2->query($sql2,__LINE__, __FILE__);
+                                                       $db2->next_record();
+                                                       $check_map[$_result_id] 
= $db2->num_rows();
+                                               }
+                                               if(     $check_map[$_result_id] 
== $_count )
+                                               {
+                                                       $id_ok++;
+                                               }
+                                       }
+                                       if($id_ok == $num_of_objects)
+                                       {
+                                               break;
+                                       }
+                               }
+                       }
+
+                       return $results;
+               }
+
+               /**
+                * Returns count of matching objects.
+                * 
+                * @param $search_for string with free text search query.
+                * @param $search_type string with the query type.
+                * @param $filters array with key => value of filters.
+                * @return int with object count.
+                */
+               public function get_count(string $search_for, string 
$search_type, array $filters)
+               {
+                       return $this->get_query_count($this->get_query(null, 
null, $search_for, $search_type, $filters, true));
+               }
+
+               /**
+                * Implementing classes must return the name of the field used 
in the query
+                * returned from get_query().
+                * 
+                * @return string with name of id field.
+                */
+               protected abstract function get_id_field_name();
+
+               /**
+                * Returns SQL for retrieving matching objects or object count.
+                * 
+                * @param $start_index int with index of first object.
+                * @param $num_of_objects int with max number of objects to 
return.
+                * @param $sort_field string representing the object field to 
sort on.
+                * @param $ascending boolean true for ascending sort on sort 
field, false
+                * for descending.
+                * @param $search_for string with free text search query.
+                * @param $search_type string with the query type.
+                * @param $filters array with key => value of filters.
+                * @param $return_count boolean telling to return only the 
count of the
+                * matching objects, or the objects themself.
+                * @return string with SQL.
+                */
+
+               protected abstract function get_query(string $sort_field, 
boolean $ascending, string $search_for, string $search_type, array $filters, 
boolean $return_count);
+
+               protected abstract function populate(int $object_id, &$object);
+
+               protected abstract function add(&$object);
+
+               protected abstract function update($object);
+
+               /**
+               * Store the object in the database.  If the object has no ID it 
is assumed to be new and
+               * inserted for the first time.  The object is then updated with 
the new insert id.
+               */
+
+               public function store(&$object)
+               {
+                       if ($object->validates()) {
+                               if ($object->get_id() > 0) {
+                                       // We can assume this composite came 
from the database since it has an ID. Update the existing row
+                                       return $this->update($object);
+                               }
+                               else
+                               {
+                                       // This object does not have an ID, so 
will be saved as a new DB row
+                                       return $this->add($object);
+                               }
+                       }
+
+                       // The object did not validate
+                       return false;
+               }
+
+       }


Property changes on: 
branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2011-12-13 09:52:14 UTC (rev 8282)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2011-12-13 10:00:58 UTC (rev 8283)
@@ -1,342 +1,476 @@
-<?php
-phpgw::import_class('controller.socommon');
-
-include_class('controller', 'control', 'inc/model/');
-
-class controller_socontrol extends controller_socommon
-{
-       protected static $so;
-
-       /**
-        * Get a static reference to the storage object associated with this 
model object
-        *
-        * @return controller_soparty the storage object
-        */
-       public static function get_instance()
-       {
-               if (self::$so == null) {
-                       self::$so = CreateObject('controller.socontrol');
-               }
-               return self::$so;
-       }
-
-       /**
-        * Function for adding a new control to the database. Updates the 
control object.
-        *
-        * @param activitycalendar_activity $activity the party to be added
-        * @return bool true if successful, false otherwise
-        */
-       function add(&$control)
-       {
-               $title = $control->get_title();
-               
-               $sql = "INSERT INTO controller_control (title) VALUES 
('$title')";
-               $result = $this->db->query($sql, __LINE__,__FILE__);
-
-               if(isset($result)) {
-                       
-                       // Set the new control ID
-                       
$control->set_id($this->db->get_last_insert_id('controller_control', 'id'));
-                       
-                       // Forward this request to the update method
-                       return $this->update($control);
-               }
-               else
-               {
-                       return false;
-               }       
-       }
-
-       /**
-        * Update the database values for an existing activity object.
-        *
-        * @param $activity the activity to be updated
-        * @return boolean true if successful, false otherwise
-        */
-       function update($control)
-       {       
-               
-               $id = intval($control->get_id());
-               
-               $values = array(
-                       'title = ' . $this->marshal($control->get_title(), 
'string'),
-                       'description = ' . 
$this->marshal($control->get_description(), 'string'),
-                       'start_date = ' . 
$this->marshal($control->get_start_date(), 'int'),
-                       'end_date = ' . 
$this->marshal($control->get_end_date(), 'int'),
-                       'control_area_id = ' . 
$this->marshal($control->get_control_area_id()),
-                       'repeat_type = ' . 
$this->marshal($control->get_repeat_type(), 'string'),
-                       'repeat_interval = ' . 
$this->marshal($control->get_repeat_interval(), 'string'),
-                       'procedure_id = ' . 
$this->marshal($control->get_procedure_id(), 'int'),
-                       'responsibility_id = ' . 
$this->marshal($control->get_responsibility_id(), 'int')
-               );
-               
-               $result = $this->db->query('UPDATE controller_control SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
-               
-               if( isset($result) ){
-                       return $id;     
-               }else{
-                       return 0;
-               }
-                               
-               // Kommenterte denne ut midlertidig. 
-               //Trenger id-en som ble lagret når controllen blir lagret. 
-               //return isset($result);
-       }
-       
-       
-       
-       function get_controls_by_control_area($control_area_id)
-       {
-               $controls_array = array();
-               
-               $sql = "SELECT * FROM controller_control WHERE 
control_area_id=$control_area_id";
-               $this->db->query($sql);
-               
-               while($this->db->next_record()) {
-                       $control = new 
controller_control($this->unmarshal($this->db->f('id', true), 'int'));
-                       
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
-                       
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
-                       
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
-                       
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
-                       
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
-                       
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
-                       
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
-                       
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
-                       
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
-                       
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
-                       
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
-                       
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
 true), 'int'));
-                       
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true), 
'int'));
-                       
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
-                       
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
-                       
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
-                       
-                       $controls_array[] = $control->toArray();
-               }
-               
-               if( count( $controls_array ) > 0 ){
-                       return $controls_array; 
-               }
-               else
-               {
-                       return null;
-               }
-       }
-       
-       function get_locations_for_control($control_id)
-       {
-               $controls_array = array();
-               
-               $sql =  "SELECT c.id, c.title, cll.location_code "; 
-               $sql .= "FROM controller_control c, 
controller_control_location_list cll ";
-               $sql .= "WHERE cll.control_id = $control_id ";
-               $sql .= "AND cll.control_id = c.id";
-
-               $this->db->query($sql);
-               
-               while($this->db->next_record()) {
-                       $control_id = $this->unmarshal($this->db->f('id', 
true), 'int');
-                       $title = $this->unmarshal($this->db->f('title', true), 
'string');
-                       $location_code = 
$this->unmarshal($this->db->f('location_code', true), 'int');
-                       
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
-                       
-                       $controls_array[] = array("id" => $control_id, "title" 
=> $title, "location_code" => $location_code, "loc1_name" => 
$location_array["loc1_name"]);
-               }
-               
-               if( count( $controls_array ) > 0 ){
-                       return $controls_array; 
-               }
-               else
-               {
-                       return null;
-               }
-       }
-       
-       function add_location_to_control($control_id, $location_code)
-       {
-               $sql =  "INSERT INTO controller_control_location_list 
(control_id, location_code) values($control_id, $location_code)";
-               $this->db->query($sql);
-       }
-               
-       function get_id_field_name($extended_info = false)
-       {
-               if(!$extended_info)
-               {
-                       $ret = 'id';
-               }
-               else
-               {
-                       $ret = array
-                       (
-                               'table'                 => 'control', // alias
-                               'field'                 => 'id',
-                               'translated'    => 'id'
-                       );
-               }
-               
-               return $ret;
-       }
-
-       protected function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean $return_count)
-       {
-               $clauses = array('1=1');
-               
-               $filter_clauses = array();
-               
-               // Search for based on search type
-               if($search_for)
-               {
-                       $search_for = $this->marshal($search_for,'field');
-                       $like_pattern = "'%".$search_for."%'";
-                       $like_clauses = array();
-                       switch($search_type){
-                               default:
-                                       $like_clauses[] = 
"controller_control.title $this->like $like_pattern";
-                                       $like_clauses[] = 
"controller_control.description $this->like $like_pattern";
-                                       break;
-                       }
-                       
-                       if(count($like_clauses))
-                       {
-                               $clauses[] = '(' . join(' OR ', $like_clauses) 
. ')';
-                       }
-               }
-               //var_dump($filters);
-               if(isset($filters[$this->get_id_field_name()]))
-               {
-                       $filter_clauses[] = "controller_control.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
-               }
-               if(isset($filters['control_areas']))
-               {
-                       $filter_clauses[] = "controller_control.control_area_id 
= {$this->marshal($filters['control_areas'],'int')}";
-               }
-               if(isset($filters['responsibilities']))
-               {
-                       $filter_clauses[] = 
"controller_control.responsibility_id = 
{$this->marshal($filters['responsibilities'],'int')}";
-               }
-               
-               if(count($filter_clauses))
-               {
-                       $clauses[] = join(' AND ', $filter_clauses);
-               }
-               
-               
-               $condition =  join(' AND ', $clauses);
-
-               $tables = "controller_control";
-               //$joins = " {$this->left_join} rental_document_types ON 
(rental_document.type_id = rental_document_types.id)";
-               $joins = " {$this->left_join} controller_control_area ON 
(controller_control.control_area_id = controller_control_area.id)";
-               $joins .= " {$this->left_join} controller_procedure ON 
(controller_control.procedure_id = controller_procedure.id)";
-               $joins .= " {$this->left_join} fm_responsibility_role ON 
(controller_control.responsibility_id = fm_responsibility_role.id)";
-               
-               if($return_count)
-               {
-                       $cols = 'COUNT(DISTINCT(controller_control.id)) AS 
count';
-               }
-               else
-               {
-                       $cols = 'controller_control.id, 
controller_control.title, controller_control.description, 
controller_control.start_date, controller_control.end_date, 
controller_control.procedure_id, controller_control.control_area_id, 
controller_control.requirement_id, controller_control.costresponsibility_id, 
controller_control.responsibility_id, controller_control.equipment_type_id, 
controller_control.equipment_id, controller_control.location_code, 
controller_control.repeat_type, controller_control.repeat_interval, 
controller_control.enabled, controller_control_area.title AS control_area_name, 
controller_procedure.title AS procedure_name, fm_responsibility_role.name AS 
responsibility_name ';
-               }
-               
-               $dir = $ascending ? 'ASC' : 'DESC';
-               if($sort_field == 'title')
-               {
-                       $sort_field = 'controller_control.title';
-               }
-               else if($sort_field == 'id')
-               {
-                       $sort_field = 'controller_control.id';
-               }
-               $order = $sort_field ? "ORDER BY {$this->marshal($sort_field, 
'field')} $dir ": '';
-               
-               return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
-               
-       }
-       
-       function populate(int $control_id, &$control)
-       {
-               if($control == null) {
-                       $control = new controller_control((int) $control_id);
-
-                       
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
-                       
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
-                       
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
-                       
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
-                       
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
-                       
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
-                       
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
-                       
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
-                       
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
-                       
$control->set_responsibility_name($this->unmarshal($this->db->f('responsibility_name',
 true), 'string'));
-                       
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
-                       
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
-//                     
$control->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
-                       
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
 true), 'int'));
-                       
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true), 
'int'));
-                       
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
-                       
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
-                       
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
-               }
-               
-               return $control;
-       }
-       
-       /**
-        * Get single control
-        * 
-        * @param       $id     id of the control to return
-        * @return a controller_control
-        */
-       function get_single($id)
-       {
-               $id = (int)$id;
-               
-               $joins = " {$this->left_join} controller_control_area ON 
(c.control_area_id = controller_control_area.id)";
-               $joins .= " {$this->left_join} controller_procedure ON 
(c.procedure_id = controller_procedure.id)";
-               $joins .= " {$this->left_join} fm_responsibility_role ON 
(c.responsibility_id = fm_responsibility_role.id)";
-               
-               $sql = "SELECT c.*, controller_control_area.title AS 
control_area_name, controller_procedure.title AS procedure_name, 
fm_responsibility_role.name AS responsibility_name FROM controller_control c 
{$joins} WHERE c.id = " . $id;
-               $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
-               $this->db->next_record();
-               
-               $control = new controller_control((int) $id);
-
-               $control->set_title($this->unmarshal($this->db->f('title', 
true), 'string'));
-               
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
-               
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
-               
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
-               
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
-               
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
-               
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
-               
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
-               
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
-               
$control->set_responsibility_name($this->unmarshal($this->db->f('responsibility_name',
 true), 'string'));
-               
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
-               
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
-//                     
$control->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
-               
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
 true), 'int'));
-               
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true), 
'int'));
-               
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
-               
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
-               
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
-               
-               return $control;
-       }
-
-       function get_roles()
-       {
-               $ret_array = array();
-               $ret_array[0] = array('id' =>  0,'name' => lang('Not 
selected'));
-               $sql = "select * from fm_responsibility_role ORDER BY name";
-               $this->db->query($sql, __LINE__, __FILE__);
-               $i = 1;
-               while($this->db->next_record())
-               {
-                       $ret_array[$i]['id'] = $this->db->f('id');
-                       $ret_array[$i]['name'] = $this->db->f('name');
-                       $i++;
-               }
-               return $ret_array;
-       }
-}
+<?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$
+       */
+
+       phpgw::import_class('controller.socommon');
+
+       include_class('controller', 'control', 'inc/model/');
+
+       class controller_socontrol extends controller_socommon
+       {
+               protected static $so;
+
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                *
+                * @return controller_soparty the storage object
+                */
+               public static function get_instance()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.socontrol');
+                       }
+                       return self::$so;
+               }
+
+               /**
+                * Function for adding a new control to the database. Updates 
the control object.
+                *
+                * @param activitycalendar_activity $activity the party to be 
added
+                * @return bool true if successful, false otherwise
+                */
+               function add(&$control)
+               {
+                       $title = $control->get_title();
+
+                       $sql = "INSERT INTO controller_control (title) VALUES 
('$title')";
+                       $result = $this->db->query($sql, __LINE__,__FILE__);
+
+                       if(isset($result)) {
+
+                               // Set the new control ID
+                               
$control->set_id($this->db->get_last_insert_id('controller_control', 'id'));
+
+                               // Forward this request to the update method
+                               return $this->update($control);
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+
+               /**
+                * Update the database values for an existing activity object.
+                *
+                * @param $activity the activity to be updated
+                * @return boolean true if successful, false otherwise
+                */
+               function update($control)
+               {
+
+                       $id = intval($control->get_id());
+
+                       $values = array(
+                               'title = ' . 
$this->marshal($control->get_title(), 'string'),
+                               'description = ' . 
$this->marshal($control->get_description(), 'string'),
+                               'start_date = ' . 
$this->marshal($control->get_start_date(), 'int'),
+                               'end_date = ' . 
$this->marshal($control->get_end_date(), 'int'),
+                               'control_area_id = ' . 
$this->marshal($control->get_control_area_id()),
+                               'repeat_type = ' . 
$this->marshal($control->get_repeat_type(), 'string'),
+                               'repeat_interval = ' . 
$this->marshal($control->get_repeat_interval(), 'string'),
+                               'procedure_id = ' . 
$this->marshal($control->get_procedure_id(), 'int'),
+                               'responsibility_id = ' . 
$this->marshal($control->get_responsibility_id(), 'int')
+                       );
+
+                       $result = $this->db->query('UPDATE controller_control 
SET ' . join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+
+                       if( isset($result) ){
+                               return $id;
+                       }else{
+                               return 0;
+                       }
+
+                       // Kommenterte denne ut midlertidig. 
+                       //Trenger id-en som ble lagret når controllen blir 
lagret. 
+                       //return isset($result);
+               }
+
+
+
+               function get_controls_by_control_area($control_area_id)
+               {
+                       $controls_array = array();
+
+                       $sql = "SELECT * FROM controller_control WHERE 
control_area_id=$control_area_id";
+                       $this->db->query($sql);
+
+                       while($this->db->next_record()) {
+                               $control = new 
controller_control($this->unmarshal($this->db->f('id', true), 'int'));
+                               
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+                               
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
+                               
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
+                               
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
+                               
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
+                               
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
+                               
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
+                               
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
+                               
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
+                               
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
+                               
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
+                               
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
 true), 'int'));
+                               
$control->set_component_id($this->unmarshal($this->db->f('component_id', true), 
'int'));
+                               
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
+                               
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
+                               
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
+
+                               $controls_array[] = $control->toArray();
+                       }
+
+                       if( count( $controls_array ) > 0 ){
+                               return $controls_array; 
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+
+               function get_locations_for_control($control_id)
+               {
+                       $controls_array = array();
+
+                       $sql =  "SELECT c.id, c.title, cll.location_code "; 
+                       $sql .= "FROM controller_control c, 
controller_control_location_list cll ";
+                       $sql .= "WHERE cll.control_id = $control_id ";
+                       $sql .= "AND cll.control_id = c.id";
+
+                       $this->db->query($sql);
+
+                       while($this->db->next_record()) {
+                               $control_id = 
$this->unmarshal($this->db->f('id', true), 'int');
+                               $title = $this->unmarshal($this->db->f('title', 
true), 'string');
+                               $location_code = 
$this->unmarshal($this->db->f('location_code', true), 'int');
+
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+
+                               $controls_array[] = array("id" => $control_id, 
"title" => $title, "location_code" => $location_code, "loc1_name" => 
$location_array["loc1_name"]);
+                       }
+
+                       if( count( $controls_array ) > 0 ){
+                               return $controls_array; 
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+
+               function add_location_to_control($control_id, $location_code)
+               {
+                       $sql =  "INSERT INTO controller_control_location_list 
(control_id, location_code) values($control_id, $location_code)";
+                       $this->db->query($sql);
+               }
+
+               function add_component_to_control($control_id, $component_id)
+               {
+                       $sql =  "INSERT INTO controller_control_component_list 
(control_id, component_id) values($control_id, $component_id)";
+                       $this->db->query($sql);
+               }
+
+               function get_id_field_name($extended_info = false)
+               {
+                       if(!$extended_info)
+                       {
+                               $ret = 'id';
+                       }
+                       else
+                       {
+                               $ret = array
+                               (
+                                       'table'                 => 'control', 
// alias
+                                       'field'                 => 'id',
+                                       'translated'    => 'id'
+                               );
+                       }
+
+                       return $ret;
+               }
+
+               protected function get_query(string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count)
+               {
+                       $clauses = array('1=1');
+
+                       $filter_clauses = array();
+
+                       // Search for based on search type
+                       if($search_for)
+                       {
+                               $search_for = 
$this->marshal($search_for,'field');
+                               $like_pattern = "'%".$search_for."%'";
+                               $like_clauses = array();
+                               switch($search_type){
+                                       default:
+                                               $like_clauses[] = 
"controller_control.title $this->like $like_pattern";
+                                               $like_clauses[] = 
"controller_control.description $this->like $like_pattern";
+                                               break;
+                               }
+
+                               if(count($like_clauses))
+                               {
+                                       $clauses[] = '(' . join(' OR ', 
$like_clauses) . ')';
+                               }
+                       }
+                       //var_dump($filters);
+                       if(isset($filters[$this->get_id_field_name()]))
+                       {
+                               $filter_clauses[] = "controller_control.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+                       }
+                       if(isset($filters['control_areas']))
+                       {
+                               $filter_clauses[] = 
"controller_control.control_area_id = 
{$this->marshal($filters['control_areas'],'int')}";
+                       }
+                       if(isset($filters['responsibilities']))
+                       {
+                               $filter_clauses[] = 
"controller_control.responsibility_id = 
{$this->marshal($filters['responsibilities'],'int')}";
+                       }
+
+                       if(count($filter_clauses))
+                       {
+                               $clauses[] = join(' AND ', $filter_clauses);
+                       }
+
+
+                       $condition =  join(' AND ', $clauses);
+
+                       $tables = "controller_control";
+                       //$joins = " {$this->left_join} rental_document_types 
ON (rental_document.type_id = rental_document_types.id)";
+                       $joins = " {$this->left_join} controller_control_area 
ON (controller_control.control_area_id = controller_control_area.id)";
+                       $joins .= " {$this->left_join} controller_procedure ON 
(controller_control.procedure_id = controller_procedure.id)";
+                       $joins .= " {$this->left_join} fm_responsibility_role 
ON (controller_control.responsibility_id = fm_responsibility_role.id)";
+
+                       if($return_count)
+                       {
+                               $cols = 'COUNT(DISTINCT(controller_control.id)) 
AS count';
+                       }
+                       else
+                       {
+                               $cols = 'controller_control.id, 
controller_control.title, controller_control.description, 
controller_control.start_date, controller_control.end_date, 
controller_control.procedure_id, controller_control.control_area_id, 
controller_control.requirement_id, controller_control.costresponsibility_id, 
controller_control.responsibility_id, controller_control.component_type_id, 
controller_control.component_id, controller_control.location_code, 
controller_control.repeat_type, controller_control.repeat_interval, 
controller_control.enabled, controller_control_area.title AS control_area_name, 
controller_procedure.title AS procedure_name, fm_responsibility_role.name AS 
responsibility_name ';
+                       }
+
+                       $dir = $ascending ? 'ASC' : 'DESC';
+                       if($sort_field == 'title')
+                       {
+                               $sort_field = 'controller_control.title';
+                       }
+                       else if($sort_field == 'id')
+                       {
+                               $sort_field = 'controller_control.id';
+                       }
+                       $order = $sort_field ? "ORDER BY 
{$this->marshal($sort_field, 'field')} $dir ": '';
+
+                       return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
+
+               }
+
+               function populate(int $control_id, &$control)
+               {
+                       if($control == null) {
+                               $control = new controller_control((int) 
$control_id);
+
+                               
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+                               
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
+                               
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
+                               
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
+                               
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
+                               
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
+                               
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
+                               
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
+                               
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
+                               
$control->set_responsibility_name($this->unmarshal($this->db->f('responsibility_name',
 true), 'string'));
+                               
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
+                               
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
+       //                      
$control->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
+                               
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
 true), 'int'));
+                               
$control->set_component_id($this->unmarshal($this->db->f('component_id', true), 
'int'));
+                               
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
+                               
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
+                               
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
+                       }
+
+                       return $control;
+               }
+
+               /**
+                * Get single control
+                * 
+                * @param       $id     id of the control to return
+                * @return a controller_control
+                */
+               function get_single($id)
+               {
+                       $id = (int)$id;
+
+                       $joins = " {$this->left_join} controller_control_area 
ON (c.control_area_id = controller_control_area.id)";
+                       $joins .= " {$this->left_join} controller_procedure ON 
(c.procedure_id = controller_procedure.id)";
+                       $joins .= " {$this->left_join} fm_responsibility_role 
ON (c.responsibility_id = fm_responsibility_role.id)";
+
+                       $sql = "SELECT c.*, controller_control_area.title AS 
control_area_name, controller_procedure.title AS procedure_name, 
fm_responsibility_role.name AS responsibility_name FROM controller_control c 
{$joins} WHERE c.id = " . $id;
+                       $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+                       $this->db->next_record();
+
+                       $control = new controller_control((int) $id);
+
+                       
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+                       
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
+                       
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
+                       
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
+                       
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
+                       
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
+                       
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
+                       
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
+                       
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
+                       
$control->set_responsibility_name($this->unmarshal($this->db->f('responsibility_name',
 true), 'string'));
+                       
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
+                       
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
+       //                      
$control->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
+                       
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
 true), 'int'));
+                       
$control->set_component_id($this->unmarshal($this->db->f('component_id', true), 
'int'));
+                       
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
+                       
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
+                       
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
+
+                       return $control;
+               }
+
+               function get_roles()
+               {
+                       $ret_array = array();
+                       $ret_array[0] = array('id' =>  0,'name' => lang('Not 
selected'));
+                       $sql = "select * from fm_responsibility_role ORDER BY 
name";
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $i = 1;
+                       while($this->db->next_record())
+                       {
+                               $ret_array[$i]['id'] = $this->db->f('id');
+                               $ret_array[$i]['name'] = $this->db->f('name');
+                               $i++;
+                       }
+                       return $ret_array;
+               }
+
+               function get_bim_types($ifc = null)
+               {
+                       $ret_array = array();
+                       if($ifc != null)
+                       {
+                               if($ifc == 1)
+                                       $where_clause = "WHERE is_ifc";
+                               else
+                                       $where_clause = "WHERE NOT is_ifc";
+                       }
+                       $sql = "select * from fm_bim_type {$where_clause} ORDER 
BY name";
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $i = 1;
+                       while($this->db->next_record())
+                       {
+                               $ret_array[$i]['id'] = $this->db->f('id');
+                               $ret_array[$i]['name'] = $this->db->f('name');
+                               $i++;
+                       }
+                       return $ret_array;
+               }
+
+               public function getAllBimItems($noOfObjects = null, $bim_type = 
null) {
+                       $filters = array();
+                       if($noOfObjects != null && is_numeric($noOfObjects))
+                       {
+                               $limit = "LIMIT {$noOfObjects}";
+                       }
+                       else
+                       {
+                               $limit = "LIMIT 10";
+                       }
+                       if($bim_type != null && is_numeric($bim_type))
+                       {
+                               $filter = " AND fm_bim_type.id = {$bim_type}";
+                       }
+                       $sql  = "SELECT fm_bim_item.id, fm_bim_type.name AS 
type, fm_bim_item.guid FROM public.fm_bim_item,  public.fm_bim_type WHERE 
fm_bim_item.type = fm_bim_type.id {$filter} {$limit}";
+                       $bimItemArray = array();
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $i=1;
+                       while($this->db->next_record())
+                       {
+                               $bimItemArray[$i]['id'] = $this->db->f('id');
+                               $bimItemArray[$i]['guid'] = 
$this->db->f('guid');
+                               $bimItemArray[$i]['type'] = 
$this->db->f('type');
+                               //$bimItemArray[$i]['xml_representation'] = 
$this->db->f('xml_representation',true);
+                               //$bimItemArray[] = $bimItem;
+                               $i++;
+                       }
+
+                       return $bimItemArray;
+               }
+
+               public function get_control_component($noOfObjects = null, 
$bim_type = null)
+               {
+                       $filters = array();
+                       if($noOfObjects != null && is_numeric($noOfObjects))
+                       {
+                               $limit = "LIMIT {$noOfObjects}";
+                       }
+                       else
+                       {
+                               $limit = "LIMIT 10";
+                       }
+
+                       $joins = " {$this->left_join} 
controller_control_component_list ON (c.id = 
controller_control_component_list.control_id)";
+                       $joins .= " {$this->left_join} fm_bim_item ON 
(controller_control_component_list.component_id = fm_bim_item.id)";
+                       $joins .= " {$this->left_join} fm_bim_type ON 
(fm_bim_item.type= fm_bim_type.id)";
+                       //$joins .= " {$this->left_join} fm_responsibility_role 
ON (c.responsibility_id = fm_responsibility_role.id)";
+                       $sql  = "SELECT c.id AS control_id, c.title AS 
control_title, fm_bim_type.name AS type_name, fm_bim_item.id AS bim_id, 
fm_bim_item.guid as bim_item_guid FROM controller_control c {$joins} {$limit}";
+                       $controlArray = array();
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $i=1;
+                       while($this->db->next_record())
+                       {
+                               $controlArray[$i]['id'] = 
$this->db->f('control_id');
+                               $controlArray[$i]['title'] = 
$this->db->f('control_title');
+                               $controlArray[$i]['bim_id'] = 
$this->db->f('bim_id');
+                               $controlArray[$i]['bim_item_guid'] = 
$this->db->f('bim_item_guid');
+                               $controlArray[$i]['bim_type'] = 
$this->db->f('type_name');
+                               $i++;
+                       }
+
+                       return $controlArray;
+               }
+
+               public function getBimItemAttributeValue($bimItemGuid, 
$attribute) 
+               {
+                       $columnAlias = "attribute_values";
+                       $sql = "select 
array_to_string(xpath('descendant-or-self::*[{$attribute}]/{$attribute}/text()',
 (select xml_representation from fm_bim_item where guid='{$bimItemGuid}')), 
',') as $columnAlias";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       if($this->db->num_rows() > 0)
+                       {
+                               $this->db->next_record();
+                               $result = $this->db->f($columnAlias,true);
+                               return preg_split('/,/', $result);
+                       }
+               }
+       }


Property changes on: 
branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php     
2011-12-13 09:52:14 UTC (rev 8282)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php     
2011-12-13 10:00:58 UTC (rev 8283)
@@ -1,210 +1,240 @@
-<?php
-phpgw::import_class('controller.socommon');
-
-include_class('controller', 'control_area', 'inc/model/');
-
-class controller_socontrol_area extends controller_socommon
-{
-       protected static $so;
-
-       /**
-        * Get a static reference to the storage object associated with this 
model object
-        *
-        * @return controller_soparty the storage object
-        */
-       public static function get_instance()
-       {
-               if (self::$so == null) {
-                       self::$so = CreateObject('controller.socontrol_area');
-               }
-               return self::$so;
-       }
-
-       /**
-        * Function for adding a new activity to the database. Updates the 
activity object.
-        *
-        * @param activitycalendar_activity $activity the party to be added
-        * @return bool true if successful, false otherwise
-        */
-       function add(&$control_area)
-       {
-               
-               $control_area = $control_area->get_control_area();
-               
-               $sql = "INSERT INTO controller_control_area (type_name) VALUES 
('$title')";
-               $result = $this->db->query($sql, __LINE__,__FILE__);
-
-               if(isset($result)) {
-                       // Set the new party ID
-                       
$control_area->set_id($this->db->get_last_insert_id('controller_control_area', 
'id'));
-                       // Forward this request to the update method
-                       return $this->update($control_area);
-               }
-               else
-               {
-                       return false;
-               }
-               
-       }
-
-       /**
-        * Update the database values for an existing activity object.
-        *
-        * @param $activity the activity to be updated
-        * @return boolean true if successful, false otherwise
-        */
-
-       function update($control_area)
-       {       
-               $id = intval($control_area->get_id());
-                       
-               $values = array(
-                       '$type_name = ' . 
$this->marshal($control_area->get_type_name(), 'string')
-               );
-               
-               //var_dump('UPDATE activity_activity SET ' . join(',', $values) 
. " WHERE id=$id");
-               $result = $this->db->query('UPDATE controller_control_area SET 
' . join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
-               
-               return isset($result);
-       }
-       
-       /**
-        * Get single procedure
-        * 
-        * @param       $id     id of the procedure to return
-        * @return a controller_procedure
-        */
-       function get_single($id)
-       {
-               $id = (int)$id;
-               
-               $sql = "SELECT p.* FROM controller_control_area p WHERE p.id = 
" . $id;
-               $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
-               $this->db->next_record();
-               
-               $control_area = new 
controller_control_area($this->unmarshal($this->db->f('id', true), 'int'));
-               $control_area->set_title($this->unmarshal($this->db->f('title', 
true), 'string'));
-               
-               return $control_area;
-       }
-       
-       /**
-        * Get a list of procedure objects matching the specific filters
-        * 
-        * @param $start search result offset
-        * @param $results number of results to return
-        * @param $sort field to sort by
-        * @param $query LIKE-based query string
-        * @param $filters array of custom filters
-        * @return list of rental_composite objects
-        */
-       function get_control_area_array($start = 0, $results = 1000, $sort = 
null, $dir = '', $query = null, $search_option = null, $filters = array())
-       {
-               $results = array();
-               
-               //$condition = $this->get_conditions($query, 
$filters,$search_option);
-               $order = $sort ? "ORDER BY $sort $dir ": '';
-               
-               //$sql = "SELECT * FROM controller_procedure WHERE $condition 
$order";
-               $sql = "SELECT * FROM controller_control_area $order";
-               $this->db->limit_query($sql, $start, __LINE__, __FILE__, 
$limit);
-               
-               while ($this->db->next_record()) {
-                       $control_area = new 
controller_control_area($this->unmarshal($this->db->f('id', true), 'int'));
-                       
$control_area->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
-                       
-                       $results[] = $control_area;
-               }
-               
-               return $results;
-       }
-
-       function get_control_areas_as_array($start = 0, $results = 1000, $sort 
= null, $dir = '', $query = null, $search_option = null, $filters = array())
-       {
-               $results = array();
-               
-               //$condition = $this->get_conditions($query, 
$filters,$search_option);
-               $order = $sort ? "ORDER BY $sort $dir ": '';
-               
-               //$sql = "SELECT * FROM controller_procedure WHERE $condition 
$order";
-               $sql = "SELECT * FROM controller_control_area $order";
-               $this->db->limit_query($sql, $start, __LINE__, __FILE__, 
$limit);
-               
-               while ($this->db->next_record()) {
-                       $control_area = new 
controller_control_area($this->unmarshal($this->db->f('id', true), 'int'));
-                       
$control_area->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
-                       
-                       $results[] = $control_area->toArray();
-               }
-               
-               return $results;
-       }
-       
-       function get_control_area_select_array()
-       {
-            $results = array();
-                       $results[] = array('id' =>  0,'name' => lang('Not 
selected'));
-                       $this->db->query("SELECT id, title as name FROM 
controller_control_area ORDER BY name ASC", __LINE__, __FILE__);
-                       while ($this->db->next_record())
-                       {
-                               $results[] = array('id' => $this->db->f('id', 
false),
-                                                          'name' => 
$this->db->f('name', false));
-                       }
-                       return $results;
-       }       
-       
-       function get_id_field_name($extended_info = false)
-       {
-               /*
-               if(!$extended_info)
-               {
-                       $ret = 'id';
-               }
-               else
-               {
-                       $ret = array
-                       (
-                               'table'                 => 'activity', // alias
-                               'field'                 => 'id',
-                               'translated'    => 'id'
-                       );
-               }
-               */
-               return $ret;
-       }
-
-       protected function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean $return_count)
-       {
-               
-               
-       }
-       
-       function populate(int $control_area_id, &$control_area)
-       {
-               /*
-               if($control_area == null) {
-                       $control_area = new activitycalendar_activity((int) 
$activity_id);
-
-                       
$control_area->set_title($this->unmarshal($this->db->f('title'), 'string'));
-                       
$control_area->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
-                       
$control_area->set_type_id($this->unmarshal($this->db->f('type_id'), 'int'));
-                       
$control_area->set_district($this->unmarshal($this->db->f('district'), 'int'));
-                       
$control_area->set_office($this->unmarshal($this->db->f('office'), 'int'));
-                       
$control_area->set_category($this->unmarshal($this->db->f('category'), 'int'));
-                       
$control_area->set_state($this->unmarshal($this->db->f('state'), 'int'));
-                       
$control_area->set_target($this->unmarshal($this->db->f('target'), 'string'));
-                       
$control_area->set_description($this->unmarshal($this->db->f('description'), 
'string'));
-                       
$control_area->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
-                       
$control_area->set_internal_arena($this->unmarshal($this->db->f('internal_arena'),
 'string'));
-                       
$control_area->set_time($this->unmarshal($this->db->f('time'), 'string'));
-                       
$control_area->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
 'int'));
-                       
$control_area->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
 'bool')));
-                       
$control_area->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
-                       
-                       
-               }
-               */
-               return $control_area;
-       }
-       
-}
+<?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$
+       */
+
+       phpgw::import_class('controller.socommon');
+
+       include_class('controller', 'control_area', 'inc/model/');
+
+       class controller_socontrol_area extends controller_socommon
+       {
+               protected static $so;
+
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                *
+                * @return controller_soparty the storage object
+                */
+               public static function get_instance()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('controller.socontrol_area');
+                       }
+                       return self::$so;
+               }
+
+               /**
+                * Function for adding a new activity to the database. Updates 
the activity object.
+                *
+                * @param activitycalendar_activity $activity the party to be 
added
+                * @return bool true if successful, false otherwise
+                */
+               function add(&$control_area)
+               {
+
+                       $control_area = $control_area->get_control_area();
+
+                       $sql = "INSERT INTO controller_control_area (type_name) 
VALUES ('$title')";
+                       $result = $this->db->query($sql, __LINE__,__FILE__);
+
+                       if(isset($result)) {
+                               // Set the new party ID
+                               
$control_area->set_id($this->db->get_last_insert_id('controller_control_area', 
'id'));
+                               // Forward this request to the update method
+                               return $this->update($control_area);
+                       }
+                       else
+                       {
+                               return false;
+                       }
+
+               }
+
+               /**
+                * Update the database values for an existing activity object.
+                *
+                * @param $activity the activity to be updated
+                * @return boolean true if successful, false otherwise
+                */
+
+               function update($control_area)
+               {
+                       $id = intval($control_area->get_id());
+
+                       $values = array(
+                               '$type_name = ' . 
$this->marshal($control_area->get_type_name(), 'string')
+                       );
+
+                       //var_dump('UPDATE activity_activity SET ' . join(',', 
$values) . " WHERE id=$id");
+                       $result = $this->db->query('UPDATE 
controller_control_area SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
+
+                       return isset($result);
+               }
+
+               /**
+                * Get single procedure
+                * 
+                * @param       $id     id of the procedure to return
+                * @return a controller_procedure
+                */
+               function get_single($id)
+               {
+                       $id = (int)$id;
+
+                       $sql = "SELECT p.* FROM controller_control_area p WHERE 
p.id = " . $id;
+                       $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+                       $this->db->next_record();
+
+                       $control_area = new 
controller_control_area($this->unmarshal($this->db->f('id', true), 'int'));
+                       
$control_area->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
+
+                       return $control_area;
+               }
+
+               /**
+                * Get a list of procedure objects matching the specific filters
+                * 
+                * @param $start search result offset
+                * @param $results number of results to return
+                * @param $sort field to sort by
+                * @param $query LIKE-based query string
+                * @param $filters array of custom filters
+                * @return list of rental_composite objects
+                */
+               function get_control_area_array($start = 0, $results = 1000, 
$sort = null, $dir = '', $query = null, $search_option = null, $filters = 
array())
+               {
+                       $results = array();
+
+                       //$condition = $this->get_conditions($query, 
$filters,$search_option);
+                       $order = $sort ? "ORDER BY $sort $dir ": '';
+
+                       //$sql = "SELECT * FROM controller_procedure WHERE 
$condition $order";
+                       $sql = "SELECT * FROM controller_control_area $order";
+                       $this->db->limit_query($sql, $start, __LINE__, 
__FILE__, $limit);
+
+                       while ($this->db->next_record()) {
+                               $control_area = new 
controller_control_area($this->unmarshal($this->db->f('id', true), 'int'));
+                               
$control_area->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
+
+                               $results[] = $control_area;
+                       }
+
+                       return $results;
+               }
+
+               function get_control_areas_as_array($start = 0, $results = 
1000, $sort = null, $dir = '', $query = null, $search_option = null, $filters = 
array())
+               {
+                       $results = array();
+
+                       //$condition = $this->get_conditions($query, 
$filters,$search_option);
+                       $order = $sort ? "ORDER BY $sort $dir ": '';
+
+                       //$sql = "SELECT * FROM controller_procedure WHERE 
$condition $order";
+                       $sql = "SELECT * FROM controller_control_area $order";
+                       $this->db->limit_query($sql, $start, __LINE__, 
__FILE__, $limit);
+
+                       while ($this->db->next_record()) {
+                               $control_area = new 
controller_control_area($this->unmarshal($this->db->f('id', true), 'int'));
+                               
$control_area->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
+
+                               $results[] = $control_area->toArray();
+                       }
+
+                       return $results;
+               }
+
+               function get_control_area_select_array()
+               {
+                               $results = array();
+                               $results[] = array('id' =>  0,'name' => 
lang('Not selected'));
+                               $this->db->query("SELECT id, title as name FROM 
controller_control_area ORDER BY name ASC", __LINE__, __FILE__);
+                               while ($this->db->next_record())
+                               {
+                                       $results[] = array('id' => 
$this->db->f('id', false),
+                                                                          
'name' => $this->db->f('name', false));
+                               }
+                               return $results;
+               }
+
+               function get_id_field_name($extended_info = false)
+               {
+                       /*
+                       if(!$extended_info)
+                       {
+                               $ret = 'id';
+                       }
+                       else
+                       {
+                               $ret = array
+                               (
+                                       'table'                 => 'activity', 
// alias
+                                       'field'                 => 'id',
+                                       'translated'    => 'id'
+                               );
+                       }
+                       */
+                       return $ret;
+               }
+
+               protected function get_query(string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count)
+               {
+
+
+               }
+
+               function populate(int $control_area_id, &$control_area)
+               {
+                       /*
+                       if($control_area == null) {
+                               $control_area = new 
activitycalendar_activity((int) $activity_id);
+
+                               
$control_area->set_title($this->unmarshal($this->db->f('title'), 'string'));
+                               
$control_area->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$control_area->set_type_id($this->unmarshal($this->db->f('type_id'), 'int'));
+                               
$control_area->set_district($this->unmarshal($this->db->f('district'), 'int'));
+                               
$control_area->set_office($this->unmarshal($this->db->f('office'), 'int'));
+                               
$control_area->set_category($this->unmarshal($this->db->f('category'), 'int'));
+                               
$control_area->set_state($this->unmarshal($this->db->f('state'), 'int'));
+                               
$control_area->set_target($this->unmarshal($this->db->f('target'), 'string'));
+                               
$control_area->set_description($this->unmarshal($this->db->f('description'), 
'string'));
+                               
$control_area->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
+                               
$control_area->set_internal_arena($this->unmarshal($this->db->f('internal_arena'),
 'string'));
+                               
$control_area->set_time($this->unmarshal($this->db->f('time'), 'string'));
+                               
$control_area->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
 'int'));
+                               
$control_area->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
 'bool')));
+                               
$control_area->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
+
+
+                       }
+                       */
+                       return $control_area;
+               }
+
+       }


Property changes on: 
branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php    
2011-12-13 09:52:14 UTC (rev 8282)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php    
2011-12-13 10:00:58 UTC (rev 8283)
@@ -1,315 +1,345 @@
-<?php
-phpgw::import_class('controller.socommon');
-
-include_class('controller', 'control_group', 'inc/model/');
-
-class controller_socontrol_group extends controller_socommon
-{
-       protected static $so;
-
-       /**
-        * Get a static reference to the storage object associated with this 
model object
-        *
-        * @return controller_socontrol_group the storage object
-        */
-       public static function get_instance()
-       {
-               if (self::$so == null) {
-                       self::$so = CreateObject('controller.socontrol_group');
-               }
-               return self::$so;
-       }
-
-       /**
-        * Function for adding a new control group to the database.
-        *
-        * @param controller_control_group $control_group the control group to 
be added
-        * @return int id of the new control group object
-        */
-       function add(&$control_group)
-       {
-               $cols = array(
-                               'group_name',
-                               'procedure_id',
-                               'control_area_id',
-                               'building_part_id'
-               );
-                       
-               $values = array(
-                       $this->marshal($control_group->get_group_name(), 
'string'),
-                       $this->marshal($control_group->get_procedure_id(), 
'int'),
-                       $this->marshal($control_group->get_control_area_id(), 
'int'),
-                       $this->marshal($control_group->get_building_part_id(), 
'int'),
-               );
-               
-               $result = $this->db->query('INSERT INTO 
controller_control_group (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
-               
-               if(isset($result)) {
-                       // Get the new control group ID and return it
-                       return 
$this->db->get_last_insert_id('controller_control_group', 'id');
-               }
-               else
-               {
-                       return 0;
-               }
-                       
-       }
-
-       /**
-        * Update the database values for an existing activity object.
-        *
-        * @param $activity the activity to be updated
-        * @return boolean true if successful, false otherwise
-        */
-
-       function update($control_group)
-       {       
-               $id = intval($control_group->get_id());
-                       
-               $values = array(
-                       'group_name = ' . 
$this->marshal($control_group->get_group_name(), 'string'),
-                       'procedure_id = '. 
$this->marshal($control_group->get_procedure_id(), 'int'),
-                       'control_area_id = ' . 
$this->marshal($control_group->get_control_area_id(), 'int'),
-                       'building_part_id = ' . 
$this->marshal($control_group->get_building_part_id(), 'int')
-               );
-               
-               //var_dump('UPDATE activity_activity SET ' . join(',', $values) 
. " WHERE id=$id");
-               $result = $this->db->query('UPDATE controller_control_group SET 
' . join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
-               
-               return isset($result);
-       }
-       
-       /**
-        * Get single procedure
-        * 
-        * @param       $id     id of the procedure to return
-        * @return a controller_procedure
-        */
-       function get_single($id)
-       {
-               $id = (int)$id;
-               
-               $joins = "      {$this->left_join} fm_building_part ON 
(p.building_part_id = CAST(fm_building_part.id AS INT))";
-               $joins .= "     {$this->left_join} controller_procedure ON 
(p.procedure_id = controller_procedure.id)";
-               $joins .= "     {$this->left_join} controller_control_area ON 
(p.control_area_id = controller_control_area.id)";
-               
-               $sql = "SELECT p.*, fm_building_part.descr AS 
building_part_descr, controller_procedure.title as procedure_title, 
controller_control_area.title as control_area_name FROM 
controller_control_group p {$joins} WHERE p.id = " . $id;
-               $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
-               $this->db->next_record();
-               
-               $control_group = new 
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
-               
$control_group->set_group_name($this->unmarshal($this->db->f('group_name', 
true), 'string'));
-               
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
-               
$control_group->set_procedure_name($this->unmarshal($this->db->f('procedure_title'),
 'string'));
-               
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
 'int'));
-               
$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
 'string'));
-               
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
 'int'));
-               
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
 'string'));
-               
-               return $control_group;
-       }
-       
-       /**
-        * Get a list of procedure objects matching the specific filters
-        * 
-        * @param $start search result offset
-        * @param $results number of results to return
-        * @param $sort field to sort by
-        * @param $query LIKE-based query string
-        * @param $filters array of custom filters
-        * @return list of rental_composite objects
-        */
-       function get_control_group_array($start = 0, $results = 1000, $sort = 
null, $dir = '', $query = null, $search_option = null, $filters = array())
-       {
-               $results = array();
-               
-               //$condition = $this->get_conditions($query, 
$filters,$search_option);
-               $order = $sort ? "ORDER BY $sort $dir ": '';
-               
-               //$sql = "SELECT * FROM controller_procedure WHERE $condition 
$order";
-               $sql = "SELECT * FROM controller_control_group $order";
-               $this->db->limit_query($sql, $start, __LINE__, __FILE__, 
$limit);
-               
-               while ($this->db->next_record()) {
-                       $control_group = new 
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
-                       
$control_group->set_group_name($this->unmarshal($this->db->f('group_name', 
true), 'string'));
-                       
-                       $results[] = $control_group;
-               }
-               
-               return $results;
-       }
-       
-       function get_control_group_select_array()
-       {
-            $results = array();
-                       $results[] = array('id' =>  0,'name' => lang('Not 
selected'));
-                       $this->db->query("SELECT id, group_name as name FROM 
controller_control_group ORDER BY name ASC", __LINE__, __FILE__);
-                       while ($this->db->next_record())
-                       {
-                               $results[] = array('id' => $this->db->f('id', 
false),
-                                                          'name' => 
$this->db->f('name', false));
-                       }
-                       return $results;
-       }
-       
-       function get_building_part_select_array($selected_building_part_id)
-       {
-            $results = array();
-                       $results[] = array('id' =>  0,'name' => lang('Not 
selected'));
-                       $this->db->query("SELECT id, descr as name FROM 
fm_building_part ORDER BY id ASC", __LINE__, __FILE__);
-                       while ($this->db->next_record())
-                       {
-                               $curr_id = $this->db->f('id', false);
-                               if($selected_building_part_id && 
$selected_building_part_id > 0 && $selected_building_part_id == $curr_id)
-                               {
-                                       $results[] = array('id' => 
$this->db->f('id', false),
-                                                                  'name' => 
$this->db->f('name', false),
-                                                                          
'selected' => 'yes');
-                               }
-                               else
-                               {
-                                       $results[] = array('id' => 
$this->db->f('id', false),
-                                                                  'name' => 
$this->db->f('name', false));
-                               }
-                       }
-                       return $results;
-       }
-       
-       function get_control_groups_as_objects($control_area_id, $limit)
-       {
-               $results = array();
-               
-               $sql = "SELECT * FROM controller_control_group WHERE 
control_area_id=$control_area_id";
-               $this->db->limit_query($sql, $start, __LINE__, __FILE__, 
$limit);
-               
-               while ($this->db->next_record()) {
-                       $control_group = new 
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
-                       
$control_group->set_group_name($this->unmarshal($this->db->f('group_name', 
true), 'string'));
-                       
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id', 
true), 'string'));
-                       
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
 true), 'string'));
-                       
-                       $results[] = $control_group;
-               }
-               
-               return $results;
-       }
-       
-       function get_control_groups_as_array($control_area_id)
-       {
-               $results = array();
-               
-               $sql = "SELECT * FROM controller_control_group WHERE 
control_area_id=$control_area_id";
-               $this->db->query($sql);
-               
-               while ($this->db->next_record()) {
-                       $control_group = new 
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
-                       
$control_group->set_group_name($this->unmarshal($this->db->f('group_name', 
true), 'string'));
-                       
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id', 
true), 'string'));
-                       
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
 true), 'string'));
-                       
-                       $results[] = $control_group->toArray();
-               }
-               
-               return $results;
-       }
-       
-       function get_id_field_name($extended_info = false)
-       {
-               
-               if(!$extended_info)
-               {
-                       $ret = 'id';
-               }
-               else
-               {
-                       $ret = array
-                       (
-                               'table'                 => 
'controller_control_group', // alias
-                               'field'                 => 'id',
-                               'translated'    => 'id'
-                       );
-               }
-               
-               return $ret;
-       }
-
-       protected function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean $return_count)
-       {
-               $clauses = array('1=1');
-               if($search_for)
-               {
-                       $like_pattern = "'%" . 
$this->db->db_addslashes($search_for) . "%'";
-                       $like_clauses = array();
-                       switch($search_type){
-                               default:
-                                       $like_clauses[] = 
"controller_control_group.group_name $this->like $like_pattern";
-                                       break;
-                       }
-                       if(count($like_clauses))
-                       {
-                               $clauses[] = '(' . join(' OR ', $like_clauses) 
. ')';
-                       }
-               }
-
-               $filter_clauses = array();
-                       
-               if(isset($filters[$this->get_id_field_name()]))
-               {
-                       $filter_clauses[] = "controller_control_group.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
-               }
-               if(isset($filters['control_areas']))
-               {
-                       $filter_clauses[] = 
"controller_control_group.control_area_id = 
{$this->marshal($filters['control_areas'],'int')}";
-               }
-
-               if(count($filter_clauses))
-               {
-                       $clauses[] = join(' AND ', $filter_clauses);
-               }
-
-               $condition =  join(' AND ', $clauses);
-
-               $tables = "controller_control_group";
-               $joins = "      {$this->left_join} fm_building_part ON 
(building_part_id = CAST(fm_building_part.id AS INT))";
-               $joins .= "     {$this->left_join} controller_procedure ON 
(controller_control_group.procedure_id = controller_procedure.id)";
-               $joins .= "     {$this->left_join} controller_control_area ON 
(controller_control_group.control_area_id = controller_control_area.id)";
-               //$joins .= "   {$this->left_join} rental_contract_composite ON 
(rental_contract_composite.composite_id = rental_composite.id)";
-               //$joins .= "   {$this->left_join} rental_contract ON 
(rental_contract.id = rental_contract_composite.contract_id)";
-               
-               if($return_count) // We should only return a count
-               {
-                       $cols = 'COUNT(DISTINCT(controller_control_group.id)) 
AS count';
-               }
-               else
-               {

@@ Diff output truncated at 153600 characters. @@



reply via email to

[Prev in Thread] Current Thread [Next in Thread]