<link rel="stylesheet" href="style.css"> <title>test</title> </head> <body> <?php $events = ["CALENDRIER 1" => ["2016-01-01" => ["titre1", "descrition1"]], "CALENDRIER 2" => ["2016-02-01" => ["titre2", "descrition2"]], "CALENDRIER 3" => ["2016-03-04" => ["titre2", "descrition2"]], "CALENDRIER 4" => ["2016-01-01" => ["titre2", "descrition2"]], "CALENDRIER 5" => ["2016-01-01" => ["titre2", "descrition2"]], "CALENDRIER 6" => ["2016-03-20" => ["titre2", "descrition2"]], "CALENDRIER 7" => ["2016-01-01" => ["titre2", "descrition2"]], "CALENDRIER 8" => ["2016-01-01" => ["titre2", "descrition2"]], "CALENDRIER 9" => ["2016-02-23" => ["titre2", "descrition2"]], "CALENDRIER 10" => ["2016-01-01" => ["titre2", "descrition2"]], "CALENDRIER 11" => ["2016-05-01" => ["titre2", "descrition2"]], "CALENDRIER 12" => ["2016-01-01" => ["titre2", "descrition2"]], "CALENDRIER 13" => ["2016-01-01" => ["titre2", "descrition2"]], "CALENDRIER 14" => ["2016-01-01" => ["titre2", "descrition2"]]]; // url du serveur $servername = "localhost"; // Nom d'utilisateur Base de données $username = "******"; // MDP utilisateur $password = ""; // Nom de la base de donnée $dbname = "Dynamo"; $co = mysqli_connect($servername, $username, $password, $dbname) or die("pas de base de donnée :("); $sql = "SELECT groupe.titre, planning.date, planning.activité, planning.description AS description, dstart, dend FROM planning JOIN groupe ON groupe.id = planning.id_groupe"; $result = mysqli_query($co, $sql); $events = []; while ($row = mysqli_fetch_assoc($result)) { $events[$row['titre']][] = [$row['date'], $row['activité'], $row['description'], $row['dstart'], $row['dend']]; } ?> <?php Calendar(12, $events); ?> <script src="cal.js" charset="utf-8"></script> </body> </html>
function CalendarPeriod($sFromName, $sFromVal, $sToName, $sToVal, $sFormName="skform", $show_select="N", $field_select="class=\"typeselect\"", $field_input="class=\"typeinput\"", $size="10") { if(class_exists("CAdminCalendar")) return CAdminCalendar::CalendarPeriod($sFromName, $sToName, $sFromVal, $sToVal, ($show_select=="Y"), $size, ($size > 10)); $arr = array(); $str = ""; if ($show_select=="Y") { $sname = $sFromName."_DAYS_TO_BACK"; $str = " <script type=\"text/javascript\"> function ".$sFromName."_SetDate() { var number = document.".$sFormName.".".$sname.".selectedIndex-1; document.".$sFormName.".".$sFromName.".disabled = false; if (number>=0) { document.".$sFormName.".".$sFromName.".value = dates[number]; document.".$sFormName.".".$sFromName.".disabled = true; } } </script> "; global $$sname; $value = $$sname; if (strlen($value)>0 && $value!="NOT_REF") $ds="disabled"; ?><script type="text/javascript"> var dates = new Array(); <? for ($i=0; $i<=90; $i++) { $prev_date = GetTime(time()-86400*$i); ?>dates[<?php echo $i; ?> ]="<?php echo $prev_date; ?> ";<? if (!is_array($arr["reference"])) $arr["reference"] = array(); if (!is_array($arr["reference_id"])) $arr["reference_id"] = array(); $arr["reference"][] = $i." ".GetMessage("TOOLS_DN"); $arr["reference_id"][] = $i; } ?></script><? $str .= SelectBoxFromArray($sname, $arr, $value , " ", "onchange=\"".$sFromName."_SetDate()\" ".$field_select); $str .= " "; } $str .= '<input '.$ds.' '.$field_input.' type="text" name="'.$sFromName.'" id="'.$sFromName.'" size="'.$size.'" value="'.htmlspecialcharsbx($sFromVal).'" /> '."\n". Calendar($sFromName, $sFormName, $sFromName, $sToName).' ... '."\n". '<input '.$field_input.' type="text" name="'.$sToName.'" id="'.$sToName.'" size="'.$size.'" value="'.htmlspecialcharsbx($sToVal).'" /> '."\n". Calendar($sToName, $sFormName, $sFromName, $sToName)."\n"; return '<span style="white-space: nowrap;">'.$str.'</span>'; }
<body> <p>Note: URL preservation has been disabled and the dates are not clickable.</p> <?php require_once "calendar.php"; ?> <h1>Calendar without session</h1> <?php Calendar(array("LANGUAGE_CODE" => "zh", "PREFIX" => "cal1_", "PRESERVE_URL" => false, "DATE_URL" => "target/target.php")); ?> <h1>Calendar with session</h1> <?php Calendar(array("LANGUAGE_CODE" => "zh", "PREFIX" => "cal2_", "PRESERVE_URL" => false, "USE_SESSION" => true, "DATE_URL" => "target/target.php")); ?> <h1>JavaScript calendar (without session)</h1> <script type="text/javascript" src="calendar_js.php?LANGUAGE_CODE=zh&PREFIX=cal3_&PRESERVE_URL=false&DATE_URL=target%2ftarget.php"></script> <h1>Calendar as return value</h1> <?php $html_code = Calendar(array("LANGUAGE_CODE" => "zh", "PREFIX" => "cal4_", "PRESERVE_URL" => false, "OUTPUT_MODE" => "return", "DATE_URL" => "target/target.php")); // Commenting out the next line makes the calendar not being rendered echo $html_code; ?> </body> </html>
function ConditionShow($arArgs=array()) { global $strCondition, $APPLICATION, $arGroupsNames, $arDisplay, $arConditionTypes, $strFolder, $strUrl_param, $strUrl_value, $arSelGroups, $strPer_start, $strPer_end, $CurType, $USER; $i=$arArgs['i']; $field_name=$arArgs['field_name']; $form=$arArgs['form']; ?> <div style="display:<?php echo $arDisplay['empty']; ?> " id="type_empty<?php echo $i; ?> "><?php echo GetMessage("TYPES_EMPTY_COND"); ?> </div> <?if (isset($arConditionTypes['false'])):?> <div style="display:<?php echo $arDisplay['false']; ?> " id="type_false<?php echo $i; ?> "><?php echo GetMessage("TYPES_FALSE_COND"); ?> </div> <?endif;?> <div style="display:<?php echo $arDisplay['folder']; ?> " value="<?php echo htmlspecialcharsbx($strFolder); ?> " id="type_folder<?php echo $i; ?> "> <? CAdminFileDialog::ShowScript(Array ( "event" => "BtnClick$i", "arResultDest" => Array("ELEMENT_ID" => "fname$i"), "arPath" => Array("PATH" => '/'), "select" => 'DF', // F - file only, D - folder only, "operation" => 'O',// O - open, S - save "showUploadTab" => true, "saveConfig" => true, ) ); ?><input title="<?php echo GetMessage("MAIN_PATH"); ?> " type="text" size="25" id="fname<?php echo $i; ?> " name="<?php echo $field_name; ?> [CONDITION_folder]" value="<?php echo htmlspecialcharsbx($strFolder); ?> "> <input type="button" name="browse" value="..." onClick="BtnClick<?php echo $i; ?> ()"> </div> <div style="display:<?php echo $arDisplay['ugroups']; ?> " id="type_ugroups<?php echo $i; ?> "> <select title="<?php echo GetMessage("MAIN_USERGROUPS"); ?> " multiple size=5 style="width:100%" name="<?php echo $field_name; ?> [CONDITION_ugroups][]"><? reset($arGroupsNames); while ($e=each($arGroupsNames)) echo '<option value="'.$e[0].'"'.(in_array($e[0], $arSelGroups)?" selected":"").'>'.htmlspecialcharsbx($e[1]).'</option>'; ?></select> </div> <div style="display:<?php echo $arDisplay['period']; ?> " id="type_period<?php echo $i; ?> "> <input title="<?php echo GetMessage("MAIN_PERIOD_FROM"); ?> " type="text" size="10" value="<?php echo htmlspecialcharsbx($strPer_start); ?> " name="<?php echo $field_name; ?> [CONDITION_period_start]" id="<?php echo $field_name; ?> [CONDITION_period_start]"> <?php echo Calendar($field_name . "[CONDITION_period_start]", $form); ?> - <input title="<?php echo GetMessage("MAIN_PERIOD_TO"); ?> " type="text" size="10" value="<?php echo htmlspecialcharsbx($strPer_end); ?> " name="<?php echo $field_name; ?> [CONDITION_period_end]"> <?php echo Calendar($field_name . "[CONDITION_period_end]", $form); ?> <span class="required"></span> </div> <div style="display:<?php echo $arDisplay['url']; ?> " id="type_url<?php echo $i; ?> "> <input title="<?php echo GetMessage("MAIN_URL_FIELD"); ?> " type="text" size="10" name="<?php echo $field_name; ?> [CONDITION_url_param]" value="<?php echo htmlspecialcharsbx($strUrl_param); ?> "> = <input title="<?php echo GetMessage("MAIN_URL_VALUE"); ?> " type="text" size="10" name="<?php echo $field_name; ?> [CONDITION_url_value]" value="<?php echo htmlspecialcharsbx($strUrl_value); ?> "> </div> <div style="display:<?php echo $arDisplay['php']; ?> " id="type_php<?php echo $i; ?> "><input type="text" style="width:100%" size="25" name="<?php echo $field_name; ?> [CONDITION_php]" value="<?php echo htmlspecialcharsex($strCondition); ?> " <?echo ((!$USER->CanDoOperation('edit_php')) ? 'disabled' : '');?>></div> <? }
?> name="<?php echo htmlspecialchars($arField["NAME"]); ?> "> <?php } elseif ($arField["TYPE"] == "date") { ?> <input type="text" maxlength="255" value="<?php echo htmlspecialchars($val); ?> " name="<?php echo htmlspecialchars($arField["NAME"]); ?> "> <?php echo Calendar(htmlspecialchars($arField["NAME"]), "post_form"); ?> <?php } elseif ($arField["TYPE"] == "textarea") { ?> <textarea name="<?php echo htmlspecialchars($arField["NAME"]); ?> "<?php if ($arField["COLS"]) { ?> cols="<?php echo $arField["COLS"]; ?> "<?php }
:</td> <td> <?php switch ($arSetting["TYPE"]) { case "CHECKBOX": $res = "<input type=\"checkbox\" id=\"PARAM_" . htmlspecialcharsbx($settingName) . "\" name=\"PARAMS[" . htmlspecialcharsbx($settingName) . "]\" value=\"Y\"" . ($arSetting["DEFAULT"] == "Y" ? " checked=\"checked\"" : "") . " />"; break; case "DROPDOWN": $res = "<select id=\"PARAM_" . htmlspecialcharsbx($settingName) . "\" name=\"PARAMS[" . htmlspecialcharsbx($settingName) . "]\">"; foreach ($arSetting["VALUES"] as $value => $title) { $res .= "<option value=\"" . htmlspecialcharsbx($value) . "\"" . ($value == $arSetting["DEFAULT"] ? " selected=\"selected\"" : "") . ">" . htmlspecialcharsbx($title) . "</option>"; } $res .= "</select>"; break; case "DATE": $res = "<input type=\"text\" name=\"PARAMS[" . htmlspecialcharsbx($settingName) . "]\" id=\"PARAM_" . htmlspecialcharsbx($settingName) . "\" value=\"" . htmlspecialcharsbx($arSettings["DEFAULT"]) . "\" />\n" . Calendar("PARAMS[" . htmlspecialcharsbx($settingName) . "]", "form1"); break; default: $res = "<input type=\"text\" id=\"PARAM_" . htmlspecialcharsbx($settingName) . "\" name=\"PARAMS[" . htmlspecialcharsbx($settingName) . "]\" value=\"" . htmlspecialcharsbx($arSetting["DEFAULT"]) . "\" />"; break; } // endswitch echo $res; ?> </td> </tr> <?php } // endforeach ?> </table>
function ShowOptionCustom($gks_tab_id, $gks_option_id, $option, $set_variables = true) { global $APPLICATION; global $arLang; ob_start(); switch ($option["TYPE"]) { case "text": ?> <table cellspacing="0" cellpadding="0"><tr> <td><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_TAB_OPTION_CUSTOM_DEFAULT_VALUE"); ?> </td> <td><input type="text" name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][DEFAULT_VALUE]" value="<?php echo htmlspecialchars($option["DEFAULT_VALUE"]); ?> " /></td> </tr></table> <table cellspacing="0" cellpadding="0"><tr> <td><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_TAB_OPTION_TYPE_TEXT_SIZE"); ?> </td> <td><input type="text" name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][SIZE]" size="4" value="<?php echo htmlspecialchars($option["SIZE"]); ?> " /></td> </tr></table> <?php break; case "textarea": ?> <table cellspacing="0" cellpadding="0"><tr> <td><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_TAB_OPTION_CUSTOM_DEFAULT_VALUE"); ?> </td> <td><textarea name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][DEFAULT_VALUE]"><?php echo htmlspecialchars($option["DEFAULT_VALUE"]); ?> </textarea></td> </tr></table> <table cellspacing="0" cellpadding="0"><tr> <td><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_TAB_OPTION_TYPE_TEXT_SIZE"); ?> </td> <td><input type="text" name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][COLS]" size="4" value="<?php echo htmlspecialchars($option["COLS"]); ?> " /></td> <td>x</td> <td><input type="text" name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][ROWS]" size="4" value="<?php echo htmlspecialchars($option["ROWS"]); ?> " /></td> </tr></table> <?php break; case "checkbox": ?> <table cellspacing="0" cellpadding="0"><tr> <td><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_TAB_OPTION_CUSTOM_DEFAULT_VALUE"); ?> </td> <td><input type="checkbox" name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][DEFAULT_VALUE]" value="Y"<?php if ($option["DEFAULT_VALUE"] == "Y") { ?> checked="checked"<?php } ?> /></td> </tr></table> <?php break; case "select": ?> <?php if ($set_variables) { ?> <script type="text/javascript"> gks_selectvalues[<?php echo $gks_tab_id; ?> ][<?php echo $gks_option_id; ?> ]=0; </script> <?php } ?> <table cellspacing="0" cellpadding="0"><tr> <td><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_TAB_OPTION_CUSTOM_DEFAULT_VALUE"); ?> </td> <td> <select name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][DEFAULT_VALUE]"> <?php foreach ($option["VALUES"] as $value) { ?> <option value="<?php echo htmlspecialchars($value["VALUE"]); ?> "<?php if ($option["DEFAULT_VALUE"] == $value["VALUE"]) { ?> selected="selected"<?php } ?> ><?php echo $value["LANG"][LANGUAGE_ID]; ?> </option> <?php } ?> </select> </td> </tr></table> <table class="gcustomsettings-settings-selectvalue-table"> <thead> <tr> <td class="gcustomsettings-settings-selectvalue-col-value"><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_SELECTVALUE_TD_VALUE"); ?> </td> <td class="gcustomsettings-settings-selectvalue-col-name"><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_SELECTVALUE_TD_NAME"); ?> </td> <td class="gcustomsettings-settings-selectvalue-col-remove"> </td> </tr> </thead> </table> <div id="gks_option_selectvalues_<?php echo $gks_tab_id; ?> _<?php echo $gks_option_id; ?> "> <?php $gks_selectvalue_id = 1; foreach ($option["VALUES"] as $value) { ?> <div id="gks_selectvalue_<?php echo $gks_tab_id; ?> _<?php echo $gks_option_id; ?> _<?php echo $gks_selectvalue_id; ?> "> <?php echo self::ShowOptionSelectvalue($gks_tab_id, $gks_option_id, $gks_selectvalue_id, $value, true); ?> </div> <?php $gks_selectvalue_id++; } ?> </div> <div class="gcustomsettings-settings-selectvalue-add"> <a href="#" onclick="gksAddSelectValue('<?php echo $gks_tab_id; ?> ','<?php echo $gks_option_id; ?> '); return false;"><img src="/bitrix/images/grain.customsettings/gcustomsettings_options_option_icon_add.gif" width="16" height="16" border="0" /> <span><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_SELECTVALUE_ADD"); ?> </span></a> </div> <?php break; case "date": ?> <table cellspacing="0" cellpadding="0"><tr> <td><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_TAB_OPTION_CUSTOM_DEFAULT_VALUE"); ?> </td> <td><input type="text" name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][DEFAULT_VALUE]" value="<?php echo htmlspecialchars($option["DEFAULT_VALUE"]); ?> " /></td> <td><?php echo Calendar(htmlspecialchars("TABS[" . $gks_tab_id . "][FIELDS][" . $gks_option_id . "][DEFAULT_VALUE]"), "gcs_settings_form"); ?> </td> </tr></table> <?php break; case "link": ?> <?php if (self::IsLinksInstalled()) { ?> <input type="button" style="margin: 5px 0" onclick="gksShowLinksDataSourcePopup('TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][LINK]','gks_column_linkparams_<?php echo $gks_tab_id; ?> _<?php echo $gks_option_id; ?> '); return false;" value="<?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_LINK_SET_UP_DATA_SOURCE"); ?> " /> <div style="margin: 5px 0"> <?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_LINK_INTERFACE_TYPE"); ?> :<br /> <select name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][INTERFACE]"> <option value="ajax"<?php if ($option["INTERFACE"] == "ajax") { ?> selected="selected"<?php } ?> ><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_LINK_INTERFACE_AJAX"); ?> </option> <option value="select"<?php if ($option["INTERFACE"] == "select") { ?> selected="selected"<?php } ?> ><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_LINK_INTERFACE_SELECT"); ?> </option> <option value="selectsearch"<?php if ($option["INTERFACE"] == "selectsearch") { ?> selected="selected"<?php } ?> ><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_LINK_INTERFACE_SELECTSEARCH"); ?> </option> <option value="search"<?php if ($option["INTERFACE"] == "search") { ?> selected="selected"<?php } ?> ><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_LINK_INTERFACE_SEARCH"); ?> </option> </select> </div> <label><table cellspacing="0" cellpadding="0"><tr> <td><?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_LINK_INTERFACE_SHOW_URL"); ?> </td> <td><input type="checkbox" name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][SHOW_URL]" value="Y"<?php if ($option["SHOW_URL"] == "Y") { ?> checked="checked"<?php } ?> /></td> </tr></table></label> <div id="gks_column_linkparams_<?php echo $gks_tab_id; ?> _<?php echo $gks_option_id; ?> "> <?php if (is_array($option["LINK"])) { foreach ($option["LINK"] as $param_name => $param_value) { ?> <?php if (is_array($param_value)) { ?> <?php foreach ($param_value as $k => $v) { ?> <input type="hidden" name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][LINK][<?php echo $param_name; ?> ][<?php echo $k; ?> ]" value="<?php echo htmlspecialchars($v); ?> " /> <?php } ?> <?php } else { ?> <input type="hidden" name="TABS[<?php echo $gks_tab_id; ?> ][FIELDS][<?php echo $gks_option_id; ?> ][LINK][<?php echo $param_name; ?> ]" value="<?php echo htmlspecialchars($param_value); ?> " /> <?php } ?> <?php } } ?> </div> <?php } else { ?> <?php echo GetMessage("GRAIN_CUSTOMSETTINGS_OPTIONS_SETTINGS_LINK_NOT_INSTALLED"); ?> <?php } ?> <?php break; default: echo "Wrong type"; } $s .= ob_get_contents(); ob_end_clean(); return $s; }
<tr> <td nowrap><?php echo GetMessage("TC_ACTIVATED"); ?> :</td> <td nowrap><input type="text" name="find_activated" value="<?echo htmlspecialchars($find_activated)?>" size="44"></td> </tr> <tr> <td nowrap><?php echo GetMessage("TC_DATE_MODIFY"); ?> :</td> <td nowrap><input type="text" name="find_date_modify" size="44"><?php echo Calendar("find_date_modify", "form2"); ?> </td> </tr> <?$filter->Buttons(array("table_id"=>$sTableID, "url"=>$APPLICATION->GetCurPage(), "form"=>"form2"));?> <?$filter->End();?> </form> <? $lAdmin->DisplayList(); } function getNumericSuffix($values, $count, $base = 10) {
<?php /********************************************************************* mod_calendrier.php Le 20 Août 2006 par Saint-Pere - www.yep-yop.com Ce bloc affiche un calendrier vous permettant de parcourrir les news par leur date **********************************************************************/ if (!defined('IN_PHPBB')) { die("Hacking attempt"); } //chargement du template $template->set_filenames(array('calendrier' => 'areabb/mods/calendrier/tpl/calendrier.tpl')); // Appel au script du calendrier require_once 'areabb/mods/calendrier/calendar.php'; // Parametrage $params = array('LANGUAGE_CODE' => 'fr', 'OUTPUT_MODE' => 'return', 'DATE_URL' => append_sid(NOM_NEWS . '.' . $phpEx . '?action=date'), 'FIRST_WEEK_DAY' => 1, 'URL_PARAMETER' => 'date_news', 'URL_DAY_DATE_FORMAT' => 'Y-m-d'); // Affichage $affichage_calendrier = Calendar($params); $template->assign_vars(array('L_CALENDRIER' => $lang['L_CALENDRIER'], 'CALENDRIER' => $affichage_calendrier)); $template->assign_var_from_handle('calendrier', 'calendrier');