phpDocumentor jqGrid
[ class tree: jqGrid ] [ index: jqGrid ] [ all elements ]

Class: jqGridUtils

Source Location: /jqGrid.php

Class jqGridUtils

Class Overview

Located in /jqGrid.php [line 2422]



		
				Author(s):
		
  • Tony Tomov, (tony@trirand.com)
API Tags:
Abstract:  Helper functions for the jqGrid package

Information Tags:
Copyright:  TriRand Ltd

Methods

[ Top ]
Method Summary
static array   array_extend()   "Extend" recursively array $a with array $b values (no deletion in $a, just added and updated values)
static array   decode()   Decodes json string to PHP array. The function is used
static string   encode()   Encodes a PHP variable into javascript representation.
static mixed   GetParam()   Return the value from POST or from GET
static mixed   parseDate()   Parses a $format and $date value and return the date formated via $newformat.
static void   phpTojsDate()   Convert the php date string to Java Script date string
static string   quote()   Quotes a javascript string.
static mixed   Strip()   Strip slashes from a varaible if PHP magic quotes are on
static string   toXml()   Function for converting to an XML document.

[ Top ]
Methods
static method array_extend  [line 2672]

  static array array_extend( array $a, array $b  )

"Extend" recursively array $a with array $b values (no deletion in $a, just added and updated values)

Parameters:
array   $a: 
array   $b: 

API Tags:
Access:  public


[ Top ]
static method decode  [line 2564]

  static array decode( string $json  )

Decodes json string to PHP array. The function is used

when the encoding is diffrent from utf-8

Parameters:
string   $json:  string to decode

API Tags:
Access:  public


[ Top ]
static method encode  [line 2512]

  static string encode( mixed $value  )

Encodes a PHP variable into javascript representation.

Example:

 $options=array('key1'=>true,'key2'=>123,'key3'=>'value');
 echo jqGridUtils::encode($options);
 // The following javascript code would be generated:
 // {'key1':true,'key2':123,'key3':'value'}

For highly complex data structures use jsonEncode and jsonDecode to serialize and unserialize.

Parameters:
mixed   $value:  PHP variable to be encoded

API Tags:
Return:  the encoded string
Access:  public


[ Top ]
static method GetParam  [line 2655]

  static mixed GetParam( string $parameter_name, [string $default_value = ""]  )

Return the value from POST or from GET

Parameters:
string   $parameter_name: 
string   $default_value: 

API Tags:
Access:  public


[ Top ]
static method parseDate  [line 2620]

  static mixed parseDate( string $format, string $date, [string $newformat = '']  )

Parses a $format and $date value and return the date formated via $newformat.

If the $newformat is not set return the timestamp. Support only numeric date format as input, but the $new format can be any valid PHP date format

Parameters:
string   $format:  the format of the date to be parsed
string   $date:  the value of the data.
string   $newformat:  the new format of the $date

API Tags:
Access:  public


[ Top ]
static method phpTojsDate  [line 2691]

  static void phpTojsDate( string $phpdate  )

Convert the php date string to Java Script date string

Parameters:
string   $phpdate: 

API Tags:
Access:  public


[ Top ]
static method quote  [line 2487]

  static string quote( string $js, [boolean $forUrl = false]  )

Quotes a javascript string.

After processing, the string can be safely enclosed within a pair of quotation marks and serve as a javascript string.

Parameters:
string   $js:  string to be quoted
boolean   $forUrl:  whether this string is used as a URL

API Tags:
Return:  the quoted string
Access:  public


[ Top ]
static method Strip  [line 2591]

  static mixed Strip( mixed $value  )

Strip slashes from a varaible if PHP magic quotes are on

Parameters:
mixed   $value:  to be striped

API Tags:
Access:  public


[ Top ]
static method toXml  [line 2433]

  static string toXml( array $data, [string $rootNodeName = 'root'], [SimpleXMLElement $xml = null], [ $encoding = 'utf-8'], [ $cdata = false]  )

Function for converting to an XML document.

Pass in a multi dimensional array or object and this recrusively loops through and builds up an XML document.

Parameters:
array   $data: 
string   $rootNodeName:  - what you want the root node to be - defaultsto data.
SimpleXMLElement   $xml:  - should only be used recursively
   $encoding: 
   $cdata: 

API Tags:
Return:  XML
Access:  public


[ Top ]

Documentation generated on Thu, 16 Sep 2010 11:18:57 +0300 by phpDocumentor 1.4.3