app/Resources/views/Includes/apartments-header-navmain.html.php line 92

Open in your IDE?
  1. <?php
  2.     /*
  3.     At this point we have...
  4.     $site
  5.     $navStartNode
  6.     $mainNavigation
  7.     $menu
  8.     */
  9.     use \Pimcore\Navigation\Page;
  10.     # RESULT: $this->document
  11.     if( !$this->document instanceof \Pimcore\Model\Document\Page ) {                // Check if we have a document by default...
  12.         if( \Pimcore\Model\Site::isSiteRequest() ) {                                // Check if the request is a site request...
  13.             $site = \Pimcore\Model\Site::getCurrentSite();                            // Assign the site root as the current document...
  14.             $this->document $site->getRootDocument();
  15.         } else {
  16.             $this->document = \Pimcore\Model\Document\Page::getById);            // Assign the root document as the current document...
  17.         }
  18.     }
  19.     # RESULT: $navStartNode
  20.     $navStartNode $this->document->getProperty'navigationRoot' );                // Allow a site manager to define the navigation root with a property...
  21.     if( !$navStartNode instanceof \Pimcore\Model\Document\Page ) {                    // Figure out if the navigation root is a valid document...
  22.         if( \Pimcore\Model\Site::isSiteRequest() ) {                                // Check if the request is a site request...
  23.             $site = \Pimcore\Model\Site::getCurrentSite();                            // Assign the site root as the navigation root...
  24.             $navStartNode $site->getRootDocument();
  25.         } else {
  26.             $navStartNode = \Pimcore\Model\Document\Page::getById);                // Assign the root document as the navigation root...
  27.         }
  28.     }
  29.     // Generate a working site navigation...
  30.     $mainNavigation $this->navigation()->buildNavigation$this->document$navStartNode );
  31. ?>
  32. <div class="navigation-links-desktop show-for-large">
  33.     <?php
  34.         // State Abbreviations...
  35.         $states = array(
  36.             'dc'=>'District of Columbia'
  37.             'al' => 'Alabama'            'hi' => 'Hawaii'            'ma' => 'Massachusetts'    'nm' => 'New Mexico'        'sd' => 'South Dakota'
  38.             'ak' => 'Alaska'            'id' => 'Idaho'            'mi' => 'Michigan'        'ny' => 'New York'        'tn' => 'Tennessee'
  39.             'az' => 'Arizona'            'il' => 'Illinois'        'mn' => 'Minnesota'        'nc' => 'North Carolina'    'tx' => 'Texas'
  40.             'ar' => 'Arkansas'        'in' => 'Indiana'            'ms' => 'Mississippi'        'nd' => 'North Dakota'    'ut' => 'Utah'
  41.             'ca' => 'California'        'ia' => 'Iowa'            'mo' => 'Missouri'        'oh' => 'Ohio'            'vt' => 'Vermont'
  42.             'co' => 'Colorado'        'ks' => 'Kansas'            'mt' => 'Montana'            'ok' => 'Oklahoma'        'va' => 'Virginia'
  43.             'ct' => 'Connecticut'        'ky' => 'Kentucky'        'ne' => 'Nebraska'        'or' => 'Oregon'            'wa' => 'Washington'
  44.             'de' => 'Delaware'        'la' => 'Louisiana'        'nv' => 'Nevada'            'pa' => 'Pennsylvania'    'wv' => 'West Virginia'
  45.             'fl' => 'Florida'            'me' => 'Maine'            'nh' => 'New Hampshire'    'ri' => 'Rhode Island'    'wi' => 'Wisconsin'
  46.             'ga' => 'Georgia'            'md' => 'Maryland'        'nj' => 'New Jersey'        'sc' => 'South Carolina'    'wy' => 'Wyoming'
  47.         );
  48.         // Generate a hierarchy composed of city-to-state relationships...
  49.         $Structure = array();
  50.         $YardiProperties = new \Pimcore\Model\DataObject\YardiProperty\Listing();
  51.         foreach( $YardiProperties as $YardiProperty ) {
  52.             // Parse the cached property data...
  53.             $YardiPropertyJson json_decode$YardiProperty->getCache_property() )[ ];
  54.             $PropertyData $YardiPropertyJson->PropertyData;
  55.             // Get key and name pairs...
  56.             $PropertyStateKey = \Pimcore\File::getValidFilenamestrtolower$PropertyData->state ) );
  57.             $PropertyState $statesstrtolower$PropertyStateKey ) ];
  58.             $PropertyCityKey = \Pimcore\File::getValidFilename$PropertyData->city );
  59.             $PropertyCity $PropertyData->city;
  60.             // Skip empty-string states and cities...
  61.             if( empty( $PropertyStateKey ) || empty( $PropertyCityKey ) ) continue;
  62.             // Create the array if it doesn't exist yet...
  63.             if( !is_array$Structure$PropertyStateKey ] ) ) {
  64.                 $Structure$PropertyStateKey ] = array();
  65.             }
  66.             // Assign the name of the city to the tree...
  67.             $Structure$PropertyStateKey ][ $PropertyCityKey ] = $PropertyCity;
  68.         }
  69.         $CheckURI explode'/'trimparse_url$_SERVER'REQUEST_URI' ], PHP_URL_PATH ), '/' ) );
  70.         // Turn the hierarchy into navigation links...
  71.         $StateLinks = array();
  72.         foreach( $Structure as $StateKey => $Cities ) {
  73.             $CityLinks = array();
  74.             foreach( $Cities as $CityKey => $CityLabel ) {
  75.                 $CityLinks[] = array(
  76.                     'uri' => $this->path'Properties S_C', [ 'state' => $StateKey'city' => $CityKey ] ),
  77.                     'label' => $CityLabel,
  78.                     'active' => ( @$CheckURI] == 'apartments' && @$CheckURI] == $StateKey && @$CheckURI] == $CityKey )
  79.                 );
  80.             }
  81.             $StateLink = array(
  82.                 'uri' => $this->path'Properties S', [ 'state' => $StateKey ] ),
  83.                 'label' => $states$StateKey ],
  84.                 'active' => ( @$CheckURI] == 'apartments' && @$CheckURI] == $StateKey )
  85.             );
  86.             if( !empty( $CityLinks ) ) {
  87.                 $StateLink'pages' ] = $CityLinks;
  88.             }
  89.             $StateLinks[] = $StateLink;
  90.         }
  91.         $ApartmentsLinks = array(
  92.             'order' => -1,
  93.             'uri' => $this->path'Properties', [] ),
  94.             'label' => 'Apartments',
  95.             'class' => 'mega-menu',
  96.             'active' => ( @$CheckURI] == 'apartments' )
  97.         );
  98.         if( !empty( $StateLinks ) ) {
  99.             $ApartmentsLinks'pages' ] = $StateLinks;
  100.         }
  101.         // Add our group of links to the navigation...
  102.         $mainNavigation->addPage$ApartmentsLinks );
  103.     ?>
  104.     <style type="text/css">
  105.         /* Normal Dropdowns */
  106.         #theme-header .navigation-links-desktop .navigation > li {
  107.             position: relative;
  108.         }
  109.         #theme-header .navigation-links-desktop .navigation > li > ul {
  110.             border-top: 4px solid #e03133;
  111.             padding: 0.5rem 0;
  112.             background: #efefef;
  113.             opacity: 0;
  114.             box-shadow: 0px 2px 4px rgba(0,0,0,0.5);
  115.             -webkit-transform-origin: 100% 4px;
  116.             transform-origin: 100% 4px;
  117.             -webkit-transform: scaleY(0);
  118.             transform: scaleY(0);
  119.             -webkit-transition: -webkit-transform 0.25s, opacity 0.25s;
  120.             transition: transform 0.25s, opacity 0.25s;
  121.             position: absolute;
  122.             top: 100%;
  123.             right: -1.5rem;
  124.         }
  125.         #theme-header .navigation-links-desktop .navigation > li > ul > li {
  126.             white-space: nowrap;
  127.         }
  128.         #theme-header .navigation-links-desktop .navigation > li > ul > li > a {
  129.             display: block;
  130.             padding: 0.5rem 1.5rem;
  131.             color: #33a5bf;
  132.             font-size: 1rem;
  133.             line-height: 1;
  134.             transition: color 0.5s;
  135.             -webkit-transition: color 0.5s;
  136.             -ms-transition: color 0.5s;
  137.             -moz-transition: color 0.5s;
  138.             -o-transition: color 0.5s;
  139.             text-transform: capitalize;
  140.             text-align: left;
  141.         }
  142.         #theme-header .navigation-links-desktop .navigation > li > ul > li > a:hover{
  143.             color: #000;
  144.             transition: color 0.5s;
  145.             -webkit-transition: color 0.5s;
  146.             -ms-transition: color 0.5s;
  147.             -moz-transition: color 0.5s;
  148.             -o-transition: color 0.5s;
  149.         }
  150.         #theme-header .navigation-links-desktop .navigation > li:hover > ul {
  151.             opacity: 1;
  152.             -webkit-transform: scaleY(1);
  153.             transform: scaleY(1);
  154.         }
  155.         /* Mega Dropdowns */
  156.         #theme-header .navigation-links-desktop .navigation > li > a.mega-menu + ul {
  157.             display: flex;
  158.             table-layout: fixed;
  159.             text-align: left;
  160.             padding: 2rem 3.5rem;
  161.             max-width: 1200px;
  162.             width: 100%;
  163.             box-shadow: none;
  164.             -webkit-transform: translate(-50%,0%) scaleY(0);
  165.             transform: translate(-50%,0%) scaleY(0);
  166.             position: fixed;
  167.             top: 74px;
  168.             left: 50%;
  169.         }
  170.         #theme-header .navigation-links-desktop .navigation > li:hover > a.mega-menu + ul {
  171.             opacity: 1;
  172.             -webkit-transform: translate(-50%,0%) scaleY(1);
  173.             transform: translate(-50%,0%) scaleY(1);
  174.             border-top: 0;
  175.         }
  176.         #theme-header .navigation-links-desktop .navigation > li > a.mega-menu + ul::before {
  177.             content: "";
  178.             background: #efefef;
  179.             width: 100vw;
  180.             height: 100%;
  181.             box-shadow: 0px 2px 4px rgba(0,0,0,0.5);
  182.             -webkit-transform: translate(-50%,0%);
  183.             transform: translate(-50%,0%);
  184.             position: absolute;
  185.             z-index: 1;
  186.             top: 0;
  187.             left: 50%;
  188.             border-top: 4px solid #e02e33;
  189.         }
  190.         #theme-header .navigation-links-desktop .navigation > li > a.mega-menu + ul::after {
  191.             content: "";
  192.             display: block;
  193.             clear: both;
  194.             float: none;
  195.             height: 0;
  196.         }
  197.         #theme-header .navigation-links-desktop .navigation > li > .mega-menu + ul > li {
  198.             display: block;
  199.             float: left;
  200.             padding: 0 1.5rem;
  201.             width: <?= 100 count$StateLinks ?>%;
  202.             position: relative;
  203.             z-index: 2;
  204.             border-right: 2px solid #e0e0e0;
  205.         }
  206.         #theme-header .navigation-links-desktop .navigation > li > .mega-menu + ul > li:first-child {
  207.             padding: 0 1.5rem 0 0;
  208.         }
  209.         #theme-header .navigation-links-desktop .navigation > li > .mega-menu + ul > li:last-child {
  210.             border-right: none;
  211.             padding: 0 0 0 1.5rem;
  212.         }
  213.         #theme-header .navigation-links-desktop .navigation > li > .mega-menu + ul > li > a {
  214.             padding: 0;
  215.             font-family: 'BrandonTextWeb-Regular', sans-serif;
  216.             font-size: 20px;
  217.             text-transform: capitalize;
  218.             color: #33a5bf;
  219.             margin-bottom: 10px;
  220.             -webkit-transition: color 0.5s;
  221.             transition: color 0.5s;
  222.         }
  223.         #theme-header .navigation-links-desktop .navigation > li > .mega-menu + ul > li > a:hover {
  224.             color: #000;
  225.             transition: color 0.5s;
  226.             -webkit-transition: color 0.5s;
  227.             -ms-transition: color 0.5s;
  228.             -moz-transition: color 0.5s;
  229.             -o-transition: color 0.5s;
  230.         }
  231.         #theme-header .navigation-links-desktop .navigation > li > .mega-menu + ul > li > ul > li > a {
  232.             font-family: 'BrandonTextWeb-Regular', sans-serif;
  233.             font-size: 16px;
  234.             text-transform: capitalize;
  235.             color: #000;
  236.             transition: color 0.5s;
  237.             -webkit-transition: color 0.5s;
  238.             -ms-transition: color 0.5s;
  239.             -moz-transition: color 0.5s;
  240.             -o-transition: color 0.5s;
  241.         }
  242.         #theme-header .navigation-links-desktop .navigation > li > .mega-menu + ul > li > ul > li > a:hover{
  243.             color: #33a5bf;
  244.             transition: color 0.5s;
  245.             -webkit-transition: color 0.5s;
  246.             -ms-transition: color 0.5s;
  247.             -moz-transition: color 0.5s;
  248.             -o-transition: color 0.5s;
  249.         }
  250.         #theme-header .navigation-links-desktop .navigation > li > .mega-menu + ul > li > ul {
  251.             column-count: 2;
  252.         }
  253.         #theme-header .navigation-links-mobile .has-children .menu-wrapper li {
  254.         position: relative;
  255.             margin-left: 1rem;
  256.         }
  257.         #theme-header .navigation-links-mobile .has-children .menu-wrapper li a{
  258.             color: #33a5bf;
  259.             margin-bottom: 1rem;
  260.             display: block;
  261.         }
  262.         #theme-header .navigation-links-mobile .has-children .menu-wrapper li ul li a{
  263.             color: #fff;
  264.             font-family: 'BrandonTextWeb-Regular', sans-serif;
  265.         }
  266.     </style>
  267.     <?= $this->navigation()->render$mainNavigation ?>
  268. </div>