hướng dẫn sử dụng standar table và toolbar hepler zcms
DESCRIPTION
Hướng dẫn sử dụng Standar Table và Toolbar Hepler ZCMS cơ bảnTRANSCRIPT
ZCMS TUTORIAL
Copy right TechMaster.vn 2014
SỬ DỤNG STANDARD TABLE&
TOOLBAR HEPLER
Standard Table
Tại sao lại sử dụng Standard Table và Toolbar Helper
• Hiển thị danh sách mất nhiều thời gian lập trình, các dữ liệu ngày tháng (date time), tiền tệ (money format), ảnh (thumb), trạng thái (published, unpublished…,) và tranlation…
• Các hành động cơ bản như publish, unpulish, delete, update, addnew tốn thời gian lập trình hiển thị nút, kiểm tra phân quyền với các người dùng khác nhau để hiển thị hay không hiển thị…
• Các hiển thị mô tả như là Breadcrumb, Title Page, Heading Page tốn nhiều thời gian… mà không hỗ trợ đa ngôn ngữ.
• Standard Table & Toolbar Helper hỗ trợ lập trình viên giảm thiểu các thao tác code để nhanh trong có được trang hiển thị danh sách nhanh chóng
Tại sao lại sử dụng Standard Table và Toolbar Helper
Cách sử dụng Toolbar Helper
Bước 1: Khởi tạo toolbar:$toolbar = ZToolbarHelper::getInstance();//Chú ý sử dụng namespaceuse ZCMS\Core\Utilities\ZToolbarHelper;
addHeaderPrimary addHeaderSecond
addBreadcrumb
addTitle (Nếu ko addTitle CMS mặc định lấy HeaderPrimary nối với HeaderSecond)
Code
Quy tắc đặt tên translationprefix : m_ = moduleprefix: t_ = templateprefix: w_ = widget
Quy tắc đặt tên cho modulem_{moduleName}_[Controller]_{Type}{ } => Bắt buộc, [ ] Nên cóType: message, menu, button, form
Bước 1: Khởi tạo toolbar:$toolbar = ZToolbarHelper::getInstance();//Chú ý sử dụng namespaceuse ZCMS\Core\Utilities\ZToolbarHelper;
Code Add Button: $toolbar->add…
Xem thêm tại file /library/Core/Utilities/Z
ToolbarHelper.pphp(Sẽ update thêm :D)
Cách sử dụng Standard Table
Bắt buộc phải setVar(‘_sortColumn’,….)
Các kiểu Type
Các kiểu Type
Các kiểu TypeMặc định sort = true, Nếu bạn muốn bỏ sort thì thêm sort = fale
Sử dụng translation cho cột này
display có giá trị: text, date, published, edit,
published_is_core, id (Sẽ cập nhật thêm image, monney…)
Thêm vào file Volt để sử dụng standard table
Xem thêm• 'access' => $this->acl->isAllowed('module|index|index'): Màu đỏ là rule• 'link' => '/admin/system/module/',• 'prefix' => 'gb_',$this->acl mặc định được định nghĩa trong DI
Tham khảo thêm standard_table.volt và /app/backend/system/controllers/ModuleController.php