protected function chkSelected_Click($strFormId, $strControlId, $strParameter)
{
// We look to the Parameter for the ID of the person being checked
$intPersonId = $strParameter;
// Let's get the selected person
$objPerson = Person::Load($intPersonId);
// Let's respond to the user what just happened
if ($this->GetControl($strControlId)->Checked) {
$strResponse = QApplication::HtmlEntities('You just selected ' . $objPerson->FirstName . ' ' . $objPerson->LastName . '.');
} else {
$strResponse = QApplication::HtmlEntities('You just deselected ' . $objPerson->FirstName . ' ' . $objPerson->LastName . '.');
}
$strResponse .= '<br/>';
// Now, let's go through all the checkboxes and list everyone who has been selected
$strNameArray = array();
foreach ($this->GetAllControls() as $objControl) {
if (substr($objControl->ControlId, 0, 11) == 'chkSelected') {
if ($objControl->Checked) {
$objPerson = Person::Load($objControl->ActionParameter);
$strName = QApplication::HtmlEntities($objPerson->FirstName . ' ' . $objPerson->LastName);
array_push($strNameArray, $strName);
}
}
}
$strResponse .= 'The list of people who are currently selected: ' . implode(', ', $strNameArray);
// Provide feedback to the user by updating the Response label
$this->lblResponse->Text = $strResponse;
}