コード例 #1
0
    public function showApproveDialog($id)
    {
        $ajax = new Disjax();
        $options = new stdClass();
        $options->title = JText::_('COM_EASYDISCUSS_DIALOG_MODERATE_TITLE');
        $options->content = '
		<p>' . JText::_('COM_EASYDISCUSS_DIALOG_MODERATE_CONTENT') . '</p>

		<form id="moderate-form" name="moderate" method="post">
			<span class="float-r" id="dialog_loading"></span>
			<input type="hidden" name="option" value="com_easydiscuss" />
			<input type="hidden" name="controller" value="points" />
			<input type="hidden" name="cid[]" value="' . $id . '" />
			<input type="hidden" id="moderate-task" name="task" value="" />
		</form>
';
        $buttons = array();
        $button = new stdClass();
        $button->title = JText::_('COM_EASYDISCUSS_REJECT_BUTTON');
        $button->action = 'admin.post.moderate.unpublish();';
        $buttons[] = $button;
        $button = new stdClass();
        $button->title = JText::_('COM_EASYDISCUSS_APPROVE_BUTTON');
        $button->action = 'admin.post.moderate.publish();';
        $button->className = 'btn-primary';
        $buttons[] = $button;
        $ajax->dialog($options);
        $ajax->send();
    }
コード例 #2
0
 /**
  * Remove a location from a post.
  *
  * @since	3.0
  * @access	public
  */
 public function removeLocation($id)
 {
     $ajax = new Disjax();
     $post = DiscussHelper::getTable('Post');
     $state = $post->load($id);
     $my = JFactory::getUser();
     if (!$id || !$state) {
         echo JText::_('COM_EASYDISCUSS_INVALID_ID');
         return $ajax->send();
     }
     if ($post->user_id != $my->id && !DiscussHelper::isModerator($post->category_id)) {
         echo JText::_('COM_EASYDISCUSS_NOT_ALLOWED_TO_REMOVE_LOCATION_FOR_POST');
         return $ajax->send();
     }
     // Update the address, latitude and longitude of the post.
     $post->address = '';
     $post->latitude = '';
     $post->longitude = '';
     $post->store();
     $content = JText::_('COM_EASYDISCUSS_LOCATION_IS_REMOVED');
     $options = new stdClass();
     $options->content = $content;
     $options->title = JText::_('COM_EASYDISCUSS_DELETE_LOCATION_TITLE');
     $buttons = array();
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_CLOSE');
     $button->action = 'disjax.closedlg();';
     $buttons[] = $button;
     $options->buttons = $buttons;
     $ajax->script('discuss.location.removeHTML("' . $id . '");');
     $ajax->dialog($options);
     return $ajax->send();
 }
コード例 #3
0
 /**
  * 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();
 }
コード例 #4
0
 public function getTemplate($name = null, $vars = array())
 {
     $theme = new DiscussThemes();
     if (!empty($vars)) {
         foreach ($vars as $key => $value) {
             $theme->set($key, $value);
         }
     }
     $ajax = new Disjax();
     $option = new stdClass();
     $option->content = $theme->fetch($name, array('dialog' => true));
     $ajax->dialog($option);
     $ajax->send();
 }
コード例 #5
0
 /**
  * Merges the current discussion into an existing discussion
  *
  * @since   1.0
  * @access  public
  * @param   string
  * @return
  */
 public function mergeForm($id)
 {
     $ajax = new Disjax();
     $model = DiscussHelper::getModel('Posts');
     $posts = $model->getDiscussions(array('limit' => DISCUSS_NO_LIMIT, 'exclude' => array($id)));
     $theme = new DiscussThemes();
     $theme->set('posts', $posts);
     $theme->set('current', $id);
     $content = $theme->fetch('ajax.post.merge.php', array('dialog' => true));
     $options = new stdClass();
     $options->content = $content;
     $options->title = JText::_('COM_EASYDISCUSS_MERGE_POST_TITLE');
     $buttons = array();
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_CLOSE');
     $button->action = 'disjax.closedlg();';
     $buttons[] = $button;
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_MERGE');
     $button->form = '#frmMergePost';
     $button->className = 'btn-primary';
     $buttons[] = $button;
     $options->buttons = $buttons;
     $ajax->dialog($options);
     $ajax->send();
 }
コード例 #6
0
 /**
  * Retrieve a list of voters from the site in a dialog.
  *
  * @since	3.0
  * @access	public
  * @param	int		The unique id for the poll answer.
  * @return
  */
 public function getVoters($pollId)
 {
     $ajax = new Disjax();
     $poll = DiscussHelper::getTable('Poll');
     $poll->load($pollId);
     $voters = $poll->getVoters();
     $template = new DiscussThemes();
     $template->set('voters', $voters);
     $option = new stdClass();
     $option->title = JText::_('COM_EASYDISCUSS_USERS_WHO_VOTED_THIS_POLL');
     $option->content = $template->fetch('ajax.poll.voters.php', array('dialog' => true));
     $buttons = array();
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_OK');
     $button->action = 'disjax.closedlg();';
     $button->className = 'btn-primary';
     $buttons[] = $button;
     $option->buttons = $buttons;
     $ajax->dialog($option);
     $ajax->send();
 }
コード例 #7
0
 /**
  * Displays the conversation dialog
  *
  * @since	3.0
  * @access	public
  */
 public function write($userId)
 {
     $my = JFactory::getUser();
     // Do not allow guests to access here.
     if (!$my->id || !$userId) {
         exit;
     }
     $ajax = new Disjax();
     $theme = new DiscussThemes();
     $recipient = DiscussHelper::getTable('Profile');
     $recipient->load($userId);
     $theme->set('recipient', $recipient);
     $content = $theme->fetch('ajax.conversation.write.php', array('dialog' => true));
     $options = new stdClass();
     $options->content = $content;
     $options->title = JText::_('COM_EASYDISCUSS_DIALOG_TITLE_NEW_CONVERSATION');
     $buttons = array();
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_CANCEL');
     $button->action = 'disjax.closedlg();';
     $buttons[] = $button;
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_SEND');
     $button->action = 'discuss.conversation.send();';
     $button->className = 'btn-primary';
     $buttons[] = $button;
     $options->buttons = $buttons;
     $options->width = 650;
     $ajax->dialog($options);
     return $ajax->send();
 }
コード例 #8
0
 /**
  * Shows the terms and condition dialog window.
  *
  * @since	3.0
  * @access	public
  */
 public function tnc()
 {
     $config = DiscussHelper::getConfig();
     $disjax = new Disjax();
     $themes = new DiscussThemes();
     $content = $themes->fetch('ajax.terms.php', array('dialog' => true));
     $options = new stdClass();
     $options->title = JText::_('COM_EASYDISCUSS_TERMS_AND_CONDITIONS');
     $options->content = $content;
     $buttons = array();
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_OK');
     $button->action = 'disjax.closedlg();';
     $button->className = 'btn-primary';
     $buttons[] = $button;
     $options->buttons = $buttons;
     $disjax->dialog($options);
     $disjax->send();
     return;
 }
コード例 #9
0
    public function customMessage($id)
    {
        $ajax = new Disjax();
        $theme = new DiscussThemes();
        $badgeUser = DiscussHelper::getTable('BadgesUsers');
        $badgeUser->load($id);
        ob_start();
        ?>
		<p><?php 
        echo JText::_('COM_EASYDISCUSS_BADGE_CUSTOM_MESSAGE_DESC');
        ?>
</p>

		<textarea id="customMessage" style="width:98%;height: 100px;" class="mt-20"><?php 
        echo $badgeUser->custom;
        ?>
</textarea>
		<?php 
        $content = ob_get_contents();
        ob_end_clean();
        $options = new stdClass();
        $options->content = $content;
        $options->title = JText::_('Custom Message');
        $buttons = array();
        $button = new stdClass();
        $button->title = JText::_('Close');
        $button->action = 'disjax.closedlg();';
        $buttons[] = $button;
        $button = new stdClass();
        $button->title = JText::_('Submit');
        $button->action = 'saveMessage("' . $id . '" );';
        $button->className = 'btn-primary';
        $buttons[] = $button;
        $options->buttons = $buttons;
        $ajax->dialog($options);
        $ajax->send();
    }
コード例 #10
0
 public function delete($id)
 {
     $ajax = new Disjax();
     $user = JFactory::getUser();
     // @rule: Do not allow empty id or guests to delete files.
     if (empty($id) || empty($user->id)) {
         return false;
     }
     $attachment = DiscussHelper::getTable('Attachments');
     $attachment->load($id);
     // Ensure that only post owner or admin can delete it.
     if (!$attachment->deleteable()) {
         return false;
     }
     // Ensure that only post owner or admin can delete it.
     if (!$attachment->delete()) {
         return false;
     }
     $theme = new DiscussThemes();
     $content = JText::_('COM_EASYDISCUSS_ATTACHMENT_DELETED_SUCCESSFULLY');
     $options = new stdClass();
     $options->content = $content;
     $options->title = JText::_('COM_EASYDISCUSS_ATTACHMENT_DELETE_CONFIRMATION_TITLE');
     $buttons = array();
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_CLOSE');
     $button->action = 'disjax.closedlg();';
     $buttons[] = $button;
     $options->buttons = $buttons;
     $ajax->script('EasyDiscuss.$("#attachment-' . $attachment->id . '" ).trigger("itemRemoved").remove();');
     $ajax->dialog($options);
     $ajax->send();
 }