[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [13195]
From: |
Nelson Guerra |
Subject: |
[Fmsystem-commits] [13195] |
Date: |
Wed, 13 May 2015 21:40:44 +0000 |
Revision: 13195
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13195
Author: nelson224
Date: 2015-05-13 21:40:42 +0000 (Wed, 13 May 2015)
Log Message:
-----------
Modified Paths:
--------------
branches/dev-syncromind/property/inc/class.uiwo_hour.inc.php
Modified: branches/dev-syncromind/property/inc/class.uiwo_hour.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiwo_hour.inc.php
2015-05-13 20:54:32 UTC (rev 13194)
+++ branches/dev-syncromind/property/inc/class.uiwo_hour.inc.php
2015-05-13 21:40:42 UTC (rev 13195)
@@ -219,11 +219,8 @@
'add_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'lang_done'
=> lang('done'),
'done_action'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiwo_hour.index', 'workorder_id'=> $workorder_id))
- );
+ );
- //$GLOBALS['phpgw']->js->validate_file( 'yahoo',
'wo_hour.deviation', 'property' );
- //-----------------------datatable settings---
-
$appname = lang('Workorder');
$function_msg = lang('list deviation');
@@ -627,16 +624,11 @@
array('key' => 'wo_hour_category',
'label' => $common_data['table_header'][0]['lang_category'],'sortable' =>
true,'resizeable' => true),
array('key' => 'cat_per_cent',
'label' => $common_data['table_header'][0]['lang_per_cent'],'sortable' =>
true,'resizeable' => true, 'formatter' => 'FormatterCenter')
)));
-
//----------------------------------------------datatable settings--------
- $property_js = "/property/js/yahoo/property2.js";
-
- if
(!isset($GLOBALS['phpgw_info']['server']['no_jscombine']) ||
!$GLOBALS['phpgw_info']['server']['no_jscombine'])
- {
- $cachedir =
urlencode($GLOBALS['phpgw_info']['server']['temp_dir']);
- $property_js =
"/phpgwapi/inc/combine.php?cachedir={$cachedir}&type=javascript&files=" .
str_replace('/', '--', ltrim($property_js,'/'));
- }
-
+ $tabs = array();
+ $tabs['generic'] = array('label' =>
lang('generic'), 'link' => '#generic');
+ $active_tab = 'generic';
+
$data = array
(
'property_js'
=> json_encode($GLOBALS['phpgw_info']['server']['webserver_url'] .
$property_js),
@@ -666,32 +658,17 @@
'lang_total_records' =>
lang('Total records'),
'table_header_hour'
=> $common_data['table_header'],
'values_hour'
=> $common_data['content'],
- 'workorder_data'
=> $common_data['workorder_data']
+ 'workorder_data'
=> $common_data['workorder_data'],
+ 'tabs'
=> phpgwapi_jquery::tabview_generate($tabs, $active_tab),
);
- //---datatable settings--------------------
- phpgwapi_yui::load_widget('dragdrop');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('menu');
- phpgwapi_yui::load_widget('connection');
- phpgwapi_yui::load_widget('loader');
- phpgwapi_yui::load_widget('tabview');
- phpgwapi_yui::load_widget('paginator');
- phpgwapi_yui::load_widget('animation');
- $GLOBALS['phpgw']->css->validate_file('datatable');
- $GLOBALS['phpgw']->css->validate_file('property');
-
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
- $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'wo_hour.save_template', 'property' );
- //-----------------------datatable settings---
//_debug_array($data);die;
$appname = lang('Workorder');
$function_msg = lang('Add template');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add_template' => $data));
// $GLOBALS['phpgw']->xslttpl->pp();
}
@@ -2193,10 +2170,7 @@
'container' =>
'datatable-container_0',
'requestUrl' =>
json_encode(self::link(array('menuaction'=>'property.uiwo_hour.prizebook',
'workorder_id'=>$workorder_id, 'phpgw_return_as'=>'json'))),
'data' => json_encode(array()),
- 'ColumnDefs' => $price_book_def,
- 'config' => array(
- array('disableFilter' => true)
- )
+ 'ColumnDefs' => $price_book_def
);
//*************************************************/
@@ -2311,7 +2285,7 @@
(
'menuaction' =>
'property.uiwo_hour.edit',
'workorder_id' =>
$workorder_id,
- 'from' =>
'index'
+ 'from' =>
'prizebook'
)),
'parameters' =>
json_encode($parameters)
);
@@ -2324,7 +2298,7 @@
(
'menuaction' =>
'property.uiwo_hour.edit',
'workorder_id' =>
$workorder_id,
- 'from' =>
'index'
+ 'from' =>
'prizebook'
)),
'target' => '_blank',
'parameters' =>
json_encode($parameters)
@@ -2337,7 +2311,7 @@
'confirm_msg' => lang('do you really
want to delete this entry'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
- 'menuaction' =>
'property.uiwo_hour.index',
+ 'menuaction' =>
'property.uiwo_hour.prizebook',
'workorder_id' =>
$workorder_id,
'delete' => true
)),
@@ -2349,17 +2323,15 @@
$common_data = $this->common_data();
$data['datatable']['table_sum'] =
$common_data['table_sum'][0];
- $data['datatable']['workorder_data'] =
$common_data['workorder_data'];
+ $data['datatable']['workorder_data'] =
$common_data['workorder_data'];
-
-
- //Title of Page
+ $appname = lang('pricebook');
+ $function_msg = lang('list pricebook');
+
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
- // Prepare YUI Library
- //$GLOBALS['phpgw']->js->validate_file( 'yahoo',
'wo_hour.prizebook', 'property' );
- //self::render_template_xsl(array('wo_hour.index'),
$data);
self::add_javascript('property', 'portico',
'wo_hour.index.js');
+ self::add_javascript('property', 'portico',
'wo_hour.prizebook.js');
self::render_template_xsl(array('wo_hour.index','datatable_inline'), $data);
//$this->save_sessiondata();
@@ -2371,6 +2343,7 @@
$workorder_id = phpgw::get_var('workorder_id'); // in
case of bigint
$order = phpgw::get_var('order');
$draw = phpgw::get_var('draw', 'int');
+ $search = phpgw::get_var('search');
$columns = phpgw::get_var('columns');
$common_data = $this->common_data($workorder_id);
@@ -2389,6 +2362,7 @@
{
$params = array
(
+ 'query' => $search['value'],
'start' =>
phpgw::get_var('start', 'int', 'REQUEST', 0),
'results' =>
phpgw::get_var('length', 'int', 'REQUEST', 0),
'order' =>
$columns[$order[0]['column']]['data'],
@@ -2486,103 +2460,12 @@
if($values['add'])
{
$receipt =
$this->bo->add_hour_from_template($values,$workorder_id);
+ return $receipt;
}
- $common_data=$this->common_data($workorder_id);
-
- $workorder = $common_data['workorder'];
-
- $botemplate =
CreateObject('property.botemplate');
-
-
- if( phpgw::get_var('phpgw_return_as') != 'json' )
+ if( phpgw::get_var('phpgw_return_as') == 'json' )
{
-
- $datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
- (
- 'menuaction'
=> 'property.uiwo_hour.template',
- 'workorder_id' =>
$workorder_id,
- 'template_id' =>
$template_id,
- 'query'
=> $this->query
- ));
-
- $datatable['config']['allow_allrows'] = true;
-
- $datatable['config']['base_java_url'] =
"menuaction:'property.uiwo_hour.template',"
- ."workorder_id:'{$workorder_id}',"
- ."template_id:'{$template_id}',"
- ."query:'{$this->query}'";
-
- $datatable['actions']['form'] = array
- (
- array
- (
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',
- array
- (
- 'menuaction'
=> 'property.uiwo_hour.template',
- 'workorder_id'
=> $workorder_id,
- 'template_id'
=> $template_id,
- 'query'
=> $this->query
- )
- ),
- 'fields' => array
- (
- 'field' => array
- (
- array
- ( // mensaje
- 'type'
=> 'label',
- 'id'
=> 'msg_header',
- 'value'
=> '',
- 'style'
=> 'filter'
- ),
- array
- ( // boton done
- 'type'
=> 'button',
- 'id'
=> 'btn_done',
-
'tab_index' => 4,
- 'value'
=> lang('done')
- ),
- array
- ( // boton SAVE
- 'type'
=> 'button',
- 'id'
=> 'btn_save',
-
'tab_index' => 3,
- 'value'
=> lang('save')
- ),
- array
- ( //boton
SEARCH
- 'id' =>
'btn_search',
- 'name'
=> 'search',
- 'value'
=> lang('search'),
- 'type'
=> 'button',
-
'tab_index' => 2
- ),
- array
- ( // TEXT IMPUT
- 'name'
=> 'query',
- 'id'
=> 'txt_query',
- 'value'
=> '',
- 'type'
=> 'text',
- 'size'
=> 28,
-
'onkeypress' => 'return pulsar(event)',
-
'tab_index' => 1
- ),
- array
- (
- 'type'
=> 'label',
- 'id'
=> 'lbl_template',
- 'value'
=> ''
-
- )
- ),
- 'hidden_value' => array
- (
- )
- )
- )
- );
+ return $this->query_template();
}
$uicols = array (
@@ -2594,176 +2477,96 @@
'className' =>
array('','','','','rightClasss','','','','','','','','','','','','','')
);
- $values_combo_box =
$this->bocommon->select_category_list(array('format'=>'filter','selected' =>
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id'));
- $default_value = array ('id'=>'','name'=>lang('no
category'));
- array_unshift ($values_combo_box,$default_value);
+ $count_uicols = count($uicols['name']);
+ $template_def = array();
- $template_list =
$botemplate->read_template_hour($template_id);
-
- $grouping_descr_old='';
- $content = array();
- $j=0;
- if (isset($template_list) && is_array($template_list))
+ for($k=0;$k<$count_uicols;$k++)
{
- foreach($template_list as $template)
- {
+ $params = array(
+ 'key'
=> $uicols['name'][$k],
+ 'label'
=> $uicols['descr'][$k],
+
'className' => $uicols['className'][$k],
+
'sortable' => ($uicols['sortable'][$k]) ? true : false,
+
'hidden' => ($uicols['input_type'][$k] == 'hidden') ? true : false
+ );
- if($template['grouping_descr'] !=
$grouping_descr_old)
- {
- $new_grouping = true;
- }
- else
- {
- $new_grouping = false;
- }
-
- $grouping_descr_old =
$template['grouping_descr'];
-
- if($template['activity_num'])
- {
- $code =
$template['activity_num'];
- }
- else
- {
- $code =
str_replace("-",$template['tolerance'],$template['ns3420_id']);
- }
-
- $hidden = '';
- $hidden .= " <input
name='values[chapter_id][".$j."]' id='values[chapter_id][".$j."]'
class='myValuesForPHP' type='hidden' value='".$template['chapter_id']."'/>";
- $hidden .= " <input
name='values[grouping_descr][".$j."]' id='values[grouping_descr][".$j."]'
class='myValuesForPHP' type='hidden'
value='".$template['grouping_descr']."'/>";
- $hidden .= " <input
name='values[activity_id][".$j."]' id='values[activity_id][".$j."]'
class='myValuesForPHP' type='hidden' value='".$template['activity_id']."'/>";
- $hidden .= " <input
name='values[activity_num][".$j."]' id='values[activity_num][".$j."]'
class='myValuesForPHP' type='hidden' value='".$template['activity_num']."'/>";
- $hidden .= " <input
name='values[unit][".$j."]' id='values[unit][".$j."]' class='myValuesForPHP'
type='hidden' value='".$template['unit']."'/>";
- $hidden .= " <input
name='values[dim_d][".$j."]' id='values[dim_d][".$j."]' class='myValuesForPHP'
type='hidden' value='".$template['dim_d']."'/>";
- $hidden .= " <input
name='values[ns3420_id][".$j."]' id='values[ns3420_id][".$j."]'
class='myValuesForPHP' type='hidden' value='".$template['ns3420_id']."'/>";
- $hidden .= " <input
name='values[tolerance][".$j."]' id='values[tolerance][".$j."]'
class='myValuesForPHP' type='hidden' value='".$template['tolerance']."'/>";
- $hidden .= " <input
name='values[building_part][".$j."]' id='values[building_part][".$j."]'
class='myValuesForPHP' type='hidden' value='".$template['building_part']."'/>";
- $hidden .= " <input
name='values[hours_descr][".$j."]' id='values[hours_descr][".$j."]'
class='myValuesForPHP' type='hidden' value='".$template['hours_descr']."'/>";
- $hidden .= " <input
name='values[remark][".$j."]' id='values[remark][".$j."]'
class='myValuesForPHP' type='hidden' value='".$template['remark']."'/>";
- $hidden .= " <input
name='values[billperae][".$j."]' id='values[billperae][".$j."]'
class='myValuesForPHP' type='hidden' value='".$template['billperae']."'/>";
-
- if ($j==0)
- {
- $hidden .= " <input
name='values[add]' id='values[add]' class='myValuesForPHP' type='hidden'
value='add'/>";
- }
-
- for ($i=0; $i<count($uicols['name']);
$i++)
- {
- if ($i==0) {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$template[$uicols['name'][$i]].$hidden;
- }
- else
- {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$template[$uicols['name'][$i]];
- if ($uicols['name'][$i]
== 'code')
- {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] = $code;
- }
- if($uicols['name'][$i]
== 'activity_num')
- {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] = $new_grouping;
- }
- }
-
-
$datatable['rows']['row'][$j]['column'][$i]['name'] = $uicols['name'][$i];
-
- if
($uicols['input_type'][$i]=='varchar')
- {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] = "<input
name='values[{$uicols['name'][$i]}][{$j}]'
id='values[{$uicols['name'][$i]}][{$j}]' size='4' class='myValuesForPHP'/>";
- }
-
- if
($uicols['input_type'][$i]=='select')
- {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] = "<input
name='values[".$uicols['name'][$i]."][".$j."]'
id='values[".$uicols['name'][$i]."][".$j."]' class='myValuesForPHP CheckClass'
type='hidden' value=''/> <input type='checkbox'
name='values[".$uicols['name'][$i]."_tmp][".$j."]'
id='values[".$uicols['name'][$i]."_tmp][".$j."]' class='CheckClass_tmp'
value='".$j."' />";
- }
-
- $select = '';
-
if($uicols['input_type'][$i]=='combo')
- {
- $select .= "<select
name='values[".$uicols['name'][$i]."_list][".$j."]'
id='values[".$uicols['name'][$i]."_list][".$j."]' class='combo_tmp'>";
- for($k = 0;
$k<count($values_combo_box); $k++)
- {
- $select .=
"<option
value='".$values_combo_box[$k]['id']."'>".$values_combo_box[$k]['name']."</option>";
- }
- $select .=
"</select>";
- $select .= " <input
name='values[".$uicols['name'][$i]."][".$j."]'
id='values[".$uicols['name'][$i]."][".$j."]' class='myValuesForPHP combo'
type='hidden' value=''/>";
-
$datatable['rows']['row'][$j]['column'][$i]['value'] = $select;
- }
- }
- $j++;
- }
+ array_push ($template_def, $params);
}
-
- $datatable['rowactions']['action'] = array();
- $uicols_count = count($uicols['name']);
-
- for ($i=0;$i<$uicols_count;$i++)
- {
- //all colums should be have formatter
-
$datatable['headers']['header'][$i]['formatter'] =
($uicols['formatter'][$i]==''? '""' : $uicols['formatter'][$i]);
-
- if($uicols['input_type'][$i]!='hidden')
- {
-
$datatable['headers']['header'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['headers']['header'][$i]['text'] =
$uicols['descr'][$i];
-
$datatable['headers']['header'][$i]['visible'] = true;
-
$datatable['headers']['header'][$i]['sortable'] = false;
-
$datatable['headers']['header'][$i]['className'] =
$uicols['className'][$i];
-
- if ($uicols['name'][$i] ==
'building_part' || $uicols['name'][$i] == 'billperae')
- {
-
$datatable['headers']['header'][$i]['sortable'] = true;
-
$datatable['headers']['header'][$i]['sort_field'] = $uicols['name'][$i];
- }
- }
- else
- {
-
$datatable['headers']['header'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['headers']['header'][$i]['text'] =
$uicols['descr'][$i];
-
$datatable['headers']['header'][$i]['visible'] = false;
-
$datatable['headers']['header'][$i]['sortable'] = false;
-
$datatable['headers']['header'][$i]['format'] = 'hidden';
- }
- }
-
-
-
- $uicols_details = array (
+
+ $datatable_def[] = array
+ (
+ 'container' =>
'datatable-container_0',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction'=>'property.uiwo_hour.template',
'workorder_id'=>$workorder_id, 'template_id'=>$template_id,
'phpgw_return_as'=>'json'))),
+ 'data' => json_encode(array()),
+ 'ColumnDefs' => $template_def
+ );
+
+ $data = array();
+ $data['datatable_def'] = $datatable_def;
+ $data['datatable_name'] = '';
+ $data['form'] = array();
+ $data['datatable'] = array
+ (
+ 'source' => self::link(array(
+ 'menuaction' =>
'property.uiwo_hour.index',
+ 'workorder_id' =>
$workorder_id,
+ 'phpgw_return_as' => 'json'
+ )),
+ 'allrows' => true,
+ 'editor_action' => '',
+ 'field' => array()
+ );
+
+ $data['top-toolbar'] = array
+ (
+ 'fields' => array
+ (
+ 'field' => array
+ (
+ array
+ (
+ 'type' =>
'button',
+ 'id' =>
'btn_save',
+ 'value' =>
lang('Save'),
+ 'href' => '#',
+ 'onclick' =>
'onSave();'
+ ),
+ array
+ (
+ 'type' =>
'button',
+ 'id' =>
'btn_done',
+ 'value' =>
lang('done'),
+ 'href' =>
self::link(array(
+
'menuaction' => 'property.uiwo_hour.index',
+
'workorder_id' => $workorder_id
+
))
+ )
+ )
+ )
+ );
+
+ $uicols_hour = array (
'name' =>
array('hour_id','post','code','hours_descr','unit_name','billperae','quantity','cost','deviation','result','wo_hour_category','cat_per_cent'),
'input_type' =>
array('hidden','text','text','text','text','text','text','text','text','text','text','text'),
'descr' =>
array('',lang('Post'),lang('Code'),lang('Descr'),lang('Unit'),lang('Bill per
unit'),lang('Quantity'),lang('Cost'),lang('deviation'),lang('result'),lang('Category'),lang('percent')),
- 'className' =>
array('','','','','','rightClasss','rightClasss','rightClasss','rightClasss','rightClasss','','rightClasss')
+ 'className' =>
array('','','','','','dt-right','dt-right','dt-right','dt-right','dt-right','','dt-right')
);
- $j=0;
- if (isset($common_data['content']) &&
is_array($common_data['content']))
+ $count_uicols_name = count($uicols_hour['name']);
+
+ for($k=0;$k<$count_uicols_name;$k++)
{
- foreach($common_data['content'] as $content)
- {
- for ($i=0;
$i<count($uicols_details['name']); $i++)
- {
- if ($uicols_details['name'][$i]
== 'deviation')
- {
- if
(is_numeric($content[$uicols_details['name'][$i]])) {
-
$details['rows'][$j][$uicols_details['name'][$i]] =
$content[$uicols_details['name'][$i]];
- }
- else
- {
-
$details['rows'][$j][$uicols_details['name'][$i]] = '';
- }
- }
- else
- {
-
$details['rows'][$j][$uicols_details['name'][$i]] =
$content[$uicols_details['name'][$i]];
- }
- }
- $j++;
- }
+ $params = array(
+ 'key'
=> $uicols_hour['name'][$k],
+ 'label'
=> $uicols_hour['descr'][$k],
+
'className' => $uicols_hour['className'][$k],
+
'sortable' => ($uicols_hour['sortable'][$k]) ? true : false,
+
'hidden' => ($uicols_hour['input_type'][$k] == 'hidden') ? true : false
+ );
+
+ array_push
($data['datatable']['field'], $params);
}
-
- $details['rowactions'] = array();
-
$parameters = array
(
'parameter' => array
@@ -2775,10 +2578,10 @@
)
)
);
-
- $details['rowactions'][] = array
+
+ $data['datatable']['actions'][] = array
(
- 'my_name' =>
'deviation',
+ 'my_name' => 'deviation',
'text' =>
lang('Deviation'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
@@ -2786,10 +2589,10 @@
'workorder_id' =>
$workorder_id,
'from' =>
'template'
)),
- 'parameters' => $parameters
+ 'parameters' =>
json_encode($parameters)
);
-
- $details['rowactions'][] = array
+
+ $data['datatable']['actions'][] = array
(
'my_name' =>
'deviation',
'text' =>
lang('open deviation in new window'),
@@ -2797,15 +2600,15 @@
(
'menuaction' =>
'property.uiwo_hour.deviation',
'workorder_id' =>
$workorder_id,
- 'from' =>
'template',
- 'target' =>
'_blank'
+ 'from' =>
'template'
)),
- 'parameters' => $parameters
+ 'target' => '_blank',
+ 'parameters' =>
json_encode($parameters)
);
- $details['rowactions'][] = array
+ $data['datatable']['actions'][] = array
(
- 'my_name' =>
'edit',
+ 'my_name' => 'edit',
'text' => lang('Edit'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
@@ -2814,10 +2617,10 @@
'template_id' => $template_id,
'from' =>
'template'
)),
- 'parameters' => $parameters
+ 'parameters' =>
json_encode($parameters)
);
- $details['rowactions'][] = array
+ $data['datatable']['actions'][] = array
(
'my_name' =>
'edit',
'text' =>
lang('open edit in new window'),
@@ -2826,16 +2629,15 @@
'menuaction' =>
'property.uiwo_hour.edit',
'workorder_id' =>
$workorder_id,
'template_id' => $template_id,
- 'from' =>
'template',
- 'target' =>
'_blank'
-
+ 'from' =>
'template'
)),
- 'parameters' => $parameters
+ 'target' => '_blank',
+ 'parameters' =>
json_encode($parameters)
);
- $details['rowactions'][] = array
+ $data['datatable']['actions'][] = array
(
- 'my_name' =>
'delete',
+ 'my_name' => 'delete',
'text' =>
lang('Delete'),
'confirm_msg' => lang('do you really
want to delete this entry'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
@@ -2845,150 +2647,166 @@
'template_id' => $template_id,
'delete' => true
)),
- 'parameters' => $parameters
+ 'parameters' =>
json_encode($parameters)
);
- unset($parameters);
+ unset($parameters);
+
+ $common_data = $this->common_data();
+ $data['datatable']['table_sum'] =
$common_data['table_sum'][0];
+ $data['datatable']['workorder_data'] =
$common_data['workorder_data'];
+
+ $appname = lang('Template');
+ $function_msg = lang('list template');
- $datatable['exchange_values'] = '';
- $datatable['valida'] = '';
+ // Title of Page
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
- // path for property.js
- $property_js = "/property/js/yahoo/property.js";
+ self::add_javascript('property', 'portico',
'wo_hour.index.js');
+ self::add_javascript('property', 'portico',
'wo_hour.template.js');
+
self::render_template_xsl(array('wo_hour.index','datatable_inline'), $data);
- if
(!isset($GLOBALS['phpgw_info']['server']['no_jscombine']) ||
!$GLOBALS['phpgw_info']['server']['no_jscombine'])
- {
- $cachedir =
urlencode($GLOBALS['phpgw_info']['server']['temp_dir']);
- $property_js =
"/phpgwapi/inc/combine.php?cachedir={$cachedir}&type=javascript&files=" .
str_replace('/', '--', ltrim($property_js,'/'));
- }
+ //$this->save_sessiondata();
+ }
- $datatable['property_js'] =
$GLOBALS['phpgw_info']['server']['webserver_url'] . $property_js;
+
+ public function query_template()
+ {
+ //$workorder_id = phpgw::get_var('workorder_id'); // in
case of bigint
+ $template_id = phpgw::get_var('template_id', 'int');
+
+ $order = phpgw::get_var('order');
+ $draw = phpgw::get_var('draw', 'int');
+ $search = phpgw::get_var('search');
+ $columns = phpgw::get_var('columns');
+
+ //$common_data = $this->common_data($workorder_id);
+ //$workorder = $common_data['workorder'];
- // Pagination and sort values
- $datatable['pagination']['records_start'] =
(int)$this->start;
- $datatable['pagination']['records_limit'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- $datatable['pagination']['records_returned']=
count($template_list);
- $datatable['pagination']['records_total'] =
$this->bopricebook->total_records;
+ $botemplate =
CreateObject('property.botemplate');
+
+ $uicols = array (
+ 'input_type' =>
array('text','text','text','text','text','varchar','combo','varchar','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden'),
+ 'type' =>
array('','','','','','text','','','text','','','',''),
+ 'name' =>
array('building_part','code','hours_descr','unit_name','billperae','quantity','wo_hour_cat','cat_per_cent','chapter_id','grouping_descr','new_grouping','activity_id','activity_num','remark','ns3420_id','tolerance','cost','dim_d'),
+ 'formatter' =>
array('','','','','','','','','','','','','','','','','','',''),
+ 'descr' =>
array(lang('Building
part'),lang('Code'),lang('Description'),lang('Unit'),lang('Bill per
unit'),lang('Quantity'),'','','','','','','','','','','',''),
+ 'className' =>
array('','','','','rightClasss','','','','','','','','','','','','','')
+ );
- if ( (phpgw::get_var("start")== "") &&
(phpgw::get_var("order",'string')== ""))
- {
- $datatable['sorting']['order']
= 'building_part'; // name key Column in myColumnDef
- $datatable['sorting']['sort']
= 'desc'; // ASC / DESC
- }
- else
- {
- $datatable['sorting']['order']
= phpgw::get_var('order', 'string'); // name of column of Database
- $datatable['sorting']['sort']
= phpgw::get_var('sort', 'string'); // ASC / DESC
- }
+ $values_combo_box =
$this->bocommon->select_category_list(array('format'=>'filter','selected' =>
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id'));
+ $default_value = array ('id'=>'','name'=>lang('no
category'));
+ array_unshift ($values_combo_box,$default_value);
- $appname = lang('Template');
- $function_msg = lang('list template');
-
-
- //-- BEGIN----------------------------- JSON CODE
------------------------------
-
- //values for Pagination
- $json = array
+ $params = array
(
- 'recordsReturned' =>
$datatable['pagination']['records_returned'],
- 'totalRecords' =>
(int)$datatable['pagination']['records_total'],
- 'startIndex' =>
$datatable['pagination']['records_start'],
- 'sort'
=> $datatable['sorting']['order'],
- 'dir'
=> $datatable['sorting']['sort'],
- 'records'
=> array(),
- 'details'
=> $details,
- 'uicols_details' =>
$uicols_details,
- 'table_sum'
=> $common_data['table_sum'][0],
- 'workorder_data' =>
$common_data['workorder_data'],
- 'total_hours_records' =>
$common_data['total_hours_records'],
- 'lang_total_records' => lang('Total
records')
+ 'query' => $search['value'],
+ 'start' => phpgw::get_var('start',
'int', 'REQUEST', 0),
+ 'results' => phpgw::get_var('length',
'int', 'REQUEST', 0),
+ 'order' =>
$columns[$order[0]['column']]['data'],
+ 'sort' => $order[0]['dir'],
+ 'allrows' => phpgw::get_var('length',
'int') == -1,
+ 'template_id' => $template_id,
+ 'chapter_id' => $this->chapter_id
+
);
+
+ $template_list =
$botemplate->read_template_hour($params);
- // values for datatable
- if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row']))
+ $grouping_descr_old = '';
+ $content = array();
+ $j=0;
+ if (isset($template_list) && is_array($template_list))
{
- foreach( $datatable['rows']['row'] as $row )
+ foreach($template_list as $template)
{
$json_row = array();
- foreach( $row['column'] as $column)
+
+ if($template['grouping_descr'] !=
$grouping_descr_old)
{
- if(isset($column['format']) &&
$column['format']== "link" && $column['java_link']==true)
+ $new_grouping = true;
+ }
+ else
+ {
+ $new_grouping = false;
+ }
+
+ $grouping_descr_old =
$template['grouping_descr'];
+
+ if($template['activity_num'])
+ {
+ $code =
$template['activity_num'];
+ }
+ else
+ {
+ $code =
str_replace("-",$template['tolerance'],$template['ns3420_id']);
+ }
+
+ $hidden = '';
+ $hidden .= " <input counter='".$j."'
name='values[chapter_id][".$j."]' id='values[chapter_id][".$j."]'
class='chapter_id' type='hidden' value='".$template['chapter_id']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[grouping_descr][".$j."]' id='values[grouping_descr][".$j."]'
class='grouping_descr' type='hidden'
value='".$template['grouping_descr']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[activity_id][".$j."]' id='values[activity_id][".$j."]'
class='activity_id' type='hidden' value='".$template['activity_id']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[activity_num][".$j."]' id='values[activity_num][".$j."]'
class='activity_num' type='hidden' value='".$template['activity_num']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[unit][".$j."]' id='values[unit][".$j."]' class='unit'
type='hidden' value='".$template['unit']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[dim_d][".$j."]' id='values[dim_d][".$j."]' class='dim_d'
type='hidden' value='".$template['dim_d']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[ns3420_id][".$j."]' id='values[ns3420_id][".$j."]'
class='ns3420_id' type='hidden' value='".$template['ns3420_id']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[tolerance][".$j."]' id='values[tolerance][".$j."]'
class='tolerance' type='hidden' value='".$template['tolerance']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[building_part][".$j."]' id='values[building_part][".$j."]'
class='building_part' type='hidden' value='".$template['building_part']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[hours_descr][".$j."]' id='values[hours_descr][".$j."]'
class='hours_descr' type='hidden' value='".$template['hours_descr']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[remark][".$j."]' id='values[remark][".$j."]' class='remark'
type='hidden' value='".$template['remark']."'/>";
+ $hidden .= " <input counter='".$j."'
name='values[billperae][".$j."]' id='values[billperae][".$j."]'
class='billperae' type='hidden' value='".$template['billperae']."'/>";
+
+ for ($i=0; $i<count($uicols['name']);
$i++)
+ {
+ $json_row[$uicols['name'][$i]]
= $template[$uicols['name'][$i]];
+ if ($uicols['name'][$i] ==
'code')
{
-
$json_row[$column['name']] = "<a href='#' id='".$column['link']."'
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+
$json_row[$uicols['name'][$i]] = $code;
}
- else
if(isset($column['format']) && $column['format']== "link")
+ if($uicols['name'][$i] ==
'activity_num')
{
-
$json_row[$column['name']] = "<a href='".$column['link']."' target='_blank'>"
.$column['value']."</a>";
+
$json_row[$uicols['name'][$i]] = $new_grouping;
}
- else
+
+
//$datatable['rows']['row'][$j]['column'][$i]['name'] = $uicols['name'][$i];
+
+ if
($uicols['input_type'][$i]=='varchar')
{
-
$json_row[$column['name']] = $column['value'];
+
$json_row[$uicols['name'][$i]] = "<input counter='".$j."'
name='values[{$uicols['name'][$i]}][{$j}]'
id='values[{$uicols['name'][$i]}][{$j}]' size='4'
class='".$uicols['name'][$i]."'/>";
}
+
+ /*if
($uicols['input_type'][$i]=='select')
+ {
+
$json_row[$uicols['name'][$i]] = "<input
name='values[".$uicols['name'][$i]."][".$j."]'
id='values[".$uicols['name'][$i]."][".$j."]' class='myValuesForPHP CheckClass'
type='hidden' value=''/> <input type='checkbox'
name='values[".$uicols['name'][$i]."_tmp][".$j."]'
id='values[".$uicols['name'][$i]."_tmp][".$j."]' class='CheckClass_tmp'
value='".$j."' />";
+ }*/
+
+ $select = '';
+
if($uicols['input_type'][$i]=='combo')
+ {
+ $select .= "<select
counter='".$j."' name='values[".$uicols['name'][$i]."_list][".$j."]'
id='values[".$uicols['name'][$i]."_list][".$j."]'
class='".$uicols['name'][$i]."'>";
+ for($k = 0;
$k<count($values_combo_box); $k++)
+ {
+ $select .=
"<option
value='".$values_combo_box[$k]['id']."'>".$values_combo_box[$k]['name']."</option>";
+ }
+ $select .=
"</select>";
+ //$select .= " <input
name='values[".$uicols['name'][$i]."][".$j."]'
id='values[".$uicols['name'][$i]."][".$j."]' class='combo' type='hidden'
value=''/>";
+
$json_row[$uicols['name'][$i]] = $select.$hidden;
+ }
}
- $json['records'][] = $json_row;
+ $content[] = $json_row;
+ $j++;
}
}
+
+ $result_data = array('results' => $content);
+ $result_data['total_records'] =
$botemplate->total_records;
+ $result_data['draw'] = $draw;
- // right in datatable
- if(isset($datatable['rowactions']['action']) &&
is_array($datatable['rowactions']['action']))
- {
- $json ['rights'] =
$datatable['rowactions']['action'];
- }
-
- // message when editting & deleting records
- if(isset($receipt) && is_array($receipt))
- {
- $json ['message'][] = $receipt;
- }
-
- if( phpgw::get_var('phpgw_return_as') == 'json' )
- {
- return $json;
- }
-
- $datatable['json_data'] = json_encode($json);
- //-------------------- JSON CODE ----------------------
-
- // Prepare template variables and process XSLT
- $template_vars = array();
- $template_vars['datatable'] = $datatable;
-
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
$template_vars);
-
- phpgwapi_yui::load_widget('dragdrop');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('menu');
- phpgwapi_yui::load_widget('connection');
- //// cramirez: necesary for include a partucular js
- phpgwapi_yui::load_widget('loader');
- //cramirez: necesary for use opener . Avoid error JS
- phpgwapi_yui::load_widget('tabview');
- phpgwapi_yui::load_widget('paginator');
- //FIXME this one is only needed when $lookup==true - so
there is probably an error
- phpgwapi_yui::load_widget('animation');
-
- if ( !isset($GLOBALS['phpgw']->css) ||
!is_object($GLOBALS['phpgw']->css) )
- {
- $GLOBALS['phpgw']->css =
createObject('phpgwapi.css');
- }
- // Prepare CSS Style
- $GLOBALS['phpgw']->css->validate_file('datatable');
- $GLOBALS['phpgw']->css->validate_file('property');
-
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-
- // Title of Page
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
- // Prepare YUI Library
- $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'wo_hour.template', 'property' );
-
- $this->save_sessiondata();
+ return $this->jquery_results($result_data);
}
-
+
+
function edit()
{
if(!$this->acl_edit)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [13195],
Nelson Guerra <=