- Group of approx. 14 participants
- Every participant submits a text (Stage 1)
- Every participant evaluates the submission of randomly selected 5 other participants in the group (Stage 2)
We want to achieve this with the following code in Stage 2 (with comment):
$rolesarray = $getRoles(); // get all the roles in the group
$key = array_search($role, $array);
// find the player in this group
unset($rolesarray[$key]);
// delete player from array of all roles
shuffle($rolesarray);
$rolesarray_rand5=array_slice($rolesarray, 0, 5);
// get five randomly selected (because shuffled) roles
// randomly selected submissions
$other1=$findVariablePartner('slogan1',$round,$partnerRole=$rolesarray_rand5[0],$no_decision=0);
$other2=$findVariablePartner('slogan1',$round,$partnerRole=$rolesarray_rand5[1],$no_decision=0);
$other3=$findVariablePartner('slogan1',$round,$partnerRole=$rolesarray_rand5[2],$no_decision=0);
$other4=$findVariablePartner('slogan1',$round,$partnerRole=$rolesarray_rand5[3],$no_decision=0);
$other5=$findVariablePartner('slogan1',$round,$partnerRole=$rolesarray_rand5[4],$no_decision=0);
However, I get the error message:
Fatal error: Uncaught Error: Call to undefined method D::getRoles() in /var/www/htdocs/bin/classes/D.class.php(204) : eval()'d code:3 Stack trace: #0 /var/www/htdocs/bin/classes/D.class.php(204): eval() #1 /var/www/htdocs/bin/classes/participant/PElementProg.class.php(30): D->setVar() #2 /var/www/htdocs/bin/classes/participant/PSub.class.php(236): PElementProg->showElement() #3 /var/www/htdocs/bin/classes/participant/PPage.class.php(186): PSub->showSub() #4 /var/www/htdocs/bin/index.php(62): PPage->renderStageContainer() #5 {main} thrown in /var/www/htdocs/bin/classes/D.class.php(204) : eval()'d code on line 3
Which I do not get. The problem seems to be $getRoles() which I got from the documentation.
I am grateful for any advice.