Last active
August 29, 2015 13:56
-
-
Save Greg-Boggs/9260408 to your computer and use it in GitHub Desktop.
Must refactor this
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* This code created an alphabetized index, when I combined them, I created a mess. | |
foreach ($build as $key => $value) { | |
$companies[$value['#markup'][0]][] = $value['#markup']; | |
} | |
*/ | |
asort($build); | |
foreach ($build as $key => $value) { | |
$markup = strtoupper($value['#markup'][0]); | |
if (is_numeric($markup) || $markup == 'A') { | |
$character_range['# - A'][$value['#indexed_value']] = $value; | |
} | |
if ($markup >= 'B' && $markup <= 'E') { | |
$character_range['B - E'][$value['#indexed_value']] = $value; | |
} | |
if ($markup >= 'F' && $markup <= 'H') { | |
$character_range['F - H'][$value['#indexed_value']] = $value; | |
} | |
if ($markup >= 'I' && $markup <= 'K') { | |
$character_range['I - K'][$value['#indexed_value']] = $value; | |
} | |
if ($markup >= 'L' && $markup <= 'N') { | |
$character_range['L - N'][$value['#indexed_value']] = $value; | |
} | |
if ($markup >= 'O' && $markup <= 'Q') { | |
$character_range['O - Q'][$value['#indexed_value']] = $value; | |
} | |
if ($markup >= 'R' && $markup <= 'S') { | |
$character_range['R - S'][$value['#indexed_value']] = $value; | |
} | |
if ($markup >= 'T' && $markup <= 'V') { | |
$character_range['T - V'][$value['#indexed_value']] = $value; | |
} | |
if ($markup >= 'W' && $markup <= 'Z') { | |
$character_range['W - Z'][$value['#indexed_value']] = $value; | |
} | |
} | |
unset($build); | |
foreach ($character_range as $key => $companies) { | |
$build[] = array( | |
'#markup' => $key, | |
'#active' => 1, | |
'#item_children' => $companies, | |
); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment