<?php

require_once 'config.php';
require_once 'class/rating.php';
require_once 'functions/functions.php';
$renderObj = new rating();
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
    $record = $renderObj->saveWorkManager($_POST);
}
$alphaValue = strip_tags($_POST['alphaValue']);
$alphaValue = $alphaValue != '' ? $alphaValue : 0;
$alphaValue = $alphaValue == 'All' ? '' : $alphaValue;
$team_member = $renderObj->get_all_member_custom();
$rating_dashboard = $renderObj->rating_dashboard($team_member, $alphaValue);
$rating_dashboard = sortByRating($rating_dashboard);
//pr($rating_dashboard);
if (!empty($rating_dashboard)) {
    $i = 0;
    foreach ($rating_dashboard as $key => $val) {
        $i++;
        $user_id = $val['id'];
        $profile_pic = $val['google_picture_link'] ? $val['google_picture_link'] . "?sz=100" : 'images/user.png';
        ?>
        <div class="mid-col-4">
            <div class="mid-col-top">
                <div class="mid-col-img"><a href="./profile.php?id=<?php 
        echo $val['id'];
        ?>
&edit_comment=true"><img src="<?php 
        echo $profile_pic;
        ?>
<?php

require_once 'config.php';
require_once 'class/rating.php';
$renderObj = new rating();
$page_number = (int) (!isset($_GET['page']) ? 1 : $_GET['page']);
$user_id = $_SESSION['userinfo']->id != '' ? $_SESSION['userinfo']->id : 0;
require_once 'header.php';
$user_data = $renderObj->get_all_member_custom();
if (isset($_GET['chk'])) {
    $error_id = isset($_GET['chk']) ? (int) $_GET['chk'] : 0;
    if ($error_id != 0 && array_key_exists($error_id, $errors)) {
        $cls = "error-red";
        echo '<div class="', $cls, '" style="width:55%;margin-left: 28%;"><div class="close-alert"></div>', $errors[$error_id], '</div>';
    }
}
?>
    <div class="succes-green"><div class="close-alert"></div> <?php 
echo $errors[18];
?>
</div>
    <div id="allchars" class="link-block-all">
        <a href="javascript:void(0);" id="charAll" class="link-all link-alphabet Alphas">All</a>
        <?php 
$names = array();
foreach ($user_data as $character) {
    $names[] = substr($character['name'], 0, 1);
}
$names = array_unique($names);
foreach ($names as $character) {
    echo '<a href="javascript:void(0);" id="char', $character['name'], '" class="link-alphabet Alphas">', ucfirst($character['name']), '</a>';