function process($arguments)
{
    $dump_data = false;
    $term = get_term_default();
    array_shift($arguments);
    if (!isset($arguments[0])) {
        $arguments[0] = '-h';
    }
    $argCount = count($arguments);
    for ($i = 0; $i < $argCount; $i++) {
        if ($arguments[$i] == '-h') {
            print_help();
            exit;
        } elseif ($arguments[$i] == '-f') {
            $i++;
            if (!isset($arguments[$i])) {
                exit("Configuration file not included.\n");
            }
            $file_directory = $arguments[$i];
        } elseif ($arguments[$i] == '-n') {
            $i++;
            if (!isset($arguments[$i])) {
                exit("Student rows not included.\n");
            }
            $number_of_students = $arguments[$i];
        } elseif ($arguments[$i] == '-x') {
            $dump_data = true;
        } elseif ($arguments[$i] == '-t') {
            $i++;
            if (!isset($arguments[$i])) {
                exit("Term is missing.\n");
            }
            $term = $arguments[$i];
        } else {
            exit("Unknown command\n");
        }
    }
    if (empty($number_of_students)) {
        $number_of_students = NUMBER_OF_STUDENTS;
    }
    include_database_file($file_directory);
    if ($dump_data) {
        $response = readline("Are you sure you want to reset ALL your student tables? (y/N):");
        if ($response == 'y') {
            reset_tables();
        } else {
            echo "Ending script.\n\n";
            exit;
        }
        echo "\nReset complete.\n------------------------------------\n\n";
    }
    build_table();
    echo TABLE_NAME . " table created.\n";
    echo "------------------------------------\n\n";
    echo "Creating {$number_of_students} students.\n\n";
    insert_rows($number_of_students, $term);
    echo "------------------------------------\nStudent creation complete.\n\n";
    echo "Make sure your inc/hms_defines.php file contains the following setting:\ndefine('SOAP_OVERRIDE_FILE', 'FakeSoapTable.php');\n";
}
Example #2
0
function Buscar()
{
    global $connect;
    $product = $_POST["name"];
    $query = "SELECT * FROM product WHERE name LIKE '{$product}%';";
    $result = mysqli_query($connect, $query);
    $number_of_rows = mysqli_num_rows($result);
    $temp_array = array();
    if ($number_of_rows > 0) {
        while ($row = mysqli_fetch_assoc($result)) {
            $temp_array[] = $row;
        }
    }
    //header('Content-Type: application/json');
    build_table(json_decode(json_encode($temp_array), true));
}
function build_table($data)
{
    $html = '<table width="100%" border="1">' . "\n";
    foreach ($data as $key => $value) {
        $html .= '<tr>' . "\n";
        $html .= "\t" . '<td width="300" style="width:300px">' . $key . '</td>' . "\n";
        if (is_object($value) or is_array($value)) {
            $html .= '<td>' . build_table($value) . '</td>';
        } else {
            $html .= "\t" . '<td>' . $value . '</td>' . "\n";
        }
        $html .= '</tr>' . "\n";
    }
    $html .= '</table>' . "\n\n\n";
    return $html;
}
Example #4
0
$components->components[] = new results_drop_down($per_page);
$components->display_as_table($heading_main);
$where = $components->where_clause();
// Do a prequery to figure out if the table doesn't just print out
$threshold = get_config('', 'block_student_gradeviewer_threshold');
//Running a count on the pre query info
if (!empty($prequery) && empty($where)) {
    $sql = "SELECT COUNT(u.id) FROM {$CFG->prefix}block_courseprefs_users u {$table} WHERE " . $prequery;
    $count = count_records_sql($sql);
} else {
    $count = $threshold;
}
// Print table if they submitted data
if (!empty($where) || $count < $threshold) {
    // build table
    build_table($components, $where, $page, $per_page);
}
// Tag the inputs with our special javascript
echo '<script type="text/javascript">tag_inputs();</script>';
print_footer();
function build_table($components, $where, $page, $per_page)
{
    global $CFG, $USER;
    $defaults = $components->as_dict();
    list($table, $prequery) = get_pre_query($USER->id);
    // if they have the ability to view a particular sport then
    // we have to do some joins in our lookup
    $viewsports = (isset($where['sports']) or !empty($table));
    if ($viewsports) {
        $extra_values = ", spo.code AS sports, spo.name ";
        $sports_tables = ", {$CFG->prefix}block_courseprefs_sports spo,\n                     {$CFG->prefix}block_courseprefs_sportusers spu ";
Example #5
0
$context = get_context_instance(CONTEXT_SYSTEM);
if (!has_capability('block/courseprefs:viewdata', $context)) {
    // Nope, redirecting to main
    redirect($CFG->wwwroot);
}
require_login();
$heading_main = get_string('content_viewer', 'block_courseprefs');
$navigation = array(array('name' => get_string('blockname', 'block_courseprefs'), 'link' => '', 'type' => 'title'), array('name' => $heading_main, 'link' => '', 'type' => 'title'));
print_header_simple($heading_main, '', build_navigation($navigation));
$components = cps_user_component::build_components();
$components->display_as_table();
$where = $components->where_clause();
// Draw table
if ($data = data_submitted()) {
    if (!empty($where)) {
        build_table($components, $where);
    }
}
print_footer();
function build_table($components, $where)
{
    global $CFG;
    $count_sql = "SELECT COUNT(id) FROM {$CFG->prefix}block_courseprefs_users ";
    $sql = "SELECT * FROM {$CFG->prefix}block_courseprefs_users ";
    $where_sql = "WHERE " . implode(' AND ', $where);
    $users = get_records_sql($sql . $where_sql);
    $defaults = $components->as_dict();
    $keys = array_keys($defaults);
    $count = count_records_sql($count_sql . $where_sql);
    // No results gets a special message
    if (empty($users)) {
Example #6
0
// check if the repeater field has rows of data
if (have_rows('panes')) {
    $count = 1;
    // loop through the rows of data
    while (have_rows('panes')) {
        the_row();
        $the_content = '';
        $contents = get_sub_field('content');
        foreach ($contents as $content) {
            //send table content to build_table.php otherwise appent to the_content
            $layout = $content['acf_fc_layout'];
            if ($content['acf_fc_layout'] == 'table') {
                /*echo '<pre>';
                  print_r($content[$layout]);
                  echo '</pre>';*/
                $the_content .= build_table($content[$layout], $content['options']);
            } else {
                $the_content .= $content[$layout];
            }
        }
        ?>
    <dl>
        <dt>
            <a href="#accordion<?php 
        echo $count;
        ?>
" aria-expanded="false" aria-controls="accordion<?php 
        echo $count;
        ?>
" class="accordion-title accordionTitle js-accordionTrigger"><?php 
        the_sub_field('header');
    $limit = $_GET['limit'];
}
if ($organizations = $pipedrive_api->request('organizations', array('start' => $start, 'limit' => $limit))) {
    echo '<h1>' . count($organizations->data) . ' Results</h1>';
    if ($organizations->additional_data) {
        echo '<p>Showing: ' . ($organizations->additional_data->pagination->start + 1) . ' to ' . ($organizations->additional_data->pagination->start + $organizations->additional_data->pagination->limit) . '. ';
        if ($organizations->additional_data->pagination->more_items_in_collection) {
            echo ' <a href="?s=' . $organizations->additional_data->pagination->next_start . '">Next &gt;&gt;</a>';
        }
        echo '</p>';
    }
    foreach ($organizations->data as $record) {
        echo '<a href="#c' . $record->id . '">' . $record->name . '</a>, ';
    }
    foreach ($organizations->data as $record) {
        echo '<h1 id="c' . $record->id . '">' . $record->name . ' <a href="#">^</a></h1>';
        echo build_table($record);
        if ($persons = $pipedrive_api->request('organizations/' . $record->id . '/persons')) {
            echo '<h3>' . count($persons->data) . ' Persons</h3>';
            foreach ($persons->data as $person) {
                echo '<h4>' . $person->name . ' </h4>';
                echo build_table($person);
            }
        } else {
            echo $pipedrive_api->errors();
        }
        echo '<hr>';
    }
} else {
    echo $pipedrive_api->errors();
}
Example #8
0
session_start();
$pageTitle = "Search";
# Checks if logged in. If NOT logged in, the login button stays the same.
# If IS logged in, the login button changes to logout.
if (isset($_SESSION['loggedin'])) {
    $loggedin = $_SESSION['loggedin'];
}
query_title();
include_once "{$_SERVER['DOCUMENT_ROOT']}/phase5/inc/header.php";
// Body content
?>
<div class="wrap">
    <div class="row">
        <div class="col-md-8">
            <?php 
isset($_GET['refine']) ? build_table(refine_query()) : build_table(query_title());
?>
        </div>
        <div class="col-md-4">
            <h3 class="page-header">Refine your search</h3>
            <form class="form-group" role="search" action="search.php">
                <div style="padding: 5px;">
                    <input type="text" value="<?php 
echo $_GET['title'];
?>
" name="title">
                </div>            
                <label>Streaming Service: </label>
                <div class="checkbox">
                    <label><input type="checkbox" name="netflix">Netflix</label>
                </div>
    exit;
}
if (isset($_GET["requeteur-js"])) {
    requeteur_js();
    exit;
}
if (isset($_GET["query-js"])) {
    build_query_js();
    exit;
}
if (isset($_GET["table1"])) {
    table1();
    exit;
}
if (isset($_GET["build-table"])) {
    build_table();
    exit;
}
function stats_requeteur()
{
    $tpl = new templates();
    $page = CurrentPageName();
}
function requeteur_js()
{
    header("content-type: application/x-javascript");
    $page = CurrentPageName();
    $tpl = new templates();
    $build_the_query = $tpl->javascript_parse_text("{build_the_query}::{members}");
    echo "YahooWin('670','{$page}?requeteur-popup=yes&t={$_GET["t"]}','{$build_the_query}');";
}
function scrapper($url_to_scrape = NULL, $location)
{
    // DATABASE CONNECTION
    $servername = "localhost";
    $username = "******";
    $password = "";
    $database = "rted";
    $conn = new mysqli($servername, $username, $password, $database);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    // Connection Successful
    $building_sql = "SELECT * FROM building where url = '{$url_to_scrape}'";
    $building_result = mysqli_query($conn, $building_sql);
    $building_array = mysqli_fetch_all($building_result);
    $first_building_id = 1;
    // Check when data was last retrieved, based on first building in array
    $last_retrieved_date = false;
    $sql = "SELECT * FROM energy_consumption inner join building on energy_consumption.building_id = building.id where energy_consumption.building_id = '{$first_building_id}' ORDER BY energy_consumption.timestamp DESC\n                 LIMIT 1";
    $result = mysqli_query($conn, $sql);
    if (mysqli_num_rows($result) > 0) {
        // output data of each row
        while ($row = mysqli_fetch_assoc($result)) {
            $last_retrieved_date = $row['timestamp'];
        }
    } else {
        // No Results found
    }
    if ($last_retrieved_date) {
        // switch month and day around for strtotime to work properly
        $array = explode('/', $last_retrieved_date);
        $tmp = $array[0];
        $array[0] = $array[1];
        $array[1] = $tmp;
        unset($tmp);
        $last_retrieved_date = implode('/', $array);
        $last_retrieved_date = str_replace("/", "-", $last_retrieved_date);
        $last_retrieved_date = strtotime(str_replace(".000", "", $last_retrieved_date));
        // Calculate difference in time between now and last retrieve date
        $interval = time() - $last_retrieved_date - 32400;
        //matching the timezone
        if ($interval < 10) {
            // if diff is less than 15 mins, then don't need to run again
            $last_retrieved_date = true;
        } else {
            // if diff is more than 15 mins and need to scrape again
            $last_retrieved_date = false;
        }
    }
    if (!$last_retrieved_date) {
        //open the html
        $url = $url_to_scrape;
        $ch = curl_init($url);
        $header = array();
        $header[] = 'Accept-Encoding: gzip, deflate, sdch';
        $header[] = 'Accept-Language: en-US,en;q=0.8';
        $header[] = 'Upgrade-Insecure-Requests: 1';
        $header[] = 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36';
        $header[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
        $header[] = 'Cache-Control: no-cache';
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
        curl_setopt($ch, CURLOPT_HEADER, true);
        $error_message = null;
        $content = curl_exec($ch);
        //$httpCode =  curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        $dom = new DOMDocument();
        $dom->loadHTML($content);
        // Stores our scraped content
        $data = array();
        $headers = array();
        $table = $dom->getElementById("myTable");
        $rowElements = $table->getElementsByTagName("tr");
        foreach ($rowElements as $rowElement) {
            $class = $rowElement->getAttribute("class");
            // Headers
            if ($class === "body") {
                foreach ($rowElement->getElementsByTagName('th') as $tableHeaderElement) {
                    $headerName = $tableHeaderElement->nodeValue;
                    array_push($headers, $headerName);
                    array_push($data, array());
                }
            } elseif ($class === "dataRow") {
                foreach ($rowElement->getElementsByTagName('td') as $i => $dataElement) {
                    $dataValue = $dataElement->nodeValue;
                    array_push($data[$i], $dataValue);
                }
                break;
            }
        }
        /* $new_time = date_create_from_format('d/M/Y H:i:s', $data[0]);         
           $new_time->getTimestamp();*/
        //var_dump($new_time);die.;
        $data_array = array();
        foreach ($headers as $key => $column_title) {
            $keyvalue = array($column_title => $data[$key]);
            array_push($data_array, $keyvalue);
        }
        /*                echo "<pre>";
                        print_r($building_array);
                        echo "</pre>";
        
                        echo "<pre>";
                        print_r($data_array);
                        echo "</pre>";*/
        foreach ($data_array as $data_entry) {
            if (key($data_entry) == "Timestamp") {
                $timestamp = $data_entry["Timestamp"][0];
                $timestamp = strtotime(str_replace(".000", "", $timestamp));
                $new_timestamp = $timestamp + 3600;
            }
            foreach ($building_array as $building) {
                $building_name = $building[1];
                $key = key($data_entry);
                if (strpos(strtolower($key), strtolower($building_name)) !== false) {
                    $building_id = $building[0];
                    $building_energy = $data_entry[$key][0];
                    $building_energy_float = floatval(preg_replace("/[^-0-9\\.]/", "", $building_energy));
                    $sql = "INSERT INTO energy_consumption (building_id, timestamp, energy)\n                                            VALUES ('{$building_id}', '{$new_timestamp}', '{$building_energy}')";
                    if ($conn->query($sql) === TRUE) {
                        echo "New record created successfully";
                    } else {
                        echo "Error: " . $sql . "<br>" . $conn->error;
                    }
                }
            }
        }
        $conn->close();
        //build_table($new_headers, $new_data);
        build_table($headers, $data);
    }
}
Example #11
0
function include_resort_tools_text()
{
    global $local_stats, $userid;
    //     mysql_grab($userid, 'local', 'stats');
    // Two ways of pulling user stats; 1 is the above (bad) and 1 is with object
    // like below (good). Old resort tools require the above, but we want to
    // change that.
    $objUser =& $GLOBALS['objSrcUser'];
    $arrSrcStats = $objUser->get_stats();
    $local_stats = $arrSrcStats;
    if (!$arrSrcStats['level'] > 0) {
        echo '<div class="center">' . "Sorry, this page is restricted to ORKFiA Staff" . '</div>';
        include_game_down();
        exit;
    }
    $count = 0;
    if (isset($_POST['update_staff_tools'])) {
        // Save new tools and access limits to DB
        foreach ($_POST['new_tools'] as $details) {
            $toolname = substr(stripslashes($details['toolname']), 0, 30);
            $new_name = addslashes(trim(stripslashes($details['new_name'])));
            $req_level = stripslashes($details['req_level']);
            $req_resort = stripslashes($details['req_resort']);
            $sql = "INSERT INTO `staff_tools` SET\n                    toolname    = '{$toolname}',\n                    name_output = '{$new_name}',\n                    req_level   = {$req_level},\n                    req_resort  = {$req_resort}";
            if ($new_name != "Tool Output Name") {
                if (!($result = mysql_query($sql))) {
                    echo '<div class="center">' . "{$count} Resort tool(s) added" . '</div>';
                    die('<div class="center">' . "Could not save record!<br /><b>TOOL: {$toolname}</b>" . '</div>');
                }
                $count++;
            }
        }
        echo '<div class="center">' . "{$count} Resort tool(s) added<br /><br />";
        echo "<a href=\"main.php?cat=game&amp;page=resort_tools\">";
        echo "Back to Control Panel</a>" . '</div>';
    } elseif (isset($_POST['remove_staff_tool'])) {
        $toolname = $_POST['remove_staff_tool'];
        $sql = 'DELETE FROM staff_tools WHERE toolname = \'' . $toolname . '\'';
        if (!($result = mysql_query($sql))) {
            die("Could not remove tool!<br /><b>TOOL: {$toolname}</b>");
        }
        echo "{$toolname} removed from the list.<br /><br />";
        echo "<a href=\"main.php?cat=game&amp;page=resort_tools\">";
        echo "Back to Control Panel</a>";
    } elseif (isset($_GET['tool'])) {
        // Log activity
        include_once 'inc/functions/resort_tools.php';
        $tool = $_GET['tool'];
        log_staff_activity($tool);
        // Show tool
        echo '<div id="textBig">';
        echo "<a href=\"main.php?cat=game&amp;page=resort_tools\">";
        echo "<p>Back to Resort Tools</a></p>";
        include_once "inc/staff/{$tool}.inc.php";
        $function = "call_" . $tool . "_text";
        $function();
        echo "<p><a href=\"main.php?cat=game&amp;page=resort_tools\">";
        echo "Back to Resort Tools</a></p>";
        echo '</div>';
    } else {
        $staffmember = stripslashes($arrSrcStats['name']);
        echo '<div class="center">' . "<b>Welcome {$staffmember} =)</b></div><br />";
        // List all new pages found in /staff/
        if ($arrSrcStats['level'] == 6) {
            // Get all tool file names
            $arrfiles = scan_Dir('inc/staff');
            // Query DB for existing tools
            $query = "SELECT * FROM staff_tools";
            $result = mysql_query($query) or die("Error querying staff_tools!");
            while ($row = mysql_fetch_row($result)) {
                $arrtools[] = $row[0];
            }
            // Add both arrays together and sort out the doubles
            $arrtotal = array_diff($arrfiles, $arrtools);
            $count = count($arrtotal);
            // Display remaining tools as 'new tools found'
            if ($count > 0) {
                ?>
            <form action="main.php?cat=game&amp;page=resort_tools" method="post">
            <input type="hidden" name="update_staff_tools" value="yes">

            <table class="medium" cellpadding="0" cellspacing="0">
            <tr class="header">
                <th colspan="4"><?php 
                echo $count;
                ?>
 New Tools Found!</th>
            </tr>
            <tr class="subheader">
                <th>Tool</th>
                <td>Name</td>
                <td>Resort</td>
                <td>Level</td>
            </tr>

            <?php 
                foreach ($arrtotal as $id => $toolname) {
                    $link = "<a href=\"main.php?cat=game&amp;page=resort_tools";
                    $link .= "&amp;tool={$toolname}\">{$toolname}</a>";
                    ?>

            <tr class="data">
            <th>
                <?php 
                    echo $link;
                    ?>
            </th>

            <td>
                <input type="hidden" name="new_tools[<?php 
                    echo $id;
                    ?>
][toolname]"
                                                     value="<?php 
                    echo $toolname;
                    ?>
">
                <input size="30" name="new_tools[<?php 
                    echo $id;
                    ?>
][new_name]"
                                                   value="Tool Output Name">
            </td>

            <td>
                <Select size=1 name="new_tools[<?php 
                    echo $id;
                    ?>
][req_resort]">
                    <option value=0>All</option>
                    <option value=1>(#1)</option>
                    <option value=2>(#2)</option>
                    <option value=3>(#3)</option>
                    <option value=4>(#4)</option>
                    <option value=5>(#5)</option>
                    <option value=6>(#6)</option>
                    <option value=7>(#7)</option>
                    <option value=8>(#8)</option>
                    <option value=9>(#9)</option>
                    <option value=10>(#10)</option>
                </select>
            </td>

            <td>
                <Select size=1 name="new_tools[<?php 
                    echo $id;
                    ?>
][req_level]">
                    <option value=2>2</option>
                    <option value=3>3</option>
                    <option value=4>4</option>
                    <option value=5>5</option>
                    <option value=6>6</option>
                </select>
            </td>
            </tr>

                <?php 
                }
                ?>
            <tr>
                <td class="center" colspan="4">
                <input type="submit" value="Add Tool(s)">
                </td>
            </tr>
            </table>
            </form>
            <br />
            <?php 
            }
        }
        // List available tools
        echo build_table($arrSrcStats);
    }
}
            case 'sources':
                $newwhy = '';
                while ($unit = $units->fetch_assoc()) {
                    echo '<li><a href="StudyMaster.php?a=pick_unit&unit=' . $unit['unit_id'] . '&why=sources">' . $unit['unit_name'] . '</a></li>';
                }
                break;
            case 'facts':
                $newwhy = '';
                while ($unit = $units->fetch_assoc()) {
                    echo '<li><a href="StudyMaster.php?a=pick_unit&unit=' . $unit['unit_id'] . '&why=facts">' . $unit['unit_name'] . '</a></li>';
                }
                break;
        }
        while ($unit = $units->fetch_assoc()) {
            echo '<li><a href="StudyMaster.php?a=pick_units&why="' . $GLOBALS['why'] . '">' . $unit['unit_name'] . '</a></li>';
        }
        break;
    case 'units':
        echo 'units:<br><br><table><tr><td style="font-weight:bold;">ID</td><td style="font-weight:bold;">unit</td><td style="font-weight:bold;">Enabled</td></tr>
';
        build_table('unit', 'id,name,enabled');
        break;
    case 'units':
        echo 'units:<br><br><table><tr><td style="font-weight:bold;">ID</td><td style="font-weight:bold;">unit</td><td style="font-weight:bold;">unit</td><td style="font-weight:bold;">Enabled</td></tr>
';
        build_table('unit', 'id,name,unit,enabled');
        break;
    default:
        break;
}
echo '</body></html>';
Example #13
0
    // foreach( $array as $key=>$value){
    //     foreach($value as $key2=>$value2){
    //         $html .= '<colgroup>' . $key2 . '</colgroup>';
    //     }
    // }
    $html .= '<tr>';
    // foreach($array as $key=>$value){
    //         $html .= '<th>' . $key . '</th>';
    //     }
    foreach ($array as $key => $value) {
        if ($key == "1") {
            foreach ($value as $key2 => $value2) {
                $html .= '<th>' . $key2 . '</th>';
            }
        }
    }
    $html .= '</tr>';
    // data rows
    foreach ($array as $key => $value) {
        $html .= '<tr>';
        foreach ($value as $key2 => $value2) {
            $html .= '<td>' . $value2 . '</td>';
        }
        $html .= '</tr>';
    }
    // finish table and return it
    $html .= '</table>';
    return $html;
}
echo build_table($ac_decoded);
Example #14
0
print_header_simple($heading_main, '', build_navigation($navigation));
// If they don't have any courses, then tell the user so and die
if (empty($courses)) {
    print_heading(get_string('no_courses', 'block_student_gradeviewer'));
    print_footer();
    die;
}
echo '<fieldset class="aligncenter">
        <legend><strong>Grades Overview for ' . fullname($user) . '</strong></legend>
        <div class="student_courses">
            <span>' . implode(' | ', pull_grades_courses($courses)) . '</span>
        </div>
      </fieldset>';
// If they selected a course, then use that course
$chosen = $courseid ? $courses[$courseid] : current($courses);
build_table($chosen);
print_footer();
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) {
Example #15
0
  <td><input type="reset" value="' . __('reset07') . '">&nbsp;&nbsp;<input type="submit" value="' . __('add07') . '" name="submit"></td>
 </tr>';
if (isset($errors)) {
    echo '<tr>
  <td class="heading">Errors:</td>
  <td>' . implode("<br>", $errors) . '</td>
 </tr>';
}
echo '</table>
   </form>
   <br>
<table cellspacing="1" width="100%" class="mail">
<tr>
  <th class="whitelist">' . __('wl07') . '</th>
  <th class="blacklist">' . __('bl07') . '</th>
</tr>
<tr>
  <td class="blackwhitelist">
    <!-- Whitelist -->';
build_table("SELECT id, from_address, to_address FROM whitelist WHERE " . $_SESSION['global_list'] . " ORDER BY from_address", 'w');
echo '</td>
 <td  class="blackwhitelist">
  <!-- Blacklist -->';
build_table("SELECT id, from_address, to_address FROM blacklist WHERE " . $_SESSION['global_list'] . " ORDER BY from_address", 'b');
echo '</td>
</tr>
</table>';
// Add the footer
html_end();
// close the connection to the Database
dbclose();
for ($a = 0; $a < $noOfStores; $a++) {
    $token = $_SESSION['token'][$a];
    $tokentype = $_SESSION['tokenType'][$a];
    $url = 'https://' . $_SESSION['storename'][$a] . '.vendhq.com';
    echo $url;
    $vend = new VendAPI\VendAPI($url, $tokentype, $token);
    //$vend->debug(true);
    $products = $vend->getProducts();
    $length = count($products);
    $prod_array = array();
    for ($i = 0; $i < $length; $i++) {
        $prod_array[$i]["ID"] = $products[$i]->__get('id');
        $prod_array[$i]["Name"] = $products[$i]->__get('name');
        $prod_array[$i]["sku"] = $products[$i]->__get('sku');
        $prod_array[$i]["Price"] = $products[$i]->__get('price');
        $prod_array[$i]["Stock"] = $products[$i]->getInventory(null);
    }
    //Show the info
    //echo '<pre>',print_r($prod_array,1),'</pre>';
    $_SESSION['list'] = $products;
    $_SESSION['array'][$a] = $prod_array;
    //Show the info in a table
    echo build_table($prod_array, $a) . "<br/>";
}
?>

<a href="https://vend-products.herokuapp.com/new">Add a new product to all stores</a>

</body>
</html>
} catch (Exception $e) {
    echo "<br/>Caught exception: " . $e->getMessage();
}
//build table from PHP array
function build_table($array)
{
    // start table
    $html = '<table>';
    // header row
    $html .= '<tr>';
    foreach ($array[0] as $key => $value) {
        $html .= '<th>' . $key . '</th>';
    }
    $html .= '</tr>';
    // data rows
    foreach ($array as $key => $value) {
        $html .= '<tr>';
        foreach ($value as $key2 => $value2) {
            $value2 = is_array($value2) ? json_encode($value2) : $value2;
            $html .= '<td>' . @$value2 . '</td>';
        }
        $html .= '</tr>';
    }
    // finish table and return it
    $html .= '</table>';
    return $html;
}
//print process list as HTML table
if (isset($plist, $plist['response']) && count($plist['response']) > 0) {
    echo build_table($plist['response']);
}
Example #18
0
    while (0 != socket_recv($socket, $out, 4096, MSG_DONTWAIT)) {
        if ($out != null) {
            $mess .= $out;
        }
    }
    /*$mess .= $next;*/
    socket_close($socket);
    return $mess;
}
function GetLocations($addr, $port)
{
    $in = json_encode(array('cmd' => 'listlocations'));
    $message = sendcmd($in, $addr, $port);
    $obj = json_decode($message);
    $dat = $obj->{'data'};
    return $dat;
}
function GetActions($addr, $port)
{
    $in = json_encode(array('cmd' => 'listactions'));
    $message = sendcmd($in, $addr, $port);
    $obj = json_decode($message);
    $dat = $obj->{'data'};
    return $dat;
}
$NHCLoc = GetLocations($address, $service_port);
$aff = build_table($NHCLoc);
echo $aff . "<br>";
$NHCAct = GetActions($address, $service_port);
$aff = build_table($NHCAct);
echo $aff;
Example #19
0
  
    </head>
    <body>



        <div id="tabel">

            <form action="outputextra.php" method="post" enctype="multipart/form-data">
                <label for="file">Zoek een bestand:</label> <input type="file" name="file" id="file"/>
                <input type="submit" value="Submit">
            </form>

            <?php 
//de tabel laten zien
echo build_table($woordenzoeker);
?>
   
            <div id="zoekwoorden">
                </br>
                <?php 
//het lijstje met zoekwoorden laten zien
sort($zoekwoorden);
foreach ($zoekwoorden as &$zoekwoord) {
    $ZOEKWOORD = ucfirst($zoekwoord);
    echo "<div class={$zoekwoord}>{$ZOEKWOORD}</div>";
}
?>
            </div>
        </div>
    </body>
<?php

require __DIR__ . '/../libs/parse_results.php';
require __DIR__ . '/../libs/build_table.php';
$module = $_SERVER['argv'][1];
if (in_array($module, array_keys($modules))) {
    $results = parse_results(__DIR__ . '/../output/' . $module . '/results.hello_world.log');
    //var_dump($results);
    echo $modules[$module];
    echo "\n";
    echo build_table($results);
    echo "\n";
}
<?php

require __DIR__ . '/../libs/parse_results.php';
require __DIR__ . '/../libs/build_table.php';
require __DIR__ . '/../libs/recalc_relative.php';
$list = ['cake-3.0', 'symfony-2.6', 'zf-2.4'];
system('git checkout master');
$results_master = parse_results(__DIR__ . '/../output/results.hello_world.log');
system('git checkout optimize');
$results_optimize = parse_results(__DIR__ . '/../output/results.hello_world.log');
//var_dump($results_master, $results_optimize);
$is_fisrt = true;
foreach ($list as $fw) {
    $results = [];
    $results[$fw] = $results_master[$fw];
    $results[$fw . ' (*)'] = $results_optimize[$fw];
    $results = recalc_relative($results);
    echo build_table($results, $is_fisrt);
    $is_fisrt = false;
}
Example #22
0
    }
    $html .= '<th>' . 'Actions' . '</th>';
    $html .= '</tr><thead><tbody>';
    // data rows
    foreach ($array as $key => $value) {
        $html .= '<tr>';
        foreach ($value as $key2 => $value2) {
            $html .= '<td>' . getCellData($key2, $value2, $me) . '</td>';
        }
        //        print_r('<pre>');
        //        print_r($value);
        //        print_r('</pre>');
        $html .= '<td>';
        $html .= '<div class="tools">' . '<a href="' . site_url('templates/edit/' . $value['id']) . '" title="Edit" class="fa fa-edit"></a>' . '<a href="' . site_url('templates/delete/' . $value['id']) . '"title="Delete" class="fa fa-trash-o"></a>' . '</div>';
        $html .= '</td>';
        $html .= '</tr>';
    }
    $html .= '</tbody></table>';
    return $html;
}
function getCellData($key, $value, $me)
{
    $imagesFields = $me->{$me->module_name . '_model'}->imagesFields;
    if (isset($imagesFields[$key])) {
        $str = '<img class="thumb-size" src="' . $value . '" />';
        return $str;
    }
    return $value;
}
echo build_table($allData, $this);