echo '<input type="hidden" name="SuggestionId" value="' . $this->suggestionId . '">'; } if (isset($this->suggestionsUri)) { echo '<input type="hidden" name="SuggestionURI" value="' . $this->suggestionsUri . '">'; } } else { if (isset($vars['IdGroup']) && $vars['IdGroup'] != 0 && is_numeric($vars['IdGroup'])) { echo '<input type="hidden" name="IdGroup" value="' . intval($vars['IdGroup']) . '">'; } else { echo '<input type="hidden" name="IdGroup" value="0">'; } } ?> <?php if (isset($this->suggestionsGroupId) || $groupsforum == SuggestionsModel::getGroupId()) { ?> <fieldset class="row" id = "fpost_vis_fieldset" > <legend onclick = "toggleFieldsets('fpost_vis');" ><?php echo $words->getFormatted("ForumSuggestionsVisibilityAndLanguage"); ?> </legend> <div id="fpost_vis"> <p><?php echo $words->get('SuggestionsGroupInfoReply'); ?> </p> <input type="hidden" name="PostVisibility" id="PostVisibility" value="MembersOnly"/> <input type="hidden" name="IdLanguage" id="IdLanguage" value="0"/> </div> </fieldset>
public function replySuggestionsProcess() { $callbackId = PFunctions::hex2base64(sha1(__METHOD__)); if (PPostHandler::isHandling()) { $groupId = SuggestionsModel::getGroupId(); $this->_model->setGroupId($groupId); return $this->_model->replyProcess(true); } else { PPostHandler::setCallback($callbackId, __CLASS__, __METHOD__); return $callbackId; } }
protected function getStateSelect($state) { $select = '<select id="suggestion-state" name="suggestion-state">'; $words = $this->getWords(); $states = SuggestionsModel::getStatesAsArray(); foreach ($states as $key => $wordCode) { $select .= '<option value="' . $key . '"'; if ($key == $state) { $select .= ' selected="selected"'; } $select .= '>' . $words->getSilent($wordCode) . '</option>'; } $select .= '</select>'; $select .= $words->flushBuffer(); return $select; }
private function getVisibilityCheckbox($visibility, $highestVisibility, $IdGroup, $newTopic) { if ($IdGroup == 0) { // Indicate to the form that only MembersOnly is allowed; this is a hack to avoid too much code changes return ''; } if ($IdGroup == SuggestionsModel::getGroupId()) { // Indicate to the form that only MembersOnly is allowed; return ''; } if ($highestVisibility == 'GroupOnly') { // This will tell the form that the post is GroupOnly (IdGroup set and no visibilityCheckbox content return ''; } if (!$newTopic) { $name = "PostVisibility"; $word = 'ForumVisibilityGroupOnlyPost'; } else { $name = "ThreadVisibility"; $word = 'ForumVisibilityGroupOnlyThread'; } $words = new MOD_words(); $out = '<input type="checkbox" name="' . $name . '" id="' . $name . '" value="GroupOnly"'; if ($visibility == 'GroupOnly') { $out .= ' checked="checked" '; } $out .= '/> <label for="' . $name . '">' . $words->get($word) . '</label>'; return $out; }
public function __construct() { parent::__construct(); $this->THREADS_PER_PAGE = Forums::CV_THREADS_PER_PAGE; //Variable because it can change wether the user is logged or no $this->POSTS_PER_PAGE = Forums::CV_POSTS_PER_PAGE; //Variable because it can change wether the user is logged or no $layoutbits = new MOD_layoutbits(); switch ($layoutbits->GetPreference("PreferenceForumFirstPage")) { case "Pref_ForumFirstPageLastPost": $this->setTopMode(Forums::CV_TOPMODE_FORUM); break; case "Pref_ForumFirstPageCategory": $this->setTopMode(Forums::CV_TOPMODE_CATEGORY); break; default: $this->setTopMode(Forums::CV_TOPMODE_LANDING); break; } if (!isset($_SESSION['IdMember'])) { $this->THREADS_PER_PAGE = 100; // Variable because it can change wether the user is logged or no $this->POSTS_PER_PAGE = 200; // Variable because it can change wether the user is logged or no } $MyGroups = array(); $this->words = new MOD_words(); $this->BW_Right = MOD_right::get(); $this->IdGroup = 0; // By default no group $this->ByCategories = false; // toggle or not toglle the main view is TopCategories or TopLevel $this->ForumOrderList = $layoutbits->GetPreference("PreferenceForumOrderListAsc"); // Decide if it is an active LoggeMember or not if (empty($_SESSION["IdMember"]) or empty($_SESSION["MemberStatus"]) or $_SESSION["MemberStatus"] == 'Pending' or $_SESSION["MemberStatus"] == 'NeedMore') { $this->PublicThreadVisibility = " (ThreadVisibility = 'NoRestriction') AND (ThreadDeleted != 'Deleted')"; $this->PublicPostVisibility = " (PostVisibility = 'NoRestriction') AND (PostDeleted != 'Deleted')"; $this->ThreadGroupsRestriction = " (IdGroup = 0 OR ThreadVisibility = 'NoRestriction')"; $this->PostGroupsRestriction = " (IdGroup = 0 OR PostVisibility = 'NoRestriction')"; } else { $this->PublicThreadVisibility = "(ThreadVisibility != 'ModeratorOnly') AND (ThreadDeleted != 'Deleted')"; $this->PublicPostVisibility = "(PostVisibility != 'ModeratorOnly') AND (PostDeleted !='Deleted')"; $this->PostGroupsRestriction = " PostVisibility IN ('MembersOnly','NoRestriction') OR (PostVisibility='GroupOnly' AND IdGroup in(0"; $this->ThreadGroupsRestriction = " ThreadVisibility IN ('MembersOnly','NoRestriction') OR (ThreadVisibility = 'GroupOnly' and IdGroup in(0"; $qry = $this->dao->query("SELECT IdGroup FROM membersgroups WHERE IdMember = " . $_SESSION["IdMember"] . " AND Status = 'In'"); if (!$qry) { throw new PException('Failed to retrieve groups for member id =#' . $_SESSION["IdMember"] . ' !'); } while ($rr = $qry->fetch(PDB::FETCH_OBJ)) { $this->PostGroupsRestriction = $this->PostGroupsRestriction . "," . $rr->IdGroup; $this->ThreadGroupsRestriction = $this->ThreadGroupsRestriction . "," . $rr->IdGroup; array_push($MyGroups, $rr->IdGroup); // Save the group list } $this->ThreadGroupsRestriction .= "," . SuggestionsModel::getGroupId(); $this->PostGroupsRestriction = $this->PostGroupsRestriction . "))"; $this->ThreadGroupsRestriction = $this->ThreadGroupsRestriction . "))"; } // Prepares additional visibility options for moderator if ($this->BW_Right->HasRight("ForumModerator")) { $this->PublicPostVisibility = " PostVisibility IN ('NoRestriction', 'MembersOnly','GroupOnly','ModeratorOnly')"; $this->PublicThreadVisibility = " ThreadVisibility IN ('NoRestriction', 'MembersOnly','GroupOnly','ModeratorOnly')"; if ($this->BW_Right->HasRight("ForumModerator", "AllGroups") or $this->BW_Right->HasRight("ForumModerator", "All")) { $this->PostGroupsRestriction = " (1=1)"; $this->ThreadGroupsRestriction = " (1=1)"; } } $this->MyGroups = $MyGroups; }
<?php echo $callbackTags; ?> <h3><?php echo $this->purifier->purify($this->suggestion->summary . " (" . $words->get('SuggestionsVoteEnds', $this->suggestion->nextstatechange) . ")"); ?> </h3> <p><?php echo $this->purifier->purify($this->suggestion->description); ?> </p> <?php if (!$this->viewOnly) { ?> <p><?php echo $words->get('SuggestionsVoteDiscussion', '<a href="/groups/' . SuggestionsModel::getGroupId() . '/forum/s' . $this->suggestion->threadId . '">', '</a>'); ?> </p> <?php } ?> <hr class="suggestion" /> <?php foreach ($this->suggestion->options as $option) { ?> <div class="option floatbox"> <div class="floatbox float_left"> <p><strong><?php echo $this->purifier->purify($option->summary); ?> </strong></p>
<?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) { ?>
private function postVotingEndsMessage() { $entityFactory = new RoxEntityFactory(); $suggestionsTeam = $entityFactory->create('Member')->findByUsername('SuggestionsTeam'); $text = 'Voting for the suggestion \'<a href="/suggestions/' . $this->id . '/">' . $this->summary . '</a>\' will end on ' . date('Y-m-d', strtotime($this->laststatechanged) + SuggestionsModel::DURATION_VOTING) . '.<br /><br />if you haven\'t done so yet, please cast your vote.'; $suggestions = new SuggestionsModel(); $postId = $suggestions->addPost($suggestionsTeam->id, $text, $this->threadId); $suggestions->setForumNotification($postId, 'reply'); }