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)); } }