public function setExclusions($member, $args) { $suggestion = new Suggestion($args->post['suggestion-id']); $options = array(); $optionKeys = array_filter(array_keys($args->post), array($this, 'filterOptions')); foreach ($optionKeys as $optionKey) { $optionId = str_replace('option', '', $optionKey); $options[] = $optionId; $option = new SuggestionOption($optionId); $mutuallyExclusive = implode(',', $args->post[$optionKey]); $option->mutuallyExclusiveWith = $mutuallyExclusive; $option->update(); } // Check for empty rows foreach ($suggestion->options as $option) { if (array_search($option->id, $options) === false) { $option->mutuallyExclusiveWith = 'None'; $option->update(); } } return $suggestion; }
<?php $ranks = SuggestionsModel::getRanksAsArray($_SESSION['lang']); $states = SuggestionsModel::getStatesAsArray(); $optionStates = SuggestionOption::getStatesAsArray($_SESSION['lang']); ?> <table id="results"> <tr> <td><h2><?php echo htmlspecialchars($this->suggestion->summary, ENT_COMPAT, 'utf-8'); ?> </h2></td> <td colspan="2" class="rank"><strong><?php if ($this->suggestion->voteCount) { echo $words->get('SuggestionsVotesGiven', $this->suggestion->voteCount); } ?> </strong></td> <td class="rank"><strong><?php echo $words->get($states[$this->suggestion->state]); ?> </strong></td> </tr> <tr><td colspan="4"><?php echo $this->purifier->purify($this->suggestion->description); ?> </td></tr> <tr><td colspan="4"><hr class="suggestion" /></td></tr> <?php if ($this->suggestion->optionsVisibleCount == 0) { ?>