<td><?php 
    echo $table['is_metatable'] == 1 ? Crudderconfig::get_string('yes_label') : Crudderconfig::get_string('no_label');
    ?>
</td>
        <td><?php 
    echo $table['help_text'];
    ?>
</td>
        <td>
        <?php 
    if ($table['with_edit'] == 1) {
        ?>
        <div class="btn-toolbar" role="toolbar">
          <div class="btn-group btn-group-xs">
            <button type="button" onclick="location.href='/crudder/table_show/<?php 
        echo $table['id'];
        ?>
'" class="btn btn-info"><?php 
        echo Crudderconfig::get_string('show_label');
        ?>
</button>
          </div>
        </div>
        <?php 
    }
}
?>
    </table>

    </div>
    <ul class="pagination">
        <li><a href="#" <?php 
echo $pager_prev_action;
?>
 <?php 
echo $pager_is_first_page ? 'class="disabled"' : '';
?>
 >&laquo;</a></li>
        <li class="disabled"><a href="#" ><?php 
echo Crudderconfig::get_string('pager_page_label');
?>
 <?php 
echo $pager_page_number;
?>
 <?php 
echo Crudderconfig::get_string('pager_of_label');
?>
 <?php 
echo $pager_total_pages;
?>
</a></li>
        <li><a href="#" <?php 
echo $pager_next_action;
?>
 <?php 
echo $pager_is_last_page ? 'class="disabled"' : '';
?>
 >&raquo;</a></li>
    </ul>        
    </div>
          </label>
          <div class="col-sm-8">
            <?php 
        echo $html;
        echo $extra_html;
        ?>
          </div>
        </div>
        
        <?php 
    }
}
?>
    
    <!--/table-->
    
    <!-- BUTTONS -->
    <div class="form-group">
      <div class="col-sm-offset-4 col-sm-8">
        <button type="submit" class="btn btn-primary"><?php 
echo $form_action == 'update' ? Crudderconfig::get_string('update_label') : Crudderconfig::get_string('insert_label');
?>
</button>
      </div>
    </div>

    <?php 
echo form_close();
?>
    </div>
Example #4
0
<div>
    
    <div class="alert alert-danger">
        <b><?php 
echo Crudderconfig::get_string('error_abort_session_message');
?>
</b>
    </div>
    
</div>
Example #5
0
<!-- desde aqui el CRUDDER_header -->

<div>

    <div>
        <?php 
echo anchor('crudder/goaway', Crudderconfig::get_string('go_back_main_system_link'));
?>
    </div>

    <h2><?php 
echo Crudderconfig::get_string('tables_administrator_title');
?>
</h2>

    <?php 
$message = $this->session->flashdata('crudder_message');
if ($message != false) {
    echo '<div class="alert alert-success">';
    echo '<b>' . $message . '</b>';
    echo "</div>\n";
}
?>
    
    <!-- hasta aqui el CRUDDER_header -->

Example #6
0
    
    <!-- desde aqui el CRUDDER_footer -->
    
    <p>&nbsp;<br/><?php 
echo Crudderconfig::get_string('credits_text_and_links', false);
?>
</p>

</div>

<!-- hasta aqui el CRUDDER_footer -->

Example #7
0
    /**
     * Deletes a record from the database (hard or soft way)
     * 
     * (CRUD generator method)
     * 
     * "Soft way" means that the record will not be deleted but tagged as "deleted" (useful for auditing); in order to indicate this, the "soft_delete_field" in the table "crudder_tables" must countain the name of the field that will be used to save the tag (INT type or one of its derivatives)
     * 
     * Note that if a field if deleted, it's neccesary that the values of other fields that are UNIQUE-like (either implemented or not using database restrictions) don't collide with new records inserted of updated by system operations that occur after the soft deletion; the way to do this is by defining it in the "soft_delete_uniques_suffix", that have the following syntax: "{field_name}.{suffix}" where 'field_name' is the field whose values are unique and 'suffix' is a string that will be appended to the current value of the field
     * 
     * For example: the setting 'code.DEL' will take the current value of field 'code', as in 'Res123', and modify it by 'Res123.DEL'
     * 
     * More than one field modification can be set by comma-separated rules
     * 
     * Redirects to the table_show method
     *
     * @access	private
     * @param   integer ID of table (according to the "crudder_tables" metatable)
     * @param   integer ID of record
     * @return	void
     */
    public function record_delete($id_table, $id_record)
    {
        // access control
        if ($this->check_access() === false) {
            return false;
        }
        // fetch this table metadata
        $table_md = $this->fetch_table_metadata($id_table);
        if ($table_md === false) {
            Crudderconfig::log(Crudderconfig::LOG_EXCEPTION, "record_delete", "cant access table single record ({$id_table}, {$id_record})");
            $this->crudder_redirect("crudder/table_show/{$id_table}", Crudderconfig::get_string('cant_access_table_single_record'));
            return false;
        }
        $table_name = $table_md['name'];
        $soft_delete_field = $table_md['soft_delete_field'];
        // make the query according to soft or hard delete
        if ($soft_delete_field != '') {
            // free the values of unique fields
            $operations = explode(',', $table_md['soft_delete_uniques_suffix']);
            $updates = array();
            foreach ($operations as $operation) {
                list($field, $suffix) = explode('.', $operation);
                $updates[] = "`{$field}` = CONCAT(`{$field}`, '{$suffix}')";
            }
            $updates_full = implode(', ', $updates);
            if ($updates_full != '') {
                $query = <<<END
                    UPDATE `{$table_name}`
                    SET {$updates_full}
                    WHERE `id` = {$id_record}
END;
                $rs = $this->db->query($query);
            }
            // do the soft delete
            $query = <<<END
                UPDATE `{$table_name}`
                SET `{$soft_delete_field}` = 1
                WHERE `id` = {$id_record};
END;
        } else {
            $query = <<<END
                DELETE FROM `{$table_name}`
                WHERE `id` = {$id_record};
END;
        }
        // executes the query
        $rs = $this->db->query($query);
        if ($this->db->affected_rows() != 1) {
            $this->crudder_redirect("crudder/table_show/{$id_table}", Crudderconfig::get_string('unable_to_delete_record'));
        }
        if ($soft_delete_field != '') {
            Crudderconfig::log(Crudderconfig::LOG_NOTICE, "record_delete", "soft delete complete ({$table_name}, {$id_record})");
        } else {
            Crudderconfig::log(Crudderconfig::LOG_NOTICE, "record_delete", "hard delete complete ({$table_name}, {$id_record})");
        }
        // save session vars for the next POST or GET request (these come from the form content display)
        $this->session->keep_flashdata('crudder_sort_field_name');
        $this->session->keep_flashdata('crudder_sort_order');
        $this->session->keep_flashdata('crudder_pager_page_number');
        // show table content view
        $this->crudder_redirect("crudder/table_show/{$id_table}", Crudderconfig::get_string('record_deleted'));
    }