/** * */ public static function logReportPageOutput() { $path = admin_url('admin.php?page=rating_reports'); if (!empty($_GET['sortby']) && !empty($_GET['sort'])) { $sorbys = array('post_id', 'post_title', 'form_id', 'avg', 'time'); $sort = $_GET['sort'] == 'asc' ? 'asc' : 'desc'; $sortby = in_array($_GET['sortby'], $sorbys) ? $_GET['sortby'] : ''; } else { $sort = 'desc'; $sortby = ''; } $postID = (!empty($_GET['post']) and is_numeric($_GET['post'])) ? (int) $_GET['post'] : ''; $formID = (!empty($_GET['form']) and is_numeric($_GET['form'])) ? (int) $_GET['form'] : ''; $userID = (!empty($_GET['user']) and is_numeric($_GET['user'])) ? (int) $_GET['user'] : ''; $data = CBRatingSystemData::get_admin_user_ratings_with_ratingForm(array($formID), array($postID), array($userID), '', $sortby, $sort, array(), true); ?> <style> .approve { display:block; } </style> <div class="wrap columns-2"> <div class="icon32 icon32_cbrp_admin icon32-cbrp-user-ratings" id="icon32-cbrp-user-ratings"><br></div> <h2><?php _e('Codeboxr Rating System User Rating Logs', 'cbratingsystem'); ?> </h2> <div class="metabox-holder has-right-sidebar" id="poststuff"> <div class="messages"></div> <div id="post-body" class="post-body"> <div class="cbrp-log-report"> <form method="post"> <div style="clear: both;"></div> <div class="stuffbox"> <?php if ($data) { ?> <?php foreach ($data as $rowId => $rows) { ?> <?php $log_id_hidden = $rows->form_id . '-' . $rows->post_id . '-' . $rows->id; // (form_id)-(post_id)-(log_id) $log_id = $rows->id; $user_type = $rows->user_id > 0 ? sprintf(__('User%s', 'cbratingsystem'), " (ID: {$rows->user_id})") : __('Guest', 'cbratingsystem'); $user_name = $rows->user_id > 0 ? get_the_author_meta('display_name', $rows->user_id) : (!empty($rows->user_name) ? $rows->user_name : 'Anonymous'); $user_email = $rows->user_id > 0 ? get_the_author_meta('email', $rows->user_id) : (!empty($rows->user_email) ? $rows->user_email : '--'); $log_post_id = $rows->post_id; $log_post_title = $rows->post_title; $log_post_type = $rows->post_type; $log_form_id = $rows->form_id; $log_average = $rows->average > 0 ? '<strong>' . $rows->average / 100 * 5 . ' / 5</strong>' : '-'; if (!empty($rows->rating)) { $log_criteria_rating = '<ul>'; foreach ($rows->rating as $cId => $value) { if (is_numeric($cId)) { $log_criteria_rating .= '<li>' . $rows->custom_criteria[$cId]['label'] . ': <strong>' . number_format($value / 100 * count($rows->custom_criteria[$cId]['stars']), 2) . '/' . count($rows->custom_criteria[$cId]['stars']) . '</strong>'; } } $log_criteria_rating .= '</ul>'; } else { $log_criteria_rating = '-'; } $log_q_a = ''; $valuesText = array(); if (!empty($rows->question) and is_array($rows->question)) { $log_q_a .= '<ul>'; foreach ($rows->question as $questionId => $value) { $ratingFormId = $rows->form_id; $type = $rows->custom_question[$questionId]['field']['type']; if (array_key_exists($type, $rows->custom_question[$questionId]['field'])) { $fieldArr = $rows->custom_question[$questionId]['field'][$type]; } else { $fieldArr = array(); } if (array_key_exists('seperated', $fieldArr)) { $seperated = $fieldArr['seperated']; } else { $seperated = 0; } if (is_array($value)) { foreach ($value as $key => $val) { $valuesText[$rows->form_id][$questionId][] = '<strong>' . __(stripcslashes($fieldArr[$key]['text']), 'cbratingsystem') . '</strong>'; } if (!empty($valuesText)) { $log_q_a .= ' <li> <div data-q-id="' . $questionId . '" class="question-id-wrapper-' . $questionId . ' question-id-wrapper-' . $questionId . '-form-' . $ratingFormId . ' "> <div class="question-label-wrapper"> <span class="question-label question-label-id-' . $questionId . '" >' . (isset($rows->custom_question[$questionId]) ? __(stripslashes($rows->custom_question[$questionId]['title']), 'cbratingsystem') : '') . '</span> <span class="question-label-hiphen">' . (isset($rows->custom_question[$questionId]) ? ' - ' : '') . '</span> <span class="answer"><strong>' . implode(', ', $valuesText[$rows->form_id][$questionId]) . '</strong></span> </div> </div> </li> '; } } else { if ($seperated == 0) { $log_q_a .= ' <li> <div data-form-id="' . $ratingFormId . '" data-q-id="' . $questionId . '" class="question-id-wrapper-' . $questionId . ' question-id-wrapper-' . $questionId . '-form-' . $ratingFormId . ' "> <div class="question-label-wrapper"> <span class="question-label question-label-id-' . $questionId . '" >' . (isset($rows->custom_question[$questionId]) ? __(stripslashes($rows->custom_question[$questionId]['title']), 'cbratingsystem') : '') . '</span> <span class="question-label-hiphen">' . (isset($rows->custom_question[$questionId]) ? ' - ' : '') . '</span> <span class="answer"><strong>' . ($value == 1 ? __('Yes', 'cbratingsystem') : __($value, 'cbratingsystem')) . '</strong></span> </div> </div> </li> '; } } } $log_q_a .= '</ul>'; } //$log_comment = ( $rows->comment ) ? CBRatingSystemFunctions :: text_summary_mapper( $rows->comment ) : '-'; $log_comment = $rows->comment ? stripslashes($rows->comment) : '-'; $log_comment_status = $rows->comment_status; $log_date = date('M d, Y @ H:m', $rows->created); $log_host_ip = $rows->user_ip; ?> <?php $comment_status_list = array('delete', 'unapproved', 'approved', 'spam'); $comment_status = $log_comment_status; ?> <?php array_push(CBRatingSystemAdminReport::$cb_user_comment_log_data, array('ID' => $log_id, 'id' => $log_id, 'user_name' => $user_name, 'user_id' => $userID, 'userinfo' => $user_email, 'post' => $log_post_id, 'type' => $log_post_type, 'posttitle' => $log_post_title, 'formid' => $log_form_id, 'avgrating' => $log_average, 'criteriarating' => $log_criteria_rating, 'qa' => $log_q_a, 'comment' => $log_comment, 'commentstatus' => $comment_status, 'date' => $log_date, 'ip' => $log_host_ip)); ?> <?php } ?> <?php } else { //echo "<td colspan='13' align='center'>No Results Found</td>"; ?> <?php } ?> </div> </form> </div> </div> </div> </div> <?php $user_log = new Cbratinguserlog(array()); $user_log->prepare_items(); ?> <div class="cbratinguserlog"> <form id="user-filter" method="get"> <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?> " /> <?php $user_log->display(); ?> </form> </div> <?php }