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

Class: jqGridUtils

Source Location: /jqUtils.php

Class jqGridUtils

Class Overview

Located in /jqUtils.php [line 17]



		
				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   date_parse()   Converts the string date to array by using the pattern generated by generatePattern() function
static array   decode()   Decodes json string to PHP array. The function is used
static string   encode()   Encodes a PHP variable into javascript representation.
static string   generatePattern()   Internal function which generates regex pattern from date pattern
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 string|false   sprintfn()   version of sprintf for cases where named arguments are desired (php syntax)
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 363]

  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 date_parse  [line 239]

  static array date_parse( string $dateformat, string $date, boolean $localize  )

Converts the string date to array by using the pattern generated by generatePattern() function

Parameters:
string   $dateformat: 
string   $date: 
boolean   $localize: 

API Tags:
Access:  public


[ Top ]
static method decode  [line 159]

  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 107]

  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 generatePattern  [line 212]

  static string generatePattern( string $dateformat  )

Internal function which generates regex pattern from date pattern

Parameters:
string   $dateformat: 

API Tags:
Access:  public


[ Top ]
static method GetParam  [line 346]

  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 333]

  static mixed parseDate( string $patternFrom, string $date, [string $patternTo = '']  )

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

If the $patternTo is not set return the timestamp.

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

API Tags:
Access:  public


[ Top ]
static method phpTojsDate  [line 382]

  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 82]

  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 sprintfn  [line 447]

  static string|false sprintfn( string $format, [ $args = array()]  )

version of sprintf for cases where named arguments are desired (php syntax)

with sprintf: sprintf('second: %2$s ; first: %1$s', '1st', '2nd');

with sprintfn: sprintfn('second: %second$s ; first: %first$s', array( 'first' => '1st', 'second'=> '2nd' ));

Parameters:
string   $format:  sprintf format string, with any number of named arguments
array   $args:  array of [ 'arg_name' => 'arg value', ... ] replacements to be made

API Tags:
Return:  result of sprintf call, or bool false on error
Access:  public


[ Top ]
static method Strip  [line 186]

  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 28]

  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 Wed, 22 Jun 2011 14:57:51 +0300 by phpDocumentor 1.4.3