[phpwebapp-commits] CVS: web_app/session class.Session.php,1.16,1.17
Brought to you by:
dashohoxha
From: Dashamir H. <das...@us...> - 2006-01-04 08:32:49
|
Update of /cvsroot/phpwebapp/web_app/session In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9661/session Modified Files: class.Session.php Log Message: Index: class.Session.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/session/class.Session.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** class.Session.php 4 Nov 2005 06:54:14 -0000 1.16 --- class.Session.php 4 Jan 2006 08:32:38 -0000 1.17 *************** *** 269,272 **** --- 269,310 ---- /** + * Get all the state variables of a webobject + * and return them as an associative array. + * The optional parameter $type accepts the values "DB" + * and "JS", and depending on this parameter the function + * returns DB vars, JS vars or all of them (if undefined). + */ + function getObjVars($obj_id, $type =UNDEFINED) + { + switch ($type) + { + case "DB": + $arr_vars = $this->dbVars; + break; + case "JS": + $arr_vars = $this->Vars; + break; + default: + print WebApp::warning_msg("WebObject::getSVars(): unreckognized \$type '$type'."); + case UNDEFINED: + $arr_vars = array_merge($this->Vars, $this->dbVars); + break; + } + + $stateVars = array(); + $pattern = "^".$obj_id."->(.*)"; + while (list($var_name,$var_value) = each($arr_vars)) + { + if (ereg($pattern, $var_name, $regs)) + { + $v_name = $regs[1]; + $stateVars[$v_name] = $var_value; + } + } + + return $stateVars; + } + + /** * Builds and returns the variable $session_vars which is used to insert * the session vars inside the page as JavaScript code. |