[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14324]
From: |
Nelson Guerra |
Subject: |
[Fmsystem-commits] [14324] |
Date: |
Wed, 11 Nov 2015 00:23:53 +0000 |
Revision: 14324
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14324
Author: nelson224
Date: 2015-11-11 00:23:53 +0000 (Wed, 11 Nov 2015)
Log Message:
-----------
Modified Paths:
--------------
branches/dev-syncromind/frontend/inc/class.uihelpdesk.inc.php
Modified: branches/dev-syncromind/frontend/inc/class.uihelpdesk.inc.php
===================================================================
--- branches/dev-syncromind/frontend/inc/class.uihelpdesk.inc.php
2015-11-11 00:23:39 UTC (rev 14323)
+++ branches/dev-syncromind/frontend/inc/class.uihelpdesk.inc.php
2015-11-11 00:23:53 UTC (rev 14324)
@@ -41,121 +41,50 @@
'index' => true,
'add_ticket' => true,
'view' => true,
+ 'query' => true
);
public function __construct()
{
phpgwapi_cache::session_set('frontend','tab',$GLOBALS['phpgw']->locations->get_id('frontend','.ticket'));
+ $this->location_id =
phpgw::get_var('location_id', 'int', 'REQUEST', 0);
parent::__construct();
$this->location_code =
$this->header_state['selected_location'];
$GLOBALS['phpgw']->translation->add_app('property');
}
-
+
public function index()
{
$GLOBALS['phpgw_info']['apps']['manual']['section'] =
'helpdesk.index';
$this->insert_links_on_header_state();
- $bo = CreateObject('property.botts');
+
+ $filters = array();
- $dry_run = false;
- $second_display = phpgw::get_var('second_display',
'bool');
-
- $datatable = array();
-
- if( phpgw::get_var('phpgw_return_as') != 'json' )
- {
- $datatable['config']['allow_allrows'] = true;
-
- $datatable['config']['base_java_url'] =
"menuaction:'frontend.uihelpdesk.index',"
- ."second_display:1,"
- ."sort: '{$this->sort}',"
- ."order: '{$this->order}',"
- ."cat_id:'{$this->cat_id}',"
- ."status_id: '{$this->status_id}',"
- ."user_id: '{$this->user_id}',"
- ."query: '{$this->query}',"
- ."district_id: '{$this->district_id}',"
- ."start_date: '{$start_date}',"
- ."end_date: '{$end_date}',"
- ."allrows:'{$this->allrows}'";
-
- $this->bocommon =
CreateObject('property.bocommon', true);
-
- $values_combo_box = array(
- 0 => array(
+ $search_option = array
+ (
+ array(
'id' => 'all',
'name' => lang("All"),
- 'selected' => 'selected'
+ 'selected' => 1
),
- 1 => array(
+ array(
'id' => 'X',
'name' => lang("Closed")
),
- 2 => array(
+ array(
'id' => 'O',
'name' => lang("Open"),
)
- );
-
- $datatable['actions']['form'] = array(
- array
- (
- 'action' =>
$GLOBALS['phpgw']->link('/index.php', array
- (
- 'menuaction' =>
'frontend.uihelpdesk.index',
- 'second_display'=>
$second_display,
- 'status' =>
$this->status
- )
- ),
- 'fields' => array(
- 'field' => array(
- array
- (
- 'type'
=> 'button',
- 'id'
=> 'btn_new',
- 'value'
=> lang('new_ticket'),
-
'tab_index' => 3
- ),
- array
- (
- 'id'
=> 'btn_status_id',
- 'name'
=> 'status_id',
- 'value'
=> lang('Status'),
- 'type'
=> 'button',
- 'style'
=> 'filter',
-
'tab_index' => 2
- ),
- ),
- 'hidden_value' => array
- (
- array
- ( //status
values
- 'id' =>
'values_combo_box',
- 'value'
=> $this->bocommon->select2String($values_combo_box)
- )
- )
- )
- )
- );
-
- $dry_run = true;
- }
-
- if(isset($this->location_code) && $this->location_code
!= '')
- {
- $bo->location_code = $this->location_code;
- //to make sure the list select "All" not only
the open ones
- if(phpgw::get_var("status_id")== ""){
- $bo->status_id = 'all';
- }
- $ticket_list = $bo->read('','','',$dry_run);
- }
- else
- {
- $ticket_list = null;
- }
+ );
-
+ $filters[] = array
+ (
+ 'type' => 'filter',
+ 'name' => 'status_id',
+ 'text' =>
lang('Status'),
+ 'list' =>
$search_option
+ );
+
$uicols = array();
$uicols['name'][] = 'id';
@@ -170,47 +99,27 @@
$uicols['descr'][] = lang('user');
$count_uicols_name = count($uicols['name']);
-
- if(is_array($ticket_list))
+
+ $uicols_helpdesk = array();
+ for($k = 0; $k < $count_uicols_name; $k++)
{
- $status['X'] = array
- (
- 'status' =>
lang('closed')
+ $params = array(
+ 'key' => $uicols['name'][$k],
+ 'label' =>
$uicols['descr'][$k],
+ 'sortable' =>
($uicols['sortable'][$k]) ? true : false,
+ 'hidden' =>
($uicols['input_type'][$k] == 'hidden') ? true : false
);
- $status['O'] = array
- (
- 'status' =>
isset($bo->config->config_data['tts_lang_open']) &&
$bo->config->config_data['tts_lang_open'] ?
$bo->config->config_data['tts_lang_open'] : lang('Open'),
- );
-
- $custom_status = $bo->get_custom_status();
-
- foreach($custom_status as $custom)
+ if($uicols['name'][$k]=='id' ||
$uicols['name'][$k]=='user' || $uicols['name'][$k]=='entry_date')
{
- $status["C{$custom['id']}"] = array
- (
- 'status'
=> $custom['name'],
- );
+ $params['sortable'] = true;
}
-
- $j = 0;
- foreach($ticket_list as $ticket)
+ if($uicols['name'][$k]=='id')
{
- for ($k = 0 ; $k < $count_uicols_name ;
$k++)
- {
- if($uicols['name'][$k] ==
'status' && array_key_exists($ticket[$uicols['name'][$k]],$status))
- {
-
$datatable['rows']['row'][$j]['column'][$k]['name'] =
$uicols['name'][$k];
-
$datatable['rows']['row'][$j]['column'][$k]['value'] =
$status[$ticket[$uicols['name'][$k]]]['status'];
- }
- else
- {
-
$datatable['rows']['row'][$j]['column'][$k]['name'] =
$uicols['name'][$k];
-
$datatable['rows']['row'][$j]['column'][$k]['value'] =
$ticket[$uicols['name'][$k]];
- }
- }
- $j++;
+ $params['hidden'] = true;
}
+
+ array_push($uicols_helpdesk, $params);
}
$parameters = array
@@ -221,19 +130,33 @@
(
'name' => 'id',
'source' => 'id'
- ),
+ )
)
);
- $datatable['rowactions']['action'][] = array(
- 'my_name' => 'view',
- 'statustext' => lang('view the ticket'),
- 'text' => lang('view'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ $tabletools[] = array
(
- 'menuaction' => 'frontend.uihelpdesk.view'
- )),
- 'parameters' => $parameters
+ 'my_name' => 'view',
+ 'text' => lang('view'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'frontend.uihelpdesk.view',
+ 'location_id' =>
$this->location_id,
+ )),
+ 'parameters' =>
json_encode($parameters)
+ );
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_0',
+ 'requestUrl' => json_encode(self::link(array
+ (
+ 'menuaction'
=> 'frontend.uihelpdesk.query',
+ 'location_id'
=> $this->location_id,
+ 'phpgw_return_as'
=> 'json'))
+ ),
+ 'ColumnDefs' => $uicols_helpdesk,
+ 'tabletools' => $tabletools
);
$link = $GLOBALS['phpgw']->link(
@@ -241,139 +164,87 @@
array('menuaction' =>
'frontend.uihelpdesk.view'));
$datatable['exchange_values'] = "document.location =
'{$link}&id=' + data.getData().id;";
- unset($parameters);
- for ($i = 0 ; $i < $count_uicols_name ; $i++)
- {
-
$datatable['headers']['header'][$i]['formatter'] =
!isset($uicols['formatter'][$i]) || $uicols['formatter'][$i]==''? '""' :
$uicols['formatter'][$i];
- $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;
- if($uicols['name'][$i]=='id' ||
$uicols['name'][$i]=='user' || $uicols['name'][$i]=='entry_date')
- {
-
$datatable['headers']['header'][$i]['sortable'] = true;
-
$datatable['headers']['header'][$i]['sort_field'] = $uicols['name'][$i];
- }
- if($uicols['name'][$i]=='id')
- {
-
$datatable['headers']['header'][$i]['visible'] = false;
- }
- }
+ $msglog =
phpgwapi_cache::session_get('frontend','msgbox');
+ phpgwapi_cache::session_clear('frontend','msgbox');
+
+ $data = array(
+ 'header' => $this->header_state,
+ 'helpdesk' =>
array('datatable_def' => $datatable_def, 'tabs' => $this->tabs, 'filters' =>
$filters, 'location_id' => $this->location_id, 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog))),
+ 'lightbox_name' => lang('add ticket')
+ );
- //path for property.js
- $datatable['property_js'] =
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+ self::render_template_xsl(array('helpdesk',
'datatable_inline', 'frontend'), array('data' => $data));
+ }
+
+ public function query()
+ {
+ $bo = CreateObject('property.botts');
+
+ $search = phpgw::get_var('search');
+ $order = phpgw::get_var('order');
+ $draw = phpgw::get_var('draw', 'int');
+ $columns = phpgw::get_var('columns');
- // Pagination and sort values
- $datatable['pagination']['records_start'] =
(int)$bo->start;
- $datatable['pagination']['records_limit'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- if($dry_run)
- {
- $datatable['pagination']['records_returned'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $datatable['pagination']['records_returned']=
count($ticket_list);
- }
- $datatable['pagination']['records_total'] =
$bo->total_records;
+ $bo->status_id = phpgw::get_var('status_id', 'string',
'REQUEST', 'all');
- $datatable['sorting']['order'] =
phpgw::get_var('order', 'string'); // Column
+ $params = array(
+ 'start' => phpgw::get_var('start',
'int', 'REQUEST', 0),
+ 'results' => phpgw::get_var('length',
'int', 'REQUEST', 0),
+ 'query' => $search['value'],
+ 'order' =>
$columns[$order[0]['column']]['data'],
+ 'sort' => $order[0]['dir'],
+ 'allrows' => phpgw::get_var('length',
'int') == -1
+ );
- $appname = lang('helpdesk');
- $function_msg = lang('list ticket');
-
- if ( (phpgw::get_var("start")== "") &&
(phpgw::get_var("order",'string')== ""))
+ if(isset($this->location_code) && $this->location_code
!= '')
{
- $datatable['sorting']['order']
= 'entry_date'; // name key Column in myColumnDef
- $datatable['sorting']['sort']
= 'desc'; // ASC / DESC
+ $bo->location_code = $this->location_code;
+ $ticket_list = $bo->read($params);
}
else
{
- $datatable['sorting']['order']
= phpgw::get_var('order', 'string'); // name of column of Database
- $datatable['sorting']['sort']
= phpgw::get_var('sort', 'string'); // ASC / DESC
+ $ticket_list = null;
}
-//-- BEGIN----------------------------- JSON CODE
------------------------------
- //values for Pagination
- $json = 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()
- );
-
- // values for datatable
- if(is_array($datatable['rows']['row']))
+ if(is_array($ticket_list))
{
- foreach( $datatable['rows']['row'] as $row )
+ $status['X'] = array
+ (
+ 'status' =>
lang('closed')
+ );
+
+ $status['O'] = array
+ (
+ 'status' =>
isset($bo->config->config_data['tts_lang_open']) &&
$bo->config->config_data['tts_lang_open'] ?
$bo->config->config_data['tts_lang_open'] : lang('Open'),
+ );
+
+ $custom_status = $bo->get_custom_status();
+
+ foreach($custom_status as $custom)
{
- $json_row = array();
- foreach( $row['column'] as $column)
+ $status["C{$custom['id']}"] = array
+ (
+ 'status' =>
$custom['name'],
+ );
+ }
+
+ foreach($ticket_list as &$ticket)
+ {
+ if(array_key_exists($ticket['status'],
$status))
{
- $json_row[$column['name']] =
$column['value'];
+ $ticket['status'] =
$status[$ticket['status']]['status'];
}
- $json['records'][] = $json_row;
- }
+ }
}
- // right in datatable
- if(is_array($datatable['rowactions']['action']))
- {
- $json['rights'] =
$datatable['rowactions']['action'];
- }
+ $result_data = array('results' => $ticket_list);
- if( phpgw::get_var('phpgw_return_as') == 'json' )
- {
- return $json;
- }
+ $result_data['total_records'] = $bo->total_records;
+ $result_data['draw'] = $draw;
-
- $datatable['json_data'] = json_encode($json);
-//-------------------- JSON CODE ----------------------
-
-// Prepare template variables and process XSLT
-
- if ( !isset($GLOBALS['phpgw']->css) ||
!is_object($GLOBALS['phpgw']->css) )
- {
- $GLOBALS['phpgw']->css =
createObject('phpgwapi.css');
- }
-
- 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('paginator');
-
- // 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/paginator/assets/skins/sam/paginator.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('frontend') . ' - ' . $appname . ': ' . $function_msg;
-
-
$GLOBALS['phpgw']->css->add_external_file('property/js/tinybox2/style.css');
- $GLOBALS['phpgw']->js->validate_file('tinybox2',
'packed' , 'property');
- $GLOBALS['phpgw']->js->validate_file('yahoo',
'helpdesk.list' , 'frontend');
-
- $msglog =
phpgwapi_cache::session_get('frontend','msgbox');
- phpgwapi_cache::session_clear('frontend','msgbox');
-
- $data = array(
- 'header' => $this->header_state,
- 'tabs' => $this->tabs,
- 'helpdesk' => array('datatable' =>
$datatable, 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog))),
- 'lightbox_name' => lang('add ticket')
- );
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('frontend',
'helpdesk', 'datatable'));
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('app_data' => $data));
+ return $this->jquery_results($result_data);
}
-
+
private function cmp($a, $b)
{
$timea = explode('/', $a['date']);
@@ -506,14 +377,21 @@
$data = array(
'header' => $this->header_state,
'msgbox_data' => isset($msglog) ?
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog))
: array(),
- 'tabs' => $this->tabs,
'ticketinfo' => array(
+ 'helpdesklist' =>
$GLOBALS['phpgw']->link('/index.php',
+ array
+ (
+
'menuaction' => 'frontend.uihelpdesk.index',
+
'location_id' => $this->location_id
+ )),
'ticket' => $ticket,
- 'tickethistory' => $tickethistory2)
+ 'tickethistory' => $tickethistory2,
+ 'tabs' => $this->tabs,
+ 'location_id' => $this->location_id
+ )
);
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('frontend',
'ticketview'));
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('app_data' => $data));
+
+ self::render_template_xsl(array('frontend',
'ticketview'), array('data' => $data));
}
@@ -697,5 +575,6 @@
$GLOBALS['phpgw']->xslttpl->add_file(array('frontend','helpdesk','attributes_view'));
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('add_ticket' => $data));
}
+
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14324],
Nelson Guerra <=