apress pro php and jquery 2010 phần 6

Tiếp theo, bạn cần phải làm cho nó có thể cho người dùng có thẩm quyền để chỉnh sửa sự kiện. Bạn sẽ làm điều này bằng cách thêm một nút để xem đầy đủ của một sự kiện trong . Tuy nhiên, không giống như các liên kết đơn giản được sử dụng để tạo ra một tùy chọn mới, | CHAPTER 5 ADD CONTROLS TO CREATE EDIT AND DELETE EVENTS Figure 5-4. The Admin button appears in the bottom left of the calendar Adding Edit Controls to the Full Event View Next you need to make it possible for authorized users to edit events. You will do this by adding a button to the full view of an event in . However unlike the simple link used to create a new option an Edit button will require an actual form submission. To keep this code manageable you ll create a new private method called _adminEntryOptions in the Calendar class that will generate the markup for the form. For now this form will simply return the form markup to display the Edit button. More will be added to the form as you continue on through the exercises in this book. You create this method by adding the following bold code to the Calendar class php class Calendar extends DB_Connect 185 CHAPTER 5 ADD CONTROLS TO CREATE EDIT AND DELETE EVENTS private _useDate private _m private _y private _daysInMonth private _startDay public function _construct dbo NULL useDate NULL . public function buildCalendar . public function displayEvent id . public function displayForm . public function processForm . private function _loadEventData id NULL . private function _createEventObj . private function _loadEventById id . private function _adminGeneralOptions . Generates edit and delete options for a given event ID @param int id the event ID to generate options for @return string the markup for the edit delete options private function _adminEntryOptions id Z . return ADMIN_OPTIONS div class admin-options form action method post p input type submit name edit_event value Edit This Event input type hidden name event_id value id p form div -- end .admin-options -- ADMIN_OPTIONS 186 CHAPTER 5 ADD CONTROLS TO CREATE EDIT AND DELETE EVENTS Modifying the Full Event Display Method to Show Admin Controls Before the Edit button will be displayed the _adminEntryOptions method needs to be called from .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
36    80    1    21-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.