Ejemplo n.º 1
0
 public function ajaxCheckAlias($alias)
 {
     $disjax = new disjax();
     $my = JFactory::getUser();
     // do not let unregistered user
     if ($my->id <= 0) {
         return false;
     }
     // satinize input
     $filter = JFilterInput::getInstance();
     $alias = $filter->clean($alias, 'ALNUM');
     // check for existance
     $db = DiscussHelper::getDBO();
     $query = 'SELECT `alias` FROM `#__discuss_users` WHERE `alias` = ' . $db->quote($alias) . ' ' . 'AND ' . $db->nameQuote('id') . '!=' . $db->Quote($my->id);
     $db->setQuery($query);
     $result = $db->loadResult();
     // prepare output
     if ($result) {
         $html = JText::_('COM_EASYDISCUSS_ALIAS_NOT_AVAILABLE');
         $class = 'failed';
     } else {
         $html = JText::_('COM_EASYDISCUSS_ALIAS_AVAILABLE');
         $class = 'success';
     }
     $options = new stdClass();
     // fill in the value
     $disjax->assign('profile-alias', $alias);
     $disjax->script('EasyDiscuss.$( "#alias-status" ).html("' . $html . '").removeClass("failed").removeClass("success").addClass( "' . $class . '" );');
     $disjax->value('profile-alias', $alias);
     $disjax->send();
 }
Ejemplo n.º 2
0
 public function getMoreVoters($postid = null, $limit = null)
 {
     $disjax = new disjax();
     $voteModel = $this->getModel('votes');
     $total = $voteModel->getTotalVotes($postid);
     if (!empty($total)) {
         $voters = DiscussHelper::getVoters($postid, $limit);
         $msg = JText::sprintf('COM_EASYDISCUSS_VOTES_BY', $voters->voters);
         if ($voters->shownVoterCount < $total) {
             $limit += '5';
             $msg .= '[<a href="javascript:void(0);" onclick="disjax.load(\'post\', \'getMoreVoters\', \'' . $postid . '\', \'' . $limit . '\');">' . JText::_('COM_EASYDISCUSS_MORE') . '</a>]';
         }
         $disjax->assign('dc_reply_voters_' . $postid, $msg);
     }
     $disjax->send();
     return;
 }