コード例 #1
0
">
  <?php 
if ($sf_request->hasError('formulario{entrega}')) {
    ?>
    <?php 
    echo form_error('formulario{entrega}', array('class' => 'form-error-msg'));
    ?>
  <?php 
}
?>
  <?php 
$cuatrimestres = array('1' => __('primer cuatrimestre'), '2' => __('segundo cuatrimestre'), '3' => __('tercer cuatrimestre'), '4' => __('cuarto cuatrimestre'));
$value = select_tag('formulario[entrega_cuatrimestre]', options_for_select($cuatrimestres, $formulario->getEntregaCuatrimestre(), array('include_blank' => true)), array());
echo $value ? $value : '&nbsp;';
$anyo = $formulario->getEntregaAnio() ? $formulario->getEntregaAnio() : '';
$selectAnyo = select_year_tag('formulario[entrega_anio]', $anyo, array('year_start' => 2007, 'year_end' => 2015, 'include_blank' => 'true'));
echo $selectAnyo ? $selectAnyo : '&nbsp;';
?>
    </div>
</div>




<div class="form-row">
  <?php 
echo label_for('formulario[interesa_cualquier_tabla]', __($labels['formulario{interesa_cualquier_tabla}']), '');
?>
  <div class="content<?php 
if ($sf_request->hasError('formulario{interesa_cualquier_tabla}')) {
    ?>
コード例 #2
0
/**
 * Returns three <select> tags populated with a range of months, days, and years.
 *
 * By default, the <i>$value</i> parameter is set to today's month, day and year. To override this, simply pass a valid date
 * or a correctly formatted date array (see example) to the <i>$value</i> parameter. You can also set the <i>$value</i> 
 * parameter to null which will disable the <i>$value</i>, however this will only be useful if you pass 'include_blank' or 
 * 'include_custom' to the <i>$options</i> parameter. Also, the default selectable range of years is set to show five years 
 * back and five years forward from today's year. For instance, if today's year is 2006, the default 'year_start' option will 
 * be set to 2001 and the 'year_end' option will be set to 2011.  These start and end dates can easily be overwritten by 
 * setting the 'year_start' and 'year_end' options in the <i>$options</i> parameter. 
 *
 * <b>Note:</b> The <i>$name</i> parameter will automatically converted to array names. For example, a <i>$name</i> of "date" becomes:
 * <samp>
 *  <select name="date[month]">...</select>
 *  <select name="date[day]">...</select>
 *  <select name="date[year]">...</select>
 * </samp>
 *  
 * <b>Options:</b>
 * - include_blank     - Includes a blank <option> tag at the beginning of the string with an empty value.
 * - include_custom    - Includes an <option> tag with a custom display title at the beginning of the string with an empty value.
 * - discard_month     - If set to true, will only return select tags for day and year.
 * - discard_day       - If set to true, will only return select tags for month and year.
 * - discard_year      - If set to true, will only return select tags for month and day.
 * - use_month_numbers - If set to true, will show the month's numerical value (1 - 12) instead of the months full name.
 * - use_short_month   - If set to true, will show the month's short name (i.e. Jan, Feb, Mar) instead of its full name.
 * - year_start        - If set, the range of years will begin at this four-digit date (i.e. 1979)
 * - year_end          - If set, the range of years will end at this four-digit date (i.e. 2025)
 * - date_seperator    - Includes a string of defined text between each generated select tag
 *  
 * <b>Examples:</b>
 * <code>
 *  echo select_date_tag('date');
 * </code>
 *
 * <code>
 *  echo select_date_tag('date', '2006-10-30');
 * </code>
 *
 * <code>
 *  $date = array('year' => '1979', 'month' => 10, 'day' => 30);
 *  echo select_date_tag('date', $date, array('year_start' => $date['year'] - 10, 'year_end' => $date['year'] + 10));
 * </code>
 *
 * @param  string field name (automatically becomes an array of parts: name[year], name[month], year[day])
 * @param  mixed  accepts a valid date string or properly formatted date array
 * @param  array  additional HTML compliant <select> tag parameters
 * @return string three <select> tags populated with a months, days and years
 * @see select datetime_tag, select_month_tag, select_date_tag, select_year_tag
 */
function select_date_tag($name, $value = null, $options = array(), $html_options = array())
{
    $options = _parse_attributes($options);
    $culture = _get_option($options, 'culture', sfContext::getInstance()->getUser()->getCulture());
    // set it back for month tag
    $options['culture'] = $culture;
    $I18n_arr = _get_I18n_date_locales($culture);
    $date_seperator = _get_option($options, 'date_seperator', $I18n_arr['date_seperator']);
    $discard_month = _get_option($options, 'discard_month');
    $discard_day = _get_option($options, 'discard_day');
    $discard_year = _get_option($options, 'discard_year');
    // discarding month automatically discards day
    if ($discard_month) {
        $discard_day = true;
    }
    $order = _get_option($options, 'order');
    $tags = array();
    if (is_array($order) && count($order) == 3) {
        foreach ($order as $v) {
            $tags[] = $v[0];
        }
    } else {
        $tags = $I18n_arr['date_order'];
    }
    if ($include_custom = _get_option($options, 'include_custom')) {
        $include_custom_month = is_array($include_custom) ? isset($include_custom['month']) ? array('include_custom' => $include_custom['month']) : array() : array('include_custom' => $include_custom);
        $include_custom_day = is_array($include_custom) ? isset($include_custom['day']) ? array('include_custom' => $include_custom['day']) : array() : array('include_custom' => $include_custom);
        $include_custom_year = is_array($include_custom) ? isset($include_custom['year']) ? array('include_custom' => $include_custom['year']) : array() : array('include_custom' => $include_custom);
    } else {
        $include_custom_month = array();
        $include_custom_day = array();
        $include_custom_year = array();
    }
    $month_name = $name . '[month]';
    $m = !$discard_month ? select_month_tag($month_name, _parse_value_for_date($value, 'month', 'm'), $options + $include_custom_month, $html_options) : '';
    $day_name = $name . '[day]';
    $d = !$discard_day ? select_day_tag($day_name, _parse_value_for_date($value, 'day', 'd'), $options + $include_custom_day, $html_options) : '';
    $year_name = $name . '[year]';
    $y = !$discard_year ? select_year_tag($year_name, _parse_value_for_date($value, 'year', 'Y'), $options + $include_custom_year, $html_options) : '';
    // we have $tags = array ('m','d','y')
    foreach ($tags as $k => $v) {
        // $tags['m|d|y'] = $m|$d|$y
        if (strlen(${$v})) {
            $tags[$k] = ${$v};
        } else {
            unset($tags[$k]);
        }
    }
    return implode($date_seperator, $tags);
}
コード例 #3
0
ファイル: _step5.php プロジェクト: yasirgit/afids
echo $form['ccard_expire']->renderId();
?>
"> <?php 
echo $form['ccard_expire']->renderLabelName();
?>
            </label> <?php 
//echo $form['ccard_expire']
?>
 <?php 
//echo $form['ccard_expire']->renderError()
?>
                <?php 
echo select_month_tag('month', 'Select month', array('use_month_numbers' => true, 'include_custom' => 'Select month'), array('style' => 'width:95px'));
$year_start = date('Y', strtotime('now'));
$year_end = date('Y', strtotime('+20 years'));
echo select_year_tag('year', 'Select year', array('year_start' => $year_start, 'year_end' => $year_end, 'include_custom' => 'Select year'), array('style' => 'width:90px'));
//'include_blank' => true
?>
                <?php 
if ($exp == 1) {
    ?>
                <ul class="error_list">
                    <li>Please select expiration date </li>
                </ul>
                <?php 
}
?>
            <?php 
//echo $form['ccard_expire']
//          $array = explode("/", $form->getObject()->getCcardExpire());
//          $s_y = $sf_params->get("s_y") ? $sf_params->get("s_y") : (isset($array[1]) ? $array[1] : "");
コード例 #4
0
ファイル: pageViewsSuccess.php プロジェクト: kotow/work
<select name="section"> 
	<option value="job" <?php 
if ($section == "job") {
    echo "selected";
}
?>
> Jobs section </option> 
	<option value="house" <?php 
if ($section == "house") {
    echo "selected";
}
?>
> Housing section </option> 
</select> 

<?php 
echo select_month_tag('month', $month);
?>
 
<?php 
echo select_year_tag('year', $year, array('year_end' => date("Y"), 'year_start' => date("Y") - 2));
?>
 

<input type="submit" value="check">
</form>

</body>
</html>
    
コード例 #5
0
function my_input_date_tag($name, $value = null, $options = array(), $html_options = array())
{
    $options = _parse_attributes($options);
    $context = sfContext::getInstance();
    $culture = _get_option($options, 'culture', $context->getUser()->getCulture());
    // set it back for month tag
    $options['culture'] = $culture;
    $I18n_arr = _get_I18n_date_locales($culture);
    $date_seperator = _get_option($options, 'date_seperator', $I18n_arr['date_seperator']);
    $include_blank_month = array('include_blank' => _get_option($options, 'include_blank_month', false));
    $include_blank_day = array('include_blank' => _get_option($options, 'include_blank_day', false));
    $include_blank_year = array('include_blank' => _get_option($options, 'include_blank_year', false));
    $order = _get_option($options, 'order');
    $tags = array();
    if (is_array($order) && count($order) == 3) {
        foreach ($order as $v) {
            $tags[] = $v[0];
        }
    } else {
        $tags = $I18n_arr['date_order'];
    }
    $month_name = $name . '[month]';
    $m = select_month_tag($month_name, _parse_value_for_date($value, 'month', 'm'), $options + $include_blank_month, $html_options);
    $day_name = $name . '[day]';
    $d = select_day_tag($day_name, _parse_value_for_date($value, 'day', 'd'), $options + $include_blank_day, $html_options);
    $year_name = $name . '[year]';
    $y = select_year_tag($year_name, _parse_value_for_date($value, 'year', 'Y'), $options + $include_blank_year, $html_options);
    // we have $tags = array ('m','d','y')
    foreach ($tags as $k => $v) {
        // $tags['m|d|y'] = $m|$d|$y
        $tags[$k] = ${$v};
    }
    return implode($date_seperator, $tags);
}
コード例 #6
0
     $value .= "<div class=\"content\">";
 }
 $valor = isset($items_formulario[$item_base->getIdItemBase()]) ? $items_formulario[$item_base->getIdItemBase()] : null;
 if ($campo->esTipoTextoLargo()) {
     if ($campo->getTamano() != null && $campo->getTamano() != "") {
         $tamano = $campo->getTamano();
     } else {
         $tamano = '50x3';
     }
     $value .= textarea_tag($control_name, $valor ? $valor->getTextoLargo() : $campo->getDefecto(), array('control_name' => $control_name, 'size' => $tamano));
 } elseif ($campo->esTipoBooleano()) {
     $value .= checkbox_tag($control_name, $valor ? $valor->getSiNo() : $campo->getDefecto(), $valor ? $valor->getSiNo() : $campo->getDefecto(), array());
 } elseif ($campo->esTipoSelectPeriodo()) {
     $value .= select_periodo_meses($control_name, $valor ? $valor->getNumero() : '', $campo->getTipoPeriodo());
     $control_name_anio = $campo_name . "[item_base_year_" . $item_base->getIdItemBase() . "]";
     $value .= select_year_tag($control_name_anio, $valor ? $valor->getAnio() : '', array('include_blank' => true));
     //select_year_tag
 } elseif ($campo->esTipoTextoCorto()) {
     if ($campo->getTamano() != null && $campo->getTamano() != "") {
         $tamano = $campo->getTamano();
     } else {
         $tamano = '60';
     }
     $value .= input_tag($control_name, $valor ? $valor->getTextoCorto() : $campo->getDefecto(), array('control_name' => $control_name, 'size' => $tamano));
 } elseif ($campo->esTipoFecha()) {
     if ($valor == null) {
         $valor_fecha = "";
         switch ($campo->getDefecto()) {
             case 1:
                 $fecha = new Date();
                 $valor_fecha = $fecha->getTimestamp();
コード例 #7
0
ファイル: form_tags.php プロジェクト: qlixes/springphp
/**
 * Returns three <select> tags populated with a range of months, days, and years.
 *
 * By default, the <i>$value</i> parameter is set to today's month, day and year. To override this, simply pass a valid date
 * or a correctly formatted date array (see example) to the <i>$value</i> parameter. You can also set the <i>$value</i>
 * parameter to null which will disable the <i>$value</i>, however this will only be useful if you pass 'include_blank' or
 * 'include_custom' to the <i>$options</i> parameter. Also, the default selectable range of years is set to show five years
 * back and five years forward from today's year. For instance, if today's year is 2006, the default 'year_start' option will
 * be set to 2001 and the 'year_end' option will be set to 2011.  These start and end dates can easily be overwritten by
 * setting the 'year_start' and 'year_end' options in the <i>$options</i> parameter.
 *
 * <b>Note:</b> The <i>$name</i> parameter will automatically converted to array names. For example, a <i>$name</i> of "date" becomes:
 * <samp>
 *  <select name="date[month]">...</select>
 *  <select name="date[day]">...</select>
 *  <select name="date[year]">...</select>
 * </samp>
 *
 * <b>Options:</b>
 * - include_blank     - Includes a blank <option> tag at the beginning of the string with an empty value.
 * - include_custom    - Includes an <option> tag with a custom display title at the beginning of the string with an empty value.
 * - discard_month     - If set to true, will only return select tags for day and year.
 * - discard_day       - If set to true, will only return select tags for month and year.
 * - discard_year      - If set to true, will only return select tags for month and day.
 * - use_month_numbers - If set to true, will show the month's numerical value (1 - 12) instead of the months full name.
 * - use_short_month   - If set to true, will show the month's short name (i.e. Jan, Feb, Mar) instead of its full name.
 * - year_start        - If set, the range of years will begin at this four-digit date (i.e. 1979)
 * - year_end          - If set, the range of years will end at this four-digit date (i.e. 2025)
 * - date_seperator    - Includes a string of defined text between each generated select tag
 *
 * <b>Examples:</b>
 * <code>
 *  echo submit_date_tag('date');
 * </code>
 *
 * <code>
 *  echo select_date_tag('date', '2006-10-30');
 * </code>
 *
 * <code>
 *  $date = array('year' => '1979', 'month' => 10, 'day' => 30);
 *  echo select_date_tag('date', $date, array('year_start' => $date['year'] - 10, 'year_end' => $date['year'] + 10));
 * </code>
 *
 * @param  string field name (automatically becomes an array of parts: name[year], name[month], year[day])
 * @param  mixed  accepts a valid date string or properly formatted date array
 * @param  array  additional HTML compliant <select> tag parameters
 * @return string three <select> tags populated with a months, days and years
 * @see select datetime_tag, select_month_tag, select_date_tag, select_year_tag
 */
function select_date_tag($name, $value = null, $options = array(), $html_options = array())
{
    $options = _parse_attributes($options);
    $date_seperator = _get_option($options, 'date_seperator', '/');
    $discard_month = _get_option($options, 'discard_month');
    $discard_day = _get_option($options, 'discard_day');
    $discard_year = _get_option($options, 'discard_year');
    //discarding month automatically discards day
    if ($discard_month) {
        $discard_day = true;
    }
    $order = _get_option($options, 'order');
    $tags = array();
    if (is_array($order) && count($order) == 3) {
        foreach ($order as $v) {
            $tags[] = $v[0];
        }
    } else {
        $tags = array('m', 'd', 'y');
    }
    if ($include_custom = _get_option($options, 'include_custom')) {
        $include_custom_month = is_array($include_custom) ? isset($include_custom['month']) ? array('include_custom' => $include_custom['month']) : array() : array('include_custom' => $include_custom);
        $include_custom_day = is_array($include_custom) ? isset($include_custom['day']) ? array('include_custom' => $include_custom['day']) : array() : array('include_custom' => $include_custom);
        $include_custom_year = is_array($include_custom) ? isset($include_custom['year']) ? array('include_custom' => $include_custom['year']) : array() : array('include_custom' => $include_custom);
    } else {
        $include_custom_month = array();
        $include_custom_day = array();
        $include_custom_year = array();
    }
    $month_name = $name . '[month]';
    $m = !$discard_month ? select_month_tag($month_name, _parse_value_for_date($value, 'month', 'm'), $options + $include_custom_month, $html_options) : '';
    $day_name = $name . '[day]';
    $d = !$discard_day ? select_day_tag($day_name, _parse_value_for_date($value, 'day', 'd'), $options + $include_custom_day, $html_options) : '';
    $year_name = $name . '[year]';
    $y = !$discard_year ? select_year_tag($year_name, _parse_value_for_date($value, 'year', 'Y'), $options + $include_custom_year, $html_options) : '';
    // we have $tags = array ('m','d','y')
    foreach ($tags as $k => $v) {
        // $tags['m|d|y'] = $m|$d|$y
        $tags[$k] = ${$v};
    }
    return implode($date_seperator, $tags);
}
コード例 #8
0
$t->like(select_month_tag('month', 2, array('use_short_month' => true, 'add_month_numbers' => true)), '/<option value="1">1 - Jan<\\/option>/i', 'select_month_tag() displays month names and month number if passed a "add_month_numbers" options');
$t->like(select_month_tag('month', null, array('include_custom' => 'test')), "/<option value=\"\">test<\\/option>/", 'select_month_tag() can take an "include_custom" option');
$t->like(select_month_tag('month', null, array('include_blank' => true)), "/<option value=\"\"><\\/option>/", 'select_month_tag() can take an "include_blank" option');
$t->like(select_month_tag('month', null, array(), array('class' => 'foo')), '<select name="month" id="month" class="foo">', 'select_month_tag() takes an array of attribute options as its fourth argument');
$t->like(select_month_tag('month', null, array(), array('id' => 'foo')), '<select name="month" id="foo">', 'select_month_tag() takes an array of attribute options as its fourth argument');
// select_year_tag()
$t->diag('select_year_tag()');
$t->like(select_year_tag('year'), '/<select name="year" id="year">/', 'select_year_tag() outputs a select tag for years');
$t->like(select_year_tag('year'), '/<option value="' . date('Y') . '" selected="selected">/', 'select_year_tag() selects the current year by default');
$t->like(select_year_tag('year', 2006), '/<option value="2006" selected="selected">/', 'select_year_tag() takes a year as its second argument');
// options
$t->is(preg_match_all('/<option /', select_year_tag('year', 2006, array('year_start' => 2005, 'year_end' => 2007)), $matches), 3, 'select_year_tag() takes a "year_start" and a "year_end" options');
$t->like(select_year_tag('year', null, array('include_custom' => 'test')), "/<option value=\"\">test<\\/option>/", 'select_year_tag() can take an "include_custom" option');
$t->like(select_year_tag('year', null, array('include_blank' => true)), "/<option value=\"\"><\\/option>/", 'select_year_tag() can take an "include_blank" option');
$t->like(select_year_tag('year', null, array(), array('class' => 'foo')), '<select name="year" id="year" class="foo">', 'select_year_tag() takes an array of attribute options as its fourth argument');
$t->like(select_year_tag('year', null, array(), array('id' => 'foo')), '<select name="year" id="foo">', 'select_year_tag() takes an array of attribute options as its fourth argument');
// select_date_tag()
$t->diag('select_date_tag()');
$t->todo('select_date_tag()');
// select_second_tag()
$t->diag('select_second_tag()');
$t->like(select_second_tag('second'), '/<select name="second" id="second">/', 'select_second_tag() outputs a select tag for seconds');
$t->like(select_second_tag('second'), '/selected="selected">' . date('s') . '/', 'select_second_tag() selects the current seconds by default');
$t->like(select_second_tag('second', 12), '/<option value="12" selected="selected">/', 'select_second_tag() takes a second number as its second argument');
$t->like(select_second_tag('second', '02'), '/<option value="2" selected="selected">/', 'select_second_tag() takes a second number as its second argument');
// options
$t->like(select_second_tag('second', null, array('include_custom' => 'test')), "/<option value=\"\">test<\\/option>/", 'select_second_tag() can take an "include_custom" option');
$t->like(select_second_tag('second', null, array('include_blank' => true)), "/<option value=\"\"><\\/option>/", 'select_second_tag() can take an "include_blank" option');
$t->like(select_second_tag('second', null, array(), array('class' => 'foo')), '<select name="second" id="second" class="foo">', 'select_second_tag() takes an array of attribute options as its fourth argument');
$t->like(select_second_tag('second', null, array(), array('id' => 'foo')), '<select name="second" id="foo">', 'select_second_tag() takes an array of attribute options as its fourth argument');
$t->is(preg_match_all("/<option value=\"/", select_second_tag('second', null, array('second_step' => 10)), $matches), 6, 'select_second_tag() can take an "second_step" option');
コード例 #9
0
function campo_periodos($nombre, $duracion_periodo_meses = 1, $periodo_from = '', $year_from = '', $periodo_to = '', $year_to = '')
{
    $label_campo = $nombre;
    $label = $label_campo;
    $label_from = $label . "[from]";
    $label_to = $label . "[to]";
    $value = "<ul class=\"sf_admin_checklist\">\n";
    $value .= "<li>";
    $value .= select_periodo_meses($label_from . '[periodo]', $periodo_from, $duracion_periodo_meses);
    $value .= select_year_tag($label_from . '[year]', $year_from, array('include_blank' => true));
    $value .= "</li>\n";
    $value .= "<li>";
    $value .= select_periodo_meses($label_to . '[periodo]', $periodo_to, $duracion_periodo_meses);
    $value .= select_year_tag($label_to . '[year]', $year_to, array('include_blank' => true));
    $value .= "</li>\n";
    $value .= "</ul>\n";
    return $value;
}
コード例 #10
0
ファイル: bind_tags.php プロジェクト: qlixes/springphp
function select_year($path, $options = array(), $html_options = array())
{
    $name = _get_complete_bind_path($path);
    $bindStatus =& new BindStatus(_get_bind_path($path));
    $boundValue = $bindStatus->getDisplayValue();
    return select_year_tag($name, $boundValue, $options, $html_options);
}
コード例 #11
0
ファイル: indexSuccess.php プロジェクト: mediasadc/alba
                    <?php 
echo label_for('fecha', __('Fecha Inicio:'), 'class="required" ');
?>
       
                </td>
                <td>
                    <?php 
//----- Nuevo -----//
//@TODO Obtener el año de inicio y de fin del cliclo lectivo
echo select_day_tag('dia', $d, 'include_custom=Elija un d&iacute;a');
?>
                    <?php 
echo select_month_tag('mes', $m, 'include_custom=Elija un mes use_short_month=true');
?>
                    <?php 
echo select_year_tag('ano', $y, 'include_custom=Elija un a&ntilde;o year_end=' . $anio_hasta . ' year_start=' . $anio_desde);
?>
                </td>
                <td style='padding-left:50px'>
                    <?php 
echo label_for('vista', __('Vista:'), 'class="required"');
?>
                </td>
                <td>  
                    <?php 
echo select_tag('vistas', options_for_select($aVistas, $vista_id));
?>
                </td>
            </tr>

        <table>