Post by Kristal Rose Phoenix McKinstry on Oct 17, 2005 3:26:03 GMT -5
<?php
##########################################################################################
######################### SMC CS85 CHESS PROGRAM #########################################
##########################################################################################
if ($ulShowVersions) print('
//DataGameWonAlready
#### oCollectFormVars.rp #################################################################<br />
#### 2005.11.09 21:15 - km deleted obsolete field LastState. ###############<br />
#### 2005.11.07 07:00 - km Basic function of oCFV.fGetProcess. ###############<br />
#### 2005.11.07 05:00 - km added fFlipMove. ###############<br />
#### 2005.11.07 07:00 - km chess.php now uses oCFV.fGetProcess list of processes. ########<br />
#### 2005.11.06 19:25 - km DELETED fGetRequestType. ###############<br />
#### 2005.11.06 05:15 - km CREATED fGetProcess to replace fGetRequestType. ###############<br />
#### 2005.11.06 03:45 - km deleted #$llvlIsNew. ###############<br />
#### 2005.11.06 03:45 - km deleted hidden vars: submitter,submit,formId,LastState ########<br />
#### 2005.11.06 03:00 - km deleted test fields. ###############<br />');
#### 2005.11.05 03:00 - km filled fGetMove. ###############
#### 2005.11.05 02:15 - km deleted refresh seconds button. ###############
#### 2005.11.05 02:10 - km totally redid fGetRequestType logic. ###############
#### 2005.11.04 05:40 - km deleted fGetSubmitter. Use oReg->fIsPlayersturn.###############
#### 2005.11.04 05:40 - km lots of work on fGetRequestType. ###############
#### 2005.11.04 01:05 - km corrected Typos in xvbLogIn and xvbLogIn. ###############
#### 2005.11.03 05:45 - km improved docs. ###############
#### 2005.10.30 02:25 - km added RegisterPartner to fGetGetRequestType. ###############
#### 2005.10.29 08:00 - km added $vhLastState for refresh of forum. ###############
#### 2005.10.29 02:30 - km added uaOthers array for storing SelectPlayers vals. ##########
#### 2005.10.28 20:45 - km added oCFV->fSetVal($lsValName, $lsNewVal). ###############
#### 2005.10.26 19:40 - km added $ulShowVersions for testing. ###############
#### 2005.10.25 04:20 - km Added GUI testing vars (btn & text field). ###############
#### 2005.10.24 05:55 - km Added Forum Features. ###############
#### 2005.10.22 19:35 - km ADDED row/col Move hidden fields. ####################
#### 2005.10.22 19:05 - km Deleted unnecessary methods. ####################
#### 2005.10.22 19:05 - km Added default oCollectFormVars instead. ####################
#### 2005.10.21 20:50 - km EDITED btn NAMES, added index to $laCFV to ####################
#### isolate sSetPageVarsObj and oCollectFormVars from each other. ####################
#### 2005.10.20 20:50 - km EDITED VAR NAMES for consistency with new conventions #########
#### 2005.10.19 05:15 - km altered temp fSetFormVars ####################################
#### 2005.10.17 02:00 - km added Title block #############################################
#### 2005.10.17 01:30 - km build switch, test (dummy ret-val for oCFV returns ############
##########################################################################################
##########################################################################################
#### Status: LOCKED by KM ################################################################
#### Kristal McKinstry has volunteered to write this entire object #######################
##########################################################################################
##########################################################################################
#### Description: ####################################
#### ####################################
#### ####################################
#### ######################
##########################################################################################
##########################################################################################
#### Ver. 1.0 - Incomplete stub code #####################################################
##########################################################################################
#### Agenda: #############################################################################
#### #############
#### SITUATION: Other player needs informed if he has been selected! #############
#### [ ] fGetRequest now needs to figure out or save former state #############
#### because of forum post requests. see $vhLastState. #############
#### [x] !!!! Globally changed $llvlIsNew and $liviSubmitter to $llvlIsNew #############
#### and $liviSubmitter for macro consistency !!!! #############
#### Deal with integer string values. ##################################
#### ###################################
#### #############################################################################
##########################################################################################
##########################################################################################
#### Programmers: Kristal McKinstry, #################
##########################################################################################
##########################################################################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class oCollectFormVars {
var $lsvhPlayer = 'zilch'; //
var $livhMoveFromRow = 0;
var $livhMoveFromCol = 0;
var $livhMoveToRow = 0;
var $livhMoveToCol = 0;
var $lsvtPlayer = 'zilch';
var $lsvbLogIn = 'zilch'; //value="Log-in"
var $lsvbCheck = 'zilch'; //value="Check Status"
var $lsvbLogOut = 'zilch'; //value="Log-out"
var $lsvsOtherPlayer = 'zilch';
var $lsvsMove = 'zilch';
var $lsvsColors = 'zilch';
var $lsvsSet = 'zilch';
var $lsvcIncludeChat = 'zilch'; // zilch or yes
// Forum Variables //
var $lsvcIsPublic = 'zilch'; // zilch or yes
var $lsvcShowPublic = 'zilch'; // zilch or yes
var $lsvsBegin = "0"; // "0" default
var $lsvsEnd = "0"; // "0" default
var $lsvaComment = ""; // empty string
var $lsvsDelete = "0"; // "0" default
var $lsvsModify = "0"; // "0" default
var $lsvbForumPost = 'zilch'; // zilch or "Post comment"
// end-Forum Variables //
var $lauaOthers = 'zilch'; // To populate SelectPlayer within oBuildGui.
// Set in functions ie LogIn w/ $laOthers = $loReg->fGetOtherPlayers($lsId);
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function oCollectFormVars ($laReqdInput){
##echo "<br />Default oCollectFormVars constructor called <br /> using $laReqdInput";
$this->lsvhPlayer = $laReqdInput['xvhPlayer']; // player unique id. = 'zilch';
$this->livhMoveFromRow = $laReqdInput['xvhMoveFromRow']; // = 0, integer may come in as string though.
$this->livhMoveFromCol = $laReqdInput['xvhMoveFromCol']; // = 0, integer may come in as string though.
$this->livhMoveToRow = $laReqdInput['xvhMoveToRow']; // = 0, integer may come in as string though.
$this->livhMoveToCol = $laReqdInput['xvhMoveToCol']; // = 0, integer may come in as string though.
$this->lsvtPlayer = $laReqdInput['xvtPlayer']; // player display name. = 'zilch'; // not persistent! Use oReg->fGenNameFromId()
$this->lsvbLogIn = $laReqdInput['xvbLogIn']; // log-in. = FALSE; //value="Log-in"
$this->lsvbCheck = $laReqdInput['xvbCheck']; // Check status. = FALSE; //value="Check Status"
$this->lsvbLogOut = $laReqdInput['xvbLogOut']; //log-out. = FALSE; //value="Log-out"
$this->lsvsOtherPlayer = $laReqdInput['xvsOtherPlayer']; // for selecting, not persistent. = 'zilch';
$this->lsvsMove = $laReqdInput['xvsMove']; // Special move requests. = 'zilch';
$this->lsvsColors = $laReqdInput['xvsColors']; // Select Board colors. = 'zilch';
$this->lsvsSet = $laReqdInput['xvsSet']; // Select Chess set. = 'zilch';
$this->lsvcIncludeChat = $laReqdInput['xvcIncludeChat']; // zilch or yes
// Forum Variables //
$this->lsvcIsPublic = $laReqdInput['xvcIsPublic']; // zilch or yes
$this->lsvcShowPublic = $laReqdInput['xvcShowPublic']; // zilch or yes
$this->lsvsBegin = $laReqdInput['xvsBegin']; // "0" default
$this->lsvsEnd = $laReqdInput['xvsEnd']; // "0" default
$this->lsvaComment = $laReqdInput['xvaComment']; // empty string
$this->lsvsDelete = $laReqdInput['xvsDelete']; // "0" default
$this->lsvsModify = $laReqdInput['xvsModify']; // "0" default
$this->lsvbForumPost = $laReqdInput['xvbForumPost']; // zilch or "Post comment"
// end-Forum Variables //
}//end-oCollectFormVars
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fGetProcess (){
//processes to overwrite default process.
$laProcess = array('DataId' =>FALSE, // = Logged in? [x]
'DataTheirName' =>FALSE,//[x]
'DataGameId' =>FALSE,//[x]
'DataTurnNum' =>FALSE,//[x]
'DataTheirTurn' =>FALSE,//[x]
'DataFirstPlayer' =>FALSE,//[x]
'DataPlayersAvailable' =>FALSE,
'DataRecentlyChosen' =>FALSE,
'DataChosePlayer' =>FALSE,//[x]
'DataPartnerName' =>FALSE,//[x]
'DataGameWonAlready' =>FALSE,//[x]
'DataCheckDeclaredByOtherUser' => FALSE,
'TryMove' => FALSE,//[x]
'TryPostComment' => FALSE,//[x]
'TrySelectPlayer' => FALSE,
'TryRegister' => FALSE,
'TryRegisterPartner' => FALSE, //[x] what if player now unavailable?
'TrySaveGame' => FALSE,//[%]
'TryLoadGame' => FALSE,//[%]
'TryQuitGame' => FALSE,//[%]
'TryLogOut' => FALSE);//[x]
$loS = new oServer();
$loR = new oRegistration($loS);
// Collect data:
$laProcess['DataTheirName'] = $this->lsvtPlayer; //-------------------->
$lsId = $this->lsvhPlayer;
if ($lsId != 'zilch'){ // Already Logged-in.
$laProcess['DataId'] = $lsId; //-------------------->
$laProcess['DataTheirName'] = $loR->fGetNameFromId($lsId); //-------------------->
$lsGameId = $loR->fGetGameFromId($lsId);
if ($lsGameId != 'zilch'){
$laProcess['DataGameId'] = $lsGameId; //-------------------->
$loG = new oGame($loS, $lsGameId);
$laProcess['DataTurnNum'] = $loG->fGetCurrentTurnNum(); //-------------------->
if ($loR->fGetOtherId($this->lsvhPlayer)!='zilch'){ // Assigned game
$laProcess['DataPartnerName'] = $loR->fGetNameFromId($loR->fGetOtherId($this->lsvhPlayer));
$laProcess['DataTheirTurn'] = $loR->fIsPlayersTurn($this->lsvhPlayer);
$laProcess['DataFirstPlayer'] = $loR->fPlayerIsFirst($this->lsvhPlayer);
#### Recently chosen code here.
}//end-if Assigned game
else {
if ($laProcess['DataChosePartner'] == TRUE){
$laProcess['TryRegisterPartner'] = TRUE; //-------------------->
}//end-if
}//end-else
if (ereg('^[A-Z]{6}$', $loG->fGetWinner())) $laProcess['DataGameWonAlready'] = TRUE;
if (($laProcess['DataTurnNum']==(integer)$loG->fGetWinner()+1) AND ($laProcess['DataTurnNum']>2)) $laProcess['DataCheckDeclaredByOtherUser'] = TRUE;
if ($this->lsvsMove==3){ // doesn't handle simultaneous check
$lsCheck = $laProcess['DataTurnNum']; // really +1, but oTest doesn't know that yet either.
$loG->fSetWinner('zilch', $lsCheck);
}
}//end-if GameId existed.
else{
$laOthers = $loR->fGetOtherPlayers($lsId);
if (!is_null($laOthers)) {
$this->lauaOthers = $laOthers;
$laProcess['DataPlayersAvailable'] = TRUE; //-------------------->
}//end-if others existed
if ($this->lsvsOtherPlayer != 'zilch' and $this->lsvsOtherPlayer != '0'){
$laProcess['DataChosePlayer'] = TRUE; //-------------------->
$laOthers = $loR->fGetOtherPlayers($lsId);
if (!is_null($laOthers)) {
$laProcess['TryRegisterPartner'] = TRUE; //-------------------->
}//end-if others exist.
else $laProcess['TrySelectPartner'] = TRUE; //-------------------->
}//end-if chose player
}//end-else game didnt exist
}//end-if logged in
else{ //even if they werent logged in till now any other players are ok
$laOthers = $loR->fGetOtherPlayers($lsId);
if (!is_null($laOthers)) {
$this->lauaOthers = $laOthers;
$laProcess['DataPlayersAvailable'] = TRUE; //-------------------->
}//end-if others existed
}//end-else
#### Need to see if games stored with other player at some point.
## SelectGame = New
## SelectGame = Load
// Determine Processes:
if ($this->lsvbLogIn == 'Log-in') $laProcess['TryRegister'] = TRUE; //-------------------->
//or// if this-vtname!=0 & this vhname=0 tryReg
if ($this->lsvbLogOut == 'Log-out') $laProcess['TryLogOut'] = TRUE; //-------------------->
if ($this->lsvbForumPost == 'Post comment') $laProcess['TryPostComment'] = TRUE; //-------------------->
/*
if ($this->lsvbQuitGame != 'zilch') $laProcess['TryQuitGame'] = TRUE; //-------------------->
if ($this->lsvbSaveGame != 'zilch') $laProcess['TrySaveGame'] = TRUE; //-------------------->
if ($this->lsvbLoadGame != 'zilch') $laProcess['TryLoadGame'] = TRUE; //-------------------->
*/
if ($this->livhMoveToCol != 0) $laProcess['TryMove'] = TRUE; //-------------------->
return($laProcess);
}//end-meth
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fGetMove (){
$laMove = array($this->livhMoveFromRow,
$this->livhMoveFromCol,
$this->livhMoveToRow,
$this->livhMoveToCol);
return($laMove);
}//end-meth fGetMove
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fFlipMove (){
$this->livhMoveFromRow = 9 - $this->livhMoveFromRow;
$this->livhMoveFromCol = 9 - $this->livhMoveFromCol;
$this->livhMoveToRow = 9 - $this->livhMoveToRow;
$this->livhMoveToCol = 9 - $this->livhMoveToCol;
}//end-meth fFlipMove
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fGetForumSettings (){
$laGFS = array('xvcIsPublic' => $this->lsvcIsPublic,
'xvcShowPublic' => $this->lsvcShowPublic,
'xvsBegin' => $this->lsvsBegin,
'xvsEnd' => $this->lsvsEnd,
'xvaComment' => $this->lsvaComment,
'xvsDelete' => $this->lsvsDelete,
'xvsModify' => $this->lsvsModify,
'xvbForumPost' => $this->lsvbForumPost
); //end-array
return($laGFS);
}//end-meth fGetForumSetings
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fGetVal ($lsValName){
switch($lsValName){
case 'vhPlayer':
return($this->lsvhPlayer);
break;
case 'vhMoveFromRow':
return($this->livhMoveFromRow);
break;
case 'vhMoveFromCol':
return($this->livhMoveFromCol);
break;
case 'vhMoveToRow':
return($this->livhMoveToRow);
break;
case 'vhMoveToCol':
return($this->livhMoveToCol);
break;
case 'vtPlayer':
return($this->lsvtPlayer);
break;
case 'vbLogIn':
return($this->lsvbLogIn);
break;
case 'vbCheck':
return($this->lsvbCheck);
break;
case 'vbLogOut':
return($this->lsvbLogOut);
break;
case 'vsOtherPlayer':
return($this->lsvsOtherPlayer);
break;
case 'vsMove':
return($this->lsvsMove);
break;
case 'vsColors':
return($this->lsvsColors);
break;
case 'vsSet':
return($this->lsvsSet);
break;
case 'vcIncludeChat':
return($this->lsvcIncludeChat);
break;
case 'vcIsPublic':// Forum Variables //
return($this->lsvcIsPublic);
break;
case 'vcShowPublic':
return($this->lsvcShowPublic);
break;
case 'vsBegin':
return($this->lsvsBegin);
break;
case 'vsEnd':
return($this->lsvsEnd);
break;
case 'vaComment':
return($this->lsvaComment);
break;
case 'vsDelete':
return($this->lsvsDelete);
break;
case 'vsModify':
return($this->lsvsModify);
break;
case 'vbForumPost':
return($this->lsvbForumPost);
break;// end-Forum Variables //
case 'uaOthers':
return($this->lauaOthers);
break;// from oReg
default:
echo 'end of the world';
}//end-switch
}//end-meth fGetVal
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fSetVal ($lsValName, $lsNewVal){ //NOT TESTED. WONT WORK ON NON-STRINGS!!
switch($lsValName){
case 'vhPlayer':
$this->lsvhPlayer = $lsNewVal;
break;
case 'vhMoveFromRow':
$this->livhMoveFromRow = $lsNewVal;
break;
case 'vhMoveFromCol':
$this->livhMoveFromCol = $lsNewVal;
break;
case 'vhMoveToRow':
$this->livhMoveToRow = $lsNewVal;
break;
case 'vhMoveToCol':
$this->livhMoveToCol = $lsNewVal;
break;
case 'vtPlayer':
$this->lsvtPlayer = $lsNewVal;
break;
case 'vbLogIn':
$this->lsvbLogIn = $lsNewVal;
break;
case 'vbCheck':
$this->lsvbCheck = $lsNewVal;
break;
case 'vbLogOut':
$this->lsvbLogOut = $lsNewVal;
break;
case 'vsOtherPlayer':
$this->lsvsOtherPlayer = $lsNewVal;
break;
case 'vsMove':
$this->lsvsMove = $lsNewVal;
break;
case 'vsColors':
$this->lsvsColors = $lsNewVal;
break;
case 'vsSet':
$this->lsvsSet = $lsNewVal;
break;
case 'vcIncludeChat':
$this->lsvcIncludeChat = $lsNewVal;
break;
case 'vcIsPublic':// Forum Variables //
$this->lsvcIsPublic = $lsNewVal;
break;
case 'vcShowPublic':
$this->lsvcShowPublic = $lsNewVal;
break;
case 'vsBegin':
$this->lsvsBegin = $lsNewVal;
break;
case 'vsEnd':
$this->lsvsEnd = $lsNewVal;
break;
case 'vaComment':
$this->lsvaComment = $lsNewVal;
break;
case 'vsDelete':
$this->lsvsDelete = $lsNewVal;
break;
case 'vsModify':
$this->lsvsModify = $lsNewVal;
break;
case 'vbForumPost':
$this->lsvbForumPost = $lsNewVal;
break;// end-Forum Variables //
case 'uaOthers':
$this->lauaOthers = $lsNewVal;
break;// array for SelectPlayers
default:
echo 'end of the world';
}//end-switch
}//end-meth fSetVal
}//end-class oCollectFormVars
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
?>
##########################################################################################
######################### SMC CS85 CHESS PROGRAM #########################################
##########################################################################################
if ($ulShowVersions) print('
//DataGameWonAlready
#### oCollectFormVars.rp #################################################################<br />
#### 2005.11.09 21:15 - km deleted obsolete field LastState. ###############<br />
#### 2005.11.07 07:00 - km Basic function of oCFV.fGetProcess. ###############<br />
#### 2005.11.07 05:00 - km added fFlipMove. ###############<br />
#### 2005.11.07 07:00 - km chess.php now uses oCFV.fGetProcess list of processes. ########<br />
#### 2005.11.06 19:25 - km DELETED fGetRequestType. ###############<br />
#### 2005.11.06 05:15 - km CREATED fGetProcess to replace fGetRequestType. ###############<br />
#### 2005.11.06 03:45 - km deleted #$llvlIsNew. ###############<br />
#### 2005.11.06 03:45 - km deleted hidden vars: submitter,submit,formId,LastState ########<br />
#### 2005.11.06 03:00 - km deleted test fields. ###############<br />');
#### 2005.11.05 03:00 - km filled fGetMove. ###############
#### 2005.11.05 02:15 - km deleted refresh seconds button. ###############
#### 2005.11.05 02:10 - km totally redid fGetRequestType logic. ###############
#### 2005.11.04 05:40 - km deleted fGetSubmitter. Use oReg->fIsPlayersturn.###############
#### 2005.11.04 05:40 - km lots of work on fGetRequestType. ###############
#### 2005.11.04 01:05 - km corrected Typos in xvbLogIn and xvbLogIn. ###############
#### 2005.11.03 05:45 - km improved docs. ###############
#### 2005.10.30 02:25 - km added RegisterPartner to fGetGetRequestType. ###############
#### 2005.10.29 08:00 - km added $vhLastState for refresh of forum. ###############
#### 2005.10.29 02:30 - km added uaOthers array for storing SelectPlayers vals. ##########
#### 2005.10.28 20:45 - km added oCFV->fSetVal($lsValName, $lsNewVal). ###############
#### 2005.10.26 19:40 - km added $ulShowVersions for testing. ###############
#### 2005.10.25 04:20 - km Added GUI testing vars (btn & text field). ###############
#### 2005.10.24 05:55 - km Added Forum Features. ###############
#### 2005.10.22 19:35 - km ADDED row/col Move hidden fields. ####################
#### 2005.10.22 19:05 - km Deleted unnecessary methods. ####################
#### 2005.10.22 19:05 - km Added default oCollectFormVars instead. ####################
#### 2005.10.21 20:50 - km EDITED btn NAMES, added index to $laCFV to ####################
#### isolate sSetPageVarsObj and oCollectFormVars from each other. ####################
#### 2005.10.20 20:50 - km EDITED VAR NAMES for consistency with new conventions #########
#### 2005.10.19 05:15 - km altered temp fSetFormVars ####################################
#### 2005.10.17 02:00 - km added Title block #############################################
#### 2005.10.17 01:30 - km build switch, test (dummy ret-val for oCFV returns ############
##########################################################################################
##########################################################################################
#### Status: LOCKED by KM ################################################################
#### Kristal McKinstry has volunteered to write this entire object #######################
##########################################################################################
##########################################################################################
#### Description: ####################################
#### ####################################
#### ####################################
#### ######################
##########################################################################################
##########################################################################################
#### Ver. 1.0 - Incomplete stub code #####################################################
##########################################################################################
#### Agenda: #############################################################################
#### #############
#### SITUATION: Other player needs informed if he has been selected! #############
#### [ ] fGetRequest now needs to figure out or save former state #############
#### because of forum post requests. see $vhLastState. #############
#### [x] !!!! Globally changed $llvlIsNew and $liviSubmitter to $llvlIsNew #############
#### and $liviSubmitter for macro consistency !!!! #############
#### Deal with integer string values. ##################################
#### ###################################
#### #############################################################################
##########################################################################################
##########################################################################################
#### Programmers: Kristal McKinstry, #################
##########################################################################################
##########################################################################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class oCollectFormVars {
var $lsvhPlayer = 'zilch'; //
var $livhMoveFromRow = 0;
var $livhMoveFromCol = 0;
var $livhMoveToRow = 0;
var $livhMoveToCol = 0;
var $lsvtPlayer = 'zilch';
var $lsvbLogIn = 'zilch'; //value="Log-in"
var $lsvbCheck = 'zilch'; //value="Check Status"
var $lsvbLogOut = 'zilch'; //value="Log-out"
var $lsvsOtherPlayer = 'zilch';
var $lsvsMove = 'zilch';
var $lsvsColors = 'zilch';
var $lsvsSet = 'zilch';
var $lsvcIncludeChat = 'zilch'; // zilch or yes
// Forum Variables //
var $lsvcIsPublic = 'zilch'; // zilch or yes
var $lsvcShowPublic = 'zilch'; // zilch or yes
var $lsvsBegin = "0"; // "0" default
var $lsvsEnd = "0"; // "0" default
var $lsvaComment = ""; // empty string
var $lsvsDelete = "0"; // "0" default
var $lsvsModify = "0"; // "0" default
var $lsvbForumPost = 'zilch'; // zilch or "Post comment"
// end-Forum Variables //
var $lauaOthers = 'zilch'; // To populate SelectPlayer within oBuildGui.
// Set in functions ie LogIn w/ $laOthers = $loReg->fGetOtherPlayers($lsId);
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function oCollectFormVars ($laReqdInput){
##echo "<br />Default oCollectFormVars constructor called <br /> using $laReqdInput";
$this->lsvhPlayer = $laReqdInput['xvhPlayer']; // player unique id. = 'zilch';
$this->livhMoveFromRow = $laReqdInput['xvhMoveFromRow']; // = 0, integer may come in as string though.
$this->livhMoveFromCol = $laReqdInput['xvhMoveFromCol']; // = 0, integer may come in as string though.
$this->livhMoveToRow = $laReqdInput['xvhMoveToRow']; // = 0, integer may come in as string though.
$this->livhMoveToCol = $laReqdInput['xvhMoveToCol']; // = 0, integer may come in as string though.
$this->lsvtPlayer = $laReqdInput['xvtPlayer']; // player display name. = 'zilch'; // not persistent! Use oReg->fGenNameFromId()
$this->lsvbLogIn = $laReqdInput['xvbLogIn']; // log-in. = FALSE; //value="Log-in"
$this->lsvbCheck = $laReqdInput['xvbCheck']; // Check status. = FALSE; //value="Check Status"
$this->lsvbLogOut = $laReqdInput['xvbLogOut']; //log-out. = FALSE; //value="Log-out"
$this->lsvsOtherPlayer = $laReqdInput['xvsOtherPlayer']; // for selecting, not persistent. = 'zilch';
$this->lsvsMove = $laReqdInput['xvsMove']; // Special move requests. = 'zilch';
$this->lsvsColors = $laReqdInput['xvsColors']; // Select Board colors. = 'zilch';
$this->lsvsSet = $laReqdInput['xvsSet']; // Select Chess set. = 'zilch';
$this->lsvcIncludeChat = $laReqdInput['xvcIncludeChat']; // zilch or yes
// Forum Variables //
$this->lsvcIsPublic = $laReqdInput['xvcIsPublic']; // zilch or yes
$this->lsvcShowPublic = $laReqdInput['xvcShowPublic']; // zilch or yes
$this->lsvsBegin = $laReqdInput['xvsBegin']; // "0" default
$this->lsvsEnd = $laReqdInput['xvsEnd']; // "0" default
$this->lsvaComment = $laReqdInput['xvaComment']; // empty string
$this->lsvsDelete = $laReqdInput['xvsDelete']; // "0" default
$this->lsvsModify = $laReqdInput['xvsModify']; // "0" default
$this->lsvbForumPost = $laReqdInput['xvbForumPost']; // zilch or "Post comment"
// end-Forum Variables //
}//end-oCollectFormVars
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fGetProcess (){
//processes to overwrite default process.
$laProcess = array('DataId' =>FALSE, // = Logged in? [x]
'DataTheirName' =>FALSE,//[x]
'DataGameId' =>FALSE,//[x]
'DataTurnNum' =>FALSE,//[x]
'DataTheirTurn' =>FALSE,//[x]
'DataFirstPlayer' =>FALSE,//[x]
'DataPlayersAvailable' =>FALSE,
'DataRecentlyChosen' =>FALSE,
'DataChosePlayer' =>FALSE,//[x]
'DataPartnerName' =>FALSE,//[x]
'DataGameWonAlready' =>FALSE,//[x]
'DataCheckDeclaredByOtherUser' => FALSE,
'TryMove' => FALSE,//[x]
'TryPostComment' => FALSE,//[x]
'TrySelectPlayer' => FALSE,
'TryRegister' => FALSE,
'TryRegisterPartner' => FALSE, //[x] what if player now unavailable?
'TrySaveGame' => FALSE,//[%]
'TryLoadGame' => FALSE,//[%]
'TryQuitGame' => FALSE,//[%]
'TryLogOut' => FALSE);//[x]
$loS = new oServer();
$loR = new oRegistration($loS);
// Collect data:
$laProcess['DataTheirName'] = $this->lsvtPlayer; //-------------------->
$lsId = $this->lsvhPlayer;
if ($lsId != 'zilch'){ // Already Logged-in.
$laProcess['DataId'] = $lsId; //-------------------->
$laProcess['DataTheirName'] = $loR->fGetNameFromId($lsId); //-------------------->
$lsGameId = $loR->fGetGameFromId($lsId);
if ($lsGameId != 'zilch'){
$laProcess['DataGameId'] = $lsGameId; //-------------------->
$loG = new oGame($loS, $lsGameId);
$laProcess['DataTurnNum'] = $loG->fGetCurrentTurnNum(); //-------------------->
if ($loR->fGetOtherId($this->lsvhPlayer)!='zilch'){ // Assigned game
$laProcess['DataPartnerName'] = $loR->fGetNameFromId($loR->fGetOtherId($this->lsvhPlayer));
$laProcess['DataTheirTurn'] = $loR->fIsPlayersTurn($this->lsvhPlayer);
$laProcess['DataFirstPlayer'] = $loR->fPlayerIsFirst($this->lsvhPlayer);
#### Recently chosen code here.
}//end-if Assigned game
else {
if ($laProcess['DataChosePartner'] == TRUE){
$laProcess['TryRegisterPartner'] = TRUE; //-------------------->
}//end-if
}//end-else
if (ereg('^[A-Z]{6}$', $loG->fGetWinner())) $laProcess['DataGameWonAlready'] = TRUE;
if (($laProcess['DataTurnNum']==(integer)$loG->fGetWinner()+1) AND ($laProcess['DataTurnNum']>2)) $laProcess['DataCheckDeclaredByOtherUser'] = TRUE;
if ($this->lsvsMove==3){ // doesn't handle simultaneous check
$lsCheck = $laProcess['DataTurnNum']; // really +1, but oTest doesn't know that yet either.
$loG->fSetWinner('zilch', $lsCheck);
}
}//end-if GameId existed.
else{
$laOthers = $loR->fGetOtherPlayers($lsId);
if (!is_null($laOthers)) {
$this->lauaOthers = $laOthers;
$laProcess['DataPlayersAvailable'] = TRUE; //-------------------->
}//end-if others existed
if ($this->lsvsOtherPlayer != 'zilch' and $this->lsvsOtherPlayer != '0'){
$laProcess['DataChosePlayer'] = TRUE; //-------------------->
$laOthers = $loR->fGetOtherPlayers($lsId);
if (!is_null($laOthers)) {
$laProcess['TryRegisterPartner'] = TRUE; //-------------------->
}//end-if others exist.
else $laProcess['TrySelectPartner'] = TRUE; //-------------------->
}//end-if chose player
}//end-else game didnt exist
}//end-if logged in
else{ //even if they werent logged in till now any other players are ok
$laOthers = $loR->fGetOtherPlayers($lsId);
if (!is_null($laOthers)) {
$this->lauaOthers = $laOthers;
$laProcess['DataPlayersAvailable'] = TRUE; //-------------------->
}//end-if others existed
}//end-else
#### Need to see if games stored with other player at some point.
## SelectGame = New
## SelectGame = Load
// Determine Processes:
if ($this->lsvbLogIn == 'Log-in') $laProcess['TryRegister'] = TRUE; //-------------------->
//or// if this-vtname!=0 & this vhname=0 tryReg
if ($this->lsvbLogOut == 'Log-out') $laProcess['TryLogOut'] = TRUE; //-------------------->
if ($this->lsvbForumPost == 'Post comment') $laProcess['TryPostComment'] = TRUE; //-------------------->
/*
if ($this->lsvbQuitGame != 'zilch') $laProcess['TryQuitGame'] = TRUE; //-------------------->
if ($this->lsvbSaveGame != 'zilch') $laProcess['TrySaveGame'] = TRUE; //-------------------->
if ($this->lsvbLoadGame != 'zilch') $laProcess['TryLoadGame'] = TRUE; //-------------------->
*/
if ($this->livhMoveToCol != 0) $laProcess['TryMove'] = TRUE; //-------------------->
return($laProcess);
}//end-meth
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fGetMove (){
$laMove = array($this->livhMoveFromRow,
$this->livhMoveFromCol,
$this->livhMoveToRow,
$this->livhMoveToCol);
return($laMove);
}//end-meth fGetMove
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fFlipMove (){
$this->livhMoveFromRow = 9 - $this->livhMoveFromRow;
$this->livhMoveFromCol = 9 - $this->livhMoveFromCol;
$this->livhMoveToRow = 9 - $this->livhMoveToRow;
$this->livhMoveToCol = 9 - $this->livhMoveToCol;
}//end-meth fFlipMove
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fGetForumSettings (){
$laGFS = array('xvcIsPublic' => $this->lsvcIsPublic,
'xvcShowPublic' => $this->lsvcShowPublic,
'xvsBegin' => $this->lsvsBegin,
'xvsEnd' => $this->lsvsEnd,
'xvaComment' => $this->lsvaComment,
'xvsDelete' => $this->lsvsDelete,
'xvsModify' => $this->lsvsModify,
'xvbForumPost' => $this->lsvbForumPost
); //end-array
return($laGFS);
}//end-meth fGetForumSetings
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fGetVal ($lsValName){
switch($lsValName){
case 'vhPlayer':
return($this->lsvhPlayer);
break;
case 'vhMoveFromRow':
return($this->livhMoveFromRow);
break;
case 'vhMoveFromCol':
return($this->livhMoveFromCol);
break;
case 'vhMoveToRow':
return($this->livhMoveToRow);
break;
case 'vhMoveToCol':
return($this->livhMoveToCol);
break;
case 'vtPlayer':
return($this->lsvtPlayer);
break;
case 'vbLogIn':
return($this->lsvbLogIn);
break;
case 'vbCheck':
return($this->lsvbCheck);
break;
case 'vbLogOut':
return($this->lsvbLogOut);
break;
case 'vsOtherPlayer':
return($this->lsvsOtherPlayer);
break;
case 'vsMove':
return($this->lsvsMove);
break;
case 'vsColors':
return($this->lsvsColors);
break;
case 'vsSet':
return($this->lsvsSet);
break;
case 'vcIncludeChat':
return($this->lsvcIncludeChat);
break;
case 'vcIsPublic':// Forum Variables //
return($this->lsvcIsPublic);
break;
case 'vcShowPublic':
return($this->lsvcShowPublic);
break;
case 'vsBegin':
return($this->lsvsBegin);
break;
case 'vsEnd':
return($this->lsvsEnd);
break;
case 'vaComment':
return($this->lsvaComment);
break;
case 'vsDelete':
return($this->lsvsDelete);
break;
case 'vsModify':
return($this->lsvsModify);
break;
case 'vbForumPost':
return($this->lsvbForumPost);
break;// end-Forum Variables //
case 'uaOthers':
return($this->lauaOthers);
break;// from oReg
default:
echo 'end of the world';
}//end-switch
}//end-meth fGetVal
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
function fSetVal ($lsValName, $lsNewVal){ //NOT TESTED. WONT WORK ON NON-STRINGS!!
switch($lsValName){
case 'vhPlayer':
$this->lsvhPlayer = $lsNewVal;
break;
case 'vhMoveFromRow':
$this->livhMoveFromRow = $lsNewVal;
break;
case 'vhMoveFromCol':
$this->livhMoveFromCol = $lsNewVal;
break;
case 'vhMoveToRow':
$this->livhMoveToRow = $lsNewVal;
break;
case 'vhMoveToCol':
$this->livhMoveToCol = $lsNewVal;
break;
case 'vtPlayer':
$this->lsvtPlayer = $lsNewVal;
break;
case 'vbLogIn':
$this->lsvbLogIn = $lsNewVal;
break;
case 'vbCheck':
$this->lsvbCheck = $lsNewVal;
break;
case 'vbLogOut':
$this->lsvbLogOut = $lsNewVal;
break;
case 'vsOtherPlayer':
$this->lsvsOtherPlayer = $lsNewVal;
break;
case 'vsMove':
$this->lsvsMove = $lsNewVal;
break;
case 'vsColors':
$this->lsvsColors = $lsNewVal;
break;
case 'vsSet':
$this->lsvsSet = $lsNewVal;
break;
case 'vcIncludeChat':
$this->lsvcIncludeChat = $lsNewVal;
break;
case 'vcIsPublic':// Forum Variables //
$this->lsvcIsPublic = $lsNewVal;
break;
case 'vcShowPublic':
$this->lsvcShowPublic = $lsNewVal;
break;
case 'vsBegin':
$this->lsvsBegin = $lsNewVal;
break;
case 'vsEnd':
$this->lsvsEnd = $lsNewVal;
break;
case 'vaComment':
$this->lsvaComment = $lsNewVal;
break;
case 'vsDelete':
$this->lsvsDelete = $lsNewVal;
break;
case 'vsModify':
$this->lsvsModify = $lsNewVal;
break;
case 'vbForumPost':
$this->lsvbForumPost = $lsNewVal;
break;// end-Forum Variables //
case 'uaOthers':
$this->lauaOthers = $lsNewVal;
break;// array for SelectPlayers
default:
echo 'end of the world';
}//end-switch
}//end-meth fSetVal
}//end-class oCollectFormVars
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
?>