Beispiel #1
0
function getAllItemsDT()
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $content = '<thead>';
        $content .= '<tr>';
        $content .= '<th>Id</th>';
        $content .= '<th>Type Item</th>';
        $content .= '<th>Website Category</th>';
        $content .= '<th>Guid</th>';
        $content .= '<th>Url</th>';
        $content .= '<th>Title</th>';
        $content .= '<th>Width Image</th>';
        $content .= '<th>Height Image</th>';
        $content .= '<th>Image</th>';
        $content .= '<th>Alt Image</th>';
        $content .= '<th>Description</th>';
        $content .= '<th>Date Publication</th>';
        $content .= '<th>Author</th>';
        $content .= '<th>Action</th>';
        $content .= '</tr>';
        $content .= '</thead>';
        $content .= '<tbody>';
        $objItem = new Item($bdd, $_TABLES);
        $items = $objItem->getAllItems();
        if ($items) {
            foreach ($items as $key => $item) {
                $content .= '<tr item_id=' . $item->id . '>';
                $content .= '<td>' . $item->id . '</td>';
                $content .= '<td><select class="select_dt select_dt_type_item_id">';
                $objTypeItem = new TypeItem($bdd, $_TABLES);
                $types_items = $objTypeItem->getAllTypeItems();
                if ($types_items) {
                    foreach ($types_items as $key_ti => $type_item) {
                        $temp_content = '';
                        $temp_content .= '<option value="' . $type_item->id . '" ';
                        if ($type_item->id == $item->type_item_id) {
                            $temp_content .= 'selected>';
                        } else {
                            $temp_content .= '>';
                        }
                        $temp_content .= $type_item->type . '</option>';
                        $content .= $temp_content;
                    }
                }
                $content .= '</select></td>';
                $content .= '<td><select class="select_dt select_dt_website_category_id">';
                $objWebsiteCategory = new WebsiteCategory($bdd, $_TABLES);
                $websites_categories = $objWebsiteCategory->getAllWebsiteCategories();
                if ($websites_categories) {
                    foreach ($websites_categories as $key_wc => $website_category) {
                        $temp_content = '';
                        $temp_content .= '<option value="' . $website_category->id . '" ';
                        if ($website_category->id == $item->website_category_id) {
                            $temp_content .= 'selected>';
                        } else {
                            $temp_content .= '>';
                        }
                        $temp_content .= $website_category->category . '</option>';
                        $content .= $temp_content;
                    }
                }
                $content .= '</select></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_guid" value="' . $item->guid . '" /></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_title" value="' . $item->title . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_width_image" value="' . $item->width_image . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_height_image" value="' . $item->height_image . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_image" value="' . $item->image . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_alt_image" value="' . $item->alt_image . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_description" value="' . $item->description . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_date_publication" value="' . $item->date_publication . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_author" value="' . $item->author . '" /></td>';
                $content .= "<td><input type='button' class='edit edit_item_dt' value='Save' />\n\t\t\t\t    <input type='button' class='delete delete_item_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));
    }
}
function createWebsiteCategory($category_id, $website_id, $category, $url, $use_url, $url_pagination, $use_pagination)
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $objWebsiteCategory = new WebsiteCategory($bdd, $_TABLES);
        $objWebsiteCategory->createWebsiteCategory($category_id, $website_id, $category, $url, $use_url, $url_pagination, $use_pagination);
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
Beispiel #3
0
$username = '******';
$password = '******';
$bdd = getConnection();
$_TABLES = null;
if (!is_null($bdd)) {
    $_TABLES = getStructure();
} else {
    echo "Connection BDD Error \n";
}
if (!is_null($bdd) && !is_null($_TABLES)) {
    set_time_limit(0);
    $website = new Website($bdd, $_TABLES);
    $websites = $website->getWebsites();
    if (!is_null($websites)) {
        foreach ($websites as $key_website => $value_website) {
            $website_category = new WebsiteCategory($bdd, $_TABLES);
            $website_categories = $website_category->getWebsiteCategories($value_website->id);
            $url = $value_website->url;
            $file = $value_website->file;
            // Try to load json config
            $config = null;
            $json = file_get_contents(dirname(dirname(dirname(__FILE__))) . '/' . $file);
            if ($json !== false) {
                // if Valid Config
                $config = json_decode($json);
            } else {
                // Invalid Config
                echo "Website File Not Found \n";
            }
            if (!is_null($website_categories)) {
                foreach ($website_categories as $key_website_category => $value_website_category) {