Esempio n. 1
0
function show_progress()
{
    /* this function is a copy of edit_event() */
    /*
    $mandants = EventDatabaseManager::getAllMandants();
    View::outputAllMandants('edit_mandants', $mandants);
    echo "<br><br>";
    
    
    echo "Mandants:<br><pre>";var_dump($mandants); echo "</pre>";
    echo "<br><br>";
    
    	$topics = EventDatabaseManager::getAllTopics();
    
    	$users = EventDatabaseManager::getAllTopics();
    	echo "Topics:<br><pre>";var_dump($topics); echo "</pre>";
    */
    $users = EventDatabaseManager::getAllUsers();
    foreach ($users as $key => $row) {
        $company[$key] = $row['company'];
        $last_name[$key] = $row['last_name'];
    }
    // Die Daten mit 'company' absteigend, die mit 'last_name' aufsteigend sortieren.
    // Geben Sie $data als letzten Parameter an, um nach dem gemeinsamen
    // Schlüssel zu sortieren.
    array_multisort($company, SORT_ASC, $last_name, SORT_ASC, $users);
    //echo "Users:<br><pre>";var_dump($users); echo "</pre>";
    $output_str = "<h2>" . HEADER_PROGRESS . "</h2>";
    $output_str .= "<table style=\"width: 100%;\">";
    $output_str .= "<tr>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">Mandant-ID</td>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">Company</td>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">User-ID</td>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">Username</td>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">Name, Vorname</td>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">email</td>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">Course</td>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">Progress</td>";
    $output_str .= "</tr>";
    foreach ($users as $user => $value) {
        $output_str .= "<tr>";
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $value['mandant_id'] . "</td>";
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $value['company'] . "</td>";
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $value['id'] . "</td>";
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $value['display_name'] . "</td>";
        $lfn = "";
        if (isset($value['last_name']) && isset($value['first_name'])) {
            $lfn = $value['last_name'] . ", " . $value['first_name'];
        }
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $lfn . "</td>";
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $value['user_email'] . "</td>";
        $c = "";
        if (isset($value['course_title']) && isset($value['course_id'])) {
            $c = $value['course_title'] . " (" . $value['course_id'] . ")";
        }
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $c . "</td>";
        $p = "";
        if (isset($value['course_progress'])) {
            $p = $value['course_progress'] . " %";
        }
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $p . "</td>";
        $output_str .= "</tr>";
    }
    $output_str .= "</table>";
    $users_per_mandant = EventDatabaseManager::getUsersPerMandant();
    //echo "users_per_mandant:<br><pre>";var_dump($users_per_mandant); echo "</pre>";
    $output_str .= "<h2>" . HEADER_USERS_PER_MANDANT . "</h2>";
    $output_str .= "<table>";
    $output_str .= "<tr>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">Mandant-ID</td>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">Company</td>";
    $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black; background:black; color:white;\">Users</td>";
    $output_str .= "</tr>";
    foreach ($users_per_mandant as $upm => $value) {
        $output_str .= "<tr>";
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $value['mandantID'] . "</td>";
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $value['company'] . "</td>";
        $output_str .= "<td style=\"padding: 1px 2px; border: 1px solid black;\">" . $value['number_users'] . "</td>";
        $output_str .= "</tr>";
    }
    $output_str .= "</table>";
    echo $output_str;
}