/** * View */ public function action_view($id = null) { $mk011 = Model_DocMK011::find($id); $data['docmk011'] = Petro::render_panel('Docmk011 Information', Petro::render_attr_table($mk011, static::_columns('view'))); $this->sidebars->add('Render from another View!', View::forge('sidebar_link', array('url' => 'going/anywhere'))); $this->action_items = array(array('title' => 'Edit Docmk011', 'link' => 'docmk011/edit/' . $id), array('title' => 'Delete Docmk011', 'link' => 'docmk011/delete/' . $id)); $this->template->page_title = "docmk011"; $this->template->content = View::forge('docmk011/view', $data, false); }
public function action_view($id = null) { $client = Model_Client::find($id); if (is_null($client)) { \Response::redirect('clients'); } $data['client'] = Petro::render_panel('Client Information', Petro::render_attr_table($client, array('code', 'name', 'name_en', 'status'))); $data['comments'] = Petro_Comment::render($this->app, $id); $this->sidebars->add('Render from another View!', View::forge('sidebar_link', array('url' => 'going/anywhere'))); $routes = Petro::get_routes($id); $this->action_items = array(array('title' => 'Edit Client', 'link' => $routes['edit']), array('title' => 'Delete Client', 'link' => $routes['delete'], 'attr' => array('data-toggle' => 'modal', 'data-target' => '#petro-confirm', 'class' => 'del-item'))); $this->template->page_title = $client->name; $this->template->set('content', $data['client'] . $data['comments'], false); }
public function action_view($id = null) { $user = \Model_User::find($id); if (is_null($user)) { \Response::redirect('users'); } $out = Petro::render_panel('User Information', Petro::render_attr_table($user, array('name', 'username', 'email', 'group', 'last_login'), static::_columns())); $out .= Petro_Comment::render($this->app, $id); $routes = Petro::get_routes($id); $this->action_items = array(array('title' => 'Edit User', 'link' => $routes['edit']), array('title' => 'Delete User', 'link' => $routes['delete'])); $gp = \Auth::group()->get_name($user->group); if (\Auth::instance()->is_current_user($id)) { $this->sidebars->add('Operations', '<div>' . \Html::anchor('users/change_password', 'Change password') . '<br/>' . \Html::anchor('#', 'Reset password') . '<br/>' . $user->group . ' : ' . $gp . '</div>'); } $this->template->page_title = $user->username; $this->template->set('content', $out, false); }
protected function display_info($docmk) { // $out = Petro::render_attr_table_open($docmk); // $out .= Petro::render_attr_table_row(__('mk_no'), $docmk->mk_no); // $out .= Petro::render_attr_table_row(__('mk_date'), Petro::to_app_date($docmk->mk_date)); // $out .= Petro::render_attr_table_row(__('client_id'), // '<a href="'.Uri::base().'clients/view/'.$docmk->client_id.'">'. // Petro_Lookup::get(null, $docmk->client_id, 'clients', 'id', 'name'). // '</a>' // ); // $out .= Petro::render_attr_table_row(__('client_po'), $docmk->client_po); // $out .= Petro::render_attr_table_row(__('product_type'), Petro_Lookup::get('product.type', $docmk->product_type)); // $out .= Petro::render_attr_table_row(__('belt_info'), BeltInfo::long($docmk)); // $out .= Petro::render_attr_table_row(__('belt_length'), $docmk->belt_length.' '.Petro_Lookup::get('belt.l.unit', $docmk->belt_length_unit)); // $out .= Petro::render_attr_table_row(__('belt_end'), Petro_Lookup::get('belt.end', $docmk->belt_end)); // $out .= Petro::render_attr_table_row(__('belt_qty'), $docmk->belt_qty.' '.'เส้น'); // $price = BeltInfo::calc_price($docmk); // $out .= Petro::render_attr_table_row(__('belt_price'), number_format($price['standard_price'], 2)); // $out .= Petro::render_attr_table_row(__('remark'), $docmk->remark); // $out .= Petro::render_attr_table_row(__('creator'), $docmk->creator_name); // $out .= Petro::render_attr_table_row(__('status'), Petro_Lookup::get('prd.status', $docmk->status)); // $out .= Petro::render_attr_table_close(); // return $out; return Petro::render_attr_table($docmk, array('mk_no', 'mk_date' => function ($data) { return Petro::to_app_date($data->mk_date); }, 'client_id' => function ($data) { return '<a href="' . Uri::base() . 'clients/view/' . $data->client_id . '">' . Petro_Lookup::get(null, $data->client_id, 'clients', 'id', 'name') . '</a>'; }, 'client_po', 'product_type' => function ($data) { return Petro_Lookup::get('product.type', $data->product_type); }, 'belt_info' => function ($data) { return BeltInfo::long($data); }, 'belt_length' => function ($data) { return $data->belt_length . ' ' . Petro_Lookup::get('belt.l.unit', $data->belt_length_unit); }, 'belt_end' => function ($data) { return Petro_Lookup::get('belt.end', $data->belt_end); }, 'belt_qty' => function ($data) { return $data->belt_qty . ' ' . 'เส้น'; }, 'belt_price' => function ($data) { $price = BeltInfo::calc_price($data); return number_format($price['standard_price'], 2); }, 'remark', 'creator' => function ($data) { return $data->creator_name; }, 'status' => function ($data) { return Petro_Lookup::get('prd.status', $data->status); })); }