[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7625] Merge 7592:7623 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7625] Merge 7592:7623 from trunk |
Date: |
Fri, 16 Sep 2011 08:27:39 +0000 |
Revision: 7625
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7625
Author: sigurdne
Date: 2011-09-16 08:27:39 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------
Merge 7592:7623 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php
branches/Version-1_0-branch/controller/inc/class.menu.inc.php
branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.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.procedure.inc.php
branches/Version-1_0-branch/controller/setup/phpgw_no.lang
branches/Version-1_0-branch/controller/setup/setup.inc.php
branches/Version-1_0-branch/controller/setup/tables_current.inc.php
branches/Version-1_0-branch/controller/templates/base/control_item.php
branches/Version-1_0-branch/phpgwapi/inc/class.log.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.xslttemplates.inc.php
branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
Added Paths:
-----------
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.uicontrol_item2.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_type.inc.php
branches/Version-1_0-branch/controller/js/yahoo/
branches/Version-1_0-branch/controller/templates/base/app_data.xsl
branches/Version-1_0-branch/controller/templates/base/control_item.xsl
branches/Version-1_0-branch/controller/templates/base/control_item_list.php
branches/Version-1_0-branch/controller/templates/base/datatable.xsl
branches/Version-1_0-branch/controller/templates/base/procedure.php
branches/Version-1_0-branch/controller/templates/base/procedure_item.xsl
branches/Version-1_0-branch/controller/templates/base/procedure_list.php
branches/Version-1_0-branch/controller/templates/base/procedure_list_partial.php
branches/Version-1_0-branch/controller/templates/base/yui_booking_i18n.xsl
Removed Paths:
-------------
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.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
+
/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-7623
Modified:
branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
2011-09-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -362,7 +362,7 @@
{
//$subject = lang('mail_subject_update', $avtivity->get_id() .
'-' . $activity->get_title(), $activity->get_link());
$subject = lang('mail_subject_update');
- $link_text =
"http://www.bergen.kommune.no/portico/aktivitycalendarfrontend/?menuaction=activitycalendarfrontend.uiactivity.edit&id={$activity->get_id()}&secret={$activity->get_secret()}";
+ $link_text =
"http://www.bergen.kommune.no/portico/activitycalendarfrontend/?menuaction=activitycalendarfrontend.uiactivity.edit&id={$activity->get_id()}&secret={$activity->get_secret()}";
$body = lang('mail_body_update', $activity->get_id() . ', ' .
$activity->get_title(), $link_text);
}
else
Modified:
branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php
2011-09-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -341,7 +341,7 @@
$contact2['mail'] =
$contact_mail_2;
$contact2['org_id'] =
$this->decode($activity_org);
$soactivity->add_contact_person_org($contact2);
-/*
+
//group-stuff:
if($activity_group)
{
@@ -369,9 +369,9 @@
$activity_persons =
activitycalendar_sogroup::get_instance()->get_contacts($new_group_id);
}
else
- {*/
+ {
$activity_persons =
activitycalendar_soorganization::get_instance()->get_contacts($activity_org);
- /*}*/
+ }
/*
foreach($activity_persons as
$pers)
{
@@ -400,7 +400,7 @@
*/
//$activity_persons =
activitycalendar_soorganization::get_instance()->get_contacts($activity_org);
}
-/* else //add org unit
+ else //add org unit
{
$org_info = array();
$org_info['name'] =
$org_name_tmp; //new
@@ -465,9 +465,9 @@
{
$activity_persons =
activitycalendar_soorganization::get_instance()->get_contacts($new_org_id);
}
- }*/
+ }
}
-/* else //add org unit without org no
+ else //add org unit without org no
{
$org_info = array();
if($activity_group && !$activity_group
== '')
@@ -535,8 +535,8 @@
$activity_persons =
activitycalendar_soorganization::get_instance()->get_contacts($new_org_id);
}
}
- */
+
$activity_adapted = $this->decode($data[4]);
$activity_target = $this->decode($data[7]);
//var_dump($activity_target);
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-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -25,13 +25,42 @@
(
'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_item' => array
(
'text' => lang('Control_item'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicontrol_item.index') ),
- 'image' => array('property',
'location_1'),
+ 'image' => array('property', 'location_1'),
+ 'children' => array(
+
'control_item_list' => array
+ (
+ 'text'
=> lang('control_item_list'),
+ 'url'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_item.display_control_items', 'appname' => 'controller') ),
+ 'image'
=> array('rental', 'x-office-spreadsheet')
+ )
+ )
+ ),
+ 'control_item2' => array
+ (
+ 'text' => lang('Control_item') . 2,
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicontrol_item2.index') ),
+ 'image' => array('property', 'location_1'),
+ 'children' => array(
+
'control_item_list2' => array
+
+ (
+ 'text'
=> lang('control_item_list') . 2,
+ 'url'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_item2.display_control_items', 'appname' => 'controller')
),
+ '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'),
)
);
Modified: branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
2011-09-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -137,7 +137,7 @@
* array, never null. The array keys are the respective index numbers.
*/
public function get(int $start_index, int $num_of_objects, string
$sort_field, boolean $ascending, string $search_for, string $search_type, array
$filters)
- {
+ {
$results = array(); // Array to store
result objects
$map = array(); // Array to hold number
of records per target object
$check_map = array(); // Array to hold the actual
number of record read per target object
@@ -178,7 +178,6 @@
$start_index = 0;
}
-
// test-input for break on ordered queries
$db2 = clone($this->db);
@@ -190,6 +189,7 @@
{
$should_populate_object = false; // Default value - we
won't populate object
$result_id =
$this->unmarshal($this->db->f($id_field_name), 'int'); // The id of object
+
if(in_array($result_id, $added_object_ids)) // Object
with this id already added
{
$should_populate_object = true; // We should
populate this object as we already have it in our result array
@@ -248,6 +248,7 @@
}
}
}
+
return $results;
}
Copied: branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
(from rev 7623, trunk/controller/inc/class.socontrol_area.inc.php)
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
(rev 0)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_area.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,176 @@
+<?php
+phpgw::import_class('controller.socommon');
+
+include_class('controller', 'control_area', 'inc/model/');
+
+class controller_socontrol_area extends controller_socommon
+{
+ protected static $so;
+
+ /**
+ * Get a static reference to the storage object associated with this
model object
+ *
+ * @return controller_soparty the storage object
+ */
+ public static function get_instance()
+ {
+ if (self::$so == null) {
+ self::$so = CreateObject('controller.socontrol_area');
+ }
+ return self::$so;
+ }
+
+ /**
+ * Function for adding a new activity to the database. Updates the
activity object.
+ *
+ * @param activitycalendar_activity $activity the party to be added
+ * @return bool true if successful, false otherwise
+ */
+ function add(&$control_area)
+ {
+
+ $control_area = $control_area->get_control_area();
+
+ $sql = "INSERT INTO controller_control_area (type_name) VALUES
('$title')";
+ $result = $this->db->query($sql, __LINE__,__FILE__);
+
+ if(isset($result)) {
+ // Set the new party ID
+
$control_area->set_id($this->db->get_last_insert_id('controller_control_area',
'id'));
+ // Forward this request to the update method
+ return $this->update($control_area);
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+
+ /**
+ * Update the database values for an existing activity object.
+ *
+ * @param $activity the activity to be updated
+ * @return boolean true if successful, false otherwise
+ */
+
+ function update($control_area)
+ {
+ $id = intval($control_area->get_id());
+
+ $values = array(
+ '$type_name = ' .
$this->marshal($control_area->get_type_name(), 'string')
+ );
+
+ //var_dump('UPDATE activity_activity SET ' . join(',', $values)
. " WHERE id=$id");
+ $result = $this->db->query('UPDATE controller_control_area SET
' . join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+
+ return isset($result);
+ }
+
+ /**
+ * Get single procedure
+ *
+ * @param $id id of the procedure to return
+ * @return a controller_procedure
+ */
+ function get_single($id)
+ {
+ $id = (int)$id;
+
+ $sql = "SELECT p.* FROM controller_control_area p WHERE p.id =
" . $id;
+ $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+ $this->db->next_record();
+
+ $control_area = new
controller_control_area($this->unmarshal($this->db->f('id', true), 'int'));
+
$control_area->set_type_name($this->unmarshal($this->db->f('type_name', true),
'string'));
+
+ return $control_area;
+ }
+
+ /**
+ * Get a list of procedure objects matching the specific filters
+ *
+ * @param $start search result offset
+ * @param $results number of results to return
+ * @param $sort field to sort by
+ * @param $query LIKE-based query string
+ * @param $filters array of custom filters
+ * @return list of rental_composite objects
+ */
+ function get_control_area_array($start = 0, $results = 1000, $sort =
null, $dir = '', $query = null, $search_option = null, $filters = array())
+ {
+ $results = array();
+
+ //$condition = $this->get_conditions($query,
$filters,$search_option);
+ $order = $sort ? "ORDER BY $sort $dir ": '';
+
+ //$sql = "SELECT * FROM controller_procedure WHERE $condition
$order";
+ $sql = "SELECT * FROM controller_control_area $order";
+ $this->db->limit_query($sql, $start, __LINE__, __FILE__,
$limit);
+
+ while ($this->db->next_record()) {
+ $control_area = new
controller_control_area($this->unmarshal($this->db->f('id', true), 'int'));
+
$control_area->set_title($this->unmarshal($this->db->f('title', true),
'string'));
+
+ $results[] = $control_area;
+ }
+
+ return $results;
+ }
+
+ function get_id_field_name($extended_info = false)
+ {
+ /*
+ if(!$extended_info)
+ {
+ $ret = 'id';
+ }
+ else
+ {
+ $ret = array
+ (
+ 'table' => 'activity', // alias
+ 'field' => 'id',
+ 'translated' => 'id'
+ );
+ }
+ */
+ return $ret;
+ }
+
+ protected function get_query(string $sort_field, boolean $ascending,
string $search_for, string $search_type, array $filters, boolean $return_count)
+ {
+
+
+ }
+
+ function populate(int $control_area_id, &$control_area)
+ {
+ /*
+ if($control_area == null) {
+ $control_area = new activitycalendar_activity((int)
$activity_id);
+
+
$control_area->set_title($this->unmarshal($this->db->f('title'), 'string'));
+
$control_area->set_organization_id($this->unmarshal($this->db->f('organization_id'),
'int'));
+
$control_area->set_type_id($this->unmarshal($this->db->f('type_id'), 'int'));
+
$control_area->set_district($this->unmarshal($this->db->f('district'), 'int'));
+
$control_area->set_office($this->unmarshal($this->db->f('office'), 'int'));
+
$control_area->set_category($this->unmarshal($this->db->f('category'), 'int'));
+
$control_area->set_state($this->unmarshal($this->db->f('state'), 'int'));
+
$control_area->set_target($this->unmarshal($this->db->f('target'), 'string'));
+
$control_area->set_description($this->unmarshal($this->db->f('description'),
'string'));
+
$control_area->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
+
$control_area->set_internal_arena($this->unmarshal($this->db->f('internal_arena'),
'string'));
+
$control_area->set_time($this->unmarshal($this->db->f('time'), 'string'));
+
$control_area->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
'int'));
+
$control_area->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
'bool')));
+
$control_area->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
+
+
+ }
+ */
+ return $control_area;
+ }
+
+}
Deleted:
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-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -1,176 +0,0 @@
-<?php
-phpgw::import_class('controller.socommon');
-
-include_class('controller', 'control_group', 'inc/model/');
-
-class controller_socontrol_group extends controller_socommon
-{
- protected static $so;
-
- /**
- * Get a static reference to the storage object associated with this
model object
- *
- * @return controller_soparty the storage object
- */
- public static function get_instance()
- {
- if (self::$so == null) {
- self::$so = CreateObject('controller.socontrol_group');
- }
- return self::$so;
- }
-
- /**
- * Function for adding a new activity to the database. Updates the
activity object.
- *
- * @param activitycalendar_activity $activity the party to be added
- * @return bool true if successful, false otherwise
- */
- function add(&$control_group)
- {
-
- $control_group = $control_group->get_control_group();
-
- $sql = "INSERT INTO controller_control_group (group_name)
VALUES ('$title')";
- $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);
- }
- else
- {
- return false;
- }
-
- }
-
- /**
- * Update the database values for an existing activity object.
- *
- * @param $activity the activity to be updated
- * @return boolean true if successful, false otherwise
- */
-
- function update($control_group)
- {
- $id = intval($control_group->get_id());
-
- $values = array(
- '$group_name = ' .
$this->marshal($control_group->get_group_name(), 'string')
- );
-
- //var_dump('UPDATE activity_activity SET ' . join(',', $values)
. " WHERE id=$id");
- $result = $this->db->query('UPDATE controller_control_group SET
' . join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
-
- return isset($result);
- }
-
- /**
- * Get single procedure
- *
- * @param $id id of the procedure to return
- * @return a controller_procedure
- */
- function get_single($id)
- {
- $id = (int)$id;
-
- $sql = "SELECT p.* FROM controller_control_group p WHERE p.id =
" . $id;
- $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
- $this->db->next_record();
-
- $control_group = new
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
-
$control_group->set_group_name($this->unmarshal($this->db->f('group_name',
true), 'string'));
-
- return $control_group;
- }
-
- /**
- * Get a list of procedure objects matching the specific filters
- *
- * @param $start search result offset
- * @param $results number of results to return
- * @param $sort field to sort by
- * @param $query LIKE-based query string
- * @param $filters array of custom filters
- * @return list of rental_composite objects
- */
- function get_control_group_array($start = 0, $results = 1000, $sort =
null, $dir = '', $query = null, $search_option = null, $filters = array())
- {
- $results = array();
-
- //$condition = $this->get_conditions($query,
$filters,$search_option);
- $order = $sort ? "ORDER BY $sort $dir ": '';
-
- //$sql = "SELECT * FROM controller_procedure WHERE $condition
$order";
- $sql = "SELECT * FROM controller_control_group $order";
- $this->db->limit_query($sql, $start, __LINE__, __FILE__,
$limit);
-
- while ($this->db->next_record()) {
- $control_group = new
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
-
$control_group->set_group_name($this->unmarshal($this->db->f('group_name',
true), 'string'));
-
- $results[] = $control_group;
- }
-
- return $results;
- }
-
- function get_id_field_name($extended_info = false)
- {
- /*
- if(!$extended_info)
- {
- $ret = 'id';
- }
- else
- {
- $ret = array
- (
- 'table' => 'activity', // alias
- 'field' => 'id',
- 'translated' => 'id'
- );
- }
- */
- return $ret;
- }
-
- protected function get_query(string $sort_field, boolean $ascending,
string $search_for, string $search_type, array $filters, boolean $return_count)
- {
-
-
- }
-
- function populate(int $control_group_id, &$control_group)
- {
- /*
- if($control_group == null) {
- $control_group = new activitycalendar_activity((int)
$activity_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'));
-
-
- }
- */
- return $control_group;
- }
-
-}
Copied:
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php (from
rev 7623, trunk/controller/inc/class.socontrol_group.inc.php)
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
(rev 0)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,176 @@
+<?php
+phpgw::import_class('controller.socommon');
+
+include_class('controller', 'control_group', 'inc/model/');
+
+class controller_socontrol_group extends controller_socommon
+{
+ protected static $so;
+
+ /**
+ * Get a static reference to the storage object associated with this
model object
+ *
+ * @return controller_soparty the storage object
+ */
+ public static function get_instance()
+ {
+ if (self::$so == null) {
+ self::$so = CreateObject('controller.socontrol_group');
+ }
+ return self::$so;
+ }
+
+ /**
+ * Function for adding a new activity to the database. Updates the
activity object.
+ *
+ * @param activitycalendar_activity $activity the party to be added
+ * @return bool true if successful, false otherwise
+ */
+ function add(&$control_group)
+ {
+
+ $control_group = $control_group->get_control_group();
+
+ $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);
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+
+ /**
+ * Update the database values for an existing activity object.
+ *
+ * @param $activity the activity to be updated
+ * @return boolean true if successful, false otherwise
+ */
+
+ function update($control_group)
+ {
+ $id = intval($control_group->get_id());
+
+ $values = array(
+ '$group_name = ' .
$this->marshal($control_group->get_group_name(), 'string')
+ );
+
+ //var_dump('UPDATE activity_activity SET ' . join(',', $values)
. " WHERE id=$id");
+ $result = $this->db->query('UPDATE controller_control_group SET
' . join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+
+ return isset($result);
+ }
+
+ /**
+ * Get single procedure
+ *
+ * @param $id id of the procedure to return
+ * @return a controller_procedure
+ */
+ function get_single($id)
+ {
+ $id = (int)$id;
+
+ $sql = "SELECT p.* FROM controller_control_group p WHERE p.id =
" . $id;
+ $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+ $this->db->next_record();
+
+ $control_group = new
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
+
$control_group->set_group_name($this->unmarshal($this->db->f('group_name',
true), 'string'));
+
+ return $control_group;
+ }
+
+ /**
+ * Get a list of procedure objects matching the specific filters
+ *
+ * @param $start search result offset
+ * @param $results number of results to return
+ * @param $sort field to sort by
+ * @param $query LIKE-based query string
+ * @param $filters array of custom filters
+ * @return list of rental_composite objects
+ */
+ function get_control_group_array($start = 0, $results = 1000, $sort =
null, $dir = '', $query = null, $search_option = null, $filters = array())
+ {
+ $results = array();
+
+ //$condition = $this->get_conditions($query,
$filters,$search_option);
+ $order = $sort ? "ORDER BY $sort $dir ": '';
+
+ //$sql = "SELECT * FROM controller_procedure WHERE $condition
$order";
+ $sql = "SELECT * FROM controller_control_group $order";
+ $this->db->limit_query($sql, $start, __LINE__, __FILE__,
$limit);
+
+ while ($this->db->next_record()) {
+ $control_group = new
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
+
$control_group->set_group_name($this->unmarshal($this->db->f('group_name',
true), 'string'));
+
+ $results[] = $control_group;
+ }
+
+ return $results;
+ }
+
+ function get_id_field_name($extended_info = false)
+ {
+ /*
+ if(!$extended_info)
+ {
+ $ret = 'id';
+ }
+ else
+ {
+ $ret = array
+ (
+ 'table' => 'activity', // alias
+ 'field' => 'id',
+ 'translated' => 'id'
+ );
+ }
+ */
+ return $ret;
+ }
+
+ protected function get_query(string $sort_field, boolean $ascending,
string $search_for, string $search_type, array $filters, boolean $return_count)
+ {
+
+
+ }
+
+ function populate(int $control_group_id, &$control_group)
+ {
+ /*
+ if($control_group == null) {
+ $control_group = new activitycalendar_activity((int)
$activity_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'));
+
+
+ }
+ */
+ 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-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -122,10 +122,10 @@
$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_desc($this->unmarshal($this->db->f('what_to_desc',
true), 'string'));
-
$control_item->set_how_to_desc($this->unmarshal($this->db->f('how_to_desc',
true), 'string'));
+
$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_type_id($this->unmarshal($this->db->f('control_type_id',
true), 'int'));
+
$control_item->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'int'));
$results[] = $control_item;
}
@@ -135,7 +135,6 @@
function get_id_field_name($extended_info = false)
{
- /*
if(!$extended_info)
{
$ret = 'id';
@@ -144,46 +143,118 @@
{
$ret = array
(
- 'table' => 'activity', // alias
+ 'table' => 'controller', //
alias
'field' => 'id',
'translated' => 'id'
);
}
- */
+
return $ret;
}
protected function get_query(string $sort_field, boolean $ascending,
string $search_for, string $search_type, array $filters, boolean $return_count)
{
+ $clauses = array('1=1');
+ $filter_clauses = array();
+
+ // Search for based on search type
+ if($search_for)
+ {
+ $search_for = $this->marshal($search_for,'field');
+ $like_pattern = "'%".$search_for."%'";
+ $like_clauses = array();
+ switch($search_type){
+ case "title":
+ $like_clauses[] =
"rental_document.title $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))
+ {
+ $clauses[] = '(' . join(' OR ', $like_clauses)
. ')';
+ }
+ }
+
+ if(isset($filters[$this->get_id_field_name()]))
+ {
+ $filter_clauses[] = "rental_document.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);
+ }
+
+
+ $condition = join(' AND ', $clauses);
+
+ $tables = "controller_control_item";
+ $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';
+ }
+ else
+ {
+ $cols = 'id, title, required,
controller_control_item.what_to_do_desc as what_to_do,
controller_control_item.how_to_do_desc as how_to_do, control_group_id,
control_area_id';
+ }
+
+ $dir = $ascending ? 'ASC' : 'DESC';
+ if($sort_field == 'title')
+ {
+ $sort_field = 'rental_document.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}";
}
function populate(int $control_item_id, &$control_item)
{
- /*
+
if($control_item == null) {
- $control_item = new activitycalendar_activity((int)
$activity_id);
+ $control_item = new controller_control_item((int)
$control_item_id);
-
$control_item->set_title($this->unmarshal($this->db->f('title'), 'string'));
-
$control_item->set_organization_id($this->unmarshal($this->db->f('organization_id'),
'int'));
-
$control_item->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
-
$control_item->set_district($this->unmarshal($this->db->f('district'), 'int'));
-
$control_item->set_office($this->unmarshal($this->db->f('office'), 'int'));
-
$control_item->set_category($this->unmarshal($this->db->f('category'), 'int'));
-
$control_item->set_state($this->unmarshal($this->db->f('state'), 'int'));
-
$control_item->set_target($this->unmarshal($this->db->f('target'), 'string'));
-
$control_item->set_description($this->unmarshal($this->db->f('description'),
'string'));
-
$control_item->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
-
$control_item->set_internal_arena($this->unmarshal($this->db->f('internal_arena'),
'string'));
-
$control_item->set_time($this->unmarshal($this->db->f('time'), 'string'));
-
$control_item->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
'int'));
-
$control_item->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
'bool')));
-
$control_item->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
-
-
+
$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'));
}
- */
+
return $control_item;
}
Modified: branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
2011-09-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -28,21 +28,33 @@
*/
function add(&$procedure)
{
+ $cols = array(
+ 'title',
+ 'purpose',
+ 'responsibility',
+ 'description',
+ 'reference',
+ 'attachment'
+ );
+
+ $values = array(
+ $this->marshal($procedure->get_title(), 'string'),
+ $this->marshal($procedure->get_purpose(), 'string'),
+ $this->marshal($procedure->get_responsibility(),
'string'),
+ $this->marshal($procedure->get_description(), 'string'),
+ $this->marshal($procedure->get_reference(), 'string'),
+ $this->marshal($procedure->get_attachment(), 'string')
+ );
- $title = $procedure->get_title();
+ $result = $this->db->query('INSERT INTO controller_procedure ('
. join(',', $cols) . ') VALUES (' . join(',', $values) . ')',
__LINE__,__FILE__);
- $sql = "INSERT INTO controller_procedure (title) VALUES
('$title')";
- $result = $this->db->query($sql, __LINE__,__FILE__);
-
if(isset($result)) {
- // Set the new party ID
-
$procedure->set_id($this->db->get_last_insert_id('controller_procedure', 'id'));
- // Forward this request to the update method
- return $this->update($procedure);
+ // Get the new procedure ID and return it
+ return
$this->db->get_last_insert_id('controller_procedure', 'id');
}
else
{
- return false;
+ return 0;
}
}
@@ -59,14 +71,13 @@
$id = intval($procedure->get_id());
$values = array(
- '$purpose = ' .
$this->marshal($procedure->get_purpose(), 'string'),
- 'responsibility = ' .
$this->marshal($procedure->get_responsibility(), 'int'),
- 'description = ' .
$this->marshal($procedure->get_description(), 'int'),
- 'reference = ' .
$this->marshal($procedure->get_reference(), 'int'),
- 'attachment = ' .
$this->marshal($procedure->get_attachment(), 'int')
+ 'purpose = ' .
$this->marshal($procedure->get_purpose(), 'string'),
+ 'responsibility = ' .
$this->marshal($procedure->get_responsibility(), 'string'),
+ 'description = ' .
$this->marshal($procedure->get_description(), 'string'),
+ 'reference = ' .
$this->marshal($procedure->get_reference(), 'string'),
+ 'attachment = ' .
$this->marshal($procedure->get_attachment(), 'string')
);
- //var_dump('UPDATE activity_activity SET ' . join(',', $values)
. " WHERE id=$id");
$result = $this->db->query('UPDATE controller_procedure SET ' .
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
return isset($result);
@@ -135,7 +146,7 @@
function get_id_field_name($extended_info = false)
{
- /*
+
if(!$extended_info)
{
$ret = 'id';
@@ -144,46 +155,170 @@
{
$ret = array
(
- 'table' => 'activity', // alias
+ 'table' => 'procedure', // 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_procedure
$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_procedure =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+ }
+
+ if(count($filter_clauses))
+ {
+ $clauses[] = join(' AND ', $filter_clauses);
+ }
+
+ $condition = join(' AND ', $clauses);
+
+ $tables = "controller_procedure";
+ //$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_procedure.id)) AS
count';
+ }
+ else
+ {
+ $cols .= "controller_procedure.id AS procedure_id,
controller_procedure.title, controller_procedure.purpose,
controller_procedure.respontibility, controller_procedure.description,
controller_procedure.reference, controller_procedure.attachment ";
+ }
+ $dir = $ascending ? 'ASC' : 'DESC';
+ $order = $sort_field ? "ORDER BY {$this->marshal($sort_field,
'field')} $dir ": '';
+
+ //var_dump("SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}");
+
+ return "SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}";
}
function populate(int $procedure_id, &$procedure)
{
- /*
+
if($procedure == null) {
- $procedure = new activitycalendar_activity((int)
$activity_id);
+ $procedure = new controller_procedure((int)
$procedure_id);
$procedure->set_title($this->unmarshal($this->db->f('title'), 'string'));
-
$procedure->set_organization_id($this->unmarshal($this->db->f('organization_id'),
'int'));
-
$procedure->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
-
$procedure->set_district($this->unmarshal($this->db->f('district'), 'int'));
-
$procedure->set_office($this->unmarshal($this->db->f('office'), 'int'));
-
$procedure->set_category($this->unmarshal($this->db->f('category'), 'int'));
-
$procedure->set_state($this->unmarshal($this->db->f('state'), 'int'));
-
$procedure->set_target($this->unmarshal($this->db->f('target'), 'string'));
+
$procedure->set_purpose($this->unmarshal($this->db->f('purpose'), 'string'));
+
$procedure->set_responsibility($this->unmarshal($this->db->f('responsibility'),
'string'));
$procedure->set_description($this->unmarshal($this->db->f('description'),
'string'));
-
$procedure->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
-
$procedure->set_internal_arena($this->unmarshal($this->db->f('internal_arena'),
'string'));
-
$procedure->set_time($this->unmarshal($this->db->f('time'), 'string'));
-
$procedure->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
'int'));
-
$procedure->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
'bool')));
-
$procedure->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
-
-
+
$procedure->set_reference($this->unmarshal($this->db->f('reference'),
'string'));
+
$procedure->set_attachment($this->unmarshal($this->db->f('attachment'),
'string'));
}
- */
+
return $procedure;
}
Modified: branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
2011-09-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -9,16 +9,23 @@
*
* @return array containg values from $array for the keys in $keys.
*/
-
-
- function extract_values($array, $keys)
+ function extract_values($array, $keys, $options = array())
{
+ static $default_options = array(
+ 'prefix' => '',
+ 'suffix' => '',
+ 'preserve_prefix' => false,
+ 'preserve_suffix' => false
+ );
+
+ $options = array_merge($default_options, $options);
+
$result = array();
- foreach($keys as $key)
+ foreach($keys as $write_key)
{
- if(in_array($key, array_keys($array)))
- {
- $result[$key] = $array[$key];
+ $array_key =
$options['prefix'].$write_key.$options['suffix'];
+ if(isset($array[$array_key])) {
+ $result[($options['preserve_prefix'] ?
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ?
$options['suffix'] : '')] = $array[$array_key];
}
}
return $result;
@@ -28,14 +35,74 @@
{
if(!isset($array[$key])) $array[$key] = $value;
}
-
- define('MANAGER','MANAGER');
- define('EXECUTIVE_OFFICER','EXECUTIVE_OFFICER');
- define('ADMINISTRATOR','ADMINISTRATOR');
-
+
+ /**
+ * Reformat an ISO timestamp into norwegian format
+ *
+ * @param string $date date
+ *
+ * @return string containg timestamp in norwegian format
+ */
+ function pretty_timestamp($date)
+ {
+ if (empty($date)) return "";
+
+ if(is_array($date) && is_object($date[0]) && $date[0]
instanceof DOMNode)
+ {
+ $date = $date[0]->nodeValue;
+ }
+ preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})(
([0-9]{2}):([0-9]{2}))?/', $date, $match);
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ if($match[4])
+ {
+ $dateformat .= ' H:i';
+ $timestamp = mktime($match[5], $match[6], 0, $match[2],
$match[3], $match[1]);
+ }
+ else
+ {
+ $timestamp = mktime(0, 0, 0, $match[2], $match[3],
$match[1]);
+ }
+ $text = date($dateformat,$timestamp);
+
+ return $text;
+ }
+
+ /**
+ * Generates a javascript translator object/hash for the specified
fields.
+ */
+ function js_lang()
+ {
+ $keys = func_get_args();
+ $strings = array();
+ foreach($keys as $key) { $strings[$key] = is_string($key) ?
lang($key) : call_user_func_array('lang', $key); }
+ return json_encode($strings);
+ }
+
+ /**
+ * Creates an array of translated strings.
+ */
+ function lang_array()
+ {
+ $keys = func_get_args();
+ foreach($keys as &$key) $key = lang($key);
+ return $keys;
+ }
+
abstract class controller_uicommon
{
- protected static $old_exception_handler;
+ const UI_SESSION_FLASH = 'flash_msgs';
+
+ protected
+ $filesArray;
+
+ protected static
+ $old_exception_handler;
+
+ private
+ $ui_session_key,
+ $flash_msgs;
+
const LOCATION_ROOT = '.';
const LOCATION_IN = '.RESPONSIBILITY.INTO';
@@ -46,11 +113,11 @@
public $type_of_user;
- public $flash_msgs;
+ // public $flash_msgs;
public function __construct()
{
- self::set_active_menu('activitycalendar');
+ self::set_active_menu('controller');
self::add_stylesheet('phpgwapi/js/yahoo/calendar/assets/skins/sam/calendar.css');
self::add_stylesheet('phpgwapi/js/yahoo/autocomplete/assets/skins/sam/autocomplete.css');
self::add_stylesheet('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
@@ -58,19 +125,22 @@
self::add_stylesheet('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
self::add_stylesheet('phpgwapi/js/yahoo/treeview/assets/skins/sam/treeview.css');
//self::add_stylesheet('controller/templates/base/css/base.css');
- self::add_javascript('controller', 'controller',
'common.js');
+ self::add_javascript('controller', 'yahoo',
'common.js');
$this->tmpl_search_path = array();
array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT .
'/phpgwapi/templates/base');
array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT .
'/phpgwapi/templates/' . $GLOBALS['phpgw_info']['server']['template_set']);
array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT .
'/' . $GLOBALS['phpgw_info']['flags']['currentapp'] . '/templates/base');
phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('history');
phpgwapi_yui::load_widget('paginator');
phpgwapi_yui::load_widget('menu');
phpgwapi_yui::load_widget('calendar');
phpgwapi_yui::load_widget('autocomplete');
phpgwapi_yui::load_widget('animation');
- $dateFormat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $this->url_prefix = str_replace('_', '.',
get_class($this));
+
+ $this->dateFormat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
$this->acl = & $GLOBALS['phpgw']->acl;
$this->locations = & $GLOBALS['phpgw']->locations;
@@ -82,8 +152,69 @@
);*/
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($GLOBALS['phpgw_info']['flags']['currentapp']);
}
+
+ private function get_ui_session_key() {
+ return $this->ui_session_key;
+ }
+ private function restore_flash_msgs() {
+ if (($flash_msgs =
$this->session_get(self::UI_SESSION_FLASH))) {
+ if (is_array($flash_msgs)) {
+ $this->flash_msgs = $flash_msgs;
+
$this->session_set(self::UI_SESSION_FLASH, array());
+ return true;
+ }
+ }
+
+ $this->flash_msgs = array();
+ return false;
+ }
+
+ private function store_flash_msgs() {
+ return $this->session_set(self::UI_SESSION_FLASH,
$this->flash_msgs);
+ }
+
+ private function reset_flash_msgs() {
+ $this->flash_msgs = array();
+ $this->store_flash_msgs();
+ }
+
+ private function session_set($key, $data) {
+ return
phpgwapi_cache::session_set($this->get_ui_session_key(), $key, $data);
+ }
+
+ private function session_get($key) {
+ return
phpgwapi_cache::session_get($this->get_ui_session_key(), $key);
+ }
+
/**
+ * Provides a private session cache setter per ui class.
+ */
+ protected function ui_session_set($key, $data) {
+ return $this->session_set(get_class($this).'_'.$key,
$data);
+ }
+
+ /**
+ * Provides a private session cache getter per ui class .
+ */
+ protected function ui_session_get($key) {
+ return $this->session_get(get_class($this).'_'.$key);
+ }
+
+ protected function generate_secret($length = 10)
+ {
+ return
substr(base64_encode(rand(1000000000,9999999999)),0, $length);
+ }
+
+ public function add_js_event($event, $js) {
+ $GLOBALS['phpgw']->js->add_event($event, $js);
+ }
+
+ public function add_js_load_event($js) {
+ $this->add_js_event('load', $js);
+ }
+
+ /**
* Permission check. Proxy method for method check in
phpgwapi->acl
*
* @param $location
@@ -226,6 +357,68 @@
$GLOBALS['phpgw']->common->phpgw_exit();
}
+ public function add_yui_translation(&$data)
+ {
+ $this->add_template_file('yui_booking_i18n');
+ $previous = lang('prev');
+ $next = lang('next');
+
+ $data['yui_booking_i18n'] = array(
+ 'Calendar' => array(
+ 'WEEKDAYS_SHORT' =>
json_encode(lang_array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa')),
+ 'WEEKDAYS_FULL' =>
json_encode(lang_array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday')),
+ 'MONTHS_LONG' =>
json_encode(lang_array('January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December')),
+ ),
+ 'DataTable' => array(
+ 'MSG_EMPTY' => json_encode(lang('No
records found.')),
+ 'MSG_LOADING' =>
json_encode(lang("Loading...")),
+ 'MSG_SORTASC' =>
json_encode(lang('Click to sort ascending')),
+ 'MSG_SORTDESC' =>
json_encode(lang('Click to sort descending')),
+ ),
+ 'setupDatePickerHelper' => array(
+ 'LBL_CHOOSE_DATE' =>
json_encode(lang('Choose a date')),
+ ),
+ 'setupPaginator' => array(
+ 'pageReportTemplate' =>
json_encode(lang("Showing items {startRecord} - {endRecord} of
{totalRecords}")),
+ 'previousPageLinkLabel' =>
json_encode("< {$previous}"),
+ 'nextPageLinkLabel' =>
json_encode("{$next} >"),
+ ),
+ 'common' => array(
+ 'LBL_NAME' => json_encode(lang('Name')),
+ 'LBL_TIME' => json_encode(lang('Time')),
+ 'LBL_WEEK' => json_encode(lang('Week')),
+ 'LBL_RESOURCE' =>
json_encode(lang('Resource')),
+ ),
+ );
+ }
+
+
+ public function add_template_helpers() {
+ $this->add_template_file('helpers');
+ }
+
+ public function render_template_xsl($files, $data)
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+
+ if($this->flash_msgs) {
+ $data['msgbox_data'] =
$GLOBALS['phpgw']->common->msgbox($this->flash_msgs);
+ } else {
+ $this->add_template_file('msgbox');
+ }
+
+ $this->reset_flash_msgs();
+
+ $this->add_yui_translation($data);
+ $data['webserver_url'] =
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+ $output = phpgw::get_var('output', 'string', 'REQUEST',
'html');
+ $GLOBALS['phpgw']->xslttpl->set_output($output);
+ $this->add_template_file($files);
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('data' => $data));
+ }
+
+
public function check_active($url)
{
if($_SERVER['REQUEST_METHOD'] == 'POST')
@@ -236,19 +429,46 @@
}
}
- /**
- * Build a YUI result of the data
- *
- * @param $data the data
- * @return YUI result { ResultSet => { totalRecords => ?,
Result => ?}
- */
- public function yui_results($data,$field_total =
'total_records', $field_results = 'results')
+ // Add link key to a result array
+ public function _add_links(&$value, $key, $menuaction)
{
- return array
- (
+ $unset = 0;
+ // FIXME: Fugly workaround
+ // I cannot figure out why this variable isn't set, but
it is needed
+ // by the ->link() method, otherwise we wind up in the
phpgroupware
+ // errorhandler which does lot of weird things and
breaks the output
+ if
(!isset($GLOBALS['phpgw_info']['server']['webserver_url'])) {
+
$GLOBALS['phpgw_info']['server']['webserver_url'] = "/";
+ $unset = 1;
+ }
+
+ $value['link'] = self::link(array('menuaction' =>
$menuaction, 'id' => $value['id']));
+
+ // FIXME: Fugly workaround
+ // I kid you not my friend. There is something very
wonky going on
+ // in phpgroupware which I cannot figure out.
+ // If this variable isn't unset() (if it wasn't set
before that is)
+ // then it will contain extra slashes and break URLs
+ if ($unset) {
+
unset($GLOBALS['phpgw_info']['server']['webserver_url']);
+ }
+ }
+
+ // Build a YUI result style array
+ public function yui_results($results)
+ {
+ if (!$results) {
+ $results['total_records'] = 0;
+ $result['results'] = array();
+ }
+
+ return array(
'ResultSet' => array(
- 'totalRecords' => $data[$field_total],
- 'Result' => $data[$field_results]
+ 'totalResultsAvailable' =>
$results['total_records'],
+ 'startIndex' => $results['start'],
+ 'sortKey' => $results['sort'],
+ 'sortDir' => $results['dir'],
+ 'Result' => $results['results']
)
);
}
@@ -479,12 +699,5 @@
public function __sleep()
{
return array('table_name', 'fields');
- }
-
- protected function generate_secret($length = 10)
- {
- return
substr(base64_encode(rand(1000000000,9999999999)),0, $length);
- }
-
+ }
}
-?>
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-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -4,18 +4,24 @@
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', 'inc/model/');
-
+
class controller_uicontrol_item extends controller_uicommon
{
private $bo;
private $so;
- private $so_proc;
+ private $so_proc;
+ private $so_control_item;
+ private $so_control_group;
+ private $so_control_area;
public $public_functions = array
(
- 'index' => true
+ 'index' => true,
+ 'query' => true,
+ 'display_control_items' => true
);
public function __construct()
@@ -25,64 +31,146 @@
$this->so = CreateObject('controller.socontrol');
$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);
}
public function index()
{
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control";
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control_item";
$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($_POST['save_control_item'])) // The user has
pressed the save button
{
- if(isset($control)) // Edit control
+ if(isset($control_item)) // 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 );
+
$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);
+ $this->so->add($control_item);
}
else // Add new control
{
- $control = new controller_control();
+ $control_item = 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 );
+
$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);
+ $this->so->add($control_item);
}
}
- $control_item_array =
$this->so_control_item->get_control_item_array();
+ $control_area_array =
$this->so_control_area->get_control_area_array();
$control_group_array =
$this->so_control_group->get_control_group_array();
$this->render('control_item.php', array
(
'editable' => true,
- 'control_item_array' =>
$control_item_array,
+ 'control_area_array' =>
$control_area_array,
'control_group_array' =>
$control_group_array
)
);
}
+
+ public function display_control_items()
+ {
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control_item_list";
+
+ $this->render('control_item_list.php');
+ }
+
public function query()
{
- var_dump("Er i uicontrol");
-
+
+ $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);
+ }
+
+ /*
+ //Retrieve the type of query and perform type specific
logic
+ $type = phpgw::get_var('type');
+ switch($type)
+ {
+ case 'included_price_items':
+ if(isset($contract))
+ {
+ $filters = array('contract_id'
=> $contract->get_id());
+ $result_objects =
rental_socontract_price_item::get_instance()->get($start_index,
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type,
$filters);
+ $object_count =
rental_socontract_price_item::get_instance()->get_count($search_for,
$search_type, $filters);
+ }
+ break;
+ case 'not_included_price_items': // We want to
show price items in the source list even after they've been added to a contract
+ $filters = array('price_item_status' =>
'active','responsibility_id' => phpgw::get_var('responsibility_id'));
+ $result_objects =
rental_soprice_item::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
+ $object_count =
rental_soprice_item::get_instance()->get_count($search_for, $search_type,
$filters);
+ break;
+ case 'manual_adjustment':
+ $filters = array('price_item_status' =>
'active','is_adjustable' => 'false');
+ $result_objects =
rental_soprice_item::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
+ $object_count =
rental_soprice_item::get_instance()->get_count($search_for, $search_type,
$filters);
+ break;
+ default:
+ //$filters = array('price_item_status'
=> 'active','responsibility_id' => phpgw::get_var('responsibility_id'));
+ $result_objects =
rental_soprice_item::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
+ $object_count =
rental_soprice_item::get_instance()->get_count($search_for, $search_type,
$filters);
+ break;
+ }
+ */
+
+ $result_objects =
controller_socontrol_item::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
+
+ // Create an empty row set
+ $rows = array();
+ foreach ($result_objects as $record) {
+ if(isset($record))
+ {
+ // ... add a serialized record
+ $rows[] = $record->serialize();
+ }
+ }
+ $data = array('results' => $rows, 'total_records' =>
$object_count);
+
+ $editable = phpgw::get_var('editable') == 'true' ? true
: false;
+
+ //Add action column to each row in result table
+ array_walk(
+ $data['results'],
+ array($this, 'add_actions'),
+ array(
+ $control_item_id,
+ $type,
+ $editable
+ )
+ );
+ return $this->yui_results($data, 'total_records',
'results');
}
- }
\ No newline at end of file
+}
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/inc/class.uicontrol_item2.inc.php (from
rev 7623, trunk/controller/inc/class.uicontrol_item2.inc.php)
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_item2.inc.php
(rev 0)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item2.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,365 @@
+<?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
+ );
+
+ 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 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);
+
+ 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");
+
+ return $this->yui_results($applications);
+ }
+
+
+ public function query()
+ {
+ var_dump("Er i uicontrol");
+
+ }
+ }
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-16 08:24:24 UTC (rev 7624)
+++
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -1,7 +1,7 @@
<?php
include_class('controller', 'model', 'inc/model/');
- class controller_check_item extends controller_model
+ class controller_control_group extends controller_model
{
public static $so;
@@ -26,12 +26,12 @@
public function get_id() { return $this->id; }
- public function set_control_group($control_group)
+ public function set_group_name($group_name)
{
- $this->control_group = $control_group;
+ $this->group_name = $group_name;
}
- public function get_control_group(){ return
$this->control_group; }
+ public function get_group_name(){ return $this->group_name; }
/**
* Get a static reference to the storage object associated with
this model object
@@ -41,7 +41,7 @@
public static function get_so()
{
if (self::$so == null) {
- self::$so =
CreateObject('controller_check_item');
+ self::$so =
CreateObject('controller.socontrol_group');
}
return self::$so;
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-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -8,10 +8,10 @@
protected $id;
protected $title;
protected $required;
- protected $what_to_desc;
- protected $how_to_desc;
+ protected $what_to_do;
+ protected $how_to_do;
protected $control_group_id;
- protected $control_type_id;
+ protected $control_area_id;
/**
* Constructor. Takes an optional ID. If a contract is
created from outside
@@ -45,19 +45,19 @@
public function get_required() { return $this->required; }
- public function set_what_to_desc($what_to_desc)
+ public function set_what_to_do($what_to_do)
{
- $this->what_to_desc = $what_to_desc;
+ $this->what_to_do = $what_to_do;
}
- public function get_what_to_desc() { return
$this->what_to_desc; }
+ public function get_what_to_do() { return $this->what_to_do; }
- public function set_how_to_desc($how_to_desc)
+ public function set_how_to_do($how_to_do)
{
- $this->how_to_desc = $how_to_desc;
+ $this->how_to_do = $how_to_do;
}
- public function get_how_to_desc() { return $this->how_to_desc; }
+ public function get_how_to_do() { return $this->how_to_do; }
public function set_control_group_id($control_group_id)
{
@@ -66,12 +66,12 @@
public function get_control_group_id() { return
$this->control_group_id; }
- public function set_control_type_id($control_type_id)
+ public function set_control_area_id($control_area_id)
{
- $this->control_type_id = $control_type_id;
+ $this->control_area_id = $control_area_id;
}
- public function get_control_type_id() { return
$this->control_type_id; }
+ public function get_control_area_id() { return
$this->control_area_id; }
/**
@@ -82,10 +82,24 @@
public static function get_so()
{
if (self::$so == null) {
- self::$so =
CreateObject('controller.sopurpose');
+ self::$so =
CreateObject('controller.socontrol_item');
}
return self::$so;
}
+
+ public function serialize()
+ {
+ $result = array();
+ $result['id'] = $this->get_id();
+ $result['title'] = $this->get_title();
+ $result['required'] = $this->get_required();
+ $result['what_to_do'] = $this->get_what_to_do();
+ $result['how_to_do'] = $this->get_how_to_do();
+ $result['control_group_id'] =
$this->get_control_group_id();
+ $result['control_area_id'] =
$this->get_control_area_id();
+
+ return $result;
+ }
}
?>
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/inc/model/class.control_type.inc.php
(from rev 7623, trunk/controller/inc/model/class.control_type.inc.php)
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control_type.inc.php
(rev 0)
+++ branches/Version-1_0-branch/controller/inc/model/class.control_type.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,50 @@
+<?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.procedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php
2011-09-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -81,10 +81,38 @@
public static function get_so()
{
if (self::$so == null) {
- self::$so =
CreateObject('controller.sopurpose');
+ self::$so =
CreateObject('controller.soprocedure');
}
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;
+ }
}
?>
\ No newline at end of file
Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2011-09-16
08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2011-09-16
08:27:39 UTC (rev 7625)
@@ -628,4 +628,13 @@
your_notifications controller no Dine varsler
control_items controller no Kontrollpunkt
Control_item controller no Kontrollpunkt
-
+Procedure controller no Prosedyre
+Procedures controller no Prosedyrer
+Procedure title controller no Navn
+t_new_procedure controller no Ny prosedyre
+f_new_procedure controller no Legg til
+Procedure purpose controller no Formål
+Procedure responsibility controller no Ansvarlig
+Procedure description controller no Beskrivelse
+Procedure reference controller no Referanse
+Procedure attachment controller no Vedlegg
Modified: branches/Version-1_0-branch/controller/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/setup.inc.php 2011-09-16
08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php 2011-09-16
08:27:39 UTC (rev 7625)
@@ -41,6 +41,6 @@
'controller_check_item',
'controller_check_list',
'controller_procedure',
- 'controller_control_type'
+ 'controller_control_area'
);
?>
\ 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-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -11,7 +11,7 @@
'requirement_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'costResponsibility_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => True),
'responsibility_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
- 'control_type_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
+ 'control_area_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'equipment_type_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'equipment_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'location_code' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
@@ -40,10 +40,10 @@
'id' => array('type' => 'auto','precision' =>
4,'nullable' => False),
'title' => array('type' =>
'varchar','precision' => '100','nullable' => false),
'required' => array('type' => 'bool','nullable'
=> true,'default' => 'false'),
- 'what_to_do_desc' => array('type' =>
'varchar','precision' => '255','nullable' => false),
- 'how_to_do_desc' => array('type' =>
'varchar','precision' => '255','nullable' => false),
+ 'what_to_do' => array('type' =>
'varchar','precision' => '255','nullable' => false),
+ 'how_to_do' => array('type' =>
'varchar','precision' => '255','nullable' => false),
'control_group_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
- 'control_type_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True)
+ 'control_area_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True)
),
'pk' => array('id'),
'fk' => array(),
@@ -102,7 +102,7 @@
'ix' => array(),
'uc' => array()
),
- 'controller_control_type' => array(
+ 'controller_control_area' => array(
'fd' => array(
'id' => array('type' => 'auto','precision' =>
4,'nullable' => False),
'title' => array('type' => 'varchar',
'precision' => 255, 'nullable' => False)
Copied: branches/Version-1_0-branch/controller/templates/base/app_data.xsl
(from rev 7623, trunk/controller/templates/base/app_data.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/app_data.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/app_data.xsl
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,3 @@
+ <xsl:template name="dummy">
+ </xsl:template>
+
Modified: branches/Version-1_0-branch/controller/templates/base/control_item.php
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_item.php
2011-09-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/controller/templates/base/control_item.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -43,19 +43,19 @@
<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_title() . "</option>";
+ echo
"<option value='" . $control_group->get_id() . "'>" .
$control_group->get_group_name() . "</option>";
}
?>
</select>
</dd>
<dt>
- <label
for="control_type">Kontrolltype</label>
+ <label
for="control_area">Kontrolltype</label>
</dt>
<dd>
- <select id="control_type"
name="control_type">
+ <select id="control_area"
name="control_area">
<?php
- foreach
($control_type_array as $control_type) {
- echo
"<option value='" . $control_type->get_id() . "'>" . $control_type->get_title()
. "</option>";
+ foreach
($control_area_array as $control_area) {
+ echo
"<option value='" . $control_area->get_id() . "'>" . $control_area->get_title()
. "</option>";
}
?>
</select>
@@ -71,4 +71,4 @@
</form>
</div>
-</div>
\ No newline at end of file
+</div>
Copied: branches/Version-1_0-branch/controller/templates/base/control_item.xsl
(from rev 7623, trunk/controller/templates/base/control_item.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_item.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/control_item.xsl
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,80 @@
+<!-- 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_item')" />
+</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>
+ <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">
+ <xsl:apply-templates
select="control_group/options"/>
+ </select>
+ </dd>
+ <dt>
+ <label
for="control_area">Kontrolltype</label>
+ </dt>
+ <dd>
+ <select id="control_area"
name="control_area">
+ <xsl:apply-templates
select="control_area/options"/>
+ </select>
+ </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>
+ </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_item_list.php
(from rev 7623, trunk/controller/templates/base/control_item_list.php)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_item_list.php
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/control_item_list.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,102 @@
+<?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/datatable.xsl
(from rev 7623, trunk/controller/templates/base/datatable.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/datatable.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/datatable.xsl
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,239 @@
+<func:function name="phpgw:conditional">
+ <xsl:param name="test"/>
+ <xsl:param name="true"/>
+ <xsl:param name="false"/>
+
+ <func:result>
+ <xsl:choose>
+ <xsl:when test="$test">
+ <xsl:value-of select="$true"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$false"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </func:result>
+</func:function>
+
+<xsl:template match="data">
+ <iframe id="yui-history-iframe"
src="phpgwapi/js/yahoo/history/assets/blank.html"
style="position:absolute;top:0; left:0;width:1px;
height:1px;visibility:hidden;"></iframe>
+ <input id="yui-history-field" type="hidden"/>
+ <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:apply-templates select="form" />
+ <xsl:apply-templates select="paging"/>
+ <div id="list_flash">
+ <xsl:call-template name="msgbox"/>
+ </div>
+ <xsl:apply-templates select="datatable"/>
+ <xsl:apply-templates select="form/list_actions"/>
+</xsl:template>
+
+<xsl:template match="toolbar">
+ <div id="toolbar">
+ <table class='yui-skin-sam' border="0" cellspacing="0"
cellpadding="0" style="padding:0px; margin:0px;">
+ <tr>
+ <xsl:for-each select="item">
+ <xsl:variable name="filter_key"
select="concat('filter_', name)"/>
+ <xsl:variable name="filter_key_name"
select="concat(concat('filter_', name), '_name')"/>
+ <xsl:variable name="filter_key_id"
select="concat(concat('filter_', name), '_id')"/>
+
+ <xsl:choose>
+ <xsl:when test="type = 'date-picker'">
+ <td valign="top">
+ <div class="date-picker">
+ <input id="filter_{name}" name="filter_{name}"
type="text">
+ <xsl:attribute
name="value"><xsl:value-of select="../../../filters/*[local-name() =
$filter_key]"/></xsl:attribute>
+ </input>
+ </div>
+ </td>
+ </xsl:when>
+ <xsl:when test="type = 'autocomplete'">
+ <td valign="top" width="160px">
+ <div style="width:140px">
+ <input
id="filter_{name}_name" name="filter_{name}_name" type="text">
+ <xsl:attribute
name="value"><xsl:value-of select="../../../filters/*[local-name() =
$filter_key_name]"/></xsl:attribute>
+ </input>
+ <input
id="filter_{name}_id" name="filter_{name}_id" type="hidden">
+ <xsl:attribute
name="value"><xsl:value-of select="../../../filters/*[local-name() =
$filter_key_id]"/></xsl:attribute>
+ </input>
+ <div
id="filter_{name}_container"/>
+ </div>
+ <script type="text/javascript">
+
YAHOO.util.Event.onDOMReady(function() {
+ var name = "<xsl:value-of
select="name"/>";
+ var ui = "<xsl:value-of
select="ui"/>";
+
+ var itemSelectCallback
= false;
+ <xsl:if
test="onItemSelect">
+
itemSelectCallback = <xsl:value-of select="onItemSelect"/>;
+ </xsl:if>
+
+ var
onClearSelectionCallback = false;
+ <xsl:if
test="onClearSelection">
+
onClearSelectionCallback = <xsl:value-of select="onClearSelection"/>;
+ </xsl:if>
+
+ var requestGenerator =
false;
+ <xsl:if
test="requestGenerator">
+
requestGenerator = <xsl:value-of select="requestGenerator"/>;
+ </xsl:if>
+
+ <![CDATA[
+ var oAC =
YAHOO.portico.autocompleteHelper('index.php?menuaction=booking.ui'+ui+'.index&phpgw_return_as=json&',
+
'filter_'+name+'_name', 'filter_'+name+'_id', 'filter_'+name+'_container');
+
+ if (requestGenerator) {
+
oAC.generateRequest = requestGenerator;
+ }
+
+ if (itemSelectCallback)
{
+
oAC.itemSelectEvent.subscribe(itemSelectCallback);
+ }
+
+
YAHOO.util.Event.addBlurListener('filter_'+name+'_name', function() {
+ if
(YAHOO.util.Dom.get('filter_'+name+'_name').value == "") {
+
YAHOO.util.Dom.get('filter_'+name+'_id').value = "";
+ if
(onClearSelectionCallback) {
+
onClearSelectionCallback();
+ }
+ }
+ });
+
+
YAHOO.portico.addPreSerializeQueryFormListener(function(form) {
+ if
(YAHOO.util.Dom.get('filter_'+name+'_name').value == "") {
+
YAHOO.util.Dom.get('filter_'+name+'_id').value = "";
+ }
+ });
+ ]]>
+ });
+ </script>
+ </td>
+ </xsl:when>
+ <xsl:when test="type = 'filter'">
+ <td valign="top">
+ <xsl:variable name="name"><xsl:value-of
select="name"/></xsl:variable>
+ <select name="{$name}"
onMouseout="window.status='';return true;">
+ <xsl:for-each select="list">
+ <xsl:variable name="id"><xsl:value-of
select="id"/></xsl:variable>
+ <xsl:if test="id =
'NEW'">
+ <option value="{$id}"
selected="selected">
+
<xsl:value-of select="name"/>
+ </option>
+ </xsl:if>
+ <xsl:if test="id !=
'NEW'">
+ <option value="{$id}">
+
<xsl:value-of select="name"/>
+ </option>
+ </xsl:if>
+ </xsl:for-each>
+ </select>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td valign="top">
+ <input id="innertoolbar">
+ <xsl:attribute
name="type"><xsl:value-of select="phpgw:conditional(not(type), '',
type)"/></xsl:attribute>
+ <xsl:attribute
name="name"><xsl:value-of select="phpgw:conditional(not(name), '',
name)"/></xsl:attribute>
+ <xsl:attribute
name="onclick"><xsl:value-of select="phpgw:conditional(not(onClick), '',
onClick)"/></xsl:attribute>
+ <xsl:attribute
name="value"><xsl:value-of select="phpgw:conditional(not(value), '',
value)"/></xsl:attribute>
+ <xsl:attribute
name="href"><xsl:value-of select="phpgw:conditional(not(href), '',
href)"/></xsl:attribute>
+ </input>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </tr>
+ <xsl:if test="item/text and normalize-space(item/text)">
+ <thead style="background:none">
+ <tr>
+ <xsl:for-each select="item">
+ <td>
+ <xsl:if
test="name">
+ <label
style='margin:auto 0.25em'>
+
<xsl:attribute name="for"><xsl:value-of select="phpgw:conditional(not(name),
'', name)"/></xsl:attribute>
+
<xsl:value-of select="phpgw:conditional(not(text), '', text)"/>
+ </label>
+ </xsl:if>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </thead>
+ </xsl:if>
+ </table>
+ </div>
+</xsl:template>
+
+<xsl:template match="form/list_actions">
+ <form id="list_actions_form" method="POST">
+ <!-- Form action is set by javascript listener -->
+ <div id="list_actions" class='yui-skin-sam'>
+ <table cellpadding="0" cellspacing="0">
+ <tr>
+ <xsl:for-each select="item">
+ <td valign="top">
+ <input
id="innertoolbar">
+ <xsl:attribute
name="type"><xsl:value-of select="phpgw:conditional(not(type), '',
type)"/></xsl:attribute>
+ <xsl:attribute
name="name"><xsl:value-of select="phpgw:conditional(not(name), '',
name)"/></xsl:attribute>
+ <xsl:attribute
name="onclick"><xsl:value-of select="phpgw:conditional(not(onClick), '',
onClick)"/></xsl:attribute>
+ <xsl:attribute
name="value"><xsl:value-of select="phpgw:conditional(not(value), '',
value)"/></xsl:attribute>
+ <xsl:attribute
name="href"><xsl:value-of select="phpgw:conditional(not(href), '',
href)"/></xsl:attribute>
+ </input>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </table>
+ </div>
+ </form>
+</xsl:template>
+<xsl:template match="form">
+ <form id="queryForm">
+ <xsl:attribute name="method">
+ <xsl:value-of select="phpgw:conditional(not(method),
'GET', method)"/>
+ </xsl:attribute>
+
+ <xsl:attribute name="action">
+ <xsl:value-of select="phpgw:conditional(not(action),
'', action)"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="toolbar"/>
+ </form>
+</xsl:template>
+
+<xsl:template match="datatable">
+ <div id="paginator"/>
+ <div id="datatable-container"/>
+ <xsl:call-template name="datasource-definition" />
+</xsl:template>
+
+<xsl:template name="datasource-definition">
+ <script>
+ YAHOO.portico.setupDatasource = function() {
+ <xsl:if test="source">
+ YAHOO.portico.dataSourceUrl = '<xsl:value-of
select="source"/>';
+ YAHOO.portico.initialSortedBy = false;
+ YAHOO.portico.initialFilters = false;
+ <xsl:if test="sorted_by">
+ YAHOO.portico.initialSortedBy =
{key: '<xsl:value-of select="sorted_by/key"/>', dir: '<xsl:value-of
select="sorted_by/dir"/>'};
+ </xsl:if>
+ </xsl:if>
+
+ YAHOO.portico.columnDefs = [
+ <xsl:for-each select="//datatable/field">
+ {
+ key: "<xsl:value-of
select="key"/>",
+ <xsl:if test="label">
+ label: "<xsl:value-of
select="label"/>",
+ </xsl:if>
+ sortable: <xsl:value-of
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
+ <xsl:if test="hidden">
+ hidden: true,
+ </xsl:if>
+ <xsl:if test="formatter">
+ formatter: <xsl:value-of
select="formatter"/>,
+ </xsl:if>
+ className: "<xsl:value-of
select="className"/>"
+ }<xsl:value-of
select="phpgw:conditional(not(position() = last()), ',', '')"/>
+ </xsl:for-each>
+ ];
+ }
+ </script>
+</xsl:template>
Copied: branches/Version-1_0-branch/controller/templates/base/procedure.php
(from rev 7623, trunk/controller/templates/base/procedure.php)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/procedure.php
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/procedure.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,62 @@
+<?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('Procedure') ?></h1>
+</div>
+
+<div class="yui-content">
+ <div id="details">
+ <form action="#" method="post">
+ <input type="hidden" name="id" value="<?php
if(!empty($procedure)){ echo $procedure->get_id(); } else { echo '0'; } ?>"/>
+ <dl class="proplist-col">
+ <dt>
+ <label for="title"><?php echo
lang('Title') ?></label>
+ </dt>
+ <dd>
+ <input type="text" name="title"
id="title" value="" />
+ </dd>
+ <dt>
+ <label for="purpose"><?php echo
lang('Purpose') ?></label>
+ </dt>
+ <dd>
+ <textarea id="purpose" rows="5"
cols="60"></textarea>
+ </dd>
+ <dt>
+ <label
for="responsibility"><?php echo lang('Responsibility') ?></label>
+ </dt>
+ <dd>
+ <textarea id="responsibility"
rows="5" cols="60"></textarea>
+ </dd>
+ <dt>
+ <label for="description"><?php
echo lang('Description') ?></label>
+ </dt>
+ <dd>
+ <textarea id="description"
rows="5" cols="60"></textarea>
+ </dd>
+ <dt>
+ <label for="reference"><?php
echo lang('Reference')?></label>
+ </dt>
+ <dd>
+ <input type="text"
name="reference" id="reference" value="" />
+ </dd>
+ <dt>
+ <label for="attachment"><?php echo
lang('Attachment')?></label>
+ </dt>
+ <dd>
+ <input type="text"
name="attachment" id="attachment" value="" />
+ </dd>
+ </dl>
+
+ <div class="form-buttons">
+ <?php
+ echo '<input type="submit"
name="save_procedure" value="' . lang('save') . '"/>';
+ ?>
+ </div>
+
+ </form>
+
+ </div>
+</div>
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/templates/base/procedure_item.xsl (from
rev 7623, trunk/controller/templates/base/procedure_item.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/procedure_item.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/procedure_item.xsl
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,114 @@
+<!-- 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', 'Procedure')" />
+</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"><xsl:value-of select="php:function('lang','Procedure title')"
/></label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <input type="text"
name="title" id="title" value="{procedure/title}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="procedure/title" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label
for="purpose"><xsl:value-of select="php:function('lang','Procedure purpose')"
/></label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <textarea id="purpose"
name="purpose" rows="5" cols="60"><xsl:value-of select="procedure/purpose"
/></textarea>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="procedure/purpose" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label
for="responsibility"><xsl:value-of select="php:function('lang','Procedure
responsibility')" /></label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <textarea
id="responsibility" name="responsibility" rows="5" cols="60"><xsl:value-of
select="procedure/responsibility" /></textarea>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="procedure/responsibility" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label
for="description"><xsl:value-of select="php:function('lang','Procedure
description')" /></label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <textarea
id="description" name="description" rows="5" cols="60"><xsl:value-of
select="procedure/description" /></textarea>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="procedure/description" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label
for="reference"><xsl:value-of select="php:function('lang','Procedure
Reference')" /></label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <input type="text"
name="reference" id="reference" value="{procedure/reference}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="procedure/reference" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label for="attachment"><xsl:value-of
select="php:function('lang','Procedure Attachment')" /></label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <input type="text"
name="attachment" id="attachment" value="{procedure/attachment}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="procedure/attachment" />
+ </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>
+ <input type="submit"
name="save_procedure" value="{$lang_save}" title = "{$lang_save}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
+ <input type="submit"
name="edit_procedure" value="{$lang_edit}" title = "{$lang_edit}" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </form>
+
+ </div>
+ </div>
+</xsl:template>
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/templates/base/procedure_list.php (from
rev 7623, trunk/controller/templates/base/procedure_list.php)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/procedure_list.php
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/procedure_list.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,41 @@
+<?php
+ include("common.php");
+?>
+
+<script>
+
+ YAHOO.util.Event.addListener(
+ 'ctrl_add_controller_procedure',
+ 'click',
+ function(e)
+ {
+ YAHOO.util.Event.stopEvent(e);
+ window.location =
'index.php?menuaction=controller.uiprocedure.add';
+ }
+);
+</script>
+
+<h1><img src="<?php echo RENTAL_TEMPLATE_PATH ?>images/32x32/go-home.png" />
<?php echo lang('rc') ?></h1>
+
+
+<fieldset>
+ <!-- Create new precedure -->
+ <h3><?php echo lang('t_new_procedure') ?></h3>
+ <input type="submit" name="ctrl_add_controller_procedure"
id="ctrl_add_controller_procedure" value="<?php echo lang('f_new_procedure')
?>" />
+</fieldset>
+
+<?php
+/* TODO: Fix column selector:
+<fieldset>
+ <!-- Select table columns -->
+ <h3><?php echo lang('t_functions') ?></h3>
+ <input type="button" id="dt-options-link" name="dt-options-link"
value="<?php echo lang('f_select_columns') ?>" />
+</fieldset>
+*/
+?>
+<?php
+$list_form = true;
+$list_id = 'all_procedures';
+$url_add_on = '&type=all_procedures';
+include('procedure_list_partial.php');
+?>
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/templates/base/procedure_list_partial.php
(from rev 7623, trunk/controller/templates/base/procedure_list_partial.php)
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/procedure_list_partial.php
(rev 0)
+++
branches/Version-1_0-branch/controller/templates/base/procedure_list_partial.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,135 @@
+<?php
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+?>
+
+<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.uiprocedure.index';
+ }
+ );
+
+ // Defining columns for datatable
+ var columnDefs = [{
+ key: "id",
+ label: "<?php echo lang('procedure_id') ?>",
+ sortable: false,
+ hidden: true
+ },
+ {
+ key: "title",
+ label: "<?php echo lang('title') ?>",
+ sortable: true
+ },
+ {
+ key: "actions",
+ hidden: true
+ },
+ {
+ key: "labels",
+ hidden: true
+ },
+ {
+ key: "ajax",
+ hidden: true
+ }];
+
+ // Initiating the data source
+ setDataSource(
+
'index.php?menuaction=controller.uiprocedure.query&phpgw_return_as=json<?php
echo $url_add_on; ?>&editable=<?php echo isset($editable) && $editable ?
"true" : "false"; ?>',
+ columnDefs,
+ '<?php echo $list_id ?>_form',
+ ['<?php echo $list_id ?>_ctrl_search_query'],
+ '<?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 isset($editor_action) ? $editor_action : '' ?>'
+ );
+<!--
+ function composite_export(compType) {
+ var availabilityselect = document.getElementById('<?php echo $list_id
?>_ctrl_toggle_active_rental_composites');
+ var availabilityoption =
availabilityselect.options[availabilityselect.selectedIndex].value;
+
+ var furnished_select = document.getElementById('<?php echo $list_id
?>_ctrl_toggle_furnished_status_rental_composites');
+ var furnished_status_id =
furnished_select.options[furnished_select.selectedIndex].value;
+
+ var query = document.getElementById('<?php echo $list_id
?>_ctrl_search_query').value;
+
+ var sSelect = document.getElementById('<?php echo $list_id
?>_ctrl_search_option');
+ var sOption = sSelect.options[sSelect.selectedIndex].value;
+
+ window.location = 'index.php?menuaction=rental.uicomposite.download'+
+ '<?php echo $url_add_on ?>'+
+ '&furnished_status='+furnished_status_id+
+ '&is_active='+availabilityoption+
+ '&type='+compType+
+ '&query='+query+
+ '&search_option='+sOption+
+ '&export=true';
+ }
+-->
+</script>
+
+<?php
+ if($list_form)
+ {
+?>
+<form id="<?php echo $list_id ?>_form" method="GET">
+<?php
+ $populate = phpgw::get_var('populate_form');
+ //Avoid Notices
+ $q = false;
+ $s_type = false;
+ $status = false;
+ $status_contract = false;
+ if(isset($populate))
+ {
+ $q = phpgwapi_cache::session_get('controller',
'procedure_query');
+ $s_type = phpgwapi_cache::session_get('controller',
'procedure_search_type');
+ $status = phpgwapi_cache::session_get('controller',
'procedure_status');
+ }
+?>
+ <fieldset>
+ <!-- Search -->
+ <h3><?php echo lang('search_options') ?></h3>
+ <label for="ctrl_search_query"><?php echo lang('search_for')
?></label>
+ <input id="<?php echo $list_id ?>_ctrl_search_query"
type="text" name="query" autocomplete="off" value="<?php echo isset($q) ? $q :
''?>"/>
+ <input type="submit" id="ctrl_search_button" value="<?php echo
lang('search') ?>" />
+ <input type="button" id="ctrl_reset_button" value="<?php echo
lang('reset') ?>" />
+ </fieldset>
+</form>
+<?php
+ } // end if($list_form)
+?>
+<fieldset>
+ <h3><?php echo lang('export_to') ?></h3>
+ <?php
+ $export_format =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['export_format'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['export_format']
? $GLOBALS['phpgw_info']['user']['preferences']['property']['export_format'] :
'csv';
+ ?>
+ <div id="export">
+ <a href="javascript:composite_export('<?php echo $list_id ?>')"
title="<?php echo lang('Download as %1', $export_format) ?>"><img src="<?php
echo RENTAL_TEMPLATE_PATH
?>images/16x16/mimetypes/x-office-spreadsheet.png"/></a>
+ </div>
+</fieldset>
+
+<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/yui_booking_i18n.xsl
(from rev 7623, trunk/controller/templates/base/yui_booking_i18n.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/yui_booking_i18n.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/yui_booking_i18n.xsl
2011-09-16 08:27:39 UTC (rev 7625)
@@ -0,0 +1,16 @@
+ <xsl:template name="yui_booking_i18n" xmlns:php="http://php.net/xsl">
+ <xsl:if test="yui_booking_i18n">
+ <script type="text/javascript">
+ YAHOO.portico.i18n = {};
+ <xsl:for-each select="yui_booking_i18n/*">
+ YAHOO.portico.i18n.<xsl:value-of
select="local-name()"/> = function(cfg)
+ {
+ cfg = cfg || {};
+ <xsl:for-each select="./*">
+ cfg["<xsl:value-of
select="local-name()"/>"] = <xsl:value-of disable-output-escaping="yes"
select="."/>;
+ </xsl:for-each>
+ };
+ </xsl:for-each>
+ </script>
+ </xsl:if>
+ </xsl:template>
Modified: branches/Version-1_0-branch/phpgwapi/inc/class.log.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.log.inc.php 2011-09-16
08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.log.inc.php 2011-09-16
08:27:39 UTC (rev 7625)
@@ -279,15 +279,18 @@
}
}
- echo '<h1>' . lang('Fatal Error') . "</h1>\n"
+
+ $message = '<h1>' . lang('Fatal Error') .
"</h1>\n"
. "<h2>{$msg}</h2>\n"
. '<p>' . lang('file') . ': ' .
$err->fname . "<br>\n"
. lang('line') . ': ' . $err->line .
"</p>\n"
. $trace;
+ phpgwapi_cache::message_set($message, 'error');
+
if ( isset($GLOBALS['phpgw']->common) &&
is_object($GLOBALS['phpgw']->common) )
{
-
$GLOBALS['phpgw']->common->phpgw_exit(True);
+
$GLOBALS['phpgw']->common->phpgw_exit(true);
}
}
}
Modified: branches/Version-1_0-branch/phpgwapi/inc/class.xslttemplates.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.xslttemplates.inc.php
2011-09-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.xslttemplates.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -395,12 +395,28 @@
if (!$html || $html == '<?xml version="1.0"?>')
{
+ $message ='Systemfeil - kontakt adminstrator';
+
+
if(isset($GLOBALS['phpgw_info']['user']['apps']['admin']) &&
$GLOBALS['phpgw_info']['user']['apps']['admin'])
+ {
+ phpgwapi_cache::message_set($message,
'error');
+ }
+ else
+ {
+ $message .= '<br>' .
$_SERVER['SERVER_ADDR'] . $_SERVER['SCRIPT_NAME'];
+ $message .=
isset($_REQUEST['menuaction']) ? "?menuaction={$_REQUEST['menuaction']}" : '';
+ echo '<div class="error">';
+ echo $message;
+ echo '</div>';
+ }
+/*
_debug_array(libxml_get_last_error());
echo "<h2>xml-data</h2>";
$this->list_lineno($this->xmldata, true);
echo "<h2>xsl-data</h2>";
$this->list_lineno($this->xsldata);
+*/
return '';
}
return preg_replace('/<!DOCTYPE([^>])+>/', '', $html);
Modified: branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
2011-09-16 08:24:24 UTC (rev 7624)
+++ branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
2011-09-16 08:27:39 UTC (rev 7625)
@@ -221,8 +221,8 @@
$cols .= "{$entity_table}.location_code";
$cols_return[] =
'location_code';
$cols_group[] =
"{$entity_table}.location_code";
+ $cols_group[] =
'fm_location1.loc1_name';
-
$cols .= ",{$entity_table}.id as request_id";
$cols_return[] = 'request_id';
$uicols['input_type'][] = 'text';
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7625] Merge 7592:7623 from trunk,
Sigurd Nes <=