function getAllCollaborationsDT() { global $bdd, $_TABLES; if (!is_null($bdd) && !is_null($_TABLES)) { $content = '<thead>'; $content .= '<tr>'; $content .= '<th>Id</th>'; $content .= '<th>Collaboration</th>'; $content .= '<th>Url</th>'; $content .= '<th>Image</th>'; $content .= '<th>Action</th>'; $content .= '</tr>'; $content .= '</thead>'; $content .= '<tbody>'; $objCollaboration = new Collaboration($bdd, $_TABLES); $items = $objCollaboration->getAllCollaborations(); if ($items) { foreach ($items as $key => $item) { $content .= '<tr collaboration_id=' . $item->id . '>'; $content .= '<td>' . $item->id . '</td>'; $content .= '<td><input type="text" class="input_dt input_dt_collaboration" value="' . $item->collaboration . '" /></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_image" value="' . $item->image . '" /></td>'; $content .= "<td><input type='button' class='edit edit_collaboration_dt' value='Save' />\n\t\t\t\t <input type='button' class='delete delete_collaboration_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)); } }
<?php if (session_status() == PHP_SESSION_NONE) { session_start(); } require_once dirname(dirname(__FILE__)) . "/common/php/class/class.collaboration.php"; global $bdd; global $_TABLES; $content = ""; if (!is_null($bdd) && !is_null($_TABLES)) { $objCollaboration = new Collaboration($bdd, $_TABLES); $collaborations = $objCollaboration->getAllCollaborations(); if ($collaborations) { $view = new Template(dirname(__FILE__) . '/html/collaboration.html'); foreach ($collaborations as $key => $value) { $content .= $view->getView(array("title" => $value->collaboration, "url" => $value->url, "image" => $value->image)); } echo $content; } else { // 404 echo "404 Not Found"; } } else { error_log("BDD ERROR : " . json_encode($bdd)); error_log("TABLES ERROR : " . json_encode($_TABLES)); }