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));
    }
}
Пример #2
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));
    }
}