/** * Method to get the filter options. * * @return array The filter option objects. * * @since 2.0 */ protected function getOptions() { // Initialize some field attributes. $client = (string) $this->element['client']; if ($client != 'site' && $client != 'administrator') { $client = 'site'; } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), \JLanguageHelper::createLanguageList($this->value, constant('JPATH_' . strtoupper($client)), true, true)); return $options; }
/** * Establish all the users that must be invited for the survey * When function is complete, the members are contained in ->_allmembers variable * as a list of Person-instances. * @return array of Person-instances that should be invited for the survey **/ public function invite() { // Establish groups gor current logged in user $userId = $this->getSubjectUser(); // Establish relations: $relations = self::getFreshFromSession("relations", array("userId" => $userId)); // Establish *selected* Groups and Persons $aAllSelected = array(); $aSelectedGroups = Selectable::selectedFromForm($_REQUEST, $relations); foreach ($aSelectedGroups as $aGroup) { $aAllSelected[$aGroup->getIdentifier()] = $aGroup; } if (sizeof($aAllSelected) == 0) { $output = "<p>You did not select any group.</p>"; } if (sizeof($aAllSelected) > 0) { // static callback: array(__CLASS__, "member-function-name") // instance callbacK: array($object_instance, "member-function-name") $this->_allmembers = array(); self::$fetcher->process(array('userId' => $userId, 'message' => new grouprelMessage()), array($this, "appendMember"), $aSelectedGroups, null); // $this->_allmembers now contains all the members // Delete doubles (based on identifier) $this->_allmembers = array_unique($this->_allmembers); $output = '<h2>All members that were retrieved</h2><ul>'; foreach ($this->_allmembers as $member) { $a = $member->getAttributes(); $output .= '<li>' . $a['name'] . ' (' . $a['email'] . ')</li>'; } $output .= '</ul>'; } $this->output = "<div>" . $output . "</div>"; return $output; }