/**
  * @param  string $name        The element name
  * @param  string $value       The value displayed in this widget
  * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
  * @param  array  $errors      An array of errors for the field
  *
  * @return string An HTML tag string
  *
  * @see sfWidgetForm
  */
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     $this->context = sfContext::getInstance();
     $attributes = array_merge(array('type' => $this->getOption('type'), 'name' => $name, 'value' => $value), $attributes);
     $attributes = $this->fixFormId($attributes);
     // Get default dir for popup window
     $dir = $value ? dirname($value) : sfConfig::get('app_sf_media_browser_root_dir') . '/' . $this->getOption('dir');
     $url = $this->context->getRouting()->generate('sf_media_browser_select', array('dir' => $dir));
     $tag = $this->renderTag('input', $attributes) . $this->includeView() . $this->includeDelete();
     // Add javascripts and stylesheets as configure in app_sf_media_browser_assets_widget
     sfMediaBrowserUtils::loadAssets(sfConfig::get('app_sf_media_browser_assets_widget'));
     $tag .= $this->loadJavascript(array_merge($attributes, array('url' => $url)));
     return $this->wrapTag($tag);
 }
<?php

sfMediaBrowserUtils::loadAssets('filepicker');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <?php 
include_http_metas();
?>
    <?php 
include_metas();
?>
    <?php 
include_title();
?>
    <link rel="shortcut icon" href="/favicon.ico" />
    <?php 
include_stylesheets();
?>
    <?php 
include_javascripts();
?>
  </head>
  <body>
    <?php 
echo $sf_content;
?>
  </body>
</html>
<?php

sfMediaBrowserUtils::loadAssets('list');
use_helper('I18N');
$upload_form->getWidgetSchema()->setFormFormatterName('list');
$dir_form->getWidgetSchema()->setFormFormatterName('list');
?>

<div id="sf_media_browser_user_message"></div>

<div id="sf_media_browser_forms">
  <fieldset id="sf_media_browser_upload">
    <legend><?php 
echo __('Upload a file');
?>
</legend>
    <form action="<?php 
echo url_for('sf_media_browser_file_create');
?>
" method="post" enctype="multipart/form-data">
      <?php 
echo $upload_form;
?>
      <input type="submit" class="submit" value="<?php 
echo __('Save');
?>
" />
    </form>
  </fieldset>

  <fieldset id="sf_media_browser_mkdir">
示例#4
0
<?php

sfMediaBrowserUtils::loadAssets(sfConfig::get('app_sf_media_browser_assets_list'));
use_helper('I18N');
?>
<script type="text/javascript">
  delete_msg = "<?php 
echo __('Are you sure you want to delete this item ?');
?>
";
</script>

<div id="sf_media_browser_user_message"></div>

<div id="sf_media_browser_forms">
  <fieldset id="sf_media_browser_upload">
    <legend><?php 
echo __('Upload a file');
?>
</legend>
    <form action="<?php 
echo url_for('sf_media_browser_file_create');
?>
" method="post" enctype="multipart/form-data">
      <?php 
echo $upload_form;
?>
      <input type="submit" class="submit" value="<?php 
echo __('Save');
?>
" />