当前位置: 首页>>代码示例>>PHP>>正文


PHP grocery_CRUD::getState方法代码示例

本文整理汇总了PHP中grocery_CRUD::getState方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::getState方法的具体用法?PHP grocery_CRUD::getState怎么用?PHP grocery_CRUD::getState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在grocery_CRUD的用法示例。


在下文中一共展示了grocery_CRUD::getState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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();
 }
开发者ID:BitmanNL,项目名称:traffictower-cms,代码行数:57,代码来源:TT_user.php

示例2: 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_ordertracking');
     $crud->set_subject('Sales Tracking');
     $crud->required_fields('NAME');
     $crud->columns('ordertrackingid', 'orderid', 'name', 'orderdate');
     // $crud->columns('fullfillment','orderdate','orderid','returnid','itemrece','caseid','product','status');
     //$crud->fields('ordertrackingid','orderid','name','orderdate');
     $crud->callback_column('ordertrackingid', array($this, '_callback_webpage_url'));
     $crud->callback_column('orderdate', array($this, '_callback_dateformat'));
     // $crud->fields('NAME');
     // $crud->unset_add();
     $crud->unset_edit();
     $crud->unset_delete();
     // $crud->callback_after_insert(array($this, 'fullfillmentid_generation'));
     $output = $crud->render();
     $state = $crud->getState();
     if ($state == 'add') {
         redirect('store/addtracking');
     }
     // $this->grocery_crud->set_table('ips_login');
     // $output = $this->grocery_crud->render();
     $this->_example_output($output);
 }
开发者ID:selva316,项目名称:trackingtool,代码行数:30,代码来源:managingtrack.php

示例3: configuracion

 function configuracion()
 {
     $crud = new grocery_CRUD();
     $crud->set_table('usuarios');
     $crud->set_theme('datatables');
     $crud->set_language('spanish');
     $crud->set_subject('Usuario');
     $state = $crud->getState();
     $state_info = $crud->getStateInfo();
     if ($state == 'list' || $state == 'success') {
         redirect('user/dashboard');
     } else {
         $crud->unset_add();
         $crud->unset_delete();
         $crud->field_type('usuario', 'readonly');
         $crud->field_type('clave', 'password');
         $crud->field_type('id_cliente', 'hidden');
         $crud->field_type('id_nivel', 'hidden');
         $crud->field_type('row_id', 'hidden');
         $crud->field_type('id_estatus', 'hidden');
         $crud->set_field_upload('foto', 'assets/uploads/users/');
         $output = $crud->render();
         $data['titulo'] = "CONFIGURACION DE USUARIO";
         $this->load->view('include/head', $output);
         $this->load->view('include/header', $data);
         $this->load->view('admin/output');
         $this->load->view('include/footer', $data);
         $this->load->view('admin/librerias');
     }
 }
开发者ID:Juchiha,项目名称:mandala,代码行数:30,代码来源:user.php

示例4: perfil

 function perfil()
 {
     $crud = new grocery_CRUD();
     $crud->where('row_id', $this->session->userdata('user_id'));
     $crud->set_table('usuarios');
     $crud->set_theme('datatables');
     $crud->set_language('spanish');
     $crud->set_subject('Usuario');
     $state = $crud->getState();
     if ($state == 'list' || $state == 'success') {
         redirect('user/dashboard');
     } else {
         $crud->unset_add();
         $crud->unset_delete();
         $crud->field_type('usuario', 'readonly');
         $crud->field_type('clave', 'password');
         $crud->field_type('id_nivel', 'hidden');
         $crud->field_type('row_id', 'hidden');
         $crud->field_type('id_estatus', 'hidden');
         $crud->set_field_upload('foto', 'assets/uploads/users/');
         $output = $crud->render();
         $data['titulo'] = "Configuración de Usuario";
         $this->load->view('include/head');
         $this->load->view('include/header');
         $this->load->view('include/sidebar');
         $this->load->view('admin/main', $data);
         $this->load->view('admin/grocery_crud', $output);
         $this->load->view('include/footer');
     }
 }
开发者ID:scortina,项目名称:kolor,代码行数:30,代码来源:user.php

示例5: index

 public function index()
 {
     $crud = new grocery_CRUD();
     $crud->set_theme('flexigrid');
     $crud->set_table('hotels');
     $crud->set_subject('Hotels');
     $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);
     //var_dump($agents);
     //        $crud->set_relation('hotel_agent_id', 'io_users', '{first_name} {last_name}', array('active' => 1));
     $crud->display_as('hotel_agent_id', 'Agent Name');
     $crud->display_as('hotel_name', 'Hotel Name');
     $crud->display_as('hotel_rooms', 'Rooms');
     $crud->display_as('hotel_tariffs', 'Tariffs');
     $crud->display_as('hotel_country', 'Country');
     $crud->display_as('hotel_city', 'City');
     $crud->display_as('hotel_street', 'Street');
     $crud->display_as('hotel_state', 'State');
     $crud->display_as('hotel_postCode', 'PostCode');
     $crud->display_as('hotel_phoneNumber', 'Phone Number');
     $crud->display_as('hotel_emailId', 'Email ID');
     $crud->display_as('hotel_website', 'Website');
     $crud->display_as('hotel_facebook', 'Facebook');
     $crud->display_as('hotel_googleMap', 'Google Map');
     $crud->display_as('hotel_related', 'Related Hotels');
     $crud->display_as('hotel_status', 'Status');
     $crud->columns('hotel_name', 'hotel_agent_id', 'hotel_phoneNumber', 'hotel_website', 'hotel_facebook', 'hotel_googleMap', 'hotel_status');
     $crud->required_fields('hotel_agent_id');
     $crud->field_type('hotel_stars', 'dropdown', range(0, 5));
     /*
      * For related hotels
      * on add list all the hotels
      * on edit, list all except own name
      */
     $hrf = array();
     if ($crud->getState() == 'edit') {
         $hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1, 'hotel_id !=' => $crud->getStateInfo()->primary_key), 'hotel_id');
     } else {
         $hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1), 'hotel_id');
     }
     $hrf = $this->generic_model->array_from_db($hrf, 'hotel_id, hotel_name');
     $crud->field_type('hotel_related', 'multiselect', $hrf);
     $crud->callback_column('hotel_image', array($this, 'set_image'));
     $crud->set_field_upload('hotel_image', $this->upload_path);
     $hf = $this->generic_model->get_by('hotel_facilities', array('hf_status' => 1), 'hf_id');
     $hf = $this->generic_model->array_from_db($hf, 'hf_id, hf_facility');
     $crud->field_type('hotel_facilities', 'multiselect', $hf);
     $hrf = $this->generic_model->get_by('hotel_room_facilities', array('hrf_status' => 1), 'hrf_id');
     $hrf = $this->generic_model->array_from_db($hrf, 'hrf_id, hrf_facility');
     $crud->field_type('hotel_room_facilities', 'multiselect', $hrf);
     $crud->unique_fields('hotel_slug');
     $crud->add_action('Photo Gallery', '', 'hotels/gallery', 'ui-icon ui-icon-image');
     $output = $crud->render();
     $data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Hotels', 'pagedesc' => 'Hotels', 'contenttitle' => 'Hotels List Records');
     $this->load->view('gc_admin_wrapper', $data);
 }
开发者ID:beingjungshahi,项目名称:theexcursionnepal,代码行数:58,代码来源:hotels.php

示例6: index

 public function index()
 {
     $crud = new grocery_CRUD();
     $crud->set_theme('flexigrid');
     $crud->set_table('hotels');
     $crud->set_subject('Hotels');
     //        $crud->set_relation('hotel_agent_id', 'io_users', '{first_name} {last_name}');
     $agent_id = $this->ion_auth->user()->row()->id;
     $crud->where('hotel_agent_id', $agent_id);
     $crud->field_type('hotel_agent_id', 'hidden', $agent_id);
     //        $crud->display_as('hotel_agent_id', 'Agent Name');
     $crud->display_as('hotel_name', 'Hotel Name');
     $crud->display_as('hotel_rooms', 'rooms');
     $crud->display_as('hotel_tariffs', 'tariffs');
     $crud->display_as('hotel_country', 'Country');
     $crud->display_as('hotel_city', 'City');
     $crud->display_as('hotel_street', 'Street');
     $crud->display_as('hotel_state', 'State');
     $crud->display_as('hotel_postCode', 'PostCode');
     $crud->display_as('hotel_phoneNumber', 'Phone Number');
     $crud->display_as('hotel_emailId', 'Email ID');
     $crud->display_as('hotel_website', 'Website');
     $crud->display_as('hotel_facebook', 'Facebook');
     $crud->display_as('hotel_googleMap', 'GoogleMap');
     $crud->display_as('hotel_status', 'Status');
     $crud->columns('hotel_name', 'hotel_phoneNumber', 'hotel_website', 'hotel_facebook', 'hotel_googleMap', 'hotel_status');
     $crud->callback_column('hotel_image', array($this, 'set_image'));
     $crud->set_field_upload('hotel_image', $this->upload_path);
     /*
      * For related hotels
      * on add list all the hotels
      * on edit, list all except own name
      */
     if ($crud->getState() == 'edit') {
         $hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1, 'hotel_agent_id' => $this->ion_auth->get_user_id(), 'hotel_id !=' => $crud->getStateInfo()->primary_key), 'hotel_id');
     } else {
         $hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1, 'hotel_agent_id' => $this->ion_auth->get_user_id()), 'hotel_id');
     }
     // empty data for multiselect field generates error
     if (empty($hrf)) {
         $hrf = array('');
     } else {
         $hrf = $this->generic_model->array_from_db($hrf, 'hotel_id, hotel_name');
     }
     $crud->field_type('hotel_related', 'multiselect', $hrf);
     $hf = $this->generic_model->get_by('hotel_facilities', array('hf_status' => 1), 'hf_id');
     $hf = $this->generic_model->array_from_db($hf, 'hf_id, hf_facility');
     $crud->field_type('hotel_facilities', 'multiselect', $hf);
     $hrf = $this->generic_model->get_by('hotel_room_facilities', array('hrf_status' => 1), 'hrf_id');
     $hrf = $this->generic_model->array_from_db($hrf, 'hrf_id, hrf_facility');
     $crud->field_type('hotel_room_facilities', 'multiselect', $hrf);
     $crud->add_action('Photo Gallery', '', 'agents/hotels/gallery', 'ui-icon ui-icon-image');
     $output = $crud->render();
     $data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Hotels', 'pagedesc' => 'Hotels', 'contenttitle' => 'Hotels List Records', 'left_menu' => 'agents_menu');
     $this->load->view('gc_admin_wrapper', $data);
 }
开发者ID:beingjungshahi,项目名称:theexcursionnepal,代码行数:56,代码来源:hotels.php

示例7: 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);
     }
 }
开发者ID:sali141,项目名称:bportal,代码行数:49,代码来源:movies.php

示例8: placing

 public function placing()
 {
     $crud = new grocery_CRUD();
     $state = $crud->getState();
     if ($state == 'add') {
         $productField = $this->ModWarehouse->getProductOnlyForDropdown();
         $crud->field_type('id_product', 'dropdown', $productField);
     } else {
         $crud->set_relation('id_product', 'product', 'name');
     }
     $crud->set_table('warehouse_rack_detail')->display_as('id_rack', 'Nama Rak')->display_as('id_product', 'Nama Produk')->display_as('stock', 'Stok')->display_as('satuan', 'Produk Satuan')->columns('id_rack', 'parent', 'id_product', 'satuan', 'stock')->set_relation('id_rack', 'warehouse_rack', 'name')->unset_add_fields('parent', 'total')->unset_edit_fields('parent', 'total')->callback_column('stock', array($this, 'addProductStockColumn'))->callback_column('satuan', array($this, 'setProdukSatuan'))->callback_column('parent', array($this, 'setParentRack'))->required_fields('id_rack', 'id_product')->callback_edit_field('id_product', array($this, 'setProductField'))->unset_read();
     $output = $crud->render();
     //        $this->render($output);
     $this->parser->parse('placing.tpl', $output);
 }
开发者ID:ibnoe,项目名称:medikasarana,代码行数:15,代码来源:Warehouse.php

示例9: index

 public function index($log_type = NULL)
 {
     $this->load->model('shared/log_model');
     $this->config->load('grocery_crud');
     $this->config->set_item('grocery_crud_character_limiter', 0);
     $crud = new grocery_CRUD();
     if ($crud->getState() == 'list') {
         // get all known log types
         $log_types = $this->log_model->get_log_types();
         $this->views['content'] = $this->load->view('admin/log/action_selector', array('log_types' => $log_types, 'selected_log_type' => $log_type), TRUE);
         $this->javascript[] = $this->load->view('admin/log/js/action_selector.js', NULL, TRUE);
     }
     if (!is_null($log_type) && $log_type != 'ajax_list' && $log_type != 'export' && $log_type != 'print' && $log_type != 'ajax_list_info') {
         $crud->where(array('action' => $log_type));
         $crud->unset_columns('action');
     }
     $crud->set_theme('bootstrap');
     $crud->set_table('log');
     $crud->set_subject('Logs');
     // Op twee velden orderen. Grocerycrud houd zich niet aan de Codeigniter active record
     // maar dit werkt.
     $crud->order_by('date_created desc, id', 'desc');
     $crud->columns('date_created', 'action', 'message', 'user_id');
     $crud->set_relation('user_id', 'user', 'screen_name');
     $crud->display_as('user_id', 'Gebruiker');
     $crud->display_as('date_created', 'Tijd');
     $crud->display_as('action', 'Actie');
     $crud->display_as('message', 'Bericht');
     $crud->display_as('ip_hash', 'IP-hash');
     $crud->unset_add();
     $crud->unset_edit();
     $crud->unset_delete();
     // 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();
     if (isset($this->views['content'])) {
         $this->views['content'] .= $crud_output->output;
     } else {
         $this->views['content'] = $crud_output->output;
     }
     $this->_layout();
 }
开发者ID:BitmanNL,项目名称:traffictower-cms,代码行数:44,代码来源:TT_log.php

示例10: 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);
 }
开发者ID:selva316,项目名称:trackingtool,代码行数:40,代码来源:homepage.php

示例11: administracion

 function administracion($ID = NULL)
 {
     if (!$this->tank_auth->is_logged_in()) {
         redirect('/auth/login/');
     }
     try {
         /* Creamos el objeto */
         $crud = new grocery_CRUD();
         /* Seleccionamos el tema */
         $crud->set_theme('flexigrid');
         /* Seleccionmos el nombre de la tabla de nuestra base de datos*/
         $crud->set_table('beneficiary');
         /* Le asignamos un nombre */
         $crud->set_subject('Beneficiario');
         /* Asignamos el idioma español */
         $crud->set_language('spanish');
         $state = $crud->getState();
         switch ($state) {
             case 'success':
                 if ($ID != NULL && $ID != 'success') {
                     //echo "success ID = " . $ID . ", state = " . $state;
                     $crud->where('ProductID', $ID);
                 }
                 break;
             case 'list':
                 if ($ID != NULL) {
                     //echo "list ID = " . $ID . ", state = " . $state;
                     $crud->where('ProductID', $ID);
                 }
                 break;
             case 'add':
                 if ($ID != "add") {
                     $crud->field_type('ProductID', 'hidden', $ID);
                 } else {
                     $crud->set_relation('ProductID', 'product', 'ProductID');
                 }
                 //echo "add ID = " . $ID . ", state = " . $state;
                 break;
             default:
                 //echo "default ID = " . $ID . ", state = " . $state;
                 $crud->set_relation('ProductID', 'product', 'ProductID');
         }
         /* Aqui le decimos a grocery que estos campos son obligatorios */
         $crud->required_fields('BeneficiaryID', 'ProductID', 'Name', 'Lastname', 'IdentType', 'Ident', 'BirthDate', 'Address', 'City');
         /* Aqui le indicamos que campos deseamos mostrar */
         $crud->columns('BeneficiaryID', 'ProductID', 'Name', 'Lastname', 'IdentType', 'Ident', 'BirthDate', 'Address', 'City', 'Phone1', 'Phone2', 'Phone3', 'Mail', 'Facebook', 'Twitter', 'Facebook', 'Skype', 'Company');
         $crud->display_as('BeneficiaryID', 'ID');
         $crud->display_as('ProductID', 'ID Producto');
         $crud->display_as('Name', 'Nombre');
         $crud->display_as('Lastname', 'Apellido');
         $crud->display_as('IdentType', 'Tipo Identificaci&oacuten');
         $crud->display_as('Ident', 'Identificaci&oacuten');
         $crud->display_as('BirthDate', 'Fecha Nacimiento');
         $crud->display_as('Address', 'Direcci&oacuten');
         $crud->display_as('City', 'Ciudad');
         $crud->display_as('Phone1', 'Tel&eacutefono 1');
         $crud->display_as('Phone2', 'Tel&eacutefono 2');
         $crud->display_as('Phone3', 'Tel&eacutefono 3');
         $crud->display_as('Company', 'Empresa');
         /* Generamos la tabla */
         $output = $crud->render();
         /* La cargamos en la vista situada en */
         $this->load->view('Beneficiary/administracion', $output);
     } catch (Exception $e) {
         /* Si algo sale mal cachamos el error y lo mostramos */
         show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
     }
 }
开发者ID:aloewens,项目名称:vacan,代码行数:68,代码来源:Beneficiary.php

示例12: foreach

 function _callback_province($value, $primarykey)
 {
     $html = '<link type="text/css" rel="stylesheet" href="' . base_url() . '/assets/grocery_crud/css/jquery_plugins/chosen/chosen.css" />';
     $html .= '<script src="' . base_url() . '/assets/grocery_crud/js/jquery_plugins/jquery.chosen.min.js"></script>';
     $html .= '<script src="' . base_url() . '/assets/grocery_crud/js/jquery_plugins/config/jquery.chosen.config.js"></script>';
     $empty_select = '<select name="province" class="chosen-select" data-placeholder="Select Province" style="width: 300px; display: none;">';
     $empty_select_closed = '</select>';
     $province = null;
     $listingID = null;
     $crud = new grocery_CRUD();
     $state = $crud->getState();
     //CHECK FOR A URI VALUE AND MAKE SURE ITS ON THE EDIT STATE
     if ($state == 'edit') {
         $state_info = $crud->getStateInfo();
         $listingID = $state_info->primary_key;
         $placeID = $this->shared_model->get_place_id($listingID, 'crop_history', 'crophist_id');
         $data = $this->shared_model->get_by_place_id($placeID);
         $province = $data->province;
     }
     $empty_select .= '<option value=""></option>';
     $db = $this->shared_model->get_province();
     //APPEND THE OPTION FIELDS WITH VALUES FROM THE STATES PER THE COUNTRY ID
     foreach ($db->result() as $row) {
         if ($row->province == $province) {
             $empty_select .= '<option value="' . $row->province . '" selected="selected">' . $row->province . '</option>';
         } else {
             $empty_select .= '<option value="' . $row->province . '">' . $row->province . '</option>';
         }
     }
     //RETURN SELECTION COMBO
     return $html . $empty_select . $empty_select_closed;
 }
开发者ID:louiej,项目名称:lidar2,代码行数:32,代码来源:terrestrial.php

示例13: email_configuration

 public function email_configuration()
 {
     try {
         $crud = new grocery_CRUD();
         $state = $crud->getState();
         $crud->set_table('tbl_email_konfigurasi');
         $crud->set_subject('Konfigurasi Email');
         $crud->fields('useragent', 'protocol', 'mailpath', 'smtp_host', 'smtp_user', 'name', 'smtp_pass', 'smtp_port', 'smtp_timeout', 'smtp_crypto', 'wordwrap', 'wrapchars', 'mailtype', 'charset', 'validate', 'priority', 'crlf', 'newline', 'bcc_batch_mode', 'bcc_batch_size');
         $crud->columns('smtp_host', 'smtp_user', 'name');
         $crud->unset_read();
         $sitemap = $this->get_sitemap();
         $output = $crud->render($sitemap);
         $this->load->view('theme/theme_default', $output);
     } catch (Execption $e) {
         show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
     }
 }
开发者ID:selametsubu,项目名称:e-ppid,代码行数:17,代码来源:admin.php

示例14: foreach

 function empty_subcategoria_select()
 {
     $empty_select = '<select name="IdSubcategoria" class="chosen-select" data-placeholder="Seleccione SubCategor&iacute;a">';
     $empty_select_closed = '</select>';
     $listingID = $this->uri->segment(4);
     $crud = new grocery_CRUD();
     $state = $crud->getState();
     if (isset($listingID) && $state == "edit") {
         $this->db->select('IdCategoria, IdSubcategoria')->from('producto')->where('IdProducto', $listingID);
         $db = $this->db->get();
         $row = $db->row(0);
         $idCategoria = $row->IdCategoria;
         $idSubcategoria = $row->IdSubcategoria;
         $this->db->select('*')->from('subcategoriaproducto')->where('IdCategoria', $idCategoria)->order_by('Nombre');
         $db = $this->db->get();
         foreach ($db->result() as $row) {
             if ($row->IdSubcategoria == $idSubcategoria) {
                 $empty_select .= '<option value="' . $row->IdSubcategoria . '" selected="selected">' . $row->Nombre . '</option>';
             } else {
                 $empty_select .= '<option value="' . $row->IdSubcategoria . '">' . $row->Nombre . '</option>';
             }
         }
         return $empty_select . $empty_select_closed;
     } else {
         return $empty_select . $empty_select_closed;
     }
 }
开发者ID:jgarceso,项目名称:convivir,代码行数:27,代码来源:Productos.php

示例15: index

 public function index()
 {
     $crud = new grocery_CRUD();
     $user_id = $this->ion_auth->user()->row()->id;
     $crud->set_table('packages');
     $crud->set_subject('Packages');
     $crud->unset_fields('package_id');
     $crud->unset_columns('package_id');
     $crud->unset_columns('package_thingsToConsider');
     $crud->unset_columns('package_weatherCondition');
     $crud->unset_columns('package_itinerary');
     $crud->display_as('package_weatherCondition', 'Weather Condition');
     $crud->display_as('package_thingsToConsider', 'Things to consider');
     $crud->display_as('package_adventureRegion', 'Adventure Region');
     $crud->display_as('package_basic_price', 'Price');
     $crud->display_as('package_basic_before_discount', 'Before Discount Price');
     $crud->display_as('package_related', 'Related Packages');
     $crud->set_field_upload('package_image', $this->upload_path);
     $crud->unique_fields('package_slug');
     $crud->where('package_agent', $user_id);
     $crud->set_relation('package_category', 'packages_types_settings', 'sett_name', 'sett_type = "ttypes"', 'sett_id');
     $crud->field_type('package_agent', 'hidden', $user_id);
     $this->load->model('agents_m');
     /*
      * For related packages
      * on add list all the packages created by the agent
      * on edit, list all except own name
      */
     if ($crud->getState() == 'edit') {
         $hrf = $this->db->select('package_id, package_title')->get_where('packages', array('package_status' => 1, 'package_agent' => $user_id, 'package_id !=' => $crud->getStateInfo()->primary_key))->result();
     } else {
         $hrf = $this->db->select('package_id, package_title')->get_where('packages', array('package_status' => 1, 'package_agent' => $user_id))->result();
     }
     $hrf = $this->agents_m->array_from_db($hrf, 'package_id, package_title');
     // empty data for multiselect field generates error
     if (empty($hrf)) {
         $hrf = array('');
     } else {
         $hrf = $this->generic_model->array_from_db($hrf, 'hotel_id, hotel_name');
     }
     $crud->field_type('package_related', 'multiselect', $hrf);
     $crud->callback_column('package_image', array($this, 'set_image'));
     $crud->callback_read_field('package_basic_price', array($this, 'set_price'));
     $crud->callback_read_field('package_basic_discount', array($this, 'set_price'));
     $crud->callback_column('package_basic_price', array($this, 'set_price'));
     $crud->callback_column('package_basic_discount', array($this, 'set_price'));
     $crud->callback_add_field('package_basic_price', function ($value, $primary_key) {
         return "USD <input id='field-package_basic_price' class='form-control' name='package_basic_price' type='text' value='{$value}' maxlength='20'>";
     });
     $crud->callback_add_field('package_basic_discount', function ($value, $primary_key) {
         return "USD <input id='field-package_basic_discount' class='form-control' name='package_basic_discount' type='text' value='{$value}' maxlength='20'>";
     });
     $crud->callback_edit_field('package_basic_price', function ($value, $primary_key) {
         return "USD <input id='field-package_basic_price' class='form-control' name='package_basic_price' type='text' value='{$value}' maxlength='20'>";
     });
     $crud->callback_edit_field('package_basic_discount', function ($value, $primary_key) {
         return "USD <input id='field-package_basic_discount' class='form-control' name='package_basic_discount' type='text' value='{$value}' maxlength='20'>";
     });
     $crud->add_action('Photo Gallery', '', 'agents/packages/gallery', 'ui-icon ui-icon-image');
     $output = $crud->render();
     $data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Packages', 'pagedesc' => 'Packages', 'contenttitle' => 'Packages List Records', 'left_menu' => 'agents_menu');
     $this->load->view('gc_admin_wrapper', $data);
 }
开发者ID:beingjungshahi,项目名称:theexcursionnepal,代码行数:63,代码来源:packages.php


注:本文中的grocery_CRUD::getState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。