本文整理汇总了PHP中grocery_CRUD::set_relation_n_n方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::set_relation_n_n方法的具体用法?PHP grocery_CRUD::set_relation_n_n怎么用?PHP grocery_CRUD::set_relation_n_n使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::set_relation_n_n方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enfants_window
public function enfants_window($id)
{
$this->id_demande = $id;
try {
$crud = new grocery_CRUD();
$crud->set_language("french");
$crud->set_theme('bootstrap');
$crud->where('id_from_demande', $this->id_demande);
$crud->set_table('sos_enfants');
$crud->set_subject('Enfant');
$crud->unset_add();
$crud->unset_delete();
$crud->field_type('id_from_demande', 'hidden', $this->id_demande);
$crud->unset_edit_fields('id_from_kids');
$crud->set_relation('id_from_kids', 'sos_kids', "id_kid");
$crud->set_relation('recu', 'sos_gen_recu', "name_recu", null, 'name_recu ASC');
$crud->set_relation_n_n('accompagniement', 'sos_relation_accompagniement_kid', 'sos_gen_accompagniement_kid', 'id_from_enfants', 'id_from_accompagniement_kid', 'name_accompagniement_kid');
$crud->set_relation_n_n('activite', 'sos_relation_activite_kid', 'sos_gen_activite_kid', 'id_from_enfants', 'id_from_activite_kid', 'name_activite_kid');
$crud->columns('enfant', 'recu', 'activite', 'accompagniement', 'commentaire_enfant');
//$crud->display_as('id_from_kids', 'Enfants');
$crud->display_as('accompagniement', 'Accompagnement');
$crud->display_as('activite', 'Activité');
$crud->display_as('recu', 'Reçu');
$crud->display_as('id_from_kids', 'Enfant(s)');
$crud->display_as('commentaire_enfant', 'Commentaire enfant');
$crud->callback_column('accompagniement', array($this, 'accompagniement'));
$crud->callback_column('activite', array($this, 'activite'));
$crud->callback_column('enfant', array($this, 'enfant'));
$crud->required_fields('recu');
$output = $crud->render();
$this->db->where('id_demande', $this->id_demande);
$query = $this->db->get('sos_demande');
if ($query->num_rows == 1) {
$row_demande = $query->row();
}
// $my_demande = $row_demande->id_from_demande;
$menu = new stdClass();
$menu->n3 = true;
//$menu->id_1 = $my_demande;
$menu->id = $row_demande->id_from_femme;
$menu->status = $this->session->userdata('status');
$this->db->where('id_femme', $menu->id);
$query = $this->db->get('sos_femme');
if ($query->num_rows == 1) {
$row_femme = $query->row();
}
$header = $this->navigation->home_f($menu) . ' ' . '<p><pre>' . $row_femme->prenom . ' ' . $row_femme->nom . ' ' . $row_femme->nom_marital . '</pre></p>';
$data = array('output' => $output, 'header' => $header);
$this->_example_output($data);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例2: administration
function administration()
{
try {
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('news');
$crud->set_subject('Noticias');
$crud->set_language('spanish');
$crud->unset_export();
$crud->columns('title', 'author', 'summary', 'date_time', 'active');
$crud->required_fields('title', 'author', 'fk_source', 'date_time', 'priority', 'category', 'tags');
// $crud->add_fields('title', 'author', 'image', 'footer_text', 'date_time', 'url', 'summary', 'text', 'fk_source', 'priority', 'active', 'category', 'tags', 'img');
$crud->set_relation('fk_source', 'sources', 'name');
$crud->set_relation_n_n('category', 'news_categories', 'categories', 'fk_news', 'fk_category', 'category');
$crud->set_relation_n_n('tags', 'news_tags', 'tags', 'fk_news', 'fk_tag', 'tag');
$crud->set_field_upload('image', 'assets/uploads/news/');
$crud->display_as('title', 'Título')->display_as('summary', 'Sumario')->display_as('text', 'Texto')->display_as('author', 'Autor')->display_as('date_time', 'Fecha')->display_as('active', 'Estado')->display_as('comment_url', 'URL')->display_as('comment_count', 'Comentarios')->display_as('category', 'Categoría')->display_as('tags', 'Palabras Claves')->display_as('image', 'Imagen principal')->display_as('priority', 'Prioridad')->display_as('fk_source', 'Fuente')->display_as('img', 'Imágenes Adicionales')->display_as('footer_text', 'Texto de imagen');
$crud->set_relation_n_n('img', 'news_image', 'images', 'fk_news', 'fk_image', 'image');
// $crud->set_field_upload('img', 'assets/uploads/news/');
// $crud->set_field_upload('img', 'uploads/news/');
// $crud->callback_add_field('img', array($this, 'add_field_image_callback'));
// $crud->callback_edit_field('img', array($this, 'edit_field_image_callback'));
/* Generamos la tabla */
// $crud->callback_after_insert(array($this, 'after_insert'));
// $crud->callback_before_delete(array($this, 'before_delete_log'));
// $crud->callback_after_update(array($this, 'after_update_log'));
//
$output = $crud->render();
$this->load->view('includes/template', $output);
} catch (Exception $e) {
/* Si algo sale mal cachamos el error y lo mostramos */
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例3: get_crud
private function get_crud()
{
$this->data['message'] = $this->session->flashdata('message');
$crud = new grocery_CRUD();
$crud->set_theme(GROCERY_CRUD_THEME);
$crud->set_table('usuario');
$crud->set_subject('Usuário');
$crud->unset_columns('id', 'senha', 'senha_anterior1', 'senha_anterior2', 'senha_anterior3', 'ultima_troca', 'cadastro');
$crud->fields('id', 'nome', 'login', 'email', 'grupos', 'tipo_usuario_id', 'situacao_usuario_id', 'senha', 'senha_anterior1', 'senha_anterior2', 'senha_anterior3');
$crud->unset_texteditor('id', 'senha', 'senha_anterior1', 'senha_anterior2', 'senha_anterior3', 'ultima_troca', 'cadastro');
$crud->change_field_type('id', 'invisible');
$crud->change_field_type('senha', 'invisible');
$crud->change_field_type('senha_anterior1', 'invisible');
$crud->change_field_type('senha_anterior2', 'invisible');
$crud->change_field_type('senha_anterior3', 'invisible');
$crud->set_relation('situacao_usuario_id', 'situacao_usuario', 'descricao');
$crud->display_as('situacao_usuario_id', 'Situacao');
$crud->set_relation('tipo_usuario_id', 'tipo_usuario', 'descricao');
$crud->display_as('tipo_usuario_id', 'Tipo de Usuário');
$crud->set_relation_n_n('grupos', 'grupo_usuario_x_usuario', 'grupo_usuario', 'usuario_id', 'grupo_usuario_id', 'descricao');
/* regras e campos obrigatórios */
$crud->required_fields('login', 'grupos', 'tipo_usuario_id', 'situacao_usuario_id');
$crud->set_rules('login', 'Login', 'required|min_length[2]');
$crud->set_rules('grupos', 'Grupos', 'required');
$crud->set_rules('tipo_usuario_id', 'Tipo de Usuário', 'required');
$crud->set_rules('situacao_usuario_id', 'Situação do Usuário', 'required');
$crud->callback_before_insert(array($this, 'checking_new_user'));
return $crud->render();
}
示例4: psy_window
public function psy_window($id)
{
$this->id_femme = $id;
try {
// General
$crud = new grocery_CRUD();
$crud->set_language("french");
$crud->set_theme('bootstrap');
$crud->where('id_from_femme', $this->id_femme);
$crud->set_table('sos_psy');
$crud->set_subject('Accompagnement Psychologique');
//relations
$crud->set_relation_n_n('troubles_physiologiques', 'sos_relation_troubles_physiologiques', 'sos_gen_troubles_physiologiques', 'id_from_psy', 'id_from_troubles_physiologiques', 'name_troubles_physiologiques', 'priority');
$crud->set_relation_n_n('troubles_cognitifs', 'sos_relation_troubles_cognitifs', 'sos_gen_troubles_cognitifs', 'id_from_psy', 'id_from_troubles_cognitifs', 'name_troubles_cognitifs', 'priority');
$crud->set_relation_n_n('troubles_emotionnels', 'sos_relation_troubles_emotionnels', 'sos_gen_troubles_emotionnels', 'id_from_psy', 'id_from_troubles_emotionnels', 'name_troubles_emotionnels', 'priority');
//Visual
$crud->columns('troubles_physiologiques', 'troubles_cognitifs', 'troubles_emotionnels');
$crud->display_as('troubles_emotionnels', 'Troubles émotionnels');
//unsets
$crud->unset_delete();
$crud->unset_add();
//Requireds
//Callbacks
$crud->callback_column('troubles_physiologiques', array($this, 'troubles_physiologiques'));
$crud->callback_column('troubles_cognitifs', array($this, 'troubles_cognitifs'));
$crud->callback_column('troubles_emotionnels', array($this, 'troubles_emotionnels'));
//field Types
$crud->field_type('id_from_femme', 'hidden', $this->id_femme);
// Actions
// Renders
$output = $crud->render();
$menu = new stdClass();
$menu->n1 = true;
$menu->status = $this->session->userdata('status');
$this->db->where('id_femme', $this->id_femme);
$query = $this->db->get('sos_femme');
if ($query->num_rows == 1) {
$row_femme = $query->row();
}
$header = $this->navigation->home_f($menu) . ' ' . '<p><pre>' . $row_femme->prenom . ' ' . $row_femme->nom . ' ' . $row_femme->nom_marital . '</pre></p>';
$data = array('output' => $output, 'header' => $header);
$this->_example_output($data);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例5: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('bootstrap');
$crud->set_table('user');
$crud->set_subject('Gebruiker');
// hide fields
$crud->columns('is_super_user', 'is_active', 'screen_name', 'email', 'gebruikersgroepen');
// new_password and new_password repeat are needed to make formvalidation work
// id is needed to make the email unique check work
$crud->fields('id', 'is_active', 'screen_name', 'email', 'gebruikersgroepen', 'password', 'new_password', 'new_password_repeat');
$crud->required_fields('email', 'screen_name', 'is_active');
$crud->set_relation_n_n('gebruikersgroepen', 'user_x_user_group', 'user_group', 'user_id', 'user_group_id', 'name');
$crud->field_type('id', 'hidden');
$crud->field_type('new_password_repeat', 'hidden');
$crud->field_type('password', 'hidden');
$crud->display_as('is_active', 'Actief');
$crud->display_as('screen_name', 'Schermnaam');
$crud->display_as('is_super_user', '');
$crud->display_as('new_password', 'Wachtwoord');
if ($crud->getState() == 'read') {
$crud->field_type('new_password', 'hidden');
} else {
$crud->callback_field('new_password', array($this, 'edit_field_callback_new_password'));
}
$crud->field_type('is_active', 'dropdown', array('yes' => 'ja', 'no' => 'nee'));
$crud->callback_column('is_active', array($this, 'callback_list_is_active'));
$crud->callback_column('is_super_user', array($this, 'callback_list_is_super_user'));
$crud->callback_before_insert(array($this, 'before_insert_update_callback'));
$crud->callback_before_update(array($this, 'before_insert_update_callback'));
$crud->callback_after_insert(array($this, 'after_insert_callback'));
$crud->callback_after_update(array($this, 'after_update_callback'));
if ($crud->getState() === 'update_validation' or $crud->getState() === 'insert_validation') {
$crud->set_rules('email', 'E-mail', 'required|valid_email|callback_email_unique_check');
$crud->set_rules('screen_name', 'Schermnaam', 'required');
if ($this->input->post('new_password') != '' or !$this->input->post('id')) {
$crud->set_rules('new_password', 'Nieuw wachtwoord', 'required|min_length[10]|matches[new_password_repeat]');
$crud->set_rules('new_password_repeat', 'Herhaal nieuw wachtwoord', '');
}
$this->form_validation->set_message('matches', 'De wachtwoorden zijn niet aan elkaar gelijk.');
}
// render the crud HTML
$crud_output = $crud->render();
//get the needed css and javascript files
$this->javascript_files = $crud->get_js_files();
$this->css_files = $crud->get_css_files();
// put the crud content in the right position
$this->views['content'] = $crud_output->output;
$this->css[] = $this->load->view('admin/user/css/index.css', array(), true);
// add javascript and css to make the password generate and change function possible
if ($crud->getState() === 'add' or $crud->getState() === 'edit') {
$this->css[] = $this->load->view('admin/user/css/edit_user.css', array(), true);
$this->javascript[] = $this->load->view('admin/user/js/edit_user.js', array(), true);
}
// create the layout-HTML and show it to the user
$this->_layout();
}
示例6: category
public function category()
{
$crud = new grocery_CRUD();
$crud->set_table('blog_category');
$crud->columns('category_name', 'description');
$crud->edit_fields('category_name', 'description');
$crud->add_fields('category_name', 'description');
$crud->display_as('category_name', 'Category')->display_as('description', 'Description');
$crud->set_subject('Category');
$crud->set_relation_n_n('Articles', 'blog_category_article', 'blog_article', 'category_id', 'article_id', 'article_title');
$output = $crud->render();
$this->view('grocery_CRUD', $output, 'blog_category');
}
示例7:
function machines_management()
{
$crud = new grocery_CRUD();
$crud->set_table('maquinas');
$crud->set_theme('datatables');
$crud->columns('nombre', 'procesos');
$crud->edit_fields('nombre', 'procesos');
$crud->add_fields('nombre', 'procesos');
$crud->set_subject('Maquina');
$crud->set_relation_n_n('procesos', 'maquinas_procesos', 'procesos', 'id_maquina', 'id_proceso', 'nombre');
$crud->unset_delete();
$output = $crud->render();
$this->_output_crud($output, 'Maquinas');
}
示例8: get_crud_add_mod_usuarios
public function get_crud_add_mod_usuarios()
{
$this->config->load('grocery_crud');
$this->config->set_item('grocery_crud_dialog_forms', true);
$crud = new grocery_CRUD();
$crud->set_theme('datatables2');
$crud->set_relation('id_tipopersona', 'gp_tipopersona', 'typo_persona');
$crud->set_relation('id_departamento', 'gp_departamentos', 'nombre_depart', array('estado_dep' => '1'));
$crud->set_relation_n_n('modulos', 'gp_mod_persona', 'gp_modulos', 'id_persona', 'id_modulo', 'modulos');
$crud->set_table('gp_persona');
// $crud->callback_column('modulos', array($this, 'view_modulos'));
$crud->callback_column('add_modulos', array($this, 'add_modulos'));
$columns = array('cedula', 'nombres', 'apellidos', 'id_tipopersona', 'id_departamento', 'modulos', 'add_modulos');
$crud->columns2($columns);
$crud->set_subject('Estudiante');
$crud->unset_add()->unset_delete()->unset_edit();
$output = $crud->render();
$this->load->view('crud/crud_view_datatable', $output);
}
示例9: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_table('usrmgr');
$crud->change_field_type('password', 'password');
$crud->callback_edit_field('password', array($this, 'decrypt_password_callback'));
$crud->columns('username', 'nama_lengkap', 'email', 'level', 'blokir');
$crud->callback_before_insert(array($this, 'encrypt_password_callback'));
$crud->callback_before_update(array($this, 'encrypt_password_callback'));
$crud->set_subject('Users');
$crud->fields('nama_lengkap', 'username', 'password', 'email', 'level', 'access_control', 'blokir');
$crud->required_fields('nama_lengkap', 'username', 'level', 'blokir');
$crud->set_relation_n_n('access_control', 'usrmgr_access', 'modul', 'id_users', 'id_modul', 'nama_modul', 'priority');
//$crud->set_relation('salesRepEmployeeNumber','employees','lastName');
$output = $crud->render();
$data['subject'] = 'Pengaturan Pengguna';
$data['content'] = $this->load->view('crud.php', $output, true);
$this->load->view('base_theme', $data);
}
示例10: listSurat
public function listSurat()
{
$crud = new grocery_CRUD();
$crud->set_table('surat');
//nama table yg akan di list
$crud->set_subject('Surat');
//deskripsi tombol
$crud->columns('nomorSurat', 'perihal', 'tanggal', 'idInstansi', 'idSifatSurat', 'fileAttach', 'Distribusi');
//kolom yg akan ditampilkan
$crud->set_relation('idInstansi', 'instansi', 'namaInstansi');
//relasi tabel : contoh
$crud->set_relation('idSifatSurat', 'sifatSurat', 'SifatSurat');
//relasi tabel dengan tabel type surat
$crud->set_field_upload('fileAttach', 'assets/');
//ubah field fileAttach menjadi mode upload
$crud->set_relation_n_n('Distribusi', 'distribusi', 'unit', 'id_surat', 'id_unit', 'namaGroup');
$output = $crud->render();
$this->_outputs($output);
}
示例11: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('pedidos')->set_subject('Pedidos')->columns('fecharegistro', 'idcliente', 'formadepago', 'montototal');
//$crud -> required_fields('titulo', 'fechainicio', 'habilitado');
//$crud -> unique_fields('nombre','categoria');
//$crud -> set_field_upload('imagen', 'assets/uploads/files');
$crud->unset_texteditor('descripcion', 'full_text');
$crud->set_relation_n_n('productos', 'items', 'producto', 'idpedido', 'idproducto', 'nombre', 'priority');
$crud->display_as('montototal', 'Monto');
$crud->display_as('nombrecliente', 'Nombre cliente');
$crud->display_as('apellido', 'Apellido cliente');
$crud->display_as('formadepago', 'Forma de pago');
$crud->display_as('idcliente', 'Cliente');
$crud->unset_fields('fecharegistro');
$crud->unset_print();
$output = $crud->render();
$this->_example_output($output);
}
示例12: index
public function index()
{
$crud = new grocery_CRUD();
// crud settings
$crud->set_theme('bootstrap');
$crud->set_table('user_group');
$crud->set_subject('Gebruikersgroepen');
$crud->columns('name', 'key');
$crud->display_as('name', 'Naam');
$crud->required_fields('name');
$crud->callback_before_insert(array($this, 'before_insert'));
$crud->change_field_type('key', 'invisible');
$crud->set_relation_n_n('gebruikers', 'user_x_user_group', 'user', 'user_group_id', 'user_id', 'email');
// render the crud HTML
$crud_output = $crud->render();
$this->javascript_files = $crud->get_js_files();
$this->css_files = $crud->get_css_files();
$this->views['content'] = $crud_output->output;
$this->_layout();
}
示例13:
/**
* Función para contruir el Grocecy CRUD de la tabla Usuarios
*/
function abm_usuarios()
{
//Defino submenu
$this->menu['submenuSeleccionado'] = 'Usuarios';
//Creo el objeto crud
$crud = new grocery_CRUD();
//Defino Template como datatables.
//$crud->set_theme('datatables');
//Defino tabla sobre la que trabajo y tipo de 'Objeto'
$crud->set_table('Usuarios');
$crud->set_subject('Usuario');
//Agrego acción para cambiar contraseña.
$crud->add_action('Cambiar Contraseña', base_url() . 'assets/grocery_crud/themes/flexigrid/css/images/key.png', 'administracion/usuarios/cambiar_contrasena');
//Un usuario puede tener un idPersonal asociado.
$crud->set_relation('idPersonal', 'Personal', 'nombreApellido');
//Relación con los roles.
$crud->set_relation_n_n('roles', 'RolesPorUsuario', 'Roles', 'idUsuario', 'idRol', 'descripcion');
//Seteo Reglas para campos
$crud->set_rules('contrasena', 'Contraseña', 'required|matches[repetirContrasena]');
$crud->add_fields('nombreUsuario', 'contrasena', 'repetirContrasena', 'roles', 'idPersonal');
$crud->edit_fields('roles', 'idPersonal');
$crud->field_type('contrasena', 'password');
$crud->field_type('repetirContrasena', 'password');
//Seteo campos requeridos
$crud->required_fields('nombreUsuario', 'contrasena', 'repetirContrasena', 'roles');
//Defino Columnas a Mostrar
$crud->columns('nombreUsuario', 'roles');
//Defino nombres para cada campo.
$crud->display_as('nombreUsuario', 'Nombre de Usuario');
$crud->display_as('contrasena', 'Contraseña');
$crud->display_as('repetirContrasena', 'Repetir Contraseña');
$crud->display_as('roles', 'Roles');
$crud->display_as('idPersonal', 'Persona Asociada');
//Hago 'callbacks' para transformar datos antes de inserción/actualización.
$crud->callback_before_insert(array($this, '_transformar_datos'));
$crud->callback_before_update(array($this, '_transformar_datos_update'));
//Genero el ABM
$output = $crud->render();
//Llamo a la función encargada de mostrar el ABM.
mostrar_crud($output, '', $this->menu, 'administracion/usuarios/abm_usuarios', '', 'administracion/usuarios/abm_usuarios_final');
}
示例14: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_model('My_Custom_model');
$crud->set_table('ips_ordertracking', 'ips_productitems');
$crud->set_subject('Sales Tracking');
$crud->required_fields('NAME');
// void set_relation_n_n( string $field_name, string $relation_table, string $selection_table, string $primary_key_alias_to_this_table, string $primary_key_alias_to_selection_table , string $title_field_selection_table [ , string $priority_field_relation ] )
$crud->set_relation_n_n('orderdetails', 'ips_ordertracking', 'ips_productitems', 'ips_ordertracking', 'ordertrackingid', 'description', 'category');
// $crud->set_relation('ordertrackingid','ips_productitems','description');
// $crud->columns('ordertrackingid','fullfillment','orderdate','orderid','returnid','itemrece','caseid','product','status','Action');
// $crud->display_as('orderdate','Order Date')->display_as('orderid','Order ID')->display_as('returnid','Sales Return ID')->display_as('itemrece','Item Received')->display_as('caseid','Case ID')->display_as('product','Product Condition')->display_as('ordertrackingid','ID');
$crud->columns('ordertrackingid', 'orderid', 'description', 'category', 'product', 'itemrece', 'cost', 'mrp', 'Action');
$crud->display_as('orderid', 'Order ID')->display_as('itemrece', 'Item Received')->display_as('product', 'Product Condition')->display_as('ordertrackingid', 'ID')->display_as('description', 'Product Name')->display_as('category', 'Category')->display_as('cost', 'Recovery Min')->display_as('mrp', 'Recovery Max');
$crud->callback_column('ordertrackingid', array($this, '_callback_webpage_url'));
$crud->callback_column('orderdate', array($this, '_callback_dateformat'));
$crud->callback_column('fullfillment', array($this, '_callback_fullfillment'));
// $crud->callback_column('product',array($this,'_callback_product'));
$crud->callback_column('status', array($this, '_callback_status'));
$crud->callback_column('itemrece', array($this, '_callback_itemrece'));
$crud->callback_column('cost', array($this, '_callback_recovery_min'));
$crud->callback_column('mrp', array($this, '_callback_recovery_max'));
$crud->callback_column('Action', array($this, '_callback_viewpage_url'));
$crud->unset_edit();
$crud->unset_read();
$crud->unset_delete();
// $crud->callback_after_insert(array($this, 'fullfillmentid_generation'));
$output = $crud->render();
$state = $crud->getState();
if ($state == 'add') {
redirect('store/addtracking');
}
if ($state == 'view') {
redirect('store/viewtracking');
}
// $this->grocery_crud->set_table('ips_login');
// $output = $this->grocery_crud->render();
$this->_example_output($output);
}
示例15: administration
function administration()
{
try {
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('sites');
$crud->set_subject('Directorio de Sitios');
$crud->set_language('spanish');
$crud->unset_export();
$crud->columns('name', 'url', 'owner', 'active', 'fk_language');
// $crud->required_fields('name', 'url', 'description', 'fk_type', 'fk_owner');
$crud->set_relation('fk_type', 'types_site', 'type');
$crud->set_relation('fk_language', 'languages', 'language');
$crud->set_relation_n_n('parent', 'parents_site', 'sites', 'child_site', 'parent_site', 'name');
$crud->set_relation_n_n('owner', 'site_owner', 'owners', 'fk_site', 'fk_owner', 'name');
$crud->set_relation_n_n('icon', 'site_icon', 'icons', 'fk_site', 'fk_icon', 'icon');
$crud->set_relation_n_n('text', 'site_text', 'text', 'fk_site', 'fk_text', 'text');
$crud->set_relation_n_n('category', 'sites_categories', 'categories', 'fk_site', 'fk_category', 'category');
$crud->set_relation_n_n('tags', 'sites_tags', 'tags', 'fk_site', 'fk_tag', 'tag');
$crud->change_field_type('description', 'text');
// $crud->callback_add_field('text', array($this, 'field_add_text_callback'));
// $crud->callback_add_field('icon', array($this, 'field_icon_callback'));
$crud->display_as('name', 'Nombre')->display_as('url', 'URL')->display_as('description', 'Descripción')->display_as('active', 'Estado')->display_as('date_publication', 'Inicio de Publicidad')->display_as('published_to_date', 'Fin de Publicidad')->display_as('priority', 'Prioridad')->display_as('category', 'Categoría')->display_as('owner', 'Propietario')->display_as('parent', 'Sitios Padre')->display_as('tags', 'Palabras Claves')->display_as('icon', 'Icono')->display_as('text', 'Texto Adicional')->display_as('fk_language', 'Idioma')->display_as('fk_type', 'Tipo de sitio');
//$crud->change_field_type('name','file');
/**
* Insertando campos en las tablas "icons_site" y "add_text"
*/
$crud->callback_after_insert(array($this, 'after_insert'));
$crud->callback_before_delete(array($this, 'before_delete_log'));
$crud->callback_after_update(array($this, 'after_update_log'));
$output = $crud->render();
$this->load->view('includes/template', $output);
} catch (Exception $e) {
/* Si algo sale mal mostramos error */
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}