function build_table($course) { global $CFG; // Pull an iterator for grades for that user $iter = pull_grade_iterator($course->userid, $course->id); // Start the table object $table = new stdClass(); $table->head = array(get_string('itemname', 'grades'), get_string('category', 'grades'), get_string('overridden', 'grades'), get_string('excluded', 'grades'), get_string('range', 'grades'), get_string('rank', 'grades'), get_string('feedback', 'grades'), get_string('finalgrade', 'grades')); $table->data = array(); $table->rowclass = array(); // Function to get ranks of students in a specific grade item $context = get_context_instance(CONTEXT_COURSE, $course->id); $total_users = get_total_users($course->id); foreach ($iter as $grade) { $line = array(); $cat = $grade->sql_grade_item->get_parent_category(); $fullname = $cat->fullname; $itemtype = $grade->sql_grade_item->itemtype; $decimals = $grade->sql_grade_item->get_decimals(); $rowclass = ''; if ($itemtype == 'category') { $rowclass = $itemtype; $itemname = $fullname . ' Category Total'; } elseif ($itemtype == 'course') { $itemname = 'Course Total'; } else { $itemname = $grade->sql_grade_item->itemname; } // Output the necessary information $line[] = $itemname; $line[] = $fullname == '?' ? $course->fullname : $fullname; $line[] = $grade->is_overridden() ? 'Y' : 'N'; $line[] = $grade->is_excluded() ? 'Y' : 'N'; $line[] = format_float($grade->sql_grade_item->grademin, $decimals) . '-' . format_float($grade->sql_grade_item->grademax, $decimals); $line[] = get_rank($grade, $total_users, $context); $line[] = format_text($grade->feedback, $grade->feedbackformat); $line[] = '<span class="' . passing_grade($grade->sql_grade_item->gradepass, $grade->finalgrade) . '">' . simple_grade_format_gradevalue($grade->finalgrade, $grade->sql_grade_item, true) . '</span>'; $table->data[] = $line; $table->rowclass[] = $rowclass; } print_table($table); }
if (($luna_config['o_feed_type'] == 1 || $luna_config['o_feed_type'] == 2) && isset($footer_style)) { '<span><a href="extern.php?action=feed&type=' . $feed_type . $feed_id . '">' . $feed_lang . '</a></span>' . "\n"; } ?> </div> <footer class="footer"> <div class="container"> <?php if ($luna_config['o_board_statistics'] == 1) { ?> <div class="panel panel-default"> <div class="panel-body"> <div class="row"> <div class="col-lg-2 col-md-4 col-sm-6 col-xs-12"> <div class="statistic-item text-center"><?php echo _n('User', 'Users', get_total_users(), 'luna'); ?> : <strong><?php total_users(); ?> </strong></div> </div> <div class="col-lg-2 col-md-4 col-sm-6 col-xs-12"> <div class="statistic-item text-center"><?php echo _n('Thread', 'Threads', get_total_threads(), 'luna'); ?> : <strong><?php total_threads(); ?> </strong></div> </div>
function follows_analytics() { ?> <div id="wrap2"> <h2>Estadísticas Generales</h3> <ul> <li><strong>Usuarios inscritos:</strong> <?php echo get_total_users(); ?> <li> <li><strong>Items seguidos:</strong> <?php echo get_total_follows(); ?> <li> <li><strong>Emails enviados:</strong> <?php echo get_total_emails(); ?> <li> <li><strong>Emails de categorías enviados:</strong> <?php echo get_total_emails('cat'); ?> <li> <li><strong>Emails de etiquetas enviados:</strong> <?php echo get_total_emails('tag'); ?> <li> <li><strong>Emails de autores enviados:</strong> <?php echo get_total_emails('author'); ?> <li> </ul> </div> <?php }
function total_users() { echo get_total_users(); }
echo "graph_scale no\n"; echo "graph_info Displays the sum of users, as well as disabled count, in your Drupal site\n"; echo "users_total.label total users\n"; echo "users_blocked.label blocked users\n"; echo "users_total.min 0\n"; echo "users_blocked.min 0\n"; exit(0); } // Connect to database $dbh = new mysqli($host, $user, $pass, $db, $port); if (mysqli_connect_errno()) { echo "Connecction failed: " . mysqli_connect_error() . PHP_EOL; exit(1); } // Print out the actual values $users_total = (int) get_total_users($dbh); $users_blocked = (int) get_blocked_users($dbh); echo "users_total.value {$users_total}\n"; echo "users_blocked.value {$users_blocked}\n"; $dbh->close(); /** * Get count for all users * @return integer $count total users */ function get_total_users(&$dbh = NULL) { $table_prefix = getenv('table_prefix'); $sql = "SELECT COUNT(uid) AS count FROM {$table_prefix}users"; $result = $dbh->query($sql); $row = $result->fetch_assoc(); return (int) $row['count'];