adminMajorStops.phpの例
<?php
//閲覧および各種メニュー
/*include_once("../../../mainfile.php");
$xoopsOption['show_rblock'] = 0;
include_once(XOOPS_ROOT_PATH."/header.php");
global $xoopsDB, $xoopsUser;
$myts = & MyTextSanitizer::getInstance();
*/
// ここから上は基本設定
////////////////////////////////////////////////////////////////////////////////////////
include_once("adminFareCommonHead.php");
/* $fareObj, $selectedRouteID, $selectedGeneralRoute,
$category are defined in adminFareCommonHead.php */
if(!isset($selectedRouteID) || !$selectedRouteID) {
include_once(XOOPS_ROOT_PATH."/footer.php");
return;
}
/* if major stops are posted, insert them into DB */
if(isset($_POST['checkbox']) && isset($_POST['route_id'])) {
$i=1;
$mStops = array();
foreach($_POST['checkbox'] as $val) {
$mStops[$i] = $val; $i++;
}
echo $fareObj->putMajorStops($_POST['route_id'],$mStops);
}
?>
<?php
$stops = $fareObj->getStopNamesByRouteID($selectedRouteID,false,true);
?>
<table border = "1"><tr>
<?php
/* Display stop sequence */
echo "<td><form>";
echo _AD_BM_PRESENT_VALUES . "<br>";
for($i=1;$i<=count($stops); $i++){
if($stops[$i]['major']==1) {
echo('<input type="checkbox" name="checkbox[]" value="'.$stops[$i]["ID"].'" checked="checked" disabled="disabled">'.$stops[$i]["Name"].'<br>');
}else{
echo('<input type="checkbox" name="checkbox[]" value="'.$stops[$i]["ID"].'" disabled="disabled" >'.$stops[$i]["Name"].'<br>');
}
}
/* checkboxes for edit */
echo "</form></td>";
echo '<td>' . _AD_BM_EDIT . '<br><form method="POST">';
echo '<input type="hidden" name="category" value="'.$selectedCategoryID.'">';
echo '<input type="hidden" name="general_route_id" value="'.$selectedGeneralRouteID.'">';
echo '<input type="hidden" name="route_id" value="'.$selectedRouteID.'">';
for($i=1;$i<=count($stops); $i++){
if($stops[$i]['major']==1){
echo('<input type="checkbox" name="checkbox[]" value="'.$stops[$i]["ID"].'" checked="checked">'.$stops[$i]["Name"].'<br>');
}else{
echo('<input type="checkbox" name="checkbox[]" value="'.$stops[$i]["ID"].'">'.$stops[$i]["Name"].'<br>');
}
}
echo '<input type="submit" value="' . _AD_BM_SUBMIT . '"/>';
?>
</form></td>
</tr></table>
<?php
echo "<form method='POST' action='adminFareMajorStops.php'>";
echo "<input type='hidden' name='category' value='${selectedCategoryID}'/>".
"<input type='hidden' name='general_route_id' value='${selectedGeneralRouteID}'/>".
"<input type='hidden' name='route_id' value='${selectedRouteID}'/>";
echo "<input type='submit' value='". _AD_BM_GOTO_ADMIN_FARE_MAJOR_STOPS . "'/></form>";
include_once(XOOPS_ROOT_PATH."/footer.php");
?>