/** * Displays a list of voters on the site. * * @since 3.0 */ public function showVoters($id) { // Allow users to see who voted on the discussion $ajax = new Disjax(); $config = DiscussHelper::getConfig(); $my = JFactory::getUser(); // If main_allowguestview_whovoted is lock if (!$config->get('main_allowguestview_whovoted') && !$my->id) { $ajax->reject(JText::_('COM_EASYDISCUSS_NOT_ALLOWED_HERE')); return $ajax->send(); } $voteModel = DiscussHelper::getModel('Votes'); $voters = $voteModel->getVoters($id); $guests = 0; $users = array(); if ($voters) { foreach ($voters as $voter) { if (!$voter->user_id) { $guests += 1; } else { $profile = DiscussHelper::getTable('Profile'); $users[] = $profile->load($voter->user_id); } } } $options = new stdClass(); $options->title = JText::_('COM_EASYDISCUSS_VIEWING_VOTERS_TITLE'); $theme = new DiscussThemes(); $theme->set('users', $users); $theme->set('guests', $guests); $content = $theme->fetch('voters.php', array('dialog' => true)); $options->content = $content; $buttons = array(); $button = new stdClass(); $button->title = JText::_('COM_EASYDISCUSS_BUTTON_CLOSE'); $button->action = 'disjax.closedlg();'; $buttons[] = $button; $options->buttons = $buttons; $ajax->dialog($options); return $ajax->send(); }
/** * Displays a confirmation dialog to delete a comment. * * @since 3.0 * @access public * @param int The unique post id. */ public function confirmDelete($id = null) { $ajax = new Disjax(); // Test if a valid post id is provided. if (!$id) { $ajax->reject(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_POST_ID')); return $ajax->send(); } $theme = new DiscussThemes(); $theme->set('id', $id); $content = $theme->fetch('ajax.comment.delete.php', array('dialog' => true)); $options = new stdClass(); $options->content = $content; $options->title = JText::_('COM_EASYDISCUSS_DELETE_COMMENT'); $buttons = array(); $button = new stdClass(); $button->title = JText::_('COM_EASYDISCUSS_BUTTON_NO'); $button->action = 'disjax.closedlg();'; $buttons[] = $button; $button = new stdClass(); $button->title = JText::_('COM_EASYDISCUSS_BUTTON_YES'); $button->action = 'disjax.load( "comment" , "delete" , "' . $id . '");'; $button->className = 'btn-primary'; $buttons[] = $button; $options->buttons = $buttons; $ajax->dialog($options); $ajax->send(); }