-
-
Save boonebgorges/b80c578e5b8e6045e2f6a64223811472 to your computer and use it in GitHub Desktop.
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 | |
function cac_get_cuny_campuses( $args = array() ) { | |
$campuses = array( | |
'baruch' => array( | |
'full_name' => 'Baruch College', | |
'one_search_id' => 'bb', | |
'short_name' => 'Baruch', | |
'url' => 'https://www.baruch.cuny.edu/', | |
), | |
'bmcc' => array( | |
'full_name' => 'Borough of Manhattan Community College', | |
'one_search_id' => 'bm', | |
'short_name' => 'BMCC', | |
'url' => 'https://www.bmcc.cuny.edu/', | |
), | |
'bcc' => array( | |
'full_name' => 'Bronx Community College', | |
'one_search_id' => 'bx', | |
'short_name' => 'BCC', | |
'url' => 'https://www.bcc.cuny.edu/', | |
), | |
'brooklyn' => array( | |
'full_name' => 'Brooklyn College', | |
'one_search_id' => 'bc', | |
'short_name' => 'Brooklyn College', | |
'url' => 'http://www.brooklyn.cuny.edu/', | |
), | |
'ccny' => array( | |
'full_name' => 'City College of New York', | |
'one_search_id' => 'cc', | |
'short_name' => 'CCNY', | |
'url' => 'https://www.ccny.cuny.edu/', | |
), | |
'citytech' => array( | |
'full_name' => 'New York City College of Technology', | |
'one_search_id' => 'ny', | |
'short_name' => 'City Tech', | |
'url' => 'https://www.citytech.cuny.edu/', | |
), | |
'central' => array( | |
'full_name' => 'CUNY Central', | |
'short_name' => 'CUNY Central', | |
'one_search_id' => false, | |
'url' => 'https://www2.cuny.edu/', | |
), | |
'csom' => array( | |
'full_name' => 'CUNY School of Medicine', | |
'one_search_id' => 'cc', | |
'short_name' => 'CUNY School of Medicine', | |
'url' => 'https://www.ccny.cuny.edu/csom/', | |
), | |
'csi' => array( | |
'full_name' => 'College of Staten Island', | |
'one_search_id' => 'si', | |
'short_name' => 'CSI', | |
'url' => 'https://www.csi.cuny.edu/', | |
), | |
'gc' => array( | |
'full_name' => 'CUNY Graduate Center', | |
'one_search_id' => 'gc', | |
'short_name' => 'GC', | |
'url' => 'https://www.gc.cuny.edu/', | |
), | |
'guttman' => array( | |
'full_name' => 'Guttman Community College', | |
'one_search_id' => 'nc', | |
'short_name' => 'Guttman CC', | |
'url' => 'https://www.guttman.cuny.edu/', | |
), | |
'hostos' => array( | |
'full_name' => 'Hostos Community College', | |
'one_search_id' => 'ho', | |
'short_name' => 'Hostos CC', | |
'url' => 'https://www.hostos.cuny.edu/', | |
), | |
'hunter' => array( | |
'full_name' => 'Hunter College', | |
'one_search_id' => 'hc', | |
'short_name' => 'Hunter', | |
'url' => 'https://www.hunter.cuny.edu/', | |
), | |
'jjay' => array( | |
'full_name' => 'John Jay College of Criminal Justice', | |
'one_search_id' => 'jj', | |
'short_name' => 'John Jay', | |
'url' => 'https://www.jjay.cuny.edu/', | |
), | |
'journalism' => array( | |
'full_name' => 'Craig Newmark Graduate School of Journalism', | |
'one_search_id' => 'gj', | |
'short_name' => 'Journalism', | |
'url' => 'https://www.journalism.cuny.edu/', | |
), | |
'kbcc' => array( | |
'full_name' => 'Kingsborough Community College', | |
'one_search_id' => 'kb', | |
'short_name' => 'KBCC', | |
'url' => 'https://www.kbcc.cuny.edu/', | |
), | |
'lagcc' => array( | |
'full_name' => 'LaGuardia Community College', | |
'one_search_id' => 'lg', | |
'short_name' => 'LaGuardia CC', | |
'url' => 'https://www.laguardia.edu', | |
), | |
'lehman' => array( | |
'full_name' => 'Lehman College', | |
'one_search_id' => 'le', | |
'short_name' => 'Lehman', | |
'url' => 'https://www.lehman.cuny.edu/', | |
), | |
'law' => array( | |
'full_name' => 'CUNY School of Law', | |
'one_search_id' => 'cl', | |
'short_name' => 'CUNY School of Law', | |
'url' => 'http://www.law.cuny.edu/', | |
), | |
'macaulay' => array( | |
'full_name' => 'Macaulay Honors College', | |
'one_search_id' => 'le', | |
'short_name' => 'Macaulay', | |
'url' => 'https://macaulay.cuny.edu/', | |
), | |
'mec' => array( | |
'full_name' => 'Medgar Evers College', | |
'one_search_id' => 'me', | |
'short_name' => 'Medgar Evers', | |
'url' => 'https://ares.mec.cuny.edu/', | |
), | |
'qc' => array( | |
'full_name' => 'Queens College', | |
'one_search_id' => 'qc', | |
'short_name' => 'Queens College', | |
'url' => 'https://www.qc.cuny.edu/', | |
), | |
'qcc' => array( | |
'full_name' => 'Queensborough Community College', | |
'one_search_id' => 'qb', | |
'short_name' => 'QCC', | |
'url' => 'https://www.qcc.cuny.edu/', | |
), | |
'slu' => array( | |
'full_name' => 'CUNY School of Labor and Urban Studies', | |
'short_name' => 'School of Labor and Urban Studies', | |
'one_search_id' => 'gc', // GC | |
'url' => 'https://slu.cuny.edu/', | |
), | |
'sph' => array( | |
'full_name' => 'CUNY Graduate School of Public Health and Health Policy', | |
'short_name' => 'School of Public Health', | |
'one_search_id' => 'cc', // CCNY | |
'url' => 'https://sph.cuny.edu/', | |
), | |
'sps' => array( | |
'full_name' => 'CUNY School of Professional Studies', | |
'one_search_id' => 'bb', // Baruch | |
'short_name' => 'SPS', | |
'url' => 'https://sps.cuny.edu/', | |
), | |
'york' => array( | |
'full_name' => 'York College', | |
'one_search_id' => 'yc', | |
'short_name' => 'York', | |
'url' => 'https://www.york.cuny.edu/', | |
), | |
); | |
$r = array_merge( array( | |
'orderby' => 'short_name', | |
), $args ); | |
$defaults = array( | |
'one_search_id' => 'CUNY', | |
); | |
$campus_data = array_map( function( $campus ) use ( $defaults ) { | |
return array_merge( $defaults, $campus ); | |
}, $campuses ); | |
$orderby = $r['orderby']; | |
if ( 'slug' !== $orderby ) { | |
uasort( $campus_data, function( $a, $b ) use ( $orderby ) { | |
$a_value = isset( $a[ $orderby ] ) ? $a[ $orderby ] : 'short_name'; | |
$b_value = isset( $b[ $orderby ] ) ? $b[ $orderby ] : 'short_name'; | |
return strnatcasecmp( $a_value, $b_value ); | |
} ); | |
} | |
return $campus_data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment