Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $query_header_by_cat = $this->db->query("SELECT id, coloane FROM categories WHERE id='".$categorie."'");
- $numrows_query_header_by_cat = $query_header_by_cat->num_rows();
- $results_query_header_by_cat = $query_header_by_cat->result_array();
- foreach ($results_query_header_by_cat as $header_td) {
- $cols_th = $header_td['coloane'];
- $rows_th = explode(',', $cols_th);
- }
- $query_content_by_cat = $this->db->query("SELECT id, id_categorie, $cols_th, status
- FROM articles
- WHERE CONCAT($rows_th[0], ' ', $rows_th[1])
- LIKE '%$keyword%'
- AND id_categorie='$categorie'
- ");
- $numrows_query_content_by_cat = $query_content_by_cat->num_rows();
- $results_query_content_by_cat = $query_content_by_cat->result_array();
- if ($numrows_query_content_by_cat > 0) {
- echo '
- <table class="table table-bordered">
- <thead>
- <tr>';
- foreach($rows_th as $values_th) {
- echo '<th>'.strtoupper(str_replace('_', ' ', $values_th)).'</th>';
- }
- print '<th>STATUS</th>';
- if ($access <= 3) {
- print '<th>ACTION</th>';
- }
- echo '
- </tr>
- </thead>
- <tbody>';
- foreach($results_query_content_by_cat as $values_td) {
- echo '<tr id="'.$values_td['id'].'">';
- for($i=0; $i < count($rows_th); $i++) {
- //print '<td id="'.$i.'">'.$values_td[''.$rows_th[$i].''].'</td>';
- //print '<td id="'.$i.'">integer: '.$i.' <br /> result: '.$rows_th[$i].'</td>';
- ///*
- if (is_string($values_td[''.$rows_th[$i].''])) {
- print '<td id="'.$i.'">Value found!!!</td>';
- } else {
- print '<td id="'.$i.'">No luck...</td>';
- }
- //*/
- }
- echo '<td>'.$values_td['status'].'</td>';
- if ($access <= 3) {
- switch ($values_td['status']) {
- default:
- print '<td>Eroare</td>\n';
- break;
- case 'assign':
- print '
- <td align="center">
- <a href="'.$this->config->item('base_url').'/action/info/'.$values_td['id'].'" class="btn btn-sm btn-info">Info</a>
- <a href="'.$this->config->item('base_url').'/action/take/'.$values_td['id'].'" class="btn btn-sm btn-danger">Preia</a>
- </td>';
- break;
- case 'available':
- print '
- <td align="center">
- <a href="'.$this->config->item('base_url').'/action/assign/'.$values_td['id'].'" class="btn btn-sm btn-success">Aloca</a>
- </td>';
- break;
- }
- }
- echo '</tr>';
- }
- echo '
- </tbody>
- </table>';
- } else {
- echo '<div class="alert alert-danger">Nu am gasit <b>'.$keyword.'</b> in categoria selectata!</div>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement