Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 3 Ответов
  • 4460 Просмотров
*

Roporak

  • Захожу иногда
  • 72
  • 0 / 0
Здравствуйте!
Я захотел модифицировать стандартный плагин голосования за материал - сделал его более интерактивным, подобно подобно другим сторонним рейтингам, и также увеличил количество "звезд" до 10 штук. Но при голосовании Joomla 2.5 почему-то не хочет принимать голоса больше стандартных пяти, выходит предупреждение - "Рейтинг статьи: Неверный рейтинг: 8".
Подскажите, кто знает, как увеличить максимально возможный голос? Плагин состоит всего из одного PHP файла, и других упоминаний о нем я не нашел.

Вот мой модифицированный код файла plugins\content\vote\vote.php:
Код
<?php

// No direct access.
defined('_JEXEC') or die;

/**
 * Vote plugin.
 *
 * @package Joomla.Plugin
 * @subpackage Content.vote
 */
class plgContentVote extends JPlugin
{
/**
* Constructor
*
* @access      protected
* @param       object  $subject The object to observe
* @param       array   $config  An array that holds the plugin configuration
* @since       1.5
*/
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
$this->loadLanguage();
}

/**
* @since 1.6
*/
public function onContentBeforeDisplay($context, &$row, &$params, $page=0)
{
$html = '';

if ($params->get('show_vote'))
{
$rating = intval(@$row->rating);
$rating_count = intval(@$row->rating_count);

$view = JRequest::getString('view', '');
$img = '';

// look for images in template if available
$starImageOn = JHtml::_('image', 'system/rating_star.png', NULL, NULL, true);
$starImageOff = JHtml::_('image', 'system/rating_star_blank.png', NULL, NULL, true);

for ($i=0; $i < $rating; $i++) {
$img .= $starImageOn;
}
for ($i=$rating; $i < 10; $i++) {
$img .= $starImageOff;
}
$html .= '<span class="content_rating">';
$html .= JText::sprintf( 'PLG_VOTE_USER_RATING', $img, $rating_count );
$html .= "</span>\n<br />\n";

if ( $view == 'article' && $row->state == 1)
{
$uri = JFactory::getURI();
$uri->setQuery($uri->getQuery().'&hitcount=0');
$html .= '<form method="post" action="' . $uri->toString(). '">';
$html .= JText::_( 'PLG_VOTE_POOR' );        
$html .= '<ul class="content_vote">';
$html .= '<li class="current_rating" style="width:'. $rating *10 .'%;" ></li>';
$html .= '<li tabindex="1"><input type="radio" title="'.JText::sprintf('PLG_VOTE_VOTE', '1').'" name="user_rating" value="1" /></li>';
$html .= '<li tabindex="2"><input type="radio" title="'.JText::sprintf('PLG_VOTE_VOTE', '2').'" name="user_rating" value="2" /></li>';
$html .= '<li tabindex="3"><input type="radio" title="'.JText::sprintf('PLG_VOTE_VOTE', '3').'" name="user_rating" value="3" /></li>';
$html .= '<li tabindex="4"><input type="radio" title="'.JText::sprintf('PLG_VOTE_VOTE', '4').'" name="user_rating" value="4" /></li>';
$html .= '<li tabindex="5"><input type="radio" title="'.JText::sprintf('PLG_VOTE_VOTE', '5').'" name="user_rating" value="5" /></li>';
$html .= '<li tabindex="6"><input type="radio" title="'.JText::sprintf('PLG_VOTE_VOTE', '6').'" name="user_rating" value="6" /></li>';
$html .= '<li tabindex="7"><input type="radio" title="'.JText::sprintf('PLG_VOTE_VOTE', '7').'" name="user_rating" value="7" /></li>';
$html .= '<li tabindex="8"><input type="radio" title="'.JText::sprintf('PLG_VOTE_VOTE', '8').'" name="user_rating" value="8" /></li>';
$html .= '<li tabindex="9"><input type="radio" title="'.JText::sprintf('PLG_VOTE_VOTE', '9').'" name="user_rating" value="9" /></li>';
$html .= '<li tabindex="10"><input type="radio" title="'.JText::sprintf('PLG_VOTE_VOTE', '10').'" name="user_rating" value="10" checked="checked" /></li>';
$html .= '</ul>';
$html .= JText::_( 'PLG_VOTE_BEST' );        
$html .= '&#160;<input class="button" type="submit" name="submit_vote" value="'. JText::_( 'PLG_VOTE_RATE' ).'" />';
$html .= '<input type="hidden" name="task" value="article.vote" />';
$html .= '<input type="hidden" name="hitcount" value="0" />';
$html .= '<input type="hidden" name="url" value="'.  $uri->toString().'" />';
$html .= JHtml::_('form.token');        
$html .= '</form>';
}
}
return $html;
}
}


И, CSS к этому плагину:
Код
ul.content_vote {
  background-position: left top;
    float: none;
    height: 32px;
    list-style: none outside none;
    margin: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
    width: 320px;
    display: inline-block;    
}

ul.content_vote li {
    display: inline-block;
    /*float: left;*/
    width: 32px;
    position: absolute;
    background: none;
    padding: 0;  
}

ul.content_vote li:nth-child(2) {width: 32px; z-index: 11;}
ul.content_vote li:nth-child(3) {width: 64px; z-index: 10;}
ul.content_vote li:nth-child(4) {width: 96px; z-index: 9;}
ul.content_vote li:nth-child(5) {width: 128px; z-index: 8;}
ul.content_vote li:nth-child(6) {width: 160px; z-index: 7;}
ul.content_vote li:nth-child(7) {width: 192px; z-index: 6;}
ul.content_vote li:nth-child(8) {width: 224px; z-index: 5;}
ul.content_vote li:nth-child(9) {width: 256px; z-index: 4;}
ul.content_vote li:nth-child(10) {width: 288px; z-index: 3;}
ul.content_vote li:nth-child(11) {width: 320px; z-index: 2;}

ul.content_vote li:nth-child(3) input {margin-left: 40px; z-index: 9;}
ul.content_vote li:nth-child(4) input {margin-left: 74px; z-index: 8;}
ul.content_vote li:nth-child(5) input {margin-left: 106px; z-index: 7;}
ul.content_vote li:nth-child(6) input {margin-left: 138px; z-index: 6;}
ul.content_vote li:nth-child(7) input {margin-left: 170px; z-index: 5;}
ul.content_vote li:nth-child(8) input {margin-left: 202px; z-index: 4;}
ul.content_vote li:nth-child(9) input {margin-left: 234px; z-index: 3;}
ul.content_vote li:nth-child(10) input {margin-left: 266px; z-index: 2;}
ul.content_vote li:nth-child(11) input {margin-left: 298px; z-index: 1;}

.content_vote input {
    height: 68px;
    width: 20px;
}

ul.content_vote{
    background: url("/media/system/images/rating_star_blank.png") repeat-x transparent;
}

ul.content_vote li:hover, ul.content_vote li:active, ul.content_vote li:focus {
    background: url("/media/system/images/rating_star_vote.png") repeat-x transparent;
}

ul.content_vote .current_rating {
    background: url("/media/system/images/rating_star.png") repeat-x transparent;
    position: absolute;
    height: 32px;
    z-index: 1;
}


Также, помогите сделать "закрепление" голоса перед  нажатием на кнопку "проголосовать", то есть чтобы фоновый рисунок не сбивался при отведении курсора от шкалы.
*

AlexSmirnov

  • Завсегдатай
  • 1862
  • 272 / 16
  • Ищите и найдете
Мы здесь не занимаемся эксперементами с хаками. Они - чисто Ваше личное дело.

Для расширения стандартного функционала рейтинга Joomla имеется много соответствующих расширений, включая бесплатных.
# Back the fufalo (особенно ту самую столкершу)! #
# ВАЖНО! Кайфую от удаления присланного в личку спама, почти как от любви (особенно по выходным). #
*

Roporak

  • Захожу иногда
  • 72
  • 0 / 0
Мы здесь не занимаемся эксперементами с хаками. Они - чисто Ваше личное дело.

Для расширения стандартного функционала рейтинга Joomla имеется много соответствующих расширений, включая бесплатных.

Извините за беспокойство. Я думал часть заголовка раздела "Модификация плагинов для Joomla" относится и к моему случаю. Вы говорите, что не занимаетесь хаками, а разе подраздел "Модификации и хаки" не для этих целей?

Однако, я уже нашел подходящий мне сторонний плагин и модифицировал его под свои нужды. В этой теме больше нет смысла.
*

AlexSmirnov

  • Завсегдатай
  • 1862
  • 272 / 16
  • Ищите и найдете
Вам не о чем извиняться. Если бы я был так легко "беспокоим", то вряд ли бы три года назад согласился быть модератором на этом форуме анархистов, называющих себя администраторами Joomla ;)

Рад слушать что Вы нашли подходящее решение для себя.
# Back the fufalo (особенно ту самую столкершу)! #
# ВАЖНО! Кайфую от удаления присланного в личку спама, почти как от любви (особенно по выходным). #
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Как и чем можно обращаться с запросами из Joomla к GraphQL?

Автор bmf1982

Ответов: 0
Просмотров: 616
Последний ответ 03.10.2019, 15:46:00
от bmf1982
Joomla как система авторизации

Автор kav

Ответов: 23
Просмотров: 2295
Последний ответ 29.04.2018, 11:10:30
от Aleks.Denezh
Нужна помощь в доработке модуля под Joomla 3

Автор kik84

Ответов: 5
Просмотров: 2278
Последний ответ 30.01.2018, 22:40:30
от Елeна
Модификация MijoPolls Free - компоненет голосование ?

Автор warlocksp

Ответов: 6
Просмотров: 4079
Последний ответ 09.04.2017, 13:31:10
от Svlad
Модификация модуля lastet_news вывод времени перед заголовком

Автор Morphiss

Ответов: 9
Просмотров: 1973
Последний ответ 19.04.2016, 12:41:55
от spsyper