[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7719] Merge 7657:7718 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7719] Merge 7657:7718 from trunk |
Date: |
Mon, 26 Sep 2011 12:11:15 +0000 |
Revision: 7719
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7719
Author: sigurdne
Date: 2011-09-26 12:11:15 +0000 (Mon, 26 Sep 2011)
Log Message:
-----------
Merge 7657:7718 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/css/base.css
branches/Version-1_0-branch/controller/inc/class.menu.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_area.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
branches/Version-1_0-branch/controller/inc/model/class.model.inc.php
branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php
branches/Version-1_0-branch/controller/js/yahoo/datatable.js
branches/Version-1_0-branch/controller/setup/phpgw_no.lang
branches/Version-1_0-branch/controller/setup/tables_current.inc.php
branches/Version-1_0-branch/controller/templates/base/control_item.xsl
branches/Version-1_0-branch/controller/templates/base/css/base.css
branches/Version-1_0-branch/controller/templates/base/datatable.xsl
branches/Version-1_0-branch/hrm/inc/class.sojob.inc.php
branches/Version-1_0-branch/hrm/inc/class.uijob.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.db.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.db_adodb.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.db_pdo.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.setup.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.setup_detection.inc.php
branches/Version-1_0-branch/setup/index.php
Added Paths:
-----------
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
branches/Version-1_0-branch/controller/inc/class.uiexample.inc.php
branches/Version-1_0-branch/controller/js/yahoo/control_tabs.js
branches/Version-1_0-branch/controller/js/yahoo/example_edit.js
branches/Version-1_0-branch/controller/js/yahoo/example_normal_tabs.js
branches/Version-1_0-branch/controller/templates/base/control.xsl
branches/Version-1_0-branch/controller/templates/base/control_group.xsl
branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
branches/Version-1_0-branch/controller/templates/base/control_items.xsl
branches/Version-1_0-branch/controller/templates/base/control_tabs.xsl
branches/Version-1_0-branch/controller/templates/base/example_edit.xsl
branches/Version-1_0-branch/controller/templates/base/example_normal_tabs.xsl
Removed Paths:
-------------
branches/Version-1_0-branch/controller/inc/class.uicontrol_item2.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_type.inc.php
branches/Version-1_0-branch/controller/templates/base/control.php
branches/Version-1_0-branch/controller/templates/base/control_item.php
branches/Version-1_0-branch/controller/templates/base/control_item_list.php
branches/Version-1_0-branch/controller/templates/base/property_location_partial.php
branches/Version-1_0-branch/controller/templates/base/unit_list_partial.php
Property Changed:
----------------
branches/Version-1_0-branch/
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
+
/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
Modified:
branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -938,6 +938,7 @@
$city = '';
}
$district = $org_info['district'];
+ $status = $org_info['status'];
$columns[] = 'name';
$columns[] = 'homepage';
@@ -949,6 +950,7 @@
//$columns[] = 'city';
$columns[] = 'orgno';
$columns[] = 'district';
+ $columns[] = 'change_type';
$cols = implode(',',$columns);
$values[] = "'{$name}'";
@@ -961,6 +963,7 @@
//$values[] = "'{$city}'";
$values[] = "'{$orgnr}'";
$values[] = "'{$district}'";
+ $values[] = "'{$status}'";
$vals = implode(',',$values);
//var_dump("INSERT INTO activity_organization ({$cols}) VALUES
({$vals})");
@@ -1015,15 +1018,18 @@
$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})";
Modified:
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
---
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -133,6 +133,7 @@
$org_info['street'] =
phpgw::get_var('address') . ' ' . phpgw::get_var('number') . ', ' .
phpgw::get_var('postaddress');
//$org_info['zip'] =
phpgw::get_var('postaddress');
$org_info['district'] =
phpgw::get_var('org_district');
+ $org_info['status'] = "new";
$o_id =
$so_activity->add_organization_local($org_info);
//add contact persons
@@ -163,6 +164,7 @@
$group_info['name'] =
phpgw::get_var('groupname');
$group_info['organization_id']
= $o_id;
$group_info['description'] =
phpgw::get_var('group_description');
+ $group_info['status'] = "new";
$g_id =
$so_activity->add_group_local($group_info);
//add contact persons
@@ -197,10 +199,10 @@
{
if(isset($activity)) // If an activity object
is created
{
- var_dump("lagre1");
+// var_dump("lagre1");
$old_state = $activity->get_state();
$new_state = phpgw::get_var('state');
- var_dump("lagre2");
+// var_dump("lagre2");
// ... set all parameters
$activity->set_title(phpgw::get_var('title'));
//$activity->set_organization_id(phpgw::get_var('organization_id'));
@@ -220,7 +222,7 @@
{
$activity->set_state($new_state);
}
- var_dump("lagre3");
+// var_dump("lagre3");
$activity->set_category(phpgw::get_var('category'));
$target_array =
phpgw::get_var('target');
$activity->set_target(implode(",",
$target_array));
@@ -229,7 +231,7 @@
$activity->set_contact_persons($persons);
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
- var_dump("storing");
+// var_dump("storing");
if($so_activity->store($activity)) //
... and then try to store the object
{
Modified:
branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
2011-09-26 12:11:15 UTC (rev 7719)
@@ -58,4 +58,6 @@
org_helptext activitycalendarfrontend no Velg organisasjon
aktiviteten skal knyttes til. <br/>Dersom din organisasjon ikke finnes, velg
"Ny organisasjon" og fyll ut feltene som vises under.
group_helptext activitycalendarfrontend no Velg gruppe/lag
aktiviteten skal knyttes til. <br/>Dersom gruppen/laget ikke finnes, velg "Ny
gruppe" og fyll ut feltene som vises under.
int_arena_helptext activitycalendarfrontend no Dersom
aktiviteten skal finne sted i et kommunalt bygg velges dette fra listen her.
-arena_helptext activitycalendarfrontend no Dersom aktiviteten skal
finne sted på en ikke-kommunal arena, velges dette her.<br/>Dersom aktiviteten
finner sted på flere arenaer, velg hovedarena her.
\ No newline at end of file
+arena_helptext activitycalendarfrontend no Dersom aktiviteten skal
finne sted på en ikke-kommunal arena, velges dette her.<br/>Dersom aktiviteten
finner sted på flere arenaer, velg hovedarena her.
+messages_saved_form activitycalendarfrontend no Aktiviteten ble
lagret
+messages_form_error activitycalendarfrontend no Det oppstod et
problem under lagring
\ No newline at end of file
Modified:
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
===================================================================
---
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
2011-09-26 12:08:19 UTC (rev 7718)
+++
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -21,12 +21,12 @@
if(org_id != null && org_id == 'new_org')
{
//alert('new_org');
- document.getElementById('new_org_group').style.display =
"block";
+ document.getElementById('new_org').style.display = "block";
document.getElementById('new_org_fields').style.display =
"block";
}
else
{
- document.getElementById('new_org_group').style.display = "none";
+ document.getElementById('new_org').style.display = "none";
document.getElementById('new_org_fields').style.display =
"none";
var divcontent_start = "<select name=\"group_id\"
id=\"group_id\" onchange=\"javascript:checkNewGroup()\">";
var divcontent_end = "</select>";
@@ -53,12 +53,12 @@
var group_selected = document.getElementById('group_id').value;
if(group_selected == 'new_group')
{
- document.getElementById('new_org_group').style.display =
"block";
+ document.getElementById('new_group').style.display = "block";
document.getElementById('new_group_fields').style.display =
"block";
}
else
{
- document.getElementById('new_org_group').style.display = "none";
+ document.getElementById('new_group').style.display = "none";
document.getElementById('new_group_fields').style.display =
"none";
}
}
@@ -111,6 +111,17 @@
<div class="yui-content">
<div id="details">
+
+ <?php if($message){?>
+ <div class="success">
+ <?php echo $message;?>
+ </div>
+ <?php }else if($error){?>
+ <div class="error">
+ <?php echo $error;?>
+ </div>
+ <?php }?>
+ </div>
<h1><?php echo lang('activity') ?></h1>
<form action="#" method="post">
<input type="hidden" name="id" value="<?php
if($activity->get_id()){ echo $activity->get_id(); } else { echo '0'; } ?>"/>
@@ -169,36 +180,7 @@
}
?>
</dd>
- <dt>
- <?php if($activity->get_group_id() ||
$editable) { ?>
- <label for="group_id"><?php echo
lang('group') ?></label>
- <?php } ?>
- </dt>
- <dd>
- <?php
- $current_group_id =
$activity->get_group_id();
- if ($editable)
- {
- ?>
- <?php echo
lang('group_helptext')?><br/>
- <div id="group_select">
- <select name="group_id"
id="group_id">
- <option
value="0">Ingen gruppe valgt</option>
- </select>
- </div>
- <?php
- ?>
- <?php
- }
- else
- {
- if($activity->get_group_id()){
- echo
activitycalendar_sogroup::get_instance()->get_group_name($activity->get_group_id());
- }
- }
- ?>
- </dd>
- <div id="new_org_group" style="display: none;">
+ <div id="new_org" style="display: none;">
<hr/>
<div id="new_org_fields"
style="display: none;">
<label
for="orgname">Organisasjonsnavn</label>
@@ -233,6 +215,60 @@
<textarea rows="10" cols="100"
name="org_description"></textarea>
</div>
<hr/>
+ <b>Kontaktperson 1</b><br/>
+ <label for="contact1_name">Navn</label>
+ <input type="text"
name="contact1_name"/><br/>
+ <label
for="contact1_phone">Telefon</label>
+ <input type="text"
name="contact1_phone"/><br/>
+ <label
for="contact1_mail">E-post</label>
+ <input type="text"
name="contact1_mail"/><br/>
+ <b>Kontaktperson 2</b><br/>
+ <label for="contact2_name">Navn</label>
+ <input type="text"
name="contact2_name"/><br/>
+ <label
for="contact2_phone">Telefon</label>
+ <input type="text"
name="contact2_phone"/><br/>
+ <label
for="contact2_mail">E-post</label>
+ <input type="text"
name="contact2_mail"/><br/>
+ <label
for="contact2_address">Adresse</label>
+ <input type="text"
name="contact2_address_txt" id="contact2_address_txt"
onkeyup="javascript:get_address_search_cp2()"/>
+ <div
id="contact2_address_container"></div><br/>
+ <label
for="contact2_number">Nummer</label>
+ <input type="text"
name="contact2_number"/><br/>
+ <label
for="contact2_postaddress">Postnummer / Sted</label>
+ <input type="text"
name="contact2_postaddress"/>
+ <hr/>
+ </div>
+ <dt>
+ <?php if($activity->get_group_id() ||
$editable) { ?>
+ <label for="group_id"><?php echo
lang('group') ?></label>
+ <?php } ?>
+ </dt>
+ <dd>
+ <?php
+ $current_group_id =
$activity->get_group_id();
+ if ($editable)
+ {
+ ?>
+ <?php echo
lang('group_helptext')?><br/>
+ <div id="group_select">
+ <select name="group_id"
id="group_id">
+ <option
value="0">Ingen gruppe valgt</option>
+ </select>
+ </div>
+ <?php
+ ?>
+ <?php
+ }
+ else
+ {
+ if($activity->get_group_id()){
+ echo
activitycalendar_sogroup::get_instance()->get_group_name($activity->get_group_id());
+ }
+ }
+ ?>
+ </dd>
+ <div id="new_group" style="display: none;">
+ <hr/>
<div id="new_group_fields"
style="display: none;">
<label
for="groupname">Gruppenavn</label>
<input type="text"
name="groupname"/><br/>
@@ -337,12 +373,8 @@
$selected_state =
$activity->get_state();
?>
<select name="state">
- <option value="0" <?php
echo ($selected_state == 0 ? 'selected="selected"' : "")?>>Ingen status
valgt</option>
<option value="1" <?php
echo ($selected_state == 1 ? 'selected="selected"' : "")?>><?php echo
lang('new') ?></option>
<option value="2" <?php
echo ($selected_state == 2 ? 'selected="selected"' : "")?>><?php echo
lang('change') ?></option>
- <option value="3" <?php
echo ($selected_state == 3 ? 'selected="selected"' : "")?>><?php echo
lang('accepted') ?></option>
- <option value="4" <?php
echo ($selected_state == 4 ? 'selected="selected"' : "")?>><?php echo
lang('processed') ?></option>
- <option value="5" <?php
echo ($selected_state == 5 ? 'selected="selected"' : "")?>><?php echo
lang('rejected') ?></option>
</select>
<?php
}
Modified:
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/css/base.css
===================================================================
---
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/css/base.css
2011-09-26 12:08:19 UTC (rev 7718)
+++
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/css/base.css
2011-09-26 12:11:15 UTC (rev 7719)
@@ -17,9 +17,10 @@
dl.form-col {
width: 18em;
float: left;
+ text-align: left;
}
+
-
table#header {
margin: 2em;
@@ -238,6 +239,24 @@
margin-left: 5px;
}
+div.success {
+ font-weight: normal;
+ margin:10px;
+ padding:5px;
+ font-size:1.1em;
+ text-align: left;
+ background-color: green;
+ border:1px solid #9F6000;
+ color: white;
+}
-
-
+div.error {
+ font-weight: normal;
+ margin:10px;
+ padding:5px;
+ font-size:1.1em;
+ text-align: left;
+ background-color: red;
+ border:1px solid #9F6000;
+ color: white;
+}
\ No newline at end of file
Modified: branches/Version-1_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.menu.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -25,37 +25,56 @@
(
'text' => lang('Control'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicontrol.index') ),
- 'image' => array('property', 'location_1'),
+ 'image' => array('property', 'location_1')
),
- 'control_item2' => array
+ 'control_item' => array
(
'text' => lang('Control_item'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicontrol_item.index') ),
+ 'image' => array('property', 'location_1')
+ ),
+ 'control_group' => array
+ (
+ 'text' => lang('Control_group'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicontrol_group.index') ),
+ 'image' => array('property', 'location_1')
+ ),
+ 'procedure' => array
+ (
+ 'text' => lang('Procedure'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uiprocedure.index') ),
'image' => array('property', 'location_1'),
+ ),
+ 'example' => array
+ (
+ 'text' => 'example',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uiexample.index') ),
+ 'image' => array('property', 'location_1'),
'children' => array(
-
'control_item_list2' => array
+ 'edit' => array
(
- 'text'
=> lang('control_item_list') . 2,
- 'url'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_item.display_control_items', 'appname' => 'controller') ),
+ 'text'
=> 'example::edit',
+ 'url'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uiexample.edit') ),
'image'
=> array('rental', 'x-office-spreadsheet')
),
+ 'normal_tabs'
=> array
+
+ (
+ 'text'
=> 'example::normal_tabs',
+ 'url'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uiexample.normal_tabs') ),
+ 'image'
=> array('rental', 'x-office-spreadsheet')
+ ),
'separate_tabs'
=> array
(
'text'
=> 'example::separate_tabs',
- 'url'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_item.separate_tabs') ),
+ 'url'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uiexample.separate_tabs') ),
'image'
=> array('rental', 'x-office-spreadsheet')
),
)
- ),
- 'procedure' => array
- (
- 'text' => lang('Procedure'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uiprocedure.index') ),
- 'image' => array('property', 'location_1'),
- )
+ ),
);
$menus['folders'] =
phpgwapi_menu::get_categories('bergen');
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -83,7 +83,7 @@
$this->db->next_record();
$control_area = new
controller_control_area($this->unmarshal($this->db->f('id', true), 'int'));
-
$control_area->set_type_name($this->unmarshal($this->db->f('type_name', true),
'string'));
+ $control_area->set_title($this->unmarshal($this->db->f('title',
true), 'string'));
return $control_area;
}
@@ -130,7 +130,7 @@
'name' =>
$this->db->f('name', false));
}
return $results;
- }
+ }
function get_id_field_name($extended_info = false)
{
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -10,7 +10,7 @@
/**
* Get a static reference to the storage object associated with this
model object
*
- * @return controller_soparty the storage object
+ * @return controller_socontrol_group the storage object
*/
public static function get_instance()
{
@@ -21,30 +21,36 @@
}
/**
- * Function for adding a new activity to the database. Updates the
activity object.
+ * Function for adding a new control group to the database.
*
- * @param activitycalendar_activity $activity the party to be added
- * @return bool true if successful, false otherwise
+ * @param controller_control_group $control_group the control group to
be added
+ * @return int id of the new control group object
*/
function add(&$control_group)
{
+ $cols = array(
+ 'group_name',
+ 'procedure_id',
+ 'control_area_id'
+ );
+
+ $values = array(
+ $this->marshal($control_group->get_group_name(),
'string'),
+ $this->marshal($control_group->get_procedure_id(),
'int'),
+ $this->marshal($control_group->get_control_area_id(),
'int'),
+ );
- $control_group = $control_group->get_control_group();
+ $result = $this->db->query('INSERT INTO
controller_control_group (' . join(',', $cols) . ') VALUES (' . join(',',
$values) . ')', __LINE__,__FILE__);
- $sql = "INSERT INTO controller_control_group (group_name)
VALUES ('$control_group')";
- $result = $this->db->query($sql, __LINE__,__FILE__);
-
if(isset($result)) {
- // Set the new party ID
-
$control_group->set_id($this->db->get_last_insert_id('controller_control_group',
'id'));
- // Forward this request to the update method
- return $this->update($control_group);
+ // Get the new control group ID and return it
+ return
$this->db->get_last_insert_id('controller_control_group', 'id');
}
else
{
- return false;
+ return 0;
}
-
+
}
/**
@@ -59,7 +65,9 @@
$id = intval($control_group->get_id());
$values = array(
- '$group_name = ' .
$this->marshal($control_group->get_group_name(), 'string')
+ 'group_name = ' .
$this->marshal($control_group->get_group_name(), 'string'),
+ 'procedure_id = '.
$this->marshal($control_group->get_procedure_id(), 'int'),
+ 'control_area_id = ' .
$this->marshal($control_group->get_control_area_id(), 'int')
);
//var_dump('UPDATE activity_activity SET ' . join(',', $values)
. " WHERE id=$id");
@@ -84,6 +92,8 @@
$control_group = new
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
$control_group->set_group_name($this->unmarshal($this->db->f('group_name',
true), 'string'));
+
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id',
true), 'string'));
+
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'string'));
return $control_group;
}
@@ -132,9 +142,28 @@
return $results;
}
+ function get_control_groups($control_area_id)
+ {
+ $results = array();
+
+ $sql = "SELECT * FROM controller_control_group WHERE
control_area_id=$control_area_id";
+ $this->db->limit_query($sql, $start, __LINE__, __FILE__,
$limit);
+
+ while ($this->db->next_record()) {
+ $control_group = new
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
+
$control_group->set_group_name($this->unmarshal($this->db->f('group_name',
true), 'string'));
+
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id',
true), 'string'));
+
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'string'));
+
+ $results[] = $control_group;
+ }
+
+ return $results;
+ }
+
function get_id_field_name($extended_info = false)
{
- /*
+
if(!$extended_info)
{
$ret = 'id';
@@ -143,46 +172,166 @@
{
$ret = array
(
- 'table' => 'activity', // alias
+ 'table' =>
'controller_control_group', // alias
'field' => 'id',
'translated' => 'id'
);
}
- */
+
return $ret;
}
protected function get_query(string $sort_field, boolean $ascending,
string $search_for, string $search_type, array $filters, boolean $return_count)
{
+ $clauses = array('1=1');
+ if($search_for)
+ {
+ $like_pattern = "'%" .
$this->db->db_addslashes($search_for) . "%'";
+ $like_clauses = array();
+ switch($search_type){
+ default:
+ $like_clauses[] =
"controller_control_group.group_name $this->like $like_pattern";
+ break;
+ }
+ if(count($like_clauses))
+ {
+ $clauses[] = '(' . join(' OR ', $like_clauses)
. ')';
+ }
+ }
+
+ $filter_clauses = array();
+ /*switch($filters['is_active']){
+ case "active":
+ $filter_clauses[] = "rental_composite.is_active
= TRUE";
+ break;
+ case "non_active":
+ $filter_clauses[] = "rental_composite.is_active
= FALSE";
+ break;
+ case "both":
+ break;
+ }*/
+ /*
+ $special_query = false; //specify if the query should use
distinct on rental_composite.id (used for selecting composites that has an
active or inactive contract)
+ $ts_query = strtotime(date('Y-m-d')); // timestamp for query
(today)
+ $availability_date_from = $ts_query;
+ $availability_date_to = $ts_query;
+ if(isset($filters['availability_date_from']) &&
$filters['availability_date_from'] != ''){
+ $availability_date_from =
strtotime($filters['availability_date_from']);
+ }
+ if(isset($filters['availability_date_to']) &&
$filters['availability_date_to'] != ''){
+ $availability_date_to =
strtotime($filters['availability_date_to']);
+ }
+ */
+ /*switch($filters['has_contract']){
+ case "has_contract":
+ $filter_clauses[] = "NOT
rental_contract_composite.contract_id IS NULL"; // Composite must have a
contract
+ $filter_clauses[] = "NOT
rental_contract.date_start IS NULL"; // The contract must have start date
+ */
+ /* The contract's start date not after the end
of the period if there is no end date */
+/* $filter_clauses[] = "
+ ((NOT rental_contract.date_start >
$availability_date_to AND rental_contract.date_end IS NULL)
+ OR
+ (NOT rental_contract.date_start >
$availability_date_to AND NOT rental_contract.date_end IS NULL AND NOT
rental_contract.date_end < $availability_date_from))";
+ $special_query=true;
+ break;
+ case "has_no_contract":
+ $filter_clauses[] = "
+ (
+ rental_contract_composite.contract_id
IS NULL OR
+ NOT rental_composite.id IN
+ (
+ SELECT rental_composite.id FROM
rental_composite
+ LEFT JOIN
rental_contract_composite ON (rental_contract_composite.composite_id =
rental_composite.id)
+ LEFT JOIN rental_contract ON
(rental_contract.id = rental_contract_composite.contract_id)
+ WHERE
+ (
+ NOT
rental_contract_composite.contract_id IS NULL AND
+ NOT
rental_contract.date_start IS NULL AND
+ ((NOT
rental_contract.date_start > $availability_date_to AND rental_contract.date_end
IS NULL)
+ OR
+ (NOT
rental_contract.date_start > $availability_date_to AND NOT
rental_contract.date_end IS NULL AND NOT rental_contract.date_end <
$availability_date_from))
+ )
+ )
+ )
+ ";
+ $special_query=true;
+ break;
+ case "both":
+ break;
+ }
+
+ // Furnished, partly furnished, not furnished, not specified
+ if(isset($filters['furnished_status']) &
$filters['furnished_status'] < 4){
+ // Not specified
+ if($filters['furnished_status'] == 0)
+ $filter_clauses[] =
"rental_composite.furnish_type_id IS NULL";
+ else
+ $filter_clauses[] =
"rental_composite.furnish_type_id=".$filters['furnished_status'];
+ }
+
+ if(isset($filters['not_in_contract'])){
+ $filter_clauses[] =
"(rental_contract_composite.contract_id != ".$filters['not_in_contract']." OR
rental_contract_composite.contract_id IS NULL)";
+ }
+
+ if(isset($filters['location_code'])){
+ $filter_clauses[] = "rental_unit.location_code = '".
$filters['location_code'] . "'";
+ }
+
+ if(isset($filters['contract_id']))
+ {
+ $filter_clauses[] = "contract_id =
{$this->marshal($filters['contract_id'],'int')}";
+ }
+
+ if(isset($filters[$this->get_id_field_name()]))
+ {
+ $filter_clauses[] = "rental_composite.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+ }*/
+
+ if(isset($filters[$this->get_id_field_name()]))
+ {
+ $filter_clauses[] = "controller_control_group.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+ }
+
+ if(count($filter_clauses))
+ {
+ $clauses[] = join(' AND ', $filter_clauses);
+ }
+
+ $condition = join(' AND ', $clauses);
+
+ $tables = "controller_control_group";
+ //$joins = " {$this->left_join} rental_unit ON
(rental_composite.id = rental_unit.composite_id)";
+ //$joins .= " {$this->left_join} rental_contract_composite ON
(rental_contract_composite.composite_id = rental_composite.id)";
+ //$joins .= " {$this->left_join} rental_contract ON
(rental_contract.id = rental_contract_composite.contract_id)";
+
+ if($return_count) // We should only return a count
+ {
+ $cols = 'COUNT(DISTINCT(controller_control_group.id))
AS count';
+ }
+ else
+ {
+ $cols .= "id, group_name, procedure_id, control_area_id
";
+ }
+ $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}";
}
function populate(int $control_group_id, &$control_group)
{
- /*
if($control_group == null) {
- $control_group = new activitycalendar_activity((int)
$activity_id);
+ $control_group = new controller_control_group((int)
$control_group_id);
-
$control_group->set_title($this->unmarshal($this->db->f('title'), 'string'));
-
$control_group->set_organization_id($this->unmarshal($this->db->f('organization_id'),
'int'));
-
$control_group->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
-
$control_group->set_district($this->unmarshal($this->db->f('district'), 'int'));
-
$control_group->set_office($this->unmarshal($this->db->f('office'), 'int'));
-
$control_group->set_category($this->unmarshal($this->db->f('category'), 'int'));
-
$control_group->set_state($this->unmarshal($this->db->f('state'), 'int'));
-
$control_group->set_target($this->unmarshal($this->db->f('target'), 'string'));
-
$control_group->set_description($this->unmarshal($this->db->f('description'),
'string'));
-
$control_group->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
-
$control_group->set_internal_arena($this->unmarshal($this->db->f('internal_arena'),
'string'));
-
$control_group->set_time($this->unmarshal($this->db->f('time'), 'string'));
-
$control_group->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
'int'));
-
$control_group->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
'bool')));
-
$control_group->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
-
-
+
$control_group->set_group_name($this->unmarshal($this->db->f('group_name'),
'string'));
+
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
+
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
}
- */
+ //var_dump($control_group);
return $control_group;
}
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -28,23 +28,37 @@
*/
function add(&$control_item)
{
+ $cols = array(
+ 'title',
+ 'required',
+ 'what_to_do',
+ 'how_to_do',
+ 'control_group_id',
+ 'control_area_id'
+ );
- $title = $control_item->get_title();
+ $values = array(
+ $this->marshal($control_item->get_title(), 'string'),
+ $this->marshal(($control_item->get_required() ? 'true'
: 'false'), 'bool'),
+ $this->marshal($control_item->get_what_to_do(),
'string'),
+ $this->marshal($control_item->get_how_to_do(),
'string'),
+ $this->marshal($control_item->get_control_group_id(),
'int'),
+ $this->marshal($control_item->get_control_area_id(),
'int')
+ );
- $sql = "INSERT INTO controller_control_item (title) VALUES
('$title')";
+ $result = $this->db->query('INSERT INTO controller_control_item
(' . join(',', $cols) . ') VALUES (' . join(',', $values) . ')',
__LINE__,__FILE__);
$result = $this->db->query($sql, __LINE__,__FILE__);
if(isset($result)) {
- // Set the new party ID
-
$control_item->set_id($this->db->get_last_insert_id('controller_control_item',
'id'));
+ // return the new control item ID
+ return
$this->db->get_last_insert_id('controller_control_item', 'id');
// Forward this request to the update method
- return $this->update($control_item);
+ //return $this->update($control_item);
}
else
{
- return false;
+ return 0;
}
-
}
/**
@@ -75,8 +89,8 @@
/**
* Get single procedure
*
- * @param $id id of the procedure to return
- * @return a controller_procedure
+ * @param $id id of the control_item to return
+ * @return a controller_control_item
*/
function get_single($id)
{
@@ -88,11 +102,11 @@
$control_item = new
controller_control_item($this->unmarshal($this->db->f('id', true), 'int'));
$control_item->set_title($this->unmarshal($this->db->f('title',
true), 'string'));
-
$control_item->set_purpose($this->unmarshal($this->db->f('purpose', true),
'string'));
-
$control_item->set_responsibility($this->unmarshal($this->db->f('responsibility',
true), 'string'));
-
$control_item->set_description($this->unmarshal($this->db->f('description',
true), 'string'));
-
$control_item->set_reference($this->unmarshal($this->db->f('reference', true),
'string'));
-
$control_item->set_attachment($this->unmarshal($this->db->f('attachment',
true), 'string'));
+
$control_item->set_required($this->unmarshal($this->db->f('required', true),
'bool'));
+
$control_item->set_what_to_do($this->unmarshal($this->db->f('what_to_do',
true), 'string'));
+
$control_item->set_how_to_do($this->unmarshal($this->db->f('how_to_do', true),
'string'));
+
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
true), 'int'));
+
$control_item->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'int'));
return $control_item;
}
@@ -166,16 +180,11 @@
$like_pattern = "'%".$search_for."%'";
$like_clauses = array();
switch($search_type){
- case "title":
- $like_clauses[] =
"rental_document.title $this->like $like_pattern";
+ default:
+ $like_clauses[] =
"controller_control_item.title $this->like $like_pattern";
+ $like_clauses[] =
"controller_control_item.what_to_do $this->like $like_pattern";
+ $like_clauses[] =
"controller_control_item.how_to_do $this->like $like_pattern";
break;
- case "name":
- $like_clauses[] = "rental_document.name
$this->like $like_pattern";
- break;
- case "all":
- $like_clauses[] =
"rental_document.title $this->like $like_pattern";
- $like_clauses[] = "rental_document.name
$this->like $like_pattern";
- break;
}
if(count($like_clauses))
@@ -186,24 +195,9 @@
if(isset($filters[$this->get_id_field_name()]))
{
- $filter_clauses[] = "rental_document.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+ $filter_clauses[] = "controller_control_item.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
}
- if(isset($filters['contract_id']))
- {
- $filter_clauses[] = "rental_document.contract_id =
{$this->marshal($filters['contract_id'],'int')}";
- }
-
- if(isset($filters['party_id']))
- {
- $filter_clauses[] = "rental_document.party_id =
{$this->marshal($filters['party_id'],'int')}";
- }
-
- if(isset($filters['document_type']) &&
$filters['document_type'] != 'all')
- {
- $filter_clauses[] = "rental_document.type_id =
{$this->marshal($filters['document_type'],'int')}";
- }
-
if(count($filter_clauses))
{
$clauses[] = join(' AND ', $filter_clauses);
@@ -213,11 +207,11 @@
$condition = join(' AND ', $clauses);
$tables = "controller_control_item";
- $joins = " {$this->left_join} rental_document_types ON
(rental_document.type_id = rental_document_types.id)";
+ //$joins = " {$this->left_join} rental_document_types ON
(rental_document.type_id = rental_document_types.id)";
if($return_count)
{
- $cols = 'COUNT(DISTINCT(rental_document.id)) AS count';
+ $cols = 'COUNT(DISTINCT(controller_control_item.id)) AS
count';
}
else
{
@@ -227,20 +221,38 @@
$dir = $ascending ? 'ASC' : 'DESC';
if($sort_field == 'title')
{
- $sort_field = 'rental_document.title';
+ $sort_field = 'controller_control_item.title';
}
- else if($sort_field == 'type')
- {
- $sort_field = 'rental_document_types.title';
- }
$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}";
- return "SELECT {$cols} FROM {$tables}";
+ return "SELECT {$cols} FROM {$tables} WHERE {$condition}
{$order}";
}
+ function get_control_items($control_group_id)
+ {
+ $results = array();
+
+ $sql = "SELECT * FROM controller_control_item WHERE
control_group_id=$control_group_id";
+ $this->db->limit_query($sql, $start, __LINE__, __FILE__,
$limit);
+
+ while ($this->db->next_record()) {
+ $control_item = new
controller_control_item($this->unmarshal($this->db->f('id', true), 'int'));
+
$control_item->set_title($this->unmarshal($this->db->f('title', true),
'string'));
+
$control_item->set_required($this->unmarshal($this->db->f('required', true),
'boolean'));
+
$control_item->set_what_to_do($this->unmarshal($this->db->f('what_to_do',
true), 'string'));
+
$control_item->set_how_to_do($this->unmarshal($this->db->f('how_to_do', true),
'string'));
+
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
true), 'int'));
+
$control_item->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'int'));
+
+ $results[] = $control_item;
+ }
+
+ return $results;
+ }
+
function populate(int $control_item_id, &$control_item)
{
Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -1,16 +1,23 @@
-<?php
+<?php
phpgw::import_class('controller.uicommon');
phpgw::import_class('property.boevent');
phpgw::import_class('controller.socontrol');
+ phpgw::import_class('controller.socontrol_group');
+ phpgw::import_class('controller.socontrol_area');
+ phpgw::import_class('controller.socontrol_item');
phpgw::import_class('controller.soprocedure');
include_class('controller', 'control', 'inc/model/');
+ include_class('controller', 'control_area', 'inc/model/');
class controller_uicontrol extends controller_uicommon
{
private $bo;
private $so;
- private $so_proc;
+ private $so_proc;
+ private $so_control_group;
+ private $so_control_area;
+ private $so_control_item;
public $public_functions = array
(
@@ -24,63 +31,185 @@
$this->so = CreateObject('controller.socontrol');
$this->so_proc = CreateObject('controller.soprocedure');
$this->bo = CreateObject('property.boevent',true);
+ $this->so_control_group =
CreateObject('controller.socontrol_group');
+ $this->so_control_area =
CreateObject('controller.socontrol_area');
+ $this->so_control_item =
CreateObject('controller.socontrol_item');
+
+ self::set_active_menu('controller::control');
}
public function index()
{
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control";
+ if( isset($_POST['save_control']) )
+ {
+ $this->edit_control();
+ }
+ else if( isset($_POST['save_control_groups']) )
+ {
+ $this->edit_control_groups();
+ }
+ else if( isset($_POST['save_control_items']) )
+ {
+ $this->edit_control_items();
+ }
+ else{
+ $this->view_control();
+ }
+ }
+
+ public function view_control(){
+ $tabs = array
+ (
+ 'details' => array('label' =>
lang('Details'), 'link' => '#details'),
+ 'control_groups' =>
array('label' => lang('Control_groups'), 'link' => '#control_groups'),
+ 'control_items' => array('label' =>
lang('Control_items'), 'link' => '#control_items')
+ );
- $repeat_type = $this->bo->get_rpt_type_list();
- $repeat_day = $this->bo->get_rpt_day_list();
+ $add_document_link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uiexample.index') );
+
+ $procedure_array =
$this->so_proc->get_procedure_array();
+
+ foreach ($procedure_array as $procedure)
+ {
+ $procedure_options[] = $procedure->toArray();
+ }
+
+ $control_area_array =
$this->so_control_area->get_control_area_array();
+
+ foreach ($control_area_array as $control_area)
+ {
+ $control_area_options[] =
$control_area->toArray();
+ }
+
+ phpgwapi_yui::tabview_setup('control_tabview');
+
+ $data = array
+ (
+ 'tabs'
=> phpgwapi_yui::tabview_generate($tabs, 'details'),
+ 'start_date' =>
$GLOBALS['phpgw']->yuical->add_listener('start_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
time())),
+ 'end_date'
=>
$GLOBALS['phpgw']->yuical->add_listener('end_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
time())),
+ 'value_id'
=> !empty($control) ? $control->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'editable'
=> true,
+ 'control_area_options' =>
array('options' => $control_area_options),
+ 'procedure_options' =>
array('options' => $procedure_options)
+ );
+
+ self::add_javascript('controller', 'yahoo',
'control_tabs.js');
+ self::render_template_xsl(array('control_tabs',
'control', 'control_groups', 'control_items'), $data);
+ }
+
+
+ public function edit_control(){
+
+ $tabs = array
+ (
+ 'details' => array('label' =>
lang('Details'), 'link' => '#details'),
+ 'control_groups' =>
array('label' => lang('Control_groups'), 'link' => '#control_groups'),
+ 'control_items' => array('label' =>
lang('Control_items'), 'link' => '#control_items')
+ );
+
+ $control_area_id = phpgw::get_var('control_area_id');
+
+ if(isset($control)) // Edit control
+ {
+ $control = $this->populate($control);
+ //$this->so->add($control);
+ }else{
+ $new_control = new controller_control();
+ $control = $this->populate($new_control);
+ //$this->so->add($control);
+ }
+
+ $control_group_array =
$this->so_control_group->get_control_groups($control_area_id);
+
+ $control_area =
$this->so_control_area->get_single($control_area_id);
+
+ foreach ($control_group_array as $control_group)
+ {
+ $control_groups[] = $control_group->serialize();
+ }
+
+ phpgwapi_yui::tabview_setup('control_tabview');
+
+ $data = array
+ (
+ 'tabs'
=> phpgwapi_yui::tabview_generate($tabs, 'control_groups'),
+ 'value_id'
=> !empty($control) ? $control->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'editable'
=> true,
+ 'title'
=> $control_area->get_title(),
+ 'control_groups' =>
$control_groups
+ );
+
+ self::add_javascript('controller', 'yahoo',
'control_tabs.js');
+ self::render_template_xsl(array('control_tabs',
'control', 'control_groups', 'control_items'), $data);
+ }
+
+ public function edit_control_groups(){
+
+ $tabs = array
+ (
+ 'details' => array('label' =>
lang('Details'), 'link' => '#details'),
+ 'control_groups' =>
array('label' => lang('Control_groups'), 'link' => '#control_groups'),
+ 'control_items' => array('label' =>
lang('Control_items'), 'link' => '#control_items')
+ );
+
+ $control_group_ids = array();
+ $control_group_ids =
phpgw::get_var('control_group_ids');
- if(isset($_POST['save_control'])) // The user has
pressed the save button
- {
- if(isset($control)) // Edit control
+ $control_items_2D = array();
+
+ foreach ($control_group_ids as $control_group_id)
+ {
+ $control_items_array =
$this->so_control_item->get_control_items($control_group_id);
+
+ $control_items = array();
+
+ foreach ($control_items_array as $control_item)
{
-
$control->set_title(phpgw::get_var('title'));
-
$control->set_description(phpgw::get_var('description'));
- $control->set_start_date( strtotime(
phpgw::get_var('start_date') ) );
- $control->set_end_date( strtotime(
phpgw::get_var('end_date') ) );
- $control->set_repeat_day( strtotime(
phpgw::get_var('repeat_day') ) );
- $control->set_repeat_type( strtotime(
phpgw::get_var('repeat_type') ) );
- $control->set_repeat_interval(
strtotime( phpgw::get_var('repeat_interval') ) );
- $control->set_enabled( true );
-
- $this->so->add($control);
- }
- else // Add new control
- {
+ $control_items[] =
$control_item->serialize();
+ }
- $control = new controller_control();
-
-
$control->set_title(phpgw::get_var('title'));
-
$control->set_description(phpgw::get_var('description'));
- $control->set_start_date( strtotime(
phpgw::get_var('start_date') ) );
- $control->set_end_date( strtotime(
phpgw::get_var('end_date') ) );
- $control->set_repeat_day( strtotime(
phpgw::get_var('repeat_day') ) );
- $control->set_repeat_type( strtotime(
phpgw::get_var('repeat_type') ) );
- $control->set_repeat_interval(
strtotime( phpgw::get_var('repeat_interval') ) );
- $control->set_enabled( true );
-
- $this->so->add($control);
- }
+ $control_group =
$this->so_control_group->get_single($control_group_id);
+
+ $control_items_2D[] = array("group_name" =>
$control_group->get_group_name(), "control_item" => $control_items);
}
- $procedure_array =
$this->so_proc->get_procedure_array();
+ phpgwapi_yui::tabview_setup('control_tabview');
- $this->render('control.php', array
- (
- 'editable' => true,
- 'repeat_type' =>
$repeat_type,
- 'repeat_day' =>
$repeat_day,
- 'procedure_array' =>
$procedure_array
- )
- );
+ $data = array
+ (
+ 'tabs' =>
phpgwapi_yui::tabview_generate($tabs, 'control_items'),
+ 'value_id' =>
!empty($control) ? $control->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'editable' => true,
+ 'control_items' =>
$control_items_2D
+ );
+
+ self::add_javascript('controller', 'yahoo',
'control_tabs.js');
+ self::render_template_xsl(array('control_tabs',
'control', 'control_groups', 'control_items'), $data);
}
-
+
+
public function query()
{
var_dump("Er i uicontrol");
}
+
+ public function populate($control){
+
+ $control->set_title(phpgw::get_var('title'));
+
$control->set_description(phpgw::get_var('description'));
+ $control->set_start_date( strtotime(
phpgw::get_var('start_date') ) );
+ $control->set_end_date( strtotime(
phpgw::get_var('end_date') ) );
+ $control->set_repeat_day( strtotime(
phpgw::get_var('repeat_day') ) );
+ $control->set_repeat_type( strtotime(
phpgw::get_var('repeat_type') ) );
+ $control->set_repeat_interval( strtotime(
phpgw::get_var('repeat_interval') ) );
+ $control->set_enabled( true );
+
+ return $control;
+
+ }
}
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php (from
rev 7718, trunk/controller/inc/class.uicontrol_group.inc.php)
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
(rev 0)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -0,0 +1,545 @@
+<?php
+ phpgw::import_class('controller.uicommon');
+ phpgw::import_class('property.boevent');
+ phpgw::import_class('controller.socontrol');
+ phpgw::import_class('controller.socontrol_item');
+ phpgw::import_class('controller.socontrol_group');
+ phpgw::import_class('controller.socontrol_area');
+
+ include_class('controller', 'control_group', 'inc/model/');
+
+ class controller_uicontrol_group extends controller_uicommon
+ {
+ private $so;
+ private $so_procedure;
+ private $so_control_area;
+
+ public $public_functions = array
+ (
+ 'index' => true,
+ 'query' => true,
+ 'edit' => true,
+ 'view' => true,
+ 'add' => true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->so = CreateObject('controller.socontrol_group');
+ $this->so_procedure =
CreateObject('controller.soprocedure');
+ $this->so_control_area =
CreateObject('controller.socontrol_area');
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control_group";
+ }
+
+ public function index()
+ {
+ if(phpgw::get_var('phpgw_return_as') == 'json') {
+ return $this->query();
+ }
+ self::add_javascript('controller', 'yahoo',
'datatable.js');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('paginator');
+
+ $data = array(
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array(
+ 'type' =>
'link',
+ 'value' =>
lang('New control group'),
+ 'href' =>
self::link(array('menuaction' => 'controller.uicontrol_group.add'))
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'status',
+ 'text' => lang('Status').':',
+ 'list' => array(
+ array(
+ 'id' => 'none',
+ 'name' => lang('Not selected')
+ ),
+ array(
+ 'id' => 'NEW',
+ 'name' => lang('NEW')
+ ),
+ array(
+ 'id' => 'PENDING',
+ 'name' => lang('PENDING')
+ ),
+ array(
+ 'id' => 'REJECTED',
+ 'name' => lang('REJECTED')
+ ),
+ array(
+ 'id' => 'ACCEPTED',
+ 'name' => lang('ACCEPTED')
+ )
+ )
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'control_areas',
+ 'text' => lang('Control_area').':',
+ 'list' =>
$this->so_control_area->get_control_area_select_array(),
+ ),
+ array('type' => 'text',
+ 'text' => lang('searchfield'),
+ 'name' =>
'query'
+ ),
+ array(
+ 'type' =>
'submit',
+ 'name' =>
'search',
+ 'value' =>
lang('Search')
+ ),
+ array(
+ 'type' =>
'link',
+ 'value' =>
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
+ 'href' =>
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' => 'controller.uicontrol_group.index',
'phpgw_return_as' => 'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' => lang('ID'),
+ 'sortable' => true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' =>
'group_name',
+ 'label' =>
lang('Control group title'),
+ 'sotrable' =>
false
+ ),
+ array(
+ 'key' =>
'control_area_id',
+ 'label' =>
lang('Control area'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'procedure_id',
+ 'label' =>
lang('Procedure'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ )
+ )
+ ),
+ );
+//_debug_array($data);
+
+ self::render_template_xsl('datatable', $data);
+ }
+
+ /**
+ * Public method. Forwards the user to edit mode.
+ */
+ public function add()
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'controller.uicontrol_group.edit'));
+ }
+
+
+ public function edit()
+ {
+ $control_group_id = phpgw::get_var('id');
+ if(isset($control_group_id) && $control_group_id > 0)
+ {
+ $control_group =
$this->so->get_single($control_group_id);
+ }
+ else
+ {
+ $control_group = new controller_control_group();
+ }
+
+ if(isset($_POST['save_control_group'])) // The user has
pressed the save button
+ {
+ if(isset($control_group)) // Add new values to
the control item
+ {
+
$control_group->set_group_name(phpgw::get_var('group_name'));
+ $control_group->set_procedure_id(
phpgw::get_var('procedure') );
+ $control_group->set_control_area_id(
phpgw::get_var('control_area') );
+
+ //$this->so->store($control_item);
+
+ if(isset($control_group_id) &&
$control_group_id > 0)
+ {
+ $ctrl_group_id =
$control_group_id;
+
if($this->so->store($control_group))
+ {
+ $message =
lang('messages_saved_form');
+ }
+ else
+ {
+ $error =
lang('messages_form_error');
+ }
+ }
+ else
+ {
+ $ctrl_group_id =
$this->so->add($control_group);
+ if($ctrl_group_id)
+ {
+ $message =
lang('messages_saved_form');
+ }
+ else
+ {
+ $error =
lang('messages_form_error');
+ }
+ }
+
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'controller.uicontrol_group.view', 'id' => $ctrl_group_id));
+ }
+ }
+ else if(isset($_POST['cancel_control_group'])) // The
user has pressed the cancel button
+ {
+ if(isset($control_group_id) &&
$control_group_id > 0)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'controller.uicontrol_group.view', 'id' => $control_group_id));
+ }
+ else
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'controller.uicontrol_group.index'));
+ }
+ }
+ else
+ {
+
+ $control_area_array =
$this->so_control_area->get_control_area_array();
+ $procedure_array =
$this->so_procedure->get_procedure_array();
+
+
+ if($this->flash_msgs)
+ {
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ }
+
+ foreach ($control_area_array as $control_area)
+ {
+ $control_area_options[] = array
+ (
+ 'id' =>
$control_area->get_id(),
+ 'name' =>
$control_area->get_title()
+
+ );
+ }
+
+ foreach ($procedure_array as $procedure)
+ {
+ $procedure_options[] = array
+ (
+ 'id' => $procedure->get_id(),
+ 'name' =>
$procedure->get_title()
+
+ );
+ }
+
+ $control_group_array =
$control_group->toArray();
+
+ $data = array
+ (
+ 'value_id'
=> !empty($control_group) ? $control_group->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'editable'
=> true,
+ 'procedure'
=> array('options' => $procedure_options),
+ 'control_area' =>
array('options' => $control_area_options),
+ 'control_group' =>
$control_group_array,
+ );
+
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control_group');
+
+/*
+
$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
+
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
+ $GLOBALS['phpgw']->richtext->generate_script();
+*/
+
+ // $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'controller.item', 'controller' );
+
+ self::render_template_xsl('control_group',
$data);
+ }
+ }
+
+/* public function display_control_items()
+ {
+ //$GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control_item_list";
+
+
self::set_active_menu('controller::control_item::control_item_list');
+ if(phpgw::get_var('phpgw_return_as') == 'json') {
+ return $this->display_control_items_json();
+ }
+
+ self::add_javascript('controller', 'yahoo',
'datatable.js');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('paginator');
+
+ $data = array(
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array(
+ 'type' =>
'link',
+ 'value' =>
lang('New application'),
+ 'href' =>
self::link(array('menuaction' => 'controller.uicontrol_item.index'))
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'status',
+ 'text' => lang('Status').':',
+ 'list' => array(
+ array(
+ 'id' => 'none',
+ 'name' => lang('Not selected')
+ ),
+ array(
+ 'id' => 'NEW',
+ 'name' => lang('NEW')
+ ),
+ array(
+ 'id' => 'PENDING',
+ 'name' => lang('PENDING')
+ ),
+ array(
+ 'id' => 'REJECTED',
+ 'name' => lang('REJECTED')
+ ),
+ array(
+ 'id' => 'ACCEPTED',
+ 'name' => lang('ACCEPTED')
+ )
+ )
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'control_groups',
+ 'text' => lang('Control_group').':',
+ 'list' =>
$this->so_control_group->get_control_group_select_array(),
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'control_areas',
+ 'text' => lang('Control_area').':',
+ 'list' =>
$this->so_control_area->get_control_area_select_array(),
+ ),
+ array('type' => 'text',
+ 'text' => lang('searchfield'),
+ 'name' =>
'query'
+ ),
+ array(
+ 'type' =>
'submit',
+ 'name' =>
'search',
+ 'value' =>
lang('Search')
+ ),
+ array(
+ 'type' =>
'link',
+ 'value' =>
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
+ 'href' =>
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' =>
'controller.uicontrol_item.display_control_items', 'phpgw_return_as' =>
'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' => lang('ID'),
+ 'sortable' => true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' => 'title',
+ 'label' =>
lang('Title'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'required',
+ 'label' =>
lang('Required'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'what_to_do',
+ 'label' => lang('What
to do'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'how_to_do',
+ 'label' => lang('How to
do'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' =>
'control_group_id',
+ 'label' =>
lang('control_group_id'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' =>
'control_area_id',
+ 'label' =>
lang('control_area_id'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ )
+ )
+ ),
+ );
+//_debug_array($data);
+
+ self::render_template_xsl('datatable', $data);
+ }
+*/
+
+/* public function display_control_items_json()
+ {
+ $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
+ );
+
+ $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');
+ if($sort_field == null)
+ {
+ $sort_field = 'control_item_id';
+ }
+ $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))
+ {
+ $control_item =
rental_socontract::get_instance()->get_single($control_item_id);
+ }
+
+ $result_objects =
controller_socontrol_item::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
+
+ $results = array();
+
+ foreach($result_objects as $control_item_obj)
+ {
+ $results['results'][] =
$control_item_obj->serialize();
+ }
+
+ array_walk($results["results"], array($this,
"_add_links"), "controller.uicontrol_item.index");
+
+ return $this->yui_results($results);
+ }
+*/
+
+ 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
+ );
+
+ $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 {
+ $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');
+ if($sort_field == null)
+ {
+ $sort_field = 'control_group_id';
+ }
+ $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_group_id = phpgw::get_var('control_group_id');
+ /*if(isset($control_group_id))
+ {
+ $control_item =
$this->so->get_single($control_group_id);
+ }*/
+
//var_dump($start_index.'-'.$num_of_objects.'-'.$sort_field.'-'.$sort_ascending.'-'.$search_for.'-'.$search_type.'-'.$filters);
+ $result_objects = $this->so->get($start_index,
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type,
$filters);
+ //var_dump($result_objects);
+
+ $results = array();
+
+ foreach($result_objects as $control_group_obj)
+ {
+ $results['results'][] =
$control_group_obj->serialize();
+ }
+
+ array_walk($results["results"], array($this,
"_add_links"), "controller.uicontrol_group.view");
+
+ return $this->yui_results($results);
+ }
+
+ /**
+ * Public method. Called when a user wants to view information
about a control group.
+ * @param HTTP::id the control_group ID
+ */
+ public function view()
+ {
+ $GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('view');
+ //Retrieve the control_group object
+ $control_group_id = (int)phpgw::get_var('id');
+ if(isset($_POST['edit_control_group']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'controller.uicontrol_group.edit', 'id' =>
$control_group_id));
+ }
+ else
+ {
+ if(isset($control_group_id) &&
$control_group_id > 0)
+ {
+ $control_group =
$this->so->get_single($control_group_id);
+ //var_dump($control_group);
+ }
+ else
+ {
+
$this->render('permission_denied.php',array('error' =>
lang('invalid_request')));
+ return;
+ }
+ //var_dump($control_group);
+
+ if($this->flash_msgs)
+ {
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ }
+
+ $control_group_array =
$control_group->toArray();
+
+ $data = array
+ (
+ 'value_id'
=> !empty($control_group) ? $control_group->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'control_group' =>
$control_group_array,
+ );
+
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control group');
+
+ self::render_template_xsl('control_group',
$data);
+ }
+ }
+
+
+ }
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
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -6,19 +6,22 @@
phpgw::import_class('controller.socontrol_group');
phpgw::import_class('controller.socontrol_area');
- include_class('controller', 'control', 'inc/model/');
+ include_class('controller', 'control_item', 'inc/model/');
- class controller_uicontrol_item2 extends controller_uicommon
+ class controller_uicontrol_item extends controller_uicommon
{
- private $bo;
private $so;
private $so_control_item;
- private $so_proc;
+ private $so_control_group;
+ private $so_control_area;
public $public_functions = array
(
- 'index' => true,
+ 'index' => true,
'query' => true,
+ 'edit' => true,
+ 'view' => true,
+ 'add' => true,
'display_control_items' => true
);
@@ -29,109 +32,262 @@
$this->so_control_item =
CreateObject('controller.socontrol_item');
$this->so_control_group =
CreateObject('controller.socontrol_group');
$this->so_control_area =
CreateObject('controller.socontrol_area');
- $this->bo = CreateObject('property.boevent',true);
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control_item";
}
public function index()
{
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control_item";
-
- self::set_active_menu('controller::control_item2');
- $repeat_type = $this->bo->get_rpt_type_list();
- $repeat_day = $this->bo->get_rpt_day_list();
+ if(phpgw::get_var('phpgw_return_as') == 'json') {
+ return $this->query();
+ }
+ self::add_javascript('controller', 'yahoo',
'datatable.js');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('paginator');
+ $data = array(
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array(
+ 'type' =>
'link',
+ 'value' =>
lang('New control item'),
+ 'href' =>
self::link(array('menuaction' => 'controller.uicontrol_item.add'))
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'status',
+ 'text' => lang('Status').':',
+ 'list' => array(
+ array(
+ 'id' => 'none',
+ 'name' => lang('Not selected')
+ ),
+ array(
+ 'id' => 'NEW',
+ 'name' => lang('NEW')
+ ),
+ array(
+ 'id' => 'PENDING',
+ 'name' => lang('PENDING')
+ ),
+ array(
+ 'id' => 'REJECTED',
+ 'name' => lang('REJECTED')
+ ),
+ array(
+ 'id' => 'ACCEPTED',
+ 'name' => lang('ACCEPTED')
+ )
+ )
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'control_groups',
+ 'text' => lang('Control_group').':',
+ 'list' =>
$this->so_control_group->get_control_group_select_array(),
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'control_areas',
+ 'text' => lang('Control_area').':',
+ 'list' =>
$this->so_control_area->get_control_area_select_array(),
+ ),
+ array('type' => 'text',
+ 'text' => lang('searchfield'),
+ 'name' =>
'query'
+ ),
+ array(
+ 'type' =>
'submit',
+ 'name' =>
'search',
+ 'value' =>
lang('Search')
+ ),
+ array(
+ 'type' =>
'link',
+ 'value' =>
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
+ 'href' =>
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' => 'controller.uicontrol_item.index',
'phpgw_return_as' => 'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' => lang('ID'),
+ 'sortable' => true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' => 'title',
+ 'label' =>
lang('Control item title'),
+ 'sotrable' =>
false
+ ),
+ array(
+ 'key' => 'what_to_do',
+ 'label' =>
lang('Control item what to do'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' =>
'control_group_id',
+ 'label' =>
lang('Control group'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' =>
'control_area_id',
+ 'label' =>
lang('Control area'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ )
+ )
+ ),
+ );
+//_debug_array($data);
+
+ self::render_template_xsl('datatable', $data);
+ }
+
+ /**
+ * Public method. Forwards the user to edit mode.
+ */
+ public function add()
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'controller.uicontrol_item.edit'));
+ }
+
+
+ public function edit()
+ {
+ $control_item_id = phpgw::get_var('id');
+ if(isset($control_item_id) && $control_item_id > 0)
+ {
+ $control_item =
$this->so_control_item->get_single($control_item_id);
+ }
+ else
+ {
+ $control_item = new controller_control_item();
+ }
+
if(isset($_POST['save_control_item'])) // The user has
pressed the save button
{
- if(isset($control_item)) // Edit control
+ if(isset($control_item)) // Add new values to
the control item
{
$control_item->set_title(phpgw::get_var('title'));
-
$control_item->set_required(phpgw::get_var('required'));
- $control_item->set_what_to_desc(
strtotime( phpgw::get_var('what_to_desc') ) );
- $control_item->set_how_to_desc(
strtotime( phpgw::get_var('how_to_desc') ) );
- $control_item->set_control_group_id(
strtotime( phpgw::get_var('control_group_id') ) );
- $control_item->set_control_area_id(
strtotime( phpgw::get_var('control_area_id') ) );
+
$control_item->set_required(phpgw::get_var('required') == 'on' ? true : false);
+ $control_item->set_what_to_do(
phpgw::get_var('what_to_do','html') );
+ $control_item->set_how_to_do(
phpgw::get_var('how_to_do','html') );
+ $control_item->set_control_group_id(
phpgw::get_var('control_group_id') );
+ $control_item->set_control_area_id(
phpgw::get_var('control_area_id') );
- $this->so->add($control_item);
- }
- else // Add new control
- {
-
- $control_item = new
controller_control();
+ //$this->so->store($control_item);
-
$control_item->set_title(phpgw::get_var('title'));
-
$control_item->set_required(phpgw::get_var('required'));
- $control_item->set_what_to_desc(
strtotime( phpgw::get_var('what_to_desc') ) );
- $control_item->set_how_to_desc(
strtotime( phpgw::get_var('how_to_desc') ) );
- $control_item->set_control_group_id(
strtotime( phpgw::get_var('control_group_id') ) );
- $control_item->set_control_area_id(
strtotime( phpgw::get_var('control_area_id') ) );
-
- $this->so->add($control_item);
+ if(isset($control_item_id) &&
$control_item_id > 0)
+ {
+ $ctrl_item_id =
$control_item_id;
+
if($this->so_control_item->store($control_item))
+ {
+ $message =
lang('messages_saved_form');
+ }
+ else
+ {
+ $error =
lang('messages_form_error');
+ }
+ }
+ else
+ {
+ $ctrl_item_id =
$this->so_control_item->add($control_item);
+ if($ctrl_item_id)
+ {
+ $message =
lang('messages_saved_form');
+ }
+ else
+ {
+ $error =
lang('messages_form_error');
+ }
+ }
+
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'controller.uicontrol_item.view', 'id' => $ctrl_item_id));
}
}
-
- $control_area_array =
$this->so_control_area->get_control_area_array();
- $control_group_array =
$this->so_control_group->get_control_group_array();
-
-
- if($this->flash_msgs)
+ else if(isset($_POST['cancel_control_item'])) // The
user has pressed the cancel button
{
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ if(isset($control_item_id) && $control_item_id
> 0)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'controller.uicontrol_item.view', 'id' => $control_item_id));
+ }
+ else
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'controller.uicontrol_item.index'));
+ }
}
-
- foreach ($control_area_array as $control_area)
+ else
{
- $control_area_options = array
+
+ $control_area_array =
$this->so_control_area->get_control_area_array();
+ $control_group_array =
$this->so_control_group->get_control_group_array();
+
+
+ if($this->flash_msgs)
+ {
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ }
+
+ foreach ($control_area_array as $control_area)
+ {
+ $control_area_options[] = array
+ (
+ 'id' =>
$control_area->get_id(),
+ 'name' =>
$control_area->get_title()
+
+ );
+ }
+
+ foreach ($control_group_array as $control_group)
+ {
+ $control_group_options[] = array
+ (
+ 'id' =>
$control_group->get_id(),
+ 'name' =>
$control_group->get_group_name()
+
+ );
+ }
+
+ $control_item_array = $control_item->toArray();
+
+ $data = array
(
- 'id' => $control_area->get_id(),
- 'name' => $control_area->get_name()
-
+ 'value_id'
=> !empty($control_item) ? $control_item->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'editable'
=> true,
+ 'control_item' =>
$control_item_array,
+ 'control_area' =>
array('options' => $control_area_options),
+ 'control_group' =>
array('options' => $control_group_options),
);
+
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control_item');
+
+
+
$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
+
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
+ $GLOBALS['phpgw']->richtext->generate_script();
+
+
+ // $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'controller.item', 'controller' );
+
+ self::render_template_xsl('control_item',
$data);
}
-
- foreach ($control_group_array as $control_group)
- {
- $control_group_options = array
- (
- 'id' => $control_group->get_id(),
- 'name' => $control_group->get_name()
-
- );
- }
-
- $data = array
- (
- 'value_id' =>
!empty($control) ? $control->get_id() : 0,
- 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
- 'editable' => true,
- 'control_item' =>
array('options' => $control_area_options),
- 'control_group' =>
array('options' => $control_group_options),
- );
-
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control_item');
-
-/*
-
$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
-
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
- $GLOBALS['phpgw']->richtext->generate_script();
-*/
-
-// $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'controller.item', 'controller' );
-
- self::render_template_xsl('control_item', $data);
}
- public function display_control_items()
+/* public function display_control_items()
{
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control_item_list";
+ //$GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control_item_list";
-
self::set_active_menu('controller::control_item2::control_item_list2');
+
self::set_active_menu('controller::control_item::control_item_list');
if(phpgw::get_var('phpgw_return_as') == 'json') {
return $this->display_control_items_json();
}
- $this->bo = CreateObject('booking.boapplication');
- $GLOBALS['phpgw_info']['apps']['manual']['section'] =
'booking_manual';
+
self::add_javascript('controller', 'yahoo',
'datatable.js');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('paginator');
@@ -143,7 +299,7 @@
array(
'type' =>
'link',
'value' =>
lang('New application'),
- 'href' =>
self::link(array('menuaction' => 'controller.uicontrol_item2.index'))
+ 'href' =>
self::link(array('menuaction' => 'controller.uicontrol_item.index'))
),
array('type' =>
'filter',
'name' =>
'status',
@@ -199,7 +355,7 @@
),
),
'datatable' => array(
- 'source' =>
self::link(array('menuaction' =>
'controller.uicontrol_item2.display_control_items', 'phpgw_return_as' =>
'json')),
+ 'source' =>
self::link(array('menuaction' =>
'controller.uicontrol_item.display_control_items', 'phpgw_return_as' =>
'json')),
'field' => array(
array(
'key' => 'id',
@@ -248,8 +404,9 @@
self::render_template_xsl('datatable', $data);
}
-
- public function display_control_items_json()
+*/
+
+/* public function display_control_items_json()
{
$params = array(
'start' => phpgw::get_var('startIndex', 'int',
'REQUEST', 0),
@@ -290,14 +447,114 @@
$results['results'][] =
$control_item_obj->serialize();
}
- array_walk($results["results"], array($this,
"_add_links"), "controller.uicontrol_item2.index");
+ array_walk($results["results"], array($this,
"_add_links"), "controller.uicontrol_item.index");
return $this->yui_results($results);
}
+*/
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
+ );
+
+ $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 {
+ $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');
+ if($sort_field == null)
+ {
+ $sort_field = 'control_item_id';
+ }
+ $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))
+ {
+ $control_item =
$this->so_control_item->get_single($control_item_id);
+ }
+
+ $result_objects =
$this->so_control_item->get($start_index, $num_of_objects, $sort_field,
$sort_ascending, $search_for, $search_type, $filters);
+ //var_dump($result_objects);
+
+ $results = array();
+
+ foreach($result_objects as $control_item_obj)
+ {
+ $results['results'][] =
$control_item_obj->serialize();
+ }
+
+ array_walk($results["results"], array($this,
"_add_links"), "controller.uicontrol_item.view");
+
+ return $this->yui_results($results);
+ }
+
+ /**
+ * Public method. Called when a user wants to view information
about a control item.
+ * @param HTTP::id the control_item ID
+ */
+ public function view()
+ {
+ $GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('view');
+ //Retrieve the control_item object
+ $control_item_id = (int)phpgw::get_var('id');
+ if(isset($_POST['edit_control_item']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'controller.uicontrol_item.edit', 'id' =>
$control_item_id));
+ }
+ else
+ {
+ if(isset($control_item_id) && $control_item_id
> 0)
+ {
+ $control_item =
$this->so_control_item->get_single($control_item_id);
+ }
+ else
+ {
+
$this->render('permission_denied.php',array('error' =>
lang('invalid_request')));
+ return;
+ }
+ //var_dump($control_item);
+
+ if($this->flash_msgs)
+ {
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ }
+
+ $control_item_array = $control_item->toArray();
+ $data = array
+ (
+ 'value_id'
=> !empty($control_item) ? $control_item->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'control_item' =>
$control_item_array,
+ );
+
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control item');
+
+ self::render_template_xsl('control_item',
$data);
+ }
}
+
}
Deleted:
branches/Version-1_0-branch/controller/inc/class.uicontrol_item2.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_item2.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item2.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -1,483 +0,0 @@
-<?php
- phpgw::import_class('controller.uicommon');
- phpgw::import_class('property.boevent');
- phpgw::import_class('controller.socontrol');
- phpgw::import_class('controller.socontrol_item');
- phpgw::import_class('controller.socontrol_group');
-
- include_class('controller', 'control', 'inc/model/');
-
- class controller_uicontrol_item2 extends controller_uicommon
- {
- private $bo;
- private $so;
- private $so_proc;
-
- public $public_functions = array
- (
- 'index' => true,
- 'display_control_items' => true,
- 'separate_tabs' => true,
- 'delete' => true,
- 'js_poll' => true
- );
-
- public function __construct()
- {
- parent::__construct();
- $this->so = CreateObject('controller.socontrol');
- $this->so_control_item =
CreateObject('controller.socontrol_item');
- $this->so_control_group =
CreateObject('controller.socontrol_group');
- $this->bo = CreateObject('property.boevent',true);
- }
-
- public function index()
- {
- self::set_active_menu('controller::control_item2');
- $repeat_type = $this->bo->get_rpt_type_list();
- $repeat_day = $this->bo->get_rpt_day_list();
-
- if(isset($_POST['save_control'])) // The user has
pressed the save button
- {
- if(isset($control)) // Edit control
- {
-
$control->set_title(phpgw::get_var('title'));
-
$control->set_description(phpgw::get_var('description'));
- $control->set_start_date( strtotime(
phpgw::get_var('start_date') ) );
- $control->set_end_date( strtotime(
phpgw::get_var('end_date') ) );
- $control->set_repeat_day( strtotime(
phpgw::get_var('repeat_day') ) );
- $control->set_repeat_type( strtotime(
phpgw::get_var('repeat_type') ) );
- $control->set_repeat_interval(
strtotime( phpgw::get_var('repeat_interval') ) );
- $control->set_enabled( true );
-
- $this->so->add($control);
- }
- else // Add new control
- {
-
- $control = new controller_control();
-
-
$control->set_title(phpgw::get_var('title'));
-
$control->set_description(phpgw::get_var('description'));
- $control->set_start_date( strtotime(
phpgw::get_var('start_date') ) );
- $control->set_end_date( strtotime(
phpgw::get_var('end_date') ) );
- $control->set_repeat_day( strtotime(
phpgw::get_var('repeat_day') ) );
- $control->set_repeat_type( strtotime(
phpgw::get_var('repeat_type') ) );
- $control->set_repeat_interval(
strtotime( phpgw::get_var('repeat_interval') ) );
- $control->set_enabled( true );
-
- $this->so->add($control);
- }
- }
-
- $control_item_array =
$this->so_control_item->get_control_item_array();
- $control_group_array =
$this->so_control_group->get_control_group_array();
-
-
- if($this->flash_msgs)
- {
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
- }
-
- foreach ($control_area_array as $control_area)
- {
- $control_area_options = array
- (
- 'id' => $control_area->get_id(),
- 'name' => $control_area->get_name()
-
- );
- }
-
- foreach ($control_group_array as $control_group)
- {
- $control_group_options = array
- (
- 'id' => $control_group->get_id(),
- 'name' => $control_group->get_name()
-
- );
- }
-
- $data = array
- (
- 'value_id' =>
!empty($control) ? $control->get_id() : 0,
- 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
- 'editable' => true,
- 'control_item' =>
array('options' => $control_area_options),
- 'control_group' =>
array('options' => $control_group_options),
- );
-
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control_item');
-
-/*
-
$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
-
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
- $GLOBALS['phpgw']->richtext->generate_script();
-*/
-
-// $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'controller.item', 'controller' );
-
- self::render_template_xsl('control_item', $data);
- }
-
-
- public function separate_tabs()
- {
-
self::set_active_menu('controller::control_item2::separate_tabs');
-
- $type = phpgw::get_var('type', 'string', 'REQUEST', null);
-
- $tabs = array();
- $tabs[] = array(
- 'label' => lang('Your preferences'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_item2.separate_tabs', 'type' => 'user'))
- );
- $tabs[] = array(
- 'label' => lang('Default preferences'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_item2.separate_tabs', 'type' => 'default'))
- );
- $tabs[] = array(
- 'label' => lang('Forced preferences'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_item2.separate_tabs', 'type' => 'forced'))
- );
-
- switch($type)
- {
- case 'default':
- $selected = 1;
- $resource_id = 81;
- break;
- case 'forced':
- $selected = 2;
- $resource_id = 46;
- break;
- case 'user':
- default:
- $selected = 0;
- $resource_id = 80;
- }
-
- $add_document_link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicontrol_item2.index') );
- $resource = array('id' => $resource_id,
'add_document_link' => $add_document_link, 'permission' => array('write' =>
true ) );
-
- $data = array
- (
- 'tabs' =>
$GLOBALS['phpgw']->common->create_tabs($tabs, $selected),
- 'resource' => $resource
- );
- $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'example_separate_tabs', 'controller' );
- self::render_template_xsl('example_separate_tabs',
$data);
- }
-
-
- public function display_control_items()
- {
-
self::set_active_menu('controller::control_item2::control_item_list2');
- if(phpgw::get_var('phpgw_return_as') == 'json') {
- return $this->display_control_items_json();
- }
- $this->bo = CreateObject('booking.boapplication');
- $GLOBALS['phpgw_info']['apps']['manual']['section'] =
'booking_manual';
- self::add_javascript('controller', 'yahoo',
'datatable.js');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('paginator');
-
- $data = array(
- 'form' => array(
- 'toolbar' => array(
- 'item' => array(
- array(
- 'type' =>
'link',
- 'value' =>
lang('New application'),
- 'href' =>
self::link(array('menuaction' => 'controller.uicontrol_item2.index'))
- ),
- array('type' =>
'filter',
- 'name' =>
'status',
- 'text' => lang('Status').':',
- 'list' => array(
- array(
- 'id' => 'none',
- 'name' => lang('Not selected')
- ),
- array(
- 'id' => 'NEW',
- 'name' => lang('NEW')
- ),
- array(
- 'id' => 'PENDING',
- 'name' => lang('PENDING')
- ),
- array(
- 'id' => 'REJECTED',
- 'name' => lang('REJECTED')
- ),
- array(
- 'id' => 'ACCEPTED',
- 'name' => lang('ACCEPTED')
- )
- )
- ),
- array('type' =>
'filter',
- 'name' =>
'buildings',
- 'text' => lang('Building').':',
- 'list' => $this->bo->so->get_buildings(),
- ),
- array('type' =>
'filter',
- 'name' =>
'activities',
- 'text' => lang('Activity').':',
- 'list' =>
$this->bo->so->get_activities_main_level(),
- ),
- array('type' => 'text',
- 'text' => lang('searchfield'),
- 'name' =>
'query'
- ),
- array(
- 'type' =>
'submit',
- 'name' =>
'search',
- 'value' =>
lang('Search')
- ),
- array(
- 'type' =>
'link',
- 'value' =>
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
- 'href' =>
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
- ),
- ),
- ),
- ),
- 'datatable' => array
- (
- 'source' =>
self::link(array('menuaction' =>
'controller.uicontrol_item2.display_control_items', 'phpgw_return_as' =>
'json')),
- 'field' => array(
- array(
- 'key' => 'id',
- 'label' => lang('ID'),
- 'sortable' => true,
- 'formatter' =>
'YAHOO.portico.formatLink'
- ),
- array(
- 'key' => 'status',
- 'label' =>
lang('Status'),
- 'sortable' => false
- ),
- array(
- 'key' =>
'building_name',
- 'label' =>
lang('Building'),
- 'sortable' => true
- ),
- array(
- 'key' => 'what',
- 'label' => lang('What'),
- 'sortable' => false
- ),
- array(
- 'key' => 'created',
- 'label' =>
lang('Created'),
- 'sortable' => true
- ),
- array(
- 'key' => 'modified',
- 'label' => lang('last
modified'),
- 'sortable' => true
- ),
- array(
- 'key' =>
'activity_name',
- 'label' =>
lang('Activity'),
- 'sortable' => true
- ),
- array(
- 'key' => 'contact_name',
- 'label' =>
lang('Contact'),
- 'sortable' => true
- ),
- array(
- 'key' => 'link',
- 'hidden' => true
- )
- )
- ),
- );
-//_debug_array($data);
- $parameters = array
- (
- 'parameter' => array
- (
- array
- (
- 'name' => 'id',
- 'source' => 'id'
- ),
- )
- );
-
- $actions = array
- (
- array
- (
- 'my_name' => 'view',
- 'text' => lang('view'),
- // 'confirm_msg' => lang('do you really
want to view this entry'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
'controller.uicontrol_item2.index',
- )),
- 'parameters' => $parameters
- ),
- array
- (
- 'my_name' => 'edit',
- 'text' => lang('edit'),
- 'confirm_msg' => lang('do you really
want to edit this entry'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
'controller.uicontrol_item2.index',
- )),
- 'parameters' => $parameters
- ),
- array
- (
- 'my_name' => 'delete',
- 'text' =>
lang('delete'),
- 'confirm_msg' => lang('do you really
want to delete this entry'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
'controller.uicontrol_item2.delete',
- )),
- 'parameters' => $parameters
- )
- );
-
- $data['actions'] = json_encode($actions);
-
-//_debug_array($data);die();
- self::render_template_xsl('datatable', $data);
- }
-
- public function display_control_items_json()
- {
- $this->bo = CreateObject('booking.boapplication');
- $this->resource_bo = CreateObject('booking.boresource');
-
- if (
!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) &&
- $GLOBALS['phpgw']->acl->check('admin',
phpgwapi_acl::ADD, 'controller') )
- {
- $filters['id'] =
$this->bo->accessable_applications($GLOBALS['phpgw_info']['user']['id']);
- }
- $filters['status'] = 'NEW';
- if(isset($_SESSION['showall']))
- {
- $filters['status'] = array('NEW',
'PENDING','REJECTED', 'ACCEPTED');
- $testdata = phpgw::get_var('buildings', 'int', 'REQUEST',
null);
- if ($testdata != 0)
- {
- $filters['building_name'] =
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST',
null));
- }
- else
- {
- unset($filters['building_name']);
- }
- $testdata2 = phpgw::get_var('activities', 'int', 'REQUEST',
null);
- if ($testdata2 != 0)
- {
- $filters['activity_id'] =
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST',
null));
- }
- else
- {
- unset($filters['activity_id']);
- }
-
- }
- else
- {
- if (phpgw::get_var('status') == 'none')
- {
- $filters['status'] = array('NEW',
'PENDING', 'REJECTED', 'ACCEPTED');
- }
- else
- {
- $filters['status'] = phpgw::get_var('status');
- }
- $testdata = phpgw::get_var('buildings', 'int', 'REQUEST',
null);
- if ($testdata != 0)
- {
- $filters['building_name'] =
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST',
null));
- }
- else
- {
- unset($filters['building_name']);
- }
- $testdata2 = phpgw::get_var('activities', 'int', 'REQUEST',
null);
- if ($testdata2 != 0)
- {
- $filters['activity_id'] =
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST',
null));
- }
- else
- {
- unset($filters['activity_id']);
- }
- }
-
- $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
- );
-
- $applications = $this->bo->so->read($params);
-
- foreach($applications['results'] as &$application)
- {
- if (strstr($application['building_name'],"%"))
- {
- $search = array('%2C','%C3%85',
'%C3%A5', '%C3%98', '%C3%B8', '%C3%86', '%C3%A6');
- $replace = array
(',','Å','å','Ø','ø','Æ','æ');
- $application['building_name'] =
str_replace($search, $replace, $application['building_name']);
- }
-
- $application['status'] =
lang($application['status']);
- $application['created'] =
pretty_timestamp($application['created']);
- $application['modified'] =
pretty_timestamp($application['modified']);
- $application['frontend_modified'] =
pretty_timestamp($application['frontend_modified']);
- $application['resources'] =
$this->resource_bo->so->read(array('filters'=>array('id'=>$application['resources'])));
- $application['resources'] =
$application['resources']['results'];
- if($application['resources'])
- {
- $names = array();
- foreach($application['resources'] as
$res)
- {
- $names[] = $res['name'];
- }
- $application['what'] =
$application['resources'][0]['building_name']. ' ('.join(', ', $names).')';
- }
- }
- array_walk($applications["results"], array($this,
"_add_links"), "controller.uicontrol_item2.index");
-//_debug_array($this->yui_results($applications));
- return $this->yui_results($applications);
- }
-
-
- public function delete()
- {
- return 'deleted';
- }
-
- public function js_poll()
- {
- if($poll = phpgw::get_var('poll'))
- {
- return $poll;
- }
- return 'hello world';
- }
-
- public function query()
- {
- var_dump("Er i uicontrol");
-
- }
- }
Copied: branches/Version-1_0-branch/controller/inc/class.uiexample.inc.php
(from rev 7718, trunk/controller/inc/class.uiexample.inc.php)
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uiexample.inc.php
(rev 0)
+++ branches/Version-1_0-branch/controller/inc/class.uiexample.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -0,0 +1,515 @@
+<?php
+ phpgw::import_class('controller.uicommon');
+ phpgw::import_class('property.boevent');
+ phpgw::import_class('controller.socontrol');
+ phpgw::import_class('controller.socontrol_item');
+ phpgw::import_class('controller.socontrol_group');
+
+ include_class('controller', 'control', 'inc/model/');
+
+ class controller_uiexample extends controller_uicommon
+ {
+ private $bo;
+ private $so;
+ private $so_proc;
+
+ public $public_functions = array
+ (
+ 'index' => true,
+ 'edit' => true,
+ 'normal_tabs' => true,
+ 'separate_tabs' => true,
+ 'delete' => true,
+ 'js_poll' => true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->so = CreateObject('controller.socontrol');
+ $this->so_control_item =
CreateObject('controller.socontrol_item');
+ $this->so_control_group =
CreateObject('controller.socontrol_group');
+ $this->bo = CreateObject('property.boevent',true);
+ }
+
+ public function index()
+ {
+ self::set_active_menu('controller::example');
+ if(phpgw::get_var('phpgw_return_as') == 'json') {
+ return $this->index_json();
+ }
+ $this->bo = CreateObject('booking.boapplication');
+ $GLOBALS['phpgw_info']['apps']['manual']['section'] =
'booking_manual';
+ self::add_javascript('controller', 'yahoo',
'datatable.js');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('paginator');
+
+ $data = array(
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array(
+ 'type' =>
'link',
+ 'value' =>
lang('New application'),
+ 'href' =>
self::link(array('menuaction' => 'controller.uiexample.index'))
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'status',
+ 'text' => lang('Status').':',
+ 'list' => array(
+ array(
+ 'id' => 'none',
+ 'name' => lang('Not selected')
+ ),
+ array(
+ 'id' => 'NEW',
+ 'name' => lang('NEW')
+ ),
+ array(
+ 'id' => 'PENDING',
+ 'name' => lang('PENDING')
+ ),
+ array(
+ 'id' => 'REJECTED',
+ 'name' => lang('REJECTED')
+ ),
+ array(
+ 'id' => 'ACCEPTED',
+ 'name' => lang('ACCEPTED')
+ )
+ )
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'buildings',
+ 'text' => lang('Building').':',
+ 'list' => $this->bo->so->get_buildings(),
+
'onChangeSelect'=> 'requestWithBuildingFilter',
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'activities',
+ 'text' => lang('Activity').':',
+ 'list' =>
$this->bo->so->get_activities_main_level(),
+ ),
+ array('type' => 'text',
+ 'text' => lang('searchfield'),
+ 'name' =>
'query'
+ ),
+ array(
+ 'type' =>
'submit',
+ 'name' =>
'search',
+ 'value' =>
lang('Search')
+ ),
+ array(
+ 'type' =>
'link',
+ 'value' =>
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
+ 'href' =>
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array
+ (
+ 'source' =>
self::link(array('menuaction' => 'controller.uiexample.index',
'phpgw_return_as' => 'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' => lang('ID'),
+ 'sortable' => true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' => 'status',
+ 'label' =>
lang('Status'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' =>
'building_name',
+ 'label' =>
lang('Building'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'what',
+ 'label' => lang('What'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'created',
+ 'label' =>
lang('Created'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'modified',
+ 'label' => lang('last
modified'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' =>
'activity_name',
+ 'label' =>
lang('Activity'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'contact_name',
+ 'label' =>
lang('Contact'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ )
+ )
+ ),
+ );
+//_debug_array($data);
+ $parameters = array
+ (
+ 'parameter' => array
+ (
+ array
+ (
+ 'name' => 'id',
+ 'source' => 'id'
+ ),
+ )
+ );
+
+ $actions = array
+ (
+ array
+ (
+ 'my_name' => 'view',
+ 'text' => lang('view'),
+ // 'confirm_msg' => lang('do you really
want to view this entry'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'controller.uiexample.edit',
+ )),
+ 'parameters' => $parameters
+ ),
+ array
+ (
+ 'my_name' => 'edit',
+ 'text' => lang('edit'),
+ 'confirm_msg' => lang('do you really
want to edit this entry'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'controller.uiexample.edit',
+ )),
+ 'parameters' => $parameters
+ ),
+ array
+ (
+ 'my_name' => 'delete',
+ 'text' =>
lang('delete'),
+ 'confirm_msg' => lang('do you really
want to delete this entry'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'controller.uiexample.delete',
+ )),
+ 'parameters' => $parameters
+ )
+ );
+
+ $data['actions'] = json_encode($actions);
+
+//_debug_array($data);die();
+ self::render_template_xsl('datatable', $data);
+ }
+
+ public function index_json()
+ {
+ $this->bo = CreateObject('booking.boapplication');
+ $this->resource_bo = CreateObject('booking.boresource');
+
+ if (
!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) &&
+ $GLOBALS['phpgw']->acl->check('admin',
phpgwapi_acl::ADD, 'controller') )
+ {
+ $filters['id'] =
$this->bo->accessable_applications($GLOBALS['phpgw_info']['user']['id']);
+ }
+ $filters['status'] = 'NEW';
+ if(isset($_SESSION['showall']))
+ {
+ $filters['status'] = array('NEW',
'PENDING','REJECTED', 'ACCEPTED');
+ $testdata = phpgw::get_var('buildings', 'int', 'REQUEST',
null);
+ if ($testdata != 0)
+ {
+ $filters['building_name'] =
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST',
null));
+ }
+ else
+ {
+ unset($filters['building_name']);
+ }
+ $testdata2 = phpgw::get_var('activities', 'int', 'REQUEST',
null);
+ if ($testdata2 != 0)
+ {
+ $filters['activity_id'] =
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST',
null));
+ }
+ else
+ {
+ unset($filters['activity_id']);
+ }
+
+ }
+ else
+ {
+ if (phpgw::get_var('status') == 'none')
+ {
+ $filters['status'] = array('NEW',
'PENDING', 'REJECTED', 'ACCEPTED');
+ }
+ else
+ {
+ $filters['status'] = phpgw::get_var('status');
+ }
+ $testdata = phpgw::get_var('buildings', 'int', 'REQUEST',
null);
+ if ($testdata != 0)
+ {
+ $filters['building_name'] =
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST',
null));
+ }
+ else
+ {
+ unset($filters['building_name']);
+ }
+ $testdata2 = phpgw::get_var('activities', 'int', 'REQUEST',
null);
+ if ($testdata2 != 0)
+ {
+ $filters['activity_id'] =
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST',
null));
+ }
+ else
+ {
+ unset($filters['activity_id']);
+ }
+ }
+
+ $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
+ );
+
+ $applications = $this->bo->so->read($params);
+
+ foreach($applications['results'] as &$application)
+ {
+ if (strstr($application['building_name'],"%"))
+ {
+ $search = array('%2C','%C3%85',
'%C3%A5', '%C3%98', '%C3%B8', '%C3%86', '%C3%A6');
+ $replace = array
(',','Å','å','Ø','ø','Æ','æ');
+ $application['building_name'] =
str_replace($search, $replace, $application['building_name']);
+ }
+
+ $application['status'] =
lang($application['status']);
+ $application['created'] =
pretty_timestamp($application['created']);
+ $application['modified'] =
pretty_timestamp($application['modified']);
+ $application['frontend_modified'] =
pretty_timestamp($application['frontend_modified']);
+ $application['resources'] =
$this->resource_bo->so->read(array('filters'=>array('id'=>$application['resources'])));
+ $application['resources'] =
$application['resources']['results'];
+ if($application['resources'])
+ {
+ $names = array();
+ foreach($application['resources'] as
$res)
+ {
+ $names[] = $res['name'];
+ }
+ $application['what'] =
$application['resources'][0]['building_name']. ' ('.join(', ', $names).')';
+ }
+ }
+ array_walk($applications["results"], array($this,
"_add_links"), "controller.uiexample.edit");
+//_debug_array($this->yui_results($applications));
+ return $this->yui_results($applications);
+ }
+
+
+ public function edit()
+ {
+ self::set_active_menu('controller::example::edit');
+ $repeat_type = $this->bo->get_rpt_type_list();
+ $repeat_day = $this->bo->get_rpt_day_list();
+
+ if(isset($_POST['save_control'])) // The user has
pressed the save button
+ {
+ if(isset($control)) // Edit control
+ {
+
$control->set_title(phpgw::get_var('title'));
+
$control->set_description(phpgw::get_var('description'));
+ $control->set_start_date( strtotime(
phpgw::get_var('start_date') ) );
+ $control->set_end_date( strtotime(
phpgw::get_var('end_date') ) );
+ $control->set_repeat_day( strtotime(
phpgw::get_var('repeat_day') ) );
+ $control->set_repeat_type( strtotime(
phpgw::get_var('repeat_type') ) );
+ $control->set_repeat_interval(
strtotime( phpgw::get_var('repeat_interval') ) );
+ $control->set_enabled( true );
+
+ $this->so->add($control);
+ }
+ else // Add new control
+ {
+
+ $control = new controller_control();
+
+
$control->set_title(phpgw::get_var('title'));
+
$control->set_description(phpgw::get_var('description'));
+ $control->set_start_date( strtotime(
phpgw::get_var('start_date') ) );
+ $control->set_end_date( strtotime(
phpgw::get_var('end_date') ) );
+ $control->set_repeat_day( strtotime(
phpgw::get_var('repeat_day') ) );
+ $control->set_repeat_type( strtotime(
phpgw::get_var('repeat_type') ) );
+ $control->set_repeat_interval(
strtotime( phpgw::get_var('repeat_interval') ) );
+ $control->set_enabled( true );
+
+ $this->so->add($control);
+ }
+ }
+
+ $control_item_array =
$this->so_control_item->get_control_item_array();
+ $control_group_array =
$this->so_control_group->get_control_group_array();
+
+
+ if($this->flash_msgs)
+ {
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ }
+
+ foreach ($control_area_array as $control_area)
+ {
+ $control_area_options = array
+ (
+ 'id' => $control_area->get_id(),
+ 'name' => $control_area->get_title()
+
+ );
+ }
+
+ foreach ($control_group_array as $control_group)
+ {
+ $control_group_options = array
+ (
+ 'id' => $control_group->get_id(),
+ 'name' =>
$control_group->get_group_name()
+
+ );
+ }
+
+ $data = array
+ (
+ 'value_id' =>
!empty($control) ? $control->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'editable' => true,
+ 'control_item' =>
array('options' => $control_area_options),
+ 'control_group' =>
array('options' => $control_group_options),
+ );
+
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control_item');
+
+
+
$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
+
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
+ $GLOBALS['phpgw']->richtext->generate_script();
+
+
+ self::add_javascript('controller', 'yahoo',
'example_edit.js');
+ self::render_template_xsl('example_edit', $data);
+ }
+
+
+ public function normal_tabs()
+ {
+
self::set_active_menu('controller::example::normal_tabs');
+
+ $resource_id = 80;
+
+ $add_document_link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uiexample.index') );
+ $resource = array('id' => $resource_id,
'add_document_link' => $add_document_link, 'permission' => array('write' =>
true ) );
+
+ $tabs = array
+ (
+ 'general' => array('label' =>
lang('general'), 'link' => '#general'),
+ 'list' => array('label' =>
lang('list'), 'link' => '#list'),
+ 'dates' => array('label' =>
lang('dates'), 'link' => '#dates'),
+ );
+
+ phpgwapi_yui::tabview_setup('example_tabview');
+
+
+ $data = array
+ (
+ 'tabs' =>
phpgwapi_yui::tabview_generate($tabs, 'general'),
+ 'resource' => $resource,
+ 'date' =>
$GLOBALS['phpgw']->yuical->add_listener('date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
time()))
+ );
+ self::add_javascript('controller', 'yahoo',
'example_normal_tabs.js');
+ self::render_template_xsl('example_normal_tabs', $data);
+ }
+
+
+
+ public function separate_tabs()
+ {
+
self::set_active_menu('controller::example::separate_tabs');
+
+ $type = phpgw::get_var('type', 'string', 'REQUEST', null);
+
+ $tabs = array();
+ $tabs[] = array(
+ 'label' => lang('Your preferences'),
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uiexample.separate_tabs', 'type' => 'user'))
+ );
+ $tabs[] = array(
+ 'label' => lang('Default preferences'),
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uiexample.separate_tabs', 'type' => 'default'))
+ );
+ $tabs[] = array(
+ 'label' => lang('Forced preferences'),
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uiexample.separate_tabs', 'type' => 'forced'))
+ );
+
+ switch($type)
+ {
+ case 'default':
+ $selected = 1;
+ $resource_id = 81;
+ break;
+ case 'forced':
+ $selected = 2;
+ $resource_id = 46;
+ break;
+ case 'user':
+ default:
+ $selected = 0;
+ $resource_id = 80;
+ }
+
+ $add_document_link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uiexample.index') );
+ $resource = array('id' => $resource_id,
'add_document_link' => $add_document_link, 'permission' => array('write' =>
true ) );
+
+ $data = array
+ (
+ 'tabs' =>
$GLOBALS['phpgw']->common->create_tabs($tabs, $selected),
+ 'resource' => $resource
+ );
+ self::add_javascript('controller', 'yahoo',
'example_separate_tabs.js');
+ self::render_template_xsl('example_separate_tabs',
$data);
+ }
+
+
+ public function delete()
+ {
+ return 'deleted';
+ }
+
+ public function js_poll()
+ {
+ if($poll = phpgw::get_var('poll'))
+ {
+ return $poll;
+ }
+ return 'hello world';
+ }
+
+ public function query()
+ {
+ var_dump("Er i uicontrol");
+
+ }
+ }
Modified:
branches/Version-1_0-branch/controller/inc/model/class.control_area.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control_area.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/model/class.control_area.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -33,6 +33,14 @@
public function get_title(){ return $this->title; }
+ public function serialize()
+ {
+ return array(
+ 'id' => $this->get_id(),
+ 'title' => $this->get_title()
+ );
+ }
+
/**
* Get a static reference to the storage object associated with
this model object
*
Modified:
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -7,6 +7,8 @@
protected $id;
protected $group_name;
+ protected $procedure_id;
+ protected $control_area_id;
/**
* Constructor. Takes an optional ID. If a contract is
created from outside
@@ -32,7 +34,60 @@
}
public function get_group_name(){ return $this->group_name; }
+
+ public function set_procedure_id($procedure_id)
+ {
+ $this->procedure_id = $procedure_id;
+ }
+
+ public function get_procedure_id(){ return $this->procedure_id;
}
+
+ public function set_control_area_id($control_area_id)
+ {
+ $this->control_area_id = $control_area_id;
+ }
+
+ public function get_control_area_id(){ return
$this->control_area_id; }
+
+ public function serialize()
+ {
+ $result = array();
+ $result['id'] = $this->get_id();
+ $result['group_name'] = $this->get_group_name();
+ $result['procedure_id'] = $this->get_procedure_id();
+ $result['control_area_id'] =
$this->get_control_area_id();
+ return $result;
+ }
+
+ public function toArray()
+ {
+
+// Alternative 1
+// return get_object_vars($this);
+
+// Alternative 2
+ $exclude = array
+ (
+ 'get_field', // feiler (foreldreklassen)
+ 'get_so',//unødvendig
+ );
+
+ $class_methods = get_class_methods($this);
+ $control_group_arr = array();
+ foreach ($class_methods as $class_method)
+ {
+ if( stripos($class_method , 'get_' ) === 0 &&
!in_array($class_method, $exclude))
+ {
+ $_class_method_part = explode('get_',
$class_method);
+
$control_group_arr[$_class_method_part[1]] = $this->$class_method();
+ }
+ }
+
+// _debug_array($control_group_arr);
+ return $control_group_arr;
+ }
+
/**
* Get a static reference to the storage object associated with
this model object
*
Modified:
branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -101,5 +101,5 @@
return $result;
}
- }
+}
?>
\ No newline at end of file
Deleted:
branches/Version-1_0-branch/controller/inc/model/class.control_type.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control_type.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/model/class.control_type.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -1,50 +0,0 @@
-<?php
- include_class('controller', 'model', 'inc/model/');
-
- class controller_control_area extends controller_model
- {
- public static $so;
-
- protected $id;
- protected $title;
-
- /**
- * Constructor. Takes an optional ID. If a contract is
created from outside
- * the database the ID should be empty so the database can add
one according to its logic.
- *
- * @param int $id the id of this composite
- */
- public function __construct(int $id = null)
- {
- $this->id = (int)$id;
- }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id() { return $this->id; }
-
- public function set_title($title)
- {
- $this->title = $title;
- }
-
- public function get_title(){ return $this->title; }
-
- /**
- * Get a static reference to the storage object associated with
this model object
- *
- * @return the storage object
- */
- public static function get_so()
- {
- if (self::$so == null) {
- self::$so =
CreateObject('controller_control_area');
- }
-
- return self::$so;
- }
- }
-?>
\ No newline at end of file
Modified: branches/Version-1_0-branch/controller/inc/model/class.model.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.model.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/model/class.model.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -63,5 +63,33 @@
return true;
}
+public function toArray()
+ {
+
+// Alternative 1
+// return get_object_vars($this);
+
+// Alternative 2
+ $exclude = array
+ (
+ 'get_field', // feiler (foreldreklassen)
+ 'get_so',//unødvendig
+ );
+
+ $class_methods = get_class_methods($this);
+ $control_item_arr = array();
+ foreach ($class_methods as $class_method)
+ {
+ if( stripos($class_method , 'get_' ) === 0 &&
!in_array($class_method, $exclude))
+ {
+ $_class_method_part = explode('get_',
$class_method);
+
$control_item_arr[$_class_method_part[1]] = $this->$class_method();
+ }
+ }
+
+// _debug_array($control_item_arr);
+ return $control_item_arr;
+ }
+
}
?>
Modified:
branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -86,35 +86,7 @@
return self::$so;
}
-
- public function toArray()
- {
-
-// Alternative 1
-// return get_object_vars($this);
-
-// Alternative 2
- $exclude = array
- (
- 'get_field', // feiler (foreldreklassen)
- 'get_so',//unødvendig
- );
-
- $class_methods = get_class_methods($this);
- $procedure_arr = array();
- foreach ($class_methods as $class_method)
- {
- if( stripos($class_method , 'get_' ) === 0 &&
!in_array($class_method, $exclude))
- {
- $_class_method_part = explode('get_',
$class_method);
- $procedure_arr[$_class_method_part[1]]
= $this->$class_method();
- }
- }
-
-// _debug_array($procedure_arr);
- return $procedure_arr;
- }
-
+
public function serialize()
{
return array(
Copied: branches/Version-1_0-branch/controller/js/yahoo/control_tabs.js (from
rev 7718, trunk/controller/js/yahoo/control_tabs.js)
===================================================================
--- branches/Version-1_0-branch/controller/js/yahoo/control_tabs.js
(rev 0)
+++ branches/Version-1_0-branch/controller/js/yahoo/control_tabs.js
2011-09-26 12:11:15 UTC (rev 7719)
@@ -0,0 +1,15 @@
+YAHOO.util.Event.addListener(window, "load", function() {
+
+ /*
+ var oArgs = {menuaction:'controller.uicontrol.edit'};
+ var url = phpGWLink('index.php', oArgs, true);
+ var colDefs = [{key: 'name', label: lang['Name'], formatter:
YAHOO.portico.formatLink}, {key: 'category', label: lang['Category']}, {key:
'actions', label: lang['Actions'], formatter:
YAHOO.portico.formatGenericLink(lang['Edit'], lang['Delete'])}];
+ YAHOO.portico.inlineTableHelper('details_container', url, colDefs);
+
+
+ var oArgs =
{menuaction:'booking.uipermission_resource.index',sort:'name',filter_object_id:resource_id};
+ var url = phpGWLink('index.php', oArgs, true);
+ var colDefs = [{key: 'subject_name', label: lang['Account']}, {key:
'role', label: lang['Role']}, {key: 'actions', label: lang['Actions'],
formatter: YAHOO.portico.formatGenericLink(lang['Edit'], lang['Delete'])}];
+ YAHOO.portico.inlineTableHelper('permissions_container', url,
colDefs);*/
+});
+
Modified: branches/Version-1_0-branch/controller/js/yahoo/datatable.js
===================================================================
--- branches/Version-1_0-branch/controller/js/yahoo/datatable.js
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/js/yahoo/datatable.js
2011-09-26 12:11:15 UTC (rev 7719)
@@ -476,5 +476,19 @@
*
*/
+ this.onChangeSelect = function(type)
+ {
+alert('onChangeSelect');
+ var myselect=document.getElementById("sel_"+ type);
+ for (var i=0; i<myselect.options.length; i++)
+ {
+ if (myselect.options[i].selected==true)
+ {
+ break;
+ }
+ }
+ eval("path_values." +type +"='"+myselect.options[i].value+"'");
+ execute_ds();
+ }
YAHOO.util.Event.addListener(window, "load",
YAHOO.portico.initializeDataTable);
Copied: branches/Version-1_0-branch/controller/js/yahoo/example_edit.js (from
rev 7718, trunk/controller/js/yahoo/example_edit.js)
===================================================================
--- branches/Version-1_0-branch/controller/js/yahoo/example_edit.js
(rev 0)
+++ branches/Version-1_0-branch/controller/js/yahoo/example_edit.js
2011-09-26 12:11:15 UTC (rev 7719)
@@ -0,0 +1,24 @@
+ /* Specific js-code for controller::item
+ *
+ */
+
+//alert('dette er respons fra "controller/js/yahoo/controller.item.js"');
+
+/*
+ this.get_some_feedback = function()
+ {
+ var callback = {success: function(o){
+ feedback =
JSON.parse(o.responseText);
+ // console.log(feedback);
+ alert(feedback);
+ },
+ failure:
function(o){window.alert('Server or your connection is dead.')},
+ timeout: 10000
+ };
+ var oArgs = {menuaction:'controller.uiexample.js_poll',poll:''};
+ var strURL = phpGWLink('index.php', oArgs, true);
+ var request = YAHOO.util.Connect.asyncRequest('POST', strURL,
callback);
+ }
+
+ get_some_feedback();
+*/
Copied: branches/Version-1_0-branch/controller/js/yahoo/example_normal_tabs.js
(from rev 7718, trunk/controller/js/yahoo/example_normal_tabs.js)
===================================================================
--- branches/Version-1_0-branch/controller/js/yahoo/example_normal_tabs.js
(rev 0)
+++ branches/Version-1_0-branch/controller/js/yahoo/example_normal_tabs.js
2011-09-26 12:11:15 UTC (rev 7719)
@@ -0,0 +1,13 @@
+YAHOO.util.Event.addListener(window, "load", function() {
+
+ var oArgs =
{menuaction:'booking.uidocument_resource.index',sort:'name',filter_owner_id:resource_id};
+ var url = phpGWLink('index.php', oArgs, true);
+ var colDefs = [{key: 'name', label: lang['Name'], formatter:
YAHOO.portico.formatLink}, {key: 'category', label: lang['Category']}, {key:
'actions', label: lang['Actions'], formatter:
YAHOO.portico.formatGenericLink(lang['Edit'], lang['Delete'])}];
+ YAHOO.portico.inlineTableHelper('documents_container', url, colDefs);
+
+ var oArgs =
{menuaction:'booking.uipermission_resource.index',sort:'name',filter_object_id:resource_id};
+ var url = phpGWLink('index.php', oArgs, true);
+ var colDefs = [{key: 'subject_name', label: lang['Account']}, {key:
'role', label: lang['Role']}, {key: 'actions', label: lang['Actions'],
formatter: YAHOO.portico.formatGenericLink(lang['Edit'], lang['Delete'])}];
+ YAHOO.portico.inlineTableHelper('permissions_container', url, colDefs);
+});
+
Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2011-09-26
12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2011-09-26
12:11:15 UTC (rev 7719)
@@ -227,4 +227,19 @@
Procedure responsibility controller no Ansvarlig
Procedure description controller no Beskrivelse
Procedure reference controller no Referanse
-Procedure attachment controller no Vedlegg
\ No newline at end of file
+Procedure attachment controller no Vedlegg
+New control item controller no Nytt kontrollpunkt
+Control item title controller no Tittel
+Control_group controller no Kontrollgruppe
+Control group controller no Kontrollgruppe
+Control_area controller no Kontrollområde
+Control area controller no Kontrollområde
+Control item what to do controller no Hva skal gjøres
+Not selected controller no Ingen valgt
+searchfield controller no Søkefelt
+NEW controller no Ny
+PENDING controller no Venter
+ACCEPTED controller no Akseptert
+REJECTED controller no Avvist
+New control group controller no Ny kontrollgruppe
+Control group title controller no Tittel
\ No newline at end of file
Modified: branches/Version-1_0-branch/controller/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_current.inc.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -38,10 +38,10 @@
'controller_control_item' => array(
'fd' => array(
'id' => array('type' => 'auto','precision' =>
4,'nullable' => False),
- 'title' => array('type' =>
'varchar','precision' => '100','nullable' => false),
+ 'title' => array('type' =>
'varchar','precision' => '255','nullable' => false),
'required' => array('type' => 'bool','nullable'
=> true,'default' => 'false'),
- 'what_to_do' => array('type' =>
'varchar','precision' => '255','nullable' => false),
- 'how_to_do' => array('type' =>
'varchar','precision' => '255','nullable' => false),
+ 'what_to_do' => array('type' =>
'text','nullable' => false),
+ 'how_to_do' => array('type' =>
'text','nullable' => false),
'control_group_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'control_area_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True)
),
@@ -96,7 +96,8 @@
'fd' => array(
'id' => array('type' => 'auto','precision' =>
4,'nullable' => False),
'group_name' => array('type' =>
'varchar','precision' => '255','nullable' => false),
- 'procedure_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True)
+ 'procedure_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
+ 'control_area_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True)
),
'pk' => array('id'),
'fk' => array(),
Deleted: branches/Version-1_0-branch/controller/templates/base/control.php
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/templates/base/control.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -1,131 +0,0 @@
-<?php
-//include common logic for all templates
- include("common.php");
- phpgwapi_yui::load_widget('tabview');
- phpgwapi_yui::tabview_setup('controller_tabview');
-?>
-
-<div class="identifier-header">
-<h1><img src="<?php echo RENTAL_TEMPLATE_PATH
?>images/32x32/actions/go-home.png" /> <?php echo lang('control') ?></h1>
-</div>
-
-
-<div id="controller_tabview" class="yui-navset">
- <ul class="yui-nav">
- <li class="selected"><a href="#details"><em><img src="<?php
echo RENTAL_TEMPLATE_PATH ?>images/16x16/actions/go-home.png" alt="icon" />
<?php echo lang('details') ?></em></a></li>
-
- <?php //if($composite->get_id() > 0) { ?>
-
- <li><a href="#elements"><em><img src="<?php echo
RENTAL_TEMPLATE_PATH ?>images/16x16/mimetypes/x-office-drawing-template.png"
alt="icon" /> <?php echo lang('units') ?></em></a></li>
- <li><a href="#controlitems"><em><img src="<?php echo
RENTAL_TEMPLATE_PATH ?>images/16x16/mimetypes/x-office-drawing-template.png"
alt="icon" /> <?php echo lang('control_items') ?></em></a></li>
-
- <?php //} ?>
- </ul>
-
-<div class="yui-content">
- <div id="details">
- <form action="#" method="post">
- <input type="hidden" name="id" value="<?php
if(!empty($control)){ echo $control->get_id(); } else { echo '0'; } ?>"/>
- <dl class="proplist-col">
- <dt>
- <label
for="title">Tittel</label>
- </dt>
- <dd>
- <input type="text" name="title"
id="title" value="" />
- </dd>
- <dt>
- <label
for="description">Beskrivelse</label>
- </dt>
- <dd>
- <textarea cols="70" rows="5"
name="description" id="description" value="" /></textarea>
- </dd>
- <dt>
- <label
for="start_date">Startdato</label>
- </dt>
- <dd>
- <?php
- $start_date = "-";
- $start_date_yui =
date('Y-m-d');
- $start_date_cal =
$GLOBALS['phpgw']->yuical->add_listener('start_date', $start_date);
-
- echo $start_date_cal;
- ?>
- </dd>
- <dt>
- <label
for="end_date">Sluttdato</label>
- </dt>
- <dd>
- <?php
- $end_date = "";
- $end_date_yui =
date('Y-m-d');
- $end_date_cal =
$GLOBALS['phpgw']->yuical->add_listener('end_date', $end_date);
-
- echo $end_date_cal;
- ?>
- </dd>
- <dt>
- <label>Frekvenstype</label>
- </dt>
- <dd>
- <select id="repeat_type"
name="repeat_type">
- <option value="0">Ikke
angitt</option>
- <option
value="1">Daglig</option>
- <option
value="2">Ukentlig</option>
- <option
value="3">Månedlig pr dato</option>
- <option
value="4">Månedlig pr dag</option>
- <option
value="5">Årlig</option>
- </select>
- </dd>
- <dt>
- <label>Frekvens</label>
- </dt>
- <dd>
- <input size="2" type="text"
name="repeat_interval" value="" />
- </dd>
- <dt>
- <label>Prosedyre</label>
- </dt>
- <dd>
- <select id="procedure"
name="procedure">
- <?php
- foreach
($procedure_array as $procedure) {
- echo
"<option value='" . $procedure->get_id() . "'>" . $procedure->get_title() .
"</option>";
- }
- ?>
- </select>
- </dd>
- </dl>
-
- <div class="form-buttons">
- <?php
- echo '<input type="submit"
name="save_control" value="' . lang('save') . '"/>';
- ?>
- </div>
-
- </form>
-
- </div>
- <div id="elements">
- <h3><?php echo lang('included_units') ?></h3>
- <?php
- $list_form = false;
- $list_id = 'included_units';
- //$url_add_on =
'&control_id='.$control->get_id();
- unset($extra_cols);
- //include('unit_list_partial.php');
-
- $editable = 'true';
-
- if ($editable) {
- echo '<h3>'.lang('all_locations').'</h3>';
- $list_form = true;
- $list_id = 'property_uilocations';
- //$url_add_on =
'&control_id='.$control->get_id();
- unset($extra_cols);
- $related = array('included_units');
-
include('property_location_partial.php');
- }
- ?>
- </div>
- </div>
-</div>
\ No newline at end of file
Copied: branches/Version-1_0-branch/controller/templates/base/control.xsl (from
rev 7718, trunk/controller/templates/base/control.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/control.xsl
2011-09-26 12:11:15 UTC (rev 7719)
@@ -0,0 +1,98 @@
+<xsl:template name="control" xmlns:php="http://php.net/xsl">
+
+<xsl:call-template name="yui_booking_i18n"/>
+<div class="identifier-header">
+<h1><img src="{img_go_home}" />
+ <xsl:value-of select="php:function('lang', 'Control')" />
+</h1>
+</div>
+
+<div class="yui-content">
+ <div id="details">
+ <form action="#" method="post">
+ <input type="hidden" name="id" value = "{value_id}" />
+
+ <dl class="proplist-col">
+ <dt>
+ <label>Kontrollområde</label>
+ </dt>
+ <dd>
+ <select id="control_area_id"
name="control_area_id">
+ <xsl:for-each
select="control_area_options/options">
+ <option value="{id}">
+ <xsl:if
test="selected != 0">
+
<xsl:attribute name="selected" value="selected" />
+ </xsl:if>
+ <xsl:value-of
disable-output-escaping="yes" select="title"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </dd>
+ <dt>
+ <label>Prosedyre</label>
+ </dt>
+ <dd>
+ <select id="procedure" name="procedure">
+ <xsl:for-each
select="procedure_options/options">
+ <option value="{id}">
+ <xsl:if
test="selected != 0">
+
<xsl:attribute name="selected" value="selected" />
+ </xsl:if>
+ <xsl:value-of
disable-output-escaping="yes" select="title"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </dd>
+ <dt>
+ <label for="title">Tittel</label>
+ </dt>
+ <dd>
+ <input type="text" name="title"
id="title" value="" />
+ </dd>
+ <dt>
+ <label
for="description">Beskrivelse</label>
+ </dt>
+ <dd>
+ <textarea cols="70" rows="5"
name="description" id="description" value=""></textarea>
+ </dd>
+ <dt>
+ <label
for="start_date">Startdato</label>
+ </dt>
+ <dd>
+ <xsl:value-of
disable-output-escaping="yes" select="start_date"/>
+ </dd>
+ <dt>
+ <label for="end_date">Sluttdato</label>
+ </dt>
+ <dd>
+ <xsl:value-of
disable-output-escaping="yes" select="end_date"/>
+ </dd>
+ <dt>
+ <label>Frekvenstype</label>
+ </dt>
+ <dd>
+ <select id="repeat_type"
name="repeat_type">
+ <option value="0">Ikke
angitt</option>
+ <option
value="1">Daglig</option>
+ <option
value="2">Ukentlig</option>
+ <option value="3">Månedlig pr
dato</option>
+ <option value="4">Månedlig pr
dag</option>
+ <option value="5">Årlig</option>
+ </select>
+ </dd>
+ <dt>
+ <label>Frekvens</label>
+ </dt>
+ <dd>
+ <input size="2" type="text"
name="repeat_interval" value="" />
+ </dd>
+ </dl>
+
+ <div class="form-buttons">
+ <xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'save')" /></xsl:variable>
+ <input type="submit" name="save_control"
value="{$lang_save}" title = "{$lang_save}" />
+ </div>
+ </form>
+ </div>
+</div>
+</xsl:template>
\ No newline at end of file
Copied: branches/Version-1_0-branch/controller/templates/base/control_group.xsl
(from rev 7718, trunk/controller/templates/base/control_group.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_group.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/control_group.xsl
2011-09-26 12:11:15 UTC (rev 7719)
@@ -0,0 +1,92 @@
+<!-- item -->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+
+<xsl:call-template name="yui_booking_i18n"/>
+<div class="identifier-header">
+<h1><img src="{img_go_home}" />
+ <xsl:value-of select="php:function('lang', 'Control_group')" />
+</h1>
+</div>
+
+<div class="yui-content">
+ <div id="details">
+ <form action="#" method="post">
+ <input type="hidden" name="id" value =
"{value_id}">
+ </input>
+ <dl class="proplist-col">
+ <dt>
+ <label
for="title">Tittel</label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <input type="text"
name="group_name" id="group_name" value="{control_group/group_name}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="control_group/group_name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label
for="control_area">Kontrollområde</label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <select
id="control_area" name="control_area">
+
<xsl:apply-templates select="control_area/options"/>
+ </select>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="control_group/control_area_id" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label
for="proecdure">Prosedyre</label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <select id="procedure"
name="procedure">
+
<xsl:apply-templates select="procedure/options"/>
+ </select>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="control_group/procedure_id" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ </dl>
+
+ <div class="form-buttons">
+ <xsl:choose>
+ <xsl:when test="editable">
+ <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')"
/></xsl:variable>
+ <input type="submit"
name="save_control_group" value="{$lang_save}" title = "{$lang_save}" />
+ <input type="submit"
name="cancel_control_group" value="{$lang_cancel}" title = "{$lang_cancel}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
+ <input type="submit"
name="edit_control_group" value="{$lang_edit}" title = "{$lang_edit}" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+
+ </form>
+
+ </div>
+ </div>
+</xsl:template>
+
+<xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected" />
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes" select="name"/>
+ </option>
+</xsl:template>
+
Copied:
branches/Version-1_0-branch/controller/templates/base/control_groups.xsl (from
rev 7718, trunk/controller/templates/base/control_groups.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
2011-09-26 12:11:15 UTC (rev 7719)
@@ -0,0 +1,31 @@
+<xsl:template name="control_groups" xmlns:php="http://php.net/xsl">
+
+<xsl:call-template name="yui_booking_i18n"/>
+<div class="identifier-header">
+
+<h1><img src="{img_go_home}" />
+ <xsl:value-of select="php:function('lang', 'Control_groups')"/> for
<xsl:value-of select="group_name" />
+</h1>
+
+</div>
+
+<div class="yui-content">
+ <div id="details">
+
+ <h1><xsl:value-of select="title"/></h1>
+
+ <form action="#" method="post">
+ <ul>
+ <xsl:for-each select="//control_groups">
+ <xsl:variable name="control_group_id"><xsl:value-of
select="id"/></xsl:variable>
+ <li><input type="checkbox" name="control_group_ids[]"
value="{$control_group_id}" /><xsl:value-of select="group_name"/></li>
+ </xsl:for-each>
+ </ul>
+ <div class="form-buttons">
+ <xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'save')" /></xsl:variable>
+ <input type="submit" name="save_control_groups"
value="{$lang_save}" title = "{$lang_save}" />
+ </div>
+ </form>
+ </div>
+</div>
+</xsl:template>
\ No newline at end of file
Deleted: branches/Version-1_0-branch/controller/templates/base/control_item.php
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_item.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/templates/base/control_item.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -1,74 +0,0 @@
-<?php
- //include common logic for all templates
- include("common.php");
-?>
-
-<div class="identifier-header">
-<h1><img src="<?php echo RENTAL_TEMPLATE_PATH
?>images/32x32/actions/go-home.png" /> <?php echo lang('Control_item') ?></h1>
-</div>
-
-<div class="yui-content">
- <div id="details">
- <form action="#" method="post">
- <input type="hidden" name="id" value="<?php
if(!empty($control)){ echo $control->get_id(); } else { echo '0'; } ?>"/>
- <dl class="proplist-col">
- <dt>
- <label
for="title">Tittel</label>
- </dt>
- <dd>
- <input type="text" name="title"
id="title" value="" />
- </dd>
- <dt>
- <label
for="required">Obligatorisk</label>
- </dt>
- <dd>
- <input type="checkbox" value=""
/>
- </dd>
- <dt>
- <label for="what_to_do">Hva
skal utføres</label>
- </dt>
- <dd>
- <textarea id="what_to_do"
rows="5" cols="60"></textarea>
- </dd>
- <dt>
- <label
for="how_to_do">Utførelsesbeskrivelse</label>
- </dt>
- <dd>
- <textarea id="how_to_do"
rows="5" cols="60"></textarea>
- </dd>
- <dt>
- <label
for="control_group">Kontrollgruppe</label>
- </dt>
- <dd>
- <select id="control_group"
name="control_group">
- <?php
- foreach
($control_group_array as $control_group) {
- echo
"<option value='" . $control_group->get_id() . "'>" .
$control_group->get_group_name() . "</option>";
- }
- ?>
- </select>
- </dd>
- <dt>
- <label
for="control_area">Kontrollområde</label>
- </dt>
- <dd>
- <select id="control_area"
name="control_area">
- <?php
- foreach
($control_area_array as $control_area) {
- echo
"<option value='" . $control_area->get_id() . "'>" . $control_area->get_title()
. "</option>";
- }
- ?>
- </select>
- </dd>
- </dl>
-
- <div class="form-buttons">
- <?php
- echo '<input type="submit"
name="save_control" value="' . lang('save') . '"/>';
- ?>
- </div>
-
- </form>
-
- </div>
-</div>
Modified: branches/Version-1_0-branch/controller/templates/base/control_item.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_item.xsl
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/templates/base/control_item.xsl
2011-09-26 12:11:15 UTC (rev 7719)
@@ -19,48 +19,114 @@
<label
for="title">Tittel</label>
</dt>
<dd>
- <input type="text" name="title"
id="title" value="" />
+ <xsl:choose>
+ <xsl:when test="editable">
+ <input type="text"
name="title" id="title" value="{control_item/title}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="control_item/title"/>
+ </xsl:otherwise>
+ </xsl:choose>
</dd>
<dt>
<label
for="required">Obligatorisk</label>
</dt>
<dd>
- <input type="checkbox" value=""
/>
+ <xsl:variable
name="required_item"><xsl:value-of select="control_item/required"
/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <xsl:choose>
+ <xsl:when
test="$required_item=1">
+ <input
type="checkbox" name="required" id="required" checked="true"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="required" id="required"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="$required_item=1">
+ <input
type="checkbox" name="required" id="required" checked="true" disabled="true"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="required" id="required" disabled="true" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
</dd>
<dt>
<label for="what_to_do">Hva
skal utføres</label>
</dt>
<dd>
- <textarea id="what_to_do"
rows="5" cols="60"></textarea>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <textarea
name="what_to_do" id="what_to_do" rows="5" cols="60"><xsl:value-of
select="control_item/what_to_do" disable-output-escaping="yes" /></textarea>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="control_item/what_to_do" disable-output-escaping="yes" />
+ </xsl:otherwise>
+ </xsl:choose>
</dd>
<dt>
<label
for="how_to_do">Utførelsesbeskrivelse</label>
</dt>
<dd>
- <textarea id="how_to_do"
rows="5" cols="60"></textarea>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <textarea
name="how_to_do" id="how_to_do" rows="5" cols="60"><xsl:value-of
select="control_item/how_to_do" disable-output-escaping="yes" /></textarea>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="control_item/how_to_do" disable-output-escaping="yes" />
+ </xsl:otherwise>
+ </xsl:choose>
</dd>
<dt>
<label
for="control_group">Kontrollgruppe</label>
</dt>
<dd>
- <select id="control_group"
name="control_group">
- <xsl:apply-templates
select="control_group/options"/>
- </select>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <select
id="control_group" name="control_group">
+
<xsl:apply-templates select="control_group/options"/>
+ </select>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="control_item/control_group_id" />
+ </xsl:otherwise>
+ </xsl:choose>
</dd>
<dt>
- <label
for="control_area">Kontrolltype</label>
+ <label
for="control_area">Kontrollområde</label>
</dt>
<dd>
- <select id="control_area"
name="control_area">
- <xsl:apply-templates
select="control_area/options"/>
- </select>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <select
id="control_area" name="control_area">
+
<xsl:apply-templates select="control_area/options"/>
+ </select>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="control_item/control_area_id" />
+ </xsl:otherwise>
+ </xsl:choose>
</dd>
</dl>
<div class="form-buttons">
- <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
- <input type="submit"
name="save_control" value="{$lang_save}" title = "{$lang_save}">
- </input>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')"
/></xsl:variable>
+ <input type="submit"
name="save_control_item" value="{$lang_save}" title = "{$lang_save}" />
+ <input type="submit"
name="cancel_control_item" value="{$lang_cancel}" title = "{$lang_cancel}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
+ <input type="submit"
name="edit_control_item" value="{$lang_edit}" title = "{$lang_edit}" />
+ </xsl:otherwise>
+ </xsl:choose>
</div>
</form>
Deleted:
branches/Version-1_0-branch/controller/templates/base/control_item_list.php
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_item_list.php
2011-09-26 12:08:19 UTC (rev 7718)
+++ branches/Version-1_0-branch/controller/templates/base/control_item_list.php
2011-09-26 12:11:15 UTC (rev 7719)
@@ -1,102 +0,0 @@
-<?php
- include("common.php");
-?>
-
-<script type="text/javascript">
- //Add listener resetting form: redirects browser to call index again
- YAHOO.util.Event.addListener(
- 'ctrl_reset_button',
- 'click',
- function(e)
- {
- YAHOO.util.Event.stopEvent(e);
- window.location = 'index.php?menuaction=rental.uiparty.index';
- }
- );
-
- var formatBoolean = function(elCell, oRecord, oColumn, oData) {
- if (oData != undefined && oData != 0) {
- if(oData == true){
- elCell.innerHTML = "<?php echo lang('yes')?>";
- }
- }else{
- elCell.innerHTML = "<?php echo lang('no')?>";
- }
- }
-
- // Defining columns for datatable
- var columnDefs = [
- {
- key: "id",
- label: "<?php echo lang('control_item_id') ?>",
- sortable: false
- },
- {
- key: "title",
- label: "<?php echo lang('title') ?>",
- sortable: true
- },
- {
- key: "required",
- label: "<?php echo lang('required') ?>",
- sortable: true
- },
- {
- key: "what_to_do",
- label: "<?php echo lang('what_to_do') ?>",
- sortable: true
- },
- {
- key: "how_to_do",
- label: "<?php echo lang('how_to_do') ?>"
- },
- {
- key: "control_group_id",
- label: "control_group_id"
- },
- {
- key: "control_area_id",
- label: "control_area_id"
- },
- {
- key: "ajax",
- hidden: true
- },
- {
- key: "labels",
- hidden: true
- },
- {
- key: "actions",
- hidden: true
- }];
-
- // Initiating the data source
- setDataSource(
-
'index.php?menuaction=controller.uicontrol_item.query&phpgw_return_as=json<?php
echo $url_add_on; ?>&editable=<?php echo $editable ? "true" : "false"; ?>',
- columnDefs,
- '',
- [],
- '<?php echo $list_id ?>_container',
- '<?php echo $list_id ?>_paginator',
- '<?php echo $list_id ?>',
- new Array(<?php
- if(isset($related)){
- $tot_related = count($related);
- $count_related = 0;
- foreach($related as $r){
- $count_related++;
- echo "\"".$r."\"";
- if($count_related <
$tot_related){
- echo ",";
- }
- }
- }
- ?>),
- '<?php echo $editor_action ?>',
- true
- );
-</script>
-
-<div id="<?php echo $list_id ?>_paginator" class="paginator"></div>
-<div id="<?php echo $list_id ?>_container" class="datatable_container"></div>
Copied: branches/Version-1_0-branch/controller/templates/base/control_items.xsl
(from rev 7718, trunk/controller/templates/base/control_items.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_items.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/control_items.xsl
2011-09-26 12:11:15 UTC (rev 7719)
@@ -0,0 +1,31 @@
+<xsl:template name="control_items" xmlns:php="http://php.net/xsl">
+
+<xsl:call-template name="yui_booking_i18n"/>
+<div class="identifier-header">
+<h1><img src="{img_go_home}" />
+ <xsl:value-of select="php:function('lang', 'Control_items')" />
+</h1>
+</div>
+
+<div class="yui-content">
+ <div id="details">
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7719] Merge 7657:7718 from trunk,
Sigurd Nes <=