I've got an additional level added to a multidimensional array and I'm trying to find the best way to incorporate a new foreach loop, or alter current loops, so that my modal body properly adds a new section for each page type.
Basically, My modal should have a header for each company and display(room) and the body should have a section for each page type in that display/room.
What I have so far is good up to the modal header, but now I've commented a new section for where I need a new loop to actually show the page type and expiration.
here's the code so far:
<?php
$displays = array(
"Company" => array(
"Company One Main"=>array(
"Displays"=>array(
"Room One"=>array(
"Page"=>array(
"Type"=>"News",
"Expiration"=>"06/12/2018"),
),
"Room Two"=>array(
"Page"=>array(
"Type"=>"Social",
"Expiration"=>"06/18/2018"),
),
"Room Three"=>array(
"Page"=>array(
"Type"=>"Social",
"Expiration"=>"06/18/2018"),
),
),
),
"Company One Other"=>array(
"Displays"=>array(
"Room Two"=>array(
"Page"=>array(
"Type"=>"Social",
"Expiration"=>"06/18/2018"),
),
"Room Three"=>array(
"Page"=>array(
"Type"=>"Social",
"Expiration"=>"06/18/2018"),
),
),
),
"Company Two Main"=>array(
"Displays"=>array(
"Room One"=>array(
"Page"=>array(
"Type"=>"Social",
"Expiration"=>"06/18/2018"),
),
"Room Two"=>array(
"Page"=>array(
"Type"=>"Social",
"Expiration"=>"06/18/2018"),
),
),
),
"Company Two Other"=>array(
"Displays"=>array(
"Room One"=>array(
"Page"=>array(
"Type"=>"Social",
"Expiration"=>"06/18/2018"),
),
"Room Two"=>array(
"Page"=>array(
"Type"=>"Social",
"Expiration"=>"06/18/2018"),
),
"Room Three"=>array(
"Page"=>array(
"Type"=>"Social",
"Expiration"=>"06/18/2018"),
),
),
),
),
);
?>
<div class="col-lg-4 col-md-12 col-sm-12">
<div class="page-header">
<h2>Pages Expiring Soon</h2>
</div>
<div class="card" id="expDisplays" style="margin-bottom:20px; padding:10px;">
<?php foreach($displays["Company"] as $area_name => $area_details): ?>
<h6><?php echo $area_name ?><a href="#" data-toggle="modal" data-target="#expiringDisplays">Edit</a></h6>
<!-- Modal -->
<div class="modal fade" id="expiringDisplays" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<?php foreach($area_details["Displays"] as $d=>$v): ?>
<h5 class="modal-title" id="modalLabel"><?php echo $area_name . " - " . $d?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<!-- END MODAL HEADER -->
</div>
<!--Everything works to this point, I need a new foreach to show page types and expirations-->
<div class="modal-body">
<!--Need new foreach to get page types and their corresponding expiration-->
<br>
<h6><?php echo $v['Type'] ?></h6>
<h6>Date/Time Expiring: <?php echo $v["Expiration"] ?></h6>
<h6>Set New Expiration: <input data-date-format="mm/dd/yyyy" id="datepicker" name="datepicker"></h6>
<a href="#" style="float:left;">View Display</a>
<br>
<hr>
<?php endforeach; ?>
<!-- END MODAL BODY -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
<!-- END MODAL FOOTER -->
</div>
<!-- END MODAL CONTENT -->
</div>
<!-- END MODAL DIALOGUE -->
</div>
<!-- END MODAL -->
</div>
<?php //endforeach; ?>
<?php endforeach; ?>
</div>