本文整理汇总了PHP中grocery_CRUD::set_model方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::set_model方法的具体用法?PHP grocery_CRUD::set_model怎么用?PHP grocery_CRUD::set_model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::set_model方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: checkout
public function checkout($id)
{
if (!($master = $this->model_proposal->getDataProposal($id))) {
redirect('proposal');
}
$this->load->library('grocery_CRUD');
$this->load->model('grocery_CRUD_Model');
$crud = new grocery_CRUD();
$crud->set_model('CheckoutModel');
$crud->set_table('proposal_detail');
//Change to your table name
$crud->columns('name', 'brand', 'unit', 'size', 'qty', 'price', 'discount', 'discount_price', 'sub_total', 'ppn', 'final_sub_total');
$crud->basic_model->getDataProposalDetail($id);
$crud->callback_column('unit', array($this, '_callback_unit'));
$crud->callback_column('price', array($this, '_callback_currency'));
$crud->callback_column('discount', array($this, '_callback_currency'));
$crud->callback_column('discount_price', array($this, '_callback_currency'));
$crud->callback_column('sub_total', array($this, '_callback_currency'));
$crud->callback_column('ppn', array($this, '_callback_currency'));
$crud->callback_column('final_sub_total', array($this, '_callback_currency'));
$crud->display_as('final_sub_total', 'total');
//
$crud->unset_add()->unset_edit()->unset_delete()->unset_print()->unset_read();
$output = $crud->render();
// $this->render($output);
$data['output'] = $output;
$data['master'] = $master;
$data['proposal_type'] = $this->proposal_type[$master->type];
$data['status_ppn'] = $this->status_ppn[$master->status_ppn];
$this->parser->parse("list_detail.tpl", $data);
// $data['items'] = $this->model_proposal->getDataProposalDetail($id);
// $this->parser->parse("proposal_checkout.tpl", $data);
}