Example #1
0
/**
* Initialise le DatePicker, sert à retourner typeDate, si echoOff est true, ça return la valeur pour le template Twig au lieu du echo,
* les echos sont à supprimer dès que l'intégration twig est terminée
*
* @param $typeDate
* @param bool|false $echoOff
*/
function jQuery_DatePicker($typeDate, $echoOff = false)
{
    if (@file_exists('../include/connect.inc.php')) {
        $racine = '../';
    } else {
        $racine = './';
    }
    if ($typeDate == 'rep_end' && isset($_GET['id'])) {
        $res = grr_sql_query('SELECT repeat_id FROM ' . TABLE_PREFIX . '_entry WHERE id=' . $_GET['id'] . ';');
        if (!$res) {
            fatal_error(0, grr_sql_error());
        }
        $repeat_id = implode('', grr_sql_row($res, 0));
        $res = grr_sql_query('SELECT rep_type, end_date, rep_opt, rep_num_weeks, start_time, end_time FROM ' . TABLE_PREFIX . "_repeat WHERE id={$repeat_id}");
        if (!$res) {
            fatal_error(0, grr_sql_error());
        }
        if (grr_sql_count($res) == 1) {
            $row6 = grr_sql_row($res, 0);
            $date = date_parse(date('Y-m-d H:i:s', $row6[1]));
            $day = $date['day'];
            $month = $date['month'];
            $year = $date['year'];
        } else {
            if (isset($_GET['day'])) {
                $day = $_GET['day'];
            } else {
                $day = date('d');
            }
            if (isset($_GET['month'])) {
                $month = $_GET['month'];
            } else {
                $month = date('m');
            }
            if (isset($_GET['year'])) {
                $year = $_GET['year'];
            } else {
                $year = date('Y');
            }
        }
    } else {
        if (isset($_GET['day'])) {
            $day = $_GET['day'];
        } else {
            $day = date('d');
        }
        if (isset($_GET['month'])) {
            $month = $_GET['month'];
        } else {
            $month = date('m');
        }
        if (isset($_GET['year'])) {
            $year = $_GET['year'];
        } else {
            $year = date('Y');
        }
    }
    if ($echoOff) {
        //$tplArrayDatePicker['typeDate'] = $typeDate;
        return genDateSelectorForm('' . $typeDate . '_', "{$day}", "{$month}", "{$year}", '');
    } else {
        genDateSelector('' . $typeDate . '_', "{$day}", "{$month}", "{$year}", '');
        echo '<input type="hidden" disabled="disabled" id="mydate_' . $typeDate . '">' . PHP_EOL;
        echo '<script>' . PHP_EOL;
        echo '	$(function() {' . PHP_EOL;
        echo '$.datepicker.setDefaults( $.datepicker.regional[\'fr\'] );' . PHP_EOL;
        echo '	$(\'#mydate_' . $typeDate . '\').datepicker({' . PHP_EOL;
        echo '		beforeShow: readSelected, onSelect: updateSelected,' . PHP_EOL;
        echo '		showOn: \'both\', buttonImageOnly: true, buttonImage: \'images/calendar.png\',buttonText: "Choisir la date"});' . PHP_EOL;
        echo '		function readSelected()' . PHP_EOL;
        echo '		{' . PHP_EOL;
        echo '			$(\'#mydate_' . $typeDate . '\').val($(\'#' . $typeDate . '_day\').val() + \'/\' +' . PHP_EOL;
        echo '			$(\'#' . $typeDate . '_month\').val() + \'/\' + $(\'#' . $typeDate . '_year\').val());' . PHP_EOL;
        echo '			return {};' . PHP_EOL;
        echo '		}' . PHP_EOL;
        echo '		function updateSelected(date)' . PHP_EOL;
        echo '		{' . PHP_EOL;
        echo '			$(\'#' . $typeDate . '_day\').val(date.substring(0, 2));' . PHP_EOL;
        echo '			$(\'#' . $typeDate . '_month\').val(date.substring(3, 5));' . PHP_EOL;
        echo '			$(\'#' . $typeDate . '_year\').val(date.substring(6, 10));' . PHP_EOL;
        echo '		}' . PHP_EOL;
        echo '	});' . PHP_EOL;
        echo '</script>' . PHP_EOL;
    }
}
Example #2
0
/**
 * @param string $prefix
 * @param string $option
 */
function genDateSelector($prefix, $day, $month, $year, $option)
{
    echo genDateSelectorForm($prefix, $day, $month, $year, $option);
}
Example #3
0
    if($edit_type == "series")
        $A = get_vocab("editseries").grr_help("aide_grr_periodicite");
    else
        if (isset($_GET["copy"])) $A = get_vocab("copyentry");
        else $A = get_vocab("editentry");
$B = get_vocab("namebooker");
if (getSettingValue("remplissage_description_breve")=='1') {
   $B .= " *";
   $affiche_mess_asterisque=true;
}
$B .= get_vocab("deux_points");
$C = grr_htmlSpecialChars($breve_description);
$D = get_vocab("fulldescription");
$E = htmlspecialchars ( $description );
$F = get_vocab("date").get_vocab("deux_points");
$G = genDateSelectorForm("start_", $start_day, $start_month, $start_year,"");

//Determine l'ID de "area" de la "room"
$sql = "select area_id from ".TABLE_PREFIX."_room where id=$room_id";
$res = grr_sql_query($sql);
$row = grr_sql_row($res, 0);
$area_id = $row[0];

// Détermine si la ressource est moderée
$moderate = grr_sql_query1("select moderate from ".TABLE_PREFIX."_room where id='".$room_id."'");
echo "<h2>$A</h2>\n";
if ($moderate) echo "<h3><span class='texte_ress_moderee'>".$vocab["reservations_moderees"]."</span></h3>\n";
echo "<form id=\"main\" action=\"edit_entry_handler.php\" method=\"get\">\n";
?>
 <script type="text/javascript" >
function changeRooms( formObj )