tangra logo
   
[ class tree: tangra_lib ] [ index: tangra_lib ] [ all elements ]
 

Class: Grid_Ctrl

Source Location: /grids/grid_ctrl.class.php

Class Grid_Ctrl

Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Tangra_Class

Tangra_Class::get_class_name()
Alias of get_class(). Exist because of historical reasons.
Tangra_Class::__set()
Overides PHP built-in method and just throws exception if called. Purpose - to "forbid" autosetting of nonexisting class properties.

[ Top ]
Property Summary
array   $additional_parameters   Holds array of additional parameters passed to the controller.
Grid   $grid   Grid object
unknown_type   $method   Method for passing set page command
Paginate_DB_Data   $paginate_db_data   Paginator object
unknown_type   $system_name   Controller name
string   $user_defined_post_processing_method   Holds name of user defined method (if set)
Vars_Manager   $vm   Vars manager

[ Top ]
Method Summary
Grid_Ctrl   __construct()   Constructor
void   add_additional_parameter()   Adds new additional parameter
void   create_grid()   Overoload this method, create your Grid object and return it
void   create_paginate_db_data()   Overload this method, create Paginate_DB_Data and return it
integer   detect_page()   Detects current page number.
void   get_additional_parameter()   Returns value ot additional parameter
array   get_additional_parameters()   Returns all additional parameters as array
Grid   get_grid()   Returns reference to grid object
Web_Event_Si   get_grid_set_page_event()   Returns web event for set page command
unknown   get_method()   Returns method for receiving commands
Paginate_DB_Data   get_paginate_db_data()   Returns reference to Paginate_DB_Data object
unknown   get_system_name()   Returns grid's system name
TPLE_Exports   get_tple_exports()   Get TPLE Exports for the grid
string   get_user_defined_post_processing_method()   Returns name of the user defined method that will be called for postprocessing of the rows
unknown   get_vm()   Returns reference to Vars_Manager object
void   init()   Initializes the object
void   prepare_sqls()   Have to be overwriten and sqls for the Paginate_DB_Data have to be set inside.
void   process()   Process the grid
array   retrieve_rows()   Retrieves rows from DB
void   send_data_to_grid()   Sends retrieved rows and other data to the grid object
void   set_additional_parameters()   Sets additional_parameters at once
void   set_method()   Sets method for receiving command
void   set_page()   Sets current page
void   set_system_name()   Sets system name
void   set_user_defined_post_processing_method()   Sets user defined method that will be called for postprocessing of the rows
void   set_vm()   Sets Vars_Manager object
void   _create_grid()   Ensures that object returned by $this->create_grid(); will be instance of Grid
void   _create_paginate_db_data()   Ensures that object returned by $this->create_paginate_db_data(); will beinstance of Paginate_DB_Data

[ Top ]
Properties
array   $additional_parameters = array() [line 105]

Holds array of additional parameters passed to the controller.

API Tags:
Access:  protected


[ Top ]
Grid   $grid [line 66]

Grid object

API Tags:
Internal:  
Access:  protected


[ Top ]
unknown_type   $method [line 98]

Method for passing set page command

API Tags:
Internal:  
Access:  private


[ Top ]
Paginate_DB_Data   $paginate_db_data [line 74]

Paginator object

API Tags:
Internal:  
Access:  protected


[ Top ]
unknown_type   $system_name [line 82]

Controller name

API Tags:
Internal:  
Access:  private


[ Top ]
string   $user_defined_post_processing_method [line 113]

Holds name of user defined method (if set)

API Tags:
Access:  private


[ Top ]
Vars_Manager   $vm [line 90]

Vars manager

API Tags:
Internal:  
Access:  private


[ Top ]
Methods
Constructor __construct  [line 123]

  Grid_Ctrl __construct( string $system_name, Vars_Manager $vm, [integer $method = Tangra_Parameter_Method::GET]  )

Constructor

Parameters:
string   $system_name: 
Vars_Manager   $vm:  Permanent Vars_Manager that will be used. Session of Thread VM
integer   $method:  Tangra_Parameter_Method::GET or Tangra_Parameter_Method::POST or Tangra_Parameter_Method::PI


[ Top ]
add_additional_parameter  [line 418]

  void add_additional_parameter( string $name, mixed $value  )

Adds new additional parameter

Please note that this parameter will be also added to grid's external parameters.

Parameters:
string   $name: 
mixed   $value: 

API Tags:
Access:  public

Information Tags:
Throws:  TE_Key_Already_Exists

[ Top ]
create_grid  [line 482]

  void create_grid( )

Overoload this method, create your Grid object and return it


API Tags:
Abstract:  
Access:  protected


[ Top ]
create_paginate_db_data  [line 488]

  void create_paginate_db_data( )

Overload this method, create Paginate_DB_Data and return it


API Tags:
Abstract:  
Access:  protected


[ Top ]
detect_page  [line 500]

  integer detect_page( integer $page  )

Detects current page number.

Will return current page number. If $page is passed - will return that value otherwise will retrieve current page from permanent VM.

Parameters:
integer   $page: 

API Tags:
Access:  protected


[ Top ]
get_additional_parameter  [line 463]

  void get_additional_parameter( string $name, [boolean $forgiving = false]  )

Returns value ot additional parameter

Parameters:
string   $name: 
boolean   $forgiving: 

API Tags:
Access:  protected

Information Tags:
Throws:  TE_Key_Not_Exists

[ Top ]
get_additional_parameters  [line 450]

  array get_additional_parameters( )

Returns all additional parameters as array


API Tags:
Return:  Simple array, key => value pairs
Access:  public


[ Top ]
get_grid  [line 210]

  Grid get_grid( )

Returns reference to grid object


API Tags:
Access:  public


[ Top ]
get_grid_set_page_event  [line 186]

  Web_Event_Si get_grid_set_page_event( )

Returns web event for set page command


API Tags:
Access:  public


[ Top ]
get_method  [line 277]

  unknown get_method( )

Returns method for receiving commands


API Tags:
Access:  public


[ Top ]
get_paginate_db_data  [line 220]

  Paginate_DB_Data get_paginate_db_data( )

Returns reference to Paginate_DB_Data object


API Tags:
Access:  public


[ Top ]
get_system_name  [line 200]

  unknown get_system_name( )

Returns grid's system name


API Tags:
Access:  public


[ Top ]
get_tple_exports  [line 173]

  TPLE_Exports get_tple_exports( )

Get TPLE Exports for the grid


API Tags:
Access:  public


[ Top ]
get_user_defined_post_processing_method  [line 312]

  string get_user_defined_post_processing_method( )

Returns name of the user defined method that will be called for postprocessing of the rows


API Tags:
Access:  public


[ Top ]
get_vm  [line 241]

  unknown get_vm( )

Returns reference to Vars_Manager object


API Tags:
Internal:  
Access:  protected


[ Top ]
init  [line 321]

  void init( )

Initializes the object


API Tags:
Access:  protected


[ Top ]
prepare_sqls  [line 404]

  void prepare_sqls( )

Have to be overwriten and sqls for the Paginate_DB_Data have to be set inside.


API Tags:
Access:  protected


[ Top ]
process  [line 143]

  void process( DB_Connection $dbc, [integer $page = NULL]  )

Process the grid

This method will load page passed with $page or will load current_page

Parameters:
DB_Connection   $dbc:  DB_Connection object
integer   $page:  Page to be loaded. Default = NULL - will load current page

API Tags:
Access:  public


[ Top ]
retrieve_rows  [line 520]

  array retrieve_rows( DB_Connection $dbc, integer $page  )

Retrieves rows from DB

Parameters:
DB_Connection   $dbc: 
integer   $page:  Rows for page $page will be retrieved

API Tags:
Access:  protected


[ Top ]
send_data_to_grid  [line 545]

  void send_data_to_grid( array $rows, integer $page, integer $total_pages, integer $total_rows  )

Sends retrieved rows and other data to the grid object

Parameters:
array   $rows: 
integer   $page: 
integer   $total_pages: 
integer   $total_rows: 

API Tags:
Access:  protected


[ Top ]
set_additional_parameters  [line 434]

  void set_additional_parameters( array $params  )

Sets additional_parameters at once

Parameters:
array   $params:  Simple array key => value pairs

API Tags:
Access:  public

Information Tags:
Throws:  Tangra_Exception

[ Top ]
set_method  [line 254]

  void set_method( integer $method  )

Sets method for receiving command

Parameters:
integer   $method: 

API Tags:
Internal:  
Access:  protected


[ Top ]
set_page  [line 337]

  void set_page( integer $page  )

Sets current page

Parameters:
integer   $page: 

API Tags:
Access:  protected


[ Top ]
set_system_name  [line 375]

  void set_system_name( unknown_type $system_name  )

Sets system name

Parameters:
unknown_type   $system_name: 

API Tags:
Internal:  
Access:  protected

Information Tags:
Throws:  Tangra_Exception

[ Top ]
set_user_defined_post_processing_method  [line 299]

  void set_user_defined_post_processing_method( string $method_name  )

Sets user defined method that will be called for postprocessing of the rows

Two parameters will be passed to postprocessing method: $dbc and $rows where $dbc is DB_Connection instance and $rows contains all rows of the current page of the grid. Postprocessing method have to return an array containing new/modified data. Access to postprocessing method have to be "protected" in order grid_ctrl to be able to call it.

Example: $this->set_user_defined_post_processing_method('my_postprocessing');

protected function my_posprocessing(DB_Connection $dbc, $rows) { // ..some processing - for example loading additional data per row, doing some calculation with existing data and populating new row cell, etc. return $new_rows; }

Parameters:
string   $method_name:  This method have to be defined in descendant class otherwise exception will be thrown

API Tags:
Access:  public

Information Tags:
Throws:  Tangra_Exception

[ Top ]
set_vm  [line 230]

  void set_vm( Vars_Manager $vm  )

Sets Vars_Manager object

Parameters:
Vars_Manager   $vm: 

API Tags:
Access:  protected


[ Top ]
_create_grid  [line 357]

  void _create_grid( )

Ensures that object returned by $this->create_grid(); will be instance of Grid


API Tags:
Access:  protected

Information Tags:
Throws:  Tangra_Exception

[ Top ]
_create_paginate_db_data  [line 389]

  void _create_paginate_db_data( )

Ensures that object returned by $this->create_paginate_db_data(); will beinstance of Paginate_DB_Data


API Tags:
Access:  protected

Information Tags:
Throws:  Tangra_Exception

[ Top ]
Constants
SET_PAGE_CAPTURE = 'page' [line 58]

Capture for setting page


[ Top ]