<ul class="pagination"> <li><a href="#" <?php echo $pager_prev_action; ?> <?php echo $pager_is_first_page ? 'class="disabled"' : ''; ?> >«</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"' : ''; ?> >»</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>
<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>
<div> <div class="alert alert-danger"> <b><?php echo Crudderconfig::get_string('error_abort_session_message'); ?> </b> </div> </div>
/** * Class static initializer * * Includes localization info * * @access public * @return void */ static function init() { // default values when inserting a new record in a table // self::$default_type_values = array('INT' => 0, 'STRING' => '', 'TEXT' => '', 'DATE' => '2000-01-01', 'DATETIME' => '2000-01-01 00:00:00', 'TIMESTAMP' => '2000-01-01'); // small components for generating HTML snippets for EDITABLE BOOTSTRAPPED views // RAW pages set have strings hardcoded; see the views in order to modify the strings // // initializers for: language = ES // self::$strings['ES'] = array('system_tables_title' => 'Tablas del sistema', 'select_operation_tables_subtitle' => 'Seleccione una operación sobre una tabla.', 'tables_administrator_title' => 'Administrador de tablas', 'table_text_title_part' => 'Tabla:', 'read_only_table_subtitle' => 'Esta tabla es de sólo lectura. Use los cuadros de texto de la segunda fila y los botones <i>Filtrar</i> y <i>Borrar</i> para aplicar y deshacer filtros sobre los registros.', 'editable_table_subtitle' => 'Seleccione una operación sobre un registro. Use los cuadros de texto de la segunda fila y los botones <i>Filtrar</i> y <i>Borrar</i> para aplicar y deshacer filtros sobre los registros. El botón <i>Nuevo</i> le permite insertar un nuevo registro.', 'edit_register_title_part' => 'registro en tabla:', 'edit_register_subtitle' => 'Llene los campos del formulario. Si alguno de los campos contiene un error de formato o de valor, aparecerá un mensaje explicativo.', 'security_alert' => 'Alerta de seguridad', 'delete_record_question' => '¿Continuar con la eliminación del registro?', 'error_abort_session_message' => 'Error: o ha pasado demasiado tiempo sin interactuar con el sistema, o los privilegios son insuficientes para acceder a la administración del sistema.', 'go_back_main_system_link' => 'Regresar a las operaciones principales del sistema', 'go_back_tables_list_link' => 'Regresar al listado de tablas', 'go_back_table_content_link' => 'Regresar al contenido de la tabla', 'go_back_register_insert_link' => 'Regresar a insertar el registro', 'go_back_register_update_link' => 'Regresar a actualizar el registro', 'table_id_descriptor' => 'ID de la tabla. Debe ser único dentro de las metatablas', 'table_displayname_descriptor' => 'Nombre de la tabla', 'table_metatable_descriptor' => 'Indica si la tabla contiene metadatos, es decir, datos que sirven para describir a las otras tablas', 'table_helptext_descriptor' => 'Descripción del propósito de la tabla', 'yes_label' => 'Sí', 'no_label' => 'No', 'id_label' => 'ID', 'displayname_label' => 'Nombre', 'metatable_label' => '¿Metatabla?', 'helptext_label' => 'Descripción', 'operations_label' => 'Operaciones', 'operations_label_help' => 'En esta columna se puede elegir entre crear un nuevo registro, o actualizar o borrar un registro existente', 'show_label' => 'Mostrar', 'filters_label' => 'Filtros', 'filter_label' => 'Filtrar', 'new_label' => 'Nuevo', 'erase_label' => 'Borrar', 'insert_label' => 'Insertar', 'update_label' => 'Actualizar', 'delete_label' => 'Eliminar', 'pager_page_label' => 'Página', 'pager_of_label' => 'de', 'credits_text_and_links' => 'Desarrollado con <a href="http://codeigniter.com" target="_blank">CodeIgniter</a> y <a href="http://getbootstrap.com/" target="_blank">Bootstrap</a>. Iconos de <a href="http://glyphicons.com/" target="_blank">GlyphIcons</a>. Crudder por <a href="http://desarrolladores.logicos.org/gorka/" target="_blank">Gorka G LLona</a>.', 'record_updated' => 'El registro fue actualizado', 'record_inserted' => 'El registro fue insertado', 'record_deleted' => 'El registro fue eliminado', 'unable_to_insert_record' => 'El registro no pudo ser insertado', 'unable_to_delete_record' => 'El registro no pudo ser eliminado', 'cant_edit_metatable' => 'No está permitido editar una metatabla', 'cant_modify_metatables' => 'No está permitido alterar registros en una metatabla', 'cant_modify_read_only_table' => 'No está permitido modificar una tabla de sólo lectura', 'cant_access_table_single_record' => 'No se puede acceder al registro único de la tabla', 'cant_access_single_secondary_table_value' => 'No se puede acceder al registro único de la tabla secundaria #table_for_values#', 'cant_access_single_map_value' => 'No se puede acceder al registro único de la tabla que contiene todos los valores del campo #map_for_values_label#', 'is_unique_bad_action' => 'Valor de "action" incorrecto en "crudder_is_unique"'); // // initializers for: language = EN // self::$strings['EN'] = array('system_tables_title' => 'System tables', 'select_operation_tables_subtitle' => 'Select a table operation.', 'tables_administrator_title' => 'Tables administrative utility', 'table_text_title_part' => 'Table:', 'read_only_table_subtitle' => 'This is a read-only table. Use the text boxes located in the second row and the buttons <i>Filter</i> and <i>Erase</i> to apply and undo filtering over the records.', 'editable_table_subtitle' => 'Choose an record operation. Use the text boxes located in the second row and the buttons <i>Filter</i> and <i>Erase</i> to apply and undo filtering over the records. The <i>New</i> button allows to insert a new record.', 'edit_register_title_part' => 'record in the table:', 'edit_register_subtitle' => 'Fill in the form fields. If any field has a formatting or value error, a explaining message will be shown.', 'security_alert' => 'Security alert', 'delete_record_question' => 'Proceed with record deletion?', 'error_abort_session_message' => 'Error: too much time without interaction with the system, or insufficient privileges for accessing the system administration module.', 'go_back_main_system_link' => 'Back to main system operations', 'go_back_tables_list_link' => 'Back to tables listing', 'go_back_table_content_link' => 'Back to table content', 'go_back_register_insert_link' => 'Back to record insertion', 'go_back_register_update_link' => 'Back to record updating', 'table_id_descriptor' => 'Table ID. Must be unique within the metatables', 'table_displayname_descriptor' => 'Descriptive name of the table in the system database', 'table_metatable_descriptor' => 'Indicates if the table contains metatada (data that describe other tables)', 'table_helptext_descriptor' => 'Description of the table purpose', 'yes_label' => 'Yes', 'no_label' => 'No', 'id_label' => 'ID', 'displayname_label' => 'Name', 'metatable_label' => 'Metatable?', 'helptext_label' => 'Description', 'operations_label' => 'Operations', 'operations_label_help' => "In this column it's possible to create a new record, or update/delete an existing one", 'show_label' => 'Show', 'filters_label' => 'Filters', 'filter_label' => 'Filter', 'new_label' => 'New', 'erase_label' => 'Erase', 'insert_label' => 'Insert', 'update_label' => 'Update', 'delete_label' => 'Delete', 'pager_page_label' => 'Page', 'pager_of_label' => 'of', 'credits_text_and_links' => 'Developed with <a href="http://codeigniter.com" target="_blank">CodeIgniter</a> and <a href="http://getbootstrap.com/" target="_blank">Bootstrap</a>. Icons from <a href="http://glyphicons.com/" target="_blank">GlyphIcons</a>. Crudder by <a href="http://desarrolladores.logicos.org/gorka/" target="_blank">Gorka G LLona</a>.', 'record_updated' => 'The record was updated', 'record_inserted' => 'The record was inserted', 'record_deleted' => 'The record was deleted', 'unable_to_insert_record' => 'Could not insert the record', 'unable_to_delete_record' => 'Could not delete the record', 'cant_edit_metatable' => 'Can not edit a metatable', 'cant_modify_metatables' => 'Can not modify records in a metatable', 'cant_modify_read_only_table' => 'Can not edit a read-only table', 'cant_access_table_single_record' => 'Can not access the single record in the table', 'cant_access_single_secondary_table_value' => 'Can not access the single record #table_for_values# in the secondary table', 'cant_access_single_map_value' => 'Can not access the single record in the table that contains all the values of the #map_for_values_label# field', 'is_unique_bad_action' => 'Bad value of "action" in "crudder_is_unique"'); }
<!-- 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 -->
<!-- desde aqui el CRUDDER_footer --> <p> <br/><?php echo Crudderconfig::get_string('credits_text_and_links', false); ?> </p> </div> <!-- hasta aqui el CRUDDER_footer -->
/** * 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')); }