Как сделать шесть кнопок, вроде разобрался.
<?php if ($target_subject == 'anec'){ ?> <div class="arrow up"> <?php if ($is_enabled){ ?> <a href="#vote-up" class="vote-up" title="<?php echo LANG_RATING_VOTE_UP; ?>"></a> <?php } else { ?> <span class="disabled" title="<?php html( $is_voted ? LANG_RATING_VOTED : LANG_RATING_DISABLED ); ?>">+5</span> <?php } ?> </div> <div class="arrow up"> <?php if ($is_enabled){ ?> <a href="#vote-up" class="vote-up" title="<?php echo LANG_RATING_VOTE_UP; ?>"></a> <?php } else { ?> <span class="disabled" title="<?php html( $is_voted ? LANG_RATING_VOTED : LANG_RATING_DISABLED ); ?>">+3</span> <?php } ?> <?php } ?> </div> <div class="arrow up"> <?php if ($is_enabled){ ?> <a href="#vote-up" class="vote-up" title="<?php echo LANG_RATING_VOTE_UP; ?>"></a> <?php } else { ?> <span class="disabled" title="<?php html( $is_voted ? LANG_RATING_VOTED : LANG_RATING_DISABLED ); ?>">+1</span> <?php } ?> </div> <div class="score" title="<?php echo LANG_RATING; ?>"> <?php if ($options['is_hidden'] && !$is_voted && ($is_enabled || $is_guest)){ ?> <span>—</span> <?php } else { ?> <span class="<?php echo html_signed_class($current_rating); ?><?php if ($options['is_show']) { ?> clickable<?php } ?>"> <?php echo html_signed_num($current_rating); ?> </span> <?php } ?> </div> <div class="arrow down <?php if (!$is_enabled){ ?>disabled<?php } ?>"> <?php if ($is_enabled){ ?> <a href="#vote-down" class="vote-down" title="<?php echo LANG_RATING_VOTE_DOWN; ?>"></a> <?php } else { ?> <span class="disabled" title="<?php html( $is_voted ? LANG_RATING_VOTED : LANG_RATING_DISABLED ); ?>">-1</span> <?php } ?> </div> <?php if ($target_subject == 'anec'){ ?> <div class="arrow down <?php if (!$is_enabled){ ?>disabled<?php } ?>"> <?php if ($is_enabled){ ?> <a href="#vote-down" class="vote-down" title="<?php echo LANG_RATING_VOTE_DOWN; ?>"></a> <?php } else { ?> <span class="disabled" title="<?php html( $is_voted ? LANG_RATING_VOTED : LANG_RATING_DISABLED ); ?>">-3</span> <?php } ?> </div> <div class="arrow down <?php if (!$is_enabled){ ?>disabled<?php } ?>"> <?php if ($is_enabled){ ?> <a href="#vote-down" class="vote-down" title="<?php echo LANG_RATING_VOTE_DOWN; ?>"></a> <?php } else { ?> <span class="disabled" title="<?php html( $is_voted ? LANG_RATING_VOTED : LANG_RATING_DISABLED ); ?>">-5</span> <?php } ?> </div> <?php } ?>
Но теперь не знаю, как передать из \templates\tseso\js\rating.js значение балла рейтинга в \system\controllers\rating\actions\vote.php
Даже если просто объявить переменную в js файле
this.onDocumentReady = function(){ var widget = $(this); var controller = widget.data('target-controller'); var subject = widget.data('target-subject'); var id = widget.data('target-id'); var points = 5; $('a.vote-up', widget).click(function(){ icms.rating.vote('up', controller, subject, id, points); }); $('a.vote-down', widget).click(function(){ icms.rating.vote('down', controller, subject, id, points); });
public function run(){ if (!$this->request->isAjax()){ cmsCore::error404(); } // Получаем параметры $direction = $this->request->get('direction'); $target_controller = $this->request->get('controller'); $target_subject = $this->request->get('subject'); $target_id = $this->request->get('id'); $points = $this->request->get('points'); $template = cmsTemplate::getInstance(); $is_valid = ($this->validate_sysname($target_controller)===true) && ($this->validate_sysname($target_subject)===true) && $user = cmsUser::getInstance(); // Объединяем всю информацию о голосе 'user_id' => $user->id, 'target_controller' => $target_controller, 'target_subject' => $target_subject, 'target_id' => $target_id, 'score' => $direction=='up' ? $points : -$points );
Заранее признателен.