[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10180] rename classes and files according to databas
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [10180] rename classes and files according to database tables |
Date: |
Tue, 09 Oct 2012 12:36:19 +0000 |
Revision: 10180
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10180
Author: erikhl
Date: 2012-10-09 12:36:18 +0000 (Tue, 09 Oct 2012)
Log Message:
-----------
rename classes and files according to database tables
Added Paths:
-----------
trunk/logistic/inc/class.soresource_type_requirement.inc.php
trunk/logistic/inc/class.uiresource_type_requirement.inc.php
trunk/logistic/inc/model/class.resource_type_requirement.inc.php
trunk/logistic/js/logistic/resource_type_requirement.js
trunk/logistic/templates/base/resource_type_requirement_item.xsl
Removed Paths:
-------------
trunk/logistic/inc/class.sobim_type_requirement.inc.php
trunk/logistic/inc/class.uibim_type_requirement.inc.php
trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php
trunk/logistic/js/logistic/bim_type_requirement.js
trunk/logistic/templates/base/bim_type_requirement_item.xsl
Deleted: trunk/logistic/inc/class.sobim_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/class.sobim_type_requirement.inc.php 2012-10-09
12:32:33 UTC (rev 10179)
+++ trunk/logistic/inc/class.sobim_type_requirement.inc.php 2012-10-09
12:36:18 UTC (rev 10180)
@@ -1,188 +0,0 @@
-<?php
-
- /**
- * phpGroupWare - logistic: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/
- * @package property
- * @subpackage logistic
- * @version $Id: class.soproject.inc.php 10111 2012-10-04 08:53:35Z
erikhl $
- */
-
- phpgw::import_class('logistic.socommon');
-
- include_class('logistic', 'bim_item_type_requirement', 'inc/model/');
-
- class logistic_sobim_type_requirement extends logistic_socommon
- {
- protected static $so;
- private $local_db;
-
- public function __construct()
- {
- parent::__construct();
- $this->local_db = clone $this->db;
- }
-
- protected function add(&$object)
- {
- $user_id = $GLOBALS['phpgw_info']['user']['id'];
- $now = time();
- $entity_id = $object->get_entity_id();
- $category_id = $object->get_category_id();
- $cust_attribute_id = $object->get_cust_attribute_id();
- $type_id = $object->get_project_type_id();
-
- $sql = "INSERT INTO lg_bim_item_type_requirement
(entity_id, category_id, cust_attribute_id, project_type_id, create_user,
create_date) VALUES ($entity_id,$category_id,'$cust_attribute_id',$type_id,
$user_id, $now)";
- $result = $this->db->query($sql, __LINE__,__FILE__);
-
- if($result)
- {
- // Set the new bim_item_type_requirement ID
- return
$this->db->get_last_insert_id('lg_bim_item_type_requirement', 'id');
- }
- else
- {
- return 0;
- }
- }
-
- protected function get_id_field_name()
- {
- if(!$extended_info)
- {
- $ret = 'id';
- }
- else
- {
- $ret = array
- (
- 'table' =>
'type_requirement', // alias
- 'field' => 'id',
- 'translated' => 'id'
- );
- }
-
- return $ret;
- }
-
- protected function get_query(string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count)
- {
- $clauses = array('1=1');
-
- /*if($search_for)
- {
- $like_pattern = "'%" .
$this->db->db_addslashes($search_for) . "%'";
- $like_clauses = array();
- switch($search_type)
- {
- default:
- $like_clauses[] =
"{$table_alias}.name $this->like $like_pattern";
- break;
- }
- if(count($like_clauses))
- {
- $clauses[] = '(' . join(' OR ',
$like_clauses) . ')';
- }
- }*/
-
- $filter_clauses = array();
- if(isset($filters[$this->get_id_field_name()]))
- {
- $filter_clauses[] = "type_requirement.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
- }
-
- if(count($filter_clauses))
- {
- $clauses[] = join(' AND ', $filter_clauses);
- }
-
- $condition = join(' AND ', $clauses);
-
- //$joins = " {$this->left_join} controller_control_area
ON (controller_procedure.control_area_id = controller_control_area.id)";
-
- $tables = "lg_bim_item_type_requirement
type_requirement";
-
- if($return_count) // We should only return a count
- {
- $cols = 'COUNT(DISTINCT(type_requirement.id))
AS count';
- }
- else
- {
- $cols .= "type_requirement.* ";
- }
-
- $dir = $ascending ? 'ASC' : 'DESC';
- $order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir ": '';
-
- //var_dump("SELECT {$cols} FROM {$tables} {$joins}
WHERE {$condition} {$order}");
-
- return "SELECT {$cols} FROM {$tables} WHERE
{$condition} {$order}";
- }
-
- protected function populate(int $req_id,
&$bim_item_type_requirement)
- {
- if($bim_item_type_requirement == null)
- {
- $bim_item_type_requirement = new
logistic_bim_item_type_requirement((int) $req_id);
-
-
$bim_item_type_requirement->set_entity_id($this->unmarshal($this->db->f('entity_id'),
'int'));
-
$bim_item_type_requirement->set_category_id($this->unmarshal($this->db->f('category_id'),
'int'));
-
$bim_item_type_requirement->set_cust_attribute_id($this->unmarshal($this->db->f('cust_attribute_id'),
'string'));
-
$bim_item_type_requirement->set_project_type_id($this->unmarshal($this->db->f('project_type_id'),
'int'));
- }
-
- return $bim_item_type_requirement;
- }
-
- protected function update($object)
- {
- $id = intval($object->get_id());
-
- $values = array(
- 'entity_id = ' .
$this->marshal($object->get_entity_id(), 'int'),
- 'category_id = ' .
$this->marshal($object->get_category_id(), 'int'),
- 'cust_attribute_id = ' .
$this->marshal($object->get_cust_attribute_id(), 'string'),
- 'project_type_id = ' .
$this->marshal($object->get_project_type_id(), 'int')
- );
-
- $result = $this->db->query('UPDATE
lg_bim_item_type_requirement SET ' . join(',', $values) . " WHERE id=$id",
__LINE__,__FILE__);
-
- if( $result )
- {
- return $id;
- }
- else
- {
- return 0;
- }
- }
-
- public static function get_instance()
- {
- if (self::$so == null)
- {
- self::$so =
CreateObject('logistic.sobim_type_requirement');
- }
- return self::$so;
- }
- }
Copied: trunk/logistic/inc/class.soresource_type_requirement.inc.php (from rev
10159, trunk/logistic/inc/class.sobim_type_requirement.inc.php)
===================================================================
--- trunk/logistic/inc/class.soresource_type_requirement.inc.php
(rev 0)
+++ trunk/logistic/inc/class.soresource_type_requirement.inc.php
2012-10-09 12:36:18 UTC (rev 10180)
@@ -0,0 +1,185 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage logistic
+ * @version $Id: class.soproject.inc.php 10111 2012-10-04 08:53:35Z
erikhl $
+ */
+
+ phpgw::import_class('logistic.socommon');
+
+ include_class('logistic', 'resource_type_requirement', 'inc/model/');
+
+ class logistic_soresource_type_requirement extends logistic_socommon
+ {
+ protected static $so;
+ private $local_db;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->local_db = clone $this->db;
+ }
+
+ protected function add(&$object)
+ {
+ $user_id = $GLOBALS['phpgw_info']['user']['id'];
+ $now = time();
+ $location_id = $object->get_location_id();
+ $cust_attribute_id = $object->get_cust_attribute_id();
+ $type_id = $object->get_project_type_id();
+
+ $sql = "INSERT INTO lg_resource_type_requirement
(location_id, cust_attribute_id, project_type_id, create_user, create_date)
VALUES ($location_id,$cust_attribute_id,$type_id, $user_id, $now)";
+ $result = $this->db->query($sql, __LINE__,__FILE__);
+
+ if($result)
+ {
+ // Set the new bim_item_type_requirement ID
+ return
$this->db->get_last_insert_id('lg_resource_type_requirement', 'id');
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ protected function get_id_field_name()
+ {
+ if(!$extended_info)
+ {
+ $ret = 'id';
+ }
+ else
+ {
+ $ret = array
+ (
+ 'table' =>
'type_requirement', // alias
+ 'field' => 'id',
+ 'translated' => 'id'
+ );
+ }
+
+ return $ret;
+ }
+
+ protected function get_query(string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count)
+ {
+ $clauses = array('1=1');
+
+ /*if($search_for)
+ {
+ $like_pattern = "'%" .
$this->db->db_addslashes($search_for) . "%'";
+ $like_clauses = array();
+ switch($search_type)
+ {
+ default:
+ $like_clauses[] =
"{$table_alias}.name $this->like $like_pattern";
+ break;
+ }
+ if(count($like_clauses))
+ {
+ $clauses[] = '(' . join(' OR ',
$like_clauses) . ')';
+ }
+ }*/
+
+ $filter_clauses = array();
+ if(isset($filters[$this->get_id_field_name()]))
+ {
+ $filter_clauses[] = "type_requirement.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+ }
+
+ if(count($filter_clauses))
+ {
+ $clauses[] = join(' AND ', $filter_clauses);
+ }
+
+ $condition = join(' AND ', $clauses);
+
+ //$joins = " {$this->left_join} controller_control_area
ON (controller_procedure.control_area_id = controller_control_area.id)";
+
+ $tables = "lg_resource_type_requirement
type_requirement";
+
+ if($return_count) // We should only return a count
+ {
+ $cols = 'COUNT(DISTINCT(type_requirement.id))
AS count';
+ }
+ else
+ {
+ $cols .= "type_requirement.* ";
+ }
+
+ $dir = $ascending ? 'ASC' : 'DESC';
+ $order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir ": '';
+
+ //var_dump("SELECT {$cols} FROM {$tables} {$joins}
WHERE {$condition} {$order}");
+
+ return "SELECT {$cols} FROM {$tables} WHERE
{$condition} {$order}";
+ }
+
+ protected function populate(int $req_id,
&$resource_type_requirement)
+ {
+ if($resource_type_requirement == null)
+ {
+ $resource_type_requirement = new
logistic_resource_type_requirement((int) $req_id);
+
+
$resource_type_requirement->set_location_id($this->unmarshal($this->db->f('location_id'),
'int'));
+
$resource_type_requirement->set_cust_attribute_id($this->unmarshal($this->db->f('cust_attribute_id'),
'string'));
+
$resource_type_requirement->set_project_type_id($this->unmarshal($this->db->f('project_type_id'),
'int'));
+ }
+
+ return $resource_type_requirement;
+ }
+
+ protected function update($object)
+ {
+ $id = intval($object->get_id());
+
+ $values = array(
+ 'location_id = ' .
$this->marshal($object->get_location_id(), 'int'),
+ 'cust_attribute_id = ' .
$this->marshal($object->get_cust_attribute_id(), 'int'),
+ 'project_type_id = ' .
$this->marshal($object->get_project_type_id(), 'int')
+ );
+
+ $result = $this->db->query('UPDATE
lg_resource_type_requirement SET ' . join(',', $values) . " WHERE id=$id",
__LINE__,__FILE__);
+
+ if( $result )
+ {
+ return $id;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public static function get_instance()
+ {
+ if (self::$so == null)
+ {
+ self::$so =
CreateObject('logistic.soresource_type_requirement');
+ }
+ return self::$so;
+ }
+ }
Deleted: trunk/logistic/inc/class.uibim_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uibim_type_requirement.inc.php 2012-10-09
12:32:33 UTC (rev 10179)
+++ trunk/logistic/inc/class.uibim_type_requirement.inc.php 2012-10-09
12:36:18 UTC (rev 10180)
@@ -1,384 +0,0 @@
-<?php
-
- /**
- * phpGroupWare - logistic: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/
- * @package property
- * @subpackage logistic
- * @version $Id$
- */
-
- phpgw::import_class('phpgwapi.jquery');
- phpgw::import_class('phpgwapi.uicommon');
- phpgw::import_class('logistic.soproject');
-
- include_class('logistic', 'project');
-
- class logistic_uibim_type_requirement extends phpgwapi_uicommon
- {
-
- private $so;
- private $so_project;
- public $public_functions = array(
-
- 'query' => true,
- 'index' => true,
- 'edit' => true,
- 'add' => true,
- 'view' => true,
- 'get_bim_level1' => true,
- 'get_bim_level2' => true
- );
-
- public function __construct()
- {
- parent::__construct();
-
- $this->so =
CreateObject('logistic.sobim_type_requirement');
- $this->so_project = CreateObject('logistic.soproject');
-
- $read = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_READ, 'logistic');//1
- $add = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_ADD, 'logistic');//2
- $edit = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_EDIT, 'logistic');//4
- $delete = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_DELETE, 'logistic');//8
-
- $manage = $GLOBALS['phpgw']->acl->check('.project',
16, 'logistic');//16
-
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"admin::logistic::bim_type_requirement";
- }
-
- public function query()
- {
- $params = array(
- 'start' => phpgw::get_var('startIndex', 'int',
'REQUEST', 0),
- 'results' => phpgw::get_var('results', 'int',
'REQUEST', null),
- 'query' => phpgw::get_var('query'),
- 'sort' => phpgw::get_var('sort'),
- 'dir' => phpgw::get_var('dir'),
- 'filters' => $filters
- );
-
- if
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
- {
- $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $user_rows_per_page = 10;
- }
- // YUI variables for paging and sorting
- $start_index = phpgw::get_var('startIndex', 'int');
- $num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
- $sort_field = phpgw::get_var('sort');
- $sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
- // Form variables
- $search_for = phpgw::get_var('query');
- $search_type = phpgw::get_var('search_option');
- // Create an empty result set
- $result_objects = array();
- $result_count = 0;
-
- $exp_param = phpgw::get_var('export');
- $export = false;
- if (isset($exp_param))
- {
- $export = true;
- $num_of_objects = null;
- }
-
- //Retrieve the type of query and perform type specific
logic
- $query_type = phpgw::get_var('type');
- //var_dump($query_type);
- switch ($query_type)
- {
- default: // ... all composites, filters (active
and vacant)
- $result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters);
- $object_count =
$this->so->get_count($search_for, $search_type, $filters);
- break;
- }
- //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
- $result_data = array('results' => $rows);
-
- $result_data['total_records'] = $object_count;
- $result_data['start'] = $params['start'];
- $result_data['sort'] = $params['sort'];
- $result_data['dir'] = $params['dir'];
-
- $editable = phpgw::get_var('editable') == 'true' ? true
: false;
-
- if (!$export)
- {
- //Add action column to each row in result table
- array_walk(
-
$result_data['results'], array($this, '_add_links'),
"logistic.uibim_type_requirement.view");
- }
- return $this->yui_results($result_data);
- }
-
- public function index()
- {
- if (phpgw::get_var('phpgw_return_as') == 'json')
- {
- return $this->query();
- }
-
- self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('paginator');
-
- $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
-
- $data = array(
- 'datatable_name' =>
lang('bim_type_requirement'),
- 'form' => array(
- 'toolbar' => array(
- 'item' => array(
- array('type' =>
'filter',
- 'name' =>
'entity_type',
- 'text' =>
lang('Entity types') . ':',
- 'list' =>
$entity_list,
- ),
- array('type' => 'text',
- 'text' =>
lang('search'),
- 'name' =>
'query'
- ),
- array(
- 'type' =>
'submit',
- 'name' =>
'search',
- 'value' =>
lang('Search')
- ),
- array(
- 'type' =>
'link',
- 'value' =>
lang('t_new_type_requirement'),
- 'href' =>
self::link(array('menuaction' => 'logistic.uibim_type_requirement.add')),
- 'class' =>
'new_item'
- ),
- ),
- ),
- ),
- 'datatable' => array(
- 'source' =>
self::link(array('menuaction' => 'logistic.uibim_type_requirement.index',
'phpgw_return_as' => 'json')),
- 'field' => array(
- array(
- 'key' => 'id',
- 'label' => lang('ID'),
- 'sortable' => true,
- 'formatter' =>
'YAHOO.portico.formatLink'
- ),
- array(
- 'key' => 'entity_label',
- 'label' =>
lang('Entity'),
- 'sortable' => true
- ),
- array(
- 'key' =>
'category_label',
- 'label' =>
lang('Category'),
- 'sortable' => true
- ),
- array(
- 'key' =>
'project_type_label',
- 'label' =>
lang('Project_type'),
- 'sortable' => true
- ),
- array(
- 'key' => 'link',
- 'hidden' => true
- )
- )
- ),
- );
-
- self::render_template_xsl('datatable_common', $data);
- }
-
- public function add()
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uibim_type_requirement.edit'));
- }
-
- public function edit()
- {
- $entity_so =
CreateObject('property.soadmin_entity');
- $custom = createObject('phpgwapi.custom_fields');
- $req_type_id = phpgw::get_var('id');
- if($req_type_id && is_numeric($req_type_id))
- {
- $req_type = $this->so->get_single($req_type_id);
- }
- else
- {
- $req_type = new
logistic_bim_item_type_requirement();
- }
-
- if (isset($_POST['save']))
- {
-
$req_type->set_entity_id(phpgw::get_var('entity_id'));
-
$req_type->set_category_id(phpgw::get_var('category_id'));
-
$req_type->set_project_type_id(phpgw::get_var('project_type_id'));
- $cust_attr_ids = phpgw::get_var('attributes');
- $req_type->set_cust_attribute_id(implode(',',
$cust_attr_ids));
-
- $req_type_id = $this->so->store($req_type);
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uibim_type_requirement.view', 'id' =>
$req_type_id));
- }
- else if (isset($_POST['cancel']))
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uibim_type_requirement.view', 'id' =>
$req_type_id));
- }
- else
- {
- $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
-
- array_unshift($entity_list,array
('id'=>'','name'=> lang('select value')));
- if($req_type->get_entity_id())
- {
- foreach ($entity_list as &$e)
- {
- if($e['id'] ==
$req_type->get_entity_id())
- {
- $e['selected'] = 1;
- }
- }
- $category_list =
$entity_so->read_category(array('allrows'=>true,'entity_id'=>$req_type->get_entity_id()));
- foreach ($category_list as &$c)
- {
- if($c['id'] ==
$req_type->get_category_id())
- {
- $c['selected'] = 1;
- }
- }
-
- $attributes =
$custom->find('property',".entity.{$req_type->get_entity_id()}.{$req_type->get_category_id()}",
0, '','','',true, true);
- $selected_attributes = explode(',',
$req_type->get_cust_attribute_id());
- foreach ($attributes as &$a)
- {
- if(in_array($a['id'],
$selected_attributes))
- {
- $a['checked'] =
'checked';
- }
- }
- }
- $project_type_array =
$this->so_project->get_project_types($req_type->get_project_type_id());
-
- $data = array
- (
- 'value_id' => !empty($req_type)
? $req_type->get_id() : 0,
- 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
- 'entities' => $entity_list,
- 'categories' => $category_list,
- 'attributes' => $attributes,
- 'project_types' =>
$project_type_array,
- 'editable' => true,
- 'req_type' => $req_type
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
-
- phpgwapi_jquery::load_widget('core');
-
- self::add_javascript('logistic', 'logistic',
'bim_type_requirement.js');
-
self::render_template_xsl(array('bim_type_requirement_item'), $data);
- }
- }
-
- public function get_bim_level1()
- {
- $entity_id = phpgw::get_var('entity_id');
- $entity =
CreateObject('property.soadmin_entity');
-
- $category_list =
$entity->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
-
- return $category_list;
- }
-
- public function get_bim_level2()
- {
- $custom = createObject('phpgwapi.custom_fields');
- $entity_id = phpgw::get_var('entity_id');
- $cat_id = phpgw::get_var('cat_id');
-
- $attrib_data =
$custom->find('property',".entity.{$entity_id}.{$cat_id}", 0, '','','',true,
true);
-
- return $attrib_data;
- }
-
- public function view()
- {
- $entity_so =
CreateObject('property.soadmin_entity');
- $custom = createObject('phpgwapi.custom_fields');
- $req_type_id = phpgw::get_var('id');
- if(isset($_POST['edit']))
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uibim_type_requirement.edit', 'id' =>
$req_type_id));
- }
-
- if($req_type_id && is_numeric($req_type_id))
- {
- $req_type = $this->so->get_single($req_type_id);
- $entity =
$entity_so->read_single($req_type->get_entity_id());
- $category =
$entity_so->read_single_category($req_type->get_entity_id(),$req_type->get_category_id());
- $all_attributes =
$custom->find('property',".entity.{$req_type->get_entity_id()}.{$req_type->get_category_id()}",
0, '','','',true, true);
- $attributes = array();
- $selected_attributes = explode(',',
$req_type->get_cust_attribute_id());
- foreach ($all_attributes as $attr)
- {
- if(in_array($attr['id'],
$selected_attributes))
- {
- $attributes[] = $attr;
- }
- }
-
- $objects = $this->so_project->get(null, null,
null, null, null, 'project_type', array('id' =>
$req_type->get_project_type_id()));
- if (count($objects) > 0)
- {
- $keys = array_keys($objects);
- $project_type = $objects[$keys[0]];
- }
-
- $data = array
- (
- 'value_id' => !empty($req_type)
? $req_type->get_id() : 0,
- 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
- 'req_type' => $req_type,
- 'entity' => $entity,
- 'category' => $category,
- 'attributes' => $attributes,
- 'project_type' => $project_type
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
-
self::render_template_xsl(array('bim_type_requirement_item'), $data);
- }
- }
- }
Copied: trunk/logistic/inc/class.uiresource_type_requirement.inc.php (from rev
10159, trunk/logistic/inc/class.uibim_type_requirement.inc.php)
===================================================================
--- trunk/logistic/inc/class.uiresource_type_requirement.inc.php
(rev 0)
+++ trunk/logistic/inc/class.uiresource_type_requirement.inc.php
2012-10-09 12:36:18 UTC (rev 10180)
@@ -0,0 +1,389 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage logistic
+ * @version $Id$
+ */
+
+ phpgw::import_class('phpgwapi.jquery');
+ phpgw::import_class('phpgwapi.uicommon');
+ phpgw::import_class('logistic.soproject');
+
+ include_class('logistic', 'project');
+
+ class logistic_uiresource_type_requirement extends phpgwapi_uicommon
+ {
+
+ private $so;
+ private $so_project;
+ public $public_functions = array(
+
+ 'query' => true,
+ 'index' => true,
+ 'edit' => true,
+ 'add' => true,
+ 'view' => true,
+ 'get_bim_level1' => true,
+ 'get_bim_level2' => true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->so =
CreateObject('logistic.soresource_type_requirement');
+ $this->so_project = CreateObject('logistic.soproject');
+
+ $read = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_READ, 'logistic');//1
+ $add = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_ADD, 'logistic');//2
+ $edit = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_EDIT, 'logistic');//4
+ $delete = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_DELETE, 'logistic');//8
+
+ $manage = $GLOBALS['phpgw']->acl->check('.project',
16, 'logistic');//16
+
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"admin::logistic::resource_type_requirement";
+ }
+
+ public function query()
+ {
+ $params = array(
+ 'start' => phpgw::get_var('startIndex', 'int',
'REQUEST', 0),
+ 'results' => phpgw::get_var('results', 'int',
'REQUEST', null),
+ 'query' => phpgw::get_var('query'),
+ 'sort' => phpgw::get_var('sort'),
+ 'dir' => phpgw::get_var('dir'),
+ 'filters' => $filters
+ );
+
+ if
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+ {
+ $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $user_rows_per_page = 10;
+ }
+ // YUI variables for paging and sorting
+ $start_index = phpgw::get_var('startIndex', 'int');
+ $num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
+ $sort_field = phpgw::get_var('sort');
+ $sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
+ // Form variables
+ $search_for = phpgw::get_var('query');
+ $search_type = phpgw::get_var('search_option');
+ // Create an empty result set
+ $result_objects = array();
+ $result_count = 0;
+
+ $exp_param = phpgw::get_var('export');
+ $export = false;
+ if (isset($exp_param))
+ {
+ $export = true;
+ $num_of_objects = null;
+ }
+
+ //Retrieve the type of query and perform type specific
logic
+ $query_type = phpgw::get_var('type');
+ //var_dump($query_type);
+ switch ($query_type)
+ {
+ default: // ... all composites, filters (active
and vacant)
+ $result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters);
+ $object_count =
$this->so->get_count($search_for, $search_type, $filters);
+ break;
+ }
+ //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
+ $result_data = array('results' => $rows);
+
+ $result_data['total_records'] = $object_count;
+ $result_data['start'] = $params['start'];
+ $result_data['sort'] = $params['sort'];
+ $result_data['dir'] = $params['dir'];
+
+ $editable = phpgw::get_var('editable') == 'true' ? true
: false;
+
+ if (!$export)
+ {
+ //Add action column to each row in result table
+ array_walk(
+
$result_data['results'], array($this, '_add_links'),
"logistic.uiresource_type_requirement.view");
+ }
+ return $this->yui_results($result_data);
+ }
+
+ public function index()
+ {
+ if (phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ return $this->query();
+ }
+
+ self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('paginator');
+
+ $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
+
+ $data = array(
+ 'datatable_name' =>
lang('resource_type_requirement'),
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array('type' =>
'filter',
+ 'name' =>
'entity_type',
+ 'text' =>
lang('Entity types') . ':',
+ 'list' =>
$entity_list,
+ ),
+ array('type' => 'text',
+ 'text' =>
lang('search'),
+ 'name' =>
'query'
+ ),
+ array(
+ 'type' =>
'submit',
+ 'name' =>
'search',
+ 'value' =>
lang('Search')
+ ),
+ array(
+ 'type' =>
'link',
+ 'value' =>
lang('t_new_type_requirement'),
+ 'href' =>
self::link(array('menuaction' => 'logistic.uiresource_type_requirement.add')),
+ 'class' =>
'new_item'
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' => 'logistic.uiresource_type_requirement.index',
'phpgw_return_as' => 'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' => lang('ID'),
+ 'sortable' => true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' => 'entity_label',
+ 'label' =>
lang('Entity'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' =>
'category_label',
+ 'label' =>
lang('Category'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' =>
'project_type_label',
+ 'label' =>
lang('Project_type'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ )
+ )
+ ),
+ );
+
+ self::render_template_xsl('datatable_common', $data);
+ }
+
+ public function add()
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiresource_type_requirement.edit'));
+ }
+
+ public function edit()
+ {
+ $entity_so =
CreateObject('property.soadmin_entity');
+ $custom = createObject('phpgwapi.custom_fields');
+ $req_type_id = phpgw::get_var('id');
+ if($req_type_id && is_numeric($req_type_id))
+ {
+ $req_type = $this->so->get_single($req_type_id);
+ }
+ else
+ {
+ $req_type = new
logistic_bim_item_type_requirement();
+ }
+
+ if (isset($_POST['save']))
+ {
+ $entity_id = phpgw::get_var('entity_id');
+ $category_id = phpgw::get_var('category_id');
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property',".entity.{$entity_id}.{$category_id}");
+ $req_type->set_location_id($location_id);
+
$req_type->set_project_type_id(phpgw::get_var('project_type_id'));
+ $cust_attr_ids = phpgw::get_var('attributes');
+ foreach ($cust_attr_ids as $attr_id)
+ {
+
$req_type->set_cust_attribute_id($attr_id);
+ $req_type_id =
$this->so->store($req_type);
+ }
+
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiresource_type_requirement.view',
'location_id' => $location_id));
+ }
+ else if (isset($_POST['cancel']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiresource_type_requirement.index'));
+ }
+ else
+ {
+ $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
+
+ array_unshift($entity_list,array
('id'=>'','name'=> lang('select value')));
+ if($req_type->get_entity_id())
+ {
+ foreach ($entity_list as &$e)
+ {
+ if($e['id'] ==
$req_type->get_entity_id())
+ {
+ $e['selected'] = 1;
+ }
+ }
+ $category_list =
$entity_so->read_category(array('allrows'=>true,'entity_id'=>$req_type->get_entity_id()));
+ foreach ($category_list as &$c)
+ {
+ if($c['id'] ==
$req_type->get_category_id())
+ {
+ $c['selected'] = 1;
+ }
+ }
+
+ $attributes =
$custom->find('property',".entity.{$req_type->get_entity_id()}.{$req_type->get_category_id()}",
0, '','','',true, true);
+ $selected_attributes = explode(',',
$req_type->get_cust_attribute_id());
+ foreach ($attributes as &$a)
+ {
+ if(in_array($a['id'],
$selected_attributes))
+ {
+ $a['checked'] =
'checked';
+ }
+ }
+ }
+ $project_type_array =
$this->so_project->get_project_types($req_type->get_project_type_id());
+
+ $data = array
+ (
+ 'value_id' => !empty($req_type)
? $req_type->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'entities' => $entity_list,
+ 'categories' => $category_list,
+ 'attributes' => $attributes,
+ 'project_types' =>
$project_type_array,
+ 'editable' => true,
+ 'req_type' => $req_type
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
+
+ phpgwapi_jquery::load_widget('core');
+
+ self::add_javascript('logistic', 'logistic',
'resource_type_requirement.js');
+
self::render_template_xsl(array('resource_type_requirement_item'), $data);
+ }
+ }
+
+ public function get_bim_level1()
+ {
+ $entity_id = phpgw::get_var('entity_id');
+ $entity =
CreateObject('property.soadmin_entity');
+
+ $category_list =
$entity->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
+
+ return $category_list;
+ }
+
+ public function get_bim_level2()
+ {
+ $custom = createObject('phpgwapi.custom_fields');
+ $entity_id = phpgw::get_var('entity_id');
+ $cat_id = phpgw::get_var('cat_id');
+
+ $attrib_data =
$custom->find('property',".entity.{$entity_id}.{$cat_id}", 0, '','','',true,
true);
+
+ return $attrib_data;
+ }
+
+ public function view()
+ {
+ $entity_so =
CreateObject('property.soadmin_entity');
+ $custom = createObject('phpgwapi.custom_fields');
+ $req_type_id = phpgw::get_var('id');
+ if(isset($_POST['edit']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiresource_type_requirement.edit', 'id' =>
$req_type_id));
+ }
+
+ if($req_type_id && is_numeric($req_type_id))
+ {
+ $req_type = $this->so->get_single($req_type_id);
+ $entity =
$entity_so->read_single($req_type->get_entity_id());
+ $category =
$entity_so->read_single_category($req_type->get_entity_id(),$req_type->get_category_id());
+ $all_attributes =
$custom->find('property',".entity.{$req_type->get_entity_id()}.{$req_type->get_category_id()}",
0, '','','',true, true);
+ $attributes = array();
+ $selected_attributes = explode(',',
$req_type->get_cust_attribute_id());
+ foreach ($all_attributes as $attr)
+ {
+ if(in_array($attr['id'],
$selected_attributes))
+ {
+ $attributes[] = $attr;
+ }
+ }
+
+ $objects = $this->so_project->get(null, null,
null, null, null, 'project_type', array('id' =>
$req_type->get_project_type_id()));
+ if (count($objects) > 0)
+ {
+ $keys = array_keys($objects);
+ $project_type = $objects[$keys[0]];
+ }
+
+ $data = array
+ (
+ 'value_id' => !empty($req_type)
? $req_type->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'req_type' => $req_type,
+ 'entity' => $entity,
+ 'category' => $category,
+ 'attributes' => $attributes,
+ 'project_type' => $project_type
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
+
self::render_template_xsl(array('resource_type_requirement_item'), $data);
+ }
+ }
+ }
Deleted: trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php
2012-10-09 12:32:33 UTC (rev 10179)
+++ trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php
2012-10-09 12:36:18 UTC (rev 10180)
@@ -1,138 +0,0 @@
-<?php
-
- /**
- * phpGroupWare - logistic: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/
- * @package property
- * @subpackage logistic
- * @version $Id $
- */
- include_class('logistic', 'model', '/inc/model/');
-
- class logistic_bim_item_type_requirement extends logistic_model
- {
- public static $so;
-
- protected $id;
- protected $entity_id;
- protected $category_id;
- protected $project_type_id;
- protected $cust_attribute_id;
-
- /**
- * Constructor. Takes an optional ID. If a contract is
created from outside
- * the database the ID should be empty so the database can add
one according to its logic.
- *
- * @param int $id the id of this project
- */
- public function __construct(int $id = null)
- {
- $this->id = (int) $id;
- }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id()
- {
- return $this->id;
- }
-
- public function set_entity_id($entity_id)
- {
- $this->entity_id = $entity_id;
- }
-
- public function get_entity_id()
- {
- return $this->entity_id;
- }
-
- public function set_category_id($category_id)
- {
- $this->category_id = $category_id;
- }
-
- public function get_category_id()
- {
- return $this->category_id;
- }
-
- public function set_project_type_id($project_type_id)
- {
- $this->project_type_id = $project_type_id;
- }
-
- public function get_project_type_id()
- {
- return $this->project_type_id;
- }
-
- public function set_cust_attribute_id($cust_attribute_id)
- {
- $this->cust_attribute_id = $cust_attribute_id;
- }
-
- public function get_cust_attribute_id()
- {
- return $this->cust_attribute_id;
- }
-
- /**
- * Get a static reference to the storage object associated with
this model object
- *
- * @return the storage object
- */
- public static function get_so()
- {
- if (self::$so == null) {
- self::$so =
CreateObject('logistic.sobim_type_requirement');
- }
-
- return self::$so;
- }
-
- public function serialize()
- {
- $entity_so =
CreateObject('property.soadmin_entity');
- $project_so = CreateObject('logistic.soproject');
- $entity =
$entity_so->read_single($this->get_entity_id());
- $category =
$entity_so->read_single_category($this->get_entity_id(),$this->get_category_id());
- $entity_label = $entity['name'];
- $category_label = $category['name'];
- $project_type_label =
$project_so->get_project_type_label($this->get_project_type_id());
-
- return array(
- 'id' => $this->get_id(),
- 'entity_id' => $this->get_entity_id(),
- 'entity_label' => $entity_label,
- 'category_id' => $this->get_category_id(),
- 'category_label' => $category_label,
- 'atributes' => $this->get_cust_attribute_id(),
- 'project_type_id' =>
$this->get_project_type_id(),
- 'project_type_label' => $project_type_label
- );
- }
- }
\ No newline at end of file
Copied: trunk/logistic/inc/model/class.resource_type_requirement.inc.php (from
rev 10159, trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php)
===================================================================
--- trunk/logistic/inc/model/class.resource_type_requirement.inc.php
(rev 0)
+++ trunk/logistic/inc/model/class.resource_type_requirement.inc.php
2012-10-09 12:36:18 UTC (rev 10180)
@@ -0,0 +1,127 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage logistic
+ * @version $Id $
+ */
+ include_class('logistic', 'model', '/inc/model/');
+
+ class logistic_resource_type_requirement extends logistic_model
+ {
+ public static $so;
+
+ protected $id;
+ protected $location_id;
+ protected $project_type_id;
+ protected $cust_attribute_id;
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is
created from outside
+ * the database the ID should be empty so the database can add
one according to its logic.
+ *
+ * @param int $id the id of this project
+ */
+ public function __construct(int $id = null)
+ {
+ $this->id = (int) $id;
+ }
+
+ public function set_id($id)
+ {
+ $this->id = $id;
+ }
+
+ public function get_id()
+ {
+ return $this->id;
+ }
+
+ public function set_location_id($location_id)
+ {
+ $this->location_id = $location_id;
+ }
+
+ public function get_location_id()
+ {
+ return $this->location_id;
+ }
+
+ public function set_project_type_id($project_type_id)
+ {
+ $this->project_type_id = $project_type_id;
+ }
+
+ public function get_project_type_id()
+ {
+ return $this->project_type_id;
+ }
+
+ public function set_cust_attribute_id($cust_attribute_id)
+ {
+ $this->cust_attribute_id = $cust_attribute_id;
+ }
+
+ public function get_cust_attribute_id()
+ {
+ return $this->cust_attribute_id;
+ }
+
+ /**
+ * Get a static reference to the storage object associated with
this model object
+ *
+ * @return the storage object
+ */
+ public static function get_so()
+ {
+ if (self::$so == null) {
+ self::$so =
CreateObject('logistic.soresource_type_requirement');
+ }
+
+ return self::$so;
+ }
+
+ public function serialize()
+ {
+ $entity_so =
CreateObject('property.soadmin_entity');
+ $project_so = CreateObject('logistic.soproject');
+ $l_loc =
$GLOBALS['phpgw']->locations->get_id('property',".entity.{$this->get_entity_id()}.{$this->get_category_id()}");
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($l_loc);
+ $entity_arr = explode('.',$loc_arr['location']);
+
+ $entity = $entity_so->read_single($entity_arr[2]);
+ $category =
$entity_so->read_single_category($entity_arr[2],$entity_arr[3]);
+ $entity_label = $entity['name'];
+ $category_label = $category['name'];
+ $project_type_label =
$project_so->get_project_type_label($this->get_project_type_id());
+
+ return array(
+ 'id' => $l_loc,
+ 'entity_label' => $entity_label,
+ 'category_label' => $category_label,
+ 'project_type_label' => $project_type_label
+ );
+ }
+ }
\ No newline at end of file
Deleted: trunk/logistic/js/logistic/bim_type_requirement.js
===================================================================
--- trunk/logistic/js/logistic/bim_type_requirement.js 2012-10-09 12:32:33 UTC
(rev 10179)
+++ trunk/logistic/js/logistic/bim_type_requirement.js 2012-10-09 12:36:18 UTC
(rev 10180)
@@ -1,64 +0,0 @@
-$(document).ready(function(){
-
- $("#entity_id").change(function () {
- var oArgs =
{menuaction:'logistic.uibim_type_requirement.get_bim_level1', entity_id:
$(this).val()};
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- var htmlString = "";
-
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl,
- success: function(data)
- {
- if( data != null)
- {
- htmlString = "<option>Velg</option>"
-
- $.each(data, function(i) {
- var selected = '';
- htmlString += "<option
value='" + data[i].id + "'" + selected + ">" + data[i].name + "</option>";
- });
-
- $("#category_id").html( htmlString );
- }
- else
- {
- htmlString += "";
- $("#category_id").html( htmlString );
- }
- }
- });
- });
-
- $("#category_id").change(function () {
- var oArgs =
{menuaction:'logistic.uibim_type_requirement.get_bim_level2', entity_id:
$("#entity_id").val(), cat_id: $(this).val()};
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- var htmlString = "";
-
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl,
- success: function(data)
- {
- if( data != null)
- {
- $.each(data, function(i) {
- htmlString += "<input
type='checkbox' name='attributes[]' id='attributes[]' value='" + data[i].id +
"'/>" + data[i].input_text + " (" + data[i].trans_datatype + ")<br/>";
- });
-
- $("#attributes").html( htmlString );
- }
- else
- {
- htmlString += "";
- $("#attributes").html( htmlString );
- }
- }
- });
- });
-
-});
\ No newline at end of file
Copied: trunk/logistic/js/logistic/resource_type_requirement.js (from rev
10159, trunk/logistic/js/logistic/bim_type_requirement.js)
===================================================================
--- trunk/logistic/js/logistic/resource_type_requirement.js
(rev 0)
+++ trunk/logistic/js/logistic/resource_type_requirement.js 2012-10-09
12:36:18 UTC (rev 10180)
@@ -0,0 +1,64 @@
+$(document).ready(function(){
+
+ $("#entity_id").change(function () {
+ var oArgs =
{menuaction:'logistic.uibim_type_requirement.get_bim_level1', entity_id:
$(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data)
+ {
+ if( data != null)
+ {
+ htmlString = "<option>Velg</option>"
+
+ $.each(data, function(i) {
+ var selected = '';
+ htmlString += "<option
value='" + data[i].id + "'" + selected + ">" + data[i].name + "</option>";
+ });
+
+ $("#category_id").html( htmlString );
+ }
+ else
+ {
+ htmlString += "";
+ $("#category_id").html( htmlString );
+ }
+ }
+ });
+ });
+
+ $("#category_id").change(function () {
+ var oArgs =
{menuaction:'logistic.uibim_type_requirement.get_bim_level2', entity_id:
$("#entity_id").val(), cat_id: $(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data)
+ {
+ if( data != null)
+ {
+ $.each(data, function(i) {
+ htmlString += "<input
type='checkbox' name='attributes[]' id='attributes[]' value='" + data[i].id +
"'/>" + data[i].input_text + " (" + data[i].trans_datatype + ")<br/>";
+ });
+
+ $("#attributes").html( htmlString );
+ }
+ else
+ {
+ htmlString += "";
+ $("#attributes").html( htmlString );
+ }
+ }
+ });
+ });
+
+});
\ No newline at end of file
Deleted: trunk/logistic/templates/base/bim_type_requirement_item.xsl
===================================================================
--- trunk/logistic/templates/base/bim_type_requirement_item.xsl 2012-10-09
12:32:33 UTC (rev 10179)
+++ trunk/logistic/templates/base/bim_type_requirement_item.xsl 2012-10-09
12:36:18 UTC (rev 10180)
@@ -1,136 +0,0 @@
-<xsl:template match="data" xmlns:php="http://php.net/xsl">
-
-<xsl:call-template name="yui_phpgw_i18n"/>
-<div class="yui-navset yui-navset-top">
- <div class="identifier-header">
- <h1><img src="{img_go_home}" />
- <xsl:value-of select="php:function('lang',
'Administrate requirements')" />
- </h1>
- </div>
- <div class="yui-content">
- <div id="details">
- <form action="#" method="post">
- <input type="hidden" name="id" value =
"{value_id}">
- </input>
- <dl class="proplist-col">
- <dt>
- <label><xsl:value-of
select="php:function('lang', 'Project_type')" /></label>
- </dt>
- <dd>
- <xsl:choose>
- <xsl:when
test="editable">
- <select
name="project_type_id" id="project_type_id">
-
<xsl:for-each select="project_types">
-
<option value="{id}">
-
<xsl:if test="selected">
-
<xsl:attribute name="selected" value="selected" />
-
</xsl:if>
-
<xsl:value-of select="name"/>
-
</option>
-
</xsl:for-each>
- </select>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="project_type/name" />
- </xsl:otherwise>
- </xsl:choose>
- </dd>
- <xsl:choose>
- <xsl:when test="editable">
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Entity')" /></label>
- </dt>
- <dd>
- <select
name="entity_id" id="entity_id">
-
<xsl:for-each select="entities">
-
<option value="{id}">
-
<xsl:if test="selected">
-
<xsl:attribute name="selected" value="selected" />
-
</xsl:if>
-
<xsl:value-of select="name"/>
-
</option>
-
</xsl:for-each>
- </select>
- </dd>
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Category')" /></label>
- </dt>
- <dd>
- <select
name="category_id" id="category_id">
- <xsl:if
test="req_type/category_id">
-
<xsl:for-each select="categories">
-
<option value="{id}">
-
<xsl:if test="selected">
-
<xsl:attribute name="selected" value="selected" />
-
</xsl:if>
-
<xsl:value-of select="name"/>
-
</option>
-
</xsl:for-each>
-
</xsl:if>
- </select>
- </dd>
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Attributes')" /></label>
- </dt>
- <dd>
- <div
id="attributes">
- <xsl:if
test="req_type/cust_attribute_id">
-
<xsl:for-each select="attributes">
-
<xsl:if test="input_text">
-
<xsl:choose>
-
<xsl:when test="checked">
-
<input type='checkbox' name='attributes[]'
id='attributes[]' value='{id}' checked='checked'/><xsl:value-of
select="input_text" /> <xsl:value-of select="trans_datatype" /><br/>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type='checkbox' name='attributes[]'
id='attributes[]' value='{id}'/><xsl:value-of select="input_text" />
<xsl:value-of select="trans_datatype" /><br/>
-
</xsl:otherwise>
-
</xsl:choose>
-
</xsl:if>
-
</xsl:for-each>
-
</xsl:if>
- </div>
- </dd>
- </xsl:when>
- <xsl:otherwise>
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Entity')" /></label>
- </dt>
- <dd>
- <xsl:value-of
select="entity/name" />
- </dd>
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Category')" /></label>
- </dt>
- <dd>
- <xsl:value-of
select="category/name" />
- </dd>
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Chosen attributes')"
/></label>
- </dt>
- <dd>
- <xsl:for-each
select="attributes">
-
<xsl:value-of select="input_text" /> (<xsl:value-of select="trans_datatype"
/>)<br/>
- </xsl:for-each>
- </dd>
- </xsl:otherwise>
- </xsl:choose>
- </dl>
- <div class="form-buttons">
- <xsl:choose>
- <xsl:when test="editable">
- <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')"
/></xsl:variable>
- <input type="submit"
name="save" value="{$lang_save}" title = "{$lang_save}" />
- <input type="submit"
name="cancel" value="{$lang_cancel}" title = "{$lang_cancel}" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
- <input type="submit"
name="edit" value="{$lang_edit}" title = "{$lang_edit}" />
- </xsl:otherwise>
- </xsl:choose>
- </div>
- </form>
- </div>
- </div>
-</div>
-</xsl:template>
Copied: trunk/logistic/templates/base/resource_type_requirement_item.xsl (from
rev 10165, trunk/logistic/templates/base/bim_type_requirement_item.xsl)
===================================================================
--- trunk/logistic/templates/base/resource_type_requirement_item.xsl
(rev 0)
+++ trunk/logistic/templates/base/resource_type_requirement_item.xsl
2012-10-09 12:36:18 UTC (rev 10180)
@@ -0,0 +1,136 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+
+<xsl:call-template name="yui_phpgw_i18n"/>
+<div class="yui-navset yui-navset-top">
+ <div class="identifier-header">
+ <h1><img src="{img_go_home}" />
+ <xsl:value-of select="php:function('lang',
'Administrate requirements')" />
+ </h1>
+ </div>
+ <div class="yui-content">
+ <div id="details">
+ <form action="#" method="post">
+ <input type="hidden" name="id" value =
"{value_id}">
+ </input>
+ <dl class="proplist-col">
+ <dt>
+ <label><xsl:value-of
select="php:function('lang', 'Project_type')" /></label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <select
name="project_type_id" id="project_type_id">
+
<xsl:for-each select="project_types">
+
<option value="{id}">
+
<xsl:if test="selected">
+
<xsl:attribute name="selected" value="selected" />
+
</xsl:if>
+
<xsl:value-of select="name"/>
+
</option>
+
</xsl:for-each>
+ </select>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="project_type/name" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Entity')" /></label>
+ </dt>
+ <dd>
+ <select
name="entity_id" id="entity_id">
+
<xsl:for-each select="entities">
+
<option value="{id}">
+
<xsl:if test="selected">
+
<xsl:attribute name="selected" value="selected" />
+
</xsl:if>
+
<xsl:value-of select="name"/>
+
</option>
+
</xsl:for-each>
+ </select>
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Category')" /></label>
+ </dt>
+ <dd>
+ <select
name="category_id" id="category_id">
+ <xsl:if
test="req_type/category_id">
+
<xsl:for-each select="categories">
+
<option value="{id}">
+
<xsl:if test="selected">
+
<xsl:attribute name="selected" value="selected" />
+
</xsl:if>
+
<xsl:value-of select="name"/>
+
</option>
+
</xsl:for-each>
+
</xsl:if>
+ </select>
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Attributes')" /></label>
+ </dt>
+ <dd>
+ <div
id="attributes">
+ <xsl:if
test="req_type/cust_attribute_id">
+
<xsl:for-each select="attributes">
+
<xsl:if test="input_text">
+
<xsl:choose>
+
<xsl:when test="checked">
+
<input type='checkbox' name='attributes[]'
id='attributes[]' value='{id}' checked='checked'/><xsl:value-of
select="input_text" /> <xsl:value-of select="trans_datatype" /><br/>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type='checkbox' name='attributes[]'
id='attributes[]' value='{id}'/><xsl:value-of select="input_text" />
<xsl:value-of select="trans_datatype" /><br/>
+
</xsl:otherwise>
+
</xsl:choose>
+
</xsl:if>
+
</xsl:for-each>
+
</xsl:if>
+ </div>
+ </dd>
+ </xsl:when>
+ <xsl:otherwise>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Entity')" /></label>
+ </dt>
+ <dd>
+ <xsl:value-of
select="entity/name" />
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Category')" /></label>
+ </dt>
+ <dd>
+ <xsl:value-of
select="category/name" />
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Chosen attributes')"
/></label>
+ </dt>
+ <dd>
+ <xsl:for-each
select="attributes">
+
<xsl:value-of select="input_text" /> (<xsl:value-of select="trans_datatype"
/>)<br/>
+ </xsl:for-each>
+ </dd>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dl>
+ <div class="form-buttons">
+ <xsl:choose>
+ <xsl:when test="editable">
+ <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')"
/></xsl:variable>
+ <input type="submit"
name="save" value="{$lang_save}" title = "{$lang_save}" />
+ <input type="submit"
name="cancel" value="{$lang_cancel}" title = "{$lang_cancel}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
+ <input type="submit"
name="edit" value="{$lang_edit}" title = "{$lang_edit}" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10180] rename classes and files according to database tables,
Erik Holm-Larsen <=