WordPress.org

Support

Support » Plugins and Hacks » FT Calendar » [Plugin: FT Calendar] Modifictaion to refire get_calendar_colors()

[Plugin: FT Calendar] Modifictaion to refire get_calendar_colors()

  • I’m modifying the admin side of this plug-in a little. I’ve hit a small snag.

    I’m modifying get_calendar_colors().

    So far I’ve got it to not show colors as available if they are already in use by another calendar entry and I’m limiting the number of colors shown to 14.

    function get_calendar_colors( $ftcal_color = null ) {
    
    			$full_colors = $this->get_full_colors();
    
    			$color = ( isset( $ftcal_color ) ) ? $ftcal_color : '668cd9';
    
    			$style = "background-color: #" . $color . "; border-color: #" . $color . ";";
    			$cc = '<div id="ftcalendar-color-picker">';
    			$cc .= '<input type="hidden" value="' . $color .'" id="ftcal-color" name="ftcal-color" />';
    			$cc .= "<div id='calendar-label-color' style='width: 175px; clear: both; " . $style . "'><div style='" . $style . "'>calendar</div></div>";
    			$cc .= "<ul>";
    			$count = 0; // tug
    			$colorsUsed = get_option('ftcalendar_meta'); // tug
    			$full_colors = array_diff($full_colors, $colorsUsed); // tug
    			foreach ( (array)$full_colors as $bg_color => $border_color ) {
    					$cc .= '<li class="calcolor-li"><a class="calcolor-square" style="background-color: #' . $bg_color .'; border: 1px solid #' . $border_color . ';">&nbsp;</a></li>';
    				$count++; // tug
      				if($count == 14){ // tug
    					break; // tug
    				} // tug
    			}
    			$cc .= "</ul>";
    			$cc .= '</div>';
    
    			return $cc;
    		}

    Since the plug-in uses Wp’s core file to do the processing, I’m not sure where or how to refire the function in order to update the colors available once a new calendar is created successfully.

    I’m not sure if anything is being set on success that I can listen for just to simply refresh the page.

    Granted this doesn’t have anything to do with this plug-in specifically but, worth a shot.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Well, scratch all that.

    Turns out when you delete a calendar the color used for it stays in the DB. So after a while you literally run out of colors to use.

    Oh well.

    That’s a good point, we should probably hook into the delete function and remove the calendar color from the DB…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: FT Calendar] Modifictaion to refire get_calendar_colors()’ is closed to new replies.
Skip to toolbar