本文整理汇总了PHP中grocery_CRUD::set_relation方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::set_relation方法的具体用法?PHP grocery_CRUD::set_relation怎么用?PHP grocery_CRUD::set_relation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::set_relation方法的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: 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();
}
示例3: consultar
function consultar()
{
if ($this->session->userdata('is_logged_in')) {
$crud = new grocery_CRUD();
//-> Identifico el ID del Cliente
$crud->set_table('facturas');
//->
$crud->set_theme('datatables');
$crud->set_language('spanish');
$crud->set_subject('Factura');
// Display As
$crud->unset_add();
$crud->display_as('id_moneda_pago', 'Moneda Pago');
$crud->display_as('id_cliente', 'Cliente');
$crud->display_as('id_estatus', 'Estatus');
//-> Columnas
$crud->columns('folio', 'id_cliente', 'total', 'fecha_creacion', 'id_estatus');
// Relaciones
$crud->set_relation('id_moneda_pago', 'tipos_moneda', 'descripcion');
$crud->set_relation('registrado_por', 'usuarios', 'nombre');
$crud->set_relation('id_estatus', 'formas_pago', 'descripcion');
$crud->set_relation('id_cliente', 'clientes', 'nombre');
//-> Renderizar
$output = $crud->render();
$data['titulo'] = "CONSULTAR FACTURAS";
$this->load->view('include/head', $output);
$this->load->view('include/header', $data);
$this->load->view('admin/output');
$this->load->view('admin/librerias');
$this->load->view('include/footer', $data);
} else {
$this->load->view('admin/login');
}
}
示例4: index
function index()
{
if ($this->session->userdata('is_logged_in')) {
$crud = new grocery_CRUD();
$crud->set_table('productos');
//->
$crud->set_theme('datatables');
$crud->set_language('spanish');
$crud->set_subject('Producto');
// Display As
$crud->display_as('id_clasificacion', 'Clasificación');
$crud->display_as('id_estatus', 'Estatus');
//-> Columnas
$crud->columns('descripcion', 'id_clasificacion', 'precio');
// Relaciones
$crud->set_relation('id_clasificacion', 'productos_clasificaciones', 'descripcion');
$crud->set_relation('id_estatus', 'disponible_nodisponible', 'descripcion');
// Upload
##
// Validacion
$crud->field_type('precio', 'integer');
$crud->required_fields('descripcion', 'id_clasificacion', 'precio');
//-> Renderizar
$output = $crud->render();
$data['titulo'] = "PRODUCTOS";
$this->load->view('include/head', $output);
$this->load->view('include/header', $data);
$this->load->view('admin/output');
$this->load->view('admin/librerias');
$this->load->view('include/footer', $data);
} else {
$this->load->view('admin/login');
}
}
示例5: index
public function index()
{
$crud = new grocery_CRUD();
//Jangan lupa load library ini
$this->load->library('gc_dependent_select');
$crud->set_crud_url_path(site_url('examples/index'));
$crud->set_table('data_diri');
$crud->columns('nama', 'fk_id_prov', 'fk_id_kota', 'fk_id_kec', 'fk_id_kel');
$crud->display_as('fk_id_prov', 'Provinsi')->display_as('fk_id_kota', 'Kota')->display_as('fk_id_kec', 'Kecamatan')->display_as('fk_id_kel', 'Kelurahan');
$crud->set_subject('Data Diri');
$crud->set_relation('fk_id_prov', 'provinsi', 'nama');
$crud->set_relation('fk_id_kota', 'kabupaten', 'nama');
$crud->set_relation('fk_id_kec', 'kecamatan', 'nama');
$crud->set_relation('fk_id_kel', 'kelurahan', 'nama');
$fields = array('fk_id_prov' => array('table_name' => 'provinsi', 'title' => 'nama', 'relate' => null, 'data-placeholder' => 'Pilih Provinsi'), 'fk_id_kota' => array('table_name' => 'kabupaten', 'title' => 'nama', 'id_field' => 'id_kab', 'relate' => 'id_prov', 'data-placeholder' => 'Pilih Kota'), 'fk_id_kec' => array('table_name' => 'kecamatan', 'title' => 'ID: {id_kec} / Kota : {nama}', 'id_field' => 'id_kec', 'relate' => 'id_kab', 'data-placeholder' => 'Pilih Kecamatan'), 'fk_id_kel' => array('table_name' => 'kelurahan', 'title' => 'nama', 'id_field' => 'id_kel', 'relate' => 'id_kec', 'data-placeholder' => 'Pilih Kelurahan'));
$config = array('main_table' => 'data_diri', 'main_table_primary' => 'id', "url" => site_url() . '/examples/index/', 'ajax_loader' => base_url() . 'assets/ajax-loader.gif');
$categories = new gc_dependent_select($crud, $fields, $config);
// first method:
//$output = $categories->render();
// the second method:
$js = $categories->get_js();
$output = $crud->render();
$output->output .= $js;
$this->_example_output($output);
}
示例6: index
public function index()
{
$bol_del_before_date = $this->m_conndb->dateBeforeDelete();
try {
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('tempahan');
$crud->set_subject('Booking Room');
$crud->set_relation('m_id', 'masa', 'm_desc');
$crud->set_relation('bm_id', 'bilik_meeting', 'bm_desc');
$crud->display_as('t_datereg', 'Date Reg.')->display_as('t_date', 'Book Date')->display_as('t_day', 'Book Day')->display_as('m_id', 'Time')->display_as('t_perkara', 'Club / Item')->display_as('bm_id', 'Meeting Room')->display_as('t_status', 'Status');
$crud->columns('t_date', 't_day', 'm_id', 't_perkara', 'bm_id');
$crud->fields('t_date', 'm_id', 't_perkara', 'bm_id', 't_datereg', 't_day');
$crud->field_type('t_datereg', 'hidden');
$crud->field_type('t_day', 'hidden');
$crud->required_fields('t_date', 'm_id', 't_perkara', 'bm_id');
$umaq = $this->uri->segment(3);
if (!($this->uri->segment(3) && $umaq == 'umaqkacak')) {
$crud->unset_delete();
$crud->unset_edit();
}
$crud->callback_before_insert(array($this, 'setAutoTempahan'));
$output = $crud->render();
$this->viewpage('v_bookroom', $output);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例7: get_crud_propuesta
public function get_crud_propuesta()
{
$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_periodo', 'gp_periodo', 'siglas');
$crud->set_relation('id_departamento', 'gp_departamentos', 'nombre_depart', array('estado_dep' => '1'));
$crud->set_relation('id_persona', 'gp_persona', '{nombres} {apellidos}');
$crud->display_as('id_periodo', 'Periodo')->display_as('id_departamento', 'Departamento')->display_as('id_persona', 'Usuario');
// $crud->set_relation('id_persona', 'gp_tipopersona', 'typo_persona');
//$crud->set_relation('id_estado', 'gp_estados', 'valor');
$crud->callback_column('estado', array($this, 'color_estado'));
$crud->callback_column('tipo_persona', array($this, 'tipo_persona'));
$crud->callback_column('asignacion_tutor', array($this, 'asigna_tutor'));
$crud->callback_column('tutor', array($this, 'view_tutor'));
$crud->callback_column('historial', array($this, 'get_historial'));
$cols = array('titulo', 'contenido', 'id_periodo', 'id_departamento', 'id_persona', 'tipo_persona', 'fecha_post', 'estado', 'tutor', 'asignacion_tutor', 'historial');
$crud->columns2($cols);
$crud->set_table('gp_propuesta');
$crud->set_subject('Tesis');
$crud->unset_add()->unset_delete()->unset_edit();
$output = $crud->render();
$this->load->view('crud/crud_view_datatable', $output);
}
示例8: items
public function items()
{
$crud = new grocery_CRUD();
$crud->set_table('item');
$crud->display_as('category_id', 'Categoria')->display_as('tag_id', 'Etiqueta');
$crud->set_relation('category_id', 'category', 'name');
$crud->set_relation('tag_id', 'tag', 'name');
$crud->set_field_upload('photo', 'assets/uploads/files');
$output = $crud->render();
$this->_example_output($output);
}
示例9: ventas
function ventas()
{
$crud = new grocery_CRUD();
$crud->set_table('ventas');
$crud->set_relation('producto', 'productos', 'item_name');
$crud->set_relation('unitario', 'productos', 'precio');
$crud->display_as('valor', 'Total');
$crud->unset_add();
$crud->unset_delete();
$crud->unset_edit();
$output = $crud->render();
$this->load->view('main/ventas', $output);
}
示例10: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('bookings');
$crud->set_subject('Bookings');
// $agents = $this->ion_auth->get_all_agents();
// $user = $this->ion_auth->user()->row();
// $agents += array($user->id => $user->first_name . " " . $user->last_name);
// $crud->field_type('hotel_agent_id', 'dropdown', $agents);
$crud->set_relation('booking_agent', 'io_users', '{first_name} {last_name} [{email}]', array('active' => 1));
$crud->set_relation('agent_id', 'io_users', '{first_name} {last_name} [{email}]', array('active' => 1));
$crud->set_relation('booking_to', 'io_users', '{first_name} {last_name} [{email}]', array('active' => 1));
$crud->display_as('agent_id', 'Agent of Hotel/Package');
$crud->display_as('booking_company_commission', 'Company Commission');
$crud->display_as('booking_status', 'Status (Change Status)');
$crud->display_as('booking_agent', 'Booked By');
// $crud->display_as('hotel_name', 'Hotel Name');
// $crud->display_as('hotel_rooms', 'Rooms');
// $crud->display_as('hotel_tariffs', 'Tariffs');
$crud->field_type('booking_ref_no', 'readonly');
$crud->field_type('paypal_transaction_id', 'readonly');
$crud->field_type('booking_agent_commission', 'readonly');
$crud->field_type('booking_company_commission', 'readonly');
$crud->field_type('booking_type', 'readonly');
$crud->field_type('booking_item_title', 'readonly');
$crud->field_type('booking_date', 'readonly');
$crud->field_type('booking_payment_type', 'readonly');
$crud->field_type('booking_total', 'readonly');
$crud->field_type('booking_agent', 'readonly');
$crud->field_type('agent_id', 'readonly');
$crud->field_type('booking_to', 'readonly');
$crud->unset_columns('booking_item', 'booking_subitem', 'booking_paymethod_tax', 'ip_address', 'booking_nights');
$crud->unset_fields('booking_item', 'booking_subitem', 'booking_paymethod_tax', 'ip_address', 'booking_nights');
$crud->where('agent_id', $this->ion_auth->get_user_id());
// $crud->columns('hotel_name', 'hotel_agent_id', 'hotel_phoneNumber', 'hotel_website', 'hotel_facebook' ,'hotel_googleMap', 'hotel_status');
// $state = $crud->getState();
//
// if($state =='list' || $state =='ajax_list')
// {
$crud->set_js("assets/frontend/js/custom_functions_sam.js");
// }
$crud->add_action('Conversation', 'http://www.grocerycrud.com/assets/uploads/general/smiley.png', '', 'ui-icon-image', array($this, '_booking_conversation'));
$crud->callback_column('booking_ref_no', array($this, '_show_invoice'));
$crud->callback_edit_field('booking_status', array($this, '_edit_field_callback'));
$crud->callback_column('booking_status', array($this, '_booking_status'));
$crud->unset_add();
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Bookings', 'pagedesc' => 'Bookings', 'contenttitle' => 'Booking List Records', 'left_menu' => 'agents_menu');
$this->load->view('gc_admin_wrapper', $data);
}
示例11: get_crud_expe
public function get_crud_expe()
{
$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_persona', 'gp_persona', '{nombres} {apellidos}');
$crud->set_relation('id_periodo', 'gp_periodo', 'siglas', array('estado_periodo' => '1'));
$crud->set_table('gp_expediente');
$crud->set_subject('Expediente');
// $crud->unset_add();
$output = $crud->render();
$this->load->view('crud/crud_view_datatable', $output);
}
示例12: review_doctor
public function review_doctor()
{
if ($this->session->userdata('is_admin_logged_in')) {
$crud = new grocery_CRUD();
$crud->set_table('review_doctor');
//$crud->columns('name','address','lat','lng','phone', 'description', 'review', 'birthRateLess35', 'birthRate35To40', 'birthRateMore40', 'services');
$crud->set_subject('review_doctor');
$crud->set_relation('fk_doctor', 'doctors', 'full_name');
$crud->set_relation('fk_patient', 'patients', 'name');
$output = $crud->render();
$this->_example_output($output);
} else {
redirect('Admin/admin_restricted');
}
}
示例13: index
public function index()
{
try {
// General
$crud = new grocery_CRUD();
$crud->set_language("french");
$crud->set_theme('bootstrap');
$crud->set_table('sos_gen_nationalite_detailles');
$crud->set_subject('Situation administrative');
//relations
$crud->set_relation('id_from_nationalite', 'sos_gen_nationalite', 'name_nationalite');
//Master/child relations
//Visual
$crud->columns('name_nationalite_detailles', 'id_from_nationalite');
$crud->display_as('name_nationalite_detailles', 'Situation administrative');
$crud->display_as('id_from_nationalite', 'Nationalité');
//unsets
//Requireds
$crud->required_fields('name_nationalite_detailles', 'id_from_nationalite');
//Callbacks
//field Types
// Actions
// Renders
$output = $crud->render();
$menu = new stdClass();
$menu->n1 = true;
$menu->lien3_1_1_4 = false;
$menu->status = $this->session->userdata('status');
$header = $this->navigation->home_f($menu);
$data = array('output' => $output, 'header' => $header);
$this->_example_output($data);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例14: 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());
}
}
示例15: user
public function user()
{
$crud = new grocery_CRUD();
$crud->set_table('user');
$crud->set_relation('idUnit', 'unit', 'namaGroup');
$output = $crud->render();
$this->_outputs($output);
}