public function registerJavascript($disp) { $root_params = array('file', 'width', 'height', 'version', 'background', 'id'); if (!JsRegister::current()->isRegistered('swfobject')) { JsRegister::current()->setPluginPath('ext/js/'); JsRegister::current()->registerScript('swfobject'); } if (!JsRegister::current()->isRegistered('swf_object')) { JsRegister::current()->setPluginPath('packages/sys/display/rsml/meta/'); JsRegister::current()->registerScript('swf_object'); } if (is_object($disp)) { $object_params = array(); $swf_params = array(); foreach ($this->attributeNames() as $name) { if ($name != 'class' && $name != 'name') { if ($this->dynamic_attributes->isDynamic($name)) { $val = Display::rsmlValue($disp->variables(), $this->dynamic_attributes->attribute($name)); } else { $val = $this->attribute($name, RsmlNode::CTX_PLAIN); } if (in_array($name, $root_params)) { $object_params[DynamicAttributes::realName($name)] = $val; } else { $swf_params[DynamicAttributes::realName($name)] = $val; } } } if (count($swf_params)) { $object_params['params'] = $swf_params; } JsRegister::current()->appendArgument('swf_object', 'objects', array($object_params)); } }
public function attribute($name) { $name = DynamicAttributes::realName($name); if (isset($this->dynamic_attributes[$name])) { $ret = $this->dynamic_attributes[$name]; } else { throw new Exception('The attribute: ' . $name . ' does not exist'); } return $ret; }