You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

972 lines
45 KiB

<?php
//Important!! Saving this file with Unix EOL type
function createModuleBackground( $Layout, $CornerID, $Title ){
$SVG['C'][0]=<<<DATA_BIUNDARY
<svg viewBox="0 0 1920 700" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="0" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="50%" y="410" width="50%" height="290" fill="#C0C0C0" />
<rect x="0" y="0" width="100%" height="290" fill="#404040" />
<rect x="50%" y="450" width="50%" height="15" fill="url(#stripe)"/>
<rect x="0" y="300" width="100%" height="100" fill="url(#railway)" />
<rect x="0" y="410" width="50%" height="290" fill="#404040"/>
<rect x="0" y="0" width="50%" height="100%" fill="url(#left_wall)"/>
<text class=\"passive_area_text\" x=\"25%\" y=\"25%\">{$Title}</text>
</svg>
DATA_BIUNDARY;
$SVG['C'][1]=<<<DATA_BIUNDARY
<svg viewBox="0 0 1920 700" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="0" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="0" y="410" width="50%" height="290" fill="#C0C0C0" />
<rect x="0" y="0" width="100%" height="290" fill="#404040" />
<rect x="0" y="450" width="50%" height="15" fill="url(#stripe)"/>
<rect x="0" y="300" width="100%" height="100" fill="url(#railway)" />
<rect x="50%" y="410" width="50%" height="290" fill="#404040"/>
<rect x="50%" y="0" width="50%" height="100%" fill="url(#right_wall)"/>
<text class=\"passive_area_text\" x=\"75%\" y=\"25%\">{$Title}</text>
</svg>
DATA_BIUNDARY;
$SVG['C'][2]=<<<DATA_BIUNDARY
<svg viewBox="0 0 1920 700" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="0" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="0" y="0" width="50%" height="290" fill="#C0C0C0" />
<rect x="0" y="410" width="100%" height="290" fill="#404040" />
<rect x="0" y="240" width="50%" height="15" fill="url(#stripe)"/>
<rect x="0" y="300" width="100%" height="100" fill="url(#railway)" />
<rect x="50%" y="0" width="50%" height="290" fill="#404040"/>
<rect x="50%" y="0" width="50%" height="100%" fill="url(#right_wall)"/>
<text class=\"passive_area_text\" x=\"75%\" y=\"25%\">{$Title}</text>
</svg>
DATA_BIUNDARY;
$SVG['C'][3]=<<<DATA_BIUNDARY
<svg viewBox="0 0 1920 700" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="0" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="50%" y="0" width="50%" height="290" fill="#C0C0C0" />
<rect x="0" y="410" width="100%" height="290" fill="#404040" />
<rect x="50%" y="240" width="50%" height="15" fill="url(#stripe)"/>
<rect x="0" y="300" width="100%" height="100" fill="url(#railway)" />
<rect x="0" y="0" width="50%" height="290" fill="#404040"/>
<rect x="0" y="0" width="50%" height="100%" fill="url(#left_wall)"/>
<text class=\"passive_area_text\" x=\"25%\" y=\"25%\">{$Title}</text>
</svg>
DATA_BIUNDARY;
return str_ireplace( "\n",'',$SVG[$Layout][$CornerID] );
};
function createTrackBackground( $Layout, $Side, $LTitle, $RTitle ){
$SVG['C']['U']=<<<DATA_BIUNDARY
<svg id="svgTrackMap" viewBox="0 0 1920 200" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="50" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="0" y="155" width="100%" height="45" fill="#404040"/>
<rect x="0" y="0" width="100%" height="45" fill="#404040" />
<rect x="25%" y="0" width="50%" height="45" fill="#C0C0C0" />
<rect x="25%" y="20" width="50%" height="15" fill="url(#stripe)"/>
<rect x="0" y="50" width="100%" height="100" fill="url(#railway)" />
<rect x="0" y="0" width="25%" height="100%" fill="url(#left_wall)"/>
<rect x="75%" y="0" width="25%" height="100%" fill="url(#right_wall)"/>
<text id="scheme_anch" class=\"track_area_text\" x=\"15%\" y=\"50%\">{$LTitle}</text>
<text class=\"track_area_text\" x=\"85%\" y=\"50%\">{$RTitle}</text>
</svg>
DATA_BIUNDARY;
$SVG['C']['B']=<<<DATA_BIUNDARY
<svg id="svgTrackMap" viewBox="0 0 1920 200" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="50" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="0" y="155" width="100%" height="45" fill="#404040"/>
<rect x="0" y="0" width="100%" height="45" fill="#404040" />
<rect x="25%" y="0" width="50%" height="45" fill="#C0C0C0" />
<rect x="25%" y="20" width="50%" height="15" fill="url(#stripe)"/>
<rect x="0" y="50" width="100%" height="100" fill="url(#railway)" />
<rect x="0" y="0" width="25%" height="100%" fill="url(#left_wall)"/>
<rect x="75%" y="0" width="25%" height="100%" fill="url(#right_wall)"/>
<text id="scheme_anch" class=\"track_area_text\" x=\"15%\" y=\"50%\">{$LTitle}</text>
<text class=\"track_area_text\" x=\"85%\" y=\"50%\">{$RTitle}</text>
</svg>
DATA_BIUNDARY;
$SVG['E']['U']=<<<DATA_BIUNDARY
<svg viewBox="0 0 1920 700" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="0" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="0" y="0" width="50%" height="290" fill="#C0C0C0" />
<rect x="0" y="410" width="100%" height="290" fill="#404040" />
<rect x="0" y="240" width="50%" height="15" fill="url(#stripe)"/>
<rect x="0" y="300" width="100%" height="100" fill="url(#railway)" />
<rect x="50%" y="0" width="50%" height="290" fill="#404040"/>
<rect x="50%" y="0" width="50%" height="100%" fill="url(#right_wall)"/>
<text class=\"passive_area_text\" x=\"75%\" y=\"25%\">{$Title}</text>
</svg>
DATA_BIUNDARY;
$SVG['E']['B']=<<<DATA_BIUNDARY
<svg viewBox="0 0 1920 700" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="0" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="50%" y="0" width="50%" height="290" fill="#C0C0C0" />
<rect x="0" y="410" width="100%" height="290" fill="#404040" />
<rect x="50%" y="240" width="50%" height="15" fill="url(#stripe)"/>
<rect x="0" y="300" width="100%" height="100" fill="url(#railway)" />
<rect x="0" y="0" width="50%" height="290" fill="#404040"/>
<rect x="0" y="0" width="50%" height="100%" fill="url(#left_wall)"/>
<text class=\"passive_area_text\" x=\"25%\" y=\"25%\">{$Title}</text>
</svg>
DATA_BIUNDARY;
return str_ireplace( "\n",'',$SVG[$Layout][$Side] );
};
function createPlatformBackground( $Layout, $pid=0, $Modules=array() ){
$SVG['C']=<<<DATA_BOUNDARY
<svg id="svgTrackMap" viewBox="0 0 1920 700" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="50" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="0" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="0" y="0" width="100%" height="40" fill="#C0C0C0" />
<rect x="0" y="660" width="100%" height="40" fill="#C0C0C0" />
<rect x="270" y="160" width="1380" height="380" fill="#C0C0C0" />
<rect x="270" y="180" width="1380" height="15" fill="url(#stripe)"/>
<rect x="270" y="505" width="1380" height="15" fill="url(#stripe2)"/>
<rect x="0" y="50" width="100%" height="100" fill="url(#railway)" />
<rect x="0" y="550" width="100%" height="100" fill="url(#railway)" />
<rect x="0" y="0" width="270" height="100%" fill="url(#left_wall)"/>
<rect x="1650" y="0" width="270" height="100%" fill="url(#right_wall)"/>
%%%AREA%1%%%
%%%AREA%2%%%
%%%AREA%3%%%
%%%AREA%4%%%
</svg>
DATA_BOUNDARY;
$SVG['E']=<<<DATA_BOUNDARY
<svg id="svgTrackMap" viewBox="0 0 1920 700" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="50" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="railway2" x="0" y="30" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="0" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-10" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="0" y="0" width="100%" height="40" fill="#C0C0C0" />
<rect x="0" y="660" width="100%" height="40" fill="#C0C0C0" />
<rect x="270" y="0" width="1380" height="220" fill="#C0C0C0" />
<rect x="270" y="460" width="1380" height="220" fill="#C0C0C0" />
<rect x="270" y="180" width="1380" height="15" fill="url(#stripe)"/>
<rect x="270" y="485" width="1380" height="15" fill="url(#stripe2)"/>
<rect x="0" y="230" width="100%" height="100" fill="url(#railway2)" />
<rect x="0" y="350" width="100%" height="100" fill="url(#railway)" />
<rect x="0" y="0" width="270" height="100%" fill="url(#left_wall)"/>
<rect x="1650" y="0" width="270" height="100%" fill="url(#right_wall)"/>
%%%AREA%1%%%
%%%AREA%2%%%
%%%AREA%3%%%
%%%AREA%4%%%
</svg>
DATA_BOUNDARY;
if( isset( $Modules[0] ) ){
$as =($Modules[0]['status'])?'active_area':'passive_area';
$RPL = "<g class=\"svg_area_group\" onclick=\"loadModuleView({$pid},{$Modules[0]['id']});\"><text class=\"passive_area_text\" x=\"25%\" y=\"25%\">{$Modules[0]['name']}</text><rect class=\"{$as}\" x=\"0\" y=\"0\" width=\"50%\" height=\"50%\" fill-opacity=\"0.5\" stroke=\"none\"/></g>";
$SVG[$Layout] = str_ireplace("%%%AREA%1%%%",$RPL,$SVG[$Layout]);
} else {
$SVG[$Layout] = str_ireplace("%%%AREA%1%%%",'',$SVG[$Layout]);
};
if( isset( $Modules[1] ) ){
$as =($Modules[1]['status'])?'active_area':'passive_area';
$RPL = "<g class=\"svg_area_group\" onclick=\"loadModuleView({$pid},{$Modules[1]['id']});\"><text class=\"passive_area_text\" x=\"75%\" y=\"25%\">{$Modules[1]['name']}</text><rect class=\"{$as}\" x=\"50%\" y=\"0\" width=\"50%\" height=\"50%\" fill-opacity=\"0.5\" stroke=\"none\"/></g>";
$SVG[$Layout] = str_ireplace("%%%AREA%2%%%",$RPL,$SVG[$Layout]);
} else {
$SVG[$Layout] = str_ireplace("%%%AREA%2%%%",'',$SVG[$Layout]);
};
if( isset( $Modules[2] ) ){
$as =($Modules[2]['status'])?'active_area':'passive_area';
$RPL = "<g class=\"svg_area_group\" onclick=\"loadModuleView({$pid},{$Modules[2]['id']});\"><text class=\"passive_area_text\" x=\"25%\" y=\"75%\">{$Modules[2]['name']}</text><rect class=\"{$as}\" x=\"0\" y=\"50%\" width=\"50%\" height=\"50%\" fill-opacity=\"0.5\" stroke=\"none\"/></g>";
$SVG[$Layout] = str_ireplace("%%%AREA%3%%%",$RPL,$SVG[$Layout]);
} else {
$SVG[$Layout] = str_ireplace("%%%AREA%3%%%",'',$SVG[$Layout]);
};
if( isset( $Modules[3] ) ){
$as =($Modules[3]['status'])?'active_area':'passive_area';
$RPL = "<g class=\"svg_area_group\" onclick=\"loadModuleView({$pid},{$Modules[3]['id']});\"><text class=\"passive_area_text\" x=\"75%\" y=\"75%\">{$Modules[3]['name']}</text><rect class=\"{$as}\" x=\"50%\" y=\"50%\" width=\"50%\" height=\"50%\" fill-opacity=\"0.5\" stroke=\"none\"/></g>";
$SVG[$Layout] = str_ireplace("%%%AREA%4%%%",$RPL,$SVG[$Layout]);
} else {
$SVG[$Layout] = str_ireplace("%%%AREA%4%%%",'',$SVG[$Layout]);
};
return str_ireplace("\n",'',$SVG[$Layout]);
};
function createPlatformAnimation( $PLayout, $PNames=array(), $Colors=array() ){
$SVG['C']=<<<jjdgfjjdfh
<svg id="svgTrackMap" viewBox="0 0 1920 700" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="50" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="0" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-5" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="0" y="0" width="100%" height="40" fill="#C0C0C0" />
<rect x="0" y="660" width="100%" height="40" fill="#C0C0C0" />
<rect x="270" y="160" width="1380" height="380" fill="#C0C0C0" />
<rect x="270" y="180" width="1380" height="15" fill="url(#stripe)"/>
<rect x="270" y="505" width="1380" height="15" fill="url(#stripe2)"/>
<rect x="0" y="50" width="100%" height="100" fill="url(#railway)" />
<rect x="0" y="550" width="100%" height="100" fill="url(#railway)" />
%%ANIMATION%%
<rect x="0" y="0" width="270" height="100%" fill="url(#left_wall)"/>
<rect x="1650" y="0" width="270" height="100%" fill="url(#right_wall)"/>
</svg>
jjdgfjjdfh;
$SVG['E']=<<<khksdhfiwer
<svg id="svgTrackMap" viewBox="0 0 1920 700" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="railway" x="0" y="50" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="railway2" x="0" y="30" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stair_1m" x="0" y="0" width="50" height="100" patternUnits="userSpaceOnUse">
<rect x="20" y="5" width="10" height="90" fill="#000000" />
<rect x="0" y="15" width="50" height="10" fill="#f0f0f0" />
<rect x="0" y="75" width="50" height="10" fill="#f0f0f0" />
</pattern>
<pattern id="stripe" x="0" y="0" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<pattern id="stripe2" x="0" y="-10" width="30" height="15" patternUnits="userSpaceOnUse">
<rect x="0" y="0" width="30" height="15" style="fill:rgb(255, 240, 85);" />
<polygon points="0,0 15,15 30,15 15,0" fill="#000000" />
</pattern>
<linearGradient id="left_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 1.0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 0"/>
</linearGradient>
<linearGradient id="right_wall">
<stop offset="0%" style="stop-color: #000; stop-opacity: 0"/>
<stop offset="100%" style="stop-color: #000; stop-opacity: 1.0"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="#808080" />
<rect x="0" y="0" width="100%" height="40" fill="#C0C0C0" />
<rect x="0" y="660" width="100%" height="40" fill="#C0C0C0" />
<rect x="270" y="0" width="1380" height="220" fill="#C0C0C0" />
<rect x="270" y="460" width="1380" height="220" fill="#C0C0C0" />
<rect x="270" y="180" width="1380" height="15" fill="url(#stripe)"/>
<rect x="270" y="485" width="1380" height="15" fill="url(#stripe2)"/>
<rect x="0" y="230" width="100%" height="100" fill="url(#railway2)" />
<rect x="0" y="350" width="100%" height="100" fill="url(#railway)" />
%%ANIMATION%%
<rect x="0" y="0" width="270" height="100%" fill="url(#left_wall)"/>
<rect x="1650" y="0" width="270" height="100%" fill="url(#right_wall)"/>
</svg>
khksdhfiwer;
//Parameters - Start Point, Station Stop, End Point, Motion Duration, move to station, station stop, move from station
$SVG_ANI_PARAMS['L']=array( 2210, 290,-700, 11, 2, 6, 3 ); // L -> to the left R -> To the right movement
$SVG_ANI_PARAMS['R']=array( -1920, 930,1920, 12, 3, 6, 2 ); // Not Same duration makes animation Lifelike
$SVG_ANI['C']=<<<ksdhjfkhkie
<rect x="2210" y="50" rx="10" width="700" height="100" style="fill:%%COLOR%%;">
<animate dur="%%TOTA%%s" attributeName="x" calcMode="linear" values="%%ACORDS%%" keyTimes= "%%ATIMES%%" repeatCount="indefinite"/>
<animate dur="%%DTOTA%%s" attributeName="opacity" fsrom="1" teo="0" calcMode="linear" values="1;1;0;0" keyTimes= "0;0.49;0.50;1" repeatCount="indefinite"/>
</rect>
<rect x="-1290" y="550" rx="10" width="700" height="100" style="fill:%%COLOR%%;">
<animate begin="8s" dur="%%TOTB%%s" attributeName="x" calcMode="linear" values="%%BCORDS%%" keyTimes= "%%BTIMES%%" repeatCount="indefinite"/>
<animate begin="8s" dur="%%DTOTB%%s" attributeName="opacity" fsrom="1" teo="0" calcMode="linear" values="1;1;0;0" keyTimes= "0;0.49;0.50;1" repeatCount="indefinite"/>
</rect>
ksdhjfkhkie;
$SVG_ANI['E']=<<<ksjdhfksdhf
<rect x="2210" y="230" rx="10" width="700" height="100" style="fill:%%COLOR%%;">
<animate dur="%%TOTA%%s" attributeName="x" calcMode="linear" values="%%ACORDS%%" keyTimes= "%%ATIMES%%" repeatCount="indefinite"/>
<animate dur="%%DTOTA%%s" attributeName="opacity" fsrom="1" teo="0" calcMode="linear" values="1;1;0;0" keyTimes= "0;0.49;0.50;1" repeatCount="indefinite"/>
</rect>
<rect x="-1290" y="350" rx="10" width="700" height="100" style="fill:%%COLOR%%;">
<animate begin="8s" dur="%%TOTB%%s" attributeName="x" calcMode="linear" values="%%BCORDS%%" keyTimes= "%%BTIMES%%" repeatCount="indefinite"/>
<animate begin="8s" dur="%%DTOTB%%s" attributeName="opacity" fsrom="1" teo="0" calcMode="linear" values="1;1;0;0" keyTimes= "0;0.49;0.50;1" repeatCount="indefinite"/>
</rect>
ksjdhfksdhf;
if( $LC = count( $Colors ) ){
switch( $PLayout ){
case 'A': $P_B = $P_A = $SVG_ANI_PARAMS['L'];break;
case 'B': $P_B = $P_A = $SVG_ANI_PARAMS['R'];break; // UK-JAP
case 'C': $P_A = $SVG_ANI_PARAMS['L']; $P_B = $SVG_ANI_PARAMS['R'];break;
case 'D': $P_A = $SVG_ANI_PARAMS['R']; $P_B = $SVG_ANI_PARAMS['L'];break; // UK-JAP
case 'E': $P_A = $SVG_ANI_PARAMS['L']; $P_B = $SVG_ANI_PARAMS['R'];break;
case 'F': $P_A = $SVG_ANI_PARAMS['R']; $P_B = $SVG_ANI_PARAMS['L'];break; // UK-JAP
};
$TOTAL_DURATION_A = $P_A[3]*$LC;
$TOTAL_DURATION_B = $P_B[3]*$LC;
$ATPL = $SVG_ANI[$PLayout];
$CT = 1/$LC;
$TS_A = $P_A[4]/$P_A[3];
$SS_A = ($P_A[4]+$P_A[5])/$P_A[3];
$FS_A = ($P_A[4]+$P_A[5]+$P_A[6])/$P_A[3];
$TS_B = $P_B[4]/$P_B[3];
$SS_B = ($P_B[4]+$P_B[5])/$P_B[3];
$FS_B = ($P_B[4]+$P_B[5]+$P_B[6])/$P_B[3];
// Stop start stop-end
$T_A = array($TS_A/$LC, $SS_A/$LC, $FS_A/$LC);
$T_B = array($TS_B/$LC, $SS_B/$LC, $FS_B/$LC);
$ANI = array();
$idx = 0;
foreach( $Colors as $CC ){
$BT = $idx*$CT;
$P_A_COORDS = $P_A[0].";".$P_A[0].";".$P_A[1].";".$P_A[1].";".$P_A[2].";".$P_A[2];
$P_B_COORDS = $P_B[0].";".$P_B[0].";".$P_B[1].";".$P_B[1].";".$P_B[2].";".$P_B[2];
$P_A_TIMING = "0;".$BT.";".($BT+$T_A[0]).";".($BT+$T_A[1]).";".($BT+$T_A[2]).";1";
$P_B_TIMING = "0;".$BT.";".($BT+$T_B[0]).";".($BT+$T_B[1]).";".($BT+$T_B[2]).";1";
$ANI[$idx] = str_ireplace('%%COLOR%%',$CC,$SVG_ANI[$PLayout] );//Load template
$ANI[$idx] = str_ireplace('%%ACORDS%%',$P_A_COORDS,$ANI[$idx]);
$ANI[$idx] = str_ireplace('%%ATIMES%%',$P_A_TIMING,$ANI[$idx]);
$ANI[$idx] = str_ireplace('%%BCORDS%%',$P_B_COORDS,$ANI[$idx]);
$ANI[$idx] = str_ireplace('%%BTIMES%%',$P_B_TIMING,$ANI[$idx]);
$ANI[$idx] = str_ireplace('%%TOTA%%',$TOTAL_DURATION_A,$ANI[$idx]);
$ANI[$idx] = str_ireplace('%%DTOTA%%',$TOTAL_DURATION_A*2,$ANI[$idx]);
$ANI[$idx] = str_ireplace('%%TOTB%%',$TOTAL_DURATION_B,$ANI[$idx]);
$ANI[$idx] = str_ireplace('%%DTOTB%%',$TOTAL_DURATION_B*2,$ANI[$idx]);
$idx++;
}
$SVG[$PLayout]=str_ireplace('%%ANIMATION%%', implode( '', $ANI ),$SVG[$PLayout]);
} else {
$SVG[$PLayout]=str_ireplace('%%ANIMATION%%','',$SVG[$PLayout]);
};
$Output = str_ireplace("\n",'',$SVG[$PLayout]);
return $Output;
};
function getPlatformLineInfo( $PID ){
global $DATABASE;
$QS = "SELECT `ln`.`id`,`ln`.`short`,`ln`.`color` FROM `metro_lines` `ln` LEFT JOIN `metro_platforms_2_lines` `sl` ON ( `ln`.`id`=`sl`.`line_id` ) WHERE `sl`.`platform_id`={$PID} ORDER BY `ln`.`short`";
$R = $DATABASE->Query( $QS );
//get station index for each line
$idx = 0;
foreach( $R as $T ){
$QS = "SELECT `sl`.`station_id`, `sl`.`index` FROM `metro_stations_2_lines` `sl` LEFT JOIN `metro_platforms` `mp` ON ( `mp`.`station_id` = `sl`.`station_id` ) WHERE `mp`.`id`={$PID} AND `sl`.`line_id`={$T['id']}";
$Z = $DATABASE->Query( $QS );
if( count( $Z ) ) {
$R[$idx]['index']=$Z[0]['index'];
$R[$idx]['station_id']=$Z[0]['station_id'];
} else {
$R[$idx]['index']= 0;
$R[$idx]['station_id']= 0;
};
$idx++;
};
return $R;
};
function getPlatformInfo( $PID ){
global $DATABASE;
$QS = "SELECT `ln`.`id`,`ln`.`short`,`ln`.`color` FROM `metro_lines` `ln` LEFT JOIN `metro_platforms_2_lines` `sl` ON ( `ln`.`id`=`sl`.`line_id` ) WHERE `sl`.`platform_id`={$PID} ORDER BY `ln`.`short`";
$R = $DATABASE->Query( $QS );
//get station index for each line
$idx = 0;
$P_PARTS = array();
$P_pidx = -1;
$P_CSID = 0;
$N_PARTS = array();
$N_pidx = -1;
$N_CSID = 0;
foreach( $R as $T ){
$QS = "SELECT `sl`.`station_id`, `sl`.`index` FROM `metro_stations_2_lines` `sl` LEFT JOIN `metro_platforms` `mp` ON ( `mp`.`station_id` = `sl`.`station_id` ) WHERE `mp`.`id`={$PID} AND `sl`.`line_id`={$T['id']}";
$Z = $DATABASE->Query( $QS );
if( count( $Z ) ) {
$R[$idx]['index']=$Z[0]['index'];
$R[$idx]['station_id']=$Z[0]['station_id'];
} else {
$R[$idx]['index']= 0;
$R[$idx]['station_id']= 0;
};
// Have Index
if( $R[$idx]['index'] ){
$NSI = getLineStationInfo( $R[$idx]['id'], $R[$idx]['index']-1 );
if( count( $NSI ) ){
if( $N_CSID != $NSI['id'] ){
$N_CSID = $NSI['id'];
$N_pidx++;
};
$N_PARTS[$N_pidx]['name']=$NSI['name'];
$N_PARTS[$N_pidx]['id']=$NSI['id'];
$N_PARTS[$N_pidx]['colors'][]=$T['color'];
};
$NSI = getLineStationInfo( $R[$idx]['id'], $R[$idx]['index']+1 );
if( count( $NSI ) ){
if( $P_CSID != $NSI['id'] ){
$P_CSID = $NSI['id'];
$P_pidx++;
};
$P_PARTS[$P_pidx]['name']=$NSI['name'];
$P_PARTS[$N_pidx]['id']=$NSI['id'];
$P_PARTS[$P_pidx]['colors'][]=$T['color'];
};
};
$idx++;
};
$R['INFO_COUNT'] = count( $R );
$R['NEXT_IS_MULTI']=( count( $N_PARTS ) > 1 );
$R['NEXT'] = array();
foreach( $N_PARTS as $P ){
$CZ['name']=$P['name'];
$CZ['id'] = $P['id'];
if( ( $CC = count( $P['colors'] ) ) > 1 ){
$CP = 100 / $CC;
$COMAP = array();
for( $ix = 0; $ix < $CC; $ix++ ){
$SPO= intval( $ix * $CP );
$NPO= intval( ( $ix+1 ) * $CP ) - 1;
if( $SPO < 2 ){
$COMAP[] = "#{$P['colors'][$ix]}, #{$P['colors'][$ix]} {$NPO}%";
} else if( $SPO > 90 ){
$COMAP[] = "#{$P['colors'][$ix]} {$SPO}%, #{$P['colors'][$ix]}";
} else {
$COMAP[] = "#{$P['colors'][$ix]} {$SPO}%, #{$P['colors'][$ix]} {$NPO}%";
};
};
$GRADIENT = implode( ',', $COMAP );//writing-mode: vertical-lr;text-orientation: upright;
$CZ['bg_style']="background-image: linear-gradient({$GRADIENT});";
} else {
$CZ['bg_style']="background-color:#{$P['colors'][0]};";
};
$R['NEXT'][]=$CZ;
};
$R['PREV_IS_MULTI']=( count( $P_PARTS ) > 1 );
$R['PREV'] = array();
foreach( $P_PARTS as $P ){
$CZ['name']=$P['name'];
$CZ['id'] = $P['id'];
if( ( $CC = count( $P['colors'] ) ) > 1 ){
$CP = 100 / $CC;
$COMAP = array();
for( $ix = 0; $ix < $CC; $ix++ ){
$SPO= intval( $ix * $CP );
$NPO= intval( ( $ix+1 ) * $CP ) - 1;
if( $SPO < 2 ){
$COMAP[] = "#{$P['colors'][$ix]}, #{$P['colors'][$ix]} {$NPO}%";
} else if( $SPO > 90 ){
$COMAP[] = "#{$P['colors'][$ix]} {$SPO}%, #{$P['colors'][$ix]}";
} else {
$COMAP[] = "#{$P['colors'][$ix]} {$SPO}%, #{$P['colors'][$ix]} {$NPO}%";
};
};
$GRADIENT = implode( ',', $COMAP );//writing-mode: vertical-lr;text-orientation: upright;
$CZ['bg_style']="background-image: linear-gradient({$GRADIENT});";
} else {
$CZ['bg_style']="background-color:#{$P['colors'][0]};";
};
$R['PREV'][]=$CZ;
};
return $R;
};
function getLineStationInfo( $LID, $IDX ){
global $DATABASE;
$QS = "SELECT `st`.`id`, `st`.`name` FROM `metro_stations` `st` LEFT JOIN `metro_stations_2_lines` `sl` ON ( `st`.`id`=`sl`.`station_id` ) WHERE `sl`.`line_id`={$LID} AND `sl`.`index`={$IDX}";
$RZ = $DATABASE->Query( $QS );
$INFO = array();
if( count( $RZ ) ) $INFO = $RZ[0];
return $INFO;
}
function createPlatformStationBlock( $PID, $D ){
$PINFO = getPlatformLineInfo( $PID );
$PARTS = array();
$pidx = -1;
$CSID = 0;
if( $D < 0 ){
$R_P = "</td><td class=\"ar_to_right\">&nbsp;</td></tr></table>";
$L_P = "<table border=0 width=\"100%\"><tr><td align=\"right\">";
} else {
$R_P = "</td></tr></table>";
$L_P = "<table border=0 width=\"100%\"><tr><td class=\"ar_to_left\">&nbsp;</td><td align=\"left\">";
};
foreach( $PINFO as $II ){
// If has more stations on the line
//if( $II['index'] > 1 ) {
$SI = getLineStationInfo( $II['id'], $II['index'] + $D );
if( count( $SI ) ){
if( $CSID != $SI['id'] ){
$CSID = $SI['id'];
$pidx++;
};
$PARTS[$pidx]['name']=$SI['name'];
$PARTS[$pidx]['colors'][]=$II['color'];
};
//};
};
$Output = '';
foreach( $PARTS as $P ){
if( ( $CC = count( $P['colors'] ) ) > 1 ){
$CP = 100 / $CC;
$COMAP = array();
for( $ix = 0; $ix < $CC; $ix++ ){
$SPO= intval( $ix * $CP );
$NPO= intval( ( $ix+1 ) * $CP ) - 1;
if( $SPO < 2 ){
$COMAP[] = "#{$P['colors'][$ix]}, #{$P['colors'][$ix]} {$NPO}%";
} else if( $SPO > 90 ){
$COMAP[] = "#{$P['colors'][$ix]} {$SPO}%, #{$P['colors'][$ix]}";
} else {
$COMAP[] = "#{$P['colors'][$ix]} {$SPO}%, #{$P['colors'][$ix]} {$NPO}%";
};
};
$GRADIENT = implode( ',', $COMAP );//writing-mode: vertical-lr;text-orientation: upright;
$Output .= "<td width=\"100%\" class=\"setEd_infoPanel\" style=\"overflow: hidden; padding: 4px; color:#fff; font-weight: bold; background-image: linear-gradient({$GRADIENT});\">{$L_P}{$P['name']}{$R_P}</td>";
} else {
$Output .= "<td class=\"setEd_infoPanel\" style=\"color:#fff;font-weight:bold;background-color:#{$P['colors'][0]};\">{$L_P}{$P['name']}{$R_P}</td>";
};
};
return $Output;
};
function getModleOnlineStatus( $MID ){
global $DATABASE;
$QS = "SELECT `status`,`ts`,`SID` FROM `mem_online_cloud` WHERE `object_id`={$MID} AND `object_type`=2";
$RV = $DATABASE->Query( $QS, false );
if( count( $RV ) ) return $RV[0];
return array();
}
function cmaera(){
};
function getStationName( $id ){
global $DATABASE;
if( $id ){
$QS = "SELECT `name` FROM `metro_stations` WHERE `id`={$id}";
$RV = $DATABASE->Query( $QS, false );
if( count( $RV ) ) return $RV[0]['name'];
};
return '';
};
function getTrackName( $id ){
global $DATABASE;
if( $id ){
$QS = "SELECT `name` FROM `metro_tracks` WHERE `id`={$id}";
$RV = $DATABASE->Query( $QS, false );
if( count( $RV ) ) return $RV[0]['name'];
};
return '';
};
function getModuleName( $id ){
global $DATABASE;
if( $id ){
$QS = "SELECT `name` FROM `metro_modules` WHERE `id`={$id}";
$RV = $DATABASE->Query( $QS, false );
if( count( $RV ) ) return $RV[0]['name'];
};
return '';
};
function getPlatformName( $id ){
global $DATABASE;
if( $id ){
$QS = "SELECT `name` FROM `metro_platforms` WHERE `id`={$id}";
$RV = $DATABASE->Query( $QS, false );
if( count( $RV ) ) return $RV[0]['name'];
};
return '';
};
function getOnlineStatus( $mid ){
global $DATABASE;
if( $mid ){
$CTS = time() - 3; // 3 seconds lag
$QS = "SELECT `status` FROM `mem_online_cloud` WHERE `object_id` = {$mid} AND `object_type`=10 AND `ts`>={$CTS}";
$RV = $DATABASE->Query( $QS, false );
if( count( $RV ) ) return intval( $RV[0]['status'] );
};
return false;
};
function createTopLabel( $Station, $Platform, $Lines, $Track="", $color_class="" ){
if( $Track!=''){
$TR_INS=<<<DATA_BOUNDARY
<td rowspan=3 valign="middle" align="center" class="top_track_lbl">{$Track}</td>
DATA_BOUNDARY;
} else {
$TR_INS = '';
}
$AA=<<<DATA_BOUNDARY
<table border=0 width="100%" class="setEd_infoPanelX {$color_class}">
<tr>
<td valign="middle" align="left" style="max-width: 20em; padding-left:30px;font-size: 22px; font-weight: bold;">{$Station}</td><td id="trx_status_cell" rowspan=3 valign="middle" align="center" class="top_status_hidden"><span id="trx_status_txt" class="static_status_text">STATUS</span></td>{$TR_INS}
</tr>
<tr>
<td valign="middle" align="left" style="padding-left:30px;font-size: 16px; font-weight: bold;">{$Platform}</td>
</tr>
<tr>
<td valign="middle" align="left" style="padding-left:30px;font-size: 16px; font-weight: bold;">{$Lines}</td>
</tr>
</table>
DATA_BOUNDARY;
return "{ xtype:'panel', border: false, frame: false, html: '". str_ireplace( "\n",'', $AA )."'}";
};
function createChopLabel( $line1, $line2, $Lines, $Track="", $color_class="", $oncli="", $atds="", $id ='' ){
if( $Track!=''){
$TR_INS=<<<DATA_BOUNDARY
<td rowspan=3 valign="middle" align="center" style="width: 200px; border-radius: 5px; font-size: 44px; font-weight: bold; color: white; background-color: black;">{$Track}</td>
DATA_BOUNDARY;
} else {
$TR_INS = '';
};
if( $atds!= "" ){
if( is_array( $atds ) ){
$ADDTD='<td rowspan=3 width="150px">&nbsp;</td>';
foreach( $atds as $A ) $ADDTD.='<td rowspan=3>'.$A.'</td>';
} else {
$ADDTD='<td rowspan=3 width="150px">&nbsp;</td><td rowspan=3>'.$atds.'</td>';
};
} else {
$ADDTD='';
};
if( $oncli!=''){
$ACTION ='onclick="'.$oncli.';"';
} else {
$ACTION ='';
};
$AA=<<<DATA_BOUNDARY
<table {$id} border=0 width="100%" class="sideInfo_item {$color_class}" {$ACTION}>
<tr>
<td valign="middle" align="left" style="max-width: 20em; padding-left:30px;font-size: 16px; font-weight: bold;">{$line1}</td>{$TR_INS}{$ADDTD}
</tr>
<tr>
<td valign="middle" align="left" style="padding-left:30px;font-size: 12px; font-weight: bold;">{$line2}</td>
</tr>
<tr>
<td valign="middle" align="left" style="padding-left:30px;font-size: 12px; font-weight: bold;">{$Lines}</td>
</tr>
</table>
DATA_BOUNDARY;
return "{ xtype:'panel', border: false, frame: false, html: '". str_ireplace( "\n",'', $AA )."'}";
};
?>