function getAllWebsiteCategoriesDT()
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $content = '<thead>';
        $content .= '<tr>';
        $content .= '<th>Id</th>';
        $content .= '<th>Category</th>';
        $content .= '<th>Website</th>';
        $content .= '<th>Website Category</th>';
        $content .= '<th>Url</th>';
        $content .= '<th>Use Url</th>';
        $content .= '<th>Url Pagination</th>';
        $content .= '<th>Use Pagination</th>';
        $content .= '<th>Action</th>';
        $content .= '</tr>';
        $content .= '</thead>';
        $content .= '<tbody>';
        $objWebsiteCategory = new WebsiteCategory($bdd, $_TABLES);
        $items = $objWebsiteCategory->getAllWebsiteCategories();
        if ($items) {
            foreach ($items as $key => $item) {
                $content .= '<tr website_category_id=' . $item->id . '>';
                $content .= '<td>' . $item->id . '</td>';
                $content .= '<td><select class="select_dt select_dt_category_id">';
                $objCategory = new Category($bdd, $_TABLES);
                $categories_items = $objCategory->getAllCategories();
                if ($categories_items) {
                    foreach ($categories_items as $key_c => $category_item) {
                        $temp_content = '';
                        $temp_content .= '<option value="' . $category_item->id . '" ';
                        if ($category_item->id == $item->category_id) {
                            $temp_content .= 'selected>';
                        } else {
                            $temp_content .= '>';
                        }
                        $temp_content .= $category_item->category . '</option>';
                        $content .= $temp_content;
                    }
                }
                $content .= '</select></td>';
                $content .= '<td><select class="select_dt select_dt_website_id">';
                $objWebsite = new Website($bdd, $_TABLES);
                $websites_items = $objWebsite->getAllWebsites();
                if ($websites_items) {
                    foreach ($websites_items as $key_w => $website_item) {
                        $temp_content = '';
                        $temp_content .= '<option value="' . $website_item->id . '" ';
                        if ($website_item->id == $item->website_id) {
                            $temp_content .= 'selected>';
                        } else {
                            $temp_content .= '>';
                        }
                        $temp_content .= $website_item->website . '</option>';
                        $content .= $temp_content;
                    }
                }
                $content .= '</select></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_website_category" value="' . $item->category . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_url" value="' . $item->url . '" /></td>';
                $content .= '<td><input type="checkbox" class="input_dt input_dt_use_url" value="' . $item->use_url . '"></input></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_url_pagination" value="' . $item->url_pagination . '" /></td>';
                $content .= '<td><input type="checkbox" class="input_dt input_dt_use_pagination" value="' . $item->use_pagination . '"></input></td>';
                $content .= "<td><input type='button' class='edit edit_website_category_dt' value='Save' />\n\t\t\t\t    <input type='button' class='delete delete_website_category_dt' value='Supprimer' /></td>";
                $content .= '</tr>';
            }
        }
        $content .= '</tbody>';
        return $content;
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
Esempio n. 2
0
include_once $_SERVER['DOCUMENT_ROOT'] . "/engine.php";
if (!isset($_GET['web-id']) && !isset($_GET['start-id'])) {
    echo "Nothing given :(";
    exit;
}
if (isset($_GET['web-id'])) {
    function echoSite(Website $site)
    {
        echo $site->getName() . ":\r\n";
        echo $site->update() . "\r\n";
    }
    $webId = $_GET['web-id'];
    if ($webId == "-1") {
        // Update all
        foreach (Website::getAllWebsites() as $site) {
            echoSite($site);
        }
    } else {
        // Update single site
        QueryBuilder::create(SQL::getConnection())->withQuery("SELECT display_name, folder_name FROM websites WHERE id = ?")->withParam($webId, QueryBuilder::PARAM_TYPE_INT)->build()->forEachResult(function ($row) {
            $site = new Website(0, $row['display_name'], $row['folder_name']);
            echoSite($site);
        });
    }
} else {
    function echoStart(Startables $starter)
    {
        echo $starter->getName() . ":\r\n";
        echo $starter->start() . "\r\n";
    }
Esempio n. 3
0
<?php

if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
require_once dirname(dirname(__FILE__)) . "/common/php/class/class.website.php";
global $bdd;
global $_TABLES;
$content = "";
$view = new Template(dirname(__FILE__) . '/html/website.html');
if (!is_null($bdd) && !is_null($_TABLES)) {
    $objWebsite = new Website($bdd, $_TABLES);
    $websites = $objWebsite->getAllWebsites();
    if (!is_null($websites)) {
        foreach ($websites as $key => $value) {
            if (isset($_COOKIE['media_preference'])) {
                $website_preference = json_decode(stripcslashes($_COOKIE['media_preference']), true);
                if (!is_null($website_preference) && !empty($website_preference)) {
                    $checked = in_array($value->id, $website_preference) == true ? 'checked="true"' : '';
                } else {
                    $checked = '';
                }
            } else {
                $checked = 'checked="true"';
            }
            $content .= $view->getView(array("website_id" => $value->id, "website_name" => mb_strtoupper($value->website, 'UTF-8'), "checked" => $checked));
        }
        echo $content;
    } else {
        // 404
        echo "404 Not Found";
function getAllWebsiteSubscriptionsDT()
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $content = '<thead>';
        $content .= '<tr>';
        $content .= '<th>Id</th>';
        $content .= '<th>User</th>';
        $content .= '<th>Website</th>';
        $content .= '<th>Action</th>';
        $content .= '</tr>';
        $content .= '</thead>';
        $content .= '<tbody>';
        $objWebsiteSubscription = new WebsiteSubscription($bdd, $_TABLES);
        $website_subscriptions = $objWebsiteSubscription->getAllWebsiteSubscriptions();
        if ($website_subscriptions) {
            foreach ($website_subscriptions as $key => $website_subscription) {
                $content .= '<tr website_subscription_id=' . $website_subscription->id . '>';
                $content .= '<td>' . $website_subscription->id . '</td>';
                $content .= '<td><select class="select_dt select_dt_user_id">';
                $objUser = new User($bdd, $_TABLES);
                $users_items = $objUser->getAllUsers();
                if ($users_items) {
                    foreach ($users_items as $key_u => $user_item) {
                        $temp_content = '';
                        $temp_content .= '<option value="' . $user_item->id . '" ';
                        if ($user_item->id == $website_subscription->user_id) {
                            $temp_content .= 'selected>';
                        } else {
                            $temp_content .= '>';
                        }
                        $temp_content .= $user_item->name . '</option>';
                        $content .= $temp_content;
                    }
                }
                $content .= '</select></td>';
                $content .= '<td><select class="select_dt select_dt_website_id">';
                $objWebsite = new Website($bdd, $_TABLES);
                $websites_items = $objWebsite->getAllWebsites();
                if ($websites_items) {
                    foreach ($websites_items as $key_w => $website_item) {
                        $temp_content = '';
                        $temp_content .= '<option value="' . $website_item->id . '" ';
                        if ($website_item->id == $website_subscription->website_id) {
                            $temp_content .= 'selected>';
                        } else {
                            $temp_content .= '>';
                        }
                        $temp_content .= $website_item->website . '</option>';
                        $content .= $temp_content;
                    }
                }
                $content .= '</select></td>';
                $content .= "<td><input type='button' class='edit edit_website_subscription_dt' value='Save' />\n\t\t\t\t    <input type='button' class='delete delete_website_subscription_dt' value='Supprimer' /></td>";
                $content .= '</tr>';
            }
        }
        $content .= '</tbody>';
        return $content;
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
Esempio n. 5
0
function getAllWebsitesDT()
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $content = '<thead>';
        $content .= '<tr>';
        $content .= '<th>Id</th>';
        $content .= '<th>Website</th>';
        $content .= '<th>Url</th>';
        $content .= '<th>Logo</th>';
        $content .= '<th>File</th>';
        $content .= '<th>Scrap</th>';
        $content .= '<th>Action</th>';
        $content .= '</tr>';
        $content .= '</thead>';
        $content .= '<tbody>';
        $objWebsite = new Website($bdd, $_TABLES);
        $items = $objWebsite->getAllWebsites();
        if ($items) {
            foreach ($items as $key => $item) {
                $content .= '<tr websiteId=' . $item->id . '>';
                $content .= '<td>' . $item->id . '</td>';
                $content .= '<td><input type="text" class="input_dt input_dt_website" value="' . $item->website . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_url" value="' . $item->url . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_logo" value="' . $item->logo . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_file" value="' . $item->file . '" /></td>';
                $content .= '<td><input type="checkbox" class="input_dt input_dt_scrap" value="' . $item->scrap . '"></input></td>';
                $content .= "<td><input type='button' class='edit edit_website_dt' value='Save' />\n\t\t\t\t    <input type='button' class='delete delete_website_dt' value='Supprimer' /></td>";
                $content .= '</tr>';
            }
        }
        $content .= '</tbody>';
        return $content;
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}