Пример #1
0
 function c_item_main($c_item)
 {
     if ($this->is_print_view) {
         if (isset($c_item['url'])) {
             $this->c_item_link($c_item);
         } else {
             $this->c_item_content($c_item);
         }
         $this->output('<DIV CLASS="qa-c-item-footer">');
         $this->post_meta($c_item, 'qa-c-item');
         $this->output('</DIV>');
     } else {
         qa_html_theme_base::c_item_main($c_item);
     }
 }
 function c_item_main($c_item)
 {
     global $topage;
     if (qa_opt('voting_on_cs') && is_array($this->comment_votes) && isset($c_item['content']) && !isset($c_item['url']) && !strpos($c_item['content'], 'question-closed-message')) {
         $vote = 0;
         $flag = 0;
         foreach ($this->comment_votes as $vote) {
             if ($vote['postid'] == $c_item['raw']['postid']) {
                 $vote = (int) $vote['vote'];
                 break;
             }
         }
         $netvotes = $c_item['raw']['netvotes'] != 0 ? $c_item['raw']['netvotes'] : '';
         if (qa_permit_check('permit_vote_c')) {
             $this->output('<table class="comment-votable-container"><tr><td class="comment-vote-container">');
             switch ($vote) {
                 case 1:
                     $up = 0;
                     $up_type = '-selected';
                     $down_type = false;
                     break;
                 case -1:
                     $down = 0;
                     $down_type = '-selected';
                     $up_type = false;
                     break;
                 default:
                     $up = 1;
                     $down = -1;
                     $up_type = '';
                     $down_type = '';
                     break;
             }
             if (!qa_opt('voting_down_cs') && $vote != -1) {
                 $down_type = false;
             }
             // don't allow for own user
             if ($c_item['raw']['userid'] != qa_get_logged_in_userid()) {
                 $this->output(($up_type !== false ? '<div class="comment-vote-item' . $up_type . '" name="vote_' . $c_item['raw']['postid'] . '_' . $up . '_c' . $c_item['raw']['postid'] . '_1" onclick="ajaxCommentVote(this);" title="' . qa_lang_html('main/vote' . ($up == 0 ? 'd' : '') . '_up_popup') . '">▲</div>' : '') . ($netvotes ? '<div id="voting_' . $c_item['raw']['postid'] . '">' . $netvotes . '</div>' : '') . ($down_type !== false ? '<div class="comment-vote-item' . $down_type . '" onclick="ajaxCommentVote(this);" name="vote_' . $c_item['raw']['postid'] . '_' . $down . '_c' . $c_item['raw']['postid'] . '_-1" title="' . qa_lang_html('main/vote' . ($down == 0 ? 'd' : '') . '_down_popup') . '">▼</div>' : ''));
             } else {
                 if ($netvotes) {
                     $this->output('<div id="voting_' . $c_item['raw']['postid'] . '">' . $netvotes . '</div>');
                 }
             }
             $this->output('</td><td>');
             qa_html_theme_base::c_item_main($c_item);
             $this->output('</td></tr></table>');
         } else {
             if ($netvotes) {
                 $this->output('<table class="comment-votable-container"><tr><td class="comment-vote-container"><div id="voting_' . $c_item['raw']['postid'] . '">' . $netvotes . '</div></td><td>');
                 qa_html_theme_base::c_item_main($c_item);
                 $this->output('</td></tr></table>');
             } else {
                 qa_html_theme_base::c_item_main($c_item);
             }
         }
     } else {
         qa_html_theme_base::c_item_main($c_item);
     }
 }