Esempio n. 1
0
/**
 * Prints <script> tags for all javascripts associated with the given form.
 *
 * @see get_javascripts_for_form()
 */
function include_javascripts_for_form(sfForm $form)
{
    echo get_javascripts_for_form($form);
}
Esempio n. 2
0
 * Kimkëlen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License v2.0 as published by
 * the Free Software Foundation.
 *
 * Kimkëlen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kimkëlen.  If not, see <http://www.gnu.org/licenses/gpl-2.0.html>.
 */
use_helper('Javascript', 'Object', 'I18N', 'Form');
use_stylesheet('/sfPropelRevisitedGeneratorPlugin/css/global.css');
use_stylesheet('/sfPropelRevisitedGeneratorPlugin/css/extended.css');
get_javascripts_for_form($form);
?>

<div id="sf_admin_container">
  <h1><?php 
echo __('Configuración de la materia  %career_subject_school_year%', array('%career_subject_school_year%' => $career_subject_school_year->__toString()));
?>
</h1>

  <div id="sf_admin_content">
    <form action="<?php 
echo url_for('career_subject_school_year/updateConfiguration');
?>
" method="post">
      <ul class="sf_admin_actions">
        <li><?php 
Esempio n. 3
0
  public function getJavaScripts()
  {
    return array('/path/to/a/foo.js', '/path/to/a/bar.js');
  }
}

// get_javascripts_for_form() get_stylesheets_for_form()
$t->diag('get_javascripts_for_form() get_stylesheets_for_form()');
$form = new MyForm();
$output = <<<EOF
<script type="text/javascript" src="/path/to/a/foo.js"></script>
<script type="text/javascript" src="/path/to/a/bar.js"></script>

EOF;
$t->is(get_javascripts_for_form($form), fix_linebreaks($output), 'get_javascripts_for_form() returns script tags');
$output = <<<EOF
<link rel="stylesheet" type="text/css" media="all" href="/path/to/a/foo.css" />
<link rel="stylesheet" type="text/css" media="print" href="/path/to/a/bar.css" />

EOF;
$t->is(get_stylesheets_for_form($form), fix_linebreaks($output), 'get_stylesheets_for_form() returns link tags');

// use_javascripts_for_form() use_stylesheets_for_form()
$t->diag('use_javascripts_for_form() use_stylesheets_for_form()');

$response = sfContext::getInstance()->getResponse();
$form = new MyForm();

$response->resetAssets();
use_stylesheets_for_form($form);
<?php

use_helper('I18N', 'Asset', 'Tag');
?>

  <?php 
echo call_user_func(array($rendererClass, 'renderForm'), call_user_func(array($rendererClass, 'renderFormHeader'), call_user_func(array($rendererClass, 'renderButtonRemoveForm'), $widgetId, $childCount, image_path($images['delete-button-image']['image']), $images['delete-button-image']['text'], $afterDeleteJs), $formTitle), str_replace(array('%content%'), array($form->renderUsing($formFormatter)), $form->getWidgetSchema()->getFormFormatter()->getDecoratorFormat()), get_javascripts_for_form($form) . get_stylesheets_for_form($form));
 public function renderEmbeddedForms($name)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Asset', 'Url'));
     $parentForm = $this->getOption('parent_form');
     $taintedValues = $parentForm->getTaintedValues();
     $html = '';
     foreach ($this->embeddedForms as $formName => $form) {
         $formClonedWidget = clone $parentForm->getWidget($formName);
         $formTempWidget = new sfWidgetFormSchemaDecorator($form->getWidgetSchema(), $this->getEmbededFormFormatter($form)->getDecoratorFormat());
         $formWidgetId = $formClonedWidget->generateId($formName);
         $formIndex = $formName[strlen($formName) - 1];
         $formTaintedValues = is_array($taintedValues) && isset($taintedValues[$formName]) ? $taintedValues[$formName] : array();
         /* Renders form's code */
         $parentForm->setWidget($formName, $formTempWidget);
         $formHtml = $this->renderDispatch('renderForm', $this->renderDispatch('renderFormHeader', $this->renderDispatch('renderButtonRemoveForm', $this->generateId($name), $formIndex, image_path($this->getOption('delete-button-image')), $this->getOption('delete-button-text'), $this->getOption('after-delete-js')), $this->getFormTitle($form, $formTaintedValues)), $parentForm[$formName]->render(array()), get_javascripts_for_form($form) . get_stylesheets_for_form($form));
         $parentForm->setWidget($formName, $formClonedWidget);
         $html .= $formHtml;
     }
     return $html;
 }
Esempio n. 6
0
$t->is(get_javascripts(), '<script type="text/javascript" src="module/action?sf_format=js"></script>' . "\n", 'use_dynamic_javascript() register a dynamic javascript in the response');
// use_dynamic_stylesheet()
$t->diag('use_dynamic_stylesheet()');
use_dynamic_stylesheet('module/action');
$t->is(get_stylesheets(), '<link rel="stylesheet" type="text/css" media="screen" href="module/action?sf_format=css" />' . "\n", 'use_dynamic_stylesheet() register a dynamic stylesheet in the response');
class MyForm extends sfForm
{
    public function getStylesheets()
    {
        return array('/path/to/a/foo.css' => 'all', '/path/to/a/bar.css' => 'print');
    }
    public function getJavaScripts()
    {
        return array('/path/to/a/foo.js', '/path/to/a/bar.js');
    }
}
// get_javascripts_for_form() get_stylesheets_for_form()
$t->diag('get_javascripts_for_form() get_stylesheets_for_form()');
$form = new MyForm();
$t->is(get_javascripts_for_form($form), <<<EOF
<script type="text/javascript" src="/path/to/a/foo.js"></script>
<script type="text/javascript" src="/path/to/a/bar.js"></script>

EOF
, 'get_javascripts_for_form() returns script tags');
$t->is(get_stylesheets_for_form($form), <<<EOF
<link rel="stylesheet" type="text/css" media="all" href="/path/to/a/foo.css" />
<link rel="stylesheet" type="text/css" media="print" href="/path/to/a/bar.css" />

EOF
, 'get_stylesheets_for_form() returns link tags');