function acf_cleaner() { global $wpdb; echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>'; echo '<h2>ACF Cleaner</h2>'; echo '<h3>Post Meta</h3>'; echo generate_table('post', $wpdb->get_results(postmeta_fields())); echo '<h3>User Meta</h3>'; echo generate_table('user', $wpdb->get_results(postmeta_fields('wp_usermeta'))); echo '</div>'; }
function generate_content($name, array $table, array $types, $primaryKey, $addKey = true) { $haveHeader = false; $sql = ""; $results = array(); foreach ($table as $key => $entity) { $data = $addKey ? array('id' => $key) : array(); $data = array_merge($data, get_object_vars($entity)); if (!$haveHeader) { generate_table($name, array_keys($data), $types, $primaryKey); $sql = "INSERT INTO {$name} (" . implode(", ", array_keys($data)) . ") VALUES\n"; $haveHeader = true; } $data = array_values($data); assert(count($data) == count($types) && count($data) >= 1); $r = ""; $isString = $types[0] != 'INT'; check_item($data[0], $isString); if ($isString) { $r .= "\"{$data[0]}\""; } else { $r .= $data[0]; } for ($i = 1; $i < count($data); ++$i) { $r .= ", "; $isString = $types[$i] != 'INT'; check_item($data[$i], $isString); if ($isString) { $r .= "\"{$data[$i]}\""; } else { $r .= $data[$i]; } } $results[] = "({$r})"; } $sql .= implode(",\n", $results) . ";\n"; fwrite(STDOUT, $sql); }
/** * Build the ranking table to be viewd in the course * @param array $rankinglastmonth List of students of the last month ranking * @param array $rankinglastweek List of students of the last week ranking * @param array $rankinggeral List of students to be print in ranking block * @return string */ function block_ranking_print_students($rankinglastmonth, $rankinglastweek, $rankinggeral) { global $PAGE; $tablelastweek = generate_table($rankinglastweek); $tablelastmonth = generate_table($rankinglastmonth); $tablegeral = generate_table($rankinggeral); $PAGE->requires->js_init_call('M.block_ranking.init_tabview'); return '<div id="ranking-tabs"> <ul> <li><a href="#semanal">' . get_string('weekly', 'block_ranking') . '</a></li> <li><a href="#mensal">' . get_string('monthly', 'block_ranking') . '</a></li> <li><a href="#geral">' . get_string('general', 'block_ranking') . '</a></li> </ul> <div> <div id="semanal">' . $tablelastweek . '</div> <div id="mensal">' . $tablelastmonth . '</div> <div id="geral">' . $tablegeral . '</div> </div> </div>'; }
$sarg = $sargs[$i]; debug($sql . "\narray(" . implode(",", $sarg) . ")\n"); db_exec($sql, $sarg); } } if (isset($arg['edit'])) { /* on edit and add, we will send Location: but with "edit" again, stripping add and the token */ if (isset($arg['add'])) { $args = "?gid={$gid}&edit"; } else { generate_edit_form($tpl, $gid); } } if (count($sqls)) { header("Location: /admin/gmessage.phtml{$args}"); } } } $tpl = new YATT($template_dir . '/admin', 'gmessage.yatt'); process_request($tpl, $_REQUEST); generate_table($tpl); /* if (!empty($debug)) { $tpl->set('debug',$debug); $tpl->parse('debug'); } */ page_header("Global Messages"); echo $tpl->output(); page_footer();
><?php echo str_replace('_', ' ', $m); ?> </option> <?php } ?> </select> <h3>Curves</h3> <div class="col-xs-12 panel"> <div class="checkbox"><label> <input type="checkbox" name="latestOnly" checked onchange="latestOnly = this.checked; redrawCurves();"> Only newest flow versions</label></div> <div id="learning_curve_visualize" style="width: 100%">Plotting curves <i class="fa fa-spinner fa-spin"></i></div> </div> <h3>Table</h3> <div class="panel table-responsive"> <table id="datatable_main" class="table table-bordered table-condensed table-responsive"> <?php echo generate_table(array('img_open' => '', 'rid' => 'Run', 'sid' => 'setup id', 'name' => 'Flow', 'value' => str_replace('_', ' ', $this->current_measure))); ?> </table></div> <?php } ?> </div> <!-- end col-md-12 -->
include_once S3DB_SERVER_ROOT . '/header_pop_ups.inc.php'; if (!isset($_SESSION['user'])) { Header('Location: ../login.php?error=2'); exit; } if ($_GET['entity'] != '') { $entity = $_GET['entity']; } if ($_REQUEST['project_id'] == '') { $tpl->set_var('message', 'You are not working with any project yet. Please select a working <a href="../project/index.php">project</a> by clicking the <b>Name</b> of project.<br /><br />'); } else { if ($resource_acl != -1 && $acl != 0 && $acl != 1 && $acl != 2 && $acl != 3) { echo 'You are not allowed on this project.'; } else { $table = compact('entity', 'project_info', 'resource_info', 'db', 'user_id'); echo generate_table($table); } } function generate_table($table) { extract($table); if ($project_id == '') { $project_id = $project_info['project_id']; } $R = array('db' => $db, 'project_id' => $project_id, 'subject' => $resource_info['entity'], 'object' => '!=UID'); $rules = list_shared_rules($R); ###Fetch all the objects and all of the verbs to create the header if (empty($_SESSION['show_me'])) { if (is_array($rules)) { $verbs = array_map('grab_verb', $rules); }
$from = "FROM {user} u\n INNER JOIN {role_assignments} a ON a.userid = u.id\n LEFT JOIN {ranking_points} r ON r.userid = u.id AND r.courseid = :r_courseid\n INNER JOIN {context} c ON c.id = a.contextid"; $where = "WHERE a.contextid = :contextid\n AND a.userid = u.id\n AND a.roleid = :roleid\n AND c.instanceid = :courseid"; $params['contextid'] = $context->id; $params['roleid'] = 5; $params['courseid'] = $COURSE->id; $params['r_courseid'] = $params['courseid']; $order = "ORDER BY r.points DESC, u.firstname ASC\n LIMIT " . $perpage; if ($group) { $from .= " INNER JOIN {groups_members} gm ON gm.userid = u.id AND gm.groupid = :groupid"; $params['groupid'] = $group; } $sql = "SELECT {$userfields}, r.points {$from} {$where} {$order}"; $students = array_values($DB->get_records_sql($sql, $params)); $strcoursereport = get_string('nostudents', 'block_ranking'); if (count($students)) { $strcoursereport = get_string('report_head', 'block_ranking', count($students)); } echo $OUTPUT->header(); echo $OUTPUT->heading($strcoursereport); $PAGE->set_title($strcoursereport); // Output group selector if there are groups in the course. echo $OUTPUT->container_start('ranking-report'); if (has_capability('moodle/site:accessallgroups', $context)) { $groups = groups_get_all_groups($course->id); if (!empty($groups)) { groups_print_course_menu($course, $PAGE->url); } } echo generate_table($students); echo $OUTPUT->container_end(); echo $OUTPUT->footer();
?> </table> </div> <div class="tab-pane" id="task-type-<?php echo $tt->ttid; ?> -illegal"> <h4><?php echo $tt->name; ?> tasks with illegal values (<?php echo count($tt->illegal); ?> )</h4> <table class="taskstable table table-striped"><?php echo generate_table($this->missingheader, $tt->illegal); ?> </table> </div> <div class="tab-pane" id="task-type-<?php echo $tt->ttid; ?> -duplicates"> <h4><?php echo $tt->name; ?> groups of tasks with the same values (<?php echo count($tt->duplicate_groups); ?> )</h4>