[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12584] class.uis_agreement.inc
From: |
Saul |
Subject: |
[Fmsystem-commits] [12584] class.uis_agreement.inc |
Date: |
Mon, 12 Jan 2015 23:25:39 +0000 |
Revision: 12584
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12584
Author: psaul
Date: 2015-01-12 23:25:39 +0000 (Mon, 12 Jan 2015)
Log Message:
-----------
class.uis_agreement.inc
Modified Paths:
--------------
branches/dev-syncromind/property/inc/class.uis_agreement.inc.php
Modified: branches/dev-syncromind/property/inc/class.uis_agreement.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uis_agreement.inc.php
2015-01-12 23:24:55 UTC (rev 12583)
+++ branches/dev-syncromind/property/inc/class.uis_agreement.inc.php
2015-01-12 23:25:39 UTC (rev 12584)
@@ -31,11 +31,11 @@
* Description
* @package property
*/
-
+ phpgw::import_class('phpgwapi.uicommon_jquery');
phpgw::import_class('phpgwapi.jquery');
- phpgw::import_class('phpgwapi.yui');
+ //phpgw::import_class('phpgwapi.yui');
- class property_uis_agreement
+ class property_uis_agreement extends phpgwapi_uicommon_jquery
{
var $grants;
var $cat_id;
@@ -47,6 +47,7 @@
var $public_functions = array
(
+ 'query' => true,
'index' => true,
'view' => true,
'edit' => true,
@@ -60,8 +61,10 @@
'get_vendor_member_info'=> true
);
- function property_uis_agreement()
+ function __construct()
{
+ parent::__construct();
+
$GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
$GLOBALS['phpgw_info']['flags']['menu_selection'] =
'property::agreement::service';
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
@@ -171,6 +174,58 @@
$bofiles->view_file('service_agreement');
}
+ private function _get_Filters()
+ {
+ $values_combo_box = array();
+ $combos = array();
+
+ $values_combo_box[0] =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> true,'link_data' =>$link_data));
+ $default_value = array ('cat_id'=>'','name'=> lang('no member'));
+ foreach ($values_combo_box[0]['cat_list'] as &$list){
+
+ $list['id'] = $list['cat_id'];
+ }
+ array_unshift ($values_combo_box[0]['cat_list'],$default_value);
+ $combos[] = array(
+ 'type' => 'filter',
+ 'name' => 'member_id',
+ 'text' => lang('Member'),
+ 'list' => $values_combo_box[0]['cat_list']
+ );
+
+ $values_combo_box[1] =
$this->bocommon->select_category_list(array('format'=>'filter','selected' =>
$this->cat_id,'type' =>'s_agreement','order'=>'descr'));
+ $default_value = array ('id'=>'','name'=>lang('no category'));
+ array_unshift ($values_combo_box[1],$default_value);
+ $combos[] = array(
+ 'type' => 'filter',
+ 'name' => 'cat_id',
+ 'text' => lang('Category'),
+ 'list' => $values_combo_box[1]
+ );
+
+ $values_combo_box[2] =
$this->bo->select_vendor_list('filter',$this->vendor_id);
+ $default_value = array ('id'=>'','name'=>lang('no vendor'));
+ array_unshift ($values_combo_box[2],$default_value);
+ $combos[] = array(
+ 'type' => 'filter',
+ 'name' => 'vendor_id',
+ 'text' => lang('Vendor'),
+ 'list' => $values_combo_box[2]
+ );
+
+ $values_combo_box[3] =
$this->bo->select_status_list('filter',$this->status_id);
+ $default_value = array ('id'=>'','name'=>lang('no status'));
+ array_unshift ($values_combo_box[3],$default_value);
+ $combos[] = array(
+ 'type' => 'filter',
+ 'name' => 'status_id',
+ 'text' => lang('Status'),
+ 'list' => $values_combo_box[3]
+ );
+
+ return $combos;
+ }
+
function index()
{
if(!$this->acl_read)
@@ -181,10 +236,68 @@
$receipt =
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt');
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt','');
- $datatable = array();
- $this->save_sessiondata();
+ if( phpgw::get_var('phpgw_return_as') == 'json' )
+ {
+ return $this->query();
+ }
+
+
self::add_javascript('phpgwapi','jquery','editable/jquery.jeditable.js');
+
self::add_javascript('phpgwapi','jquery','editable/jquery.dataTables.editable.js');
- if( phpgw::get_var('phpgw_return_as') != 'json' )
+ $appname = lang('agreement');
+ $function_msg = lang('List') . ' ' .
lang($this->role);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+ $data = array(
+ 'datatable_name' => $appname,
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array(
+ 'type' => 'link',
+ 'value' => lang('new'),
+ 'href' => self::link(array(
+ 'menuaction' =>
'property.uis_agreement.edit',
+ 'role'
=> $this->role
+ )),
+ 'class' => 'new_item'
+ ),
+ array(
+ 'type' => 'link',
+ 'value' => lang('columns'),
+ 'href' => '#',
+ 'class' => '',
+ 'onclick' =>
"JqueryPortico.openPopup({menuaction:'property.uis_agreement.columns',
role:'{$this->role}'},{closeAction:'reload'})"
+ )
+ )
+ )
+ ),
+ 'datatable' => array(
+ 'source' => self::link(array(
+ 'menuaction' => 'property.uis_agreement.index',
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'role' =>
$this->role,
+ 'member_id' =>
$this->member_id,
+ 'p_num' =>
$this->p_num,
+ 'status_id' =>
$this->status_id,
+ 'location_code' =>
$this->location_code,
+ 'phpgw_return_as' => 'json'
+ )),
+ 'download' => self::link(array(
+ 'menuaction' => 'property.uis_agreement.download',
+ 'id' => $id
+ )),
+ 'allrows' => true,
+ 'editor_action' => '',
+ 'field' => array()
+ )
+ );
+ //$datatable = array();
+ //$this->save_sessiondata();
+
+ /*if( phpgw::get_var('phpgw_return_as') != 'json' )
{
$datatable['menu']
= $this->bocommon->get_menu();
$datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
@@ -380,15 +493,31 @@
);
// $dry_run = true;
- }
+ }*/
- $list = $this->bo->read();
-//_debug_array($list);
+ $filters = $this->_get_Filters();
+ foreach ($filters as $filter) {
+ array_unshift($data['form']['toolbar']['item'], $filter);
+ }
+
+ $list = $this->bo->read(array('dry_run' => true));
$uicols = $this->bo->uicols;
- $j = 0;
+ //$j = 0;
$count_uicols_name = count($uicols['name']);
-
- if (isset($list) AND is_array($list))
+
+ for ($k = 0; $k < $count_uicols_name; $k++)
+ {
+ $params = array
+ (
+ 'key' => $uicols['name'][$k],
+ 'label' => $uicols['descr'][$k],
+ 'sortable' =>
($uicols['sortable'][$k])?false:true,
+ 'hidden' => ($uicols['input_type'][$k] ==
'hidden')?true:false
+ );
+
+ array_push($data['datatable']['field'], $params);
+ }
+ /*if (isset($list) AND is_array($list))
{
foreach($list as $list_entry)
{
@@ -402,9 +531,9 @@
}
$j++;
}
- }
+ }*/
- $datatable['rowactions']['action'] = array();
+ //$datatable['rowactions']['action'] = array();
$parameters = array
(
@@ -432,7 +561,7 @@
if($this->acl_read)
{
- $datatable['rowactions']['action'][] = array
+ $data['datatable']['actions'][] = array
(
'my_name'
=> 'view',
'statustext' => lang('view
this entity'),
@@ -442,14 +571,14 @@
'menuaction' =>
'property.uis_agreement.view',
'role'
=> $this->role
)),
- 'parameters' => $parameters
+ 'parameters' =>
json_encode($parameters)
);
$jasper = execMethod('property.sojasper.read',
array('location_id' => $GLOBALS['phpgw']->locations->get_id('property',
$this->acl_location)));
foreach ($jasper as $report)
{
- $datatable['rowactions']['action'][] =
array
+ $data['datatable']['actions'][] = array
(
'my_name'
=> 'edit',
'text'
=> lang('open JasperReport %1 in new window', $report['title']),
@@ -459,14 +588,14 @@
'jasper_id'
=> $report['id'],
'target'
=> '_blank'
)),
- 'parameters'
=> $parameters
+ 'parameters'
=> json_encode($parameters)
);
}
}
if($this->acl_edit)
{
- $datatable['rowactions']['action'][] = array
+ $data['datatable']['actions'][] = array
(
'my_name'
=> 'edit',
'statustext' => lang('edit
this entity'),
@@ -476,13 +605,13 @@
'menuaction' =>
'property.uis_agreement.edit',
'role'
=> $this->role
)),
- 'parameters' => $parameters
+ 'parameters' =>
json_encode($parameters)
);
}
if($this->acl_delete)
{
- $datatable['rowactions']['action'][] = array
+ $data['datatable']['actions'][] = array
(
'my_name'
=> 'delete',
'statustext' => lang('delete
this entity'),
@@ -493,13 +622,13 @@
'menuaction' =>
'property.uis_agreement.delete',
'role'
=> $this->role
)),
- 'parameters' => $parameters2
+ 'parameters' =>
json_encode($parameters2)
);
}
if($this->acl_add)
{
- $datatable['rowactions']['action'][] = array
+ $data['datatable']['actions'][] = array
(
'my_name'
=> 'add',
'statustext' => lang('add an
entity'),
@@ -515,7 +644,7 @@
unset($parameters);
unset($parameters2);
- for ($i=0;$i<$count_uicols_name;$i++)
+ /*for ($i=0;$i<$count_uicols_name;$i++)
{
if($uicols['input_type'][$i]!='hidden')
{
@@ -529,13 +658,6 @@
$datatable['headers']['header'][$i]['sortable'] = true;
$datatable['headers']['header'][$i]['sort_field'] = $uicols['name'][$i];
}
-/*
- if($uicols['name'][$i]=='category')
- {
-
$datatable['headers']['header'][$i]['sortable'] = true;
-
$datatable['headers']['header'][$i]['sort_field'] = 'org_name';
- }
-*/
}
}
@@ -645,12 +767,54 @@
$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('property') . ' - ' . $appname . ': ' . $function_msg;
- $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'uisagreement.index', 'property' );
+ $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'uisagreement.index', 'property' );*/
+
+ self::render_template_xsl('datatable_jquery',$data);
}
+ public function query()
+ {
+ $search = phpgw::get_var('search');
+ $order = phpgw::get_var('order');
+ $draw = phpgw::get_var('draw', 'int');
+ $columns = phpgw::get_var('columns');
+
+ $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,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'member_id'=>$this->member_id,
+ 'vendor_id'=>$this->vendor_id,
+ 'p_num' => $this->p_num,
+ 'status_id'=>$this->status_id,
+ 'location_code' => $this->location_code
+ );
+
+ $result_objects = array();
+ $result_count = 0;
+
+ $values = $this->bo->read($params);
+
+ if( phpgw::get_var('export','bool'))
+ {
+ return $values;
+ }
+
+ $result_data = array('results' => $values);
+ $result_data['total_records'] = $this->bo->total_records;
+ $result_data['draw'] = $draw;
+
+ return $this->jquery_results($result_data);
+ }
+
function list_content($list,$uicols,$edit_item='',$view_only='')
{
$j=0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12584] class.uis_agreement.inc,
Saul <=