本文整理汇总了PHP中grocery_CRUD::fields方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::fields方法的具体用法?PHP grocery_CRUD::fields怎么用?PHP grocery_CRUD::fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::fields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
//$data['main_content'] = 'login_form';
//$this->load->view('includes/template',$data);
//$this->load->view('admin/configuration');
//$this->load->view('admin/homepage');
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('ips_disposition');
$crud->set_subject('Disposition');
$crud->required_fields('NAME');
$crud->columns('NAME', 'DISABLE');
$crud->fields('NAME');
// $crud->unset_add();
// $crud->unset_edit();
$crud->unset_delete();
$crud->set_lang_string('insert_success_message', 'Your data has been successfully stored into the database.<br/>Please wait while you are redirecting to the list page.
<script type="text/javascript">
window.location = "' . site_url('admin/disposition') . '";
</script>
<div style="display:none">
');
$crud->callback_after_insert(array($this, 'disposition_generation'));
$output = $crud->render();
// $this->grocery_crud->set_table('ips_login');
// $output = $this->grocery_crud->render();
$this->_example_output($output);
}
示例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: index
public function index()
{
//Inisialisasi
$crud = new grocery_CRUD();
$crud->set_subject('Pasien');
$crud->set_table('tbl_pasien');
//Label Fields
$crud->display_as('idPasien', 'ID Pasien');
$crud->display_as('namaPasien', 'Nama');
$crud->display_as('umur', 'Umur');
$crud->display_as('tanggalLahir', 'Tanggal Lahir');
$crud->display_as('jenisKelamin', 'Jenis Kelamin');
$crud->display_as('status', 'Status');
$crud->display_as('alamat', 'Alamat');
$crud->display_as('pekerjaan', 'Pekerjaan');
$crud->display_as('no_telp', 'Nomor Telepon');
//Kolom Input dan Callbacks
$crud->fields('idPasien', 'namaPasien', 'umur', 'tanggalLahir', 'jenisKelamin', 'status', 'alamat', 'pekerjaan', 'no_telp');
$crud->field_type('idPasien', 'invisible');
$crud->callback_field('jenisKelamin', array($this, 'jenisKelamin_callback'));
$crud->field_type('status', 'dropdown', array('Menikah' => 'Menikah', 'Belum Menikah' => 'Belum Menikah'));
$crud->field_type('pekerjaan', 'dropdown', array('Pegawai Negeri' => 'Pegawai Negeri', 'Wiraswasta' => 'Wiraswasta', 'Karyawan Swasta' => 'Karyawan Swasta', 'Mahasiswa' => 'Mahasiswa', 'Ibu Rumah Tangga' => 'Ibu Rumah Tangga', 'Pensiunan' => 'Pensiunan', 'Lainnya' => 'Lainnya'));
//Aturan Pengisian Form
$crud->required_fields('namaPasien', 'umur', 'tanggalLahir', 'jenisKelamin', 'status', 'alamat', 'pekerjaan');
$crud->set_rules('umur', 'Umur', array('required', 'max_length[2]', 'numeric'));
$crud->set_rules('no_telp', 'Nomor Telepon', 'numeric');
$crud->set_language("indonesian");
//Cetak Tabel
$output = $crud->render();
$this->_example_output($output);
}
示例4: index
public function index($categoryid = 0)
{
$session_data = $this->session->userdata('logged_in');
$data['username'] = $session_data['username'];
$data['cat_id'] = $categoryid;
// $form_subject = ($categoryid==0 ? "Category" : "Sub Category");
if ($categoryid == 0) {
$form_subject = "Category";
$data['cat_title'] = "Categories";
} else {
$this->category->getTitle($categoryid);
$data['cat_title'] = $this->category->getTitle($categoryid) . " - Sub Categories";
$form_subject = "Sub Category";
}
$crud = new grocery_CRUD();
$crud->set_table('dbx_categories');
$crud->where('pid', $categoryid);
$crud->set_subject($form_subject);
$crud->required_fields('title');
$crud->columns('title');
$crud->callback_column('title', array($this, 'link_title'));
$crud->set_rules('title', 'Title', 'trim|required|xss_clean|is_unique[dbx_categories.title]');
$crud->add_action('Sub Categories', '', '', 'cat-icon', array($this, 'goto_sub'));
$crud->fields('title', 'desc', 'published', 'type', 'pid', 'ownerid', 'created_date');
$crud->field_type('pid', 'hidden', $categoryid);
$crud->field_type('published', 'dropdown', array('0' => 'No', '1' => 'Yes'));
$crud->field_type('type', 'dropdown', array('C' => 'Celebrity', 'M' => 'Movie', 'P' => 'Parent'));
$crud->change_field_type('ownerid', 'invisible');
$crud->change_field_type('created_date', 'invisible');
$crud->callback_before_insert(array($this, 'before_insert'));
$output = $crud->render($data);
$this->load->view('header_view', $data);
$this->load->view('categories_view', $output);
$this->load->view('footer_view', $data);
}
示例5: 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());
}
}
示例6: 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();
}
示例7:
function designation_management()
{
$crud = new grocery_CRUD();
$crud->set_table('designation_master');
$crud->set_subject('Designation');
$crud->columns('designation', 'status');
$crud->fields('designation', 'status');
$crud->required_fields('designation');
$output = $crud->render(array('name' => 'Designation Management'));
$this->_example_output($output);
}
示例8: resources
public function resources()
{
$this->data['page_title'] = 'Resources';
$crud = new grocery_CRUD();
$crud->set_table('resources');
$crud->set_subject('Resources ');
$crud->fields('ResourceType', 'ResourceTitle', 'ResourceDetail');
$crud->required_fields('ResourceType', 'ResourceTitle', 'ResourceTitle');
$crud->field_type('LastUpdate', 'hidden');
$this->data['output'] = $crud->render();
$this->render('admin/crud_view');
}
示例9: usuarios
public function usuarios()
{
$crud = new grocery_CRUD();
$crud->set_table("usuarios");
$crud->columns("nombre", "clave", "email", "idrol");
$crud->fields("nombre", "clave", "email", "idrol");
$crud->set_relation("idrol", "roles", "descripcion");
$crud->display_as("idrol", "Rol");
$crud->field_type("clave", "password");
$crud->required_fields("nombre", "clave", "email");
$crud->callback_before_insert(array($this, "encrypt_password_callback"));
return $crud->render();
}
示例10: index
public function index()
{
$arr['page'] = 'admnovedades';
$crud = new grocery_CRUD();
$crud->set_table('novedades');
$crud->columns('titulo', 'mostrar', 'texto', 'imagen');
$crud->fields('titulo', 'mostrar', 'imagen', 'texto');
$crud->required_fields('titulo', 'mostrar', 'texto');
$crud->set_field_upload('imagen', 'assets/uploads/images');
$output = $crud->render();
$arr['output'] = $output;
$this->load->view('admin/vwManageCMS', $arr);
}
示例11: index
public function index()
{
$arr['page'] = 'admpromociones';
$crud = new grocery_CRUD();
$crud->set_table('promociones');
$crud->columns('titulo', 'mostrar', 'precio_anterior', 'precio_actual', 'imagen', 'limite');
$crud->fields('titulo', 'mostrar', 'imagen', 'descripcion', 'precio_anterior', 'precio_actual', 'limite');
$crud->required_fields('titulo', 'mostrar', 'descripcion', 'precio_anterior', 'precio_actual');
$crud->set_field_upload('imagen', 'assets/uploads/images');
$output = $crud->render();
$arr['output'] = $output;
$this->load->view('admin/vwManageCMS', $arr);
}
示例12: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_table('pages');
$crud->columns('title', 'content', 'publish', 'view');
$crud->required_fields('title', 'content', 'publish');
$crud->fields('title', 'content', 'publish');
$crud->set_subject('Static Pages');
$output = $crud->render();
$data['subject'] = 'Static Pages';
$data['content'] = $this->load->view('crud.php', $output, true);
$this->load->view('base_theme', $data);
}
示例13: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_table('news');
$crud->columns('title', 'date_publish', 'author', 'publish', 'viewer');
$crud->required_fields('title', 'date_publish', 'content', 'author', 'publish');
$crud->fields('title', 'date_publish', 'thumb', 'content', 'author', 'publish');
$crud->set_field_upload('thumb', 'assets/uploads/news');
$crud->set_subject('IM News');
$output = $crud->render();
$data['subject'] = 'IM News';
$data['content'] = $this->load->view('crud.php', $output, true);
$this->load->view('base_theme', $data);
}
示例14: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_table('slider');
$crud->columns('img_slider', 'subject', 'deskripsi', 'publish');
$crud->required_fields('img_slider', 'publish');
$crud->set_subject('Images Slider');
$crud->fields('subject', 'deskripsi', 'img_slider', 'publish');
$crud->set_field_upload('img_slider', 'assets/uploads/img_slider');
$output = $crud->render();
$data['subject'] = 'Images SLider';
$data['content'] = $this->load->view('crud.php', $output, true);
$this->load->view('base_theme', $data);
}
示例15: index
public function index($categoryid = 0)
{
$session_data = $this->session->userdata('logged_in');
$data['username'] = $session_data['username'];
$data['lo'] = 2;
//value used to identify section movie or celebrity
$data['categoryid'] = $categoryid;
//value used to identify section movie or celebrity
if ($categoryid != 0) {
$data['cat_id'] = $categoryid;
$cat_title = $this->category->getTitle($categoryid);
$data['cat_title'] = $cat_title . " - Movies";
$form_subject = $cat_title;
$crud = new grocery_CRUD();
$crud->set_table('dbx_movies');
$crud->where('catid', $categoryid);
$crud->set_subject('Movie');
$crud->required_fields('title', 'year');
$crud->columns('title');
// $crud->callback_column('name',array($this,'link_title'));
// $crud->set_rules('title','Title','trim|required|xss_clean|is_unique[dbx_categories.title]');
$crud->add_action('Large Image', '', '', 'custom_icon limg-icon img_crop', array($this, 'set_imgurl'));
$crud->add_action('Small Image', '', '', 'custom_icon simg-icon img_crop', array($this, 'set_imgurl'));
$crud->fields('catid', 'title', 'year', 'release_date', 'cast', 'director', 'producer', 'music', 'writer', 'lyrics', 'synopsis', 'seo_url', 'ownerid', 'created_date', 'lastupdate_date');
// $crud->field_type('catid', 'hidden', $categoryid);
$crud->set_relation('catid', 'dbx_categories', 'title', array('type' => 'M'), null, $categoryid);
$crud->display_as('catid', 'Category');
//
$crud->callback_add_field('cast', array($this, 'add_field_cast'));
$crud->callback_add_field('synopsis', array($this, 'add_field_synopsis'));
$crud->callback_edit_field('cast', array($this, 'edit_field_cast'));
$crud->callback_edit_field('synopsis', array($this, 'edit_field_synopsis'));
$crud->change_field_type('ownerid', 'invisible');
$crud->change_field_type('created_date', 'invisible');
$crud->change_field_type('seo_url', 'invisible');
$crud->change_field_type('lastupdate_date', 'invisible');
$crud->callback_before_insert(array($this, 'before_insert'));
$crud->callback_before_update(array($this, 'before_update'));
$crud->callback_after_insert(array($this, 'after_insert'));
$crud->unset_jquery();
$state = $crud->getState();
// echo($state);
$data['state'] = $state;
$output = $crud->render($data);
$this->load->view('header_view', $data);
$this->load->view('movies_view', $output);
$this->load->view('footer_view', $data);
}
}