This is a documentation for Board Game Arena: play board games online !

Studio function reference: 두 판 사이의 차이

Board Game Arena
둘러보기로 이동 검색으로 이동
(Created page with "This page references useful server side and client side functions, so that nobody needs to reinvent the wheel (unless he wants to). == Server side (PHP functions) == ; todo ...")
 
편집 요약 없음
3번째 줄: 3번째 줄:
== Server side (PHP functions) ==
== Server side (PHP functions) ==


; todo : todo
=== APP_GameAction class <gamename>.action.php ===


; function isArg( $argName )
: Is this argument filled ?
; function getArg( $argName, $argType, $mandatory=false, $default=NULL, $argTypeDetails=array(), $bCanFail=false  )
: Get script argument with the correct type
: bCanFail means than a validation failure is possible (user input)
: The main argType values are as follows.
<pre>
define( 'AT_int', 0 );        //  an integer
define( 'AT_posint', 1 );    //  a positive integer
define( 'AT_float', 2 );      //  a float
define( 'AT_email', 3 );      //  an email 
define( 'AT_url', 4 );        //  a URL
define( 'AT_bool', 5 );      //  1/0/true/false
define( 'AT_enum', 6 );      //  argTypeDetails list the possible values
define( 'AT_alphanum', 7 );  //  only 0-9a-zA-Z_ and space
</pre>
=== Table class (<gamename>.game.php) ===


== Client side (Javascript functions) ==
== Client side (Javascript functions) ==


; todo : todo
; todo : todo

2012년 11월 25일 (일) 20:37 판

This page references useful server side and client side functions, so that nobody needs to reinvent the wheel (unless he wants to).

Server side (PHP functions)

APP_GameAction class <gamename>.action.php

function isArg( $argName )
Is this argument filled ?
function getArg( $argName, $argType, $mandatory=false, $default=NULL, $argTypeDetails=array(), $bCanFail=false )
Get script argument with the correct type
bCanFail means than a validation failure is possible (user input)
The main argType values are as follows.
define( 'AT_int', 0 );        //  an integer
define( 'AT_posint', 1 );     //  a positive integer 
define( 'AT_float', 2 );      //  a float
define( 'AT_email', 3 );      //  an email  
define( 'AT_url', 4 );        //  a URL
define( 'AT_bool', 5 );       //  1/0/true/false
define( 'AT_enum', 6 );       //  argTypeDetails list the possible values
define( 'AT_alphanum', 7 );   //  only 0-9a-zA-Z_ and space

Table class (<gamename>.game.php)

Client side (Javascript functions)

todo
todo