[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7192] added model-files
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [7192] added model-files |
Date: |
Thu, 07 Apr 2011 06:23:50 +0000 |
Revision: 7192
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7192
Author: erikhl
Date: 2011-04-07 06:23:49 +0000 (Thu, 07 Apr 2011)
Log Message:
-----------
added model-files
added functionality for activitycalendar, arena and organization
Modified Paths:
--------------
trunk/activitycalendar/inc/class.soorganization.inc.php
trunk/activitycalendar/inc/class.uiactivities.inc.php
trunk/activitycalendar/inc/class.uiarena.inc.php
trunk/activitycalendar/inc/class.uicommon.inc.php
trunk/activitycalendar/setup/setup.inc.php
trunk/activitycalendar/setup/tables_current.inc.php
trunk/activitycalendar/templates/base/organization_list.php
trunk/activitycalendar/templates/base/organization_list_partial.php
Added Paths:
-----------
trunk/activitycalendar/inc/class.menu.inc.php
trunk/activitycalendar/inc/class.soactivity.inc.php
trunk/activitycalendar/inc/class.soarena.inc.php
trunk/activitycalendar/inc/class.uiorganization.inc.php
trunk/activitycalendar/inc/model/
trunk/activitycalendar/inc/model/class.activity.inc.php
trunk/activitycalendar/inc/model/class.arena.inc.php
trunk/activitycalendar/inc/model/class.model.inc.php
trunk/activitycalendar/inc/model/class.organization.inc.php
trunk/activitycalendar/templates/base/activity.php
trunk/activitycalendar/templates/base/activity_list.php
trunk/activitycalendar/templates/base/activity_list_partial.php
trunk/activitycalendar/templates/base/arena.php
trunk/activitycalendar/templates/base/arena_list.php
trunk/activitycalendar/templates/base/arena_list_partial.php
Removed Paths:
-------------
trunk/activitycalendar/inc/class.uiorganizationlist.inc.php
trunk/activitycalendar/templates/base/activities.php
trunk/activitycalendar/templates/base/arena.php
Added: trunk/activitycalendar/inc/class.menu.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.menu.inc.php
(rev 0)
+++ trunk/activitycalendar/inc/class.menu.inc.php 2011-04-07 06:23:49 UTC
(rev 7192)
@@ -0,0 +1,53 @@
+<?php
+ class activitycalendar_menu
+ {
+ function get_menu()
+ {
+ $incoming_app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'activitycalendar';
+ $menus = array();
+
+ $menus['navbar'] = array
+ (
+ 'activitycalendar' => array
+ (
+ 'text' => lang('Activitycalendar'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'activitycalendar.uiactivities.index') ),
+ 'image' => array('property', 'location'),
+ 'order' => 10,
+ 'group' => 'office'
+ )
+ );
+
+ $menus['navigation'] = array
+ (
+ 'activities' => array
+ (
+ 'text' => lang('Activities'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'activitycalendar.uiactivities.index') ),
+ 'image' => array('property', 'location_tenant'),
+ 'children' => array
+ (
+ 'arena' => array
+ (
+ 'text' =>
lang('Arena'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'activitycalendar.uiarena.index') ),
+ 'image' => array('property',
'location_1'),
+ ),
+ 'organizationList' => array
+ (
+ 'text' =>
lang('OrganizationList'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'activitycalendar.uiorganization.index') ),
+ 'image' => array('property',
'location_tenant'),
+ )
+ )
+ )
+ );
+
+ $menus['folders'] =
phpgwapi_menu::get_categories('bergen');
+
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
$incoming_app;
+
+ return $menus;
+ }
+ }
Added: trunk/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soactivity.inc.php
(rev 0)
+++ trunk/activitycalendar/inc/class.soactivity.inc.php 2011-04-07 06:23:49 UTC
(rev 7192)
@@ -0,0 +1,237 @@
+<?php
+phpgw::import_class('activitycalendar.socommon');
+
+include_class('activitycalendar', 'activity', 'inc/model/');
+
+class activitycalendar_soactivity extends activitycalendar_socommon
+{
+ protected static $so;
+
+ /**
+ * Get a static reference to the storage object associated with this
model object
+ *
+ * @return rental_soparty the storage object
+ */
+ public static function get_instance()
+ {
+ if (self::$so == null) {
+ self::$so = CreateObject('activitycalendar.soactivity');
+ }
+ return self::$so;
+ }
+
+ /**
+ * Generate SQL query
+ *
+ * @todo Add support for filter "party_type", meaning what type of
contracts
+ * the party is involved in.
+ *
+ * @param string $sort_field
+ * @param boolean $ascending
+ * @param string $search_for
+ * @param string $search_type
+ * @param array $filters
+ * @param boolean $return_count
+ * @return string SQL
+ */
+ protected function get_query(string $sort_field, boolean $ascending,
string $search_for, string $search_type, array $filters, boolean $return_count)
+ {
+ $clauses = array('1=1');
+
+ //Add columns to this array to include them in the query
+ $columns = array();
+
+ if($sort_field != null) {
+ $dir = $ascending ? 'ASC' : 'DESC';
+ $order = "ORDER BY id $dir";
+ }
+ if($search_for)
+ {
+ $query = $this->marshal($search_for,'string');
+ $like_pattern = "'%".$search_for."%'";
+ $like_clauses = array();
+ switch($search_type){
+ case "name":
+ $like_clauses[] = "party.first_name
$this->like $like_pattern";
+ $like_clauses[] = "party.last_name
$this->like $like_pattern";
+ $like_clauses[] = "party.company_name
$this->like $like_pattern";
+ break;
+ case "address":
+ $like_clauses[] = "party.address_1
$this->like $like_pattern";
+ $like_clauses[] = "party.address_2
$this->like $like_pattern";
+ $like_clauses[] = "party.postal_code
$this->like $like_pattern";
+ $like_clauses[] = "party.place
$this->like $like_pattern";
+ break;
+ case "identifier":
+ $like_clauses[] = "party.identifier
$this->like $like_pattern";
+ break;
+ case "reskontro":
+ $like_clauses[] = "party.reskontro
$this->like $like_pattern";
+ break;
+ case "result_unit_number":
+ $like_clauses[] =
"party.result_unit_number $this->like $like_pattern";
+ break;
+ case "all":
+ $like_clauses[] = "party.first_name
$this->like $like_pattern";
+ $like_clauses[] = "party.last_name
$this->like $like_pattern";
+ $like_clauses[] = "party.company_name
$this->like $like_pattern";
+ $like_clauses[] = "party.address_1
$this->like $like_pattern";
+ $like_clauses[] = "party.address_2
$this->like $like_pattern";
+ $like_clauses[] = "party.postal_code
$this->like $like_pattern";
+ $like_clauses[] = "party.place
$this->like $like_pattern";
+ $like_clauses[] = "party.identifier
$this->like $like_pattern";
+ $like_clauses[] = "party.comment
$this->like $like_pattern";
+ $like_clauses[] = "party.reskontro
$this->like $like_pattern";
+ break;
+ }
+
+
+ if(count($like_clauses))
+ {
+ $clauses[] = '(' . join(' OR ', $like_clauses)
. ')';
+ }
+ }
+
+ $filter_clauses = array();
+/*
+ // All parties with contracts of type X
+ if(isset($filters['party_type']))
+ {
+ $party_type =
$this->marshal($filters['party_type'],'int');
+ if(isset($party_type) && $party_type > 0)
+ {
+ $filter_clauses[] = "contract.location_id =
{$party_type}";
+ }
+ }
+*/
+
+ if(count($filter_clauses))
+ {
+ $clauses[] = join(' AND ', $filter_clauses);
+ }
+
+ $condition = join(' AND ', $clauses);
+
+ if($return_count) // We should only return a count
+ {
+ $cols = 'COUNT(DISTINCT(activity.id)) AS count';
+ }
+ else
+ {
+ $columns[] = 'activity.id';
+ $columns[] = 'activity.organization_id';
+ $columns[] = 'activity.group_id';
+ $columns[] = 'activity.district';
+ $columns[] = 'activity.category';
+ $columns[] = 'activity.description';
+ $columns[] = 'activity.arena';
+ $columns[] = 'activity.date_start';
+ $columns[] = 'activity.date_end';
+ $columns[] = 'activity.contact_person_1';
+ $columns[] = 'activity.contact_person_2';
+
+ $cols = implode(',',$columns);
+ }
+
+ $tables = "activity_activity activity";
+
+ //$join_contracts = " {$this->left_join}
rental_contract_party c_p ON (c_p.party_id = party.id)
+ //{$this->left_join} rental_contract contract ON (contract.id =
c_p.contract_id)";
+
+ //var_dump("SELECT {$cols} FROM {$tables} WHERE {$condition}
{$order}");
+ return "SELECT {$cols} FROM {$tables} WHERE {$condition}
{$order}";
+ }
+
+
+
+ /**
+ * 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(&$activity)
+ {
+ // Insert a new activity
+ $q ="INSERT INTO activity_activity (organization_id) VALUES
(1)";
+ $result = $this->db->query($q);
+
+ if(isset($result)) {
+ // Set the new party ID
+
$activity->set_id($this->db->get_last_insert_id('activity_activity', 'id'));
+ // Forward this request to the update method
+ return $this->update($activity);
+ }
+ 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($activity)
+ {
+ $id = intval($activity->get_id());
+
+ $values = array(
+ 'organization_id = '.
$this->marshal($activity->get_organization_id(), 'string'),
+ 'group_id = ' .
$this->marshal($activity->get_group_id(), 'string'),
+ 'district = ' .
$this->marshal($activity->get_district(), 'string'),
+ 'category = ' .
$this->marshal($activity->get_category(), 'string'),
+ 'target = ' . $this->marshal($activity->get_target(),
'string'),
+ 'description = ' .
$this->marshal($activity->get_description(), 'string'),
+ 'arena = ' .
$this->marshal($activity->get_arena(), 'string'),
+ 'date_start = ' .
$this->marshal($activity->get_date_start(), 'string'),
+ 'date_end = ' .
$this->marshal($activity->get_date_end(), 'string'),
+ 'contact_person_1 = ' .
$this->marshal($activity->get_contact_person_1(), 'string'),
+ 'contact_person_2 = ' .
$this->marshal($activity->get_contact_person_2(), 'string')
+ );
+
+ $result = $this->db->query('UPDATE activity_activity SET ' .
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+
+ return isset($result);
+ }
+
+ public 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 populate(int $activity_id, &$activity)
+ {
+
+ if($activity == null) {
+ $activity = new activitycalendar_activity((int)
$activity_id);
+
+
$activity->set_organization_id($this->unmarshal($this->db->f('organization_id'),
'int'));
+
$activity->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
+
$activity->set_district($this->unmarshal($this->db->f('district'), 'string'));
+
$activity->set_category($this->unmarshal($this->db->f('category'), 'string'));
+
$activity->set_description($this->unmarshal($this->db->f('description'),
'string'));
+
$activity->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
+
$activity->set_date_start($this->unmarshal($this->db->f('date_start'), 'int'));
+
$activity->set_date_end($this->unmarshal($this->db->f('date_end'), 'int'));
+
$activity->set_contact_person_1($this->unmarshal($this->db->f('contact_person_1'),
'int'));
+
$activity->set_contact_person_2($this->unmarshal($this->db->f('contact_person_2'),
'int'));
+ }
+ return $activity;
+ }
+}
\ No newline at end of file
Added: trunk/activitycalendar/inc/class.soarena.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soarena.inc.php
(rev 0)
+++ trunk/activitycalendar/inc/class.soarena.inc.php 2011-04-07 06:23:49 UTC
(rev 7192)
@@ -0,0 +1,227 @@
+<?php
+
+phpgw::import_class('activitycalendar.socommon');
+
+include_class('activitycalendar', 'arena', 'inc/model/');
+
+class activitycalendar_soarena extends activitycalendar_socommon
+{
+ protected static $so;
+
+ /**
+ * Get a static reference to the storage object associated with this
model object
+ *
+ * @return activitycalendar_soparty the storage object
+ */
+ public static function get_instance()
+ {
+ if (self::$so == null) {
+ self::$so = CreateObject('activitycalendar.soarena');
+ }
+ return self::$so;
+ }
+
+ /**
+ * Generate SQL query
+ *
+ * @todo Add support for filter "party_type", meaning what type of
contracts
+ * the party is involved in.
+ *
+ * @param string $sort_field
+ * @param boolean $ascending
+ * @param string $search_for
+ * @param string $search_type
+ * @param array $filters
+ * @param boolean $return_count
+ * @return string SQL
+ */
+ protected function get_query(string $sort_field, boolean $ascending,
string $search_for, string $search_type, array $filters, boolean $return_count)
+ {
+ $clauses = array('1=1');
+
+ //Add columns to this array to include them in the query
+ $columns = array();
+
+ if($sort_field != null) {
+ $dir = $ascending ? 'ASC' : 'DESC';
+ if($sort_field == 'arena_id')
+ {
+ $sort_field='id';
+ }
+ $order = "ORDER BY
{$this->marshal($sort_field,'field')} $dir";
+ }
+/* if($search_for)
+ {
+ $query = $this->marshal($search_for,'string');
+ $like_pattern = "'%".$search_for."%'";
+ $like_clauses = array();
+ switch($search_type){
+ case "name":
+ $like_clauses[] = "party.first_name
$this->like $like_pattern";
+ $like_clauses[] = "party.last_name
$this->like $like_pattern";
+ $like_clauses[] = "party.company_name
$this->like $like_pattern";
+ break;
+ case "address":
+ $like_clauses[] = "party.address_1
$this->like $like_pattern";
+ $like_clauses[] = "party.address_2
$this->like $like_pattern";
+ $like_clauses[] = "party.postal_code
$this->like $like_pattern";
+ $like_clauses[] = "party.place
$this->like $like_pattern";
+ break;
+ case "identifier":
+ $like_clauses[] = "party.identifier
$this->like $like_pattern";
+ break;
+ case "reskontro":
+ $like_clauses[] = "party.reskontro
$this->like $like_pattern";
+ break;
+ case "result_unit_number":
+ $like_clauses[] =
"party.result_unit_number $this->like $like_pattern";
+ break;
+ case "all":
+ $like_clauses[] = "party.first_name
$this->like $like_pattern";
+ $like_clauses[] = "party.last_name
$this->like $like_pattern";
+ $like_clauses[] = "party.company_name
$this->like $like_pattern";
+ $like_clauses[] = "party.address_1
$this->like $like_pattern";
+ $like_clauses[] = "party.address_2
$this->like $like_pattern";
+ $like_clauses[] = "party.postal_code
$this->like $like_pattern";
+ $like_clauses[] = "party.place
$this->like $like_pattern";
+ $like_clauses[] = "party.identifier
$this->like $like_pattern";
+ $like_clauses[] = "party.comment
$this->like $like_pattern";
+ $like_clauses[] = "party.reskontro
$this->like $like_pattern";
+ break;
+ }
+
+
+ if(count($like_clauses))
+ {
+ $clauses[] = '(' . join(' OR ', $like_clauses)
. ')';
+ }
+ }*/
+
+ $filter_clauses = array();
+
+ if(isset($filters[$this->get_id_field_name()])){
+ $id =
$this->marshal($filters[$this->get_id_field_name()],'int');
+ $filter_clauses[] = "arena.id = {$id}";
+ }
+
+ //$filter_clauses[] = "show_in_portal";
+/*
+ // All parties with contracts of type X
+ if(isset($filters['party_type']))
+ {
+ $party_type =
$this->marshal($filters['party_type'],'int');
+ if(isset($party_type) && $party_type > 0)
+ {
+ $filter_clauses[] = "contract.location_id =
{$party_type}";
+ }
+ }
+*/
+
+ if(count($filter_clauses))
+ {
+ $clauses[] = join(' AND ', $filter_clauses);
+ }
+
+ $condition = join(' AND ', $clauses);
+
+ if($return_count) // We should only return a count
+ {
+ $cols = 'COUNT(DISTINCT(arena.id)) AS count';
+ }
+ else
+ {
+ $columns[] = 'arena.id';
+ $columns[] = 'arena.arena_name';
+ $columns[] = 'arena.address';
+ $columns[] = 'arena.internal_arena_id';
+
+ $cols = implode(',',$columns);
+ }
+
+ $tables = "activity_arena arena";
+
+ //$join_contracts = " {$this->left_join}
rental_contract_party c_p ON (c_p.party_id = party.id)
+ //{$this->left_join} rental_contract contract ON (contract.id =
c_p.contract_id)";
+
+ $joins = $join_contracts;
+ //var_dump("SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}");
+ return "SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}";
+ }
+
+ protected function populate(int $arena_id, &$arena)
+ {
+
+ if($arena == null) {
+ $arena = new activitycalendar_arena((int) $arena_id);
+
+
$arena->set_arena_name($this->unmarshal($this->db->f('arena_name'), 'string'));
+
$arena->set_address($this->unmarshal($this->db->f('address'), 'string'));
+
$arena->set_internal_arena_id($this->unmarshal($this->db->f('internal_arena_id'),
'int'));
+ }
+ return $arena;
+ }
+
+ /**
+ * Function for adding a new arena to the database. Updates the arena
object.
+ *
+ * @param activitycalendar_arena $arena the party to be added
+ * @return bool true if successful, false otherwise
+ */
+ function add(&$arena)
+ {
+ // Insert a new arena
+ $q ="INSERT INTO activity_arena (arena_name) VALUES ('test')";
+ $result = $this->db->query($q);
+
+ if(isset($result)) {
+ // Set the new party ID
+
$arena->set_id($this->db->get_last_insert_id('activity_arena', 'id'));
+ // Forward this request to the update method
+ return $this->update($arena);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Update the database values for an existing arena object.
+ *
+ * @param $arena the party to be updated
+ * @return boolean true if successful, false otherwise
+ */
+ function update($arena)
+ {
+ $id = intval($arena->get_id());
+
+ $values = array(
+ 'arena_name = ' .
$this->marshal($arena->get_arena_name(), 'string'),
+ 'address = ' .
$this->marshal($arena->get_address(), 'string'),
+ 'internal_arena_id = ' .
$this->marshal($arena->get_internal_arena_id(), 'int')
+ );
+
+ $result = $this->db->query('UPDATE activity_arena SET ' .
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+
+ return isset($result);
+ }
+
+ public function get_id_field_name($extended_info = false)
+ {
+ if(!$extended_info)
+ {
+ $ret = 'id';
+ }
+ else
+ {
+ $ret = array
+ (
+ 'table' => 'arena', // alias
+ 'field' => 'id',
+ 'translated' => 'id'
+ );
+ }
+ return $ret;
+ }
+}
+?>
\ No newline at end of file
Modified: trunk/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soorganization.inc.php 2011-04-06
19:27:00 UTC (rev 7191)
+++ trunk/activitycalendar/inc/class.soorganization.inc.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -2,6 +2,7 @@
phpgw::import_class('activitycalendar.socommon');
+include_class('activitycalendar', 'organization', 'inc/model/');
class activitycalendar_soorganization extends activitycalendar_socommon
{
@@ -43,20 +44,9 @@
if($sort_field != null) {
$dir = $ascending ? 'ASC' : 'DESC';
- /*if($sort_field == 'name')
- {
- $order = "ORDER BY organization.last_name
{$dir}, party.first_name {$dir}";
- }
- else
- {
- if($sort_field == 'address')
- {
- $sort_field = 'party.address_1';
- }*/
- $order = "ORDER BY
{$this->marshal($sort_field,'field')} $dir";
- //}
+ $order = "ORDER BY id $dir";
}
-/* if($search_for)
+ if($search_for)
{
$query = $this->marshal($search_for,'string');
$like_pattern = "'%".$search_for."%'";
@@ -101,10 +91,10 @@
{
$clauses[] = '(' . join(' OR ', $like_clauses)
. ')';
}
- }*/
+ }
$filter_clauses = array();
- $filter_clauses[] = "show_in_portal";
+ $filter_clauses[] = "show_in_portal=1";
/*
// All parties with contracts of type X
if(isset($filters['party_type']))
@@ -130,7 +120,7 @@
}
else
{
- $columns[] = 'org.id AS org_id';
+ $columns[] = 'org.id';
$columns[] = 'org.name';
$columns[] = 'org.homepage';
$columns[] = 'org.phone';
@@ -158,9 +148,9 @@
//$join_contracts = " {$this->left_join}
rental_contract_party c_p ON (c_p.party_id = party.id)
//{$this->left_join} rental_contract contract ON (contract.id =
c_p.contract_id)";
-
- $joins = $join_contracts;
- return "SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}";
+
+ //var_dump("SELECT {$cols} FROM {$tables} WHERE {$condition}
{$order}");
+ return "SELECT {$cols} FROM {$tables} WHERE {$condition}
{$order}";
}
@@ -171,22 +161,9 @@
* @param rental_party $party the party to be added
* @return bool true if successful, false otherwise
*/
- function add(&$party)
+ function add(&$organization)
{
- // Insert a new party
- $q ="INSERT INTO rental_party (is_inactive) VALUES (false)";
- $result = $this->db->query($q);
-
- if(isset($result)) {
- // Set the new party ID
-
$party->set_id($this->db->get_last_insert_id('rental_party', 'id'));
- // Forward this request to the update method
- return $this->update($party);
- }
- else
- {
- return false;
- }
+ return false;
}
/**
@@ -197,124 +174,40 @@
*/
function update($party)
{
- $id = intval($party->get_id());
-
-
- $location_id = $this->marshal($party->get_location_id(), 'int');
-
- if($location_id)
- {
- $loc =
$GLOBALS['phpgw']->locations->get_name($location_id);
- $name = $loc['location'];
- $level_identifier =
result_unit::get_identifier_from_name($name);
- }
-
- $result_unit_number = $this->marshal($level_identifier,
'string');
-
- $values = array(
- 'identifier = ' .
$this->marshal($party->get_identifier(), 'string'),
- 'first_name = ' .
$this->marshal($party->get_first_name(), 'string'),
- 'last_name = ' .
$this->marshal($party->get_last_name(), 'string'),
- 'title = ' .
$this->marshal($party->get_title(), 'string'),
- 'company_name = ' .
$this->marshal($party->get_company_name(), 'string'),
- 'department = ' .
$this->marshal($party->get_department(), 'string'),
- 'address_1 = ' .
$this->marshal($party->get_address_1(), 'string'),
- 'address_2 = ' .
$this->marshal($party->get_address_2(), 'string'),
- 'postal_code = ' .
$this->marshal($party->get_postal_code(), 'string'),
- 'place = ' .
$this->marshal($party->get_place(), 'string'),
- 'phone = ' .
$this->marshal($party->get_phone(), 'string'),
- 'mobile_phone = ' .
$this->marshal($party->get_mobile_phone(), 'string'),
- 'fax = ' . $this->marshal($party->get_fax(),
'string'),
- 'email = ' .
$this->marshal($party->get_email(), 'string'),
- 'url = ' . $this->marshal($party->get_url(),
'string'),
- 'account_number = ' .
$this->marshal($party->get_account_number(), 'string'),
- 'reskontro = ' .
$this->marshal($party->get_reskontro(), 'string'),
- 'is_inactive = ' .
$this->marshal(($party->is_inactive() ? 'true' : 'false'), 'bool'),
- 'comment = ' .
$this->marshal($party->get_comment(), 'string'),
- 'org_enhet_id = ' .
$this->marshal($party->get_org_enhet_id(), 'int'),
- 'location_id = ' . $location_id,
- 'result_unit_number = ' . $result_unit_number
- );
-
- $result = $this->db->query('UPDATE rental_party SET ' .
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
-
- return isset($result);
+ return false;
}
public function get_id_field_name($extended_info = false)
{
if(!$extended_info)
{
- $ret = 'party_id';
+ $ret = 'id';
}
else
{
$ret = array
(
- 'table' => 'party', // alias
+ 'table' => 'organization', //
alias
'field' => 'id',
- 'translated' => 'party_id'
+ 'translated' => 'id'
);
}
return $ret;
}
- protected function populate(int $party_id, &$party)
+ protected function populate(int $org_id, &$organization)
{
- if($party == null) {
- $party = new rental_party((int) $party_id);
+ if($organization == null) {
+ $organization = new activitycalendar_organization((int)
$org_id);
- $party->set_account_number(
$this->unmarshal($this->db->f('account_number'), 'string'));
- $party->set_address_1(
$this->unmarshal($this->db->f('address_1'), 'string'));
- $party->set_address_2(
$this->unmarshal($this->db->f('address_2'), 'string'));
- $party->set_comment(
$this->unmarshal($this->db->f('comment'), 'string'));
- $party->set_company_name(
$this->unmarshal($this->db->f('company_name'), 'string'));
- $party->set_department(
$this->unmarshal($this->db->f('department'), 'string'));
- $party->set_email(
$this->unmarshal($this->db->f('email'), 'string'));
- $party->set_fax(
$this->unmarshal($this->db->f('fax'), 'string'));
- $party->set_first_name(
$this->unmarshal($this->db->f('first_name'), 'string'));
- $party->set_is_inactive(
$this->unmarshal($this->db->f('is_inactive'), 'bool'));
- $party->set_last_name(
$this->unmarshal($this->db->f('last_name'), 'string'));
- $party->set_location_id(
$this->unmarshal($this->db->f('org_location_id'), 'int'));
- $party->set_identifier(
$this->unmarshal($this->db->f('identifier'), 'string'));
- $party->set_mobile_phone(
$this->unmarshal($this->db->f('mobile_phone'), 'string'));
- $party->set_place(
$this->unmarshal($this->db->f('place'), 'string'));
- $party->set_postal_code(
$this->unmarshal($this->db->f('postal_code'), 'string'));
- $party->set_reskontro(
$this->unmarshal($this->db->f('reskontro'), 'string'));
- $party->set_title(
$this->unmarshal($this->db->f('title'), 'string'));
- $party->set_url(
$this->unmarshal($this->db->f('url'), 'string'));
- $party->set_org_enhet_id(
$this->unmarshal($this->db->f('org_enhet_id'), 'string'));
- $sync_message = $party->set_sync_data(
- array(
- 'responsibility_id' =>
$this->unmarshal($this->db->f('responsibility_id'), 'string'),
- 'org_enhet_id' =>
$this->unmarshal($this->db->f('org_enhet_id'), 'string'),
- 'result_unit_number' =>
$this->unmarshal($this->db->f('result_unit_number'), 'string'),
- )
- );
- if(isset($sync_message) && $sync_message != '')
- {
- $party->add_sync_problem($sync_message);
- }
+
$organization->set_name($this->unmarshal($this->db->f('name'), 'string'));
+
$organization->set_organization_number($this->unmarshal($this->db->f('organization_number'),
'int'));
+
$organization->set_district($this->unmarshal($this->db->f('district'),
'string'));
+
$organization->set_description($this->unmarshal($this->db->f('description'),
'string'));
+
$organization->set_show_in_portal($this->unmarshal($this->db->f('show_in_portal'),
'int'));
}
- return $party;
+ return $organization;
}
-
- public function get_export_data()
- {
- $parties = rental_soparty::get_instance()->get(null, null,
null, null, null, null, null);
- $exportable = new rental_agresso_cs15($parties);
- return $exportable->get_contents();
- }
-
- public function get_number_of_parties()
- {
- $q ="SELECT COUNT(id) FROM rental_party";
- $result = $this->db->query($q);
- $this->db->query($q, __LINE__, __FILE__);
- $this->db->next_record();
- return (int) $this->db->f('count',true);
- }
-
}
?>
Modified: trunk/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiactivities.inc.php 2011-04-06
19:27:00 UTC (rev 7191)
+++ trunk/activitycalendar/inc/class.uiactivities.inc.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -1,6 +1,11 @@
<?php
phpgw::import_class('activitycalendar.uicommon');
+phpgw::import_class('activitycalendar.soactivity');
+phpgw::import_class('activitycalendar.soarena');
+phpgw::import_class('activitycalendar.soorganization');
+include_class('activitycalendar', 'activity', 'inc/model/');
+
class activitycalendar_uiactivities extends activitycalendar_uicommon
{
public $public_functions = array
@@ -8,8 +13,8 @@
'index' => true,
'query' => true,
'view' => true,
- 'delete' => true,
- 'commit' => true,
+ 'add' => true,
+ 'edit' => true,
'download' => true,
'download_export' => true
);
@@ -22,25 +27,17 @@
$config->read();
}
+ /**
+ * Public method. Forwards the user to edit mode.
+ */
+ public function add()
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'activitycalendar.uiactivities.edit'));
+ }
+
public function index()
{
- // No messages so far
- $errorMsgs = array();
- $warningMsgs = array();
- $infoMsgs = array();
-
-
- $data = array
- (
- 'contract_type' => phpgw::get_var('contract_type'),
- 'billing_term' => phpgw::get_var('billing_term'),
- 'year' => phpgw::get_var('year'),
- 'month' => phpgw::get_var('month'),
- 'errorMsgs' => $errorMsgs,
- 'warningMsgs' => $warningMsgs,
- 'infoMsgs' => $infoMsgs
- );
- $this->render('activities.php', $data);
+ $this->render('activity_list.php');
}
/*public function index()
{
@@ -107,127 +104,76 @@
*/
public function view()
{
- if(!$this->isExecutiveOfficer())
- {
- $this->render('permission_denied.php');
- return;
- }
-
- $GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('invoice_run');
-
$errorMsgs = array();
$infoMsgs = array();
- $billing_job =
rental_sobilling::get_instance()->get_single((int)phpgw::get_var('id'));
- $billing_info_array =
rental_sobilling_info::get_instance()->get(null, null, null, null, null, null,
array('billing_id' => phpgw::get_var('id')));
+ $activity =
activitycalendar_soactivity::get_instance()->get_single((int)phpgw::get_var('id'));
- if($billing_job == null) // Not found
+ if($activity == null) // Not found
{
- $errorMsgs[] = lang('Could not find specified billing
job.');
+ $errorMsgs[] = lang('Could not find specified
activity.');
}
- else if(phpgw::get_var('generate_export') != null) // User
wants to generate export
- {
-
- $open_and_exported =
rental_soinvoice::get_instance()->number_of_open_and_exported_rental_billings($billing_job->get_location_id());
-
- if($open_and_exported == 0)
- {
- //Loop through billing info array to find the
first month
- $month = 12;
- foreach($billing_info_array as $billing_info)
- {
- $year = $billing_info->get_year();
- if($month > $billing_info->get_month())
- {
- $month =
$billing_info->get_month();
- }
- }
-
- $billing_job->set_year($year);
- $billing_job->set_month($month);
-
-
if(rental_sobilling::get_instance()->generate_export($billing_job))
- {
- $infoMsgs[] = lang('Export generated.');
-
$billing_job->set_generated_export(true); // The template need to know that
we've genereated the export
- }
- else
- {
- $errorMsgs = lang('Export failed.');
- }
- }
- else
- {
- $errorMsgs[] = lang('open_and_exported_exist');
- }
- }
- else if(phpgw::get_var('commit') != null) // User wants to
commit/close billing so that it cannot be deleted
- {
- $billing_job->set_timestamp_commit(time());
- rental_sobilling::get_instance()->store($billing_job);
- }
+
$data = array
(
- 'billing_job' => $billing_job,
- 'billing_info_array' => $billing_info_array,
+ 'activity' => $activity,
'errorMsgs' => $errorMsgs,
- 'infoMsgs' => $infoMsgs,
- 'back_link' =>
html_entity_decode(self::link(array('menuaction' => 'rental.uibilling.index'))),
- 'download_link' =>
html_entity_decode(self::link(array('menuaction' =>
'rental.uibilling.download_export', 'id' => (($billing_job != null) ?
$billing_job->get_id() : ''), 'date' => $billing_job->get_timestamp_stop(),
'export_format' => $billing_job->get_export_format())))
+ 'infoMsgs' => $infoMsgs
);
- $this->render('billing.php', $data);
+ $this->render('activity.php', $data);
}
- /**
- * Deletes an uncommited billing job.
- */
- public function delete()
+ public function edit()
{
- if(!$this->isExecutiveOfficer())
+ $GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('edit');
+ // Get the contract part id
+ $activity_id = (int)phpgw::get_var('id');
+
+
+ // Retrieve the arena object or create a new one
+ if(isset($activity_id) && $activity_id > 0)
+ {
+ $arena =
activitycalendar_soactivity::get_instance()->get_single($activity_id);
+ }
+ else
{
- $this->render('permission_denied.php');
- return;
+ $activity = new activitycalendar_activity();
}
- $billing_job =
rental_sobilling::get_instance()->get_single((int)phpgw::get_var('id'));
- $billing_job->set_deleted(true);
- rental_sobilling::get_instance()->store($billing_job);
- //set deleted=true on billing_info
- $billing_infos =
rental_sobilling_info::get_instance()->get(null, null, null, null, null, null,
array('billing_id' => phpgw::get_var('id')));
- foreach($billing_infos as $billing_info){
- $billing_info->set_deleted(true);
-
rental_sobilling_info::get_instance()->store($billing_info);
- }
-
- //set is_billed on invoice price items to false
- $billing_job_invoices =
rental_soinvoice::get_instance()->get(null, null, null, null, null, null,
array('billing_id' => phpgw::get_var('id')));
- foreach($billing_job_invoices as $invoice){
- $price_items =
rental_socontract_price_item::get_instance()->get(null, null, null, null, null,
null, array('contract_id' => $invoice->get_contract_id(), 'one_time' => true));
- foreach($price_items as $price_item){
- if($price_item->get_date_start() >=
$invoice->get_timestamp_start() && $price_item->get_date_start() <=
$invoice->get_timestamp_end()){
- $price_item->set_is_billed(false);
-
rental_socontract_price_item::get_instance()->store($price_item);
+ $arenas = activitycalendar_soarena::get_instance()->get(null,
null, null, null, null, null, null);
+ $organizations =
activitycalendar_soorganization::get_instance()->get(null, null, null, null,
null, null, null);
+
+ if(isset($_POST['save_activity'])) // The user has pressed the
save button
+ {
+ if(isset($activity)) // If a arena object is created
+ {
+ // ... set all parameters
+
$activity->set_internal_arena_id(phpgw::get_var('internal_arena_id'));
+
$activity->set_arena_name(phpgw::get_var('arena_name'));
+
$activity->set_address(phpgw::get_var('address'));
+
+
if(activitycalendar_soactivity::get_instance()->store($activity)) // ... and
then try to store the object
+ {
+ $message = lang('messages_saved_form');
}
+ else
+ {
+ $error = lang('messages_form_error');
+ }
}
- $invoice->set_serial_number(null);
- rental_soinvoice::get_instance()->store($invoice);
}
+
+ return $this->render('activity.php', array
+ (
+ 'activity' => $activity,
+ 'organizations' => $organizations,
+ 'arenas' => $arenas,
+ 'editable' => true,
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error :
phpgw::get_var('error')
+ )
+ );
}
- /**
- * Commits a billing job. After it's commited it cannot be deleted.
- */
- public function commit()
- {
- if(!$this->isExecutiveOfficer())
- {
- $this->render('permission_denied.php');
- return;
- }
- $billing_job =
rental_sobilling::get_instance()->get_single((int)phpgw::get_var('id'));
- $billing_job->set_timestamp_commit(time());
- rental_sobilling::get_instance()->store($billing_job);
- }
-
public function query()
{
if(!$this->isExecutiveOfficer())
@@ -325,26 +271,12 @@
switch($query_type)
{
- case 'all_billings':
+ case 'all_activities':
$value['ajax'][] = false;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'rental.uibilling.view',
'id' => $value['id'])));
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiactivities.view', 'id' => $value['id'])));
$value['labels'][] = lang('show');
- if($value['timestamp_commit'] == null ||
$value['timestamp_commit'] == '')
- {
- $value['ajax'][] = true;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'rental.uibilling.delete',
'id' => $value['id'])));
- $value['labels'][] = lang('delete');
- $value['ajax'][] = true;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'rental.uibilling.commit',
'id' => $value['id'])));
- $value['labels'][] = lang('commit');
- }
- break;
- case 'invoices':
$value['ajax'][] = false;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'rental.uicontract.view',
'id' => $value['contract_id']))) . '#price';
- $value['labels'][] = lang('show');
- $value['ajax'][] = false;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'rental.uicontract.edit',
'id' => $value['contract_id']))) . '#price';
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiactivities.edit', 'id' => $value['id'])));
$value['labels'][] = lang('edit');
break;
}
Modified: trunk/activitycalendar/inc/class.uiarena.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiarena.inc.php 2011-04-06 19:27:00 UTC
(rev 7191)
+++ trunk/activitycalendar/inc/class.uiarena.inc.php 2011-04-07 06:23:49 UTC
(rev 7192)
@@ -1,6 +1,9 @@
<?php
phpgw::import_class('activitycalendar.uicommon');
+phpgw::import_class('activitycalendar.soarena');
+include_class('activitycalendar', 'arena', 'inc/model/');
+
class activitycalendar_uiarena extends activitycalendar_uicommon
{
public $public_functions = array
@@ -8,10 +11,8 @@
'index' => true,
'query' => true,
'view' => true,
- 'delete' => true,
- 'commit' => true,
- 'download' => true,
- 'download_export' => true
+ 'add' => true,
+ 'edit' => true
);
public function __construct()
@@ -22,6 +23,14 @@
$config->read();
}
+ /**
+ * Public method. Forwards the user to edit mode.
+ */
+ public function add()
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'activitycalendar.uiarena.edit'));
+ }
+
public function index()
{
// No messages so far
@@ -30,152 +39,88 @@
$infoMsgs = array();
- $data = array
- (
- 'contract_type' => phpgw::get_var('contract_type'),
- 'billing_term' => phpgw::get_var('billing_term'),
- 'year' => phpgw::get_var('year'),
- 'month' => phpgw::get_var('month'),
- 'errorMsgs' => $errorMsgs,
- 'warningMsgs' => $warningMsgs,
- 'infoMsgs' => $infoMsgs
- );
- $this->render('arena.php', $data);
+ $data = array();
+ $this->render('arena_list.php');
}
/**
- * Displays info about one single billing job.
+ * Displays info about one single arena.
*/
public function view()
{
- if(!$this->isExecutiveOfficer())
- {
- $this->render('permission_denied.php');
- return;
- }
- $GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('invoice_run');
-
$errorMsgs = array();
$infoMsgs = array();
- $billing_job =
rental_sobilling::get_instance()->get_single((int)phpgw::get_var('id'));
- $billing_info_array =
rental_sobilling_info::get_instance()->get(null, null, null, null, null, null,
array('billing_id' => phpgw::get_var('id')));
+ $arena =
activitycalendar_soarena::get_instance()->get_single((int)phpgw::get_var('id'));
- if($billing_job == null) // Not found
+ if($arena == null) // Not found
{
- $errorMsgs[] = lang('Could not find specified billing
job.');
+ $errorMsgs[] = lang('Could not find specified arena.');
}
- else if(phpgw::get_var('generate_export') != null) // User
wants to generate export
- {
-
- $open_and_exported =
rental_soinvoice::get_instance()->number_of_open_and_exported_rental_billings($billing_job->get_location_id());
-
- if($open_and_exported == 0)
- {
- //Loop through billing info array to find the
first month
- $month = 12;
- foreach($billing_info_array as $billing_info)
- {
- $year = $billing_info->get_year();
- if($month > $billing_info->get_month())
- {
- $month =
$billing_info->get_month();
- }
- }
-
- $billing_job->set_year($year);
- $billing_job->set_month($month);
-
-
if(rental_sobilling::get_instance()->generate_export($billing_job))
- {
- $infoMsgs[] = lang('Export generated.');
-
$billing_job->set_generated_export(true); // The template need to know that
we've genereated the export
- }
- else
- {
- $errorMsgs = lang('Export failed.');
- }
- }
- else
- {
- $errorMsgs[] = lang('open_and_exported_exist');
- }
- }
- else if(phpgw::get_var('commit') != null) // User wants to
commit/close billing so that it cannot be deleted
- {
- $billing_job->set_timestamp_commit(time());
- rental_sobilling::get_instance()->store($billing_job);
- }
$data = array
(
- 'billing_job' => $billing_job,
- 'billing_info_array' => $billing_info_array,
+ 'arena' => $arena,
'errorMsgs' => $errorMsgs,
- 'infoMsgs' => $infoMsgs,
- 'back_link' =>
html_entity_decode(self::link(array('menuaction' => 'rental.uibilling.index'))),
- 'download_link' =>
html_entity_decode(self::link(array('menuaction' =>
'rental.uibilling.download_export', 'id' => (($billing_job != null) ?
$billing_job->get_id() : ''), 'date' => $billing_job->get_timestamp_stop(),
'export_format' => $billing_job->get_export_format())))
+ 'infoMsgs' => $infoMsgs
);
- $this->render('billing.php', $data);
+ $this->render('arena.php', $data);
}
- /**
- * Deletes an uncommited billing job.
- */
- public function delete()
+ public function edit()
{
- if(!$this->isExecutiveOfficer())
- {
- $this->render('permission_denied.php');
- return;
- }
- $billing_job =
rental_sobilling::get_instance()->get_single((int)phpgw::get_var('id'));
- $billing_job->set_deleted(true);
- rental_sobilling::get_instance()->store($billing_job);
+ $GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('edit');
+ // Get the contract part id
+ $arena_id = (int)phpgw::get_var('id');
- //set deleted=true on billing_info
- $billing_infos =
rental_sobilling_info::get_instance()->get(null, null, null, null, null, null,
array('billing_id' => phpgw::get_var('id')));
- foreach($billing_infos as $billing_info){
- $billing_info->set_deleted(true);
-
rental_sobilling_info::get_instance()->store($billing_info);
- }
- //set is_billed on invoice price items to false
- $billing_job_invoices =
rental_soinvoice::get_instance()->get(null, null, null, null, null, null,
array('billing_id' => phpgw::get_var('id')));
- foreach($billing_job_invoices as $invoice){
- $price_items =
rental_socontract_price_item::get_instance()->get(null, null, null, null, null,
null, array('contract_id' => $invoice->get_contract_id(), 'one_time' => true));
- foreach($price_items as $price_item){
- if($price_item->get_date_start() >=
$invoice->get_timestamp_start() && $price_item->get_date_start() <=
$invoice->get_timestamp_end()){
- $price_item->set_is_billed(false);
-
rental_socontract_price_item::get_instance()->store($price_item);
+ // Retrieve the arena object or create a new one
+ if(isset($arena_id) && $arena_id > 0)
+ {
+ $arena =
activitycalendar_soarena::get_instance()->get_single($arena_id);
+ }
+ else
+ {
+ $arena = new activitycalendar_arena();
+ }
+
+ if(isset($_POST['save_arena'])) // The user has pressed the
save button
+ {
+ if(isset($arena)) // If a arena object is created
+ {
+ // ... set all parameters
+
$arena->set_internal_arena_id(phpgw::get_var('internal_arena_id'));
+
$arena->set_arena_name(phpgw::get_var('arena_name'));
+ $arena->set_address(phpgw::get_var('address'));
+
+
if(activitycalendar_soarena::get_instance()->store($arena)) // ... and then try
to store the object
+ {
+ $message = lang('messages_saved_form');
}
+ else
+ {
+ $error = lang('messages_form_error');
+ }
}
- $invoice->set_serial_number(null);
- rental_soinvoice::get_instance()->store($invoice);
}
+
+ return $this->render('arena.php', array
+ (
+ 'arena' => $arena,
+ 'editable' => true,
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error :
phpgw::get_var('error')
+ )
+ );
}
- /**
- * Commits a billing job. After it's commited it cannot be deleted.
- */
- public function commit()
- {
- if(!$this->isExecutiveOfficer())
- {
- $this->render('permission_denied.php');
- return;
- }
- $billing_job =
rental_sobilling::get_instance()->get_single((int)phpgw::get_var('id'));
- $billing_job->set_timestamp_commit(time());
- rental_sobilling::get_instance()->store($billing_job);
- }
-
public function query()
{
- if(!$this->isExecutiveOfficer())
+/* if(!$this->isExecutiveOfficer())
{
$this->render('permission_denied.php');
return;
}
+*/
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
{
$user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
@@ -204,36 +149,24 @@
$num_of_objects = null;
}
+ //var_dump($query_type);
+
switch($query_type)
{
- case 'all_billings':
+ case 'all_arenas':
$filters = array();
- if($sort_field == 'responsibility_title'){
- $sort_field = 'location_id';
- }
- $result_objects =
rental_sobilling::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
- $object_count =
rental_sobilling::get_instance()->get_count($search_for, $search_type,
$filters);
+ $result_objects =
activitycalendar_soarena::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
+ $object_count =
activitycalendar_soarena::get_instance()->get_count($search_for, $search_type,
$filters);
break;
- case 'invoices':
- if($sort_field == 'term_label'){
- $sort_field = 'term_id';
- }
- $filters = array('billing_id' =>
phpgw::get_var('billing_id'));
- $result_objects =
rental_soinvoice::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
- $object_count =
rental_soinvoice::get_instance()->get_count($search_for, $search_type,
$filters);
- break;
}
-
+ //var_dump($result_objects);
//Create an empty row set
$rows = array();
foreach($result_objects as $result) {
if(isset($result))
{
- if($result->has_permission(PHPGW_ACL_READ))
- {
// ... add a serialized result
$rows[] = $result->serialize();
- }
}
}
@@ -266,26 +199,12 @@
switch($query_type)
{
- case 'all_billings':
+ case 'all_arenas':
$value['ajax'][] = false;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'rental.uibilling.view',
'id' => $value['id'])));
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiarena.view', 'id' => $value['id'])));
$value['labels'][] = lang('show');
- if($value['timestamp_commit'] == null ||
$value['timestamp_commit'] == '')
- {
- $value['ajax'][] = true;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'rental.uibilling.delete',
'id' => $value['id'])));
- $value['labels'][] = lang('delete');
- $value['ajax'][] = true;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'rental.uibilling.commit',
'id' => $value['id'])));
- $value['labels'][] = lang('commit');
- }
- break;
- case 'invoices':
$value['ajax'][] = false;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'rental.uicontract.view',
'id' => $value['contract_id']))) . '#price';
- $value['labels'][] = lang('show');
- $value['ajax'][] = false;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'rental.uicontract.edit',
'id' => $value['contract_id']))) . '#price';
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiarena.edit', 'id' => $value['id'])));
$value['labels'][] = lang('edit');
break;
}
Modified: trunk/activitycalendar/inc/class.uicommon.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uicommon.inc.php 2011-04-06 19:27:00 UTC
(rev 7191)
+++ trunk/activitycalendar/inc/class.uicommon.inc.php 2011-04-07 06:23:49 UTC
(rev 7192)
@@ -53,7 +53,7 @@
public function __construct()
{
- self::set_active_menu('booking');
+ self::set_active_menu('activitycalendar');
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');
Copied: trunk/activitycalendar/inc/class.uiorganization.inc.php (from rev 7149,
trunk/activitycalendar/inc/class.uiorganizationlist.inc.php)
===================================================================
--- trunk/activitycalendar/inc/class.uiorganization.inc.php
(rev 0)
+++ trunk/activitycalendar/inc/class.uiorganization.inc.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -0,0 +1,191 @@
+<?php
+phpgw::import_class('activitycalendar.uicommon');
+phpgw::import_class('activitycalendar.soorganization');
+
+//include_class('activitycalendar', 'organization', 'inc/model/');
+
+class activitycalendar_uiorganization extends activitycalendar_uicommon
+{
+ public $public_functions = array
+ (
+ 'index' => true,
+ 'query' => true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+ self::set_active_menu('booking::activities::organizationList');
+ $config = CreateObject('phpgwapi.config','activitycalendar');
+ $config->read();
+ }
+
+ public function index()
+ {
+ $this->render('organization_list.php');
+ }
+
+
+ /**
+ * (non-PHPdoc)
+ * @see rental/inc/rental_uicommon#query()
+ */
+ public function query()
+ {
+
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+ {
+ $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else {
+ $user_rows_per_page = 10;
+ }
+ // YUI variables for paging and sorting
+ $start_index = phpgw::get_var('startIndex', 'int');
+ $num_of_objects = phpgw::get_var('results', 'int', 'GET',
$user_rows_per_page);
+ $sort_field = phpgw::get_var('sort', 'string',
'GET', 'identifier');
+ $sort_ascending = phpgw::get_var('dir') == 'desc' ? false :
true;
+ // Form variables
+ $search_for = phpgw::get_var('query');
+ $search_type = phpgw::get_var('search_option');
+ // Create an empty result set
+ $result_objects = array();
+ $result_count = 0;
+
+ //Create an empty result set
+ $parties = array();
+
+ $exp_param = phpgw::get_var('export');
+ $export = false;
+ if(isset($exp_param)){
+ $export=true;
+ $num_of_objects = null;
+ }
+
+ //Retrieve the type of query and perform type specific logic
+ $type = phpgw::get_var('type');
+
+ /*$config =
CreateObject('phpgwapi.config','activitycalendar');
+ $config->read();
+ switch($type)
+ {
+ case 'included_parties': // ... get all parties
incolved in the contract
+ $filters = array('contract_id' => $contract_id);
+ break;
+ case 'not_included_parties': // ... get all parties not
included in the contract
+ $filters = array('not_contract_id' =>
$contract_id, 'party_type' => phpgw::get_var('party_type'));
+ break;
+ case 'sync_parties':
+ case 'sync_parties_res_unit':
+ case 'sync_parties_identifier':
+ case 'sync_parties_org_unit':
+ $filters = array('sync' => $type, 'party_type'
=> phpgw::get_var('party_type'), 'active' => phpgw::get_var('active'));
+ if($use_fellesdata)
+ {
+ $bofelles =
rental_bofellesdata::get_instance();
+ }
+ break;
+ default: // ... get all parties of a given type
+ //$filters = array('party_type' =>
phpgw::get_var('party_type'), 'active' => phpgw::get_var('active'));
+ break;
+ }*/
+
+ $result_objects =
activitycalendar_soorganization::get_instance()->get($start_index,
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type,
$filters);
+ $result_count =
activitycalendar_soorganization::get_instance()->get_count($search_for,
$search_type, $filters);
+
+ //var_dump($result_objects);
+ // Create an empty row set
+ $rows = array();
+ foreach ($result_objects as $result) {
+ if(isset($result))
+ {
+ $rows[] = $result->serialize();
+ }
+ }
+ // ... add result data
+ $organization_data = array('results' => $rows, 'total_records'
=> $result_count);
+
+ $editable = phpgw::get_var('editable') == 'true' ? true : false;
+
+ if(!$export){
+ array_walk(
+ $organization_data['results'],
+ array($this, 'add_actions'),
+ array(
// Parameters
(non-object pointers)
+ $type
// [2] The type of
query
+ )
+ );
+ }
+
+
+ return $this->yui_results($organization_data, 'total_records',
'results');
+ }
+
+ /**
+ * Public method. Called when a user wants to view information about a
party.
+ * @param HTTP::id the party ID
+ */
+ public function view()
+ {
+ $GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('view');
+ // Get the contract part id
+ $party_id = (int)phpgw::get_var('id');
+ if(isset($party_id) && $party_id > 0)
+ {
+ $party =
rental_soparty::get_instance()->get_single($party_id);
+ }
+ else
+ {
+ $this->render('permission_denied.php',array('error' =>
lang('invalid_request')));
+ return;
+ }
+
+ if(isset($party) && $party->has_permission(PHPGW_ACL_READ))
+ {
+ return $this->render(
+ 'party.php',
+ array (
+ 'party' => $party,
+ 'editable' => false,
+ 'cancel_link' =>
self::link(array('menuaction' => 'rental.uiparty.index', 'populate_form' =>
'yes')),
+ )
+ );
+ }
+ else
+ {
+ $this->render('permission_denied.php',array('error' =>
lang('permission_denied_view_party')));
+ }
+ }
+
+ public function download_agresso(){
+ $browser = CreateObject('phpgwapi.browser');
+ $browser->content_header('export.txt','text/plain');
+ print rental_soparty::get_instance()->get_export_data();
+ }
+
+ /**
+ * Add action links and labels for the context menu of the list items
+ *
+ * @param $value pointer to
+ * @param $key ?
+ * @param $params [composite_id, type of query, editable]
+ */
+ public function add_actions(&$value, $key, $params)
+ {
+ //Defining new columns
+ $value['ajax'] = array();
+ $value['actions'] = array();
+ $value['labels'] = array();
+
+ $query_type = $params[0];
+
+ switch($query_type)
+ {
+ case 'all_organizations':
+ $value['ajax'][] = false;
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'booking.uiorganization.show', 'id' => $value['id'])));
+ $value['labels'][] = lang('show');
+ break;
+ }
+ }
+}
+?>
\ No newline at end of file
Deleted: trunk/activitycalendar/inc/class.uiorganizationlist.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiorganizationlist.inc.php 2011-04-06
19:27:00 UTC (rev 7191)
+++ trunk/activitycalendar/inc/class.uiorganizationlist.inc.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -1,167 +0,0 @@
-<?php
-phpgw::import_class('activitycalendar.uicommon');
-
-class activitycalendar_uiorganizationlist extends activitycalendar_uicommon
-{
- public $public_functions = array
- (
- 'index' => true,
- 'query' => true
- );
-
- public function __construct()
- {
- parent::__construct();
- self::set_active_menu('booking::activities::organizationList');
- $config = CreateObject('phpgwapi.config','activitycalendar');
- $config->read();
- }
-
- public function index()
- {
- $this->render('organization_list.php', $data);
- }
-
-
- /**
- * (non-PHPdoc)
- * @see rental/inc/rental_uicommon#query()
- */
- public function query()
- {
-
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
- {
- $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else {
- $user_rows_per_page = 10;
- }
- // YUI variables for paging and sorting
- $start_index = phpgw::get_var('startIndex', 'int');
- $num_of_objects = phpgw::get_var('results', 'int', 'GET',
$user_rows_per_page);
- $sort_field = phpgw::get_var('sort', 'string',
'GET', 'identifier');
- $sort_ascending = phpgw::get_var('dir') == 'desc' ? false :
true;
- // Form variables
- $search_for = phpgw::get_var('query');
- $search_type = phpgw::get_var('search_option');
- // Create an empty result set
- $result_objects = array();
- $result_count = 0;
-
- //Create an empty result set
- $parties = array();
-
- $exp_param = phpgw::get_var('export');
- $export = false;
- if(isset($exp_param)){
- $export=true;
- $num_of_objects = null;
- }
-
- //Retrieve the type of query and perform type specific logic
- $type = phpgw::get_var('type');
-
- $config = CreateObject('phpgwapi.config','activitycalendar');
- $config->read();
- switch($type)
- {
- case 'included_parties': // ... get all parties
incolved in the contract
- $filters = array('contract_id' => $contract_id);
- break;
- case 'not_included_parties': // ... get all parties not
included in the contract
- $filters = array('not_contract_id' =>
$contract_id, 'party_type' => phpgw::get_var('party_type'));
- break;
- case 'sync_parties':
- case 'sync_parties_res_unit':
- case 'sync_parties_identifier':
- case 'sync_parties_org_unit':
- $filters = array('sync' => $type, 'party_type'
=> phpgw::get_var('party_type'), 'active' => phpgw::get_var('active'));
- if($use_fellesdata)
- {
- $bofelles =
rental_bofellesdata::get_instance();
- }
- break;
- default: // ... get all parties of a given type
- //$filters = array('party_type' =>
phpgw::get_var('party_type'), 'active' => phpgw::get_var('active'));
- break;
- }
-
- $result_objects =
activitycalendar_soorganization::get_instance()->get($start_index,
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type,
$filters);
- $result_count =
activitycalendar_soorganization::get_instance()->get_count($search_for,
$search_type, $filters);
-
- var_dump($result_objects);
- // Create an empty row set
- $rows = array();
- foreach ($result_objects as $organization) {
- if(isset($organization))
- {
- //$serialized = $party->serialize($contract);
- $rows[] = $organization;
- }
- }
- // ... add result data
- $organization_data = array('results' => $rows, 'total_records'
=> $result_count);
-
- $editable = phpgw::get_var('editable') == 'true' ? true : false;
-
- if(!$export){
- array_walk(
- $party_data['results'],
- array($this, 'add_actions'),
- array(
// Parameters
(non-object pointers)
- $contract_id,
// [1] The contract id
- $type,
// [2] The type of query
- //isset($contract) ?
$contract->serialize() : null, // [3] Serialized contract
- $editable,
// [4] Editable flag
- $this->type_of_user
// [5] User role
- )
- );
- }
-
-
- return $this->yui_results($organization_data, 'total_records',
'results');
- }
-
- /**
- * Public method. Called when a user wants to view information about a
party.
- * @param HTTP::id the party ID
- */
- public function view()
- {
- $GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('view');
- // Get the contract part id
- $party_id = (int)phpgw::get_var('id');
- if(isset($party_id) && $party_id > 0)
- {
- $party =
rental_soparty::get_instance()->get_single($party_id);
- }
- else
- {
- $this->render('permission_denied.php',array('error' =>
lang('invalid_request')));
- return;
- }
-
- if(isset($party) && $party->has_permission(PHPGW_ACL_READ))
- {
- return $this->render(
- 'party.php',
- array (
- 'party' => $party,
- 'editable' => false,
- 'cancel_link' =>
self::link(array('menuaction' => 'rental.uiparty.index', 'populate_form' =>
'yes')),
- )
- );
- }
- else
- {
- $this->render('permission_denied.php',array('error' =>
lang('permission_denied_view_party')));
- }
- }
-
- public function download_agresso(){
- $browser = CreateObject('phpgwapi.browser');
- $browser->content_header('export.txt','text/plain');
- print rental_soparty::get_instance()->get_export_data();
- }
-}
-?>
\ No newline at end of file
Added: trunk/activitycalendar/inc/model/class.activity.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.activity.inc.php
(rev 0)
+++ trunk/activitycalendar/inc/model/class.activity.inc.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -0,0 +1,140 @@
+<?php
+
+ include_class('activitycalendar', 'model', 'inc/model/');
+
+ class activitycalendar_activity extends activitycalendar_model
+ {
+ public static $so;
+
+ protected $id;
+ protected $organization_id;
+ protected $group_id;
+ protected $district;
+ protected $category;
+ protected $description;
+ protected $arena;
+ protected $date_start;
+ protected $date_end;
+ protected $contact_person_1;
+ protected $contact_person_2;
+
+ /**
+ * 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_organization_id($organization_id)
+ {
+ $this->organization_id = $organization_id;
+ }
+
+ public function get_organization_id() { return
$this->organization_id; }
+
+ public function set_group_id($group_id)
+ {
+ $this->group_id = $group_id;
+ }
+
+ public function get_group_id() { return $this->group_id; }
+
+ public function set_district($district)
+ {
+ $this->district = $district;
+ }
+
+ public function get_district() { return $this->district; }
+
+ public function set_category($category)
+ {
+ $this->category = $category;
+ }
+
+ public function get_category() { return $this->category; }
+
+ public function set_description($description)
+ {
+ $this->description = $description;
+ }
+
+ public function get_description() { return $this->description; }
+
+ public function set_arena($arena)
+ {
+ $this->arena = $arena;
+ }
+
+ public function get_arena() { return $this->arena; }
+
+ public function set_date_start($date_start)
+ {
+ $this->date_start = $date_start;
+ }
+
+ public function get_date_start() { return $this->date_start; }
+
+ public function set_date_end($date_end)
+ {
+ $this->date_end = $date_end;
+ }
+
+ public function get_date_end() { return $this->date_end; }
+
+ public function set_contact_person_1($contact_person_1)
+ {
+ $this->contact_person_1 = $contact_person_1;
+ }
+
+ public function get_contact_person_1() { return
$this->contact_person_1; }
+
+ public function set_contact_person_2($contact_person_2)
+ {
+ $this->contact_person_2 = $contact_person_2;
+ }
+
+ public function get_contact_person_2() { return
$this->contact_person_2; }
+
+ /**
+ * 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('rental.socontract');
+ }
+
+ return self::$so;
+ }
+
+ public function serialize()
+ {
+ return array(
+ 'id' => $this->get_id(),
+ 'organization_id' =>
$this->get_organization_id(),
+ 'group_id' => $this->get_group_id(),
+ 'district' => $this->get_district(),
+ 'category' => $this->get_category(),
+ 'description' => $this->get_description(),
+ 'arena' => $this->get_arena(),
+ 'date_start' => $this->get_date_start(),
+ 'date_end' => $this->get_date_end(),
+ 'contact_person_1' =>
$this->get_contact_person_1(),
+ 'contact_person_2' =>
$this->get_contact_person_2()
+ );
+ }
+ }
+?>
\ No newline at end of file
Added: trunk/activitycalendar/inc/model/class.arena.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.arena.inc.php
(rev 0)
+++ trunk/activitycalendar/inc/model/class.arena.inc.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -0,0 +1,86 @@
+<?php
+
+ include_class('activitycalendar', 'model', 'inc/model/');
+
+ class activitycalendar_arena extends activitycalendar_model
+ {
+ public static $so;
+
+ protected $id;
+ protected $arena_name;
+ protected $internal_arena_id;
+ protected $address;
+ protected $reference;
+
+ /**
+ * 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_internal_arena_id($id){
+ $this->internal_arena_id = $id;
+ }
+
+ public function get_internal_arena_id(){
+ return $this->internal_arena_id;
+ }
+
+ public function set_arena_name($arena_name)
+ {
+ $this->arena_name = $arena_name;
+ }
+
+ public function get_arena_name()
+ {
+ return $this->arena_name;
+ }
+
+ public function set_address($address)
+ {
+ $this->address = $address;
+ }
+
+ public function get_address()
+ {
+ return $this->address;
+ }
+
+ /**
+ * 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('rental.socontract');
+ }
+
+ return self::$so;
+ }
+
+ public function serialize()
+ {
+ return array(
+ 'id' => $this->get_id(),
+ 'arena_name' => $this->get_arena_name(),
+ 'internal_arena_id' =>
$this->get_internal_arena_id(),
+ 'address' => $this->get_address()
+ );
+ }
+ }
+
+?>
\ No newline at end of file
Added: trunk/activitycalendar/inc/model/class.model.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.model.inc.php
(rev 0)
+++ trunk/activitycalendar/inc/model/class.model.inc.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -0,0 +1,176 @@
+<?php
+
+abstract class activitycalendar_model
+{
+ protected $validation_errors = array();
+ protected $validation_warnings = array();
+
+ protected $consistency_warnings = array();
+
+ protected $field_of_responsibility_id;
+ protected $field_of_responsibility_name;
+ protected $permission_array;
+
+ public function __construct(int $id)
+ {
+ $this->id = (int)$id;
+ }
+
+ public function get_id()
+ {
+ return $this->id;
+ }
+
+ public function set_id($id)
+ {
+ $this->id = $id;
+ }
+
+ /**
+ * Retrieve the name of the 'field of responsibility' this object
belongs to.
+ * The default name is the root location (.)
+ *
+ * @return the field name
+ */
+ public function get_field_of_responsibility_name()
+ {
+ if(!isset($this->field_of_responsibility_name))
+ {
+ if(isset($this->field_of_responsibility_id))
+ {
+ $array =
$GLOBALS['phpgw']->locations->get_name($this->field_of_responsibility_id);
+ if($array['appname'] =
$GLOBALS['phpgw_info']['flags']['currentapp']){
+ $this->field_of_responsibility_name =
$array['location'];
+ }
+ }
+ else
+ {
+ $this->field_of_responsibility_name = '.';
+ }
+ return $this->field_of_responsibility_name;
+ }
+ else
+ {
+ return $this->field_of_responsibility_name;
+ }
+ }
+
+ /**
+ * Check if the current user has been given permission for a given
action
+ *
+ * @param $permission
+ * @return true if current user has permission, false otherwise
+ */
+ public function has_permission($permission = PHPGW_ACL_PRIVATE)
+ {
+ return
$GLOBALS['phpgw']->acl->check($this->get_field_of_responsibility_name(),$permission,'bkbooking');
+ }
+
+ /**
+ * Set the identifier for the field of responsibility this object
belongs to
+ *
+ * @param $id the ocation identifier
+ */
+ public function set_field_of_responsibility_id($id)
+ {
+ $this->field_of_responsibility_id = $id;
+ }
+
+ /**
+ * Retrieve an array with the different permission levels the current
user has for this object
+ *
+ * @return an array with permissions [PERMISSION_BITMASK => true/false]
+ */
+ public function get_permission_array(){
+ $location_name = $this->get_field_of_responsibility_name();
+ return array (
+ PHPGW_ACL_READ =>
$GLOBALS['phpgw']->acl->check($location_name, PHPGW_ACL_READ,'bkbooking'),
+ PHPGW_ACL_ADD =>
$GLOBALS['phpgw']->acl->check($location_name, PHPGW_ACL_ADD,'bkbooking'),
+ PHPGW_ACL_EDIT =>
$GLOBALS['phpgw']->acl->check($location_name, PHPGW_ACL_EDIT,'bkbooking'),
+ PHPGW_ACL_DELETE =>
$GLOBALS['phpgw']->acl->check($location_name, PHPGW_ACL_DELETE,'bkbooking'),
+ PHPGW_ACL_PRIVATE =>
$GLOBALS['phpgw']->acl->check($location_name, PHPGW_ACL_PRIVATE,'bkbooking')
+ );
+ }
+
+
+
+ /**
+ * Validate the object according to the database setup and custom
rules. This function
+ * can be overridden in subclasses. It is then up to the subclasses to
call this parent method
+ * in order to validate against the standard database rules. The
subclasses can in addition
+ * add their own specific validation logic.
+ *
+ * @return boolean true if the object is valid, false otherwise
+ */
+ public function validates()
+ {
+ return true;
+ }
+
+ public function check_consistency()
+ {
+ return true;
+ }
+
+ public function validate_numeric(){
+ return true;
+ }
+
+ public function set_validation_error(string $rule_name, string
$error_language_key)
+ {
+ $this->validation_errors[$rule_name] = $error_language_key;
+ }
+
+ public function get_validation_errors()
+ {
+ return $this->validation_errors;
+ }
+
+ public function set_validation_warning(string $warning_language_key)
+ {
+ $this->validation_warnings[] = $warning_language_key;
+ }
+
+ public function set_consistency_warning(string $warning_language_key)
+ {
+ $this->consistency_warnings[] = array('warning' =>
$warning_language_key);
+ }
+
+ public function get_consistency_warnings()
+ {
+ return $this->consistency_warnings;
+ }
+
+ public function get_validation_warnings()
+ {
+ return $this->validation_warnings;
+ }
+
+ /**
+ * Gets the value of the class attribute with the given name. As such
this function translates from
+ * string to variable.
+ *
+ * @param $field the name of the class attribute to get
+ * @return mixed the value of the attribute
+ */
+ public function get_field($field)
+ {
+ return $this->{"$field"};
+ }
+
+ /**
+ * Sets the value of the class attribute with the given name. As such
this function translates from
+ * string to variable name.
+ *
+ * @param $field the name of the class attribute to set
+ * @param $value the value to set
+ */
+ public function set_field($field, $value)
+ {
+ $this->{"$field"} = $value;
+ }
+
+ public abstract function serialize();
+
+}
+?>
Added: trunk/activitycalendar/inc/model/class.organization.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.organization.inc.php
(rev 0)
+++ trunk/activitycalendar/inc/model/class.organization.inc.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -0,0 +1,81 @@
+<?php
+ include_class('activitycalendar', 'model', 'inc/model/');
+
+ class activitycalendar_organization extends activitycalendar_model
+ {
+ public static $so;
+
+ protected $id;
+ protected $name;
+ protected $description;
+ protected $organization_number;
+ protected $show_in_portal;
+ protected $district;
+
+ /**
+ * Constructor. Takes an optional ID. If a organization 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 organization
+ */
+ 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_name($name)
+ {
+ $this->name = $name;
+ }
+
+ public function get_name() { return $this->name; }
+
+ public function set_description($description)
+ {
+ $this->description = $description;
+ }
+
+ public function get_description() { return $this->description; }
+
+ public function set_organization_number($organization_number)
+ {
+ $this->organization_number = $organization_number;
+ }
+
+ public function get_organization_number() { return
$this->organization_number; }
+
+ public function set_show_in_portal($show_in_portal)
+ {
+ $this->show_in_portal = $show_in_portal;
+ }
+
+ public function get_show_in_portal() { return
$this->show_in_portal; }
+
+ public function set_district($district)
+ {
+ $this->district = $district;
+ }
+
+ public function get_district() { return $this->district; }
+
+ public function serialize()
+ {
+ return array(
+ 'id' => $this->get_id(),
+ 'name' => $this->get_name(),
+ 'organization_number' =>
$this->get_organization_number(),
+ 'district' => $this->get_district(),
+ 'description' => $this->get_description(),
+ 'show_in_portal' => $this->get_show_in_portal()
+ );
+ }
+
+ }
+?>
\ No newline at end of file
Modified: trunk/activitycalendar/setup/setup.inc.php
===================================================================
--- trunk/activitycalendar/setup/setup.inc.php 2011-04-06 19:27:00 UTC (rev
7191)
+++ trunk/activitycalendar/setup/setup.inc.php 2011-04-07 06:23:49 UTC (rev
7192)
@@ -42,8 +42,7 @@
/* The hooks this app includes, needed for hooks registration */
-/* $setup_info['activitycalendar']['hooks'] = array
+ $setup_info['activitycalendar']['hooks'] = array
(
- 'menu' => 'activitycalendar.menu.get_menu',
- 'config'
- );*/
+ 'menu' => 'activitycalendar.menu.get_menu'
+ );
Modified: trunk/activitycalendar/setup/tables_current.inc.php
===================================================================
--- trunk/activitycalendar/setup/tables_current.inc.php 2011-04-06 19:27:00 UTC
(rev 7191)
+++ trunk/activitycalendar/setup/tables_current.inc.php 2011-04-07 06:23:49 UTC
(rev 7192)
@@ -25,7 +25,7 @@
'id' => array('type' => 'auto','precision' =>
4,'nullable' => False),
'internal_arena_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'arena_name' => array('type' =>
'varchar','precision' => '255','nullable' => false),
- 'address' => array('type' =>
'varchar','precision' => '255')
+ 'address' => array('type' =>
'varchar','precision' => '255','nullable' => True)
),
'pk' => array('id'),
'fk' => array(),
Deleted: trunk/activitycalendar/templates/base/activities.php
===================================================================
--- trunk/activitycalendar/templates/base/activities.php 2011-04-06
19:27:00 UTC (rev 7191)
+++ trunk/activitycalendar/templates/base/activities.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -1,136 +0,0 @@
-<?php
-?>
-<table>
- <tr>
-
<th>Navn</th><th>bydel</th><th>kategori</th><th>målgruppe</th><th>arena</th><th>kontor</th><th>epost</th><th>dato
oppdatert</th>
- </tr>
- <tr>
- <td>test</td><td>Fana</td><td>idrett</td><td>alle</td><td>Fana
bydelshus</td><td>Fana</td><td>address@hidden</td><td>2011-03-24</td>
- </tr>
-</table>
-<hr/>
-
-<div class="toolbar-container"><div class="toolbar"><form method="POST"
action="/pe/index.php?menuaction=property.uilocation.index&type_id=1&district_id=&part_of_town_id=&cat_id=&click_history=ed9d0b13fdf51556bfabd136e6d73aee">
-<div style="float:left" class="field"><input id="btn_cat_id" type="button"
name="cat_id" value="Kategori" class="button" tabindex="1"></div>
-<div style="float:left" class="field"><input id="btn_district_id"
type="button" name="district_id" value="Område" class="button"
tabindex="2"></div>
-
-<div style="float:left" class="field"><input id="btn_part_of_town_id"
type="button" name="part_of_town_id" value="Bydel" class="button"
tabindex="3"></div>
-<div style="float:left" class="field"><input id="btn_owner_id" type="button"
name="owner_id" value="Filter" class="button" tabindex="4"></div>
-<div style="float:right" class="field"><a id="btn_columns" href="#"
onclick="Javascript:window.open('/pe/index.php?menuaction=property.uilocation.columns&type_id=1&click_history=ed9d0b13fdf51556bfabd136e6d73aee','','width=300,height=600,scrollbars=1')"
tabindex="9">kolonner</a></div>
-<div style="float:right" class="field"><input id="btn_export" type="button"
name="" value="Last ned" class="button" tabindex="8"></div>
-<div style="float:right" class="field"><input id="type_id" type="hidden"
name="" value="1" class="hidden"></div>
-<div style="float:right" class="field"><input id="btn_search" type="button"
name="search" value="Søk" class="button" tabindex="6"></div>
-<div style="float:right" class="field"><input id="txt_query" type="text"
name="query" value="" class="text" size="28" tabindex="5" onkeypress="return
pulsar(event)"></div>
-<div style="float:right" class="field"><input id="btn_new" type="button"
name="" value="Legg til" class="button" tabindex="7"></div>
-</form></div></div><script type="text/javascript">
- function Exchange_values(data)
- {
-
- }
- </script><br><div id="message"></div><div
id="paging"></div><div class="datatable-container"></div><div
id="datatable-detail"
style="background-color:#000000;color:#FFFFFF;display:none">
-<div class="hd" style="background-color:#000000;color:#000000; border:0;
text-align:center"> Record Detail </div>
-<div class="bd" style="text-align:center;"></div>
-</div><div id="footer"></div>
-<script type="text/javascript">
- var allow_allrows = "1";
-
- var property_js = "/pe/property/js/yahoo/property.js";
-
- var base_java_url =
"{menuaction:'property.uilocation.index',type_id:'1',query:'',district_id:
'',part_of_town_id:'',lookup:'',second_display:1,lookup_tenant:'',lookup_name:'',cat_id:'',status:'',location_code:'',block_query:''}";
-
-
- var json_data =
{"recordsReturned":"10","totalRecords":626,"startIndex":0,"sort":"loc1","dir":"asc","records":[],"integrationurl":"","hidden":{"dependent":[{"id":"","value":"#!no
part of address@hidden address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden address@hidden@6#YTREBYGDA
BYDEL@"}]},"rights":[{"my_name":"view","text":"Kontrakter","action":"\/pe\/index.php?menuaction=rental.uicontract.index&search_type=location_id&contract_status=all&populate_form=yes&click_history=ed9d0b13fdf51556bfabd136e6d73aee","parameters":{"parameter":[{"name":"search_for","source":"location_code"}]}},{"my_name":"view","text":"Vis","action":"\/pe\/index.php?menuaction=property.uilocation.view&click_history=ed9d0b13fdf51556bfabd136e6d73aee","parameters":{"parameter":[{"name":"location_code","source":"location_code"}]}},{"my_name":"view","text":"\u00c5pne
visning i nytt
vindu","action":"\/pe\/index.php?menuaction=property.uilocation.view&target=_blank&click_history=ed9d0b13fdf51556bfabd136e6d73aee","parameters":{"parameter":[{"name":"location_code","source":"location_code"}]}}]};
-
-
- var myColumnDefs = [
-
- {
- key: "location_code",
- label: "dummy",
- resizeable:true,
- sortable: false,
- visible: false,
- format: "hidden",
- formatter: "",
- source: "",
- className: ""
- },
- {
- key: "loc1",
- label: "Eiendom",
- resizeable:true,
- sortable: true,
- visible: true,
- format: "number",
- formatter: "",
- source: "fm_location1.loc1",
- className: ""
- },
- {
- key: "loc1_name",
- label: "Eiendom Navn",
- resizeable:true,
- sortable: false,
- visible: true,
- format: "varchar",
- formatter: "",
- source: "",
- className: ""
- },
- {
- key: "adresse1",
- label: "Adresse1",
- resizeable:true,
- sortable: true,
- visible: true,
- format: "varchar",
- formatter: "",
- source: "adresse1",
- className: ""
- },
- {
- key: "postnummer",
- label: "Postnummer",
- resizeable:true,
- sortable: true,
- visible: true,
- format: "number",
- formatter: "",
- source: "postnummer",
- className: ""
- },
- {
- key: "poststed",
- label: "Poststed",
- resizeable:true,
- sortable: true,
- visible: true,
- format: "varchar",
- formatter: "",
- source: "poststed",
- className: ""
- }
- ];
-
- var values_combo_box = [
-
- {
- id: "values_combo_box_0",
- value: "#Kategori ikke
address@hidden@11#AN01 - ANDRE address@hidden - ANDRE address@hidden EIENDOM
@address@hidden - FESTET address@hidden@14#BY01- address@hidden@15#FR01 -
address@hidden - address@hidden@address@hidden@address@hidden address@hidden -
address@hidden - address@hidden - address@hidden@99#SOLGT/address@hidden -
address@hidden - TRANSFORMATORKIOSK @21#VE01 - VEIGRUNN@"
- },
- {
- id: "values_combo_box_1",
- value: "#Distrikt ikke
address@hidden/address@hidden/address@hidden/address@hidden/address@hidden@"
- },
- {
- id: "values_combo_box_2",
- value: "#Bydel ikke address@hidden
address@hidden address@hidden address@hidden address@hidden address@hidden
address@hidden address@hidden@6#YTREBYGDA BYDEL@"
- },
- {
- id: "values_combo_box_3",
- value: "#vis address@hidden@2#Ekstern@"
- }
- ];
-
-
- </script>
\ No newline at end of file
Added: trunk/activitycalendar/templates/base/activity.php
===================================================================
--- trunk/activitycalendar/templates/base/activity.php
(rev 0)
+++ trunk/activitycalendar/templates/base/activity.php 2011-04-07 06:23:49 UTC
(rev 7192)
@@ -0,0 +1,131 @@
+<?php
+ //include common logic for all templates
+ include("common.php");
+?>
+
+<div class="yui-content">
+ <div id="details">
+ <h1><img src="<?php echo ACTIVITYCALENDAR_TEMPLATE_PATH
?>images/32x32/custom/contact.png" /><?php echo lang('activity') ?></h1>
+ <form action="#" method="post">
+ <input type="hidden" name="id" value="<?php
if($activity->get_id()){ echo $activity->get_id(); } else { echo '0'; } ?>"/>
+ <dl class="proplist-col">
+ <dt>
+ <?php
if($activity->get_organization_id() || $editable) { ?>
+ <label for="organization_id"><?php echo
lang('organization') ?></label>
+ <?php } ?>
+ </dt>
+ <dd>
+ <?php
+ $current_organization_id =
$activity->get_organization_id();
+ if ($editable)
+ {
+ ?>
+ <select name="organization_id">
+ <option>Ingen
organisasjon valgt</option>
+ <?php
+ foreach($organizations
as $organization)
+ {
+ echo "<option
".($current_organization_id == $organization->get_id() ? 'selected="selected"'
: "")."
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
+ }
+ ?>
+ </select>
+ <?php
+ ?>
+ <?php
+ }
+ else
+ {
+ echo
$activity->get_organization_id();
+ }
+ ?>
+ </dd>
+ <dt>
+ <?php if($activity->get_group_id() ||
$editable) { ?>
+ <label for="group_id"><?php echo
lang('group') ?></label>
+ <?php } ?>
+ </dt>
+ <dd>
+ <?php
+ $current_group_id =
$activity->get_group_id();
+ if ($editable)
+ {
+ ?>
+ <select name="group_id">
+ <option>Ingen gruppe
valgt</option>
+ <?php
+ foreach($groups as
$group)
+ {
+ echo "<option
".($current_group_id == $group->get_id() ? 'selected="selected"' : "")."
value=\"{$group->get_id()}\">".$group->get_name()."</option>";
+ }
+ ?>
+ </select>
+ <?php
+ ?>
+ <?php
+ }
+ else
+ {
+ echo $activity->get_group_id();
+ }
+ ?>
+ </dd>
+ <dt>
+ <?php if($activity->get_arena() ||
$editable) { ?>
+ <label for="arena"><?php echo
lang('arena') ?></label>
+ <?php } ?>
+ </dt>
+ <dd>
+ <?php
+ $current_arena_id =
$activity->get_arena();
+ if ($editable)
+ {
+ ?>
+ <select name="arena_id">
+ <option>Ingen arena
valgt</option>
+ <?php
+ foreach($arenas as
$arena)
+ {
+ echo "<option
".($current_arena_id == $arena->get_id() ? 'selected="selected"' : "")."
value=\"{$arena->get_id()}\">".$arena->get_arena_name()."</option>";
+ }
+ ?>
+ </select>
+ <?php
+ }
+ else
+ {
+ echo $activity->get_arena();
+ }
+ ?>
+ </dd>
+ <dt>
+ <?php if($activity->get_district() ||
$editable) { ?>
+ <label for="district"><?php echo
lang('district') ?></label>
+ <?php } ?>
+ </dt>
+ <dd>
+ <?php
+ if ($editable)
+ {
+ ?>
+ <input type="text"
name="district" id="district" value="<?php echo $activity->get_district() ?>" />
+ <?php
+ }
+ else
+ {
+ echo $activity->get_district();
+ }
+ ?>
+ </dd>
+ </dl>
+ <div class="form-buttons">
+ <?php
+ if ($editable) {
+ echo '<input type="submit"
name="save_activity" value="' . lang('save') . '"/>';
+ }
+ ?>
+ </div>
+
+ </form>
+
+ </div>
+</div>
\ No newline at end of file
Copied: trunk/activitycalendar/templates/base/activity_list.php (from rev 7149,
trunk/activitycalendar/templates/base/activities.php)
===================================================================
--- trunk/activitycalendar/templates/base/activity_list.php
(rev 0)
+++ trunk/activitycalendar/templates/base/activity_list.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -0,0 +1,167 @@
+<?php
+ include("common.php");
+?>
+
+<script type="text/javascript">
+
+ YAHOO.util.Event.addListener(
+ 'ctrl_add_activitycalendar_activity',
+ 'click',
+ function(e)
+ {
+ YAHOO.util.Event.stopEvent(e);
+ window.location =
'index.php?menuaction=activitycalendar.uiactivities.add';
+ }
+ );
+</script>
+
+<h1><img src="<?php echo ACTIVITYCALENDAR_TEMPLATE_PATH
?>images/32x32/x-office-address-book.png" /> <?php echo lang('activities')
?></h1>
+
+<fieldset>
+ <input type="submit" name="ctrl_add_activitycalendar_activity"
id="ctrl_add_activitycalendar_activity" value="<?php echo
lang('f_new_activity') ?>" />
+</fieldset>
+
+
+<?php
+ $list_form = true;
+ $list_id = 'all_activities';
+ $url_add_on = '&type=all_activities';
+ include('activity_list_partial.php');
+?>
+
+<hr/>
+<hr/>
+<table>
+ <tr>
+
<th>Navn</th><th>bydel</th><th>kategori</th><th>målgruppe</th><th>arena</th><th>kontor</th><th>epost</th><th>dato
oppdatert</th>
+ </tr>
+ <tr>
+ <td>test</td><td>Fana</td><td>idrett</td><td>alle</td><td>Fana
bydelshus</td><td>Fana</td><td>address@hidden</td><td>2011-03-24</td>
+ </tr>
+</table>
+<hr/>
+
+<div class="toolbar-container"><div class="toolbar"><form method="POST"
action="/pe/index.php?menuaction=property.uilocation.index&type_id=1&district_id=&part_of_town_id=&cat_id=&click_history=ed9d0b13fdf51556bfabd136e6d73aee">
+<div style="float:left" class="field"><input id="btn_cat_id" type="button"
name="cat_id" value="Kategori" class="button" tabindex="1"></div>
+<div style="float:left" class="field"><input id="btn_district_id"
type="button" name="district_id" value="Område" class="button"
tabindex="2"></div>
+
+<div style="float:left" class="field"><input id="btn_part_of_town_id"
type="button" name="part_of_town_id" value="Bydel" class="button"
tabindex="3"></div>
+<div style="float:left" class="field"><input id="btn_owner_id" type="button"
name="owner_id" value="Filter" class="button" tabindex="4"></div>
+<div style="float:right" class="field"><a id="btn_columns" href="#"
onclick="Javascript:window.open('/pe/index.php?menuaction=property.uilocation.columns&type_id=1&click_history=ed9d0b13fdf51556bfabd136e6d73aee','','width=300,height=600,scrollbars=1')"
tabindex="9">kolonner</a></div>
+<div style="float:right" class="field"><input id="btn_export" type="button"
name="" value="Last ned" class="button" tabindex="8"></div>
+<div style="float:right" class="field"><input id="type_id" type="hidden"
name="" value="1" class="hidden"></div>
+<div style="float:right" class="field"><input id="btn_search" type="button"
name="search" value="Søk" class="button" tabindex="6"></div>
+<div style="float:right" class="field"><input id="txt_query" type="text"
name="query" value="" class="text" size="28" tabindex="5" onkeypress="return
pulsar(event)"></div>
+<div style="float:right" class="field"><input id="btn_new" type="button"
name="" value="Legg til" class="button" tabindex="7"></div>
+</form></div></div><script type="text/javascript">
+ function Exchange_values(data)
+ {
+
+ }
+ </script><br><div id="message"></div><div
id="paging"></div><div class="datatable-container"></div><div
id="datatable-detail"
style="background-color:#000000;color:#FFFFFF;display:none">
+<div class="hd" style="background-color:#000000;color:#000000; border:0;
text-align:center"> Record Detail </div>
+<div class="bd" style="text-align:center;"></div>
+</div><div id="footer"></div>
+<script type="text/javascript">
+ var allow_allrows = "1";
+
+ var property_js = "/pe/property/js/yahoo/property.js";
+
+ var base_java_url =
"{menuaction:'property.uilocation.index',type_id:'1',query:'',district_id:
'',part_of_town_id:'',lookup:'',second_display:1,lookup_tenant:'',lookup_name:'',cat_id:'',status:'',location_code:'',block_query:''}";
+
+
+ var json_data =
{"recordsReturned":"10","totalRecords":626,"startIndex":0,"sort":"loc1","dir":"asc","records":[],"integrationurl":"","hidden":{"dependent":[{"id":"","value":"#!no
part of address@hidden address@hidden address@hidden address@hidden
address@hidden address@hidden address@hidden address@hidden@6#YTREBYGDA
BYDEL@"}]},"rights":[{"my_name":"view","text":"Kontrakter","action":"\/pe\/index.php?menuaction=rental.uicontract.index&search_type=location_id&contract_status=all&populate_form=yes&click_history=ed9d0b13fdf51556bfabd136e6d73aee","parameters":{"parameter":[{"name":"search_for","source":"location_code"}]}},{"my_name":"view","text":"Vis","action":"\/pe\/index.php?menuaction=property.uilocation.view&click_history=ed9d0b13fdf51556bfabd136e6d73aee","parameters":{"parameter":[{"name":"location_code","source":"location_code"}]}},{"my_name":"view","text":"\u00c5pne
visning i nytt
vindu","action":"\/pe\/index.php?menuaction=property.uilocation.view&target=_blank&click_history=ed9d0b13fdf51556bfabd136e6d73aee","parameters":{"parameter":[{"name":"location_code","source":"location_code"}]}}]};
+
+
+ var myColumnDefs = [
+
+ {
+ key: "location_code",
+ label: "dummy",
+ resizeable:true,
+ sortable: false,
+ visible: false,
+ format: "hidden",
+ formatter: "",
+ source: "",
+ className: ""
+ },
+ {
+ key: "loc1",
+ label: "Eiendom",
+ resizeable:true,
+ sortable: true,
+ visible: true,
+ format: "number",
+ formatter: "",
+ source: "fm_location1.loc1",
+ className: ""
+ },
+ {
+ key: "loc1_name",
+ label: "Eiendom Navn",
+ resizeable:true,
+ sortable: false,
+ visible: true,
+ format: "varchar",
+ formatter: "",
+ source: "",
+ className: ""
+ },
+ {
+ key: "adresse1",
+ label: "Adresse1",
+ resizeable:true,
+ sortable: true,
+ visible: true,
+ format: "varchar",
+ formatter: "",
+ source: "adresse1",
+ className: ""
+ },
+ {
+ key: "postnummer",
+ label: "Postnummer",
+ resizeable:true,
+ sortable: true,
+ visible: true,
+ format: "number",
+ formatter: "",
+ source: "postnummer",
+ className: ""
+ },
+ {
+ key: "poststed",
+ label: "Poststed",
+ resizeable:true,
+ sortable: true,
+ visible: true,
+ format: "varchar",
+ formatter: "",
+ source: "poststed",
+ className: ""
+ }
+ ];
+
+ var values_combo_box = [
+
+ {
+ id: "values_combo_box_0",
+ value: "#Kategori ikke
address@hidden@11#AN01 - ANDRE address@hidden - ANDRE address@hidden EIENDOM
@address@hidden - FESTET address@hidden@14#BY01- address@hidden@15#FR01 -
address@hidden - address@hidden@address@hidden@address@hidden address@hidden -
address@hidden - address@hidden - address@hidden@99#SOLGT/address@hidden -
address@hidden - TRANSFORMATORKIOSK @21#VE01 - VEIGRUNN@"
+ },
+ {
+ id: "values_combo_box_1",
+ value: "#Distrikt ikke
address@hidden/address@hidden/address@hidden/address@hidden/address@hidden@"
+ },
+ {
+ id: "values_combo_box_2",
+ value: "#Bydel ikke address@hidden
address@hidden address@hidden address@hidden address@hidden address@hidden
address@hidden address@hidden@6#YTREBYGDA BYDEL@"
+ },
+ {
+ id: "values_combo_box_3",
+ value: "#vis address@hidden@2#Ekstern@"
+ }
+ ];
+
+
+ </script>
\ No newline at end of file
Added: trunk/activitycalendar/templates/base/activity_list_partial.php
===================================================================
--- trunk/activitycalendar/templates/base/activity_list_partial.php
(rev 0)
+++ trunk/activitycalendar/templates/base/activity_list_partial.php
2011-04-07 06:23:49 UTC (rev 7192)
@@ -0,0 +1,129 @@
+<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=activitycalendar.uiactivities.index';
+ }
+ );
+
+ // Defining columns for datatable
+ var columnDefs = [{
+ key: "id",
+ label: "<?php echo lang('id') ?>",
+ sortable: true
+ },
+ {
+ key: "arena_name",
+ label: "<?php echo lang('name') ?>",
+ sortable: true
+ },
+ {
+ key: "internal_arena_id",
+ label: "<?php echo lang('internal_arena_id') ?>",
+ sortable: true
+ },
+ {
+ key: "address",
+ label: "<?php echo lang('address') ?>",
+ sortable: true
+ },
+ {
+ key: "actions",
+ hidden: true
+ },
+ {
+ key: "labels",
+ hidden: true
+ },
+ {
+ key: "ajax",
+ hidden: true
+ }
+ ];
+
+ <?php
+ if(isset($extra_cols)){
+ foreach($extra_cols as $col){
+ $literal = "{key: \"".$col["key"]."\",
+ label: \"".$col["label"]."\"}";
+ if($col["index"]){
+ echo
"columnDefs.splice(".$col["index"].", 0,".$literal.");";
+ } else {
+ echo "columnDefs.push($literal);";
+ }
+ }
+ }
+ ?>
+
+ // Initiating the data source
+ setDataSource(
+
'index.php?menuaction=activitycalendar.uiactivities.query&phpgw_return_as=json<?php
echo $url_add_on; ?>&editable=<?php echo $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)){
+ foreach($related as $r){
+ echo "\"".$r."\"";
+ }
+ }
+ ?>)
+ );
+
+ function activity_export(ptype) {
+
+ var query = document.getElementById('<?php echo $list_id
?>_ctrl_search_query').value;
+ <?php
+ /* FIXME Search queries will affect ALL data tables listed on one page
(of that type) when exporting
+ * even though the search only affects one of the data tables.
+ * F.ex on /index.php?menuaction=rental.uicontract.edit&id=1 -> Parties
+ */
+ ?>
+
+ window.location =
'index.php?menuaction=activitycalendar.uiactivities.download'+
+ '<?php echo $url_add_on; ?>'+
+ '&query='+query+
+ '&search_option='+sOption+
+ '&export=true';
+ }
+
+</script>
+<?php
+ if($list_form)
+ {
+?>
+
+<form id="<?php echo $list_id ?>_form" method="GET">
+ <fieldset>
+ <!-- Search -->
+ <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>
+
+ <fieldset>
+ <!-- Filters -->
+ <label class="toolbar_element_label"
for="ctrl_toggle_activity_type"><?php echo lang('activity_type') ?></label>
+ <select name="activity_type" id="<?php echo $list_id
?>_ctrl_toggle_activity_type">
+ <option value="all"><?php echo lang('all') ?></option>
+ <option value="1"><?php echo lang('internal')
?></option>
+ <option value="2" ><?php echo lang('not_internal')
?></option>
+ </select>
+ </fieldset>
+
+
+</form>
+<?php
+ }
+?>
+
+<div id="<?php echo $list_id ?>_paginator" class="paginator"></div>
+<div id="<?php echo $list_id ?>_container" class="datatable_container"></div>
Deleted: trunk/activitycalendar/templates/base/arena.php
===================================================================
--- trunk/activitycalendar/templates/base/arena.php 2011-04-06 19:27:00 UTC
(rev 7191)
+++ trunk/activitycalendar/templates/base/arena.php 2011-04-07 06:23:49 UTC
(rev 7192)
@@ -1,3 +0,0 @@
-<?php
-?>
-<h1>Dette er en test</h1>
\ No newline at end of file
Added: trunk/activitycalendar/templates/base/arena.php
===================================================================
--- trunk/activitycalendar/templates/base/arena.php
(rev 0)
+++ trunk/activitycalendar/templates/base/arena.php 2011-04-07 06:23:49 UTC
(rev 7192)
@@ -0,0 +1,88 @@
+<?php
+ //include common logic for all templates
+ include("common.php");
+?>
+
+<div class="identifier-header">
+ <h1><img src="<?php echo ACTIVITYCALENDAR_TEMPLATE_PATH
?>images/32x32/custom/contact.png" /><?php echo lang('arena') ?></h1>
+ <div>
+ <label><?php echo lang('name'); ?></label>
+ <?php if($arena->get_arena_name()){ echo
$arena->get_arena_name(); } else { echo lang('no_value'); }?>
+ </div>
+</div>
+<div class="yui-content">
+ <div id="details">
+ <form action="#" method="post">
+ <input type="hidden" name="id" value="<?php
if($arena->get_id()){ echo $arena->get_id(); } else { echo '0'; } ?>"/>
+ <dl class="proplist-col">
+ <dt>
+ <?php if($arena->get_arena_name() ||
$editable) { ?>
+ <label for="name"><?php echo
lang('name') ?></label>
+ <?php } ?>
+ </dt>
+ <dd>
+ <?php
+ if ($editable)
+ {
+ ?>
+ <input type="text"
name="arena_name" id="arena_name" value="<?php echo $arena->get_arena_name()
?>" />
+ <?php
+ }
+ else
+ {
+ echo $arena->get_arena_name();
+ }
+ ?>
+ </dd>
+ <dt>
+ <?php
if($arena->get_internal_arena_id() || $editable) { ?>
+ <label for="internal_arena_id"><?php
echo lang('internal_arena_id') ?></label>
+ <?php } ?>
+ </dt>
+ <dd>
+ <?php
+ if ($editable)
+ {
+ ?>
+ <input type="text"
name="internal_arena_id" id="internal_arena_id" value="<?php echo
$arena->get_internal_arena_id() ?>" />
+ <?php
+ }
+ else
+ {
+ echo
$arena->get_internal_arena_id();
+ }
+ ?>
+ </dd>
+ <dt>
+ <?php if($arena->get_address() ||
$editable) { ?>
+ <label for="address"><?php echo
lang('address') ?></label>
+ <?php } ?>
+ </dt>
+ <dd>
+ <?php
+ if ($editable)
+ {
+ ?>
+ <input type="text"
name="address" id="address" value="<?php echo $arena->get_address() ?>" />
+ <?php
+ }
+ else
+ {
+ echo $arena->get_address();
+ }
+ ?>
+ </dd>
+ </dl>
+ <div class="form-buttons">
+ <?php
+ if ($editable) {
+ echo '<input type="submit"
name="save_arena" value="' . lang('save') . '"/>';
+ }
+ ?>
+ </div>
+
+ </form>
+
+ </div>
+</div>
+
Copied: trunk/activitycalendar/templates/base/arena_list.php (from rev 7149,
trunk/activitycalendar/templates/base/arena.php)
===================================================================
--- trunk/activitycalendar/templates/base/arena_list.php
(rev 0)
+++ trunk/activitycalendar/templates/base/arena_list.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -0,0 +1,30 @@
+<?php
+ include("common.php");
+?>
+
+<script type="text/javascript">
+
+ YAHOO.util.Event.addListener(
+ 'ctrl_add_activitycalendar_arena',
+ 'click',
+ function(e)
+ {
+ YAHOO.util.Event.stopEvent(e);
+ window.location =
'index.php?menuaction=activitycalendar.uiarena.add';
+ }
+ );
+</script>
+
+<h1><img src="<?php echo ACTIVITYCALENDAR_TEMPLATE_PATH
?>images/32x32/x-office-address-book.png" /> <?php echo lang('arenas') ?></h1>
+
+<fieldset>
+ <input type="submit" name="ctrl_add_activitycalendar_arena"
id="ctrl_add_activitycalendar_arena" value="<?php echo lang('f_new_arena') ?>"
/>
+</fieldset>
+
+
+<?php
+ $list_form = true;
+ $list_id = 'all_arenas';
+ $url_add_on = '&type=all_arenas';
+ include('arena_list_partial.php');
+?>
\ No newline at end of file
Added: trunk/activitycalendar/templates/base/arena_list_partial.php
===================================================================
--- trunk/activitycalendar/templates/base/arena_list_partial.php
(rev 0)
+++ trunk/activitycalendar/templates/base/arena_list_partial.php
2011-04-07 06:23:49 UTC (rev 7192)
@@ -0,0 +1,146 @@
+<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=activitycalendar.uiarena.index';
+ }
+ );
+
+ // Defining columns for datatable
+ var columnDefs = [{
+ key: "id",
+ label: "<?php echo lang('id') ?>",
+ sortable: true
+ },
+ {
+ key: "arena_name",
+ label: "<?php echo lang('name') ?>",
+ sortable: true
+ },
+ {
+ key: "internal_arena_id",
+ label: "<?php echo lang('internal_arena_id') ?>",
+ sortable: true
+ },
+ {
+ key: "address",
+ label: "<?php echo lang('address') ?>",
+ sortable: true
+ },
+ {
+ key: "actions",
+ hidden: true
+ },
+ {
+ key: "labels",
+ hidden: true
+ },
+ {
+ key: "ajax",
+ hidden: true
+ }
+ ];
+
+ <?php
+ if(isset($extra_cols)){
+ foreach($extra_cols as $col){
+ $literal = "{key: \"".$col["key"]."\",
+ label: \"".$col["label"]."\"}";
+ if($col["index"]){
+ echo
"columnDefs.splice(".$col["index"].", 0,".$literal.");";
+ } else {
+ echo "columnDefs.push($literal);";
+ }
+ }
+ }
+ ?>
+
+ // Initiating the data source
+ setDataSource(
+
'index.php?menuaction=activitycalendar.uiarena.query&phpgw_return_as=json<?php
echo $url_add_on; ?>&editable=<?php echo $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)){
+ foreach($related as $r){
+ echo "\"".$r."\"";
+ }
+ }
+ ?>)
+ );
+
+ function arena_export(ptype) {
+
+ var query = document.getElementById('<?php echo $list_id
?>_ctrl_search_query').value;
+ <?php
+ /* FIXME Search queries will affect ALL data tables listed on one page
(of that type) when exporting
+ * even though the search only affects one of the data tables.
+ * F.ex on /index.php?menuaction=rental.uicontract.edit&id=1 -> Parties
+ */
+ ?>
+
+ window.location =
'index.php?menuaction=activitycalendar.uiarena.download'+
+ '<?php echo $url_add_on; ?>'+
+ '&query='+query+
+ '&search_option='+sOption+
+ '&export=true';
+ }
+
+</script>
+<?php
+ if($list_form)
+ {
+?>
+
+<form id="<?php echo $list_id ?>_form" method="GET">
+ <fieldset>
+ <!-- Search -->
+ <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>
+
+ <fieldset>
+ <!-- Filters -->
+ <label class="toolbar_element_label"
for="ctrl_toggle_arena_type"><?php echo lang('arena_type') ?></label>
+ <select name="arena_type" id="<?php echo $list_id
?>_ctrl_toggle_arena_type">
+ <option value="all"><?php echo lang('all') ?></option>
+ <option value="1"><?php echo lang('internal')
?></option>
+ <option value="2" ><?php echo lang('not_internal')
?></option>
+ </select>
+ <label class="toolbar_element_label" for="<?php echo $list_id
?>_ctrl_toggle_active"><?php echo lang('marked_as') ?></label>
+ <select name="active" id="<?php echo $list_id
?>_ctrl_toggle_active">
+ <option value="all"><?php echo
lang('not_available_nor_hidden') ?></option>
+ <option value="active"><?php echo
lang('available_for_pick') ?></option>
+ <option value="inactive"><?php echo
lang('hidden_for_pick') ?></option>
+ </select>
+ </fieldset>
+
+
+</form>
+<?php
+ }
+?>
+<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:arena_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>
+ &nbsp;&nbsp;
+ <a href="index.php?menuaction=rental.uiarena.download_agresso"
title="<?php echo lang('Download Agresso import file') ?>"><img src="<?php echo
RENTAL_TEMPLATE_PATH ?>images/16x16/mimetypes/x-office-document.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>
Modified: trunk/activitycalendar/templates/base/organization_list.php
===================================================================
--- trunk/activitycalendar/templates/base/organization_list.php 2011-04-06
19:27:00 UTC (rev 7191)
+++ trunk/activitycalendar/templates/base/organization_list.php 2011-04-07
06:23:49 UTC (rev 7192)
@@ -2,13 +2,11 @@
include("common.php");
?>
-<?php //echo activitycalendar_uicommon::get_page_error($error) ?>
-<?php //echo activitycalendar_uicommon::get_page_message($message) ?>
-
<h1><img src="<?php echo RENTAL_TEMPLATE_PATH
?>images/32x32/x-office-address-book.png" /> <?php echo lang('organizations')
?></h1>
<?php
+echo "tester";
$list_form = true;
$list_id = 'all_organizations';
$url_add_on = '&type=all_organizations';
Modified: trunk/activitycalendar/templates/base/organization_list_partial.php
===================================================================
--- trunk/activitycalendar/templates/base/organization_list_partial.php
2011-04-06 19:27:00 UTC (rev 7191)
+++ trunk/activitycalendar/templates/base/organization_list_partial.php
2011-04-07 06:23:49 UTC (rev 7192)
@@ -1,19 +1,19 @@
<script type="text/javascript">
//Add listener resetting form: redirects browser to call index again
-/* YAHOO.util.Event.addListener(
+ YAHOO.util.Event.addListener(
'ctrl_reset_button',
'click',
function(e)
{
YAHOO.util.Event.stopEvent(e);
- window.location =
'index.php?menuaction=activitycalendar.uiorganizationlist.index';
+ window.location =
'index.php?menuaction=activitycalendar.uiorganization.index';
}
);
-*/
+
// Defining columns for datatable
var columnDefs = [{
- key: "identifier",
- label: "<?php echo lang('identifier') ?>",
+ key: "organization_number",
+ label: "<?php echo lang('organization_number') ?>",
sortable: true
},
{
@@ -22,11 +22,16 @@
sortable: true
},
{
- key: "address",
- label: "<?php echo lang('address') ?>",
+ key: "district",
+ label: "<?php echo lang('district') ?>",
sortable: true
},
{
+ key: "description",
+ label: "<?php echo lang('description') ?>",
+ sortable: true
+ },
+ {
key: "actions",
hidden: true
},
@@ -56,10 +61,10 @@
// Initiating the data source
setDataSource(
-
'index.php?menuaction=activitycalendar.uiorganizationlist.query&phpgw_return_as=json<?php
echo $url_add_on; ?>&editable=<?php echo $editable ? "true" : "false"; ?>',
+
'index.php?menuaction=activitycalendar.uiorganization.query&phpgw_return_as=json<?php
echo $url_add_on; ?>&editable=<?php echo $editable ? "true" : "false"; ?>',
columnDefs,
'<?php echo $list_id ?>_form',
- ['<?php echo $list_id ?>_ctrl_toggle_active','<?php echo
$list_id ?>_ctrl_toggle_party_type','<?php echo $list_id
?>_ctrl_toggle_party_fields','<?php echo $list_id ?>_ctrl_search_query'],
+ ['<?php echo $list_id ?>_ctrl_search_query'],
'<?php echo $list_id ?>_container',
'<?php echo $list_id ?>_paginator',
'<?php echo $list_id ?>',
@@ -72,33 +77,6 @@
?>)
);
- function party_export(ptype) {
- var select = document.getElementById('<?php echo $list_id
?>_ctrl_toggle_organization_type');
- var pType = select.options[select.selectedIndex].value;
-
- var sSelect = document.getElementById('<?php echo $list_id
?>_ctrl_toggle_organization_fields');
- var sOption = sSelect.options[sSelect.selectedIndex].value;
-
- var statusSelect = document.getElementById('<?php echo $list_id
?>_ctrl_toggle_active');
- var pStatus = statusSelect.options[statusSelect.selectedIndex].value;
-
- var query = document.getElementById('<?php echo $list_id
?>_ctrl_search_query').value;
- <?php
- /* FIXME Search queries will affect ALL data tables listed on one page
(of that type) when exporting
- * even though the search only affects one of the data tables.
- * F.ex on /index.php?menuaction=rental.uicontract.edit&id=1 -> Parties
- */
- ?>
-
- window.location =
'index.php?menuaction=activitycalendar.uiorganizationlist.download'+
- '&organization_type='+pType+
- '<?php echo $url_add_on; ?>'+
- '&active='+pStatus+
- '&query='+query+
- '&search_option='+sOption+
- '&export=true';
- }
-
</script>
<?php
if($list_form)
@@ -110,57 +88,13 @@
<!-- Search -->
<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 :
''?>"/>
- <label class="toolbar_element_label"
for="ctrl_toggle_organizationlist_fields"><?php echo lang('search_where')
?>&nbsp;
- <select name="search_option" id="<?php echo $list_id
?>_ctrl_toggle_organizationlist_fields">
- <option value="all" <?php echo ($s_type ==
'all') ? 'selected' : ''?>><?php echo lang('all') ?></option>
- <option value="name" <?php echo ($s_type ==
'name') ? 'selected' : ''?>><?php echo lang('name') ?></option>
- <option value="address" <?php echo ($s_type ==
'address') ? 'selected' : ''?>><?php echo lang('address') ?></option>
- <option value="identifier" <?php echo ($s_type
== 'identifier') ? 'selected' : ''?>><?php echo lang('Identifier') ?></option>
- <option value="reskontro" <?php echo ($s_type
== 'reskontro') ? 'selected' : ''?>><?php echo lang('reskontro') ?></option>
- <option value="result_unit_number" <?php echo
($s_type == 'result_unit_number') ? 'selected' : ''?>><?php echo
lang('result_unit_number') ?></option>
- </select>
- </label>
<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>
-
- <fieldset>
- <!-- Filters -->
- <label class="toolbar_element_label"
for="ctrl_toggle_organizationlist_type"><?php echo lang('part_of_contract')
?></label>
- <select name="party_type" id="<?php echo $list_id
?>_ctrl_toggle_party_type">
- <option value="all"><?php echo lang('all') ?></option>
- <?php
- $types =
rental_socontract::get_instance()->get_fields_of_responsibility();
- foreach($types as $id => $label)
- {
- ?><option value="<?php echo $id ?>" <?php echo
($p_type == $id) ? 'selected' : ''?>><?php echo lang($label) ?></option><?php
- }
- ?>
- </select>
- <label class="toolbar_element_label" for="<?php echo $list_id
?>_ctrl_toggle_active"><?php echo lang('marked_as') ?></label>
- <select name="active" id="<?php echo $list_id
?>_ctrl_toggle_active">
- <option value="all" <?php echo ($status == 'all') ?
'selected' : ''?>><?php echo lang('not_available_nor_hidden') ?></option>
- <option value="active" <?php echo ($status == 'active')
? 'selected' : ''?>><?php echo lang('available_for_pick') ?></option>
- <option value="inactive" <?php echo ($status ==
'inactive') ? 'selected' : ''?>><?php echo lang('hidden_for_pick') ?></option>
- </select>
- </fieldset>
-
-
</form>
<?php
}
?>
-<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:party_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>
- &nbsp;&nbsp;
- <a href="index.php?menuaction=rental.uiparty.download_agresso"
title="<?php echo lang('Download Agresso import file') ?>"><img src="<?php echo
RENTAL_TEMPLATE_PATH ?>images/16x16/mimetypes/x-office-document.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>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7192] added model-files,
Erik Holm-Larsen <=