[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10940] Merge 10797:10939 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10940] Merge 10797:10939 from trunk |
Date: |
Thu, 28 Feb 2013 16:54:00 +0000 |
Revision: 10940
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10940
Author: sigurdne
Date: 2013-02-28 16:53:55 +0000 (Thu, 28 Feb 2013)
Log Message:
-----------
Merge 10797:10939 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/controller/inc/class.socase.inc.php
branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
branches/Version-1_0-branch/controller/inc/class.socommon.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.socontrol_item_option.inc.php
branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
branches/Version-1_0-branch/controller/inc/class.uicase.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_component.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
branches/Version-1_0-branch/controller/inc/component/class.check_list_status_manager.inc.php
branches/Version-1_0-branch/controller/inc/component/class.status_agg_month_info.inc.php
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
branches/Version-1_0-branch/controller/inc/hook_settings.inc.php
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php
branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_item_option.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_location.inc.php
branches/Version-1_0-branch/controller/js/controller/ajax.js
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/calendar/check_list_status_manager.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/select_buildings_on_property.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/select_my_locations.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_info.xsl
branches/Version-1_0-branch/controller/templates/base/control_item/choose_control_items.xsl
branches/Version-1_0-branch/controller/templates/base/css/base.css
branches/Version-1_0-branch/home.php
branches/Version-1_0-branch/login.php
branches/Version-1_0-branch/phpgwapi/inc/class.sessions.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php
branches/Version-1_0-branch/phpgwapi/inc/functions.inc.php
branches/Version-1_0-branch/phpgwapi/inc/sso/include_login.inc.php
branches/Version-1_0-branch/phpgwapi/templates/base/login.tpl
branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
branches/Version-1_0-branch/property/inc/class.soproject.inc.php
branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service
branches/Version-1_0-branch/property/js/yahoo/project.edit.js
branches/Version-1_0-branch/property/js/yahoo/property2.js
branches/Version-1_0-branch/property/js/yahoo/workorder.edit.js
branches/Version-1_0-branch/property/templates/base/project.xsl
branches/Version-1_0-branch/rental/inc/class.uiproperty_location.inc.php
Added Paths:
-----------
branches/Version-1_0-branch/controller/images/green_ring.png
branches/Version-1_0-branch/controller/images/green_ring.psd
branches/Version-1_0-branch/controller/images/red_ring.png
branches/Version-1_0-branch/controller/images/red_ring.psd
branches/Version-1_0-branch/controller/inc/class.hook_helper.inc.php
branches/Version-1_0-branch/controller/js/controller/case.js
branches/Version-1_0-branch/controller/js/controller/check_list.js
branches/Version-1_0-branch/controller/templates/base/case/add_case.xsl
branches/Version-1_0-branch/controller/templates/base/case/case_row.xsl
branches/Version-1_0-branch/controller/templates/base/case/cases_tab_menu.xsl
branches/Version-1_0-branch/controller/templates/base/case/view_closed_cases.xsl
branches/Version-1_0-branch/controller/templates/base/case/view_open_cases.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/
branches/Version-1_0-branch/controller/templates/mobilefrontend/
branches/Version-1_0-branch/mobilefrontend/
branches/Version-1_0-branch/phpgwapi/inc/class.login.inc.php
branches/Version-1_0-branch/phpgwapi/templates/mobilefrontend/
Removed Paths:
-------------
branches/Version-1_0-branch/controller/inc/hook_home.inc.php
branches/Version-1_0-branch/controller/templates/base/check_list/add_case.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/case_row.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/cases_tab_menu.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/check_list_tab_menu.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/nav_control_plan.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/view_cases_for_check_list.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/view_check_list.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/view_check_lists.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/view_closed_cases.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
Property Changed:
----------------
branches/Version-1_0-branch/
branches/Version-1_0-branch/controller/inc/class.socase.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php
branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_group_component.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
branches/Version-1_0-branch/controller/inc/component/class.check_list_status_manager.inc.php
branches/Version-1_0-branch/controller/inc/component/class.month_calendar.inc.php
branches/Version-1_0-branch/controller/inc/component/class.status_agg_month_info.inc.php
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
branches/Version-1_0-branch/controller/inc/component/class.year_calendar_agg.inc.php
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
branches/Version-1_0-branch/controller/inc/helper/class.date_converter.inc.php
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
branches/Version-1_0-branch/controller/inc/hook_settings.inc.php
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php
branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_item_option.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_location.inc.php
branches/Version-1_0-branch/phpgwapi/templates/activitycalendar/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/activitycalendar/navbar.inc.php
branches/Version-1_0-branch/phpgwapi/templates/bkbooking/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/bkbooking/navbar.inc.php
branches/Version-1_0-branch/phpgwapi/templates/desktop/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/desktop/navbar.inc.php
branches/Version-1_0-branch/phpgwapi/templates/idots/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/idots/navbar.inc.php
branches/Version-1_0-branch/phpgwapi/templates/idsociety/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/idsociety/navbar.inc.php
branches/Version-1_0-branch/phpgwapi/templates/linux-at-work.de/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/linux-at-work.de/navbar.inc.php
branches/Version-1_0-branch/phpgwapi/templates/portico/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/portico/navbar.inc.php
branches/Version-1_0-branch/phpgwapi/templates/probusiness/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/probusiness/navbar.inc.php
branches/Version-1_0-branch/phpgwapi/templates/simple/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/simple/navbar.inc.php
branches/Version-1_0-branch/phpgwapi/templates/verdilak/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/verdilak/navbar.inc.php
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,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796
+
/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,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939
Copied: branches/Version-1_0-branch/controller/images/green_ring.png (from rev
10939, trunk/controller/images/green_ring.png)
===================================================================
(Binary files differ)
Copied: branches/Version-1_0-branch/controller/images/green_ring.psd (from rev
10939, trunk/controller/images/green_ring.psd)
===================================================================
(Binary files differ)
Copied: branches/Version-1_0-branch/controller/images/red_ring.png (from rev
10939, trunk/controller/images/red_ring.png)
===================================================================
(Binary files differ)
Copied: branches/Version-1_0-branch/controller/images/red_ring.psd (from rev
10939, trunk/controller/images/red_ring.psd)
===================================================================
(Binary files differ)
Copied: branches/Version-1_0-branch/controller/inc/class.hook_helper.inc.php
(from rev 10939, trunk/controller/inc/class.hook_helper.inc.php)
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.hook_helper.inc.php
(rev 0)
+++ branches/Version-1_0-branch/controller/inc/class.hook_helper.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -0,0 +1,738 @@
+<?php
+ /**
+ * controller - Hook helper
+ *
+ * @author Erik Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2013 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @package controller
+ * @version $Id$
+ */
+
+ /*
+ This program 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.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ include_class('controller', 'check_list', 'inc/model/');
+ include_class('controller', 'check_item', 'inc/model/');
+ include_class('controller', 'check_list_status_info', 'inc/component/');
+ include_class('controller', 'date_generator', 'inc/component/');
+ include_class('controller', 'location_finder', 'inc/helper/');
+
+ /**
+ * Hook helper
+ *
+ * @package controller
+ */
+ class controller_hook_helper
+ {
+ /**
+ * Show info for homepage - called from backend
+ *
+ * @return void
+ */
+ public function home_backend()
+ {
+ $this->home();
+ }
+ /**
+ * Show info for homepage - called from mobilefrontend
+ *
+ * @return void
+ */
+ public function home_mobilefrontend()
+ {
+ $this->home('mobilefrontend');
+ }
+ /**
+ * Show info for homepage
+ *
+ * @return void
+ */
+ public function home($url_correction = '')
+ {
+ $location_array = array();
+ $component_short_desc = array();
+
+ $so_check_list =
CreateObject('controller.socheck_list');
+ $so_control = CreateObject('controller.socontrol');
+
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+ $limit_no_of_planned =
isset($GLOBALS['phpgw_info']['user']['preferences']['controller']['no_of_planned_controls'])?
$GLOBALS['phpgw_info']['user']['preferences']['controller']['no_of_planned_controls']
: (isset($config->config_data['no_of_planned_controls']) &&
$config->config_data['no_of_planned_controls'] > 0 ?
$config->config_data['no_of_planned_controls']:5);
+ $limit_no_of_assigned =
isset($GLOBALS['phpgw_info']['user']['preferences']['controller']['no_of_assigned_controls'])?
$GLOBALS['phpgw_info']['user']['preferences']['controller']['no_of_assigned_controls']
: (isset($config->config_data['no_of_assigned_controls']) &&
$config->config_data['no_of_assigned_controls'] > 0 ?
$config->config_data['no_of_assigned_controls']:10);
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ $styling = "\n".'<!-- BEGIN checklist info -->'."\n ";
+ $styling .= "<style>";
+ $styling .= " .home-box { background: none repeat
scroll 0 0 #EDF5FF; border-color: #DBE5EF; border-radius: 4px; margin: 5px 20px
20px;}";
+ $styling .= " .home-box .home_portal { margin:
0;border: 1px solid #EBF3FC;}";
+ $styling .= " .home_portal { margin:20px 20px 0 10px;
}";
+ $styling .= " .home_portal a {
color:#0066CC;text-decoration: none;text-transform: uppercase;
clear:both;display:block;}";
+ $styling .= " .home_portal h2 {
overflow:hidden;clear:left;font-size: 13px;font-weight:
bold;text-transform:uppercase; background: #D0DEF4; margin: 0; padding: 2px
10px; color: #1C3C6F;}";
+ $styling .= " .home_portal h2 div{
display:block;float:left;cursor: pointer;vertical-align: middle;}";
+ $styling .= " .home_portal .title {
width:300px;margin:0 20px 0 0;}";
+ $styling .= " .home_portal .control-area {
width:200px;}";
+ $styling .= " .home_portal .control { width:300px;}";
+ $styling .= " .home_portal .date { margin-left:
20px;width:130px;}";
+ $styling .= " .home_portal li { overflow:
hidden;margin: 10px;}";
+ $styling .= " .home_portal li div { display:
block;float:left;cursor: pointer;vertical-align: middle;}";
+
+ $styling .= " .home_portal_content ul li { clear: both;
overflow: hidden;}";
+ $styling .= " .home_portal_content { padding:5px
10px;}";
+ $styling .= " .property_tickets .home_portal_title h2 {
font-size: 20px; padding: 5px 10px;}";
+
+ $styling .= " h2.heading { font-size: 22px;
font-weight: normal;margin: 0 0 0 20px;}";
+
+ $styling .= " h4.expand_trigger {
clear:both;overflow:hidden;font-size: 12px;color:#031647;background:
#DEEAF8;padding:2px 4px;margin:0; }";
+ $styling .= " h4.expand_trigger img {
float:left;vertical-align:middle;margin-right:3px; }";
+ $styling .= " h4.expand_trigger span {
float:left;display:block;vertical-align:middle; }";
+ $styling .= " h4.expand_trigger span.deadline {
margin-right: 10px; }";
+ $styling .= " h4.expand_trigger span.num_check_lists {
width:200px; }";
+
+ $styling .= " .expand_list{ display:none;
overflow:hidden; }";
+ $styling .= " .expand_list li{
clear:both;overflow:hidden;margin:5px 0; }";
+
+ $styling .= "</style>";
+ $styling .= "\n".'<!-- END checklist info -->'."\n";
+ echo $styling;
+
+ //Loaded from home.php
+ //echo "<script
src='phpgwapi/js/jquery/js/jquery-1.7.2.min.js'></script>";
+
+ $script = "<script>";
+ $script .= "$(document).ready(function(){";
+ $script .= " $('.expand_trigger').live('click',
function() {";
+ $script .= " var liTag = $(this).closest('li'); ";
+ $script .= " var expandList =
$(liTag).find('.expand_list'); ";
+ $script .= " if( !$(expandList).hasClass('active') ){
$(expandList).show(); $(expandList).addClass('active'); ";
+ $script .= " $(liTag).find('img').attr('src',
'controller/images/arrow_down.png');} ";
+ $script .= " else{ $(expandList).hide();
$(expandList).removeClass('active'); ";
+ $script .= " $(liTag).find('img').attr('src',
'controller/images/arrow_right.png');} ";
+ $script .= " return false; ";
+ $script .= " })";
+ $script .= " })";
+ $script .= "</script>";
+ echo $script;
+
+ // Fetches my properties
+ $criteria = array
+ (
+ 'user_id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
+ 'type_id' => 1, // Nivå i bygningsregisteret
1:eiendom
+ 'role_id' => 0, // For å begrense til en
bestemt rolle - ellers listes alle roller for brukeren
+ 'allrows' => false
+ );
+
+ $location_finder = new location_finder();
+ $my_properties =
$location_finder->get_responsibilities( $criteria );
+
+ // Fetches my buildings
+ $criteria = array
+ (
+ 'user_id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
+ 'type_id' => 2, // Nivå i bygningsregisteret
1:eiendom
+ 'role_id' => 0, // For å begrense til en
bestemt rolle - ellers listes alle roller for brukeren
+ 'allrows' => false
+ );
+
+ $location_finder = new location_finder();
+ $my_buildings = $location_finder->get_responsibilities(
$criteria );
+
+ $my_locations = array_merge($my_properties,
$my_buildings);
+
+
+ /* ======================================= PLANNED CONTROLS
FOR CURRENT USER ================================= */
+
+ $my_planned_controls_HTML = "<div
class='home_portal'><h2><div class='date heading'>Planlagt dato</div><div
class='date heading'>Fristdato</div><div class='control heading'>Tittel på
kontroll</div><div class='title heading'>Lokasjonsnavn</div><div
class='control-area heading'>Kontrollområde</div></h2>";
+
+ // Todays date
+ $from_date_ts = mktime(0, 0, 0, date("n"), date("j"),
date("Y") );
+ // One month ahead in time
+ $to_date_ts = mktime(0, 0, 0, date("n")+1, date("j"),
date("Y") );
+
+ // fetch all repeat types
+ $repeat_type = null;
+
+ // Fetches controls current user is responsible for 1 month
ahead
+ $my_controls = array();
+ $my_controls = $this->get_my_controls($my_locations,
$from_date_ts, $to_date_ts, $repeat_type);
+
+ $my_planned_controls = array();
+
+ // Generates an array with planned controls
+ foreach($my_controls as $container_arr)
+ {
+ $location_code = $container_arr[0];
+ $control_type = $container_arr[1];
+ $controls = $container_arr[2];
+
+ foreach($controls as $my_control)
+ {
+ if($my_control["repeat_type"] ==
controller_control::REPEAT_TYPE_DAY)
+ {
+ // Daily control: To_date
assigned to one week ahead in time if repeat type is daily
+ $to_date_ts = mktime(0, 0, 0,
date("n"), date("j")+7, date("Y") );
+ }
+ else if(($my_control["repeat_type"] ==
controller_control::REPEAT_TYPE_WEEK)
+ |
($my_control["repeat_type"] == controller_control::REPEAT_TYPE_MONTH)
+ |
($my_control["repeat_type"] == controller_control::REPEAT_TYPE_YEAR))
+ {
+ // Daily, monthly yearly
control: to_date in one month
+ $to_date_ts = mktime(0, 0, 0,
date("n")+1, date("j"), date("Y") );
+ }
+
+ if($control_type == "location")
+ {
+ $check_list_array =
$so_check_list->get_check_lists_for_control_and_location( $my_control['id'],
$location_code, $from_date_ts, $to_date_ts, $repeat_type = null);
+
+ foreach($check_list_array as
$check_list)
+ {
+
$planned_date_for_check_list = $check_list->get_planned_date();
+
+
if($planned_date_for_check_list > 0)
+ {
+
$my_planned_controls[$planned_date_for_check_list][] = array(
$check_list->get_deadline(), $my_control, $check_list->get_id(), "location",
$location_code );
+ }
+ }
+ }
+ else if($control_type == "component")
+ {
+ $component = $container_arr[3];
+ $check_list_array =
$so_check_list->get_check_lists_for_control_and_component( $my_control['id'],
$component['location_id'], $component['id'], $from_date_ts, $to_date_ts,
$repeat_type = null );
+
+ foreach($check_list_array as
$check_list)
+ {
+
$planned_date_for_check_list = $check_list->get_planned_date();
+
+
if($planned_date_for_check_list > 0)
+ {
+
$my_planned_controls[$planned_date_for_check_list][] =
array($check_list->get_deadline(), $my_control, "component",
$component['location_id'], $component['id'] );
+ }
+ }
+ }
+ }
+ }
+
+ $my_planned_controls_HTML .= "<ul
style='overflow:hidden;'>";
+
+ foreach($my_planned_controls as $planned_date_ts =>
$planned_controls_on_date)
+ {
+ foreach($planned_controls_on_date as
$my_planned_control)
+ {
+ $deadline_ts = $my_planned_control[0];
+ $my_control = $my_planned_control[1];
+
+ $control_area_name =
$this->get_control_area_name( $my_control["control_area_id"] );
+
+ $deadline_formatted = date($dateformat,
$deadline_ts);
+ $planned_formatted = date($dateformat,
$planned_date_ts);
+
+ $check_list_id = $my_planned_control[2];
+ $location_code = $my_planned_control[4];
+
+
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
+ {
+ $location_array[$location_code]
= execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ }
+ $location_name =
$location_array[$location_code]["loc1_name"];
+
+ $link = "";
+ // $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
+ $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicase.add_case', 'check_list_id' => $check_list_id));
+ $my_planned_controls_HTML .= "<li><a
href='$link'><div class='date'>{$planned_formatted}</div><div
class='date'>{$deadline_formatted}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$location_name}</div><div
class='control-area'>{$control_area_name}</div></a></li>";
+ }
+ }
+
+ if(count( $planned_controls_on_date ) > 1 )
+ {
+ $my_planned_controls_HTML .= "</li></ul>";
+ }
+
+ echo "\n".'<!-- BEGIN checklist info -->'."\n <h2
class='heading'>Mine planlagte kontroller</h2><div class='home-box'>" .
$my_planned_controls_HTML . "</div></div>\n".'<!-- END checklist info -->'."\n";
+
+ // if($url_correction != 'mobilefrontend')
+ {
+ /* ======================================= UNDONE
ASSIGNED CONTROLS FOR CURRENT USER ================================= */
+
+ // from date is set to 3 months back in time
+ $from_date_ts = mktime(0, 0, 0, date("n")-3,
date("j"), date("Y") );
+ $to_date_ts = mktime(0, 0, 0, date("n"), date("j"),
date("Y") );
+
+ // fetch all repeat types
+ $repeat_type = null;
+
+ // Fetches controls current user is responsible for 3 months
back in time
+ $my_controls = $this->get_my_controls($my_locations,
$from_date_ts, $to_date_ts, $repeat_type);
+
+ $my_undone_controls = array();
+
+ // Generates an array containing undone controls
+ foreach($my_controls as $container_arr)
+ {
+ $location_code = $container_arr[0];
+ $control_type = $container_arr[1];
+ $controls = $container_arr[2];
+
+ foreach($controls as $my_control)
+ {
+ if($my_control["repeat_type"] ==
controller_control::REPEAT_TYPE_DAY)
+ {
+ // DAILY CONTROLS: Fetch undone
controls one week back in time
+ $from_date_ts = mktime(0, 0,
0, date("n"), date("j")-7, date("Y") );
+ }
+ else if($my_control["repeat_type"] ==
controller_control::REPEAT_TYPE_WEEK)
+ {
+ // WEEKLY CONTROLS: Fetch
undone controls one month back in time
+ $from_date_ts = mktime(0, 0,
0, date("n")-1, date("j"), date("Y") );
+ }
+ else if($my_control["repeat_type"] ==
controller_control::REPEAT_TYPE_MONTH)
+ {
+ // MONTHLY CONTROLS: Fetch
undone controls three months back in time
+ $from_date_ts = mktime(0, 0,
0, date("n")-3, date("j"), date("Y") );
+ }
+ else if($my_control["repeat_type"] ==
controller_control::REPEAT_TYPE_YEAR)
+ {
+ // YEARLY CONTROLS: Fetch
undone controls one year back in time
+ $from_date_ts = mktime(0, 0,
0, date("n"), date("j"), date("Y")-1 );
+ }
+
+ $date_generator = new
date_generator($my_control["start_date"], $my_control["end_date"],
$from_date_ts, $to_date_ts, $my_control["repeat_type"],
$my_control["repeat_interval"]);
+ $deadline_dates_for_control =
$date_generator->get_dates();
+
+ $check_list_array = array();
+ foreach($deadline_dates_for_control as
$deadline_ts)
+ {
+ $check_list = null;
+
+ if($control_type == "location")
+ {
+ $check_list =
$so_check_list->get_check_list_for_control_by_date($my_control['id'],
$deadline_ts, null, $location_code, null, null, "location" );
+ }
+ else if($control_type ==
"component")
+ {
+ $component =
$container_arr[3];
+
+ $check_list =
$so_check_list->get_check_list_for_control_by_date($my_control['id'],
$deadline_ts, null, null, $component['location_id'], $component['id'],
"component" );
+ }
+ $control_id = $my_control['id'];
+
+ if($check_list == null &
$control_type == "location")
+ {
+
$my_undone_controls[$deadline_ts][] = array("add", $deadline_ts, $my_control,
"location", $location_code );
+ }
+ else if($check_list == null &
$control_type == "component")
+ {
+ $component =
$container_arr[3];
+
$my_undone_controls[$deadline_ts][]= array("add", $deadline_ts, $my_control,
"component", $component['location_id'], $component['id'] );
+ }
+ else if(
($check_list->get_status() == controller_check_list::STATUS_NOT_DONE) ||
($check_list->get_status() == controller_check_list::STATUS_CANCELED) )
+ {
+
$my_undone_controls[$deadline_ts][] = array("edit", $deadline_ts, $my_control,
$check_list->get_id(), $location_code );
+ }
+ }
+ }
+ }
+
+ $my_undone_controls_HTML = "<div
class='home_portal'><h2><div class='date heading'>Fristdato</div><div
class='control heading'>Tittel på kontroll</div><div class='title
heading'>Lokasjonsnavn</div><div class='control-area
heading'>Kontrollområde</div></h2>";
+
+ // Sorts my_undone_controls by deadline date
+ ksort($my_undone_controls);
+
+ $my_undone_controls_HTML .= "<ul>";
+
+ foreach($my_undone_controls as $date_ts =>
$controls_on_date)
+ {
+ // If number of controls on a date exceeds 1 it
will be put in expand list
+ if(count( $controls_on_date) > 1 )
+ {
+ $my_undone_controls_HTML .=
"<li>";
+ $my_undone_controls_HTML .= "<a
href='#'><h4 class='expand_trigger'><img height='12'
src='controller/images/arrow_right.png' /><span class='deadline'>" .
date($dateformat, $date_ts) . "</span><span class='num_check_lists'>(" .
count($controls_on_date) . " kontroller)</span></h4></a>";
+ $my_undone_controls_HTML .=
"<ul class='expand_list'>";
+ }
+
+ foreach($controls_on_date as
$my_undone_control)
+ {
+ $check_list_status =
$my_undone_control[0];
+ $deadline_ts =
$my_undone_control[1];
+ $my_control =
$my_undone_control[2];
+
+ $control_area_name =
$this->get_control_area_name( $my_control["control_area_id"] );
+
+ $date_str = date($dateformat,
$deadline_ts);
+
+ if($check_list_status == "add")
+ {
+ $check_list_type =
$my_undone_control[3];
+
+ if($check_list_type ==
"location")
+ {
+ $location_code
= $my_undone_control[4];
+
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
+ {
+
$location_array[$location_code] = execMethod('property.bolocation.read_single',
array('location_code' => $location_code));
+ }
+ $location_name
= $location_array[$location_code]["loc1_name"];
+
+ if(count(
$controls_on_date) > 1 )
+ {
+ $link =
"";
+ $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'type' => "location", 'control_id' =>
$my_control['id'], 'location_code' => $location_code, 'deadline_ts' =>
$deadline_ts));
+
+
$my_undone_controls_HTML .= "<li><a href='{$link}'><div
class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$location_name}</div><div
class='control-area'>{$control_area_name}</div></a></li>";
+ }
+ else
+ {
+ $link =
"";
+ $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'type' => "location", 'control_id' =>
$my_control['id'], 'location_code' => $location_code, 'deadline_ts' =>
$deadline_ts));
+
+
$my_undone_controls_HTML .= "<a href='{$link}'><div
class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$location_name}</div><div
class='control-area'>{$control_area_name}</div></a>";
+ }
+
+ }
+ else
if($check_list_type == "component")
+ {
+ $location_id =
$my_undone_control[4];
+ $component_id =
$my_undone_control[5];
+
+
if(!isset($component_short_desc[$location_id][$component_id]))
+ {
+
$component_short_desc[$location_id][$component_id] =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+ }
+
+
if($component_short_desc[$location_id][$component_id])
+ {
+
$short_desc_arr = $component_short_desc[$location_id][$component_id];
+ }
+
+ if(count(
$controls_on_date) > 1 )
+ {
+ $link =
"";
+ $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'type' => "component", 'control_id'
=> $my_control['id'], 'location_id' => $location_id, 'component_id' =>
$component_id, 'deadline_ts' => $deadline_ts));
+
+
$my_undone_controls_HTML .= "<li><a href='{$link}'><div
class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$short_desc_arr}</div><div
class='control-area'>{$control_area_name}</div></a></li>";
+ }
+ else
+ {
+ $link =
"";
+ $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'type' => "component", 'control_id'
=> $my_control['id'], 'location_id' => $location_id, 'component_id' =>
$component_id, 'deadline_ts' => $deadline_ts));
+
+
$my_undone_controls_HTML .= "<a href='{$link}'><div
class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$short_desc_arr}</div><div
class='control-area'>{$control_area_name}</div></a>";
+ }
+ }
+ }
+ else if($check_list_status ==
"edit")
+ {
+ $check_list_id =
$my_undone_control[3];
+ $location_code =
$my_undone_control[4];
+
+
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
+ {
+
$location_array[$location_code] = execMethod('property.bolocation.read_single',
array('location_code' => $location_code));
+ }
+ $location_name =
$location_array[$location_code]["loc1_name"];
+
+ if(count(
$controls_on_date) > 1 )
+ {
+ $link = "";
+ $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
+
+
$my_undone_controls_HTML .= "<li><a href='{$link}'><div
class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$location_name}</div><div
class='control-area'>{$control_area_name}</div></a></li>";
+ }
+ else
+ {
+ $link = "";
+ $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
+
+
$my_undone_controls_HTML .= "<a href='{$link}'><div
class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$location_name}</div><div
class='control-area'>{$control_area_name}</div></a>";
+ }
+ }
+ }
+
+ if(count( $controls_on_date) > 1 )
+ {
+ $my_undone_controls_HTML .=
"</ul>";
+ }
+ }
+
+ $my_undone_controls_HTML .= "</div>"; //
home_portal
+
+ echo "\n".'<!-- BEGIN checklist info -->'."\n
<h2 class='heading'>Mine ugjorte kontroller</h2><div
class='home-box'>".$my_undone_controls_HTML."</div>\n".'<!-- END checklist info
-->'."\n";
+
+
+ /* ================================ CONTROLS
ASSIGNED TO CURRENT USER ================================= */
+
+ $my_assigned_controls_HTML = "<div
class='home_portal'><h2><div class='date heading'>Fristdato</div><div
class='control heading'>Tittel på kontroll</div><div class='title
heading'>Lokasjonsnavn</div><div class='control-area
heading'>Kontrollområde</div></h2>";
+
+
+ $from_date_ts = strtotime("now");
+ $to_date_ts = mktime(0, 0, 0, date("n")+1, date("j"),
date("Y") );
+
+ // fetch all repeat types
+ $repeat_type = null;
+
+ // Fetches controls current user is responsible for 1
month ahead in time
+ $my_controls = array();
+ $my_controls = $this->get_my_controls($my_locations,
$from_date_ts, $to_date_ts, $repeat_type);
+
+ $my_assigned_controls = array();
+
+ $from_date_ts = mktime(0, 0, 0, date("n"), date("j"),
date("Y") );
+
+ // Generates an array with undone controls
+ foreach($my_controls as $container_arr)
+ {
+ $location_code = $container_arr[0];
+ $control_type = $container_arr[1];
+ $controls = $container_arr[2];
+
+ foreach($controls as $my_control)
+ {
+ if($my_control["repeat_type"] ==
controller_control::REPEAT_TYPE_DAY)
+ {
+ // Daily control: Todate in one
week
+ $to_date_ts = mktime(0, 0, 0,
date("n"), date("j")+7, date("Y") );
+ }
+ else if(($my_control["repeat_type"] ==
controller_control::REPEAT_TYPE_WEEK)
+ |
($my_control["repeat_type"] == controller_control::REPEAT_TYPE_MONTH)
+ |
($my_control["repeat_type"] == controller_control::REPEAT_TYPE_YEAR))
+ {
+ // Daily, monthly yearly
control: to_date in one month
+ $to_date_ts = mktime(0, 0, 0,
date("n")+1, date("j"), date("Y") );
+ }
+
+ $date_generator = new
date_generator($my_control["start_date"], $my_control["end_date"],
$from_date_ts, $to_date_ts, $my_control["repeat_type"],
$my_control["repeat_interval"]);
+ $deadline_dates_for_control =
$date_generator->get_dates();
+
+ $check_list_array = array();
+ foreach($deadline_dates_for_control as
$deadline_ts)
+ {
+ $check_list = null;
+
+ if($control_type == "location")
+ {
+ // Gets checklist for
control with current date as deadline if there exists one
+ $check_list =
$so_check_list->get_check_list_for_control_by_date($my_control['id'],
$deadline_ts, null, $location_code, null, null, "location" );
+ }
+ else if($control_type ==
"component")
+ {
+ $component =
$container_arr[3];
+
+ // Gets checklist for
control with current date as deadline if there exists one
+ $check_list =
$so_check_list->get_check_list_for_control_by_date($my_control['id'],
$deadline_ts, null, null, $component['location_id'], $component['id'],
"component" );
+ }
+
+ // Check if there is a
checklist on the deadline
+ if($check_list == null)
+ {
+ if($control_type ==
"location")
+ {
+
$my_assigned_controls[$deadline_ts][] = array("add", $deadline_ts, $my_control,
"location", $location_code );
+ }
+ else if($control_type
== "component")
+ {
+ $component =
$container_arr[3];
+
$my_assigned_controls[$deadline_ts][] = array("add", $deadline_ts,
$my_control, "component", $component['location_id'], $component['id'] );
+ }
+ }
+ // Do not put checklist with
status planned in list
+ else if(
($check_list->get_planned_date() == '' || $check_list->get_planned_date() == 0
) && ( $check_list->get_status() == controller_check_list::STATUS_NOT_DONE ||
($check_list->get_status() == controller_check_list::STATUS_CANCELED)) )
+ {
+ $my_assigned_controls[$deadline_ts][] =
array("edit", $deadline_ts, $my_control, $check_list->get_id(), $location_code
);
+ }
+ }
+ }
+ }
+
+ // Sorts my_undone_controls by deadline date
+ $cats = CreateObject('phpgwapi.categories', -1,
'controller', '.control');
+ $cats->supress_info = true;
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','selected' => '','globals'
=> true,'use_acl' => $this->_category_acl));
+
+ $my_assigned_controls_HTML .= "<ul>";
+
+ foreach($my_assigned_controls as $date_ts =>
$assigned_controls_on_date)
+ {
+ if(count( $assigned_controls_on_date) > 1 )
+ {
+ $my_assigned_controls_HTML .= "<li>";
+ $my_assigned_controls_HTML .= "<a
href='#'><h4 class='expand_trigger'><img height='12'
src='controller/images/arrow_right.png' /><span class='deadline'>" .
date($dateformat, $date_ts) . "</span><span class='num_controls'>(" .
count($assigned_controls_on_date) . " kontroller)</span></h4></a>";
+ }
+
+ if(count( $assigned_controls_on_date ) > 1 )
+ {
+ $my_assigned_controls_HTML .= "<ul
class='expand_list'>";
+ }
+
+ foreach($assigned_controls_on_date as
$my_assigned_control)
+ {
+ $check_list_status =
$my_assigned_control[0];
+ $deadline_ts = $my_assigned_control[1];
+ $my_control = $my_assigned_control[2];
+
+ reset($control_areas['cat_list']);
+
+ foreach($control_areas['cat_list'] as
$area)
+ {
+ if($area['cat_id'] ==
$my_control["control_area_id"])
+ {
+ $control_area_name =
$area['name'];
+ }
+ }
+
+ $date_str = date($dateformat,
$deadline_ts);
+
+ if($check_list_status == "add")
+ {
+ $check_list_type =
$my_assigned_control[3];
+
+ if($check_list_type ==
"location")
+ {
+ $location_code =
$my_assigned_control[4];
+
+
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
+ {
+
$location_array[$location_code] = execMethod('property.bolocation.read_single',
array('location_code' => $location_code));
+ }
+ $location_name =
$location_array[$location_code]["loc1_name"];
+
+ $link = "";
+ $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'type' => "location", 'control_id' =>
$my_control['id'], 'location_code' => $location_code, 'deadline_ts' =>
$deadline_ts));
+
+
$my_assigned_controls_HTML .= "<li><a href='$link'><div
class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$location_name}</div><div
class='control-area'>{$control_area_name}</div></a></li>";
+ }
+ else if($check_list_type ==
"component")
+ {
+ $location_id =
$my_assigned_control[4];
+ $component_id =
$my_assigned_control[5];
+
+
if(!isset($component_short_desc[$location_id][$component_id]))
+ {
+
$component_short_desc[$location_id][$component_id] =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+ }
+
+
if($component_short_desc[$location_id][$component_id])
+ {
+ $short_desc_arr
= $component_short_desc[$location_id][$component_id];
+ }
+
+ $link = "";
+ $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'type' => "component", 'control_id'
=> $my_control['id'], 'location_id' => $location_id, 'component_id' =>
$component_id, 'deadline_ts' => $deadline_ts));
+
+
$my_assigned_controls_HTML .= "<li><a href='$link'><div
class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$short_desc_arr}</div><div
class='control-area'>{$control_area_name}</div></a></li>";
+ }
+ }
+ else if($check_list_status == "edit")
+ {
+ $check_list_id =
$my_assigned_control[3];
+ $location_code =
$my_assigned_control[4];
+
+
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
+ {
+
$location_array[$location_code] = execMethod('property.bolocation.read_single',
array('location_code' => $location_code));
+ }
+ $location_name =
$location_array[$location_code]["loc1_name"];
+
+ $link = "";
+ $link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
+
+ $my_assigned_controls_HTML .=
"<li><a href='$link'><div class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$location_name}</div><div
class='control-area'>{$control_area_name}</div></a></li>";
+ }
+ }
+
+ if(count( $assigned_controls_on_date ) > 1 )
+ {
+ $my_assigned_controls_HTML .= "</li>";
+ }
+
+ if(count( $assigned_controls_on_date ) > 1 )
+ {
+ $my_assigned_controls_HTML .= "</ul>";
+ }
+ }
+
+ echo "\n".'<!-- BEGIN checklist info -->'."\n <h2
class='heading'>Mine tildelte kontroller</h2><div class='home-box'>" .
$my_assigned_controls_HTML . "</div></div>\n".'<!-- END checklist info
-->'."\n";
+ }
+ }
+ /* ================================ FUNCTIONS
======================================== */
+
+
+ function get_my_controls($my_locations, $from_date_ts,
$to_date_ts, $repeat_type)
+ {
+ $so_control = CreateObject('controller.socontrol');
+
+ foreach($my_locations as $location)
+ {
+
+ $controls = array();
+ $components_with_controls_array = array();
+ $location_code = $location["location_code"];
+
+ $controls_at_location =
$so_control->get_controls_by_location( $location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_array", $location["role_id"] );
+
+ $level = count(explode('-', $location_code));
+
+ if($level == 1)
+ {
+ // Fetches all controls for the components for
a location within time period
+ $filter = "bim_item.location_code =
'$location_code' ";
+ $components_with_controls_array =
$so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_array", $location["role_id"], $filter);
+ }
+ else
+ {
+ // Fetches all controls for the components for
a location within time period
+ $filter = "bim_item.location_code LIKE
'$location_code%' ";
+ $components_with_controls_array =
$so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_array", $location["role_id"], $filter);
+ }
+
+ if( count($controls_at_location) > 0 )
+ {
+ // Saves location code, location type and an
array containing controls at locations
+ $my_controls[] = array( $location_code,
'location', $controls_at_location );
+ }
+
+ if( count($components_with_controls_array) > 0 )
+ {
+ foreach($components_with_controls_array as
$component)
+ {
+ // Saves location code, location type, an array
containing controls at locations and component object
+ $my_controls[] = array( $location_code,
'component', $component['controls_array'], $component );
+ }
+ }
+ }
+
+ return $my_controls;
+ }
+
+ function get_control_area_name( $control_area_id )
+ {
+ $cats = CreateObject('phpgwapi.categories', -1,
'controller', '.control');
+ $cats->supress_info = true;
+
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','selected' => '','globals'
=> true,'use_acl' => 0));
+
+ foreach($control_areas['cat_list'] as $area)
+ {
+ if( $area['cat_id'] == $control_area_id )
+ {
+ $control_area_name =
$area['name'];
+ }
+ }
+
+ return $control_area_name;
+ }
+ }
Modified: branches/Version-1_0-branch/controller/inc/class.socase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socase.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++ branches/Version-1_0-branch/controller/inc/class.socase.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -25,7 +25,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/
* @package property
* @subpackage controller
- * @version $Id: class.socheck_item.inc.php 8535 2012-01-09 10:14:45Z
vator $
+ * @version $Id$
*/
phpgw::import_class('controller.socommon');
@@ -83,6 +83,7 @@
$case->set_modified_date($this->unmarshal($this->db->f('modified_date'),
'int'));
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
$case->set_measurement($this->unmarshal($this->db->f('measurement'), 'string'));
+
$case->set_location_code($this->unmarshal($this->db->f('location_code'),
'string'));
return $case;
}
@@ -97,10 +98,9 @@
*
* @param $location_id location id
* @param $location_item_id location item id
- * @param $return_type return data as objects or as arrays
* @return array of case object represented as objects or arrays
*/
- public function get_cases_by_message($location_id,
$location_item_id, $return_type = "return_object")
+ public function get_cases_by_message($location_id,
$location_item_id)
{
$location_id = (int) $location_id;
$location_item_id = (int) $location_item_id;
@@ -123,15 +123,9 @@
$case->set_modified_date($this->unmarshal($this->db->f('modified_date'),
'int'));
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
$case->set_measurement($this->unmarshal($this->db->f('measurement'), 'string'));
+
$case->set_location_code($this->unmarshal($this->db->f('location_code'),
'string'));
- if($return_type == "return_object")
- {
- $cases_array[] = $case;
- }
- else
- {
- $cases_array[] = $case->toArray();
- }
+ $cases_array[] = $case;
}
return $cases_array;
@@ -156,6 +150,7 @@
'modified_date',
'modified_by',
'measurement',
+ 'location_code'
);
$values = array(
@@ -168,10 +163,12 @@
$this->marshal($case->get_entry_date(), 'int'),
$this->marshal($case->get_modified_date(),
'int'),
$this->marshal($case->get_modified_by(), 'int'),
- $this->marshal($case->get_measurement(),
'string')
+ $this->marshal($case->get_measurement(),
'string'),
+ $this->marshal($case->get_location_code(), 'string')
);
- $result = $this->db->query('INSERT INTO
controller_check_item_case (' . join(',', $cols) . ') VALUES (' . join(',',
$values) . ')', __LINE__,__FILE__);
+ $sql = 'INSERT INTO controller_check_item_case (' . join(',', $cols) .
') VALUES (' . join(',', $values) . ')';
+ $result = $this->db->query( $sql, __LINE__,__FILE__);
return $result ?
$this->db->get_last_insert_id('controller_check_item_case', 'id') : 0;
}
@@ -196,7 +193,8 @@
'entry_date = ' .
$this->marshal($case->get_entry_date(), 'int'),
'modified_date = ' .
$this->marshal($case->get_modified_date(), 'int'),
'modified_by = ' .
$this->marshal($case->get_modified_by(), 'int'),
- 'measurement = ' .
$this->marshal($case->get_measurement(), 'string')
+ 'measurement = ' .
$this->marshal($case->get_measurement(), 'string'),
+ 'location_code = ' . $this->marshal($case->get_location_code(),
'string')
);
$result = $this->db->query('UPDATE
controller_check_item_case SET ' . join(',', $values) . " WHERE id=$id",
__LINE__,__FILE__);
Property changes on:
branches/Version-1_0-branch/controller/inc/class.socase.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
2013-02-28 14:43:23 UTC (rev 10939)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -147,7 +147,8 @@
* @param $check_item_id id to check item to be fetched
from database
* @return check item object
*/
- public function get_single_with_cases($check_item_id,
$return_type = "return_object")
+ /*
+ public function get_single_with_cases($check_item_id)
{
$check_item_id = (int) $check_item_id;
@@ -178,15 +179,8 @@
$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'), 'int');
$control_item->set_type($this->db->f('type', true), 'string');
-
- if($return_type == "return_array")
- {
-
$check_item->set_control_item($control_item->toArray());
- }
- else
- {
-
$check_item->set_control_item($control_item);
- }
+
+
$check_item->set_control_item($control_item);
$cases_array = array();
}
@@ -204,15 +198,7 @@
$case->set_modified_date($this->unmarshal($this->db->f('modified_date'),
'int'));
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
-
- if($return_type == "return_array")
- {
- $cases_array[] =
$case->toArray();
- }
- else
- {
- $cases_array[] = $case;
- }
+ $cases_array[] = $case;
}
$check_item_id = $check_item->get_id();
@@ -222,21 +208,14 @@
if($check_item != null)
{
$check_item->set_cases_array($cases_array);
-
- if($return_type == "return_array")
- {
- return $check_item->toArray();
- }
- else
- {
- return $check_item;
- }
+ return $check_item;
}
else
{
return null;
}
}
+ */
/**
* Get single check item object from database including related
control item
@@ -288,10 +267,9 @@
* @param $type control item registration type
COMMENT/TEXTFIELD/CHECKLIST/RADIOBUTTONS
* @param $status status for cases OPEN/CLOSED/PENDING
* @param $messageStatus is there a message registered
for the case
- * @param $returnType data returned as objects or arrays
* @return check item objects
*/
- public function get_check_items_with_cases($check_list_id,
$type = "control_item_type_1", $status = "open", $messageStatus = null,
$return_type = "return_object")
+ public function get_check_items_with_cases($check_list_id,
$type = "control_item_type_1", $status = "open", $messageStatus = null,
$location_code = null)
{
$check_list_id = (int) $check_list_id;
$sql = "SELECT ci.id as ci_id, control_item_id,
check_list_id, ";
@@ -332,6 +310,11 @@
{
$sql .= "AND cic.location_item_id > 0 ";
}
+
+ if($location_code != null)
+ {
+ $sql .= "AND cic.location_code =
'$location_code' ";
+ }
$sql .= "ORDER BY ci.id";
@@ -346,15 +329,8 @@
if($check_item_id)
{
$check_item->set_cases_array($cases_array);
-
- if($return_type ==
"return_array")
- {
- $check_items_array[] =
$check_item->toArray();
- }
- else
- {
- $check_items_array[] =
$check_item;
- }
+
+ $check_items_array[] =
$check_item;
}
$check_item = new
controller_check_item($this->unmarshal($this->db->f('ci_id'), 'int'));
@@ -369,15 +345,8 @@
$control_item->set_control_group_id($this->db->f('control_group_id'), 'int');
$control_item->set_type($this->db->f('type', true), 'string');
- if($return_type == "return_array")
- {
-
$check_item->set_control_item($control_item->toArray());
- }
- else
- {
-
$check_item->set_control_item($control_item);
- }
-
+
$check_item->set_control_item($control_item);
+
$cases_array = array();
}
@@ -395,14 +364,8 @@
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
$case->set_measurement($this->unmarshal($this->db->f('measurement', true),
'string'));
- if($return_type == "return_array")
- {
- $cases_array[] =
$case->toArray();
- }
- else
- {
- $cases_array[] = $case;
- }
+ $cases_array[] = $case;
+
}
$check_item_id = $check_item->get_id();
@@ -411,15 +374,9 @@
if($check_item != null)
{
$check_item->set_cases_array($cases_array);
+
+ $check_items_array[] = $check_item;
- if($return_type == "return_array")
- {
- $check_items_array[] =
$check_item->toArray();
- }
- else
- {
- $check_items_array[] = $check_item;
- }
return $check_items_array;
}
else
@@ -432,10 +389,9 @@
* Get check item objects from database including related
control item and cases
*
* @param $message_ticket_id get check items and cases
for this message
- * @param $returnType data returned as objects or arrays
* @return check item objects
*/
- public function
get_check_items_with_cases_by_message($message_ticket_id, $return_type =
"return_object")
+ public function
get_check_items_with_cases_by_message($message_ticket_id)
{
$message_ticket_id = (int) $message_ticket_id;
@@ -459,14 +415,7 @@
{
$check_item->set_cases_array($cases_array);
- if($return_type ==
"return_array")
- {
- $check_items_array[] =
$check_item->toArray();
- }
- else
- {
- $check_items_array[] =
$check_item;
- }
+ $check_items_array[] =
$check_item;
}
$check_item = new
controller_check_item($this->unmarshal($this->db->f('ci_id'), 'int'));
@@ -480,16 +429,9 @@
$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'), 'int');
$control_item->set_type($this->db->f('type', true), 'string');
-
- if($return_type == "return_array")
- {
-
$check_item->set_control_item($control_item->toArray());
- }
- else
- {
-
$check_item->set_control_item($control_item);
- }
+
$check_item->set_control_item($control_item);
+
$cases_array = array();
}
@@ -506,15 +448,7 @@
$case->set_modified_date($this->unmarshal($this->db->f('modified_date'),
'int'));
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
-
- if($return_type == "return_array")
- {
- $cases_array[] =
$case->toArray();
- }
- else
- {
- $cases_array[] = $case;
- }
+ $cases_array[] = $case;
}
$check_item_id = $check_item->get_id();
@@ -523,16 +457,8 @@
if($check_item != null)
{
$check_item->set_cases_array($cases_array);
+ $check_items_array[] = $check_item;
- if($return_type == "return_array")
- {
- $check_items_array[] =
$check_item->toArray();
- }
- else
- {
- $check_items_array[] = $check_item;
- }
-
return $check_items_array;
}
else
Modified: branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++ branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -107,7 +107,8 @@
}
else if($type == 'string')
{
- return (string) $value;
+ return (string) str_replace('</ol></li>',
'</ol>' ,$value);
+ // return (string) $value;
}
else if($value === null || $value == 'NULL')
{
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -161,7 +161,7 @@
* @param $return_type return data as objects or as arrays
* @return control item object
*/
- public function get_single_with_options($id, $return_type =
"return_object")
+ public function get_single_with_options($id)
{
$id = (int)$id;
$sql = "SELECT ci.id as ci_id, ci.*, cio.id as cio_id,
cio.*, cg.group_name ";
@@ -171,7 +171,6 @@
$sql .= "WHERE ci.id = $id";
$this->db->query($sql);
-
$counter = 0;
$control_item = null;
while ($this->db->next_record())
@@ -198,14 +197,7 @@
$control_item_option->set_option_value($this->unmarshal($this->db->f('option_value',
true), 'string'));
$control_item_option->set_control_item_id($this->unmarshal($this->db->f('control_item_id'),
'int'));
- if($return_type == "return_object")
- {
- $options_array[] =
$control_item_option;
- }
- else
- {
- $options_array[] =
$control_item_option->toArray();
- }
+ $options_array[] = $control_item_option;
}
$counter++;
@@ -213,14 +205,7 @@
$control_item->set_options_array( $options_array );
- if($return_type == "return_object")
- {
- return $control_item;
- }
- else
- {
- return $control_item->toArray();
- }
+ return $control_item;
}
/**
@@ -233,7 +218,8 @@
{
$control_item_id = (int)$control_item_id;
$sql = "delete from controller_control_item_option
where control_item_id={$control_item_id}";
- $this->db->query($sql);
+
+ return $this->db->query($sql);
}
function get_control_item_array($start = 0, $results = 1000,
$sort = null, $dir = '', $query = null, $search_option = null, $filters =
array())
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++
branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -160,10 +160,9 @@
* Get control item objects from database as objects or as
arrays
*
* @param $control_group_id control group id
- * @param $return_type return data as objects or as arrays
* @return array with control items
*/
- function get_control_items($control_group_id, $return_type =
"return_object")
+ function get_control_items($control_group_id)
{
$control_group_id = (int) $control_group_id;
@@ -184,14 +183,7 @@
$control_item->set_how_to_do($this->unmarshal($this->db->f('how_to_do', true),
'string'));
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id'),
'int'));
- if($return_type == "return_object")
- {
- $results[] = $control_item;
- }
- else
- {
- $results[] = $control_item->toArray();
- }
+ $results[] = $control_item;
}
return $results;
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -25,7 +25,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/
* @package property
* @subpackage controller
- * @version $Id: class.socontrol_item.inc.php 8909 2012-02-17 08:51:35Z
erikhl $
+ * @version $Id$
*/
phpgw::import_class('controller.socommon');
Property changes on:
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Modified: branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++ branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -56,6 +56,7 @@
private $so_control_item;
private $so_check_list;
private $so_check_item;
+ private $location_finder;
public $public_functions = array
(
'view_calendar_for_month' => true,
@@ -83,6 +84,8 @@
$this->so_check_list =
CreateObject('controller.socheck_list');
$this->so_check_item =
CreateObject('controller.socheck_item');
+ $this->location_finder = new location_finder();
+
self::set_active_menu('controller::location_check_list');
}
@@ -117,12 +120,12 @@
if ($location_code != null && $location_code != "")
{
- $level =
$this->get_location_level($location_code);
+ $level =
$this->location_finder->get_location_level($location_code);
$user_role = true;
// Fetches buildings on property
- $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
// Fetches controls for location within
specified time period
$controls_for_location_array =
$this->so_control->get_controls_by_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role);
@@ -203,29 +206,29 @@
);
$data = array
- (
- 'buildings_on_property' =>
$buildings_on_property,
- 'my_locations' => $my_locations,
- 'property_array' => $property_array,
- 'current_location' => $location_array,
- 'heading_array' => $heading_array,
- 'controls_calendar_array' =>
$controls_calendar_array,
+ (
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'my_locations' =>
$my_locations,
+ 'property_array' =>
$property_array,
+ 'current_location' =>
$location_array,
+ 'heading_array' =>
$heading_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
'components_calendar_array' =>
$components_calendar_array,
- 'location_level' => $level,
- 'roles_array' => $roles_array,
- 'repeat_type_array' =>
$repeat_type_array,
- 'current_year' => $year,
- 'current_month_nr' => $month,
- 'current_role' => $role,
- 'current_repeat_type' => $repeat_type
+ 'location_level' => $level,
+ 'roles_array' =>
$roles_array,
+ 'repeat_type_array' =>
$repeat_type_array,
+ 'current_year' => $year,
+ 'current_month_nr' => $month,
+ 'current_role' => $role,
+ 'current_repeat_type' =>
$repeat_type
);
phpgwapi_jquery::load_widget('autocomplete');
self::add_javascript('controller',
'controller', 'ajax.js');
self::render_template_xsl(array('calendar/view_calendar_month',
'calendar/check_list_status_manager',
-
'calendar/icon_color_map', 'calendar/select_my_locations',
-
'calendar/select_buildings_on_property', 'calendar/nav_calendar_month',
-
'calendar/calendar_filters'), $data);
+ 'calendar/icon_color_map',
'calendar/select_my_locations',
+
'calendar/select_buildings_on_property',
'calendar/nav_calendar_month',
+
'calendar/calendar_filters'), $data);
}
else
{
@@ -271,12 +274,12 @@
if ($location_code != null && $location_code != "")
{
- $level =
$this->get_location_level($location_code);
+ $level =
$this->location_finder->get_location_level($location_code);
$user_role = true;
// Fetches buildings on property
- $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
// Fetches all controls for the location within
time period
$controls_for_location_array =
$this->so_control->get_controls_by_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role);
@@ -421,9 +424,9 @@
self::add_javascript('controller',
'controller', 'ajax.js');
self::render_template_xsl(array('calendar/view_calendar_year',
'calendar/check_list_status_manager',
- 'calendar/icon_color_map',
'calendar/select_my_locations',
-
'calendar/select_buildings_on_property', 'calendar/nav_calendar_year',
- 'calendar/calendar_filters'), $data);
+ 'calendar/icon_color_map',
'calendar/select_my_locations',
+
'calendar/select_buildings_on_property', 'calendar/nav_calendar_year',
+ 'calendar/calendar_filters'),
$data);
}
else
{
@@ -557,7 +560,7 @@
);
self::render_template_xsl(array('calendar/view_calendar_year_for_locations',
'calendar/check_list_status_manager',
- 'calendar/icon_color_map',
'calendar/select_my_locations', 'calendar/nav_calendar_year'), $data);
+ 'calendar/icon_color_map',
'calendar/select_my_locations', 'calendar/nav_calendar_year'), $data);
phpgwapi_jquery::load_widget('core');
self::add_javascript('controller', 'controller',
'ajax.js');
@@ -597,7 +600,7 @@
$repeat_type = $control->get_repeat_type();
$check_lists_array =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $control->get_repeat_type());
- $month_calendar = new month_calendar($control, $year, $month, null,
$curr_location_code, "location");
+ $month_calendar = new month_calendar($control, $year, $month,
null, $curr_location_code, "location");
$calendar_array =
$month_calendar->build_calendar($check_lists_array);
$locations_with_calendar_array[] =
array("location" => $location, "calendar_array" => $calendar_array);
@@ -694,38 +697,6 @@
return $agg_open_cases_pr_month_array;
}
- function get_buildings_on_property($user_role, $location_code,
$level)
- {
-
- // Property level
- if ($level == 1)
- {
- $property_location_code = $location_code;
- }
- // Building level
- else if ($level > 1)
- {
- $split_loc_code_array = explode('-',
$location_code);
- $property_location_code =
$split_loc_code_array[0];
- }
-
- if ($user_role)
- {
- $criteria = array();
- $criteria['location_code'] =
$property_location_code;
- $criteria['field_name'] = 'loc2_name';
- $criteria['child_level'] = '2';
-
- $buildings_on_property =
execMethod('property.solocation.get_children', $criteria);
- }
- else
- {
- $buildings_on_property =
execMethod('property.solocation.get_children', $property_location_code);
- }
-
- return $buildings_on_property;
- }
-
function get_start_month_for_control($control)
{
// Checks if control starts in the year that is
displayed
@@ -756,13 +727,6 @@
return $to_month;
}
- function get_location_level($location_code)
- {
- $level = count(explode('-', $location_code));
-
- return $level;
- }
-
function validate_location_code($location_code)
{
$criteria = array
@@ -773,12 +737,13 @@
'allrows' => false
);
- $location_finder = new location_finder();
- $my_locations =
$location_finder->get_responsibilities($criteria);
-
if (empty($location_code))
{
- $location_code =
$my_locations[0]["location_code"];
+ $my_locations =
$this->location_finder->get_responsibilities($criteria);
+ if( count($my_locations) > 0 )
+ {
+ $location_code = $my_locations[0]["location_code"];
+ }
}
return $location_code;
@@ -794,8 +759,7 @@
'allrows' => false
);
- $location_finder = new location_finder();
- $my_locations =
$location_finder->get_responsibilities($criteria);
+ $my_locations =
$this->location_finder->get_responsibilities($criteria);
$my_washed_locations = array();
Modified: branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -25,7 +25,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/
* @package property
* @subpackage controller
- * @version $Id: class.uicheck_list.inc.php 8419 2011-12-23 09:54:15Z
vator $
+ * @version $Id$
*/
/**
@@ -39,48 +39,152 @@
phpgw::import_class('controller.socheck_list');
phpgw::import_class('controller.socheck_item');
phpgw::import_class('controller.socontrol');
+ phpgw::import_class('controller.socontrol_group_list');
+ phpgw::import_class('controller.socontrol_item_list');
include_class('controller', 'check_item_case', 'inc/model/');
include_class('controller', 'component', 'inc/model/');
include_class('controller', 'check_list_status_updater', 'inc/helper/');
+ include_class('controller', 'location_finder', 'inc/helper/');
class controller_uicase extends phpgwapi_uicommon
{
private $so;
- private $so_check_list;
- private $so_control;
+
+ private $so_control;
private $so_control_item;
private $so_check_item;
-
+ private $so_procedure;
+ private $so_control_group_list;
+ private $so_control_group;
+ private $so_control_item_list;
+ private $so_check_list;
+
+ private $location_finder;
+
var $public_functions = array(
-
'add_case' => true,
-
'save_case' => true,
-
'create_case_message' => true,
-
'view_case_message' => true,
-
'send_case_message' => true,
-
'updateStatusForCases' => true,
-
'delete_case' => true,
-
'close_case' => true,
-
'open_case' => true
- );
+ 'add_case' => true,
+ 'save_case' => true,
+ 'save_case_ajax' => true,
+ 'create_case_message' => true,
+ 'view_case_message' => true,
+ 'send_case_message' => true,
+ 'updateStatusForCases' => true,
+ 'delete_case' => true,
+ 'close_case' => true,
+ 'open_case' => true,
+ 'view_open_cases' => true,
+ 'view_closed_cases' => true
+ );
function __construct()
{
parent::__construct();
- $this->so = CreateObject('controller.socase');
- $this->so_check_list =
CreateObject('controller.socheck_list');
- $this->so_control =
CreateObject('controller.socontrol');
- $this->so_check_item =
CreateObject('controller.socheck_item');
- $this->so_control_item =
CreateObject('controller.socontrol_item');
+ $this->so =
CreateObject('controller.socase');
+ $this->so_control =
CreateObject('controller.socontrol');
+ $this->so_control_item =
CreateObject('controller.socontrol_item');
+ $this->so_check_item =
CreateObject('controller.socheck_item');
+ $this->so_procedure =
CreateObject('controller.soprocedure');
+ $this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
+ $this->so_control_group =
CreateObject('controller.socontrol_group');
+ $this->so_control_item_list =
CreateObject('controller.socontrol_item_list');
+ $this->so_check_list =
CreateObject('controller.socheck_list');
+
+ $this->location_finder = new location_finder();
}
- function add_case(){
+ function add_case()
+ {
$check_list_id = phpgw::get_var('check_list_id');
+ $check_list =
$this->so_check_list->get_single($check_list_id);
+ $control =
$this->so_control->get_single($check_list->get_control_id());
+
+ $saved_control_groups =
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
+
+ $control_groups_with_items_array = array();
+
+ $component_id = $check_list->get_component_id();
+
+ if($component_id > 0)
+ {
+ $location_id = $check_list->get_location_id();
+ $component_id = $check_list->get_component_id();
+
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+
+ $component = new controller_component();
+ $component->set_location_code(
$component_arr['location_code'] );
+ $component->set_xml_short_desc( $short_desc );
+ $component_array = $component->toArray();
+
+ $type = 'component';
+ $building_location_code =
$this->location_finder->get_building_location_code($component_arr['location_code']);
+ }
+ else
+ {
+ $location_code =
$check_list->get_location_code();
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ $type = 'location';
+ }
+
+ //Populating array with saved control items for each
group
+ foreach ($saved_control_groups as $control_group)
+ {
+ $saved_control_items =
$this->so_control_item_list->get_control_items_and_options_by_control_and_group($control->get_id(),
$control_group->get_id(), "return_array");
+
+ if(count($saved_control_items) > 0)
+ {
+ $control_groups_with_items_array[] =
array("control_group" => $control_group->toArray(), "control_items" =>
$saved_control_items);
+ }
+ }
+
+
+ $level =
$this->location_finder->get_location_level($location_code);
+ $year = date("Y", $check_list->get_deadline());
+ $month = date("n", $check_list->get_deadline());
+
+ $user_role = true;
+
+ // Fetches buildings on property
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
+
+ $data = array
+ (
+ 'control'
=> $control,
+ 'check_list'
=> $check_list,
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'location_array' =>
$location_array,
+ 'component_array'
=> $component_array,
+ 'control_groups_with_items_array' =>
$control_groups_with_items_array,
+ 'type'
=> $type,
+ 'location_level'
=> $level,
+ 'building_location_code'
=> $building_location_code,
+ 'current_year'
=> $year,
+ 'current_month_nr'
=> $month,
+ 'cases_view' => 'add_case',
+ );
+
+ phpgwapi_jquery::load_widget('core');
+
+ self::add_javascript('controller', 'controller',
'custom_ui.js');
+ self::add_javascript('controller', 'controller',
'ajax.js');
+ self::add_javascript('controller', 'controller', 'case.js');
+ self::add_javascript('controller', 'controller', 'check_list.js');
+
+
self::render_template_xsl(array('check_list/fragments/check_list_menu',
'check_list/fragments/nav_control_plan',
+
'check_list/fragments/check_list_top_section', 'case/add_case',
+
'check_list/fragments/select_buildings_on_property'), $data);
+ }
+
+ function save_case_ajax(){
+ $check_list_id = phpgw::get_var('check_list_id');
$control_item_id = phpgw::get_var('control_item_id');
$case_descr = phpgw::get_var('case_descr');
$type = phpgw::get_var('type');
$status = phpgw::get_var('status');
+ $location_code = phpgw::get_var('location_code');
$check_list =
$this->so_check_list->get_single($check_list_id);
@@ -94,7 +198,7 @@
$new_check_item = new controller_check_item();
$new_check_item->set_check_list_id(
$check_list_id );
$new_check_item->set_control_item_id(
$control_item_id );
-
+
$saved_check_item_id =
$this->so_check_item->store( $new_check_item );
$check_item =
$this->so_check_item->get_single($saved_check_item_id);
}
@@ -112,6 +216,7 @@
$case->set_modified_by($user_id);
$case->set_modified_by($user_id);
$case->set_status($status);
+ $case->set_location_code( $location_code );
// Saves selected value from or measurement
if($type == 'control_item_type_2'){
@@ -135,9 +240,9 @@
}
else{
return json_encode( array( "status" =>
"not_saved" ) );
- }
+ }
}
-
+
function save_case(){
$case_id = phpgw::get_var('case_id');
$case_descr = phpgw::get_var('case_descr');
@@ -153,30 +258,37 @@
$case->set_measurement($measurement);
$case->set_status($case_status);
- $case_id = $this->so->store($case);
- $case = $this->so->get_single($case_id);
-
- if($case_id > 0){
- $cl_status_updater = new
check_list_status_updater();
- $cl_status_updater->update_check_list_status(
$check_list_id );
-
- $check_item =
$this->so_check_item->get_single($case->get_check_item_id());
- $control_item =
$this->so_control_item->get_single($check_item->get_control_item_id());
-
- $type = $control_item->get_type();
-
- return json_encode( array( "status" => "saved",
"type" => $type, "caseObj" => $case->toArray() ) );
- }
- else{
- return json_encode( array( "status" =>
"not_saved" ) );
- }
+ if($case->validate())
+ {
+ $case_id = $this->so->store($case);
+ $case = $this->so->get_single($case_id);
+
+ if($case_id > 0){
+ $cl_status_updater = new check_list_status_updater();
+ $cl_status_updater->update_check_list_status( $check_list_id );
+
+ $check_item =
$this->so_check_item->get_single($case->get_check_item_id());
+ $control_item =
$this->so_control_item->get_single($check_item->get_control_item_id());
+
+ $type = $control_item->get_type();
+
+ return json_encode( array( "status" => "saved", "type" => $type,
"caseObj" => $case->toArray() ) );
+ }
+ else{
+ return json_encode( array( "status" => "not_saved" ) );
+ }
+ }
+ else
+ {
+ return json_encode( array( "status" => "error" ) );
+ }
}
function create_case_message(){
$check_list_id = phpgw::get_var('check_list_id');
$check_list =
$this->so_check_list->get_single($check_list_id);
- $check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open",
"no_message_registered", "return_array");
+ $check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open",
"no_message_registered");
$control_id = $check_list->get_control_id();
$control = $this->so_control->get_single( $control_id );
@@ -198,10 +310,10 @@
$component = new controller_component();
$component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
+ $component->set_xml_short_desc( $short_desc );
$component_array = $component->toArray();
- $building_location_code =
$this->get_building_location_code($component_arr['location_code']);
+ $building_location_code =
$this->location_finder->get_building_location_code($component_arr['location_code']);
$type = 'component';
}
else
@@ -211,24 +323,24 @@
$type = 'location';
}
- $level = $this->get_location_level();
+ $level = $this->location_finder->get_location_level();
$year = date("Y", $check_list->get_deadline());
$month = date("n", $check_list->get_deadline());
$data = array
(
- 'categories'
=> $categories,
- 'check_list'
=> $check_list->toArray(),
- 'control'
=> $control->toArray(),
+ 'categories' =>
$categories,
+ 'check_list' =>
$check_list->toArray(),
+ 'control'
=> $control->toArray(),
'check_items_and_cases' =>
$check_items_and_cases,
- 'location_array'
=> $location_array,
- 'component_array'
=> $component_array,
- 'building_location_code' =>
$building_location_code,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month,
- 'type'
=> $type,
- 'location_level'
=> $level,
+ 'location_array' =>
$location_array,
+ 'component_array' =>
$component_array,
+ 'building_location_code' =>
$building_location_code,
+ 'current_year' =>
$year,
+ 'current_month_nr' =>
$month,
+ 'type'
=> $type,
+ 'location_level' =>
$level,
);
if(count( $buildings_array ) > 0)
@@ -245,7 +357,7 @@
self::add_javascript('controller', 'controller',
'custom_ui.js');
self::add_javascript('controller', 'controller',
'ajax.js');
-
self::render_template_xsl(array('check_list/check_list_tab_menu',
'case/create_case_message'), $data);
+
self::render_template_xsl(array('check_list/fragments/check_list_menu',
'case/create_case_message'), $data);
}
function send_case_message(){
@@ -288,13 +400,13 @@
$ticket = array
(
- 'origin_id' => $location_id,
+ 'origin_id' => $location_id,
'origin_item_id' => $check_list_id,
'location_code' => $location_code,
- 'cat_id'
=> $message_cat_id,
- 'priority' =>
$priority, //valgfri (1-3)
- 'title'
=> $message_title,
- 'details'
=> $message_details,
+ 'cat_id' =>
$message_cat_id,
+ 'priority' => $priority,
//valgfri (1-3)
+ 'title' =>
$message_title,
+ 'details' =>
$message_details,
'file_input_name' => 'file' // navn på
felt som inneholder fil
);
@@ -314,11 +426,11 @@
$interlink_data = array
(
- 'location1_id' =>
$component_location_id,
+ 'location1_id' =>
$component_location_id,
'location1_item_id' => $component_id,
- 'location2_id' =>
$location_id_ticket,
+ 'location2_id' =>
$location_id_ticket,
'location2_item_id' =>
$message_ticket_id,
- 'account_id' => $user_id
+ 'account_id' => $user_id
);
execMethod('property.interlink.add',
$interlink_data);
@@ -372,11 +484,11 @@
$component = new controller_component();
$component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
+ $component->set_xml_short_desc( $short_desc );
$component_array = $component->toArray();
$type = 'component';
- $building_location_code =
$this->get_building_location_code($component_arr['location_code']);
+ $building_location_code =
$this->location_finder->get_building_location_code($component_arr['location_code']);
}
else
{
@@ -385,26 +497,26 @@
$type = 'location';
}
- $level = $this->get_location_level($location_code);
+ $level =
$this->location_finder->get_location_level($location_code);
$year = date("Y", $check_list->get_deadline());
$month = date("n", $check_list->get_deadline());
$data = array
(
- 'control'
=> $control->toArray(),
- 'message_ticket_id'
=> $message_ticket_id,
- 'message_ticket'
=> $message_ticket,
- 'category'
=> $category[0]['name'],
- 'location_array'
=> $location_array,
- 'component_array'
=> $component_array,
- 'control_array'
=> $control->toArray(),
- 'check_list'
=> $check_list->toArray(),
- 'check_items_and_cases' =>
$check_items_and_cases,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month,
- 'type'
=> $type,
+ 'control' =>
$control->toArray(),
+ 'message_ticket_id' =>
$message_ticket_id,
+ 'message_ticket' => $message_ticket,
+ 'category' =>
$category[0]['name'],
+ 'location_array' => $location_array,
+ 'component_array' => $component_array,
+ 'control_array' =>
$control->toArray(),
+ 'check_list' =>
$check_list->toArray(),
+ 'check_items_and_cases' =>
$check_items_and_cases,
+ 'current_year' => $year,
+ 'current_month_nr' => $month,
+ 'type' => $type,
'building_location_code' =>
$building_location_code,
- 'location_level'
=> $level
+ 'location_level' =>
$level
);
phpgwapi_jquery::load_widget('core');
@@ -412,7 +524,7 @@
self::add_javascript('controller', 'controller',
'custom_ui.js');
self::add_javascript('controller', 'controller',
'ajax.js');
-
self::render_template_xsl(array('check_list/check_list_tab_menu',
'case/view_case_message'), $data);
+
self::render_template_xsl(array('check_list/fragments/check_list_menu',
'case/view_case_message'), $data);
}
public function updateStatusForCases($location_id,
$location_item_id, $updateStatus = 0){
@@ -501,32 +613,168 @@
return json_encode( array( "status" => "false"
) );
}
}
-
- function get_location_level($location_code)
- {
- $level = count(explode('-', $location_code));
+
+ function view_open_cases()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+ $case_location_code = phpgw::get_var('location_code');
+
+ $check_list =
$this->so_check_list->get_single($check_list_id);
+ $control =
$this->so_control->get_single($check_list->get_control_id());
- return $level;
- }
+ $check_list_location_code = $check_list->get_location_code();
+
+ $component_id = $check_list->get_component_id();
- function get_building_location_code($location_code)
- {
- if( strlen( $location_code ) == 6 )
+ if($component_id > 0)
{
- $location_code_arr = explode('-',
$location_code, 2);
- $building_location_code = $location_code_arr[0];
+ $location_id = $check_list->get_location_id();
+ $component_id = $check_list->get_component_id();
+
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+
+ $component = new controller_component();
+ $component->set_location_code(
$component_arr['location_code'] );
+ $component->set_xml_short_desc( $short_desc );
+ $component_array = $component->toArray();
+
+ $type = 'component';
+ $building_location_code =
$this->location_finder->get_building_location_code($component_arr['location_code']);
}
- else if( strlen( $location_code ) > 6 )
+ else
{
- $location_code_arr = explode('-',
$location_code, 3);
- $building_location_code = $location_code_arr[0]
. "-" . $location_code_arr[1];
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$check_list_location_code));
+ $type = 'location';
}
+
+
+ $level =
$this->location_finder->get_location_level($check_list_location_code);
+ $year = date("Y", $check_list->get_deadline());
+ $month = date("n", $check_list->get_deadline());
+
+ $user_role = true;
+
+ // Fetches buildings on property
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role,
$check_list_location_code, $level);
+
+ if( count($buildings_on_property) > 0 )
+ {
+ if($case_location_code == "")
+ {
+ $case_location_code = $buildings_on_property[0]['id'];
+ }
+
+ $open_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null,
'open_or_waiting', null, $case_location_code);
+ }
+
+ foreach($open_check_items_and_cases as $key =>
$check_item)
+ {
+ $control_item_with_options =
$this->so_control_item->get_single_with_options(
$check_item->get_control_item_id() );
+
+ $check_item->get_control_item()->set_options_array(
$control_item_with_options->get_options_array() );
+ $open_check_items_and_cases[$key] = $check_item;
+ }
+
+ $data = array
+ (
+ 'control' => $control,
+ 'check_list'
=> $check_list,
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'location_array' =>
$location_array,
+ 'component_array'
=> $component_array,
+ 'type'
=> $type,
+ 'location_level'
=> $level,
+ 'building_location_code' =>
$case_location_code,
+ 'current_year'
=> $year,
+ 'current_month_nr'
=> $month,
+ 'open_check_items_and_cases' =>
$open_check_items_and_cases,
+ 'cases_view' => 'open_cases'
+ );
+
+ phpgwapi_jquery::load_widget('core');
+ self::add_javascript('controller', 'controller', 'case.js');
+
+ self::render_template_xsl(
array('check_list/fragments/check_list_menu', 'case/cases_tab_menu',
'case/view_open_cases', 'case/case_row',
+
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
+
'check_list/fragments/select_buildings_on_property'), $data );
+ }
+
+ function view_closed_cases()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+ $check_list =
$this->so_check_list->get_single($check_list_id);
+
+ // Check list top section info
+ $control =
$this->so_control->get_single($check_list->get_control_id());
+ $location_code = $check_list->get_location_code();
+
+ $component_id = $check_list->get_component_id();
+
+ if($component_id > 0)
+ {
+ $location_id = $check_list->get_location_id();
+ $component_id = $check_list->get_component_id();
+
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+
+ $component = new controller_component();
+ $component->set_location_code(
$component_arr['location_code'] );
+ $component->set_xml_short_desc( $short_desc );
+ $component_array = $component->toArray();
+
+ $type = 'component';
+ $building_location_code =
$this->location_finder->get_building_location_code($component_arr['location_code']);
+ }
else
{
- $building_location_code = $location_code;
+ $location_code =
$check_list->get_location_code();
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ $type = 'location';
}
-
- return $building_location_code;
+ // Check list top section info
+
+ $level =
$this->location_finder->get_location_level($location_code);
+ $year = date("Y", $check_list->get_deadline());
+ $month = date("n", $check_list->get_deadline());
+
+ $user_role = true;
+
+ // Fetches buildings on property
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
+
+ if( count($buildings_on_property) > 0 )
+ {
+ $building_location_code = $buildings_on_property[0]['id'];
+ $closed_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null,
'closed', null, $building_location_code);
+ }
+
+ $data = array
+ (
+ 'control' =>
$control,
+ 'check_list'
=> $check_list,
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'location_array' =>
$location_array,
+ 'component_array'
=> $component_array,
+ 'type'
=> $type,
+ 'location_level'
=> $level,
+ 'building_location_code' =>
$building_location_code,
+ 'current_year'
=> $year,
+ 'current_month_nr'
=> $month,
+ 'closed_check_items_and_cases' =>
$closed_check_items_and_cases,
+ 'check_list' => $check_list,
+ 'cases_view' => 'closed_cases',
+ 'building_location_code' => $building_location_code
+ );
+
+ phpgwapi_jquery::load_widget('core');
+ self::add_javascript('controller', 'controller', 'case.js');
+
+ self::render_template_xsl(
array('check_list/fragments/check_list_menu', 'case/cases_tab_menu',
'case/view_closed_cases', 'case/case_row',
+
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
+
'check_list/fragments/select_buildings_on_property'), $data );
}
public function query(){}
Property changes on:
branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Modified: branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -1,829 +1,638 @@
<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-
- /**
- * Import the jQuery class
- */
- phpgw::import_class('phpgwapi.jquery');
- /**
- * Import the yui class
- */
- phpgw::import_class('phpgwapi.yui');
- phpgw::import_class('phpgwapi.uicommon');
- phpgw::import_class('controller.socheck_list');
- phpgw::import_class('phpgwapi.datetime');
-
- include_class('controller', 'check_list', 'inc/model/');
- include_class('controller', 'check_item', 'inc/model/');
- include_class('controller', 'date_generator', 'inc/component/');
- include_class('controller', 'check_list_status_updater', 'inc/helper/');
- include_class('controller', 'date_converter', 'inc/helper/');
-
- class controller_uicheck_list extends phpgwapi_uicommon
- {
- private $so;
- private $so_control;
- private $so_control_item;
- private $so_check_item;
- private $so_procedure;
- private $so_control_group_list;
- private $so_control_group;
- private $so_control_item_list;
-
- var $public_functions = array(
-
'index'
=> true,
-
'add_check_list' => true,
-
'save_check_list' => true,
-
'edit_check_list' => true,
-
'view_control_info' => true,
-
'view_cases_for_check_list' => true,
-
'print_check_list' => true,
-
'add_case'
=> true,
-
'view_open_cases' => true,
-
'view_closed_cases' => true,
-
'view_control_details' => true,
-
'view_control_items' => true,
-
'get_check_list_info' => true,
-
'get_cases_for_check_list' => true
- );
+ /**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage controller
+ * @version $Id$
+ */
+ /**
+ * Import the jQuery class
+ */
+ phpgw::import_class('phpgwapi.jquery');
- function __construct()
- {
- parent::__construct();
+ /**
+ * Import the yui class
+ */
+ phpgw::import_class('phpgwapi.yui');
+ phpgw::import_class('phpgwapi.uicommon');
+ phpgw::import_class('controller.socheck_list');
+ phpgw::import_class('phpgwapi.datetime');
- $this->so_control
= CreateObject('controller.socontrol');
- $this->so
=
CreateObject('controller.socheck_list');
- $this->so_control_item =
CreateObject('controller.socontrol_item');
- $this->so_check_item
= CreateObject('controller.socheck_item');
- $this->so_procedure
= CreateObject('controller.soprocedure');
- $this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
- $this->so_control_group =
CreateObject('controller.socontrol_group');
- $this->so_control_item_list =
CreateObject('controller.socontrol_item_list');
+ include_class('controller', 'check_list', 'inc/model/');
+ include_class('controller', 'check_item', 'inc/model/');
+ include_class('controller', 'date_generator', 'inc/component/');
+ include_class('controller', 'check_list_status_updater', 'inc/helper/');
+ include_class('controller', 'date_converter', 'inc/helper/');
+ include_class('controller', 'location_finder', 'inc/helper/');
-
self::set_active_menu('controller::control::check_list');
- }
-
- /**
- * Public function for displaying checklists
- *
- * @param HTTP:: phpgw_return_as
- * @return data array
- */
- public function index()
- {
- if(phpgw::get_var('phpgw_return_as') == 'json') {
- return $this->query();
- }
- self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('paginator');
+ class controller_uicheck_list extends phpgwapi_uicommon
+ {
+ protected $so;
+ protected $so_control;
+ protected $so_control_item;
+ protected $so_check_item;
+ protected $so_procedure;
+ protected $so_control_group_list;
+ protected $so_control_group;
+ protected $so_control_item_list;
+ protected $location_finder;
+ var $public_functions = array(
+ 'index' => true,
+ 'add_check_list' => true,
+ 'save_check_list' => true,
+ 'edit_check_list' => true,
+ 'print_check_list' => true,
+ 'view_control_info' => true,
+ 'view_control_details' => true,
+ 'view_control_items' => true,
+ 'get_check_list_info' => true,
+ 'get_cases_for_check_list' => true,
+ 'update_status' => true
+ );
- $data = array(
- 'datatable_name' => 'Sjekkliste (Ikke i
bruk)',
- 'form' => array(
- 'toolbar' => array(
- 'item' => array(
- array('type' =>
'filter',
- 'name' =>
'status',
- 'text' =>
lang('Status'),
- 'list' => array(
- array(
-
'id' => 'none',
-
'name' => lang('Not selected')
- ),
- array(
-
'id' => 'NEW',
-
'name' => lang('NEW')
- ),
- array(
-
'id' => 'PENDING',
-
'name' => lang('PENDING')
- ),
- array(
-
'id' => 'REJECTED',
-
'name' => lang('REJECTED')
- ),
- array(
-
'id' => 'ACCEPTED',
-
'name' => lang('ACCEPTED')
- )
- )
- ),
- array('type' => 'text',
- 'text' =>
lang('searchfield'),
- 'name' =>
'query'
- ),
- array(
- 'type' =>
'submit',
- 'name' =>
'search',
- 'value' =>
lang('Search')
- ),
- ),
- ),
- ),
- 'datatable' => array(
- 'source' =>
self::link(array('menuaction' => 'controller.uicheck_list.index',
'phpgw_return_as' => 'json')),
- 'field' => array(
- array(
- 'key' => 'id',
- 'label' => lang('ID'),
- 'sortable' => true,
- 'formatter' =>
'YAHOO.portico.formatLink'
- ),
- array(
- 'key' => 'title',
- 'label' =>
lang('Control title'),
- 'sortable' =>
false
- ),
- array(
- 'key' => 'start_date',
- 'label' =>
lang('start_date'),
- 'sortable' => false
- ),
- array(
- 'key' => 'planned_date',
- 'label' =>
lang('planned_date'),
- 'sortable' => false
- ),
- array(
- 'key' => 'end_date',
- 'label' =>
lang('end_date'),
- 'sortable' => false
- ),
- array(
- 'key' => 'link',
- 'hidden' => true
- )
- )
- ),
- );
+ function __construct()
+ {
+ parent::__construct();
- self::render_template_xsl('datatable_common', $data);
- }
-
- /**
- * Public function for displaying the add check list form
- *
- * @param HTTP:: location code, control id, date
- * @return data array
- */
- function add_check_list($check_list = null){
- if($check_list == null)
- {
- $type = phpgw::get_var('type');
- $control_id = phpgw::get_var('control_id');
- $deadline_ts = phpgw::get_var('deadline_ts');
-
- $check_list = new controller_check_list();
- $check_list->set_control_id($control_id);
- $check_list->set_deadline($deadline_ts);
- }
- else
- {
- if( $check_list->get_component_id() > 0)
- {
- $type = "component";
- }
- else
- {
- $type = "location";
- }
- }
-
- if(!$location_code = $check_list->get_location_code())
- {
- $location_code =
phpgw::get_var('location_code');
- $check_list->set_location_code($location_code);
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$check_list->get_location_code()));
- $level =
$this->get_location_level($location_code);
- }
+ $this->so_control = CreateObject('controller.socontrol');
+ $this->so = CreateObject('controller.socheck_list');
+ $this->so_control_item = CreateObject('controller.socontrol_item');
+ $this->so_check_item = CreateObject('controller.socheck_item');
+ $this->so_procedure = CreateObject('controller.soprocedure');
+ $this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
+ $this->so_control_group =
CreateObject('controller.socontrol_group');
+ $this->so_control_item_list =
CreateObject('controller.socontrol_item_list');
- if($type == "component")
- {
- if($check_list != null)
- {
- $location_id =
phpgw::get_var('location_id');
-
$check_list->set_location_id($location_id);
- $component_id =
phpgw::get_var('component_id');
-
$check_list->set_component_id($component_id);
- }
-
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
- $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
-
- $component = new controller_component();
- $component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
-
- $component_array = $component->toArray();
- $building_location_code =
$this->get_building_location_code($component_arr['location_code']);
- $type = "component";
- }
- else
- {
- $type = "location";
- }
-
- $control = $this->so_control->get_single(
$check_list->get_control_id() );
-
- $year = date("Y", $deadline_ts);
- $month_nr = date("n", $deadline_ts);
-
- $data = array
- (
- 'location_array'
=> $location_array,
- 'component_array'
=> $component_array,
- 'control'
=> $control,
- 'check_list'
=> $check_list,
- 'type'
=> $type,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month_nr,
- 'building_location_code' =>
$building_location_code,
- 'location_level'
=> $level
- );
-
- $GLOBALS['phpgw']->jqcal->add_listener('planned_date');
-
$GLOBALS['phpgw']->jqcal->add_listener('completed_date');
-
- self::add_javascript('controller', 'controller',
'custom_ui.js');
- self::add_javascript('controller', 'controller',
'ajax.js');
- self::render_template_xsl(
array('check_list/add_check_list', 'check_list/nav_control_plan'), $data );
- }
-
- /**
- * Public function for displaying the edit check list form
- *
- * @param HTTP:: check list id
- * @return data array
- */
- function edit_check_list( $check_list = null){
- if($check_list == null)
- {
- $check_list_id =
phpgw::get_var('check_list_id');
- $check_list =
$this->so->get_single($check_list_id);
- }
-
- $control =
$this->so_control->get_single($check_list->get_control_id());
-
- $component_id = $check_list->get_component_id();
+ $this->location_finder = new location_finder();
- if($component_id > 0)
- {
- $location_id = $check_list->get_location_id();
- $component_id = $check_list->get_component_id();
-
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
- $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
-
- $component = new controller_component();
- $component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
- $component_array = $component->toArray();
-
- $type = 'component';
- $building_location_code =
$this->get_building_location_code($component_arr['location_code']);
- }
- else
- {
- $location_code =
$check_list->get_location_code();
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
- $type = 'location';
- $level =
$this->get_location_level($location_code);
- }
-
- $year = date("Y", $check_list->get_deadline());
- $month = date("n", $check_list->get_deadline());
-
- $data = array
- (
- 'control'
=> $control,
- 'check_list'
=> $check_list,
- 'location_array'
=> $location_array,
- 'component_array'
=> $component_array,
- 'type'
=> $type,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month,
- 'building_location_code' =>
$building_location_code,
- 'location_level'
=> $level
- );
-
- $GLOBALS['phpgw']->jqcal->add_listener('planned_date');
-
$GLOBALS['phpgw']->jqcal->add_listener('completed_date');
- $GLOBALS['phpgw']->jqcal->add_listener('deadline_date');
+ self::set_active_menu('controller::control::check_list');
+ }
- self::add_javascript('controller', 'controller',
'custom_ui.js');
- self::add_javascript('controller', 'controller',
'ajax.js');
-
-
self::render_template_xsl(array('check_list/check_list_tab_menu',
'check_list/nav_control_plan', 'check_list/edit_check_list'), $data);
- }
-
- /**
- * Public function for saving a check list
- *
- * @param HTTP:: location code, control id, status etc.. (check
list details)
- * @return data array
- */
- function save_check_list()
- {
- $check_list_id = phpgw::get_var('check_list_id');
- $control_id = phpgw::get_var('control_id');
- $status = (int)phpgw::get_var('status');
- $type = phpgw::get_var('type');
- $deadline_date = phpgw::get_var('deadline_date',
'string');
- $planned_date = phpgw::get_var('planned_date',
'string');
- $completed_date = phpgw::get_var('completed_date',
'string');
- $comment = phpgw::get_var('comment', 'string');
-
- $deadline_date_ts = date_converter::date_to_timestamp(
$deadline_date );
-
- if($planned_date != '')
- {
- $planned_date_ts =
phpgwapi_datetime::date_to_timestamp( $planned_date );
- }
- else
- {
- $planned_date_ts = 0;
- }
-
- if($completed_date != '')
- {
- $completed_date_ts =
phpgwapi_datetime::date_to_timestamp( $completed_date );
- $status = controller_check_list::STATUS_DONE;
- }
- else
- {
- $completed_date_ts = 0;
- }
+ /**
+ * Public function for displaying checklists
+ *
+ * @param HTTP:: phpgw_return_as
+ * @return data array
+ */
+ public function index()
+ {
+ if(phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ return $this->query();
+ }
+ self::add_javascript('phpgwapi', 'yahoo', 'datatable.js');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('paginator');
- if($check_list_id > 0)
- {
- $check_list =
$this->so->get_single($check_list_id);
- }
- else
- {
- $check_list = new controller_check_list();
- $check_list->set_control_id($control_id);
- $location_code =
phpgw::get_var('location_code');
- $check_list->set_location_code( $location_code
);
-
- if($type == "component")
- {
- $location_id =
phpgw::get_var('location_id');
- $component_id =
phpgw::get_var('component_id');
- $check_list->set_location_id(
$location_id );
- $check_list->set_component_id(
$component_id );
- }
- }
-
- $check_list->set_status($status);
- $check_list->set_comment($comment);
- $check_list->set_deadline( $deadline_date_ts );
- $check_list->set_planned_date($planned_date_ts);
- $check_list->set_completed_date($completed_date_ts);
+ $data = array(
+ 'datatable_name' => 'Sjekkliste (Ikke i bruk)',
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array('type' => 'filter',
+ 'name' => 'status',
+ 'text' => lang('Status'),
+ 'list' => array(
+ array(
+ 'id' => 'none',
+ 'name' => lang('Not selected')
+ ),
+ array(
+ 'id' => 'NEW',
+ 'name' => lang('NEW')
+ ),
+ array(
+ 'id' => 'PENDING',
+ 'name' => lang('PENDING')
+ ),
+ array(
+ 'id' => 'REJECTED',
+ 'name' => lang('REJECTED')
+ ),
+ array(
+ 'id' => 'ACCEPTED',
+ 'name' => lang('ACCEPTED')
+ )
+ )
+ ),
+ array('type' => 'text',
+ 'text' => lang('searchfield'),
+ 'name' => 'query'
+ ),
+ array(
+ 'type' => 'submit',
+ 'name' => 'search',
+ 'value' => lang('Search')
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' => self::link(array('menuaction' =>
'controller.uicheck_list.index', 'phpgw_return_as' => 'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' => lang('ID'),
+ 'sortable' => true,
+ 'formatter' => 'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' => 'title',
+ 'label' => lang('Control title'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'start_date',
+ 'label' => lang('start_date'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'planned_date',
+ 'label' => lang('planned_date'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'end_date',
+ 'label' => lang('end_date'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ )
+ )
+ ),
+ );
- if( $check_list->validate() )
- {
- $check_list_id = $this->so->store($check_list);
-
- $cl_status_updater = new check_list_status_updater();
- $cl_status_updater->update_check_list_status( $check_list_id );
-
- if( $check_list_id > 0 )
- {
- $this->redirect(array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
- }
- else{
- $this->edit_check_list($check_list);
- }
- }
- else
- {
- if($check_list->get_id() > 0)
- {
- $this->edit_check_list($check_list);
- }
- else
- {
- $this->add_check_list($check_list);
- }
- }
- }
-
- function view_cases_for_check_list()
- {
- $check_list_id = phpgw::get_var('check_list_id');
-
- $check_list = $this->so->get_single($check_list_id);
- $control =
$this->so_control->get_single($check_list->get_control_id());
-
- $component_id = $check_list->get_component_id();
+ self::render_template_xsl('datatable_common', $data);
+ }
- if($component_id > 0)
- {
- $location_id = $check_list->get_location_id();
- $component_id = $check_list->get_component_id();
-
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
- $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
-
- $component = new controller_component();
- $component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
- $component_array = $component->toArray();
-
- $type = 'component';
- $building_location_code =
$this->get_building_location_code($component_arr['location_code']);
- }
- else
- {
- $location_code =
$check_list->get_location_code();
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
- $type = 'location';
- $level =
$this->get_location_level($location_code);
- }
-
- $level = $this->get_location_level($location_code);
- $year = date("Y", $check_list->get_deadline());
- $month = date("n", $check_list->get_deadline());
-
- $data = array
- (
- 'control'
=> $control,
- 'check_list'
=> $check_list,
- 'location_array'
=> $location_array,
- 'component_array'
=> $component_array,
- 'type'
=> $type,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month,
- 'building_location_code' =>
$building_location_code,
- 'location_level'
=> $level,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month
- );
+ /**
+ * Public function for displaying the add check list form
+ *
+ * @param HTTP:: location code, control id, date
+ * @return data array
+ */
+ function add_check_list($check_list = null)
+ {
+ if($check_list == null)
+ {
+ $type = phpgw::get_var('type');
+ $control_id = phpgw::get_var('control_id');
+ $deadline_ts = phpgw::get_var('deadline_ts');
- phpgwapi_jquery::load_widget('core');
- self::add_javascript('controller', 'controller',
'custom_ui.js');
- self::add_javascript('controller', 'controller',
'ajax.js');
-
-
self::render_template_xsl(array('check_list/check_list_tab_menu',
'check_list/nav_control_plan', 'check_list/view_cases_for_check_list'), $data);
- }
-
- public function print_check_list()
- {
- $check_list_id = phpgw::get_var('check_list_id');
- $check_list = $this->so->get_single($check_list_id);
-
- $control =
$this->so_control->get_single($check_list->get_control_id());
- $control_groups =
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
-
- $saved_groups_with_items_array = array();
-
- //Populating array with saved control items for each
group
- foreach ($control_groups as $control_group)
- {
- $saved_control_items =
$this->so_control_item_list->get_control_items_by_control_and_group($control->get_id(),
$control_group->get_id());
-
- $control_item =
$this->so_control_item->get_single($control_item_id);
-
- $saved_groups_with_items_array[] =
array("control_group" => $control_group->toArray(), "control_items" =>
$saved_control_items);
- }
-
- $data = array
- (
- 'saved_groups_with_items_array' =>
$saved_groups_with_items_array,
- 'check_list'
=> $check_list
- );
-
-
self::render_template_xsl('check_list/print_check_list', $data);
- }
-
- public function view_control_info()
- {
- $check_list_id = phpgw::get_var('check_list_id');
-
- $check_list = $this->so->get_single($check_list_id);
- $control =
$this->so_control->get_single($check_list->get_control_id());
-
- $component_id = $check_list->get_component_id();
+ $check_list = new controller_check_list();
+ $check_list->set_control_id($control_id);
+ $check_list->set_deadline($deadline_ts);
+ } else
+ {
+ if($check_list->get_component_id() > 0)
+ {
+ $type = "component";
+ } else
+ {
+ $type = "location";
+ }
+ }
- if($component_id > 0)
- {
- $location_id = $check_list->get_location_id();
- $component_id = $check_list->get_component_id();
-
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
- $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
-
- $component = new controller_component();
- $component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
- $component_array = $component->toArray();
-
- $type = 'component';
- $building_location_code =
$this->get_building_location_code($component_arr['location_code']);
- }
- else
- {
- $location_code =
$check_list->get_location_code();
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
- $type = 'location';
- $level =
$this->get_location_level($location_code);
- }
-
- $year = date("Y", $check_list->get_deadline());
- $month = date("n", $check_list->get_deadline());
-
- $data = array
- (
- 'control'
=> $control,
- 'check_list'
=> $check_list,
- 'location_array'
=> $location_array,
- 'component_array'
=> $component_array,
- 'type'
=> $type,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month,
- 'building_location_code' =>
$building_location_code,
- 'location_level'
=> $level
- );
+ if(!$location_code = $check_list->get_location_code())
+ {
+ $location_code = phpgw::get_var('location_code');
+ $check_list->set_location_code($location_code);
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$check_list->get_location_code()));
+ $level =
$this->location_finder->get_location_level($location_code);
+ }
- phpgwapi_jquery::load_widget('core');
-
-
self::render_template_xsl(array('check_list/check_list_tab_menu',
'check_list/nav_control_plan', 'check_list/view_control_info'), $data);
- }
-
- function view_control_details()
- {
- $control_id = phpgw::get_var('control_id');
-
- $control = $this->so_control->get_single($control_id);
-
- $data = array
- (
- 'control' => $control,
- );
-
-
self::render_template_xsl('check_list/view_control_details', $data);
- }
-
- // Displays control groups and control items for a check list
- function add_case()
- {
- $check_list_id = phpgw::get_var('check_list_id');
-
- $check_list = $this->so->get_single($check_list_id);
- $control =
$this->so_control->get_single($check_list->get_control_id());
-
- $saved_control_groups =
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
-
- $control_groups_with_items_array = array();
-
- $component_id = $check_list->get_component_id();
+ if($type == "component")
+ {
+ if($check_list != null)
+ {
+ $location_id = phpgw::get_var('location_id');
+ $check_list->set_location_id($location_id);
+ $component_id = phpgw::get_var('component_id');
+ $check_list->set_component_id($component_id);
+ }
- if($component_id > 0)
- {
- $location_id = $check_list->get_location_id();
- $component_id = $check_list->get_component_id();
-
- $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
- $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
-
- $component = new controller_component();
- $component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
- $component_array = $component->toArray();
-
- $type = 'component';
- $building_location_code =
$this->get_building_location_code($component_arr['location_code']);
- }
- else
- {
- $location_code =
$check_list->get_location_code();
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
- $type = 'location';
- }
-
- //Populating array with saved control items for each
group
- foreach ($saved_control_groups as $control_group)
- {
- $saved_control_items =
$this->so_control_item_list->get_control_items_and_options_by_control_and_group($control->get_id(),
$control_group->get_id(), "return_array");
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
- if(count($saved_control_items) > 0)
- {
- $control_groups_with_items_array[] =
array("control_group" => $control_group->toArray(), "control_items" =>
$saved_control_items);
- }
- }
-
- /* ================ Ikke slett!!! Kode som henter ut
utstyr basert på lokasjon ==================
-
- //get control items based on control group/component
connection
- $control_groups_for_control =
$this->so_control_group->get_control_group_ids_for_control($control->get_id());
- //_debug_array($control_groups_for_control);
+ $component = new controller_component();
+ $component->set_location_code($component_arr['location_code']);
+ $component->set_xml_short_desc($short_desc);
- foreach($control_groups_for_control as $cg)
- {
- $components_for_control_group[] = array($cg =>
$this->so_control_group->get_components_for_control_group($cg));
- }
-
- //_debug_array($components_for_control_group);
-
- $control_group_check_items = array();
- foreach($components_for_control_group as $cg_components)
- {
- foreach($control_groups_for_control as
$cg_control)
- {
- $components =
$cg_components[$cg_control];
- //_debug_array($components);
- $location_has_component = false;
- foreach($components as $comp)
- {
- if(!$location_has_component)
- {
- //check if current
location has component
- $location_has_component
= $this->so_control_item->location_has_component($comp,
$check_list->get_location_code);
- }
- }
- if($location_has_component)
- {
- //the check items for the
control group shall be added
- $check_items =
$this->so_control_item->get_items_for_control_group($control->get_id(),
$cg_control);
- $control_group_check_items[] =
$check_items;
- }
- }
- }
-
=====================================================================*/
- //_debug_array($control_group_check_items);
-
-
-
- $level = $this->get_location_level($location_code);
- $year = date("Y", $check_list->get_deadline());
- $month = date("n", $check_list->get_deadline());
-
- $data = array
- (
- 'control'
=> $control,
- 'check_list'
=> $check_list,
- 'location_array'
=> $location_array,
- 'component_array'
=> $component_array,
- 'control_groups_with_items_array' =>
$control_groups_with_items_array,
- 'type'
=>
$type,
- 'location_level'
=> $level,
- 'building_location_code'
=> $building_location_code,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month
- );
-
- phpgwapi_jquery::load_widget('core');
+ $component_array = $component->toArray();
+ $building_location_code =
$this->location_finder->get_building_location_code($component_arr['location_code']);
+ $type = "component";
+ } else
+ {
+ $type = "location";
+ }
- self::add_javascript('controller', 'controller',
'custom_ui.js');
- self::add_javascript('controller', 'controller',
'ajax.js');
-
-
self::render_template_xsl(array('check_list/check_list_tab_menu',
'check_list/nav_control_plan', 'check_list/add_case'), $data);
- }
-
- function view_open_cases()
- {
- $check_list_id = phpgw::get_var('check_list_id');
-
- $check_list = $this->so->get_single($check_list_id);
+ $control =
$this->so_control->get_single($check_list->get_control_id());
- $open_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null,
'open_or_waiting', null, 'return_array');
+ $year = date("Y", $deadline_ts);
+ $month_nr = date("n", $deadline_ts);
- foreach($open_check_items_and_cases as $key =>
$check_item)
- {
- $control_item_with_options =
$this->so_control_item->get_single_with_options($check_item['control_item_id'],
"return_array");
- $check_item['control_item']['options_array'] =
$control_item_with_options['options_array'];
- $open_check_items_and_cases[$key] = $check_item;
- }
+ $level =
$this->location_finder->get_location_level($location_code);
+ $user_role = true;
- $data = array
- (
- 'open_check_items_and_cases' =>
$open_check_items_and_cases,
- 'check_list'
=> $check_list
- );
-
- self::render_template_xsl(
array('check_list/cases_tab_menu', 'check_list/view_open_cases',
'check_list/case_row'), $data );
- }
-
- function view_closed_cases()
- {
- $check_list_id = phpgw::get_var('check_list_id');
-
- $check_list = $this->so->get_single($check_list_id);
-
- $closed_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null,
'closed', null, 'return_array');
+ // Fetches buildings on property
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
- $data = array
- (
- 'closed_check_items_and_cases'
=> $closed_check_items_and_cases,
- 'check_list'
=> $check_list
- );
-
- self::render_template_xsl(
array('check_list/cases_tab_menu', 'check_list/view_closed_cases'), $data );
- }
-
- function view_control_items()
+ $data = array
+ (
+ 'location_array' => $location_array,
+ 'component_array' => $component_array,
+ 'control' => $control,
+ 'check_list' => $check_list,
+ 'buildings_on_property' => $buildings_on_property,
+ 'type' => $type,
+ 'current_year' => $year,
+ 'current_month_nr' => $month_nr,
+ 'building_location_code' => $building_location_code,
+ 'location_level' => $level,
+ 'check_list_type' => 'add_check_list'
+ );
+
+ $GLOBALS['phpgw']->jqcal->add_listener('planned_date');
+ $GLOBALS['phpgw']->jqcal->add_listener('completed_date');
+
+ self::add_javascript('controller', 'controller', 'custom_ui.js');
+ self::add_javascript('controller', 'controller', 'ajax.js');
+ self::add_javascript('controller', 'controller', 'check_list.js');
+
+ self::render_template_xsl(array('check_list/add_check_list',
'check_list/fragments/nav_control_plan',
+ 'check_list/fragments/check_list_top_section',
'check_list/fragments/add_check_list_menu',
+ 'check_list/fragments/select_buildings_on_property'), $data);
+ }
+
+ /**
+ * Public function for displaying the edit check list form
+ *
+ * @param HTTP:: check list id
+ * @return data array
+ */
+ function edit_check_list($check_list = null)
+ {
+ if($check_list == null)
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+ $check_list = $this->so->get_single($check_list_id);
+ }
+
+ $control =
$this->so_control->get_single($check_list->get_control_id());
+
+ $component_id = $check_list->get_component_id();
+
+ if($component_id > 0)
+ {
+ $location_id = $check_list->get_location_id();
+ $component_id = $check_list->get_component_id();
+
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+
+ $component = new controller_component();
+ $component->set_location_code($component_arr['location_code']);
+ $component->set_xml_short_desc($short_desc);
+ $component_array = $component->toArray();
+
+ $type = 'component';
+ $building_location_code =
$this->location_finder->get_building_location_code($component_arr['location_code']);
+ } else
+ {
+ $location_code = $check_list->get_location_code();
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ $type = 'location';
+ $level =
$this->location_finder->get_location_level($location_code);
+ }
+
+ $year = date("Y", $check_list->get_deadline());
+ $month = date("n", $check_list->get_deadline());
+
+ $level =
$this->location_finder->get_location_level($location_code);
+ $user_role = true;
+
+ // Fetches buildings on property
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
+
+ $data = array
+ (
+ 'control' => $control,
+ 'check_list' => $check_list,
+ '$buildings_on_property' => $buildings_on_property,
+ 'location_array' => $location_array,
+ 'component_array' => $component_array,
+ 'type' => $type,
+ 'current_year' => $year,
+ 'current_month_nr' => $month,
+ 'building_location_code' => $building_location_code,
+ 'location_level' => $level
+ );
+
+ $GLOBALS['phpgw']->jqcal->add_listener('planned_date');
+ $GLOBALS['phpgw']->jqcal->add_listener('completed_date');
+ $GLOBALS['phpgw']->jqcal->add_listener('deadline_date');
+
+ self::add_javascript('controller', 'controller', 'custom_ui.js');
+ self::add_javascript('controller', 'controller', 'ajax.js');
+ self::add_javascript('controller', 'controller', 'check_list.js');
+
+
self::render_template_xsl(array('check_list/fragments/check_list_menu',
'check_list/fragments/nav_control_plan',
+ 'check_list/fragments/check_list_top_section',
'check_list/edit_check_list',
+ 'check_list/fragments/select_buildings_on_property'), $data);
+ }
+
+ /**
+ * Public function for saving a check list
+ *
+ * @param HTTP:: location code, control id, status etc.. (check list
details)
+ * @return data array
+ */
+ function save_check_list()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+ $control_id = phpgw::get_var('control_id');
+ $status = (int) phpgw::get_var('status');
+ $type = phpgw::get_var('type');
+ $deadline_date = phpgw::get_var('deadline_date', 'string');
+ $planned_date = phpgw::get_var('planned_date', 'string');
+ $completed_date = phpgw::get_var('completed_date', 'string');
+ $comment = phpgw::get_var('comment', 'string');
+
+ $deadline_date_ts =
date_converter::date_to_timestamp($deadline_date);
+
+ if($planned_date != '')
+ {
+ $planned_date_ts =
date_converter::date_to_timestamp($planned_date);
+ } else
+ {
+ $planned_date_ts = 0;
+ }
+
+ if($completed_date != '')
+ {
+ $completed_date_ts =
phpgwapi_datetime::date_to_timestamp($completed_date);
+ $status = controller_check_list::STATUS_DONE;
+ } else
+ {
+ $completed_date_ts = 0;
+ }
+
+ if($check_list_id > 0)
+ {
+ $check_list = $this->so->get_single($check_list_id);
+ } else
+ {
+ $check_list = new controller_check_list();
+ $check_list->set_control_id($control_id);
+ $location_code = phpgw::get_var('location_code');
+ $check_list->set_location_code($location_code);
+
+ if($type == "component")
+ {
+ $location_id = phpgw::get_var('location_id');
+ $component_id = phpgw::get_var('component_id');
+ $check_list->set_location_id($location_id);
+ $check_list->set_component_id($component_id);
+ }
+ }
+
+ $check_list->set_status($status);
+ $check_list->set_comment($comment);
+ $check_list->set_deadline($deadline_date_ts);
+ $check_list->set_planned_date($planned_date_ts);
+ $check_list->set_completed_date($completed_date_ts);
+
+ if($check_list->validate())
+ {
+ $check_list_id = $this->so->store($check_list);
+
+ $cl_status_updater = new check_list_status_updater();
+ $cl_status_updater->update_check_list_status($check_list_id);
+
+ if($check_list_id > 0)
+ {
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
+ } else
+ {
+ $this->edit_check_list($check_list);
+ }
+ } else
+ {
+ if($check_list->get_id() > 0)
+ {
+ $this->edit_check_list($check_list);
+ } else
+ {
+ $this->add_check_list($check_list);
+ }
+ }
+ }
+
+ function view_control_info()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+
+ $check_list = $this->so->get_single($check_list_id);
+ $control =
$this->so_control->get_single($check_list->get_control_id());
+
+ $component_id = $check_list->get_component_id();
+
+ if($component_id > 0)
+ {
+ $location_id = $check_list->get_location_id();
+ $component_id = $check_list->get_component_id();
+
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+
+ $component = new controller_component();
+ $component->set_location_code($component_arr['location_code']);
+ $component->set_xml_short_desc($short_desc);
+ $component_array = $component->toArray();
+
+ $type = 'component';
+ $building_location_code =
$this->location_finder->get_building_location_code($component_arr['location_code']);
+ } else
+ {
+ $location_code = $check_list->get_location_code();
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ $type = 'location';
+ $level =
$this->location_finder->get_location_level($location_code);
+ }
+
+ $year = date("Y", $check_list->get_deadline());
+ $month = date("n", $check_list->get_deadline());
+
+ $level =
$this->location_finder->get_location_level($location_code);
+ $user_role = true;
+
+ // Fetches buildings on property
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
+
+ $data = array
+ (
+ 'control' => $control,
+ 'check_list' => $check_list,
+ 'buildings_on_property' => $buildings_on_property,
+ 'location_array' => $location_array,
+ 'component_array' => $component_array,
+ 'type' => $type,
+ 'current_year' => $year,
+ 'current_month_nr' => $month,
+ 'building_location_code' => $building_location_code,
+ 'location_level' => $level
+ );
+
+ phpgwapi_jquery::load_widget('core');
+
+
self::render_template_xsl(array('check_list/fragments/check_list_menu',
'check_list/fragments/check_list_top_section',
+ 'check_list/fragments/nav_control_plan',
'check_list/view_control_info',
+ 'check_list/fragments/select_buildings_on_property'), $data);
+ }
+
+ function view_control_details()
+ {
+ $control_id = phpgw::get_var('control_id');
+
+ $control = $this->so_control->get_single($control_id);
+
+ $data = array
+ (
+ 'control' => $control,
+ );
+
+ self::render_template_xsl('check_list/view_control_details',
$data);
+ }
+
+ function view_control_items()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+ $check_list = $this->so->get_single($check_list_id);
+
+ $control =
$this->so_control->get_single($check_list->get_control_id());
+ $control_groups =
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
+
+ $saved_groups_with_items_array = array();
+
+ //Populating array with saved control items for each group
+ foreach($control_groups as $control_group)
+ {
+ $saved_control_items =
$this->so_control_item_list->get_control_items_by_control_and_group($control->get_id(),
$control_group->get_id());
+
+ $control_item =
$this->so_control_item->get_single($control_item_id);
+
+ $saved_groups_with_items_array[] = array("control_group" =>
$control_group->toArray(), "control_items" => $saved_control_items);
+ }
+
+ $data = array
+ (
+ 'saved_groups_with_items_array' =>
$saved_groups_with_items_array,
+ 'check_list' => $check_list
+ );
+
+ self::render_template_xsl('check_list/view_control_items', $data);
+ }
+
+ public function print_check_list()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+ $check_list = $this->so->get_single($check_list_id);
+
+ $control =
$this->so_control->get_single($check_list->get_control_id());
+ $control_groups =
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
+
+ $saved_groups_with_items_array = array();
+
+ //Populating array with saved control items for each group
+ foreach($control_groups as $control_group)
+ {
+ $saved_control_items =
$this->so_control_item_list->get_control_items_by_control_and_group($control->get_id(),
$control_group->get_id());
+
+ $control_item =
$this->so_control_item->get_single($control_item_id);
+
+ $saved_groups_with_items_array[] = array("control_group" =>
$control_group->toArray(), "control_items" => $saved_control_items);
+ }
+
+ $data = array
+ (
+ 'saved_groups_with_items_array' =>
$saved_groups_with_items_array,
+ 'check_list' => $check_list
+ );
+
+ self::render_template_xsl('check_list/print_check_list', $data);
+ }
+
+ // Returns check list info as JSON
+ public function get_check_list_info()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+ $check_list =
$this->so_check_list->get_single_with_check_items($check_list_id, "open");
+
+ return json_encode($check_list);
+ }
+
+ // Returns open cases for a check list as JSON
+ public function get_cases_for_check_list()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+
+ $check_items_with_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open",
null);
+
+ return json_encode($check_items_with_cases);
+ }
+
+ /**
+ * Public function for updateing status for a check list
+ *
+ * @return json encoded array with status saved or not saved
+ */
+ public function update_status()
{
$check_list_id = phpgw::get_var('check_list_id');
+ $check_list_status = phpgw::get_var('status');
+
$check_list = $this->so->get_single($check_list_id);
-
- $control =
$this->so_control->get_single($check_list->get_control_id());
- $control_groups =
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
- $saved_groups_with_items_array = array();
-
- //Populating array with saved control items for each
group
- foreach ($control_groups as $control_group)
- {
- $saved_control_items =
$this->so_control_item_list->get_control_items_by_control_and_group($control->get_id(),
$control_group->get_id());
-
- $control_item =
$this->so_control_item->get_single($control_item_id);
-
- $saved_groups_with_items_array[] =
array("control_group" => $control_group->toArray(), "control_items" =>
$saved_control_items);
- }
-
- $data = array
- (
- 'saved_groups_with_items_array' =>
$saved_groups_with_items_array,
- 'check_list'
=> $check_list
- );
-
-
self::render_template_xsl('check_list/view_control_items', $data);
- }
-
- // Returns check list info as JSON
- public function get_check_list_info()
- {
- $check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single_with_check_items($check_list_id, "open");
-
- return json_encode( $check_list );
- }
-
- // Returns open cases for a check list as JSON
- public function get_cases_for_check_list()
- {
- $check_list_id = phpgw::get_var('check_list_id');
+ $check_list->set_status( $check_list_status );
- $check_items_with_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open",
null, "return_array");
-
- return json_encode( $check_items_with_cases );
- }
-
- function get_building_location_code($location_code)
- {
- if( strlen( $location_code ) == 6 )
+ if($this->so->store($check_list))
{
- $location_code_arr = explode('-',
$location_code, 2);
- $building_location_code = $location_code_arr[0];
+ return json_encode( array( 'status' =>
$check_list_status) );
}
- else if( strlen( $location_code ) > 6 )
- {
- $location_code_arr = explode('-',
$location_code, 3);
- $building_location_code = $location_code_arr[0]
. "-" . $location_code_arr[1];
- }
else
{
- $building_location_code = $location_code;
+ return json_encode( array( "status" =>
'not_saved') );
}
-
- return $building_location_code;
}
-
- function get_location_level($location_code)
- {
- $level = count(explode('-', $location_code));
- return $level;
- }
-
- public function query(){}
- }
+ public function query()
+ {
+
+ }
+
+ }
Modified:
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -66,8 +66,6 @@
$this->bo =
CreateObject('property.bolocation',true);
$this->bocommon = &
$this->bo->bocommon;
$this->so_control =
CreateObject('controller.socontrol');
- //$this->so_bim =
CreateObject('bim.sobimitem_impl');
- //$this->so_bim = new
sobimitem_impl();
$this->type_id =
$this->bo->type_id;
@@ -283,20 +281,6 @@
public function get_component()
{
- /*$start =
phpgw::get_var('start', 'int', 'REQUEST', 0);
- $query =
phpgw::get_var('query');
- $sort =
phpgw::get_var('sort');
- $order =
phpgw::get_var('order');
- $filter =
phpgw::get_var('filter', 'int');
- $cat_id =
phpgw::get_var('cat_id');
- $lookup_tenant =
phpgw::get_var('lookup_tenant', 'bool');
- $district_id =
phpgw::get_var('district_id', 'int');
- $part_of_town_id =
phpgw::get_var('part_of_town_id', 'int');
- $status =
phpgw::get_var('status');
- $type_id =
phpgw::get_var('type_id', 'int');
- $allrows =
phpgw::get_var('allrows', 'bool');
- $location_code =
phpgw::get_var('location_code');*/
-
$type_id = phpgw::get_var('bim_type_id');
$start = phpgw::get_var('startIndex');
Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -78,7 +78,7 @@
public function __construct()
{
- parent::__construct();
+ parent::__construct('controller');
$read = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_READ, 'controller');//1
$add = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_ADD, 'controller');//2
Property changes on:
branches/Version-1_0-branch/controller/inc/class.uicontrol_group_component.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -26,7 +26,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/
* @package property
* @subpackage controller
- * @version $Id: class.uicheck_list.inc.php 8628 2012-01-21 10:42:05Z
vator $
+ * @version $Id$
*/
phpgw::import_class('phpgwapi.yui');
Property changes on:
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -26,7 +26,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/
* @package property
* @subpackage controller
- * @version $Id: class.uicheck_list.inc.php 8628 2012-01-21 10:42:05Z
vator $
+ * @version $Id$
*/
phpgw::import_class('phpgwapi.yui');
Property changes on:
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Modified:
branches/Version-1_0-branch/controller/inc/component/class.check_list_status_manager.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/component/class.check_list_status_manager.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++
branches/Version-1_0-branch/controller/inc/component/class.check_list_status_manager.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -25,7 +25,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/
* @package property
* @subpackage controller
- * @version $Id: class.check_list_status_info.inc.php 8885 2012-02-16
07:41:15Z vator $
+ * @version $Id$
*/
include_class('controller', 'check_list_status_info', 'inc/component/');
Property changes on:
branches/Version-1_0-branch/controller/inc/component/class.check_list_status_manager.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Property changes on:
branches/Version-1_0-branch/controller/inc/component/class.month_calendar.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Modified:
branches/Version-1_0-branch/controller/inc/component/class.status_agg_month_info.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/component/class.status_agg_month_info.inc.php
2013-02-28 14:43:23 UTC (rev 10939)
+++
branches/Version-1_0-branch/controller/inc/component/class.status_agg_month_info.inc.php
2013-02-28 16:53:55 UTC (rev 10940)
@@ -25,7 +25,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/
* @package property
* @subpackage controller
- * @version $Id: class.check_list_status_info.inc.php 8571 2012-01-15
13:46:27Z vator $
+ * @version $Id$
*/
class status_agg_month_info
Property changes on:
branches/Version-1_0-branch/controller/inc/component/class.status_agg_month_info.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Property changes on:
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Property changes on:
branches/Version-1_0-branch/controller/inc/component/class.year_calendar_agg.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Modified:
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
===================================================================
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10940] Merge 10797:10939 from trunk,
Sigurd Nes <=