<?php

$aValue = [
    'header' => [
        'style' => 'remarkGuide',
        'title' => '封面',
        'remark' => '',
        'value' => [
            'compute' => false, // 是否需要计算页码
            'imglist' => [
                dirname(__DIR__). '/image/header.jpg',
            ],
        ]
    ],
    
    'general' => [
        'style' => 'generalGuide',
        'title' => 'GENERAL INDEX',
        'remark' => 'GENERAL INDEX',
        'value' => []
    ],
    
    'vehicle' => [
        'style' => 'vehicleGuide',
        'title' => 'Vehicle Index',
        'remark' => 'Vehicle Index',
        'value' => []
    ],
    
    'rule' => [
        'style' => 'remarkGuide',
        'title' => '封面',
        'remark' => 'Coding Rule',
        'value' => [
            'compute' => true, // 是否需要计算页码
            'imglist' => [
                dirname(__DIR__). '/image/rule.jpg',
            ],
        ]
    ],
];

// 轮毂车型
$aData = [];

$sRun = 0;
$aBrand = [];
$aTests = require __DIR__. '/model.php';
$aTexts = [
    'Grand Cherokee IV(WK,WK2),3.0 CRD V6 4WD,3.6 V6(209 kW) 2WD,3.6 V6 4WD,3.6 VVT 4WD,5.7 V8(259 kW) 4WD,With Sport sus.,Air Spring Suspension,Incl. Height Control,Exc. Adjustable Shock Absorber,Auto Entry/Exit sus., Tuned',
    'Grand Cherokee IV(WK,WK2),3.0 CRD V6 4WD,3.6 V6(209 kW) 2WD,3.6 V6(210 kW) 4WD,3.6 V6 FlexFuel(210 kW) 4WD,3.6 VVT 4WD,5.7 V8(259 kW) 4WD,Exc. Sport sus.,Height Control,Adjustable Shock Absorber,Exc. Air Spring Suspension,Auto Entry/Exit sus.,Tuned',
    'Grand Cherokee IV(WK,WK2),3.0 CRD V6 4WD,3.6 V6(209 kW) 2WD,3.6 V6(210 kW) 4WD,3.6 VVT 4WD,5.7 V8(259 kW) 4WD,With Air Spring Suspension,Incl. Height Control,Exc. Sport sus.,Air Spring Suspension,Exc. Auto Entry/Exit sus.,Tuned',
    '2.0 (150 kw) Coupe FWD DMSA for vehicles with sports suspension, for PR Code: 1BH, 1BU, 1BE ;for vehicles with standard suspension, for PR Code: 1BH, 1BM, 1BU',
    '2wd 2000-16V(Engine = 20XE,C 20XE), Chassis No.→NV199999,Chassis No. →N1999999 ,Chassis No.→N5999999',
    '2WD2000-16V(Engine = 20XE,C 20XE), Chassis No.P1000001→,P5000001→,Chassis No .P7000001→',
    '1 2 3, 4, 5, 6, 7',
    'Grand Cherokee IV(WK,WK2),3.0 CRD V6 4WD,3.6 V6(209 kW) 2WD,3.6 V6 4WD,3.6 VVT 4WD',
    '1.6,2.0,2.0 E,2.3 E,(8C,B4),1.9 TD,1.9 TDI,Exc. Sport sus.,Quattro,For bad road suspension',
    '1.6,2.0,2.0 E,2.3 E,(8C,B4),1.9 TD,1.9 TDI,Exc. Sport sus.,Quattro,For bad road suspension test',
    'Sport sus. test',
    'ALL 2 & 4 Door Saloon 4WD(3T4),With Original 32112410 Raised Vehicle,Exc. Sport sus.,For bad road suspension',
    "For more information about the Giant Wing Paper Plane " .
    "see our Web site <underline=true avoidbreak>" .
    "www.kraxi-systems.com<underline=false noavoidbreak>." .
    "Alternatively, contact us by email via <underline=true " .
    "charclass={letter {- .}}>questions@kraxi-systems.com" .
    "<charclass={default {- .}} underline=false>. You'll get all " .
    "information about how to fly the Giant Wing in a thunderstorm " .
    "as soon as possible.",
    '116i,118i,120i,130i(E81,E87),116d,118d,120d,123d,Exc. Sport sus.',
    '2WD(F21, 32356750F20),114d,116d,118d,120d,125d,114i,116i,118i,120i,125i,With Sport sus.,Exc. M models,For bad road suspension,Exc. Adaptive sus.,M Performance',
    '320Ci(E46),Exc. Sport sus.,For bad road suspension,Xi',

    '< C >',
];

$shuffle = [];
//dd(mb_strlen($sText2));
foreach ($aTests as $aVal)
{
    if (!$shuffle)
    {
        $shuffle = $aTexts;
        shuffle($shuffle);
    }

    $shift = array_shift($shuffle);
    $aBrand[$aVal['make']][$aVal['model1']][$aVal['model2']] = $shift;
    $sRun ++;
}

$sRun = 1;
$aPng = [];
$aRun = [
    '23.png', '26.png', '29.png', '32.png', '35.png', '38.png', '41.png',
    '44.png', '24.png', '27.png', '30.png', '33.png', '36.png', '39.png',
    '42.png', '45.png', '25.png', '28.png', '31.png', '34.png', '37.png', '40.png', '43.png'
];
foreach ($aBrand as $sBrand => $aModel)
{
    foreach ($aModel as $sModel => $aRemark)
    {
        foreach ($aRemark as $sYear => $sRemark)
        {
            if (!$aPng) {
                $aPng = $aRun;
            }

            $sPng = array_shift($aPng);
            $aData[] = [
                'make' => $sBrand,
                'model1' => $sModel,
                'model2' => $sYear,
                'remark' => $sRemark,
                'value' => [
                    [
                        'col1' => 'L', 'col2' => 'L1'. substr('000000'. $sRun, -6), 'col3' => '32201740', 'col4' => $sPng,
                        'col5' => 'L', 'col6' => 'R3'. substr('000000'. $sRun, -6), 'col7' => '32201740', 'col8' => $sPng,
                    ],
                    [
                        'col1' => 'R', 'col2' => 'L2'. substr('000000'. $sRun, -6), 'col3' => '32201740', 'col4' => $sPng,
                        'col5' => 'R', 'col6' => 'R4'. substr('000000'. $sRun, -6), 'col7' => '32201740', 'col8' => $sPng,
                    ],
                ]
            ];
        }
    }
}
$aValue['model'] = ['style' => 'modelGuideByShockAbsorber', 'title' => 'Application', 'remark' => 'Application', 'value' => $aData];

// 交叉号
$aData = [];
$aBrand = ['OE1', 'OE2', 'OE3', 'OE4', 'OE5', 'OE6', 'OE7'];
foreach ($aBrand as $sBrand)
{
    $sRand = rand(5, 500);
    for ($sRun = 1; $sRun < $sRand; $sRun ++) {
        $aData[] = ['col' => $sBrand, 'col1' => 31100000 + $sRun, 'col2' => 443000 + $sRun];
    }
}
$aValue['cross'] = ['style' => 'cross3Guide', 'title' => 'Cross Reference List', 'remark' => 'Cross Reference List', 'value' => $aData];

// 新号码
$aData = [];
for ($sRun = 201321; $sRun < 201821; $sRun ++) {
    $aData[] = $sRun;
}
$aValue['new'] = ['style' => 'new1Guide', 'title' => 'New applications (compared with catalogue 2020)', 'remark' => 'New applications (compared with catalogue 2020)', 'value' => $aData];

$aValue['footer'] = [
    'style' => 'remarkGuide',
    'title' => '封底',
    'remark' => '封底',
    'value' => [
        'compute' => false, // 是否需要计算页码
        'imglist' => [
            dirname(__DIR__). '/image/footer.jpg',
        ],
    ]
];
return $aValue;


