\n"; return $observe; } // observe /** * action * This takes the action, the source and the post (if passed) and generated the full * ajax link */ public static function action($action,$source,$post='') { $url = Config::get('ajax_url') . $action; if ($post) { $ajax_string = "ajaxPost('$url','$post','$source')"; } else { $ajax_string = "ajaxPut('$url','$source')"; } return $ajax_string; } // action /** * button * This prints out an img of the specified icon with the specified alt text * and then sets up the required ajax for it */ public static function button($action,$icon,$alt,$source='',$post='') { // Get the correct action $ajax_string = self::action($action,$source,$post); $string = get_user_icon($icon,$alt,$source); $string .= self::observe($source,'click',$ajax_string); return $string; } // button /** * text * This prints out the specified text as a link and setups the required * ajax for the link so it works correctly */ public static function text($action,$text,$source,$post='',$span_class='') { // Format the string we wanna use $ajax_string = self::action($action,$source,$post); // If they passed a span class if ($span_class) { $class_txt = ' class="' . $span_class . '"'; } // If we pass a source put it in the ID $string = "$text\n"; $string .= self::observe($source,'click',$ajax_string); return $string; } // text } // end Ajax class ?>