function cmsKarmaButtonsText($target, $target_id, $points = 0, $is_author = false){ $html = ''; if (!$points) { $postkarma = cmsKarma($target, $target_id); $points = cmsKarmaFormat($postkarma['points']); } else { $points = $points; } $control = ''; //PREPARE RATING FORM if (cmsCore::c('user')->id && !$is_author){ if(!cmsAlreadyKarmed($target, $target_id, cmsCore::c('user')->id)){ cmsCore::c('page')->addHeadJS('core/js/karma.js'); $control .= '<span>'; $control .= '<a href="javascript:void(0);" onclick="plusKarma(\''.$target.'\', '.$target_id.');" style="color:green">Нравится</a> ↑ '; $control .= '<a href="javascript:void(0);" onclick="minusKarma(\''.$target.'\', '.$target_id.');" style="color:red">Не нравится</a> ↓'; $control .= '</span>'; $html .= '<span class="karma_buttons">'; $html .= '<span id="karmactrl">'.$control.'</span>'; $html .= '</span>'; } } return $html; }
function cmsKarmaButtonsText($target, $target_id, $points = 0, $is_author = false) { $inUser = cmsUser::getInstance(); $inPage = cmsPage::getInstance(); $html = ''; if ($inUser->id && !$is_author) { if (!cmsAlreadyKarmed($target, $target_id, $inUser->id)) { global $_LANG; $inPage->addHeadJS('core/js/karma.js'); $control = ' <span><a class="color_green color_transition" href="#" onclick="return plusKarma(\'' . $target . '\', ' . $target_id . ');"><i class="fa fa-thumbs-up fa-lg"></i> ' . $_LANG['LIKE'] . '</a> '; $control .= '<a class="color_red color_transition" href="#" onclick="return minusKarma(\'' . $target . '\', ' . $target_id . ');"><i class="fa fa-thumbs-down fa-lg"></i> ' . $_LANG['UNLIKE'] . '</a></span>'; $html .= '<span class="karma_buttons">'; $html .= '<span id="karmactrl">' . $control . '</span>'; $html .= '</span>'; } } return $html; }