[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10074] Merge 10032:10073 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10074] Merge 10032:10073 from trunk |
Date: |
Mon, 01 Oct 2012 19:07:48 +0000 |
Revision: 10074
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10074
Author: sigurdne
Date: 2012-10-01 19:07:48 +0000 (Mon, 01 Oct 2012)
Log Message:
-----------
Merge 10032:10073 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
branches/Version-1_0-branch/controller/inc/class.menu.inc.php
branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
branches/Version-1_0-branch/controller/inc/class.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_group.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
branches/Version-1_0-branch/controller/inc/class.uiprocedure.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/js/controller/ajax.js
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_location.js
branches/Version-1_0-branch/controller/templates/base/check_list/add_case.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
branches/Version-1_0-branch/controller/templates/base/control_group/control_groups.xsl
branches/Version-1_0-branch/controller/templates/base/control_item/choose_control_items.xsl
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_documents.xsl
branches/Version-1_0-branch/logistic/inc/class.menu.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.model.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.project.inc.php
branches/Version-1_0-branch/logistic/setup/phpgw_no.lang
branches/Version-1_0-branch/phpgwapi/inc/class.datetime.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.jqcal.inc.php
branches/Version-1_0-branch/phpgwapi/inc/functions.inc.php
branches/Version-1_0-branch/phpgwapi/js/yahoo/datatable.js
branches/Version-1_0-branch/phpgwapi/templates/base/datatable_common.xsl
branches/Version-1_0-branch/property/inc/class.boproject.inc.php
branches/Version-1_0-branch/property/inc/class.soproject.inc.php
branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
branches/Version-1_0-branch/property/inc/soap_client/braarkiv/soap.php
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/registration/inc/class.uipending.inc.php
branches/Version-1_0-branch/registration/templates/base/pending_users.xsl
Added Paths:
-----------
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.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/logistic/inc/class.soactivity.inc.php
branches/Version-1_0-branch/logistic/inc/class.socommon.inc.php
branches/Version-1_0-branch/logistic/inc/class.soproject.inc.php
branches/Version-1_0-branch/logistic/inc/class.uiactivity.inc.php
branches/Version-1_0-branch/logistic/inc/class.uiproject.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.activity.inc.php
branches/Version-1_0-branch/logistic/js/yahoo/
branches/Version-1_0-branch/logistic/templates/base/activity_item.xsl
branches/Version-1_0-branch/logistic/templates/base/app_data.xsl
branches/Version-1_0-branch/logistic/templates/base/config.tpl
branches/Version-1_0-branch/logistic/templates/base/css/
branches/Version-1_0-branch/logistic/templates/base/project_item.xsl
branches/Version-1_0-branch/logistic/templates/base/project_type_item.xsl
branches/Version-1_0-branch/phpgwapi/js/jquery/css/jquery-ui-timepicker-addon.css
branches/Version-1_0-branch/phpgwapi/js/jquery/js/jquery-ui-timepicker-addon.js
branches/Version-1_0-branch/property/inc/cron/default/organize_energy_pdf_bbb.php
branches/Version-1_0-branch/registration/js/yahoo/pending.index2.js
Removed Paths:
-------------
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_helper.inc.php
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
branches/Version-1_0-branch/controller/templates/base/control/controls_datatable.xsl
branches/Version-1_0-branch/controller/templates/base/control_group/control_groups_datatable.xsl
branches/Version-1_0-branch/controller/templates/base/control_item/control_items_datatable.xsl
branches/Version-1_0-branch/controller/templates/base/procedure/procedures_datatable.xsl
Property Changed:
----------------
branches/Version-1_0-branch/
branches/Version-1_0-branch/logistic/inc/class.menu.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.model.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.project.inc.php
branches/Version-1_0-branch/logistic/index.php
branches/Version-1_0-branch/logistic/setup/default_records.inc.php
branches/Version-1_0-branch/logistic/setup/setup.inc.php
branches/Version-1_0-branch/logistic/setup/tables_current.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
+
/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
Modified:
branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -68,7 +68,7 @@
'get_groups' => true,
'remove_old_activities' => true,
);
-
+
/**
* Get a static reference to the storage object associated with this
model object
*
@@ -81,7 +81,7 @@
}
return self::$so;
}
-
+
/**
* Generate SQL query
*
@@ -155,7 +155,7 @@
}
$filter_clauses = array();
-
+
if(isset($filters[$this->get_id_field_name()])){
$id =
$this->marshal($filters[$this->get_id_field_name()],'int');
$filter_clauses[] = "activity.id = {$id}";
@@ -195,7 +195,7 @@
$activity_district_corr = 1;
else
$activity_district_corr =
(int)$activity_district;
-
+
$filter_clauses[] = "activity.office =
'{$activity_district_corr}'";
}
}
@@ -235,7 +235,7 @@
$activity_district = 2;
else if ($activity_district == 2)
$activity_district = 1;
-
+
$filter_clauses[] = "activity.office =
'{$activity_district}'";
}
}
@@ -245,7 +245,7 @@
$filter_clauses[] = "activity.last_change_date
< {$ts_query}";
}
}
-
+
if(count($filter_clauses))
{
$clauses[] = join(' AND ', $filter_clauses);
@@ -282,8 +282,8 @@
$columns[] = 'activity.secret';
$columns[] = 'activity.frontend';
$columns[] = 'activity.new_org';
- $columns[] = 'activity.new_group';
-
+ $columns[] = 'activity.new_group';
+
$cols = implode(',',$columns);
}
@@ -291,7 +291,7 @@
//$join_contracts = " {$this->left_join}
rental_contract_party c_p ON (c_p.party_id = party.id)
//{$this->left_join} rental_contract contract ON (contract.id =
c_p.contract_id)";
-
+
//var_dump("SELECT {$cols} FROM {$tables} WHERE {$condition}
{$order}");
return "SELECT {$cols} FROM {$tables} WHERE {$condition}
{$order}";
}
@@ -334,7 +334,7 @@
{
$id = intval($activity->get_id());
$ts_now = strtotime('now');
-
+
$values = array(
'title = ' . $this->marshal($activity->get_title(),
'string'),
'organization_id = '.
$this->marshal($activity->get_organization_id(), 'int'),
@@ -358,18 +358,18 @@
'new_org = '
.($activity->get_new_org() ? "true" : "false"),
'new_group = '
.($activity->get_new_group() ? "true" : "false")
);
-
+
//var_dump('UPDATE activity_activity SET ' . join(',', $values)
. " WHERE id=$id");
$result = $this->db->query('UPDATE activity_activity SET ' .
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
return isset($result);
}
-
+
function import_activity($activity)
{
$id = intval($activity->get_id());
$ts_now = strtotime('now');
-
+
$columns = array(
'title',
'organization_id',
@@ -392,7 +392,7 @@
'secret',
'special_adaptation'
);
-
+
$values = array(
$this->marshal($activity->get_title(), 'string'),
$this->marshal($activity->get_organization_id(), 'int'),
@@ -415,7 +415,7 @@
$this->marshal($this->generate_secret(),'string'),
($activity->get_special_adaptation() ? "true" : "false")
);
-
+
$result = $this->db->query('INSERT INTO activity_activity (' .
join(',', $columns) . ') VALUES (' . join(',', $values) . ')',
__LINE__,__FILE__);
return isset($result);
@@ -465,7 +465,7 @@
$activity->set_frontend($this->unmarshal($this->db->f('frontend', 'bool')));
$activity->set_new_org($this->unmarshal($this->db->f('new_org', 'bool')));
$activity->set_new_group($this->unmarshal($this->db->f('new_group', 'bool')));
-
+
if($activity->get_group_id() &&
$activity->get_group_id() > 0)
{
if($activity->get_new_group())
@@ -496,12 +496,12 @@
$activity->set_contact_persons($contacts);
}
}
-
+
}
return $activity;
}
-
+
function get_category_name($category_id)
{
$result = "Ingen";
@@ -515,7 +515,7 @@
}
return $result;
}
-
+
function get_categories()
{
$categories = array();
@@ -529,7 +529,7 @@
}
return $categories;
}
-
+
function select_district_list()
{
$this->db->query("SELECT id, descr FROM fm_district where id
>'0' AND NOT descr LIKE '%vrige%' ORDER BY id ", __LINE__, __FILE__);
@@ -544,26 +544,26 @@
return $district;
}
-
+
function get_district_from_name($name)
{
$this->db->query("SELECT part_of_town_id FROM fm_part_of_town
where name like UPPER('%{$name}%') ", __LINE__, __FILE__);
while($this->db->next_record()){
$result = $this->db->f('part_of_town_id');
- }
+ }
return $result;
}
-
+
function get_district_from_id($d_id)
{
$this->db->query("SELECT name FROM fm_part_of_town where
part_of_town_id={$d_id} ", __LINE__, __FILE__);
while($this->db->next_record()){
$result = $this->db->f('name');
- }
+ }
return $result;
}
-
-
+
+
function get_district_name($district_id)
{
//$result = "Ingen";
@@ -582,7 +582,7 @@
}
return "";
}
-
+
function get_districts()
{
$this->db->query("SELECT part_of_town_id, name FROM
fm_part_of_town district_id ", __LINE__, __FILE__);
@@ -601,8 +601,8 @@
return $district;
}
-
-
+
+
function get_office_from_user($user_id)
{
if(user_id)
@@ -617,7 +617,7 @@
}
return $office_id;
}
-
+
function get_office_name($district_id)
{
$result = "Ingen";
@@ -631,7 +631,7 @@
}
return $result;
}
-
+
function get_office_description($office_id)
{
$result = "";
@@ -645,7 +645,7 @@
}
return $result;
}
-
+
function get_target_name($target_id)
{
$result = "Ingen";
@@ -659,7 +659,7 @@
}
return $result;
}
-
+
function get_targets()
{
$targets = array();
@@ -677,7 +677,7 @@
}
return $targets;
}
-
+
function get_category_from_name($name)
{
if($name != null)
@@ -690,7 +690,7 @@
}
return $result;
}
-
+
function get_target_from_sort_id($id)
{
if($id != null && is_numeric($id))
@@ -703,7 +703,7 @@
}
return $result;
}
-
+
function get_orgid_from_orgno($orgno)
{
if($orgno != null)
@@ -716,7 +716,7 @@
}
return $result;
}
-
+
function update_org_description($org_id, $description)
{
if($org_id != null)
@@ -726,7 +726,7 @@
}
return isset($result);
}
-
+
function set_org_active($org_id)
{
if($org_id != null)
@@ -736,7 +736,7 @@
}
return isset($result);
}
-
+
function get_activities($parameters = array())
{
$soap = isset($parameters['soap']) && $parameters['soap'] ?
true : false;
@@ -752,7 +752,7 @@
$sql = "SELECT * FROM activity_activity where state in (2,3,5)
{$whereclause_date}";
$this->db->query($sql, __LINE__, __FILE__);
while ($this->db->next_record())
- {
+ {
$gr = $this->db->f('group_id');
$activities[]= array
(
@@ -776,7 +776,7 @@
foreach ($activities as &$activity)
{
if($activity['group_id'] &&
!$activity['group_id'] == '' && !$activity['group_id'] == 0)
- {
+ {
$activity['group_info']
= $this->get_group_info($activity['group_id']);
$activity['organization_info'] =
$this->get_org_info($activity['group_info']['organization_id']);
}
@@ -795,7 +795,7 @@
//_debug_array($activities);
return $activities;
}
-
+
function get_contact_person($org_id, $group_id, $cont_pers)
{
if($group_id)
@@ -817,7 +817,7 @@
}
return $result;
}
-
+
function get_activity_description($org_id, $group_id)
{
if($group_id)
@@ -838,8 +838,8 @@
}
return $result;
}
-
+
function get_organizations()
{
$organizations = array();
@@ -865,7 +865,7 @@
// _debug_array($organizations);
return $organizations;
}
-
+
function get_org_info($org_id)
{
$result = array();
@@ -886,7 +886,7 @@
}
return $result;
}
-
+
function get_groups()
{
$groups = array();
@@ -924,7 +924,7 @@
}
}
-
+
function get_group_info($group_id)
{
$result = array();
@@ -944,7 +944,7 @@
}
return $result;
}
-
+
function get_all_arena_info($arena_id, $int_arena_id)
{
$result = array();
@@ -972,7 +972,7 @@
}
return $result;
}
-
+
function get_arena_info($arena_id)
{
$result = array();
@@ -989,7 +989,7 @@
}
return $result;
}
-
+
function get_internal_arena_info($arena_id)
{
$result = array();
@@ -1006,7 +1006,7 @@
}
return $result;
}
-
+
function get_statuscodes()
{
$statuscodes[] = array('id' => '0', 'name' =>
utf8_decode('Ingen'));
@@ -1018,7 +1018,7 @@
return $statuscodes;
}
-
+
function get_targetgroups()
{
$sql = "SELECT * FROM bb_agegroup where active=1 AND NOT name
like 'Tilskuer%' ORDER BY sort";
@@ -1032,7 +1032,7 @@
}
return $targets;
}
-
+
function get_category_list()
{
$sql = "SELECT * FROM bb_activity where active=1 and
parent_id=1";
@@ -1091,8 +1091,8 @@
$district = '';
}
$activity_id = $org_info['activity_id'];
- $show_in_portal = 1;
-
+ $show_in_portal = 1;
+
$values = array(
'name = ' . $this->marshal($name, 'string'),
'homepage = ' . $this->marshal($homepage, 'string'),
@@ -1106,7 +1106,7 @@
'activity_id = ' . $this->marshal($activity_id, 'int'),
'show_in_portal = 1'
);
-
+
$result = $this->db->query('UPDATE bb_organization SET ' .
join(',', $values) . " WHERE id=$orgid", __LINE__,__FILE__);
}
function add_organization($org_info)
@@ -1131,8 +1131,8 @@
}
$district = $org_info['district'];
$activity_id = $org_info['activity_id'];
- $show_in_portal = 1;
-
+ $show_in_portal = 1;
+
$columns[] = 'name';
$columns[] = 'homepage';
$columns[] = 'phone';
@@ -1146,7 +1146,7 @@
$columns[] = 'activity_id';
$columns[] = 'show_in_portal';
$cols = implode(',',$columns);
-
+
$values[] = "'{$name}'";
$values[] = "'{$homepage}'";
$values[] = "'{$phone}'";
@@ -1160,7 +1160,7 @@
$values[] = $this->marshal($activity_id, 'int');
$values[] = $show_in_portal;
$vals = implode(',',$values);
-
+
$sql = "INSERT INTO bb_organization ({$cols}) VALUES ({$vals})";
$result = $this->db->query($sql, __LINE__, __FILE__);
if(isset($result))
@@ -1172,7 +1172,7 @@
return 0;
}
}
-
+
function add_organization_local($org_info)
{
$name = $org_info['name'];
@@ -1192,7 +1192,7 @@
{
$original_org_id = 0;
}
-
+
$columns[] = 'name';
$columns[] = 'homepage';
$columns[] = 'phone';
@@ -1207,7 +1207,7 @@
$columns[] = 'change_type';
$columns[] = 'original_org_id';
$cols = implode(',',$columns);
-
+
$values[] = "'{$name}'";
$values[] = "'{$homepage}'";
$values[] = "'{$phone}'";
@@ -1222,7 +1222,7 @@
$values[] = "'{$status}'";
$values[] = $original_org_id;
$vals = implode(',',$values);
-
+
//var_dump("INSERT INTO activity_organization ({$cols}) VALUES
({$vals})");
$sql = "INSERT INTO activity_organization ({$cols}) VALUES
({$vals})";
$result = $this->db->query($sql, __LINE__, __FILE__);
@@ -1235,29 +1235,29 @@
return 0;
}
}
-
+
function add_group($group_info)
{
$name = $group_info['name'];
$orgid = $group_info['organization_id'];
$description = $group_info['description'];
$activity_id = $group_info['activity_id'];
- $show_in_portal = 1;
-
+ $show_in_portal = 1;
+
$columns[] = 'name';
$columns[] = 'description';
$columns[] = 'organization_id';
$columns[] = 'activity_id';
$columns[] = 'show_in_portal';
$cols = implode(',',$columns);
-
+
$values[] = "'{$name}'";
$values[] = "'{$description}'";
$values[] = "'{$orgid}'";
$values[] = $this->marshal($activity_id, 'int');
$values[] = $show_in_portal;
$vals = implode(',',$values);
-
+
$sql = "INSERT INTO bb_group ({$cols}) VALUES ({$vals})";
$result = $this->db->query($sql, __LINE__, __FILE__);
if(isset($result))
@@ -1269,26 +1269,26 @@
return 0;
}
}
-
+
function add_group_local($group_info)
{
$name = $group_info['name'];
$orgid = $group_info['organization_id'];
$description = $group_info['description'];
$status = $group_info['status'];
-
+
$columns[] = 'name';
$columns[] = 'description';
$columns[] = 'organization_id';
$columns[] = 'change_type';
$cols = implode(',',$columns);
-
+
$values[] = "'{$name}'";
$values[] = "'{$description}'";
$values[] = "'{$orgid}'";
$values[] = "'{$status}'";
$vals = implode(',',$values);
-
+
$sql = "INSERT INTO activity_group ({$cols}) VALUES ({$vals})";
$result = $this->db->query($sql, __LINE__, __FILE__);
if(isset($result))
@@ -1300,7 +1300,7 @@
return 0;
}
}
-
+
function delete_contact_persons($org_id)
{
if($org_id)
@@ -1318,7 +1318,7 @@
return isset($result);
}*/
}
-
+
function add_contact_person_org($contact)
{
$name = $contact['name'];
@@ -1326,60 +1326,60 @@
$mail = $contact['mail'];
$org_id = $contact['org_id'];
$ssn = '';
-
+
$columns[] = 'name';
$columns[] = 'ssn';
$columns[] = 'phone';
$columns[] = 'email';
$columns[] = 'organization_id';
$cols = implode(',',$columns);
-
+
$values[] = "'{$name}'";
$values[] = "'{$ssn}'";
$values[] = "'{$phone}'";
$values[] = "'{$mail}'";
$values[] = $org_id;
$vals = implode(',',$values);
-
+
$sql = "INSERT INTO bb_organization_contact ({$cols}) VALUES
({$vals})";
$result = $this->db->query($sql, __LINE__, __FILE__);
return isset($result);
}
-
+
function update_contact_person_org($contact)
{
-
+
}
-
+
function add_contact_person_group($contact)
{
$name = $contact['name'];
$phone = $contact['phone'];
$mail = $contact['mail'];
$org_id = $contact['group_id'];
-
+
$columns[] = 'name';
$columns[] = 'phone';
$columns[] = 'email';
$columns[] = 'group_id';
$cols = implode(',',$columns);
-
+
$values[] = "'{$name}'";
$values[] = "'{$phone}'";
$values[] = "'{$mail}'";
$values[] = $org_id;
$vals = implode(',',$values);
-
+
$sql = "INSERT INTO bb_group_contact ({$cols}) VALUES
({$vals})";
$result = $this->db->query($sql, __LINE__, __FILE__);
return isset($result);
}
-
+
function update_contact_person_group($contact)
{
-
+
}
-
+
function add_contact_person_local($contact)
{
$name = $contact['name'];
@@ -1387,17 +1387,17 @@
$mail = $contact['mail'];
$org_id = $contact['org_id'];
$group_id = $contact['group_id'];
-
+
$columns[] = 'name';
$columns[] = 'phone';
$columns[] = 'email';
$columns[] = 'organization_id';
$columns[] = 'group_id';
$columns[] = 'address';
- $columns[] = 'zipcode';
+ $columns[] = 'zipcode';
$columns[] = 'city';
$cols = implode(',',$columns);
-
+
$values[] = "'{$name}'";
$values[] = "'{$phone}'";
$values[] = "'{$mail}'";
@@ -1407,13 +1407,13 @@
$values[] = "''";
$values[] = "''";
$vals = implode(',',$values);
-
+
//var_dump("INSERT INTO activity_contact_person ({$cols})
VALUES ({$vals})");
$sql = "INSERT INTO activity_contact_person ({$cols}) VALUES
({$vals})";
$result = $this->db->query($sql, __LINE__, __FILE__);
return isset($result);
}
-
+
function get_activities_for_update($org_id, $group = false)
{
$activity_ids = array();
@@ -1431,10 +1431,10 @@
{
$activity_ids[] = $this->db->f('id');
}
-
+
return $activity_ids;
}
-
+
function get_connected_activities($org_id)
{
$activities = array();
@@ -1442,7 +1442,7 @@
$this->db->query($sql, __LINE__, __FILE__);
while ($this->db->next_record())
- {
+ {
$activity = new activitycalendar_activity((int)
$this->db->f('id'));
$activity->set_title($this->unmarshal($this->db->f('title'), 'string'));
@@ -1464,35 +1464,35 @@
$activity->set_contact_person_2_zip($this->unmarshal($this->db->f('contact_person_2_zip'),
'string'));
$activity->set_frontend($this->unmarshal($this->db->f('frontend', 'bool')));
$activity->set_new_org($this->unmarshal($this->db->f('new_org', 'bool')));
-
+
$activities[] = $activity;
}
-
+
return $activities;
}
-
+
function update_organization_connection($activity_id, $organization_id)
{
$id = intval($activity_id);
$org_id = intval($organization_id);
-
+
$result = $this->db->query("UPDATE activity_activity SET
organization_id={$org_id} WHERE id={$id}", __LINE__,__FILE__);
return isset($result);
}
-
+
function get_activities_without_groups()
{
$activities = array();
$sql_activities = "select a.*, o.description as org_desc from
activity_activity a, bb_organization o where (a.group_id is null or a.group_id
= 0) and o.id = a.organization_id";
$this->db->query($sql_activities, __LINE__, __FILE__);
while($this->db->next_record())
- {
+ {
$activity_id = $this->db->f('id');
$activity_title = $this->db->f('title');
$activity_organization = $this->db->f('organization_id');
$description = $this->db->f('org_desc');
-
+
$activities[] = array(
'id'=>$activity_id,
'title'=>$activity_title,
@@ -1502,7 +1502,7 @@
}
return $activities;
}
-
+
/*
* Function to be run once.
* Generates new groups based on activity where group is not
registered.
@@ -1512,33 +1512,34 @@
{
//TODO
}
-
-
+
+
function remove_old_activities()
{
- $sql = "delete from activity_activity where id in
(1293,1294,1297,1299)"; //1293,1294,1297,1299
+ //$sql = "delete from activity_activity where id in
(1293,1294,1297,1299)"; //1293,1294,1297,1299
+ $sql = "delete from
activity_activity where id=1285";
$result = $this->db->query($sql, __LINE__, __FILE__);
-
+
return isset($result);
}
-
+
function save_with_no_changes($activity)
{
$id = intval($activity->get_id());
$ts_now = strtotime('now');
-
+
$values = "last_change_date = " . $this->marshal($ts_now, 'int');
$result = $this->db->query("UPDATE activity_activity SET {$values}
WHERE id={$id}", __LINE__,__FILE__);
return isset($result);
}
-
+
function update_activity_group($activity_id, $group_id)
{
$id = intval($activity_id);
$g_id = intval($group_id);
-
+
$values = "group_id = " . $g_id;
//var_dump("UPDATE activity_activity SET {$values} WHERE
id={$id}");
//die;
Modified: branches/Version-1_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.menu.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -67,7 +67,7 @@
'component_for_check_list' => array
(
'text' => lang('component'),
-
'url' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction'=>
'controller.uicontrol_location.register_control_to_component') ),
+
'url' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction'=> 'controller.uicontrol_register_to_component.index') ),
'image' => array('property', 'entity_1')
)
)
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
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -280,52 +280,7 @@
return null;
}
}
-
- /* Later ikke til at denne er i bruk: Torstein 10.07.12
- public function get_check_items($check_list_id, $status, $type,
$return_type = "return_object"){
- $sql = "SELECT ci.id as ci_id, control_item_id,
check_list_id, ";
- $sql .= "coi.id as coi_id, coi.title, coi.required,
coi.what_to_do, coi.how_to_do, coi.control_group_id, coi.type ";
- $sql .= "FROM controller_check_item ci ";
- $sql .= "LEFT JOIN controller_control_item as coi ON
ci.control_item_id = coi.id ";
- $sql .= "WHERE ci.check_list_id = $check_list_id ";
-
- if($status == 'open')
- $sql .= "AND ci.status = 0 ";
- else if($status == 'handled')
- $sql .= "AND ci.status = 1 ";
- if($type != null)
- $sql .= "AND coi.type = '$type'";
-
- $this->db->query($sql);
-
- while ($this->db->next_record()) {
- $check_item = new
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
-
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
true), 'int'));
-
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id',
true), 'int'));
-
- $control_item = new
controller_control_item($this->unmarshal($this->db->f('coi_id', true), 'int'));
- $control_item->set_title($this->db->f('title',
true), 'string');
-
$control_item->set_required($this->db->f('required', true), 'string');
-
$control_item->set_what_to_do($this->db->f('what_to_do', true), 'string');
-
$control_item->set_how_to_do($this->db->f('how_to_do', true), 'string');
-
$control_item->set_control_group_id($this->db->f('control_group_id', true),
'string');
- $control_item->set_type($this->db->f('type',
true), 'string');
-
- if($return_type == "return_array"){
-
$check_item->set_control_item($control_item->toArray());
- $check_items_array[] =
$check_item->toArray();
- }
- else{
-
$check_item->set_control_item($control_item);
- $check_items_array[] = $check_item;
- }
- }
-
- return $check_items_array;
- }
- */
-
/**
* Get check item objects from database including control item
and related cases
*
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
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -39,13 +39,13 @@
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_helper', 'inc/helper/');
-
+
class controller_uicheck_list extends phpgwapi_uicommon
{
private $so;
@@ -101,11 +101,12 @@
if(phpgw::get_var('phpgw_return_as') == 'json') {
return $this->query();
}
- self::add_javascript('controller', 'yahoo',
'datatable.js');
+ self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('paginator');
$data = array(
+ 'datatable_name' => 'Sjekkliste (Ikke i
bruk)',
'form' => array(
'toolbar' => array(
'item' => array(
@@ -184,7 +185,7 @@
),
);
- self::render_template_xsl('datatable', $data);
+ self::render_template_xsl('datatable_common', $data);
}
/**
@@ -373,12 +374,11 @@
$comment = phpgw::get_var('comment', 'string');
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $deadline_date_ts =
date_helper::get_timestamp_from_date( $deadline_date, $dateformat );
+ $deadline_date_ts =
phpgwapi_datetime::date_to_timestamp( $deadline_date );
if($planned_date != '')
{
- $planned_date_ts =
date_helper::get_timestamp_from_date( $planned_date, $dateformat );
+ $planned_date_ts =
phpgwapi_datetime::date_to_timestamp( $planned_date );
}
else
{
@@ -387,7 +387,7 @@
if($completed_date != '')
{
- $completed_date_ts =
date_helper::get_timestamp_from_date( $completed_date, $dateformat );
+ $completed_date_ts =
phpgwapi_datetime::date_to_timestamp( $completed_date );
$status = controller_check_list::STATUS_DONE;
}
else
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
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -198,7 +198,7 @@
'lists' => $lists
);
- //self::add_javascript('controller', 'yahoo',
'datatable.js');
+ //self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
self::add_javascript('controller', 'controller',
'controller_datatable_test.js');
self::add_javascript('controller', 'controller',
'jquery.js');
self::add_javascript('controller', 'controller',
'ajax.js');
@@ -206,7 +206,7 @@
//$GLOBALS['phpgw']->js->validate_file( 'yahoo',
'equipmens_location', 'controller' );
- //self::render_template_xsl('datatable', $data);
+ //self::render_template_xsl('datatable_common', $data);
self::render_template_xsl('component', $data);
*/
if(phpgw::get_var('phpgw_return_as') == 'json') {
Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -117,7 +117,7 @@
if(phpgw::get_var('phpgw_return_as') == 'json') {
return $this->query();
}
- self::add_javascript('controller', 'yahoo',
'datatable.js');
+ self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('paginator');
@@ -139,6 +139,7 @@
// END categories
$data = array(
+ 'datatable_name' =>
'Kontroller',//lang('controls'),
'form' => array(
'toolbar' => array(
'item' => array(
@@ -240,7 +241,7 @@
),
);
- self::render_template_xsl(array(
'control/controls_datatable', 'datatable' ), $data);
+ self::render_template_xsl(array( 'datatable_common' ),
$data);
}
/**
@@ -816,7 +817,7 @@
if($sort_field == null)
{
- $sort_field = 'control_group_id';
+ $sort_field = 'controller_control.id';
}
$sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -95,11 +95,12 @@
);
}
// END categories
- self::add_javascript('controller', 'yahoo',
'datatable.js');
+ self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('paginator');
$data = array(
+ 'datatable_name' => 'Kontrollgrupper',
//lang('control groups'),
'form' => array(
'toolbar' => array(
'item' => array(
@@ -169,7 +170,7 @@
);
//_debug_array($data);
- self::render_template_xsl(array(
'control_group/control_groups_datatable', 'datatable' ), $data);
+ self::render_template_xsl(array( 'datatable_common' ),
$data);
}
/**
@@ -644,7 +645,7 @@
$sort_field = phpgw::get_var('sort');
if($sort_field == null)
{
- $sort_field = 'control_group_id';
+ $sort_field = 'controller_control_group.id';
}
$sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
//Create an empty result set
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -105,6 +105,7 @@
// END categories
$data = array(
+ 'datatable_name' => 'Kontrollpunkter',
//lang(control items),
'form' => array(
'toolbar' => array(
'item' => array(
@@ -175,9 +176,9 @@
phpgwapi_yui::load_widget('paginator');
phpgwapi_yui::load_widget('datatable');
- self::add_javascript('controller', 'yahoo',
'datatable.js');
+ self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
- self::render_template_xsl( array(
'control_item/control_items_datatable', 'datatable' ), $data);
+ self::render_template_xsl( array( 'datatable_common' ),
$data);
}
/**
@@ -369,34 +370,41 @@
$filters['control_groups'] = $ctrl_group;
}
+
$search_for = phpgw::get_var('query');
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
{
$user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
- else {
+ else
+ {
$user_rows_per_page = 10;
}
// YUI variables for paging and sorting
- $start_index = phpgw::get_var('startIndex', 'int');
+ $start_index = (int)phpgw::get_var('startIndex',
'int');
$num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
$sort_field = phpgw::get_var('sort');
if($sort_field == null)
{
- $sort_field = 'control_item_id';
+ $sort_field = 'id';
}
+
if(phpgw::get_var('sort_dir') == 'desc')
+ {
$sort_ascending = false;
+ }
else
+ {
$sort_ascending = phpgw::get_var('dir') ==
'desc' ? false : true;
+ }
//Create an empty result set
$records = array();
//Retrieve a contract identifier and load corresponding
contract
$control_item_id = phpgw::get_var('control_item_id');
- if(isset($control_item_id))
+ if(isset($control_item_id) && $control_item_id)
{
$control_item =
$this->so->get_single($control_item_id);
}
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -41,7 +41,6 @@
include_class('controller', 'check_list', 'inc/model/');
include_class('controller', 'date_generator', 'inc/component/');
include_class('controller', 'check_list_status_updater', 'inc/helper/');
- include_class('controller', 'date_helper', 'inc/helper/');
class controller_uicontrol_location extends phpgwapi_uicommon
{
@@ -67,12 +66,9 @@
'view_locations_for_control' => true,
'register_control_to_location' => true,
'register_control_to_location_2' => true,
- 'register_control_to_component' => true,
- 'edit_component'
=> true,
'get_locations_for_control' => true,
'get_location_category' => true,
'get_district_part_of_town' => true,
- 'query2'
=> true,
'get_category_by_entity' => true,
'get_entity_table_def' => true,
'get_locations'
=> true,
@@ -418,125 +414,7 @@
return $category_list;
}
- function register_control_to_component()
- {
-
self::set_active_menu('controller::control::component_for_check_list');
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
- $receipt = array();
- if(phpgw::get_var('phpgw_return_as') == 'json')
- {
- return $this->query2();
- }
-
- $msgbox_data = array();
- if( phpgw::get_var('phpgw_return_as') != 'json' &&
$receipt = phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
- {
- phpgwapi_cache::session_clear('phpgwapi',
'phpgw_messages');
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($receipt);
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
- }
-
- $myColumnDefs = array();
- $datavalues = array();
- $myButtons = array();
-
- $datavalues[] = array
- (
- 'name' => "0",
- 'values' =>
json_encode(array()),
- 'total_records' => 0,
- 'permission' => "''",
- 'is_paginator' => 1,
- 'edit_action' => "''",
- 'footer' => 0
- );
-
- $myColumnDefs[0] = array
- (
- 'name' => "0",
- 'values' => json_encode(array())
- );
-
- $GLOBALS['phpgw']->translation->add_app('property');
- $entity =
CreateObject('property.soadmin_entity');
- $entity_list = $entity->read(array('allrows' =>
true));
-
- $district_list =
$this->bocommon->select_district_list('filter',$this->district_id);
-
- $part_of_town_list =
execMethod('property.bogeneric.get_list', array('type'=>'part_of_town',
'selected' => $part_of_town_id ));
- $location_type_list =
execMethod('property.soadmin_location.select_location_type');
-
- array_unshift($entity_list ,array
('id'=>'','name'=>lang('select')));
- array_unshift($district_list ,array
('id'=>'','name'=>lang('select')));
- array_unshift($part_of_town_list ,array
('id'=>'','name'=>lang('select')));
- array_unshift($location_type_list ,array
('id'=>'','name'=>lang('select')));
-
- $cats = CreateObject('phpgwapi.categories', -1,
'controller', '.control');
- $cats->supress_info = true;
-
- $control_area =
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl'
=> $this->_category_acl));
-
-
- $control_area_list = array();
- foreach($control_area['cat_list'] as $cat_list)
- {
- $control_area_list[] = array
- (
- 'id' => $cat_list['cat_id'],
- 'name' => $cat_list['name'],
- );
- }
-
- array_unshift ($control_area_list ,array
('id'=>'','name'=>lang('select')));
-
-
-
- $data = array
- (
- 'td_count'
=> '""',
- // 'property_js'
=>
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
- 'datatable'
=> $datavalues,
- 'myColumnDefs'
=> $myColumnDefs,
- 'myButtons'
=> $myButtons,
-
- 'msgbox_data'
=> $msgbox_data,
- 'control_area_list' =>
array('options' => $control_area_list),
- 'filter_form'
=> array
-
(
-
'control_area_list' =>
array('options' => $control_area_list),
-
'entity_list' =>
array('options' => $entity_list),
-
'district_list' =>
array('options' => $district_list),
-
'part_of_town_list' =>
array('options' => $part_of_town_list),
-
'location_type_list' => array('options' =>
$location_type_list),
-
),
- 'update_action'
=> self::link(array('menuaction' =>
'controller.uicontrol_location.edit_component'))
- );
-
-
-
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
- $theme = 'ui-lightness';
-
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/jquery/development-bundle/themes/{$theme}/jquery.ui.autocomplete.css");
-
-
- phpgwapi_yui::load_widget('connection');
- phpgwapi_yui::load_widget('loader');
- phpgwapi_yui::load_widget('tabview');
-
- phpgwapi_jquery::load_widget('core');
- phpgwapi_jquery::load_widget('autocomplete');
-
- self::add_javascript('controller', 'controller',
'ajax_control_to_component.js');
- // self::add_javascript('controller', 'yahoo',
'register_control_to_component.js');
- self::add_javascript('controller', 'yahoo',
'register_control_to_component2.js');
-
-
self::render_template_xsl(array('control_location/register_control_to_component'
), $data);
- }
-
-
public function get_location_type_category()
{
$location_type =
phpgw::get_var('location_type', 'int');
@@ -627,100 +505,4 @@
return $locations;
}
-
-
- public function query2()
- {
- $entity_id =
phpgw::get_var('entity_id', 'int');
- $cat_id =
phpgw::get_var('cat_id', 'int');
- $district_id = phpgw::get_var('district_id',
'int');
- $part_of_town_id =
phpgw::get_var('part_of_town_id', 'int');
- $control_id =
phpgw::get_var('control_id', 'int');
- $results =
phpgw::get_var('results', 'int');
- $control_registered =
phpgw::get_var('control_registered', 'bool');
-
- if(!$entity_id && !$cat_id)
- {
- $values = array();
- }
- else
- {
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property',
".entity.{$entity_id}.{$cat_id}");
- $boentity =
CreateObject('property.boentity',false, 'entity');
- $boentity->results = $results;
- $values =
$boentity->read(array('control_registered' => $control_registered, 'control_id'
=> $control_id));
- }
-
- foreach($values as &$entry)
- {
- $checked = '';
-
if($this->so_control->check_control_component($control_id,$location_id,$entry['id']))
- {
- $checked = 'checked = "checked"
disabled = "disabled"';
- $entry['delete'] = "<input class
=\"mychecks_delete\" type =\"checkbox\" name=\"values[delete][]\"
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
- }
- $entry['select'] = "<input class
=\"mychecks_add\" type =\"checkbox\" $checked
name=\"values[register_component][]\"
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
- }
-
-
- $results = $results ? $results :
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- $return_data['recordsReturned'] = count($values);
- $return_data['totalRecords'] = $boentity->total_records;
- $return_data['startIndex'] = $this->start;
- $return_data['sort'] = 'location_code';
- $return_data['dir'] = "ASC";
- $return_data['pageSize'] = $results;
- $return_data['activePage'] = floor($this->start /
$results) + 1;
- $return_data['records'] = $values;
-
- return $return_data;
- }
-
- public function edit_component()
- {
- if($values = phpgw::get_var('values'))
- {
- if(!$GLOBALS['phpgw']->acl->check('.admin',
PHPGW_ACL_EDIT, 'property'))
- {
- $receipt['error'][]=true;
- phpgwapi_cache::message_set(lang('you
are not approved for this task'), 'error');
- }
- if(!$receipt['error'])
- {
-
-
if($this->so_control->register_control_to_component($values))
- {
- $result = array
- (
- 'status' =>
'updated'
- );
- }
- else
- {
- $result = array
- (
- 'status' =>
'error'
- );
- }
- }
- }
-
- if(phpgw::get_var('phpgw_return_as') == 'json')
- {
- if( $receipt =
phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
- {
-
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
- $result['receipt'] = $receipt;
- }
- else
- {
- $result['receipt'] = array();
- }
- return $result;
- }
- else
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' =>
'controller.uicontrol_location.register_control_to_component'));
- }
- }
}
Copied:
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
(from rev 10073,
trunk/controller/inc/class.uicontrol_register_to_component.inc.php)
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
(rev 0)
+++
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -0,0 +1,434 @@
+<?php
+ /**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage controller
+ * @version $Id: class.uicheck_list.inc.php 8628 2012-01-21 10:42:05Z
vator $
+ */
+
+ phpgw::import_class('phpgwapi.yui');
+
+ /**
+ * Import the jQuery class
+ */
+ phpgw::import_class('phpgwapi.jquery');
+
+ phpgw::import_class('phpgwapi.uicommon');
+
+ class controller_uicontrol_register_to_component extends
phpgwapi_uicommon
+ {
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $type_id;
+ var $location_code;
+
+ private $bo;
+ private $bocommon;
+ private $so_control;
+
+ var $public_functions = array
+ (
+ 'index'
=> true,
+ 'query'
=> true,
+ 'edit_component'
=> true,
+ 'get_location_category' => true,
+ 'get_district_part_of_town' => true,
+ 'get_category_by_entity' => true,
+ 'get_entity_table_def' => true,
+ 'get_locations'
=> true,
+ 'get_location_type_category' => true
+ );
+
+ function __construct()
+ {
+ parent::__construct();
+
+ $this->bo =
CreateObject('property.bolocation',true);
+ $this->bocommon = &
$this->bo->bocommon;
+ $this->so_control =
CreateObject('controller.socontrol');
+
+ $this->type_id =
$this->bo->type_id;
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->part_of_town_id =
$this->bo->part_of_town_id;
+ $this->district_id =
$this->bo->district_id;
+ $this->status =
$this->bo->status;
+ $this->allrows =
$this->bo->allrows;
+ $this->lookup =
$this->bo->lookup;
+ $this->location_code =
$this->bo->location_code;
+
+
self::set_active_menu('controller::control::location_for_check_list');
+ }
+
+
+
+ function index()
+ {
+
self::set_active_menu('controller::control::component_for_check_list');
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+ $receipt = array();
+
+ if(phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ return $this->query();
+ }
+
+ $msgbox_data = array();
+ if( phpgw::get_var('phpgw_return_as') != 'json' &&
$receipt = phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
+ {
+ phpgwapi_cache::session_clear('phpgwapi',
'phpgw_messages');
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($receipt);
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ }
+
+ $myColumnDefs = array();
+ $datavalues = array();
+ $myButtons = array();
+
+ $datavalues[] = array
+ (
+ 'name' => "0",
+ 'values' =>
json_encode(array()),
+ 'total_records' => 0,
+ 'permission' => "''",
+ 'is_paginator' => 1,
+ 'edit_action' => "''",
+ 'footer' => 0
+ );
+
+ $myColumnDefs[0] = array
+ (
+ 'name' => "0",
+ 'values' => json_encode(array())
+ );
+
+ $GLOBALS['phpgw']->translation->add_app('property');
+ $entity =
CreateObject('property.soadmin_entity');
+ $entity_list = $entity->read(array('allrows' =>
true));
+
+ $district_list =
$this->bocommon->select_district_list('filter',$this->district_id);
+
+ $part_of_town_list =
execMethod('property.bogeneric.get_list', array('type'=>'part_of_town',
'selected' => $part_of_town_id ));
+ $location_type_list =
execMethod('property.soadmin_location.select_location_type');
+
+ array_unshift($entity_list ,array
('id'=>'','name'=>lang('select')));
+ array_unshift($district_list ,array
('id'=>'','name'=>lang('select')));
+ array_unshift($part_of_town_list ,array
('id'=>'','name'=>lang('select')));
+ array_unshift($location_type_list ,array
('id'=>'','name'=>lang('select')));
+
+ $cats = CreateObject('phpgwapi.categories', -1,
'controller', '.control');
+ $cats->supress_info = true;
+
+ $control_area =
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl'
=> $this->_category_acl));
+
+
+ $control_area_list = array();
+ foreach($control_area['cat_list'] as $cat_list)
+ {
+ $control_area_list[] = array
+ (
+ 'id' => $cat_list['cat_id'],
+ 'name' => $cat_list['name'],
+ );
+ }
+
+ array_unshift ($control_area_list ,array
('id'=>'','name'=>lang('select')));
+
+
+
+ $data = array
+ (
+ 'td_count'
=> '""',
+ 'datatable'
=> $datavalues,
+ 'myColumnDefs'
=> $myColumnDefs,
+ 'myButtons'
=> $myButtons,
+
+ 'msgbox_data'
=> $msgbox_data,
+ 'control_area_list' =>
array('options' => $control_area_list),
+ 'filter_form'
=> array
+
(
+
'control_area_list' =>
array('options' => $control_area_list),
+
'entity_list' =>
array('options' => $entity_list),
+
'district_list' =>
array('options' => $district_list),
+
'part_of_town_list' =>
array('options' => $part_of_town_list),
+
'location_type_list' => array('options' =>
$location_type_list),
+
),
+ 'update_action'
=> self::link(array('menuaction' =>
'controller.uicontrol_location.edit_component'))
+ );
+
+ phpgwapi_jquery::load_widget('core');
+ phpgwapi_jquery::load_widget('autocomplete');
+
+ self::add_javascript('controller', 'controller',
'ajax_control_to_component.js');
+ self::add_javascript('controller', 'yahoo',
'register_control_to_component2.js');
+
+
self::render_template_xsl(array('control_location/register_control_to_component'
), $data);
+ }
+
+
+ /*
+ * Return categories based on chosen location
+ */
+ public function get_location_category()
+ {
+ $type_id = phpgw::get_var('type_id');
+ $category_types =
$this->bocommon->select_category_list(array(
+
'format'=>'filter',
+
'selected' => 0,
+
'type'
=>'location',
+
'type_id'
=>$type_id,
+
'order'=>'descr'
+
));
+ $default_value = array ('id'=>'','name'=>lang('no
category selected'));
+ array_unshift($category_types,$default_value);
+ return json_encode( $category_types );
+ }
+
+ /*
+ * Return parts of town based on chosen district
+ */
+ public function get_district_part_of_town()
+ {
+ $district_id = phpgw::get_var('district_id');
+ $part_of_town_list =
$this->bocommon->select_part_of_town('filter',null,$district_id);
+ $default_value = array ('id'=>'','name'=>lang('no part
of town'));
+ array_unshift($part_of_town_list,$default_value);
+
+ return json_encode( $part_of_town_list );
+ }
+
+
+ /*
+
+ * Return parts of town based on chosen district
+ */
+ public function get_category_by_entity()
+ {
+ $entity_id = phpgw::get_var('entity_id');
+ $entity =
CreateObject('property.soadmin_entity');
+
+ $category_list =
$entity->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
+
+ return $category_list;
+ }
+
+
+ public function get_location_type_category()
+ {
+ $location_type =
phpgw::get_var('location_type', 'int');
+
+ $values = $this->bocommon->select_category_list(array
+ (
+ 'format'=>'filter',
+ // 'selected' => $this->cat_id,
+ 'type' =>'location',
+ 'type_id' =>$location_type,
+ 'order'=>'descr'
+ )
+ );
+
+ return $values;
+ }
+
+
+ public function get_entity_table_def()
+ {
+ $entity_id =
phpgw::get_var('entity_id', 'int');
+ $cat_id =
phpgw::get_var('cat_id', 'int');
+ $boentity =
CreateObject('property.boentity',false, 'entity');
+ $boentity->read(array('dry_run' => true));
+ $uicols = $boentity->uicols;
+ $columndef = array();
+
+ $columndef[] = array
+ (
+ 'key' => 'select',
+ 'label' => lang('select'),
+ 'sortable' => false,
+ 'formatter' => false,
+ 'hidden' => false,
+ 'formatter' => '',
+ 'className' => ''
+ );
+
+ $columndef[] = array
+ (
+ 'key' => 'delete',
+ 'label' => lang('delete'),
+ 'sortable' => false,
+ 'formatter' => false,
+ 'hidden' => false,
+ 'formatter' => '',
+ 'className' => ''
+ );
+
+ $count_fields = count($uicols['name']);
+
+ for ($i=0;$i<$count_fields;$i++)
+ {
+ if( $uicols['name'][$i])
+ {
+ $columndef[] = array
+ (
+ 'key' =>
$uicols['name'][$i],
+ 'label' =>
$uicols['descr'][$i],
+ 'sortable' =>
$uicols['sortable'][$i],
+ 'formatter' =>
$uicols['formatter'][$i],
+ 'hidden' =>
$uicols['input_type'][$i] == 'hidden' ? true : false ,
+ 'className' =>
$uicols['classname'][$i],
+ );
+ }
+ }
+
+//_debug_array($columndef);
+ return $columndef;
+ }
+
+
+ public function get_locations()
+ {
+ $location_code = phpgw::get_var('location_code');
+ $child_level = phpgw::get_var('child_level', 'int',
'REQUEST', 1);
+ $part_of_town_id = phpgw::get_var('part_of_town_id',
'int');
+
+ $criteria = array
+ (
+ 'location_code' => $location_code,
+ 'child_level' => $child_level,
+ 'field_name' =>
"loc{$child_level}_name",
+ 'part_of_town_id' => $part_of_town_id
+ );
+
+ $locations =
execMethod('property.solocation.get_children',$criteria);
+ return $locations;
+ }
+
+
+
+ public function query()
+ {
+ $entity_id =
phpgw::get_var('entity_id', 'int');
+ $cat_id =
phpgw::get_var('cat_id', 'int');
+ $district_id = phpgw::get_var('district_id',
'int');
+ $part_of_town_id =
phpgw::get_var('part_of_town_id', 'int');
+ $control_id =
phpgw::get_var('control_id', 'int');
+ $results =
phpgw::get_var('results', 'int');
+ $control_registered =
phpgw::get_var('control_registered', 'bool');
+
+ if(!$entity_id && !$cat_id)
+ {
+ $values = array();
+ }
+ else
+ {
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property',
".entity.{$entity_id}.{$cat_id}");
+ $boentity =
CreateObject('property.boentity',false, 'entity');
+ $boentity->results = $results;
+ $values =
$boentity->read(array('control_registered' => $control_registered, 'control_id'
=> $control_id));
+ }
+
+ foreach($values as &$entry)
+ {
+ $checked = '';
+
if($this->so_control->check_control_component($control_id,$location_id,$entry['id']))
+ {
+ $checked = 'checked = "checked"
disabled = "disabled"';
+ $entry['delete'] = "<input class
=\"mychecks_delete\" type =\"checkbox\" name=\"values[delete][]\"
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
+ }
+ $entry['select'] = "<input class
=\"mychecks_add\" type =\"checkbox\" $checked
name=\"values[register_component][]\"
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
+ }
+
+
+ $results = $results ? $results :
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ $return_data['recordsReturned'] = count($values);
+ $return_data['totalRecords'] = $boentity->total_records;
+ $return_data['startIndex'] = $this->start;
+ $return_data['sort'] = 'location_code';
+ $return_data['dir'] = "ASC";
+ $return_data['pageSize'] = $results;
+ $return_data['activePage'] = floor($this->start /
$results) + 1;
+ $return_data['records'] = $values;
+
+ return $return_data;
+ }
+
+ public function edit_component()
+ {
+ if($values = phpgw::get_var('values'))
+ {
+ if(!$GLOBALS['phpgw']->acl->check('.admin',
PHPGW_ACL_EDIT, 'property'))
+ {
+ $receipt['error'][]=true;
+ phpgwapi_cache::message_set(lang('you
are not approved for this task'), 'error');
+ }
+ if(!$receipt['error'])
+ {
+
+
if($this->so_control->register_control_to_component($values))
+ {
+ $result = array
+ (
+ 'status' =>
'updated'
+ );
+ }
+ else
+ {
+ $result = array
+ (
+ 'status' =>
'error'
+ );
+ }
+ }
+ }
+
+ if(phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ if( $receipt =
phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
+ {
+
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
+ $result['receipt'] = $receipt;
+ }
+ else
+ {
+ $result['receipt'] = array();
+ }
+ return $result;
+ }
+ else
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' =>
'controller.uicontrol_location.register_control_to_component'));
+ }
+ }
+ }
Modified: branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -477,18 +477,20 @@
public function document_types()
{
- if(phpgw::get_var('phpgw_return_as') == 'json') {
+ if(phpgw::get_var('phpgw_return_as') == 'json')
+ {
return $this->get_document_types();
self::render_template_xsl(array('procedure/procedure_tabs',
'common',
'procedure/procedure_documents'),
$data);
}
- self::add_javascript('controller', 'yahoo', 'datatable.js');
+ self::add_javascript('phpgwapi', 'yahoo', 'datatable.js');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('paginator');
$data = array(
+ 'datatable_name' => 'Dokument typer',
'form' => array(
),
'datatable' => array(
@@ -514,6 +516,6 @@
),
);
- self::render_template_xsl('datatable', $data);
+ self::render_template_xsl('datatable_common', $data);
}
}
Modified: branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -76,7 +76,7 @@
if(phpgw::get_var('phpgw_return_as') == 'json') {
return $this->query();
}
- self::add_javascript('controller', 'yahoo',
'datatable.js');
+ self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('paginator');
@@ -98,6 +98,7 @@
// END as categories
$data = array(
+ 'datatable_name' =>
'Prosedyrer', //lang('procedures'),
'form' => array(
'toolbar' => array(
'item' => array(
@@ -161,7 +162,7 @@
),
);
- self::render_template_xsl(array(
'procedure/procedures_datatable', 'datatable' ), $data);
+ self::render_template_xsl(array( 'datatable_common' ),
$data);
}
public function edit()
@@ -615,7 +616,8 @@
{
$user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
- else {
+ else
+ {
$user_rows_per_page = 10;
}
// YUI variables for paging and sorting
@@ -635,7 +637,8 @@
$exp_param = phpgw::get_var('export');
$export = false;
- if(isset($exp_param)){
+ if(isset($exp_param) && $exp_param)
+ {
$export=true;
$num_of_objects = null;
}
@@ -654,7 +657,8 @@
//Create an empty row set
$rows = array();
- foreach($result_objects as $result) {
+ foreach($result_objects as $result)
+ {
if(isset($result))
{
$rows[] = $result->serialize();
@@ -671,7 +675,8 @@
$editable = phpgw::get_var('editable') == 'true' ? true
: false;
- if(!$export){
+ if(!$export)
+ {
//Add action column to each row in result table
array_walk(
$result_data['results'],
Deleted:
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -1,46 +0,0 @@
-<?php
- phpgw::import_class('controller.socheck_list');
- phpgw::import_class('controller.socheck_item');
-
- include_class('controller', 'check_list', 'inc/model/');
- include_class('controller', 'check_item', 'inc/model/');
-
- class check_list_status_updater {
-
- public function __construct()
- {
- $this->so_check_list =
CreateObject('controller.socheck_list');
- $this->so_check_item =
CreateObject('controller.socheck_item');
- }
-
- public function update_check_list_status( $check_list_id )
- {
- $check_list = $this->so_check_list->get_single(
$check_list_id );
-
- $check_items =
$this->so_check_item->get_check_items_with_cases($check_list_id,
$control_item_type = null, $status = null, $messageStatus = null,
"return_object");
-
- $num_open_cases = 0;
- $num_pending_cases = 0;
-
- foreach($check_items as $check_item){
- foreach($check_item->get_cases_array() as
$case){
-
- if($case->get_status() ==
controller_check_item_case::STATUS_OPEN){
- $num_open_cases++;
- }
-
- if($case->get_status() ==
controller_check_item_case::STATUS_PENDING){
- $num_pending_cases++;
- }
- }
- }
-
- if($num_open_cases > 0)
-
$check_list->set_status(controller_check_list::STATUS_DONE);
-
- $check_list->set_num_open_cases($num_open_cases);
- $check_list->set_num_pending_cases($num_pending_cases);
-
- $this->so_check_list->store($check_list);
- }
-}
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
(from rev 10073,
trunk/controller/inc/helper/class.check_list_status_updater.inc.php)
===================================================================
---
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
(rev 0)
+++
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -0,0 +1,46 @@
+<?php
+ phpgw::import_class('controller.socheck_list');
+ phpgw::import_class('controller.socheck_item');
+
+ include_class('controller', 'check_list', 'inc/model/');
+ include_class('controller', 'check_item', 'inc/model/');
+
+ class check_list_status_updater {
+
+ public function __construct()
+ {
+ $this->so_check_list =
CreateObject('controller.socheck_list');
+ $this->so_check_item =
CreateObject('controller.socheck_item');
+ }
+
+ public function update_check_list_status( $check_list_id )
+ {
+ $check_list = $this->so_check_list->get_single(
$check_list_id );
+
+ $check_items =
$this->so_check_item->get_check_items_with_cases($check_list_id,
$control_item_type = null, $status = null, $messageStatus = null,
"return_object");
+
+ $num_open_cases = 0;
+ $num_pending_cases = 0;
+
+ foreach($check_items as $check_item){
+ foreach($check_item->get_cases_array() as
$case){
+
+ if($case->get_status() ==
controller_check_item_case::STATUS_OPEN){
+ $num_open_cases++;
+ }
+
+ if($case->get_status() ==
controller_check_item_case::STATUS_PENDING){
+ $num_pending_cases++;
+ }
+ }
+ }
+
+ if($num_open_cases > 0)
+
$check_list->set_status(controller_check_list::STATUS_DONE);
+
+ $check_list->set_num_open_cases($num_open_cases);
+ $check_list->set_num_pending_cases($num_pending_cases);
+
+ $this->so_check_list->store($check_list);
+ }
+}
Deleted:
branches/Version-1_0-branch/controller/inc/helper/class.date_helper.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/helper/class.date_helper.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/helper/class.date_helper.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -1,29 +0,0 @@
-<?php
- class date_helper
- {
-
- public function __construct(){}
-
- public static function get_timestamp_from_date( $date_string,
$format )
- {
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- if( $format == $dateformat )
- {
- $pos_day = strpos($date_string, "/");
- $day = date_helper::substring($date_string, 0,
$pos_day);
-
- $pos_month = strpos($date_string, "-");
- $month = date_helper::substring($date_string,
$pos_day+1, $pos_month);
-
- $year = date_helper::substring($date_string,
$pos_month+1, strlen($date_string));
-
- return mktime(0, 0, 0, $month, $day, $year);
- }
- }
-
- public function substring($string, $from, $to)
- {
- return substr($string, $from, $to - $from);
- }
- }
Deleted:
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -1,51 +0,0 @@
-<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id: class.uicontrol_group.inc.php 8267 2011-12-11 12:27:18Z
sigurdne $
- */
-
- phpgw::import_class('property.solocation');
-
- class location_finder
- {
- private $so;
-
- public function __construct()
- {
- $this->so = CreateObject('property.solocation');
- }
-
- function get_responsibilities($data = array())
- {
- $data['filter_role_on_contact'] =
$GLOBALS['phpgw']->accounts->get($data['user_id'])->person_id;
- $locations = $this->so->read($data);
-
- $total_records = $this->so->total_records;
-
- return $locations;
- }
- }
Copied:
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
(from rev 10073, trunk/controller/inc/helper/class.location_finder.inc.php)
===================================================================
---
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
(rev 0)
+++
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -0,0 +1,51 @@
+<?php
+ /**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage controller
+ * @version $Id: class.uicontrol_group.inc.php 8267 2011-12-11 12:27:18Z
sigurdne $
+ */
+
+ phpgw::import_class('property.solocation');
+
+ class location_finder
+ {
+ private $so;
+
+ public function __construct()
+ {
+ $this->so = CreateObject('property.solocation');
+ }
+
+ function get_responsibilities($data = array())
+ {
+ $data['filter_role_on_contact'] =
$GLOBALS['phpgw']->accounts->get($data['user_id'])->person_id;
+ $locations = $this->so->read($data);
+
+ $total_records = $this->so->total_records;
+
+ return $locations;
+ }
+ }
Modified:
branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -29,7 +29,6 @@
*/
include_class('controller', 'model', 'inc/model/');
- include_class('controller', 'date_helper', 'inc/helper/');
class controller_component extends controller_model
{
Modified: branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -29,7 +29,7 @@
*/
include_class('controller', 'model', 'inc/model/');
- include_class('controller', 'date_helper', 'inc/helper/');
+ phpgw::import_class('phpgwapi.datetime');
class controller_control extends controller_model
{
@@ -257,14 +257,14 @@
if(phpgw::get_var('start_date','string') != '')
{
- $start_date_ts =
date_helper::get_timestamp_from_date( phpgw::get_var('start_date','string'),
$dateformat );
+ $start_date_ts =
phpgwapi_datetime::date_to_timestamp( phpgw::get_var('start_date','string') );
$this->set_start_date($start_date_ts);
}else
$this->set_start_date(0);
if( phpgw::get_var('end_date','string') != '')
{
- $end_date_ts =
date_helper::get_timestamp_from_date( phpgw::get_var('end_date','string'),
$dateformat );
+ $end_date_ts =
phpgwapi_datetime::date_to_timestamp( phpgw::get_var('end_date','string') );
$this->set_end_date( $end_date_ts );
}else
{
Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js
2012-10-01 14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js
2012-10-01 19:07:48 UTC (rev 10074)
@@ -1081,4 +1081,4 @@
// Updating order number in front of row
$(span_order_nr).text(updated_order_nr);
-}
\ No newline at end of file
+}
Modified:
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
===================================================================
---
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
2012-10-01 19:07:48 UTC (rev 10074)
@@ -47,7 +47,7 @@
$("#entity_id").change(function () {
- var oArgs =
{menuaction:'controller.uicontrol_location.get_category_by_entity', entity_id:
$(this).val()};
+ var oArgs =
{menuaction:'controller.uicontrol_register_to_component.get_category_by_entity',
entity_id: $(this).val()};
var requestUrl = phpGWLink('index.php', oArgs, true);
var htmlString = "";
@@ -88,7 +88,7 @@
$("#location_type").change(function () {
- var oArgs =
{menuaction:'controller.uicontrol_location.get_location_type_category',
location_type: $(this).val()};
+ var oArgs =
{menuaction:'controller.uicontrol_register_to_component.get_location_type_category',
location_type: $(this).val()};
var requestUrl = phpGWLink('index.php', oArgs, true);
var htmlString = "";
@@ -167,7 +167,7 @@
//update part of town category based on district
$("#district_id").change(function () {
var district_id = $(this).val();
- var oArgs =
{menuaction:'controller.uicontrol_location.get_district_part_of_town'};
+ var oArgs =
{menuaction:'controller.uicontrol_register_to_component.get_district_part_of_town'};
var requestUrl = phpGWLink('index.php', oArgs, true);
var htmlString = "";
@@ -207,7 +207,7 @@
$("#part_of_town_id").change(function ()
{
- var oArgs =
{menuaction:'controller.uicontrol_location.get_locations', child_level:1,
part_of_town_id: $(this).val()};
+ var oArgs =
{menuaction:'controller.uicontrol_register_to_component.get_locations',
child_level:1, part_of_town_id: $(this).val()};
var requestUrl = phpGWLink('index.php', oArgs, true);
var htmlString = "<option value=''>Velg</option>";
@@ -244,7 +244,7 @@
$("#loc1").change(function ()
{
- var oArgs =
{menuaction:'controller.uicontrol_location.get_locations', child_level:2,
location_code: $(this).val()};
+ var oArgs =
{menuaction:'controller.uicontrol_register_to_component.get_locations',
child_level:2, location_code: $(this).val()};
var requestUrl = phpGWLink('index.php', oArgs, true);
var htmlString = "<option value=''>Velg</option>";
@@ -440,7 +440,7 @@
function get_table_def()
{
var oArgs = {
- menuaction:'controller.uicontrol_location.get_entity_table_def',
+
menuaction:'controller.uicontrol_register_to_component.get_entity_table_def',
entity_id:$("#entity_id").val(),
cat_id:$("#cat_id").val()
};
@@ -498,7 +498,7 @@
}
var oArgs = {
- menuaction:'controller.uicontrol_location.query2',
+ menuaction:'controller.uicontrol_register_to_component.query',
entity_id:$("#entity_id").val(),
cat_id:cat_id,
district_id:$("#district_id").val(),
@@ -540,7 +540,7 @@
}
var oArgs = {
- menuaction:'controller.uicontrol_location.query2',
+
menuaction:'controller.uicontrol_register_to_component.query',
entity_id:$("#entity_id").val(),
cat_id:$("#cat_id").val(),
district_id:$("#district_id").val(),
Modified:
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_location.js
===================================================================
---
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_location.js
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_location.js
2012-10-01 19:07:48 UTC (rev 10074)
@@ -1,15 +1,3 @@
-
-//----------
- var oArgs_edit = {menuaction:'registration.uipending.edit'};
- var edit_Url = phpGWLink('index.php', oArgs_edit);
-
- formatLinkPending = function(elCell, oRecord, oColumn, oData)
- {
- var id = oRecord.getData(oColumn.key);
- elCell.innerHTML = '<a href="' + edit_Url + '&id=' + id + '">'
+ lang['edit'] + '</a>';
- };
-
-
var formatterCheckLocation = function(elCell, oRecord, oColumn, oData)
{
var checked = '';
Modified:
branches/Version-1_0-branch/controller/templates/base/check_list/add_case.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/check_list/add_case.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/check_list/add_case.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -79,7 +79,7 @@
<div class="expand_menu"><div class="expand_all">Vis
alle</div><div class="collapse_all focus">Skjul alle</div></div>
- <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', 'index.php',
'menuaction:controller.uicase.add_case,phpgw_return_as:json')" /></xsl:variable>
+ <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:controller.uicase.add_case,phpgw_return_as:json')" /></xsl:variable>
<ul class="control_groups">
<xsl:for-each select="control_groups_with_items_array">
Modified:
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -76,7 +76,7 @@
<!-- ================== CHECKLIST DETAILS ===================== -->
<div id="check_list_details">
<h3 class="box_header">Sjekklistedetaljer</h3>
- <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', 'index.php',
'menuaction:controller.uicheck_list.save_check_list')" /></xsl:variable>
+ <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:controller.uicheck_list.save_check_list')" /></xsl:variable>
<form id="frm_update_check_list" action="{$action_url}"
method="post">
<xsl:variable name="check_list_id"><xsl:value-of
select="check_list/id"/></xsl:variable>
<input id="check_list_id" type="hidden"
name="check_list_id" value="{$check_list_id}" />
Deleted:
branches/Version-1_0-branch/controller/templates/base/control/controls_datatable.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control/controls_datatable.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/control/controls_datatable.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -1,13 +0,0 @@
-<!-- $Id: view_locations_for_control.xsl 9485 2012-06-04 08:39:52Z vator $ -->
-
-<xsl:template match="data" xmlns:php="http://php.net/xsl">
-
-<div id="main_content">
-
- <h1>Kontroller</h1>
-
- <div class="content-wrp">
- <xsl:call-template name="datatable" />
- </div>
-</div>
-</xsl:template>
Modified:
branches/Version-1_0-branch/controller/templates/base/control_group/control_groups.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_group/control_groups.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/control_group/control_groups.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -6,7 +6,7 @@
<h2><xsl:value-of select="control_area/title"/></h2>
- <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', 'index.php',
'menuaction:controller.uicontrol.save_control_groups')" /></xsl:variable>
+ <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:controller.uicontrol.save_control_groups')" /></xsl:variable>
<form id="frm_save_control_groups" action="{$action_url}"
method="post">
<xsl:variable name="control_area_id"><xsl:value-of
select="control_area/id"/></xsl:variable>
Deleted:
branches/Version-1_0-branch/controller/templates/base/control_group/control_groups_datatable.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_group/control_groups_datatable.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/control_group/control_groups_datatable.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -1,13 +0,0 @@
-<!-- $Id: view_locations_for_control.xsl 9485 2012-06-04 08:39:52Z vator $ -->
-
-<xsl:template match="data" xmlns:php="http://php.net/xsl">
-
-<div id="main_content">
-
- <h1>Kontrollgrupper</h1>
-
- <div id="control_items" class="content-wrp">
- <xsl:call-template name="datatable" />
- </div>
-</div>
-</xsl:template>
Modified:
branches/Version-1_0-branch/controller/templates/base/control_item/choose_control_items.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_item/choose_control_items.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/control_item/choose_control_items.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -9,7 +9,7 @@
<!-- ==== CHOOSE NONE/ALL ===== -->
<div class="expand_menu"><div class="expand_all">Vis
alle</div><div class="collapse_all focus">Skjul alle</div></div>
- <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', 'index.php',
'menuaction:controller.uicontrol.save_control_items')" /></xsl:variable>
+ <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:controller.uicontrol.save_control_items')" /></xsl:variable>
<form id="frm_control_items" action="{$action_url}"
method="post">
<xsl:variable name="control_id"><xsl:value-of
select="control/id"/></xsl:variable>
<input type="hidden" name="control_id"
value="{$control_id}" />
Modified:
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -17,7 +17,7 @@
</xsl:choose>
<div id="control_item_details">
- <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', 'index.php',
'menuaction:controller.uicontrol_item.save')" /></xsl:variable>
+ <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:controller.uicontrol_item.save')" /></xsl:variable>
<form action="{$action_url}" method="post">
<input type="hidden" name="id"
value="{control_item/id}" />
<dl class="proplist">
Modified:
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -13,7 +13,7 @@
<div class="yui-content">
<div id="details">
- <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', 'index.php',
'menuaction:controller.uicontrol_item_option.save')" /></xsl:variable>
+ <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:controller.uicontrol_item_option.save')" /></xsl:variable>
<form id="frm_add_control_item_option" action="{$action_url}"
method="post">
<input type="hidden" name="control_item_id">
<xsl:attribute name="value"><xsl:value-of
select="control_item/id"/></xsl:attribute>
Deleted:
branches/Version-1_0-branch/controller/templates/base/control_item/control_items_datatable.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_item/control_items_datatable.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/control_item/control_items_datatable.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -1,13 +0,0 @@
-<!-- $Id: view_locations_for_control.xsl 9485 2012-06-04 08:39:52Z vator $ -->
-
-<xsl:template match="data" xmlns:php="http://php.net/xsl">
-
-<div id="main_content">
-
- <h1>Kontrollpunkter</h1>
-
- <div id="control_items" class="content-wrp">
- <xsl:call-template name="datatable" />
- </div>
-</div>
-</xsl:template>
Modified:
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_documents.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_documents.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_documents.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -7,7 +7,7 @@
<div class="yui-content">
<div id="details">
- <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', 'index.php',
'menuaction:controller.uidocument.add')" /></xsl:variable>
+ <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:controller.uidocument.add')" /></xsl:variable>
<form enctype="multipart/form-data"
action="{$action_url}" method="POST">
<xsl:variable name="lang_upload"><xsl:value-of
select="php:function('lang', 'upload')" /></xsl:variable>
<input type="hidden" name="procedure_id" value
= "{procedure_id}" />
Deleted:
branches/Version-1_0-branch/controller/templates/base/procedure/procedures_datatable.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/procedure/procedures_datatable.xsl
2012-10-01 14:16:27 UTC (rev 10073)
+++
branches/Version-1_0-branch/controller/templates/base/procedure/procedures_datatable.xsl
2012-10-01 19:07:48 UTC (rev 10074)
@@ -1,13 +0,0 @@
-<!-- $Id: view_locations_for_control.xsl 9485 2012-06-04 08:39:52Z vator $ -->
-
-<xsl:template match="data" xmlns:php="http://php.net/xsl">
-
-<div id="main_content">
-
- <h1>Prosedyrer</h1>
-
- <div id="control_items" class="content-wrp">
- <xsl:call-template name="datatable" />
- </div>
-</div>
-</xsl:template>
Modified: branches/Version-1_0-branch/logistic/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.menu.inc.php 2012-10-01
14:16:27 UTC (rev 10073)
+++ branches/Version-1_0-branch/logistic/inc/class.menu.inc.php 2012-10-01
19:07:48 UTC (rev 10074)
@@ -77,6 +77,45 @@
)
);
+ if ( $GLOBALS['phpgw']->acl->check('run',
phpgwapi_acl::READ, 'admin')
+ || $GLOBALS['phpgw']->acl->check('admin',
phpgwapi_acl::ADD, 'controller'))
+ {
+ $menus['admin'] = array
+ (
+ 'index' => array
+ (
+ 'text' =>
lang('Configuration'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uiconfig.index', 'appname' => 'logistic') )
+ ),
+ 'acl' => array
+ (
+ 'text' => lang('Configure
Access Permissions'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'preferences.uiadmin_acl.list_acl', 'acl_app' => 'logistic') )
+ ),
+ 'project_types' => array
+ (
+ 'text' => lang('Project
types'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'logistic.uiproject.project_types') )
+ ),
+/* 'control_cats' => array
+ (
+ 'text' => lang('Control area'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uicategories.index', 'appname' => 'controller', 'location' =>
'.control', 'global_cats' => 'true', 'menu_selection' =>
'admin::controller::control_cats') )
+ ),
+ 'role_at_location' => array
+ (
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uilocation.responsiblility_role', 'menu_selection' =>
'admin::controller::role_at_location') ),
+ 'text' => lang('role at
location'),
+ 'image' => array('property',
'responsibility_role')
+ ),
+ 'controller_document_types' => array
+ (
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'controller.uidocument.document_types', 'menu_selection' =>
'admin::controller::controller_document_types') ),
+ 'text' => lang('Document
types')
+ )*/
+ );
+ }
+
$menus['folders'] =
phpgwapi_menu::get_categories('bergen');
$GLOBALS['phpgw_info']['flags']['currentapp'] =
$incoming_app;
Property changes on: branches/Version-1_0-branch/logistic/inc/class.menu.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Copied: branches/Version-1_0-branch/logistic/inc/class.soactivity.inc.php (from
rev 10073, trunk/logistic/inc/class.soactivity.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.soactivity.inc.php
(rev 0)
+++ branches/Version-1_0-branch/logistic/inc/class.soactivity.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -0,0 +1,255 @@
+<?php
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id$
+ */
+ phpgw::import_class('logistic.socommon');
+
+ include_class('logistic', 'activity', '/inc/model/');
+
+ class logistic_soactivity extends logistic_socommon
+ {
+ protected static $so;
+
+ /**
+ * Get a static reference to the storage object associated with
this model object
+ *
+ * @return logistic_soactivity the storage object
+ */
+ public static function get_instance()
+ {
+ if (self::$so == null)
+ {
+ self::$so = CreateObject('logistic.soactivity');
+ }
+ return self::$so;
+ }
+
+ protected function add(&$activity)
+ {
+ $cols = array(
+ 'parent_activity_id',
+ 'name',
+ 'project_id',
+ 'start_date',
+ 'end_date',
+ 'responsible_user_id',
+ 'update_user',
+ 'update_date'
+ );
+
+ if( $activity->get_project_id() == '')
+ {
+ $activity->set_project_id(1);
+ }
+
+ if( $activity->get_responsible_user_id() == '')
+ {
+ $activity->set_responsible_user_id(1);
+ }
+
+ $values = array(
+ $this->marshal($activity->get_parent_id(),
'int'),
+ $this->marshal($activity->get_name(), 'string'),
+ $this->marshal($activity->get_project_id(),
'int'),
+ $this->marshal($activity->get_start_date(),
'int'),
+ $this->marshal($activity->get_end_date(),
'int'),
+
$this->marshal($activity->get_responsible_user_id(), 'int'),
+ $this->marshal($activity->get_update_user(),
'int'),
+ $this->marshal(strtotime('now'), 'int')
+ );
+
+ $sql = 'INSERT INTO lg_activity (' . join(',', $cols) .
') VALUES (' . join(',', $values) . ')';
+ $result = $this->db->query($sql, __LINE__,__FILE__);
+
+ if($result)
+ {
+ // Return the new activity ID
+ return
$this->db->get_last_insert_id('lg_activity', 'id');
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ protected function update($activity)
+ {
+ $id = intval($activity->get_id());
+
+ $values = array(
+ 'name=' . $this->marshal($activity->get_name(),
'string'),
+ 'parent_activity_id=' .
$this->marshal($activity->get_parent_id(), 'int'),
+ 'project_id=' .
$this->marshal($activity->get_project_id(), 'int'),
+ 'start_date=' .
$this->marshal($activity->get_start_date(), 'int'),
+ 'end_date=' .
$this->marshal($activity->get_end_date(), 'int'),
+ 'responsible_user_id=' .
$this->marshal($activity->get_responsible_user_id(), 'int'),
+ 'update_user=' .
$this->marshal($activity->get_update_user(), 'int'),
+ 'update_date=' .
$this->marshal(strtotime('now'), 'int')
+ );
+
+ $result = $this->db->query('UPDATE lg_activity SET ' .
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+
+ if($result)
+ {
+ // Return the new activity ID
+ return $id;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ protected function get_id_field_name()
+ {
+ if(!$extended_info)
+ {
+ $ret = 'id';
+ }
+ else
+ {
+ $ret = array
+ (
+ 'table' => 'activity',
// alias
+ 'field' => 'id',
+ 'translated' => 'id'
+ );
+ }
+
+ return $ret;
+ }
+
+ protected function get_query(string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count)
+ {
+ $clauses = array('1=1');
+
+ if($search_for)
+ {
+ $like_pattern = "'%" .
$this->db->db_addslashes($search_for) . "%'";
+ $like_clauses = array();
+ switch($search_type)
+ {
+ default:
+ $like_clauses[] =
"activity.name $this->like $like_pattern";
+ break;
+ }
+ if(count($like_clauses))
+ {
+ $clauses[] = '(' . join(' OR ',
$like_clauses) . ')';
+ }
+ }
+
+ $filter_clauses = array();
+ if(isset($filters[$this->get_id_field_name()]))
+ {
+ $filter_clauses[] = "activity.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+ }
+ if(isset($filters['project']) && !$filters['project']
== '')
+ {
+ $filter_clauses[] = "activity.project_id =
{$this->marshal($filters['project'], 'int')}";
+ }
+ if(isset($filters['user']) && !$filters['user'] == '')
+ {
+ $filter_clauses[] =
"activity.responsible_user_id = {$this->marshal($filters['user'], 'int')}";
+ }
+
+ if(count($filter_clauses))
+ {
+ $clauses[] = join(' AND ', $filter_clauses);
+ }
+
+ $condition = join(' AND ', $clauses);
+
+ //$joins = " {$this->left_join} controller_control_area
ON (controller_procedure.control_area_id = controller_control_area.id)";
+ $tables = "lg_activity activity";
+
+ if($return_count) // We should only return a count
+ {
+ $cols = 'COUNT(DISTINCT(activity.id)) AS count';
+ }
+ else
+ {
+ $cols .= "* ";
+ }
+
+ $dir = $ascending ? 'ASC' : 'DESC';
+ $order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir ": '';
+
+ //var_dump("SELECT {$cols} FROM {$tables} {$joins}
WHERE {$condition} {$order}");
+
+ return "SELECT {$cols} FROM {$tables} WHERE
{$condition} {$order}";
+ }
+
+ protected function populate(int $activity_id, &$activity)
+ {
+ if($activity == null)
+ {
+ $activity = new logistic_activity((int)
$activity_id);
+
+
$activity->set_name($this->unmarshal($this->db->f('name'), 'string'));
+
$activity->set_parent_id($this->unmarshal($this->db->f('parent_id'), 'int'));
+
$activity->set_project_id($this->unmarshal($this->db->f('project_id'), 'int'));
+
$activity->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
+
$activity->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
+
$activity->set_responsible_user_id($this->unmarshal($this->db->f('responsible_user_id'),
'int'));
+
$activity->set_update_date($this->unmarshal($this->db->f('update_date'),
'int'));
+
$activity->set_update_user($this->unmarshal($this->db->f('update_user'),
'int'));
+ }
+
+ return $activity;
+ }
+
+ public function get_project_name($id)
+ {
+ if($id && is_numeric($id))
+ {
+ $result = $this->db->query('SELECT name FROM
lg_project WHERE id='.$id, __LINE__,__FILE__);
+
+ while($this->db->next_record())
+ {
+ // Return the new activity ID
+ return $this->db->f('name');
+ }
+ }
+ }
+
+ public function get_responsible_user($user_id)
+ {
+ if($user_id && is_numeric($user_id))
+ {
+ $account =
$GLOBALS['phpgw']->accounts->get($user_id);
+ if(isset($account))
+ {
+ return $account->__toString();
+ }
+ else
+ {
+ return lang('nobody');
+ }
+ }
+ }
+ }
\ No newline at end of file
Copied: branches/Version-1_0-branch/logistic/inc/class.socommon.inc.php (from
rev 10073, trunk/logistic/inc/class.socommon.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.socommon.inc.php
(rev 0)
+++ branches/Version-1_0-branch/logistic/inc/class.socommon.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -0,0 +1,367 @@
+<?php
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id$
+ */
+
+ abstract class logistic_socommon
+ {
+ protected $db;
+ protected $like;
+ protected $join;
+ protected $left_join;
+
+ public function __construct()
+ {
+ $this->db = clone
$GLOBALS['phpgw']->db;
+ $this->like = & $this->db->like;
+ $this->join = & $this->db->join;
+ $this->left_join = & $this->db->left_join;
+ }
+
+ /**
+ * Marshal values according to type
+ * @param $value the value
+ * @param $type the type of value
+ * @return database value
+ */
+ protected function marshal($value, $type)
+ {
+ if($value === null)
+ {
+ return 'NULL';
+ }
+ else if($type == 'int')
+ {
+ if($value == '')
+ {
+ return 'NULL';
+ }
+ return intval($value);
+ }
+ else if($type == 'float')
+ {
+ return str_replace(',', '.', $value);
+ }
+ else if($type == 'field')
+ {
+ return $this->db->db_addslashes($value);
+ }
+ else if($type == 'string' & $value == '')
+ {
+ return 'NULL';
+ }
+
+ return "'" . $this->db->db_addslashes($value) . "'";
+ }
+
+ /*
+
+ /**
+ * Unmarchal database values according to type
+ * @param $value the field value
+ * @param $type a string dictating value type
+ * @return the php value
+ */
+ protected function unmarshal($value, $type)
+ {
+ if($type == 'bool')
+ {
+ return (boolean)$value;
+ }
+ else if($type == 'boolean')
+ {
+ return (boolean) $value;
+ }
+ else if($type == 'int')
+ {
+ return (int) $value;
+ }
+ else if($type == 'float')
+ {
+ return (float) $value;
+ }
+ else if($type == 'string')
+ {
+ return (string) $value;
+ }
+ else if($value === null || $value == 'NULL')
+ {
+ return null;
+ }
+ return $value;
+ }
+
+ /**
+ * Get the count of the specified query. Query must return a
signel column
+ * called count.
+ *
+ * @param $sql the sql query
+ * @return the count value
+ */
+ protected function get_query_count($sql)
+ {
+ $result = $this->db->query($sql);
+ if($result && $this->db->next_record())
+ {
+ return $this->unmarshal($this->db->f('count',
true), 'int');
+ }
+ }
+
+ /**
+ * Implementing classes must return an instance of itself.
+ *
+ * @return the class instance.
+ */
+ public abstract static function get_instance();
+
+ /**
+ * Convenience method for getting one single object. Calls
get() with the
+ * specified id as a filter.
+ *
+ * @param $id int with id of object to return.
+ * @return object with the specified id, null if not found.
+ */
+ public function get_single(int $id)
+ {
+ $objects = $this->get(null, null, null, null, null,
null, array($this->get_id_field_name() => $id));
+ if(count($objects) > 0)
+ {
+ $keys = array_keys($objects);
+ return $objects[$keys[0]];
+ }
+ return null;
+ }
+
+ /**
+ * Method for retrieving the db-object (security "forgotten")
+ */
+ public function get_db()
+ {
+ return $this->db;
+ }
+
+ /**
+ * Method for retreiving objects.
+ *
+ * @param $start_index int with index of first object.
+ * @param $num_of_objects int with max number of objects to
return.
+ * @param $sort_field string representing the object field to
sort on.
+ * @param $ascending boolean true for ascending sort on sort
field, false
+ * for descending.
+ * @param $search_for string with free text search query.
+ * @param $search_type string with the query type.
+ * @param $filters array with key => value of filters.
+ * @return array of objects. May return an empty
+ * array, never null. The array keys are the respective index
numbers.
+ */
+ public function get(int $start_index, int $num_of_objects,
string $sort_field, boolean $ascending, string $search_for, string
$search_type, array $filters)
+ {
+ $results = array(); // Array to
store result objects
+ $map = array(); // Array to
hold number of records per target object
+ $check_map = array(); // Array to hold the
actual number of record read per target object
+ $object_ids = array(); // All of the object
ids encountered
+ $added_object_ids = array();// All of the added objects
ids
+
+ // Retrieve information about the table name and the
name and alias of id column
+ // $break_on_limit - flag indicating whether to
break the loop when the number of records
+ // for all
the result objects are traversed
+ $id_field_name_info = $this->get_id_field_name(true);
+ if(is_array($id_field_name_info))
+ {
+ $break_on_limit = true;
+ $id_field_name =
$id_field_name_info['translated'];
+ }
+ else
+ {
+ $break_on_limit = false;
+ $id_field_name = $id_field_name_info;
+ }
+
+ // Special case: Sort on id field. Always changed to
the id field name.
+ // $break_when_num_of_objects_reached - flag indicating
to break the loop when the number of
+ // results are reached and we are sure
that the records are ordered by the id
+ if($sort_field == null || $sort_field == 'id' ||
$sort_field == '')
+ {
+ $sort_field = $id_field_name;
+ $break_when_num_of_objects_reached = true;
+ }
+ else
+ {
+ $break_when_num_of_objects_reached = false;
+ }
+
+ // Only allow positive start index
+ if($start_index < 0)
+ {
+ $start_index = 0;
+ }
+
+ // test-input for break on ordered queries
+ $db2 = clone($this->db);
+
+ $sql = $this->get_query($sort_field, $ascending,
$search_for, $search_type, $filters, false);
+
+ $sql_parts = explode('1=1',$sql); // Split the query to
insert extra condition on test for break
+ $this->db->query($sql,__LINE__, __FILE__, false, true);
+
+ while ($this->db->next_record()) // Runs through all of
the results
+ {
+ $should_populate_object = false; // Default
value - we won't populate object
+ $result_id =
$this->unmarshal($this->db->f($id_field_name), 'int'); // The id of object
+
+ if(in_array($result_id, $added_object_ids)) //
Object with this id already added
+ {
+ $should_populate_object = true; // We
should populate this object as we already have it in our result array
+ }
+ else // Object isn't already added to array
+ {
+ if(!in_array($result_id, $object_ids))
// Haven't already added this id
+ {
+ $object_ids[] = $result_id; //
We have to add the new id
+ }
+ // We have to check if we should
populate this object
+ if(count($object_ids) > $start_index)
// We're at index above start index
+ {
+ if($num_of_objects == null ||
count($results) < $num_of_objects) // We haven't found all the objects we're
looking for
+ {
+ $should_populate_object
= true; // We should populate this object
+ $added_object_ids[] =
$result_id; // We keep the id
+ }
+ }
+ }
+ if($should_populate_object)
+ {
+ $result = &$results[$result_id];
+ $results[$result_id] =
$this->populate($result_id,$result);
+ $last_result_id = $result_id;
+ $map[$result_id] =
(int)$map[$result_id] +1;
+ }
+
+ //Stop looping when array not sorted on other
then id and wanted number of results is reached
+ if(count($results) == $num_of_objects &&
$last_result_id != $result_id && $break_when_num_of_objects_reached)
+ {
+ break;
+ }
+ // else stop looping when wanted number of
results is reached all records for result objects are read
+ else if($break_on_limit && (count($results) ==
$num_of_objects) && $last_result_id != $result_id)
+ {
+ $id_ok = 0;
+ foreach ($map as $_result_id => $_count)
+ {
+
if(!isset($check_map[$_result_id]))
+ {
+ // Query the number of
records for the specific object in question
+ $sql2 =
"{$sql_parts[0]} 1=1 AND
{$id_field_name_info['table']}.{$id_field_name_info['field']} = {$_result_id}
{$sql_parts[1]}";
+
$db2->query($sql2,__LINE__, __FILE__);
+ $db2->next_record();
+ $check_map[$_result_id]
= $db2->num_rows();
+ }
+ if( $check_map[$_result_id]
== $_count )
+ {
+ $id_ok++;
+ }
+ }
+ if($id_ok == $num_of_objects)
+ {
+ break;
+ }
+ }
+ }
+
+ return $results;
+ }
+
+ /**
+ * Returns count of matching objects.
+ *
+ * @param $search_for string with free text search query.
+ * @param $search_type string with the query type.
+ * @param $filters array with key => value of filters.
+ * @return int with object count.
+ */
+ public function get_count(string $search_for, string
$search_type, array $filters)
+ {
+ return $this->get_query_count($this->get_query(null,
null, $search_for, $search_type, $filters, true));
+ }
+
+ /**
+ * Implementing classes must return the name of the field used
in the query
+ * returned from get_query().
+ *
+ * @return string with name of id field.
+ */
+ protected abstract function get_id_field_name();
+
+ /**
+ * Returns SQL for retrieving matching objects or object count.
+ *
+ * @param $start_index int with index of first object.
+ * @param $num_of_objects int with max number of objects to
return.
+ * @param $sort_field string representing the object field to
sort on.
+ * @param $ascending boolean true for ascending sort on sort
field, false
+ * for descending.
+ * @param $search_for string with free text search query.
+ * @param $search_type string with the query type.
+ * @param $filters array with key => value of filters.
+ * @param $return_count boolean telling to return only the
count of the
+ * matching objects, or the objects themself.
+ * @return string with SQL.
+ */
+
+ protected abstract function get_query(string $sort_field,
boolean $ascending, string $search_for, string $search_type, array $filters,
boolean $return_count);
+
+ protected abstract function populate(int $object_id, &$object);
+
+ protected abstract function add(&$object);
+
+ protected abstract function update($object);
+
+ /**
+ * Store the object in the database. If the object has no ID it
is assumed to be new and
+ * inserted for the first time. The object is then updated with
the new insert id.
+ */
+
+ public function store(&$object)
+ {
+ if ($object->validates())
+ {
+ if ($object->get_id() > 0)
+ {
+ // We can assume this composite came
from the database since it has an ID. Update the existing row
+ return $this->update($object);
+ }
+ else
+ {
+ // This object does not have an ID, so
will be saved as a new DB row
+ return $this->add($object);
+ }
+ }
+
+ // The object did not validate
+ return false;
+ }
+ }
Copied: branches/Version-1_0-branch/logistic/inc/class.soproject.inc.php (from
rev 10073, trunk/logistic/inc/class.soproject.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.soproject.inc.php
(rev 0)
+++ branches/Version-1_0-branch/logistic/inc/class.soproject.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -0,0 +1,288 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id$
+ */
+
+ phpgw::import_class('logistic.socommon');
+
+ include_class('logistic', 'project', 'inc/model/');
+
+ class logistic_soproject extends logistic_socommon
+ {
+ protected static $so;
+
+ /**
+ * Get a static reference to the storage object associated with
this model object
+ *
+ * @return controller_soparty the storage object
+ */
+ public static function get_instance()
+ {
+ if (self::$so == null)
+ {
+ self::$so = CreateObject('logistic.soproject');
+ }
+ return self::$so;
+ }
+
+ protected function add(&$project)
+ {
+ $name = $project->get_name();
+ $description = $project->get_description();
+ $type_id = $project->geT_project_type_id();
+
+ $sql = "INSERT INTO lg_project (name, description,
project_type_id) VALUES ('$name','$description',$type_id)";
+ $result = $this->db->query($sql, __LINE__,__FILE__);
+
+ if($result)
+ {
+ // Set the new project ID
+ return
$this->db->get_last_insert_id('lg_project', 'id');
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
+ protected function update($project)
+ {
+ $id = intval($project->get_id());
+
+ $values = array(
+ 'name = ' .
$this->marshal($project->get_name(), 'string'),
+ 'description = ' .
$this->marshal($project->get_description(), 'string'),
+ 'project_type_id = ' .
$this->marshal($project->get_project_type_id(), 'int')
+ );
+
+ $result = $this->db->query('UPDATE lg_project SET ' .
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+
+ if( $result )
+ {
+ return $id;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ protected function get_id_field_name()
+ {
+ if(!$extended_info)
+ {
+ $ret = 'id';
+ }
+ else
+ {
+ $ret = array
+ (
+ 'table' => 'project',
// alias
+ 'field' => 'id',
+ 'translated' => 'id'
+ );
+ }
+
+ return $ret;
+ }
+
+ protected function get_query(string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count)
+ {
+ $clauses = array('1=1');
+ $project_type = false;
+ $table_alias = 'project';
+ if($search_type && $search_type == 'project_type')
+ {
+ $project_type = true;
+ $table_alias = 'project_type';
+ }
+
+ if($search_for)
+ {
+ $like_pattern = "'%" .
$this->db->db_addslashes($search_for) . "%'";
+ $like_clauses = array();
+ switch($search_type)
+ {
+ default:
+ $like_clauses[] =
"{$table_alias}.name $this->like $like_pattern";
+ break;
+ }
+ if(count($like_clauses))
+ {
+ $clauses[] = '(' . join(' OR ',
$like_clauses) . ')';
+ }
+ }
+
+ $filter_clauses = array();
+ if(isset($filters[$this->get_id_field_name()]))
+ {
+ $filter_clauses[] = "{$table_alias}.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+ }
+ if(isset($filters['project_type']) &&
!$filters['project_type'] == '')
+ {
+ $filter_clauses[] =
"{$table_alias}.project_type_id = {$this->marshal($filters['project_type'],
'int')}";
+ }
+
+ if(count($filter_clauses))
+ {
+ $clauses[] = join(' AND ', $filter_clauses);
+ }
+
+ $condition = join(' AND ', $clauses);
+
+ //$joins = " {$this->left_join} controller_control_area
ON (controller_procedure.control_area_id = controller_control_area.id)";
+
+ if($project_type)
+ {
+ $tables = "lg_project_type project_type";
+ }
+ else
+ {
+ $tables = "lg_project project";
+ }
+
+ if($return_count) // We should only return a count
+ {
+ $cols = 'COUNT(DISTINCT('.$table_alias.'.id))
AS count';
+ }
+ else
+ {
+ $cols .= "* ";
+ }
+
+ $dir = $ascending ? 'ASC' : 'DESC';
+ $order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir ": '';
+
+ //var_dump("SELECT {$cols} FROM {$tables} {$joins}
WHERE {$condition} {$order}");
+
+ return "SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}";
+ }
+
+ protected function populate(int $project_id, &$project)
+ {
+ if($project == null)
+ {
+ $project = new logistic_project((int)
$project_id);
+
+
$project->set_name($this->unmarshal($this->db->f('name'), 'string'));
+
$project->set_description($this->unmarshal($this->db->f('description'),
'string'));
+
$project->set_project_type_id($this->unmarshal($this->db->f('project_type_id'),
'int'));
+ if($project->get_project_type_id() &&
$project->get_project_type_id() > 0)
+ {
+
$project->set_project_type_label($this->get_project_type_label($this->unmarshal($this->db->f('project_type_id'),
'int')));
+ }
+ }
+
+ return $project;
+ }
+
+ public function get_projects()
+ {
+ $project_array = array();
+ $project_array[] = array(
+ 'id' => '',
+ 'name' => lang('all_types'),
+ 'selected' => 1
+ );
+ $sql = "SELECT id, name FROM lg_project";
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ while ($this->db->next_record())
+ {
+ $project_array[] = array(
+ 'id' => $this->db->f('id'),
+ 'name' =>
$this->unmarshal($this->db->f('name'), 'string')
+ );
+ }
+ return $project_array;
+ }
+
+
+ private function get_project_type_label($id)
+ {
+ $sql = "SELECT name FROM lg_project_type where id=$id";
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ while ($this->db->next_record())
+ {
+ return $this->db->f('name');
+ }
+ }
+
+ public function get_project_types()
+ {
+ $project_type_array = array();
+ $project_type_array[] = array(
+ 'id' => '',
+ 'name' => lang('all_types'),
+ 'selected' => 1
+ );
+ $sql = "SELECT * FROM lg_project_type";
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ while ($this->db->next_record())
+ {
+ $project_type_array[] = array(
+ 'id' => $this->db->f('id'),
+ 'name' =>
$this->unmarshal($this->db->f('name'), 'string')
+ );
+ }
+ return $project_type_array;
+ }
+
+ public function update_project_type($id, $name)
+ {
+ $sql = "UPDATE lg_project_type set name='{$name}' where
id={$id}";
+ $result = $this->db->query($sql, __LINE__,__FILE__);
+
+ if( $result )
+ {
+ return $id;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public function add_project_type($name)
+ {
+ $sql = "INSERT INTO lg_project_type (name) VALUES
('{$name}')";
+ $result = $this->db->query($sql, __LINE__,__FILE__);
+
+ if($result)
+ {
+ return
$this->db->get_last_insert_id('lg_project_type', 'id');
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
\ No newline at end of file
Copied: branches/Version-1_0-branch/logistic/inc/class.uiactivity.inc.php (from
rev 10073, trunk/logistic/inc/class.uiactivity.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.uiactivity.inc.php
(rev 0)
+++ branches/Version-1_0-branch/logistic/inc/class.uiactivity.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -0,0 +1,392 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id$
+ */
+ phpgw::import_class('phpgwapi.uicommon');
+ phpgw::import_class('logistic.soactivity');
+
+ include_class('logistic', 'actvity');
+
+ class logistic_uiactivity extends phpgwapi_uicommon
+ {
+
+ private $so;
+ private $so_project;
+ public $public_functions = array(
+ 'query' => true,
+ 'add' => true,
+ 'edit' => true,
+ 'view' => true,
+ 'index' => true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->so = createObject('logistic.soactivity');
+ $this->so_project = createObject('logistic.soproject');
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"logistic::project::activity";
+ }
+
+ 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');
+
+ $project_array = $this->so_project->get_projects();
+ $user_array = $this->get_user_array();
+
+ $data = array(
+ 'datatable_name' => lang('activity'),
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array('type' =>
'filter',
+ 'name' =>
'project',
+ 'text' =>
lang('Project') . ':',
+ 'list' =>
$project_array,
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'user',
+ 'text' =>
lang('Responsible user') . ':',
+ 'list' =>
$user_array,
+ ),
+ array('type' => 'text',
+ 'text' =>
lang('search'),
+ 'name' =>
'query'
+ ),
+ array(
+ 'type' =>
'submit',
+ 'name' =>
'search',
+ 'value' =>
lang('Search')
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' => 'logistic.uiactivity.index', 'phpgw_return_as'
=> 'json')),
+ 'field' => array(
+ array(
+ 'key' => 'name',
+ 'label' =>
lang('Activity name'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'id',
+ 'label' => lang('ID'),
+ 'sortable' => true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' => 'project_name',
+ 'label' =>
lang('Project'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'start_date',
+ 'label' => lang('Start
date'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'end_date',
+ 'label' => lang('End
date'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' =>
'responsible_user_id',
+ 'label' =>
lang('Responsible user'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ )
+ )
+ ),
+ );
+
+
+ $parameters = array
+ (
+ 'parameter' => array
+ (
+ array
+ (
+ 'name' =>
'parent_id',
+ 'source' => 'id'
+ ),
+ )
+ );
+
+ $data['datatable']['actions'][] = array
+ (
+ 'my_name' =>
'new',
+ 'text' =>
lang('add sub activity'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'logistic.uiactivity.edit'
+ )),
+ 'parameters' =>
json_encode($parameters)
+ );
+
+
+
+ self::render_template_xsl(array('datatable_common'),
$data);
+ }
+
+ public function query()
+ {
+ $params = array(
+ 'start' => phpgw::get_var('startIndex', 'int',
'REQUEST', 0),
+ 'results' => phpgw::get_var('results', 'int',
'REQUEST', null),
+ 'query' => phpgw::get_var('query'),
+ 'sort' => phpgw::get_var('sort'),
+ 'dir' => phpgw::get_var('dir'),
+ 'filters' => $filters
+ );
+
+ if
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+ {
+ $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $user_rows_per_page = 10;
+ }
+ // YUI variables for paging and sorting
+ $start_index = phpgw::get_var('startIndex', 'int');
+ $num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
+ $sort_field = phpgw::get_var('sort');
+ $sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
+ // Form variables
+ $search_for = phpgw::get_var('query');
+ $search_type = phpgw::get_var('search_option');
+ // Create an empty result set
+ $result_objects = array();
+ $result_count = 0;
+
+ //Retrieve a contract identifier and load corresponding
contract
+ //$activity_id = phpgw::get_var('activity_id');
+
+ $exp_param = phpgw::get_var('export');
+ $export = false;
+ if (isset($exp_param))
+ {
+ $export = true;
+ $num_of_objects = null;
+ }
+
+ //Retrieve the type of query and perform type specific
logic
+ $query_type = phpgw::get_var('type');
+ //var_dump($query_type);
+ switch ($query_type)
+ {
+ default: // ... all activities, filters (active
and vacant)
+ phpgwapi_cache::session_set('logistic',
'activity_query', $search_for);
+ $filters = array('project' =>
phpgw::get_var('project'), 'user' => phpgw::get_var('user'));
+ $result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters);
+ $object_count =
$this->so->get_count($search_for, $search_type, $filters);
+ break;
+ }
+
+ //Create an empty row set
+ $rows = array();
+ foreach ($result_objects as $result)
+ {
+ if (isset($result))
+ {
+ $rows[] = $result->serialize();
+ }
+ }
+
+ // ... add result data
+ $result_data = array('results' => $rows);
+
+ $result_data['total_records'] = $object_count;
+ $result_data['start'] = $params['start'];
+ $result_data['sort'] = $params['sort'];
+ $result_data['dir'] = $params['dir'];
+
+ $editable = phpgw::get_var('editable') == 'true' ? true
: false;
+
+ if (!$export)
+ {
+ //Add action column to each row in result table
+ array_walk(
+
$result_data['results'],
+ array($this,
'_add_links'),
+
"logistic.uiactivity.view"
+ );
+ }
+
+ return $this->yui_results($result_data);
+ }
+
+ public function add()
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.edit'));
+ }
+
+ public function edit()
+ {
+ $activity_id = phpgw::get_var('id');
+ if ($activity_id && is_numeric($activity_id))
+ {
+ $activity = $this->so->get_single($activity_id);
+ }
+ else
+ {
+ $activity = new logistic_activity();
+ }
+
+ $activity->set_project_id(phpgw::get_var('project_id'));
+
+ if (isset($_POST['save_activity']))
+ {
+ $user_id = $GLOBALS['phpgw_info']['user']['id'];
+ $activity->set_id( phpgw::get_var('id') );
+ $activity->set_name( phpgw::get_var('name') );
+ $activity->set_update_user( $user_id );
+ $activity->set_responsible_user_id(
phpgw::get_var('responsible_user_id') );
+
+ if(phpgw::get_var('start_date','string') != '')
+ {
+ $start_date_ts =
phpgwapi_datetime::date_to_timestamp( phpgw::get_var('start_date','string') );
+
$activity->set_start_date($start_date_ts);
+ }
+ else
+ {
+ $activity->set_start_date(0);
+ }
+
+ if( phpgw::get_var('end_date','string') != '')
+ {
+ $end_date_ts =
phpgwapi_datetime::date_to_timestamp( phpgw::get_var('end_date','string') );
+ $activity->set_end_date($end_date_ts);
+ }
+ else
+ {
+ $activity->set_end_date(0);
+ }
+
+ $activity_id = $this->so->store($activity);
+
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.view', 'id' => $activity_id,
'project_id' => $activity->get_project_id()));
+ }
+ else if (isset($_POST['cancel_activity']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.view', 'id' => $activity_id));
+ }
+ else
+ {
+
+ $accounts =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
+
+
+ $data = array
+ (
+ 'user_array' => $accounts,
+ 'activity' => $activity->toArray(),
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'editable' => true,
+ );
+
+ $this->use_yui_editor('description');
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Add activity');
+
+
$GLOBALS['phpgw']->jqcal->add_listener('start_date');
+
$GLOBALS['phpgw']->jqcal->add_listener('end_date');
+
+
self::render_template_xsl(array('activity_item'), $data);
+ }
+ }
+
+
+ public function view()
+ {
+ $activity_id = phpgw::get_var('id');
+ $project_id = phpgw::get_var('project_id');
+ if (isset($_POST['edit_activity']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.edit', 'id' => $activity_id,
'project_id' => $project_id));
+ }
+ else if (isset($_POST['new_activity']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.edit', 'project_id' => $project_id));
+ }
+ else
+ {
+ if ($activity_id && is_numeric($activity_id))
+ {
+ $activity =
$this->so->get_single($activity_id);
+ }
+
+ $activity_array = $activity->toArray();
+
+ if ($this->flash_msgs)
+ {
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ }
+
+ $activity->set_project_id($project_id);
+
+ $data = array
+ (
+ 'activity' =>
$activity->toArray(),
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'dateformat'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project');
+
self::render_template_xsl(array('activity_item'), $data);
+ }
+ }
+
+ private function get_user_array()
+ {
+ $user_array = array();
+ $user_array[] = array(
+ 'id' => '',
+ 'name' => lang('all_types')
+ );
+ $user_array[] = array(
+ 'id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
+ 'name' => lang('my_activities'),
+ 'selected' => 1
+ );
+
+ return $user_array;
+ }
+ }
Copied: branches/Version-1_0-branch/logistic/inc/class.uiproject.inc.php (from
rev 10073, trunk/logistic/inc/class.uiproject.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.uiproject.inc.php
(rev 0)
+++ branches/Version-1_0-branch/logistic/inc/class.uiproject.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -0,0 +1,521 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id$
+ */
+ phpgw::import_class('phpgwapi.uicommon');
+ phpgw::import_class('logistic.soproject');
+
+ include_class('logistic', 'project');
+
+ class logistic_uiproject extends phpgwapi_uicommon
+ {
+
+ private $so;
+ public $public_functions = array(
+ 'query' => true,
+ 'index' => true,
+ 'project_types' => true,
+ 'view' => true,
+ 'view_project_type' => true,
+ 'edit_project_type' => true,
+ 'edit_project_type_name' => true,
+ 'add' => true,
+ 'edit' => true,
+ 'edit_something' => true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->so = CreateObject('logistic.soproject');
+
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"logistic::project";
+ }
+
+ public function query()
+ {
+ $params = array(
+ 'start' => phpgw::get_var('startIndex', 'int',
'REQUEST', 0),
+ 'results' => phpgw::get_var('results', 'int',
'REQUEST', null),
+ 'query' => phpgw::get_var('query'),
+ 'sort' => phpgw::get_var('sort'),
+ 'dir' => phpgw::get_var('dir'),
+ 'filters' => $filters
+ );
+
+ if
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+ {
+ $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $user_rows_per_page = 10;
+ }
+ // YUI variables for paging and sorting
+ $start_index = phpgw::get_var('startIndex', 'int');
+ $num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
+ $sort_field = phpgw::get_var('sort');
+ $sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
+ // Form variables
+ $search_for = phpgw::get_var('query');
+ $search_type = phpgw::get_var('search_option');
+ // Create an empty result set
+ $result_objects = array();
+ $result_count = 0;
+
+ //Retrieve a contract identifier and load corresponding
contract
+ $project_id = phpgw::get_var('project_id');
+
+ $exp_param = phpgw::get_var('export');
+ $export = false;
+ if (isset($exp_param))
+ {
+ $export = true;
+ $num_of_objects = null;
+ }
+
+ //Retrieve the type of query and perform type specific
logic
+ $query_type = phpgw::get_var('type');
+ //var_dump($query_type);
+ switch ($query_type)
+ {
+ case 'project_type':
+ phpgwapi_cache::session_set('logistic',
'project_type_query', $search_for);
+ $search_type = 'project_type';
+ $result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters);
+ $object_count =
$this->so->get_count($search_for, $search_type, $filters);
+ break;
+ default: // ... all composites, filters (active
and vacant)
+ phpgwapi_cache::session_set('logistic',
'project_query', $search_for);
+ $filters = array('project_type' =>
phpgw::get_var('project_type'));
+ $result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters);
+ $object_count =
$this->so->get_count($search_for, $search_type, $filters);
+ break;
+ }
+
+ //Create an empty row set
+ $rows = array();
+ foreach ($result_objects as $result)
+ {
+ if (isset($result))
+ {
+ $rows[] = $result->serialize();
+ }
+ }
+
+ // ... add result data
+ $result_data = array('results' => $rows);
+
+ $result_data['total_records'] = $object_count;
+ $result_data['start'] = $params['start'];
+ $result_data['sort'] = $params['sort'];
+ $result_data['dir'] = $params['dir'];
+
+ $editable = phpgw::get_var('editable') == 'true' ? true
: false;
+
+ if (!$export)
+ {
+ //Add action column to each row in result table
+ if ($search_type && $search_type ==
'project_type')
+ {
+ array_walk(
+
$result_data['results'], array($this, '_add_links'),
"logistic.uiproject.view_project_type");
+ }
+ else
+ {
+ array_walk(
+
$result_data['results'], array($this, '_add_links'), "logistic.uiproject.view");
+ }
+ }
+ return $this->yui_results($result_data);
+ }
+
+ public function index()
+ {
+ if (phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ return $this->query();
+ }
+// self::add_javascript('logistic', 'yahoo',
'datatable.js');
+ self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('paginator');
+
+ $project_type_array = $this->so->get_project_types();
+
+ $data = array(
+ 'datatable_name' => lang('project'),
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array('type' =>
'filter',
+ 'name' =>
'project_type',
+ 'text' =>
lang('Project_type') . ':',
+ 'list' =>
$project_type_array,
+ ),
+ array('type' => 'text',
+ 'text' =>
lang('search'),
+ 'name' =>
'query'
+ ),
+ array(
+ 'type' =>
'submit',
+ 'name' =>
'search',
+ 'value' =>
lang('Search')
+ ),
+ array(
+ 'type' =>
'link',
+ 'value' =>
lang('t_new_project'),
+ 'href' =>
self::link(array('menuaction' => 'logistic.uiproject.add')),
+ 'class' =>
'new_item'
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' => 'logistic.uiproject.index', 'phpgw_return_as'
=> 'json')),
+ 'editor_action' =>
'logistic.uiproject.edit_something',
+ 'field' => array(
+ array(
+ 'key' => 'name',
+ 'label' =>
lang('Project name'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'id',
+ 'label' => lang('ID'),
+ 'sortable' => true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' => 'description',
+ 'label' =>
lang('Project description'),
+ 'sortable' => false,
+ 'editor' => 'new
YAHOO.widget.TextboxCellEditor({disableBtns:true})'
+ ),
+ array(
+ 'key' =>
'project_type_label',
+ 'label' =>
lang('Project type'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ )
+ )
+ ),
+ );
+
+ self::render_template_xsl('datatable_common', $data);
+ }
+
+ public function edit_something()
+ {
+ return 'kvittering';
+ }
+
+ public function project_types()
+ {
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"admin::logistic::project_types";
+ 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');
+
+ $project_type_id = phpgw::get_var('id');
+ $new_type = phpgw::get_var('new_type');
+ $edit_type = phpgw::get_var('edit_type');
+
+ if ($new_type || $edit_type)
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiproject.edit_project_type'));
+ }
+ else
+ {
+ //list project types
+ $data = array(
+ 'datatable_name' =>
lang('project types'),
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array('type' =>
'text',
+ 'text'
=> lang('search'),
+ 'name'
=> 'query'
+ ),
+ array(
+ 'type'
=> 'submit',
+ 'name'
=> 'search',
+ 'value'
=> lang('Search')
+ ),
+ array(
+ 'type'
=> 'link',
+ 'value'
=> lang('t_new_project_type'),
+ 'href'
=> self::link(array('menuaction' => 'logistic.uiproject.project_types',
'new_type' => 'yes')),
+ 'class'
=> 'new_item'
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' => 'logistic.uiproject.project_types',
'phpgw_return_as' => 'json', 'type' => 'project_type')),
+ 'editor_action' =>
'logistic.uiproject.edit_project_type_name',
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' =>
lang('ID'),
+ 'sortable' =>
true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' => 'name',
+ 'label' =>
lang('Project type name'),
+ 'sortable' =>
false,
+ 'editor' =>
'new YAHOO.widget.TextboxCellEditor({disableBtns:true})'
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ )
+ )
+ ),
+ );
+
+
self::render_template_xsl(array('datatable_common'), $data);
+ }
+ }
+
+ public function view()
+ {
+ $project_id = phpgw::get_var('id');
+ if (isset($_POST['edit_project']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiproject.edit', 'id' => $project_id));
+ }
+ else if (isset($_POST['new_activity']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.edit', 'project_id' => $project_id));
+ }
+ else
+ {
+ if ($project_id && is_numeric($project_id))
+ {
+ $project =
$this->so->get_single($project_id);
+ }
+
+ $project_array = $project->toArray();
+
+ if ($this->flash_msgs)
+ {
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ }
+
+ $data = array
+ (
+ 'value_id' => !empty($project) ?
$project->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'project' => $project_array,
+ 'view' => 'view_project'
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project');
+
self::render_template_xsl(array('project_item'), $data);
+ }
+ }
+
+ public function view_project_type()
+ {
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"admin::logistic::project_types";
+ $project_type_id = phpgw::get_var('id');
+ if (isset($_POST['edit_project_type']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiproject.edit_project_type', 'id' =>
$project_type_id));
+ }
+ else
+ {
+ if ($project_type_id &&
is_numeric($project_type_id))
+ {
+ $objects = $this->so->get(null, null,
null, null, null, 'project_type', array('id' => $project_type_id));
+ if (count($objects) > 0)
+ {
+ $keys = array_keys($objects);
+ $project = $objects[$keys[0]];
+ }
+ }
+
+ $project_array = $project->toArray();
+
+ $data = array
+ (
+ 'value_id' => !empty($project) ?
$project->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'project' => $project_array
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
+
self::render_template_xsl(array('project_type_item'), $data);
+ }
+ }
+
+ public function edit_project_type()
+ {
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"admin::logistic::project_types";
+ $project_type_id = phpgw::get_var('id');
+ if ($project_type_id && is_numeric($project_type_id))
+ {
+ $objects = $this->so->get(null, null, null,
null, null, 'project_type', array('id' => $project_type_id));
+ if (count($objects) > 0)
+ {
+ $keys = array_keys($objects);
+ $project = $objects[$keys[0]];
+ }
+ }
+ else
+ {
+ $project = new logistic_project();
+ }
+ if (isset($_POST['save_project_type']))
+ {
+ $project_type_name = phpgw::get_var('title');
+ if (!$project_type_id ||
is_null($project_type_id))
+ {
+ $project_type_id =
$this->so->add_project_type($project_type_name);
+ }
+ else
+ {
+
$this->so->update_project_type($project_type_id, $project_type_name);
+ }
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiproject.view_project_type', 'id' =>
$project_type_id));
+ }
+ else if (isset($_POST['cancel_project_type']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiproject.view_project_type', 'id' =>
$project_type_id));
+ }
+ else
+ {
+ $project_array = $project->toArray();
+
+ $data = array
+ (
+ 'value_id' => !empty($project) ?
$project->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'project' => $project_array,
+ 'editable' => true
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
+
self::render_template_xsl(array('project_type_item'), $data);
+ }
+ }
+
+ public function edit_project_type_name()
+ {
+ $project_type_id = phpgw::get_var('id');
+ if ($project_type_id && is_numeric($project_type_id))
+ {
+ $objects = $this->so->get(null, null, null,
null, null, 'project_type', array('id' => $project_type_id));
+ if (count($objects) > 0)
+ {
+ $keys = array_keys($objects);
+ $project = $objects[$keys[0]];
+ }
+ }
+ else
+ {
+ return "Ugyldig operasjon";
+ }
+
+ $project_type_name = phpgw::get_var('value');
+ $this->so->update_project_type($project_type_id,
$project_type_name);
+
+ return lang('Project type name updated');
+ }
+
+ public function add()
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiproject.edit'));
+ }
+
+ public function edit()
+ {
+ $project_id = phpgw::get_var('id');
+ if ($project_id && is_numeric($project_id))
+ {
+ $project = $this->so->get_single($project_id);
+ }
+ else
+ {
+ $project = new logistic_project();
+ }
+
+ if (isset($_POST['save_project']))
+ {
+ $project->set_name(phpgw::get_var('name'));
+
$project->set_project_type_id(phpgw::get_var('project_type_id'));
+
$project->set_description(phpgw::get_var('description'));
+
+ $project_id = $this->so->store($project);
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiproject.view', 'id' => $project_id));
+ }
+ else if (isset($_POST['cancel_project']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiproject.view', 'id' => $project_id));
+ }
+ else
+ {
+ $project_types = $this->so->get_project_types();
+ foreach ($project_types as &$p_type)
+ {
+ if ($project->get_project_type_id() ==
$p_type['id'])
+ {
+ $p_type['selected'] = 1;
+ }
+ }
+ $project_array = $project->toArray();
+
+ $data = array
+ (
+ 'value_id' => !empty($project) ?
$project->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'project' => $project_array,
+ 'options' => $project_types,
+ 'editable' => true
+ );
+
+ $this->use_yui_editor('description');
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
+
self::render_template_xsl(array('project_item'), $data);
+ }
+ }
+
+ }
+
Copied: branches/Version-1_0-branch/logistic/inc/model/class.activity.inc.php
(from rev 10073, trunk/logistic/inc/model/class.activity.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/inc/model/class.activity.inc.php
(rev 0)
+++ branches/Version-1_0-branch/logistic/inc/model/class.activity.inc.php
2012-10-01 19:07:48 UTC (rev 10074)
@@ -0,0 +1,179 @@
+<?php
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id $
+ */
+
+ include_class('logistic', 'model', '/inc/model/');
+
+ class logistic_activity extends logistic_model
+ {
+ public static $so;
+
+ protected static $id;
+ protected static $name;
+ protected static $parent_id;
+ protected static $project_id;
+ protected static $start_date;
+ protected static $end_date;
+ protected static $responsible_user_id;
+ protected static $update_user;
+ protected static $update_date;
+
+ /**
+ * Constructor. Takes an optional ID. If a
contract is created from outside
+ * the database the ID should be empty so the
database can add one according to its logic.
+ *
+ * @param int $id the id of this project
+ */
+ public function __construct(int $id = null)
+ {
+// echo "1";
+ $this->id = (int)$id;
+ }
+
+ public function set_id($id)
+ {
+ $this->id = $id;
+ }
+
+ public function get_id()
+ {
+ return $this->id;
+ }
+
+ public function set_name($name)
+ {
+ $this->name = $name;
+ }
+
+ public function get_name()
+ {
+ return $this->name;
+ }
+
+ public function set_parent_id($parent_id)
+ {
+ $this->parent_id = $parent_id;
+ }
+
+ public function get_parent_id()
+ {
+ return $this->parent_id;
+ }
+
+ public function set_project_id($project_id)
+ {
+ $this->project_id = $project_id;
+ }
+
+ public function get_project_id()
+ {
+ return $this->project_id;
+ }
+
+ public function set_start_date($start_date)
+ {
+ $this->start_date = $start_date;
+ }
+
+ public function get_start_date()
+ {
+ return $this->start_date;
+ }
+
+ public function set_end_date($end_date)
+ {
+ $this->end_date = $end_date;
+ }
+
+ public function get_end_date()
+ {
+ return $this->end_date;
+ }
+
+ public function
set_responsible_user_id($responsible_user_id)
+ {
+ $this->responsible_user_id =
$responsible_user_id;
+ }
+
+ public function get_responsible_user_id()
+ {
+ return $this->responsible_user_id;
+ }
+
+ public function set_update_user($user_id)
+ {
+ $this->update_user = $user_id;
+ }
+
+ public function get_update_user()
+ {
+ return $this->update_user;
+ }
+
+ public function set_update_date($date)
+ {
+ $this->update_date = $date;
+ }
+
+ public function get_update_date()
+ {
+ return $this->update_date;
+ }
+
+ /**
+ * Get a static reference to the storage object
associated with this model object
+ *
+ * @return the storage object
+ */
+ public static function get_so()
+ {
+ if (self::$so == null) {
+ self::$so =
CreateObject('logistic.soactivity');
+ }
+
+ return self::$so;
+ }
+
+ public function serialize()
+ {
+ $date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $project_name =
$this->get_so()->get_project_name($this->get_project_id());
+ $responsible_user =
$this->get_so()->get_responsible_user($this->get_responsible_user_id());
+
+ return array(
+ 'id' => $this->get_id(),
+ 'parent_id' =>
$this->get_parent_id(),
+ 'name' => $this->get_name(),
+ 'project_id' =>
$this->get_project_id(),
+ 'project_name' => $project_name,
+ 'start_date' =>
$this->get_start_date() ? date($date_format, $this->get_start_date()): '',
+ 'end_date' =>
$this->get_end_date() ? date($date_format, $this->get_end_date()): '',
+ 'responsible_user_id' =>
$responsible_user
+ );
+ }
+ }
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10074] Merge 10032:10073 from trunk,
Sigurd Nes <=