public function render($name, $value = null, array $attrs = array()) { $final_attrs = array_merge(array('type' => $this->type, 'name' => $name), $this->attrs, $attrs); if ($value != '') { $final_attrs['value'] = $value; } $url = SUrlRewriter::url_for(array('controller' => 'users', 'action' => 'all_json')); $js = "\n <script type=\"text/javascript\">\n \$('#{$final_attrs['id']}').imageSelector('{$url}');\n </script>\n"; return '<input ' . $this->flatten_attrs($final_attrs) . ' />' . $js; }
/** * The url of the user image file (generate the file if it does no exists) * @param User $user user * @access public * @return string */ function userImage_url($user) { $path = userImage_path($user); return SUrlRewriter::url_for($path); }