Skip to content

Instantly share code, notes, and snippets.

@timgauthier
Last active August 29, 2015 14:14
Show Gist options
  • Save timgauthier/89fbaf1a6514e1ab8768 to your computer and use it in GitHub Desktop.
Save timgauthier/89fbaf1a6514e1ab8768 to your computer and use it in GitHub Desktop.
Compare two arrays. The second array is what the user has access two. The first array is the ProductID i need to match against the second.
// Currently pulls all of the children pages and generates the "html list for them
<?php
// get the open item on the first level
if($root = $pages->findOpen()) {
// get visible children for the root item
$items = $page->children()->visible();
}
// only show the menu if items are available
if($items && $items->count() > 0):
foreach($items as $item): ?>
<a href="<?php echo $item->url() ?>">
<li class="list-group-item"><?php echo html($item->title()) ?> - <? print_r($item->productids()->split(','))?></li>
<li class="list-group-item">
</a>
<?php endforeach ?>
<?php endif ?>
List of Courses
Adult Learning Toolbox - Array ( [0] => 4 )
Insurance Fundamentals Level 1 Course (2014) - Array ( [0] => 2 )
Insurance Fundamentals Level 2 Course (2014) - Array ( [0] => 3 )
Video Marketing Course - Array ( [0] => 6 )
Hire for HIPPA, Train for Skills - Array ( [0] => 12 )
Raise your HIPPA Standards - Array ( [0] => 11 )
Introduction to Commercial Insurance - Array ( [0] => 13 )
Helping Your Child Succeed at School - Array ( [0] => 16 )
Array ( [0] =>
Array ( [access_id] => 972 [invoice_id] => 853 [invoice_payment_id] => [user_id] => 641 [product_id] => 4 [transaction_id] => 79.254.92.190-1382830613 [begin_date] => 2013-10-26 [expire_date] => 2014-02-26 [qty] => 1 [invoice_item_id] => 988 [comment] => [invoice_public_id] => UER48 ) [1] =>
Array ( [access_id] => 977 [invoice_id] => 857 [invoice_payment_id] => [user_id] => 641 [product_id] => 4 [transaction_id] => 79.254.92.190-1382883883 [begin_date] => 2014-02-26 [expire_date] => 2014-06-26 [qty] => 1 [invoice_item_id] => 992 [comment] => [invoice_public_id] => SL41F ) [2] =>
Array ( [access_id] => 1375 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 20 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2015-02-06 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => ) [3] =>
Array ( [access_id] => 1376 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 21 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2015-02-06 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => ) [4] =>
Array ( [access_id] => 1377 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 19 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2014-12-06 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => ) [5] =>
Array ( [access_id] => 1378 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 18 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2015-01-06 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => ) [6] =>
Array ( [access_id] => 1379 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 17 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2015-02-06 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => ) [7] =>
Array ( [access_id] => 1380 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 16 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2014-11-13 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => ) [8] =>
Array ( [access_id] => 1381 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 12 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2014-12-06 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => ) [9] =>
Array ( [access_id] => 1382 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 6 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2014-12-06 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => ) [10] =>
Array ( [access_id] => 1383 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 13 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2015-01-06 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => ) [11] =>
Array ( [access_id] => 1384 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 3 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2015-01-06 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => ) [12] =>
Array ( [access_id] => 1385 [invoice_id] => [invoice_payment_id] => [user_id] => 641 [product_id] => 2 [transaction_id] => [begin_date] => 2014-11-06 [expire_date] => 2015-01-06 [qty] => 1 [invoice_item_id] => [comment] => [invoice_public_id] => )
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment