Example #1
0
    {
        return $this->faveGame;
    }
    public function getGroup()
    {
        return $this->group;
    }
}
//Now Let's create some messing with stuff.
$group_admin = new ClassGroup('Admin');
$group_user = new ClassGroup('User');
$listUsers = new ArrayList('ClassUser');
//Users
$user1 = new ClassUser('Dominic', 'YouWish', 'NotActuallyMyPassword', 'Gurumin', $group_admin);
$listUsers->add($user1);
$user2 = new ClassUser('The', 'RestOfThis', 'CanBeJust', 'Garbage', $group_admin);
$listUsers->add($user2);
//For the sake of testing let's add some fake values
for ($i = 0; $i < 50; $i++) {
    $user = new ClassUser(rand(0, 100), rand(0, 10), md5(rand(0, 100)), rand(0, 10), $group_user);
    $listUsers->add($user);
}
//Now, let's make our table matrix
$table_matrix = new ArrayList();
$table_matrix->add(array("name" => "Name", "method" => "getName"));
$table_matrix->add(array("name" => "Username", "method" => "getUsername"));
$table_matrix->add(array("name" => "Favourite Game", "method" => "getFavouriteGame"));
$table_matrix->add(array("name" => "Group", "method" => array("getGroup", "getName")));
//Now generate our HTML
echo generateTable($listUsers, $table_matrix, "some-class");
//Yep, that simple.
switch ($_POST['site']) {
    case 'ebay':
        // get eBay data
        error_log(date('d/m/Y H:i:s') . " - Ebay API start\r\n", 3, 'error_log.txt');
        $requestor = new EbayRequestor($keyword);
        $requestor->runRequest();
        $ebayData = $requestor->extractNecessaryData();
        echo generateTable($ebayData, 'ebay');
        break;
    case 'amazon':
        // get Amazon data
        error_log(date('d/m/Y H:i:s') . " - Amazon API start\r\n", 3, 'error_log.txt');
        $requestor = new AmazonRequestor($keyword);
        $requestor->runRequest();
        $amazonData = $requestor->extractNecessaryData();
        echo generateTable($amazonData, 'amazon');
        break;
    case 'start':
        echo "<table class='table table-striped table-bordered'>\r\n\t\t\t\t<thead>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>From</th>\r\n\t\t\t\t\t\t<th>Picture</th>\r\n\t\t\t\t\t\t<th>Title</th>\r\n\t\t\t\t\t\t<th>Price</th>\r\n\t\t\t\t\t\t<th>Feedback</th>\r\n\t\t\t\t\t\t<th>Shipping Cost</th>\r\n\t\t\t\t\t\t<th>URL</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</thead>\r\n\t\t\t\t<tbody>";
        break;
    case 'end':
        echo "\t</tbody>\r\n\t\t\t</table>";
        break;
    case 'details':
        $store = $_POST['store'];
        $id = $_POST['id'];
        if ($store == 'ebay') {
            echo EbayRequestor::getItemDetailsURL($_POST['id']);
        } elseif ($store == 'amazon') {
            echo AmazonRequestor::getItemDetailsURL($_POST['id']);
        }
\t\t\t\tThe number of complaints relating to the issues of this financial product are
\t\t\t\tsummarized in the table below. Data representing the most recent 10,000 complaints
\t\t\t\tsubmitted to CFPB.
\t\t\t\t</p></blockquote>
\t\t\t\t<p>&nbsp;</p>
\t\t\t\t
\t\t\t\t<table>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<th>Issues</th>
\t\t\t\t\t\t<th>Number of Complaints</th>
\t\t\t\t\t</tr>

EOF;
echo $html;
$strsql = "call countIssues('Debt collection')";
generateTable($strsql);
$html = <<<EOF
\t\t\t<p>&nbsp;</p>
\t\t\t<h5>Export Data</h5>
\t\t\t
\t\t\t\t<a href="debtCollectionXMLexport.php" class="button">EXCEL</a>
\t\t\t\t<a href="#" class="button button-reversed">PDF</a>
\t\t\t\t
\t\t\t<p>&nbsp;</p>
EOF;
echo $html;
$html = <<<EOF
\t\t\t<p>&nbsp;</p>
\t\t\t<footer class="clear">
\t\t\t\t<p>&copy; CSCI1000 Database System Course Project by Dan Meng, Weijia Sun, Yao Jin, Rui Sun.
\t\t\t\t<a href="http://zypopwebtemplates.com/">Free CSS Templates</a> by ZyPOP</p>
*/
define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'HTML');
define('XAJAX_HTML_CONTROL_DOCTYPE_VERSION', '4.01');
define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL');
$sBaseFolder = dirname(dirname(dirname(__FILE__)));
$sCoreFolder = '/xajax_core';
$sCtrlFolder = '/xajax_controls';
include $sBaseFolder . $sCoreFolder . '/xajax.inc.php';
$xajax = new xajax();
$xajax->configure('javascript URI', '../../');
include $sBaseFolder . $sCtrlFolder . '/validate_HTML401TRANSITIONAL.inc.php';
include $sBaseFolder . $sCoreFolder . '/xajaxControl.inc.php';
foreach (array('/document.inc.php', '/structure.inc.php', '/content.inc.php', '/form.inc.php', '/group.inc.php', '/misc.inc.php') as $sFile) {
    include $sBaseFolder . $sCtrlFolder . $sFile;
}
$objDocument = new clsDocument(array('children' => array(new clsDoctype(), new clsHtml(array('children' => array(new clsHead(array('xajax' => $xajax, 'children' => array(generateTitle(), generateStyle(), generateScript(), generateMeta(), generateLink(), generateBase()))), new clsBody(array('children' => array(generateOrderedList(), generateUnorderedList(), generateDefinitionList(), generateTable(), generateForm(), generateContent(), generateValidation(), generateIframe())))))))));
function generateTitle()
{
    return new clsTitle(array('child' => new clsLiteral('Title')));
}
function generateStyle()
{
    return new clsStyle(array('attributes' => array('type' => 'text/css'), 'child' => new clsLiteral('styleOne { background: #ffdddd; }')));
}
function generateScript()
{
    return new clsScript(array('attributes' => array('type' => 'text/javascript'), 'child' => new clsLiteral('javascriptFunction = function(a, b) { alert(a*b); };')));
}
function generateMeta()
{
    return new clsMeta(array('attributes' => array('name' => 'keywords', 'lang' => 'en-us', 'content' => 'xajax, javascript, php, ajax')));
Example #5
0
/**
 * 
 *@param count from getting data and convert array 
 * 
 */
function counting()
{
    $data = getData();
    //print_r($data[0]);
    $array = (array) $data;
    for ($i = 0; $i < count($data); $i++) {
        $array = (array) $data[$i];
        generateTable($array);
        echo "<br>";
    }
}
<?php

generateTable('Gosho', '0882-321-423', 24, 'Hadji Dimitar');
echo '<br/>';
echo '<br/>';
echo '<br/>';
generateTable('Pesho', '0884-888-888', 267, 'Suhata Reka');
function generateTable($name, $phoneNum, $age, $address)
{
    echo "\n    <style>\n        table {\n            border-collapse: collapse;\n        }\n        td {\n            border: 1px solid black;\n            width: 120px;\n            padding: 2px 5px;\n        }\n        td:first-child {\n            font-weight: bold;\n            background-color: #FFA500;\n        }\n        td:last-child {\n            text-align: right;\n        }\n    </style>\n\n    <table>\n        <tbody>\n            <tr>\n                <td>Name</td>\n                <td>{$name}</td>\n            </tr>\n            <tr>\n                <td>Phone number</td>\n                <td>{$phoneNum}</td>\n            </tr>\n            <tr>\n                <td>Age</td>\n                <td>{$age}</td>\n            </tr>\n            <tr>\n                <td>Address</td>\n                <td>{$address}</td>\n            </tr>\n        </tbody>\n    </table>";
}
*/
define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'XHTML');
define('XAJAX_HMTL_CONTROL_DOCTYPE_VERSION', '1.0');
define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL');
$sBaseFolder = dirname(dirname(dirname(__FILE__)));
$sCoreFolder = '/xajax_core';
$sCtrlFolder = '/xajax_controls';
include $sBaseFolder . $sCoreFolder . '/xajax.inc.php';
$xajax = new xajax();
$xajax->configure('javascript URI', '../../');
include $sBaseFolder . $sCtrlFolder . '/validate_XHTML10TRANSITIONAL.inc.php';
include $sBaseFolder . $sCoreFolder . '/xajaxControl.inc.php';
foreach (array('/document.inc.php', '/structure.inc.php', '/content.inc.php', '/form.inc.php', '/group.inc.php', '/misc.inc.php') as $sFile) {
    include $sBaseFolder . $sCtrlFolder . $sFile;
}
$objDocument = new clsDocument(array('children' => array(new clsDoctype(), new clsHtml(array('attributes' => array('xmlns' => 'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en', 'lang' => 'en'), 'children' => array(new clsHead(array('xajax' => $xajax, 'children' => array(generateTitle(), generateStyle(), generateScript(), generateMeta(), generateLink(), generateBase()))), new clsBody(array('children' => array(generateOrderedList(), generateUnorderedList(), generateDefinitionList(), generateTable(), generateForm(), generateContent(), generateValidation(), generateIframe())))))))));
function generateTitle()
{
    return new clsTitle(array('child' => new clsLiteral('Title')));
}
function generateStyle()
{
    return new clsStyle(array('attributes' => array('type' => 'text/css'), 'child' => new clsLiteral('styleOne { background: #ffdddd; }')));
}
function generateScript()
{
    return new clsScript(array('attributes' => array('type' => 'text/javascript'), 'child' => new clsLiteral('javascriptFunction = function(a, b) { alert(a*b); };')));
}
function generateMeta()
{
    return new clsMeta(array('attributes' => array('name' => 'keywords', 'lang' => 'en-us', 'content' => 'xajax, javascript, php, ajax')));
Example #8
0
        include "../FORMS/usermodal.html";
    }
    //saves the edited values that were submitted from user update modal
    if ($_POST['change'] === "edit") {
        $email = $_POST['email'];
        $fname = $_POST['firstname'];
        $lname = $_POST['lastname'];
        $userid = $_POST['primarykey'];
        $accountlocked = $_POST['accountlocked'];
        $loginattempts = $_POST['loginattempts'];
        $sqlupdate = "UPDATE {$table} SET FirstName='{$fname}', LastName = '{$lname}', Email = '{$email}', AccountLocked = {$accountlocked}, LoginAttempts = {$loginattempts} WHERE {$PK}= '{$userid}'";
        query($conn, $sqlupdate);
    }
    //adds a comment to a request
    if ($_POST['change'] === 'editrequest') {
        $comment = $_POST['comment'];
        $requestid = $_POST['primarykey'];
        $sqlupdate = "UPDATE {$table} SET Comment = '{$comment}' WHERE {$PK}={$requestid}";
        query($conn, $sqlupdate);
    }
    //simply generates the table for the admin page. Works for both the requests and users table
    if ($_POST['change'] === 'none') {
        $sqlData = "SELECT * FROM {$table}";
        $sqlTitles = "SHOW COLUMNS FROM {$table}";
        $rsData = getTableData($conn, $sqlData);
        $rsTitles = getTableData($conn, $sqlTitles);
        $arrayData = getResultSet($rsData);
        $arrayTitles = getResultSet($rsTitles);
        generateTable($table, $PK, $arrayTitles, $arrayData);
    }
}
Example #9
0
  <h1>This friendly php will help you!</h1>
  <p><?php 
echo "Hello Mond!";
?>
</p>
  <?php 
$sub = 1;
$lay = "category";
if ($_GET['lay'] != null) {
    $lay = $_GET['lay'];
    $sub = 1;
}
if ($_GET['sub'] != null) {
    $sub = $_GET['sub'];
}
generateTable($sub, $lay);
function generateTable($which, $layer)
{
    $con = mysqli_connect("127.9.180.130:3306", "adminbNNmtdG", "fkBtFscRAGRI", "mysql");
    $getTable = "SELECT * FROM listino";
    if (mysqli_connect_errno()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
    // Check connection
    if (mysqli_connect_errno()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
    $layersSucc = array("category" => "section", "section" => "product");
    $layersPrev = array("category" => 1, "section" => "category", "product" => "section");
    $query = 'SELECT DISTINCT ' . $layer . ' FROM listino WHERE ' . $layersPrev($layer) . " = " . $which;
    echo $query;