function input_fecha_hora_tag($name, $fecha = null, $options = array())
{
    use_helper('DateForm');
    $mi_fecha = !$fecha || $fecha == '' ? 'now' : $fecha;
    $value = "";
    $value .= input_date_tag($name . '[date]', $mi_fecha, array('rich' => true, 'calendar_button_img' => '/images/icons/date.png'));
    $value .= select_time_tag($name, $mi_fecha, array('include_second' => false, '12hour_time' => false));
    return $value;
}
/**
 * Returns a variable number of <select> tags populated with date and time related select boxes.
 *
 * The select_datetime_tag is the culmination of both the select_date_tag and the select_time_tag.
 * By default, the <i>$value</i> parameter is set to the current date and time. To override this, simply pass a valid 
 * date, time, datetime string or correctly formatted 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. 
 * To include seconds to the result, use set the 'include_second' option in the <i>$options</i> parameter to true. 
 * <b>Note:</b> The <i>$name</i> parameter will automatically converted to array names. 
 * For example, a <i>$name</i> of "datetime" becomes:
 * <samp>
 *  <select name="datetime[month]">...</select>
 *  <select name="datetime[day]">...</select>
 *  <select name="datetime[year]">...</select>
 *  <select name="datetime[hour]">...</select>
 *  <select name="datetime[minute]">...</select>
 *  <select name="datetime[second]">...</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.
 * - include_second    - If set to true, includes the "seconds" select tag as part of the result.
 * - 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)
 * - second_step       - If set, the seconds will be incremented in blocks of X, where X = 'second_step'
 * - minute_step       - If set, the minutes will be incremented in blocks of X, where X = 'minute_step'
 * - 12hour_time       - If set to true, will return integers 1 through 12 instead of the default 0 through 23.
 * - date_seperator    - Includes a string of defined text between each generated select tag
 * - time_seperator    - Includes a string of defined text between each generated select tag
 * - ampm_seperator    - Includes a string of defined text between the minute/second select box and the AM/PM select box 
 *  
 * <b>Examples:</b>
 * <code>
 *  echo select_datetime_tag('datetime');
 * </code>
 *
 * <code>
 *  echo select_datetime_tag('datetime', '1979-10-30');
 * </code>
 *
 * <code>
 *  $datetime = array('year' => '1979', 'month' => 10, 'day' => 30, 'hour' => '15', 'minute' => 46);
 *  echo select_datetime_tag('time', $datetime, array('use_short_month' => true, '12hour_time' => true));
 * </code>
 *
 * @param  string field name (automatically becomes an array of date and time parts)
 * @param  mixed  accepts a valid time string or properly formatted time array
 * @param  array  additional HTML compliant <select> tag parameters
 * @return string a variable number of <select> tags populated with date and time related select boxes
 * @see select date_tag, select_time_tag
 */
function select_datetime_tag($name, $value = null, $options = array(), $html_options = array())
{
    $options = _parse_attributes($options);
    $datetime_seperator = _get_option($options, 'datetime_seperator', '');
    $date = select_date_tag($name, $value, $options, $html_options);
    $time = select_time_tag($name, $value, $options, $html_options);
    return $date . $datetime_seperator . $time;
}
Exemple #3
0
<?php

use_helper('DateForm');
echo select_time_tag("evento[hora_fin]", $hora_fin, array('include_second' => false, '12hour_time' => true), $hora_asociada == 0 ? array('disabled' => true) : array());
  <?php 
        $i++;
    }
    ?>

    <tr class="sf_admin_row_0">
    <td><?php 
    echo input_tag("turnos[{$i}][descripcion]", '');
    ?>
</td>
    <td><?php 
    echo select_time_tag("turnos[{$i}][hora_inicio]", array(), array('include_second' => false, '12hour_time' => true));
    ?>
</td>
    <td><?php 
    echo select_time_tag("turnos[{$i}][hora_fin]", array(), array('include_second' => false, '12hour_time' => true));
    ?>
</td>
    <td></td>
  </tr>


  </tbody>
<tfoot>
  <tr>
    <th colspan="9">
      <div class="float-right">
<!--      <ul class="sf_admin_actions"><li><?php 
    echo button_to(__('create'), 'ciclolectivo/createTurno', array('class' => 'sf_admin_action_crear'));
    ?>
</li> </ul>
Exemple #5
0
<?php

use_helper('DateForm');
?>

<?php 
echo select_time_tag("turno[hora_fin]", $turno->getHoraFin(), array('include_second' => false, '12hour_time' => true));
$t->like(select_ampm_tag('ampm'), '/<option value="' . date('A') . '" selected="selected">/', 'select_ampm_tag() selects the current ampm by default');
$t->like(select_ampm_tag('ampm', 'AM'), '/<option value="AM" selected="selected">/', 'select_ampm_tag() takes a ampm as its second argument');
// options
$t->like(select_ampm_tag('ampm', null, array('include_custom' => 'test')), "/<option value=\"\">test<\\/option>/", 'select_ampm_tag() can take an "include_custom" option');
$t->like(select_ampm_tag('ampm', null, array('include_blank' => true)), "/<option value=\"\"><\\/option>/", 'select_ampm_tag() can take an "include_blank" option');
$t->like(select_ampm_tag('ampm', null, array(), array('class' => 'foo')), '<select name="ampm" id="ampm" class="foo">', 'select_ampm_tag() takes an array of attribute options as its fourth argument');
$t->like(select_ampm_tag('ampm', null, array(), array('id' => 'foo')), '<select name="ampm" id="foo">', 'select_ampm_tag() takes an array of attribute options as its fourth argument');
// select_time_tag()
$t->diag('select_time_tag()');
$t->like(select_time_tag('time'), '/<select name="time\\[hour\\]" id="time_hour">/', 'select_time_tag() outputs a select tag for hours');
$t->like(select_time_tag('time'), '/selected="selected">' . date('H') . '/', 'select_time_tag() selects the current hours by default');
$t->like(select_time_tag('time'), '/<select name="time\\[minute\\]" id="time_minute">/', 'select_time_tag() outputs a select tag for minutes');
$t->like(select_time_tag('time'), '/selected="selected">' . date('i') . '/', 'select_time_tag() selects the current minutes by default');
$t->like(select_time_tag('time', '09:01:05'), '/<option value="9" selected="selected">/', 'select_time_tag() selects hours for one digit correctly');
$t->like(select_time_tag('time', '09:01:05'), '/<option value="1" selected="selected">/', 'select_time_tag() selects minutes for one digit correctly');
$t->like(select_time_tag('time', '09:01:05', array('include_second' => true)), '/<option value="5" selected="selected">/', 'select_time_tag() selects seconds for one digit correctly');
$t->todo('select_time_tag()');
// select_timezone_tag()
$t->diag('select_timezone_tag()');
$t->like(select_timezone_tag('timezone'), '/<select name="timezone" id="timezone">/', 'select_timezone_tag() outputs a select tag for timezones');
$t->like(select_timezone_tag('timezone'), '/<option value="America\\/Los_Angeles">America\\/Los_Angeles<\\/option>/', 'select_timezone_tag() outputs a select tag for timezones');
$t->like(select_timezone_tag('timezone', null, array('display' => 'city')), '/<option value="America\\/Los_Angeles">Los Angeles<\\/option>/', 'select_timezone_tag() respects the display option');
$t->like(select_timezone_tag('timezone', null, array('display' => 'timezone')), '/<option value="America\\/Dawson">Pacific Standard Time<\\/option>/', 'select_timezone_tag() respects the display option');
$t->like(select_timezone_tag('timezone', null, array('display' => 'timezone_abbr')), '/<option value="America\\/Dawson">PST<\\/option>/', 'select_timezone_tag() respects the display option');
$t->like(select_timezone_tag('timezone', null, array('display' => 'timezone_dst')), '/<option value="America\\/Dawson">Pacific Daylight Time<\\/option>/', 'select_timezone_tag() respects the display option');
$t->like(select_timezone_tag('timezone', null, array('display' => 'timezone_dst_abbr')), '/<option value="America\\/Dawson">PDT<\\/option>/', 'select_timezone_tag() respects the display option');
// select_datetime_tag()
$t->diag('select_datetime_tag()');
$t->todo('select_datetime_tag()');
// select_number_tag()
$t->diag('select_number_tag()');
Exemple #7
0
<?php

use_helper('DateForm');
?>

<?php 
echo select_time_tag("turno[hora_inicio]", $turno->getHoraInicio(), array('include_second' => false, '12hour_time' => true));
Exemple #8
0
function select_time($path, $options = array(), $html_options = array())
{
    $name = _get_complete_bind_path($path);
    $bindStatus =& new BindStatus(_get_bind_path($path));
    $boundValue = $bindStatus->getDisplayValue();
    return select_time_tag($name, $boundValue, $options, $html_options);
}
// select_ampm_tag()
$t->diag('select_ampm_tag()');
$t->like(select_ampm_tag('ampm'), '/<select name="ampm" id="ampm">/', 'select_ampm_tag() outputs a select tag for ampm');
$t->like(select_ampm_tag('ampm'), '/<option value="' . date('A') . '" selected="selected">/', 'select_ampm_tag() selects the current ampm by default');
$t->like(select_ampm_tag('ampm', 'AM'), '/<option value="AM" selected="selected">/', 'select_ampm_tag() takes a ampm as its second argument');
// options
$t->like(select_ampm_tag('ampm', null, array('include_custom' => 'test')), "/<option value=\"\">test<\\/option>/", 'select_ampm_tag() can take an "include_custom" option');
$t->like(select_ampm_tag('ampm', null, array('include_blank' => true)), "/<option value=\"\"><\\/option>/", 'select_ampm_tag() can take an "include_blank" option');
$t->like(select_ampm_tag('ampm', null, array(), array('class' => 'foo')), '<select name="ampm" id="ampm" class="foo">', 'select_ampm_tag() takes an array of attribute options as its fourth argument');
$t->like(select_ampm_tag('ampm', null, array(), array('id' => 'foo')), '<select name="ampm" id="foo">', 'select_ampm_tag() takes an array of attribute options as its fourth argument');
// select_time_tag()
$t->diag('select_time_tag()');
$t->like(select_time_tag('time'), '/<select name="time\\[hour\\]" id="time_hour">/', 'select_time_tag() outputs a select tag for hours');
$t->like(select_time_tag('time'), '/selected="selected">' . date('H') . '/', 'select_time_tag() selects the current hours by default');
$t->like(select_time_tag('time'), '/<select name="time\\[minute\\]" id="time_minute">/', 'select_time_tag() outputs a select tag for minutes');
$t->like(select_time_tag('time'), '/selected="selected">' . date('i') . '/', 'select_time_tag() selects the current minutes by default');
$t->todo('select_time_tag()');
// select_datetime_tag()
$t->diag('select_datetime_tag()');
$t->todo('select_datetime_tag()');
// select_number_tag()
$t->diag('select_number_tag()');
$t->like(select_number_tag('number', 3), '/<select name="number" id="number">/', 'select_number_tag() outputs a select tag for a range of numbers');
// options
$t->like(select_number_tag('number', null, array('include_custom' => 'test')), "/<option value=\"\">test<\\/option>/", 'select_number_tag() can take an "include_custom" option');
$t->like(select_number_tag('number', null, array('include_blank' => true)), "/<option value=\"\"><\\/option>/", 'select_number_tag() can take an "include_blank" option');
$t->like(select_number_tag('number', null, array(), array('class' => 'foo')), '<select name="number" id="number" class="foo">', 'select_number_tag() takes an array of attribute options as its fourth argument');
$t->like(select_number_tag('number', null, array(), array('id' => 'foo')), '<select name="number" id="foo">', 'select_number_tag() takes an array of attribute options as its fourth argument');
$t->is(preg_match_all('/<option/', select_number_tag('number', 3, array('increment' => 4)), $matches), 4, 'select_number_tag() can take an "increment" option');
foreach (array(1, 5, 9, 13) as $number) {
    $t->like(select_number_tag('number', 3, array('increment' => 4)), '/<option value="' . $number . '"/', 'select_number_tag() can take an "increment" option');