[3.1.4 modification] modify calendar library, add extra column before calendar |
05-22-2017, 12:46 PM
(This post was last modified: 05-22-2017, 12:53 PM by eagle00789. Edit Reason: added screenshot )
if you want a quick and dirty method like me, you can do the following:
the mentiond line numbers represent the original line numbers from the original calendar.php file. that is why the changes are in reverse order, from the bottom up: Copy the system/libraries/calendar.php file to Application/libraries/MY_calendar.php Go to line 526 and replace it with the following text: PHP Code: foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_row_before_cell', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_row_before', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today', 'cal_cell_start_other', 'cal_cell_other', 'cal_cell_end_other') as $val) PHP Code: if (array_key_exists('cal_row_before', $this->replacements)) PHP Code: if (array_key_exists('cal_row_before', $this->replacements)) PHP Code: if (array_key_exists('cal_row_before', $this->replacements)) PHP Code: if (array_key_exists('week_row_before_cell', $this->replacements)) PHP Code: class MY_Calendar extends CI_Calendar { PHP Code: $this->load->library('calendar', $prefs); Now you can use the following fields in your template (with examples included) PHP Code: {week_row_before_cell}<td> </td>{/week_row_before_cell} The field cal_row_before is the extra cell before each week row. In this field, you can use the fields from_day and to_day to use the first and last day of that week in your extra cell. View a demo (partial screenshot) below: |
Messages In This Thread |
[3.1.4 modification] modify calendar library, add extra column before calendar - by eagle00789 - 05-20-2017, 12:24 PM
RE: modify calendar library - by skunkbad - 05-20-2017, 03:03 PM
RE: modify calendar library - by ivantcholakov - 05-21-2017, 06:27 AM
RE: modify calendar library - by eagle00789 - 05-22-2017, 12:46 PM
|