本文整理汇总了PHP中grocery_CRUD::callback_insert方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::callback_insert方法的具体用法?PHP grocery_CRUD::callback_insert怎么用?PHP grocery_CRUD::callback_insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::callback_insert方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: crud
public function crud()
{
$crud = new grocery_CRUD();
$crud->set_theme(THEMA_CRUD);
$crud->set_table('quadra');
$crud->set_subject('Quadra');
//@todo$crud->where('situacao_id', 2); //apenas ativos
$crud->required_fields('descricao', 'tipo_quadra_id', '');
$crud->columns('id', 'descricao', 'tipo_quadra_id', 'situacao_quadra_id');
$crud->edit_fields('descricao', 'tipo_quadra_id', 'situacao_quadra_id');
$crud->add_fields('descricao', 'tipo_quadra_id', 'situacao_quadra_id');
//relacionamentos
$crud->set_relation('situacao_quadra_id', 'situacao_quadra', 'descricao');
$crud->set_relation('tipo_quadra_id', 'tipo_quadra', 'descricao');
$crud->callback_insert(array($this, 'create'));
$crud->callback_delete(array($this, 'delete'));
$contents = $crud->render();
$this->template->set('titulo', 'Manter Quadra');
$this->template->set('subtitle', 'Quadra');
$this->template->load('template_teste', 'crudpage', $contents);
}
示例2: users
public function users()
{
$crud = new grocery_CRUD();
$crud->set_table('users');
$crud->set_subject('Users');
$crud->columns('username', 'email', 'groups', 'active');
if ($this->uri->segment(3) !== 'read') {
$crud->add_fields('username', 'first_name', 'last_name', 'email', 'phone', 'groups', 'password', 'password_confirm');
$crud->edit_fields('username', 'first_name', 'last_name', 'email', 'phone', 'groups', 'last_login', 'old_password', 'new_password');
} else {
$crud->set_read_fields('username', 'first_name', 'last_name', 'email', 'phone', 'groups', 'last_login');
}
$crud->set_relation_n_n('groups', 'users_groups', 'groups', 'user_id', 'group_id', 'name');
//VALIDATION
$crud->required_fields('username', 'first_name', 'last_name', 'email', 'phone', 'password', 'password_confirm');
$crud->set_rules('email', 'E-mail', 'required|valid_email');
$crud->set_rules('phone', 'Phone', 'required|numeric');
$crud->set_rules('password', 'Password', 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
$crud->set_rules('new_password', 'New password', 'min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']');
//FIELD TYPES
$crud->change_field_type('last_login', 'readonly');
$crud->change_field_type('password', 'password');
$crud->change_field_type('password_confirm', 'password');
$crud->change_field_type('old_password', 'password');
$crud->change_field_type('new_password', 'password');
//CALLBACKS
$crud->callback_insert(array($this, 'create_user_callback'));
$crud->callback_update(array($this, 'edit_user_callback'));
$crud->callback_field('last_login', array($this, 'last_login_callback'));
$crud->callback_column('active', array($this, 'active_callback'));
//VIEW
$output = $crud->render();
$data['judul'] = 'Users';
$data['crumb'] = array('Users' => '');
$template = 'admin_template';
$view = 'grocery';
$this->outputview->output_admin($view, $template, $data, $output);
}
示例3: crud
public function crud()
{
$crud = new grocery_CRUD();
$crud->set_theme(THEMA_CRUD);
$crud->set_table('usuario');
$crud->set_subject('Usuarios');
$crud->required_fields('nome', 'login', 'email', 'tipo_usuario_id', 'situacao_id');
$crud->columns('nome', 'login', 'email', 'tipo_usuario_id', 'situacao_id');
$crud->edit_fields('nome', 'login', 'email', 'tipo_usuario_id', 'situacao_id');
$crud->add_fields('nome', 'login', 'email', 'tipo_usuario_id');
$crud->set_relation('tipo_usuario_id', 'tipo_usuario', 'descricao');
$crud->set_relation('situacao_id', 'situacao', 'descricao');
$crud->callback_insert(array($this, 'create'));
$crud->callback_delete(array($this, 'delete'));
$crud->callback_update(array($this, 'update'));
$crud->where('situacao_id', 1);
$crud->or_where('situacao_id', 2);
$contents = $crud->render();
// $this->load->view('template_crud', $contents);
$this->template->set('titulo', 'Manter Usuário');
$this->template->set('subtitle', 'Usuário');
// nome do template , nome da view
$this->template->load('template_teste', 'crudpage', $contents);
}
示例4: array
function supervisor_management()
{
$id = $this->ion_auth->user()->row()->id;
$this->load->library('grocery_CRUD');
try {
$crud = new grocery_CRUD();
$this->load->library('user_agent');
if ($this->agent->is_mobile() && $this->agent->is_tablet() === FALSE) {
$crud->set_theme('bootstrap');
$crud->unset_search();
} else {
$crud->set_theme('datatables');
//datatables, flexigrid, bootstrap
}
$crud->set_table('users');
$crud->set_subject('Supervisor');
$crud->columns('username', 'password_visible', 'su_branch_id', 'su_can_uploadhotdeal');
$crud->required_fields('username', 'password_visible', 'su_branch_id');
$crud->fields('username', 'password_visible', 'su_branch_id', 'su_can_uploadhotdeal');
$crud->display_as('password_visible', 'Password');
$crud->display_as('su_branch_id', 'Branch');
$crud->display_as('su_can_uploadhotdeal', 'Able to upload food & beverage');
$crud->callback_add_field('su_branch_id', array($this, '_selected_branch_callback'));
//For add page set pre-selected value if got pass in brach id
$crud->field_type('su_branch_id', 'dropdown', $this->ion_auth->get_merchant_branch_list($id));
//For view show the branch list text
$crud->callback_insert(array($this, 'supervisor_insert_callback'));
$crud->callback_update(array($this, 'supervisor_update_callback'));
$crud->set_rules('username', 'Username', 'trim|required|callback_supervisor_username_check');
$crud->field_type('su_can_uploadhotdeal', 'true_false');
$controller = 'merchant';
$function = 'profile';
$crud->set_lang_string('insert_success_message', 'Your data has been successfully stored into the database.
<script type="text/javascript">
var originallocation = window.location.pathname;
if(originallocation.indexOf("/supervisor/add") > -1)
{
window.location = "' . site_url($controller . '/' . $function) . '";
}
</script>
<div style="display:none">
');
$crud->set_lang_string('update_success_message', 'Your data has been successfully stored into the database.
<script type="text/javascript">
var originallocation = window.location.pathname;
if(originallocation.indexOf("/supervisor/edit") > -1)
{
window.location = "' . site_url($controller . '/' . $function) . '";
}
</script>
<div style="display:none">
');
$crud->set_lang_string('form_save_and_go_back', 'Save and View Supervisor');
$crud->set_lang_string('form_update_and_go_back', 'Update and View Supervisor');
$crud->unset_export();
$crud->unset_print();
$crud->unset_read();
$state = $crud->getState();
//filter that this is supervisor type user and it is under this merchant
$crud->where('su_merchant_id', $id);
$crud->where('main_group_id', $this->group_id_supervisor);
$output = $crud->render();
return $output;
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例5: notificacionAutoriza
public function notificacionAutoriza()
{
if ($this->session->userdata('nivel') != 5 or $this->session->userdata('institucion') != 'A') {
$this->session->set_flashdata('error', 'Su nivel de usuario no le permite realizar este proceso');
redirect(site_url("index/principal"), 301);
}
switch ($this->session->userdata('nivel')) {
case 5:
$anio = array();
for ($i = 2010; $i <= date("Y"); $i++) {
$anio[$i] = $i;
}
$semana = array();
for ($i = 1; $i <= 53; $i++) {
$semana[$i] = $i;
}
$sub = $this->frontend_model->mostrarDiresa($this->session->userdata('diresa'));
$subr = array();
foreach ($sub as $dato) {
$subr[$dato->codigo] = $dato->nombre;
}
$tipo = array('1' => 'Autorizado', '2' => 'No autorizado');
$crud = new grocery_CRUD();
$crud->columns('ano', 'semana', 'diresa', 'estado', 'fecha', 'hora', 'usuario');
$crud->set_table('autoriza');
$crud->set_subject('Autorización');
$where = array('diresa' => $this->session->userdata('diresa'));
$crud->fields('ano', 'semana', 'diresa', 'estado');
$crud->display_as('ano', 'Año');
$crud->field_type('ano', 'dropdown', $anio);
$crud->field_type('semana', 'dropdown', $semana);
$crud->field_type('diresa', 'dropdown', $subr);
$crud->field_type('estado', 'dropdown', $tipo);
$crud->required_fields('diresa', 'ano', 'semana', 'estado');
$crud->where($where);
$crud->order_by('ano, semana', 'DESC');
$crud->callback_insert(array($this, 'autorizar'));
$output = $crud->render();
$this->_example_output3($output);
break;
default:
$this->session->set_flashdata('error', 'Este proceso no está permitido para su nivel de usuario');
redirect(site_url("index/principal"), 301);
break;
}
}
示例6: room_residents
public function room_residents($primary_key)
{
$crud = new grocery_CRUD();
$crud->where('room_resident.room_id', $primary_key);
$crud->set_subject('Resident');
$crud->set_table('room_resident');
$crud->set_relation('room_id', 'room', '{room_name}');
$crud->set_relation('resident_id', 'resident', '{resident_othernames} {resident_surname}');
$crud->required_fields('resident_id');
$crud->unset_columns('room_resident_priority');
$crud->unset_fields('room_resident_date', 'room_resident_priority', 'room_resident_status', 'room_resident_date_released');
$crud->display_as('room_resident_date', 'Date Added');
$crud->display_as('room_resident_date_released', 'Date Released');
$crud->display_as('resident_id', 'Resident');
$crud->display_as('room_id', 'Room');
$crud->display_as('room_resident_status', 'Status');
$crud->callback_column('room_resident_status', array($this, 'callback_status'));
//$crud->add_action('Residents', base_url().'img/icons/icon-48-groups-add.png', 'front_office/room_details/'.$_SESSION['navigation_id'].'/'.$_SESSION['sub_navigation_id']);
$crud->callback_insert(array($this, 'check_room_capacity'));
$crud->field_type('room_id', 'hidden', $primary_key);
$crud->unset_edit();
$output = $crud->render();
$this->_example_output3($output);
}