コード例 #1
0
ファイル: screen.php プロジェクト: jawngee/HeavyMetal
 /**
  * Runs a screen.
  * 
  * @param string $which Which screen to run, "before" or "after"
  * @param Controller $controller The controller
  * @param AttributeReader $method_meta The method metadata
  * @param Array $data Array of data that the screen(s) can add to.
  */
 public static function Run($which, $controller, $method_meta, &$data, &$args)
 {
     $c = $controller->metadata->{$which};
     $m = $method_meta->{$which};
     if (!$c) {
         $c = new AttributeReader();
     }
     if (!$m) {
         $m = new AttributeReader();
     }
     $screens = $c->merge($m);
     foreach ($screens as $name => $screen) {
         if (!$screen->ignore) {
             if (isset(self::$_screens[$name])) {
                 $s = self::$_screens[$name];
             } else {
                 uses('screen.' . $name);
                 $class = $name . 'Screen';
                 $s = new $class();
                 self::$_screens[$name] = $s;
             }
             $s->{$which}($controller, $screen, $data, $args);
         }
     }
 }