@php
#Using Recursion (## Can Handel Very Deeply Nested Data)
#Example DataSet
// $DemoData = [
// "Section 1" => [
// "Link 1" => "https://example.com/link1",
// "Link 2" => [
// "url" => "https://example.com/link2",
// "nested" => [
// "Nested Link 1" => "https://example.com/nestedlink1",
// "Nested Link 2" => "https://example.com/nestedlink2",
// ],
// ],
// ],
// "Section 2" => [
// "Link 3" => "https://example.com/link3",
// "Link 4" => "https://example.com/link4",
// ],
// "Section 3" => [
// "Subsection 3.1" => [
// "Subsection Link 1" => "https://example.com/sublink1",
// ],
// "Subsection 3.2" => [
// "url" => "https://example.com/subsection-link",
// "nested" => [
// "Nested Link 1" => [
// "url" => "https://example.com/nested-link-1",
// "nested" => [
// "Deeply Nested Link" => "https://example.com/deeply-nested",
// ],
// ],
// "Nested Link 2" => "https://example.com/nested-link-2",
// ],
// ],
// ],
// ];
$data = [
'4.1: Physical Facilities' => [
'4.1.1. The Institution has adequate infrastructure and other facilities for teaching – learning, viz., classrooms, laboratories, computing equipment etc. ICT – enabled facilities such as smart class, LMS etc.' => 'https://drive.google.com/file/d/1M0DK5_FTRBoFn0gTRhXPuoank-zinXLV/view?usp=drive_link',
'4.1.2: Percentage of expenditure for infrastructure development and augmentation excluding salary during the last five years' => 'https://drive.google.com/file/d/1L2VU_m64F9A-xFnXFWw2iy_GOlgyaVRZ/view?usp=drive_link',
],
'4.2: Library as a Learning Resource' => [
'4.2.1: Library is automated with digital facilities using Integrated Library Management System (ILMS), adequate subscriptions to e-resources and journals are made. The library is optimally used by the faculty and students.' => 'https://drive.google.com/file/d/1MYBbI8CrisYiWovxA1vFsYepQv3kQC7Y/view?usp=drive_link',
],
'4.3: IT Infrastructure' => [
'4.3.1: Institution frequently updates its IT facilities and provides sufficient bandwidth for internet connection.' => 'https://drive.google.com/file/d/1DewQRORJqg6vPcRFwq1UMvCia5-5asDU/view?usp=drive_link',
'4.3.2: Student – Computer ratio (Data for the latest completed academic year)' => [
'nested' => [
'4.3.2.1: Number of computers available for student usage during the latest completed academic year.' => 'https://drive.google.com/file/d/1dBoDR7aL9_Pzyh-GsE9QCT7Yy5SXPUDD/view?usp=drive_link',
],
],
],
'4.4: Maintenance of Campus Infrastructure' => [
'4.4.1: Percentage expenditure incurred on maintenance of physical facilities and academic support facilities excluding salary component, during the last five years (INR in Lakhs)' => 'https://drive.google.com/file/d/1j84M6ZsISy0mO5zrUp_M-gcXNxRUe9kG/view?usp=drive_link',
],
];
function displayLinks(array $links)
{
echo '';
foreach ($links as $linkText => $linkData) {
echo '- ';
if (is_array($linkData)) {
renderLink($linkText, $linkData);
displayLinks($linkData['nested']);
} else {
renderLinkWithFile($linkText, $linkData);
}
echo '
';
}
echo '
';
}
function renderLink($linkText, $linkData)
{
if (isset($linkData['url'])) {
echo "$linkText";
} else {
echo "$linkText";
}
}
function renderLinkWithFile($linkText, $linkData)
{
echo "$linkText
View File
";
}
@endphp
@php
foreach ($data as $subSectionTitle => $links) {
echo "
- ";
renderLink($subSectionTitle, []);
displayLinks($links);
echo '
';
}
@endphp