You are here

function theme_jstimer in Javascript Timer 6

Same name and namespace in other branches
  1. 8 jstimer.module \theme_jstimer()
  2. 7 jstimer.module \theme_jstimer()

File

./jstimer.module, line 48
A module which creates javascript timed dhtml things.

Code

function theme_jstimer($widget_name = NULL, $widget_args = NULL) {
  $widgets = jstimer_get_widgets();
  $widget = NULL;
  foreach ($widgets as $w) {
    if ($widget_name == $w->name) {
      $widget = $w;
      break;
    }
  }
  if (!isset($widget)) {
    return "Widget {$widget_name} not found.";
  }
  if (function_exists($widget->theme_function)) {
    return call_user_func($widget->theme_function, $widget_args);
  }
  else {
    return "Widget {$widget_name} theme not found.";
  }
}