@@ -838,8 +838,8 @@ discard block |
||
| 838 | 838 | $data_table_identifier = $table_info->name; |
| 839 | 839 | |
| 840 | 840 | $q = db_select($table_info->name) |
| 841 | - ->fields($table_info->name) |
|
| 842 | - ->condition($table_info->table_schema['primary key'][0], $school->bcode); |
|
| 841 | + ->fields($table_info->name) |
|
| 842 | + ->condition($table_info->table_schema['primary key'][0], $school->bcode); |
|
| 843 | 843 | |
| 844 | 844 | try { |
| 845 | 845 | $res = $q->execute(); |
@@ -872,8 +872,8 @@ discard block |
||
| 872 | 872 | $data_table_identifier = $table_info->name; |
| 873 | 873 | |
| 874 | 874 | $q = db_select($table_info->name) |
| 875 | - ->fields($table_info->name) |
|
| 876 | - ->condition($table_info->meta['join']['field_data_field_esd_schid']['field'], $school->esd_schid); |
|
| 875 | + ->fields($table_info->name) |
|
| 876 | + ->condition($table_info->meta['join']['field_data_field_esd_schid']['field'], $school->esd_schid); |
|
| 877 | 877 | |
| 878 | 878 | try { |
| 879 | 879 | $res = $q->execute(); |
@@ -961,8 +961,8 @@ discard block |
||
| 961 | 961 | $data_table_identifier = $table_info->name; |
| 962 | 962 | |
| 963 | 963 | $q = db_select($table_info->name) |
| 964 | - ->fields($table_info->name) |
|
| 965 | - ->condition($table_info->table_schema['primary key'][0], $ec->program_id); |
|
| 964 | + ->fields($table_info->name) |
|
| 965 | + ->condition($table_info->table_schema['primary key'][0], $ec->program_id); |
|
| 966 | 966 | |
| 967 | 967 | try { |
| 968 | 968 | $res = $q->execute(); |
@@ -1338,7 +1338,7 @@ discard block |
||
| 1338 | 1338 | * = “Early Head Start” {tid:5158} OR “Head Start” {tid:5155} OR |
| 1339 | 1339 | * “Great Start Readiness Program {tid:5154} |
| 1340 | 1340 | */ |
| 1341 | -function esdportal_api_query_ec_profile_is_free_or_reduced_cost_alter(\QueryAlterableInterface &$query) { |
|
| 1341 | +function esdportal_api_query_ec_profile_is_free_or_reduced_cost_alter(\QueryAlterableInterface & $query) { |
|
| 1342 | 1342 | // First, inner join with ec_profiles. |
| 1343 | 1343 | if (!$query->hasTag('has_ec_profile')) { |
| 1344 | 1344 | esdportal_api_query_has_ec_profile_alter($query); |
@@ -1355,7 +1355,7 @@ discard block |
||
| 1355 | 1355 | * |
| 1356 | 1356 | * IF ec_profile.field_ec_transportation = 1 |
| 1357 | 1357 | */ |
| 1358 | -function esdportal_api_query_ec_profile_has_transportation_alter(\QueryAlterableInterface &$query) { |
|
| 1358 | +function esdportal_api_query_ec_profile_has_transportation_alter(\QueryAlterableInterface & $query) { |
|
| 1359 | 1359 | // First, inner join with ec_profiles. |
| 1360 | 1360 | if (!$query->hasTag('has_ec_profile')) { |
| 1361 | 1361 | esdportal_api_query_has_ec_profile_alter($query); |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | * |
| 1372 | 1372 | * IF ec_profile.field_ec_special {vid:34} CONTAINS more than 5 values/items. |
| 1373 | 1373 | */ |
| 1374 | -function esdportal_api_query_ec_profile_has_special_needs_experience_alter(\QueryAlterableInterface &$query) { |
|
| 1374 | +function esdportal_api_query_ec_profile_has_special_needs_experience_alter(\QueryAlterableInterface & $query) { |
|
| 1375 | 1375 | // First, inner join with ec_profiles. |
| 1376 | 1376 | if (!$query->hasTag('has_ec_profile')) { |
| 1377 | 1377 | esdportal_api_query_has_ec_profile_alter($query); |
@@ -1389,7 +1389,7 @@ discard block |
||
| 1389 | 1389 | * IF ec_profile.field_ec_meals {vid:30} = “Lunch” {tid:5163} |
| 1390 | 1390 | * AND “Afternoon Snack” {tid:5164} |
| 1391 | 1391 | */ |
| 1392 | -function esdportal_api_query_ec_profile_has_meals_alter(\QueryAlterableInterface &$query) { |
|
| 1392 | +function esdportal_api_query_ec_profile_has_meals_alter(\QueryAlterableInterface & $query) { |
|
| 1393 | 1393 | // First, inner join with ec_profiles. |
| 1394 | 1394 | if (!$query->hasTag('has_ec_profile')) { |
| 1395 | 1395 | esdportal_api_query_has_ec_profile_alter($query); |
@@ -1410,7 +1410,7 @@ discard block |
||
| 1410 | 1410 | * |
| 1411 | 1411 | * Only return early childhood centers with a record in esd_el_2014. |
| 1412 | 1412 | */ |
| 1413 | -function esdportal_api_query_has_esd_el_2014_alter(\QueryAlterableInterface &$query) { |
|
| 1413 | +function esdportal_api_query_has_esd_el_2014_alter(\QueryAlterableInterface & $query) { |
|
| 1414 | 1414 | // Join with field_data_field_esd_ec_id to get program_id. |
| 1415 | 1415 | if (!$query->hasTag('has_esd_ec_id')) { |
| 1416 | 1416 | esdportal_api_query_has_esd_ec_id_alter($query); |
@@ -1425,7 +1425,7 @@ discard block |
||
| 1425 | 1425 | * |
| 1426 | 1426 | * Only return early childhood centers with a record in esd_el_2015. |
| 1427 | 1427 | */ |
| 1428 | -function esdportal_api_query_has_esd_el_2015_alter(\QueryAlterableInterface &$query) { |
|
| 1428 | +function esdportal_api_query_has_esd_el_2015_alter(\QueryAlterableInterface & $query) { |
|
| 1429 | 1429 | // Join with field_data_field_esd_ec_id to get program_id. |
| 1430 | 1430 | if (!$query->hasTag('has_esd_ec_id')) { |
| 1431 | 1431 | esdportal_api_query_has_esd_ec_id_alter($query); |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | * |
| 1441 | 1441 | * Only return early childhood centers with an ec_id. |
| 1442 | 1442 | */ |
| 1443 | -function esdportal_api_query_has_esd_ec_id_alter(\QueryAlterableInterface &$query) { |
|
| 1443 | +function esdportal_api_query_has_esd_ec_id_alter(\QueryAlterableInterface & $query) { |
|
| 1444 | 1444 | $query->join('field_data_field_esd_ec_id', 'ec_id', 'ec_id.entity_id=taxonomy_term_data.tid'); |
| 1445 | 1445 | } |
| 1446 | 1446 | |
@@ -1449,7 +1449,7 @@ discard block |
||
| 1449 | 1449 | * |
| 1450 | 1450 | * Only return early childhood centers with a record in ec_state_ratings. |
| 1451 | 1451 | */ |
| 1452 | -function esdportal_api_query_has_ec_state_rating_alter(\QueryAlterableInterface &$query) { |
|
| 1452 | +function esdportal_api_query_has_ec_state_rating_alter(\QueryAlterableInterface & $query) { |
|
| 1453 | 1453 | // Join with field_data_field_esd_ec_id to get program_id. |
| 1454 | 1454 | if (!$query->hasTag('has_esd_ec_id')) { |
| 1455 | 1455 | esdportal_api_query_has_esd_ec_id_alter($query); |
@@ -1465,7 +1465,7 @@ discard block |
||
| 1465 | 1465 | * @param \QueryAlterableInterface &$query |
| 1466 | 1466 | * A query, probably looking for ec taxonomy terms. |
| 1467 | 1467 | */ |
| 1468 | -function esdportal_api_query_has_ec_profile_alter(\QueryAlterableInterface &$query) { |
|
| 1468 | +function esdportal_api_query_has_ec_profile_alter(\QueryAlterableInterface & $query) { |
|
| 1469 | 1469 | $query->join('field_data_field_ec', 'ec_profile_ref', 'ec_profile_ref.field_ec_tid=taxonomy_term_data.tid'); |
| 1470 | 1470 | $query->condition('ec_profile_ref.bundle', 'ec_profile', '='); |
| 1471 | 1471 | } |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | * @param \QueryAlterableInterface &$query |
| 1479 | 1479 | * A query. |
| 1480 | 1480 | */ |
| 1481 | -function _esdportal_api_add_ec_ti_join(\QueryAlterableInterface &$query) { |
|
| 1481 | +function _esdportal_api_add_ec_ti_join(\QueryAlterableInterface & $query) { |
|
| 1482 | 1482 | $query->join('taxonomy_index', 'ti', 'ti.nid=ec_profile_ref.entity_id'); |
| 1483 | 1483 | $query->groupBy('ti.nid'); |
| 1484 | 1484 | } |
@@ -1491,7 +1491,7 @@ discard block |
||
| 1491 | 1491 | * @param \QueryAlterableInterface &$query |
| 1492 | 1492 | * A query. |
| 1493 | 1493 | */ |
| 1494 | -function esdportal_api_query_join_special_ed_level_alter(\QueryAlterableInterface &$query) { |
|
| 1494 | +function esdportal_api_query_join_special_ed_level_alter(\QueryAlterableInterface & $query) { |
|
| 1495 | 1495 | // First, inner join with school_profiles. |
| 1496 | 1496 | if (!$query->hasTag('has_school_profile')) { |
| 1497 | 1497 | esdportal_api_query_has_school_profile_alter($query); |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | * @param \QueryAlterableInterface &$query |
| 1510 | 1510 | * A query. |
| 1511 | 1511 | */ |
| 1512 | -function esdportal_api_query_join_special_ed_programs_alter(\QueryAlterableInterface &$query) { |
|
| 1512 | +function esdportal_api_query_join_special_ed_programs_alter(\QueryAlterableInterface & $query) { |
|
| 1513 | 1513 | // First, inner join with school_profiles. |
| 1514 | 1514 | if (!$query->hasTag('has_school_profile')) { |
| 1515 | 1515 | esdportal_api_query_has_school_profile_alter($query); |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | * |
| 1525 | 1525 | * IF school_profile.field_special_ed_level = moderate OR intensive. |
| 1526 | 1526 | */ |
| 1527 | -function esdportal_api_query_school_profile_has_specialed_alter(\QueryAlterableInterface &$query) { |
|
| 1527 | +function esdportal_api_query_school_profile_has_specialed_alter(\QueryAlterableInterface & $query) { |
|
| 1528 | 1528 | // First, inner join with field_data_field_special_ed. |
| 1529 | 1529 | if (!$query->hasTag('join_special_ed_level')) { |
| 1530 | 1530 | esdportal_api_query_join_special_ed_level_alter($query); |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | * OR IF schools.field_academic_focus = all_arts OR visual_arts OR |
| 1545 | 1545 | * performing_arts OR music. |
| 1546 | 1546 | */ |
| 1547 | -function esdportal_api_query_school_profile_has_arts_alter(\QueryAlterableInterface &$query) { |
|
| 1547 | +function esdportal_api_query_school_profile_has_arts_alter(\QueryAlterableInterface & $query) { |
|
| 1548 | 1548 | // First, inner join with school_profiles. |
| 1549 | 1549 | if (!$query->hasTag('has_school_profile')) { |
| 1550 | 1550 | esdportal_api_query_has_school_profile_alter($query); |
@@ -1594,7 +1594,7 @@ discard block |
||
| 1594 | 1594 | * IF school_profile.field_boys_sports CONTAINS 4 or more values/items |
| 1595 | 1595 | * AND IF schools.field_girls_sports CONTAINS 4 or more values/items. |
| 1596 | 1596 | */ |
| 1597 | -function esdportal_api_query_school_profile_has_sports_alter(\QueryAlterableInterface &$query) { |
|
| 1597 | +function esdportal_api_query_school_profile_has_sports_alter(\QueryAlterableInterface & $query) { |
|
| 1598 | 1598 | // First, inner join with school_profiles. |
| 1599 | 1599 | if (!$query->hasTag('has_school_profile')) { |
| 1600 | 1600 | esdportal_api_query_has_school_profile_alter($query); |
@@ -1626,7 +1626,7 @@ discard block |
||
| 1626 | 1626 | * IF school_profile.field_transportation_options = passes OR busses OR |
| 1627 | 1627 | * shared_bus. |
| 1628 | 1628 | */ |
| 1629 | -function esdportal_api_query_school_profile_has_transportation_alter(\QueryAlterableInterface &$query) { |
|
| 1629 | +function esdportal_api_query_school_profile_has_transportation_alter(\QueryAlterableInterface & $query) { |
|
| 1630 | 1630 | // First, inner join with school_profiles. |
| 1631 | 1631 | if (!$query->hasTag('has_school_profile')) { |
| 1632 | 1632 | esdportal_api_query_has_school_profile_alter($query); |
@@ -1641,7 +1641,7 @@ discard block |
||
| 1641 | 1641 | * |
| 1642 | 1642 | * IF school_profile.field_before_after_care = after OR before. |
| 1643 | 1643 | */ |
| 1644 | -function esdportal_api_query_school_profile_has_before_after_care_alter(\QueryAlterableInterface &$query) { |
|
| 1644 | +function esdportal_api_query_school_profile_has_before_after_care_alter(\QueryAlterableInterface & $query) { |
|
| 1645 | 1645 | // First, inner join with school_profiles. |
| 1646 | 1646 | if (!$query->hasTag('has_school_profile')) { |
| 1647 | 1647 | esdportal_api_query_has_school_profile_alter($query); |
@@ -1656,7 +1656,7 @@ discard block |
||
| 1656 | 1656 | * |
| 1657 | 1657 | * IF school_profile.field_application_process = yes. |
| 1658 | 1658 | */ |
| 1659 | -function esdportal_api_query_school_profile_application_required_alter(\QueryAlterableInterface &$query) { |
|
| 1659 | +function esdportal_api_query_school_profile_application_required_alter(\QueryAlterableInterface & $query) { |
|
| 1660 | 1660 | // First, inner join with school_profiles. |
| 1661 | 1661 | if (!$query->hasTag('has_school_profile')) { |
| 1662 | 1662 | esdportal_api_query_has_school_profile_alter($query); |
@@ -1674,7 +1674,7 @@ discard block |
||
| 1674 | 1674 | * OR IF school_profile.field_staff_resources = college_counselor |
| 1675 | 1675 | * AND IF school_profile.field_college_prep CONTAINS any value EXCEPT none. |
| 1676 | 1676 | */ |
| 1677 | -function esdportal_api_query_school_profile_collegereadiness_alter(\QueryAlterableInterface &$query) { |
|
| 1677 | +function esdportal_api_query_school_profile_collegereadiness_alter(\QueryAlterableInterface & $query) { |
|
| 1678 | 1678 | // First, inner join with school_profiles. |
| 1679 | 1679 | if (!$query->hasTag('has_school_profile')) { |
| 1680 | 1680 | esdportal_api_query_has_school_profile_alter($query); |
@@ -1693,7 +1693,7 @@ discard block |
||
| 1693 | 1693 | * @param \QueryAlterableInterface &$query |
| 1694 | 1694 | * A query, probably looking for school taxonomy terms. |
| 1695 | 1695 | */ |
| 1696 | -function esdportal_api_query_has_school_profile_alter(\QueryAlterableInterface &$query) { |
|
| 1696 | +function esdportal_api_query_has_school_profile_alter(\QueryAlterableInterface & $query) { |
|
| 1697 | 1697 | $query->join('field_data_field_school', 'school_profile_ref', 'school_profile_ref.field_school_tid=taxonomy_term_data.tid'); |
| 1698 | 1698 | $query->condition('school_profile_ref.bundle', 'school_profile', '='); |
| 1699 | 1699 | $query->addField('school_profile_ref', 'entity_id', 'school_profile_id'); |
@@ -1705,7 +1705,7 @@ discard block |
||
| 1705 | 1705 | * @param \QueryAlterableInterface &$query |
| 1706 | 1706 | * A query, probably looking for school taxonomy terms. |
| 1707 | 1707 | */ |
| 1708 | -function esdportal_api_query_ec_profile_changed_asc_alter(\QueryAlterableInterface &$query) { |
|
| 1708 | +function esdportal_api_query_ec_profile_changed_asc_alter(\QueryAlterableInterface & $query) { |
|
| 1709 | 1709 | if (!$query->hasTag('has_ec_profile')) { |
| 1710 | 1710 | esdportal_api_query_has_ec_profile_alter($query); |
| 1711 | 1711 | $query->addTag('has_ec_profile'); |
@@ -1714,7 +1714,7 @@ discard block |
||
| 1714 | 1714 | $query->join('node', 'n', 'ec_profile_ref.entity_id=n.nid'); |
| 1715 | 1715 | |
| 1716 | 1716 | // Our orderBy comes first! |
| 1717 | - $order =& $query->getOrderBy(); |
|
| 1717 | + $order = & $query->getOrderBy(); |
|
| 1718 | 1718 | $order = array_reverse($order, TRUE); |
| 1719 | 1719 | $order['n.changed'] = 'ASC'; |
| 1720 | 1720 | $order = array_reverse($order, TRUE); |
@@ -1726,7 +1726,7 @@ discard block |
||
| 1726 | 1726 | * @param \QueryAlterableInterface &$query |
| 1727 | 1727 | * A query, probably looking for school taxonomy terms. |
| 1728 | 1728 | */ |
| 1729 | -function esdportal_api_query_ec_profile_changed_desc_alter(\QueryAlterableInterface &$query) { |
|
| 1729 | +function esdportal_api_query_ec_profile_changed_desc_alter(\QueryAlterableInterface & $query) { |
|
| 1730 | 1730 | if (!$query->hasTag('has_ec_profile')) { |
| 1731 | 1731 | esdportal_api_query_has_ec_profile_alter($query); |
| 1732 | 1732 | $query->addTag('has_ec_profile'); |
@@ -1735,7 +1735,7 @@ discard block |
||
| 1735 | 1735 | $query->join('node', 'n', 'ec_profile_ref.entity_id=n.nid'); |
| 1736 | 1736 | |
| 1737 | 1737 | // Our orderBy comes first! |
| 1738 | - $order =& $query->getOrderBy(); |
|
| 1738 | + $order = & $query->getOrderBy(); |
|
| 1739 | 1739 | $order = array_reverse($order, TRUE); |
| 1740 | 1740 | $order['n.changed'] = 'DESC'; |
| 1741 | 1741 | $order = array_reverse($order, TRUE); |
@@ -1747,7 +1747,7 @@ discard block |
||
| 1747 | 1747 | * @param \QueryAlterableInterface &$query |
| 1748 | 1748 | * A query, probably looking for school taxonomy terms. |
| 1749 | 1749 | */ |
| 1750 | -function esdportal_api_query_school_profile_changed_asc_alter(\QueryAlterableInterface &$query) { |
|
| 1750 | +function esdportal_api_query_school_profile_changed_asc_alter(\QueryAlterableInterface & $query) { |
|
| 1751 | 1751 | if (!$query->hasTag('has_school_profile')) { |
| 1752 | 1752 | esdportal_api_query_has_school_profile_alter($query); |
| 1753 | 1753 | $query->addTag('has_school_profile'); |
@@ -1756,7 +1756,7 @@ discard block |
||
| 1756 | 1756 | $query->join('node', 'n', 'school_profile_ref.entity_id=n.nid'); |
| 1757 | 1757 | |
| 1758 | 1758 | // Our orderBy comes first! |
| 1759 | - $order =& $query->getOrderBy(); |
|
| 1759 | + $order = & $query->getOrderBy(); |
|
| 1760 | 1760 | $order = array_reverse($order, TRUE); |
| 1761 | 1761 | $order['n.changed'] = 'ASC'; |
| 1762 | 1762 | $order = array_reverse($order, TRUE); |
@@ -1768,7 +1768,7 @@ discard block |
||
| 1768 | 1768 | * @param \QueryAlterableInterface &$query |
| 1769 | 1769 | * A query, probably looking for school taxonomy terms. |
| 1770 | 1770 | */ |
| 1771 | -function esdportal_api_query_school_profile_changed_desc_alter(\QueryAlterableInterface &$query) { |
|
| 1771 | +function esdportal_api_query_school_profile_changed_desc_alter(\QueryAlterableInterface & $query) { |
|
| 1772 | 1772 | if (!$query->hasTag('has_school_profile')) { |
| 1773 | 1773 | esdportal_api_query_has_school_profile_alter($query); |
| 1774 | 1774 | $query->addTag('has_school_profile'); |
@@ -1777,7 +1777,7 @@ discard block |
||
| 1777 | 1777 | $query->join('node', 'n', 'school_profile_ref.entity_id=n.nid'); |
| 1778 | 1778 | |
| 1779 | 1779 | // Our orderBy comes first! |
| 1780 | - $order =& $query->getOrderBy(); |
|
| 1780 | + $order = & $query->getOrderBy(); |
|
| 1781 | 1781 | $order = array_reverse($order, TRUE); |
| 1782 | 1782 | $order['n.changed'] = 'DESC'; |
| 1783 | 1783 | $order = array_reverse($order, TRUE); |
@@ -1789,7 +1789,7 @@ discard block |
||
| 1789 | 1789 | * @param \QueryAlterableInterface &$query |
| 1790 | 1790 | * A query, probably looking for school taxonomy terms. |
| 1791 | 1791 | */ |
| 1792 | -function esdportal_api_query_ec_total_pts_desc_alter(\QueryAlterableInterface &$query) { |
|
| 1792 | +function esdportal_api_query_ec_total_pts_desc_alter(\QueryAlterableInterface & $query) { |
|
| 1793 | 1793 | // Add tag (which also adds needed joins) |
| 1794 | 1794 | if (!$query->hasTag('has_ec_state_rating')) { |
| 1795 | 1795 | esdportal_api_query_has_ec_state_rating_alter($query); |
@@ -1797,7 +1797,7 @@ discard block |
||
| 1797 | 1797 | } |
| 1798 | 1798 | |
| 1799 | 1799 | // Our orderBy comes first. |
| 1800 | - $order =& $query->getOrderBy(); |
|
| 1800 | + $order = & $query->getOrderBy(); |
|
| 1801 | 1801 | $order = array_reverse($order, TRUE); |
| 1802 | 1802 | $order['esr.total_points'] = 'DESC'; |
| 1803 | 1803 | $order = array_reverse($order, TRUE); |
@@ -1809,7 +1809,7 @@ discard block |
||
| 1809 | 1809 | * @param \QueryAlterableInterface &$query |
| 1810 | 1810 | * A query, probably looking for school taxonomy terms. |
| 1811 | 1811 | */ |
| 1812 | -function esdportal_api_query_ec_total_pts_asc_alter(\QueryAlterableInterface &$query) { |
|
| 1812 | +function esdportal_api_query_ec_total_pts_asc_alter(\QueryAlterableInterface & $query) { |
|
| 1813 | 1813 | // Add tag (which also adds needed joins) |
| 1814 | 1814 | if (!$query->hasTag('has_ec_state_rating')) { |
| 1815 | 1815 | esdportal_api_query_has_ec_state_rating_alter($query); |
@@ -1817,7 +1817,7 @@ discard block |
||
| 1817 | 1817 | } |
| 1818 | 1818 | |
| 1819 | 1819 | // Our orderBy comes first. |
| 1820 | - $order =& $query->getOrderBy(); |
|
| 1820 | + $order = & $query->getOrderBy(); |
|
| 1821 | 1821 | $order = array_reverse($order, TRUE); |
| 1822 | 1822 | $order['esr.total_points'] = 'ASC'; |
| 1823 | 1823 | $order = array_reverse($order, TRUE); |
@@ -1829,7 +1829,7 @@ discard block |
||
| 1829 | 1829 | * @param \QueryAlterableInterface &$query |
| 1830 | 1830 | * A query, probably looking for school taxonomy terms. |
| 1831 | 1831 | */ |
| 1832 | -function esdportal_api_query_has_bcode_alter(\QueryAlterableInterface &$query) { |
|
| 1832 | +function esdportal_api_query_has_bcode_alter(\QueryAlterableInterface & $query) { |
|
| 1833 | 1833 | $query->join('field_data_field_bcode', 'field_bcode', "field_bcode.entity_id=taxonomy_term_data.tid AND field_bcode.bundle='schools'"); |
| 1834 | 1834 | } |
| 1835 | 1835 | |
@@ -1839,7 +1839,7 @@ discard block |
||
| 1839 | 1839 | * @param \QueryAlterableInterface &$query |
| 1840 | 1840 | * A query, probably looking for school taxonomy terms. |
| 1841 | 1841 | */ |
| 1842 | -function esdportal_api_query_esd_k8hs_2015_highscore_alter(\QueryAlterableInterface &$query) { |
|
| 1842 | +function esdportal_api_query_esd_k8hs_2015_highscore_alter(\QueryAlterableInterface & $query) { |
|
| 1843 | 1843 | // Add bcode join. |
| 1844 | 1844 | if (!$query->hasTag('has_bcode')) { |
| 1845 | 1845 | esdportal_api_query_has_bcode_alter($query); |
@@ -1868,7 +1868,7 @@ discard block |
||
| 1868 | 1868 | * @param \QueryAlterableInterface &$query |
| 1869 | 1869 | * A query, probably looking for early childhood taxonomy terms. |
| 1870 | 1870 | */ |
| 1871 | -function esdportal_api_query_esd_el_highscore_alter(\QueryAlterableInterface &$query) { |
|
| 1871 | +function esdportal_api_query_esd_el_highscore_alter(\QueryAlterableInterface & $query) { |
|
| 1872 | 1872 | // Join with ec_state_ratings. |
| 1873 | 1873 | if (!$query->hasTag('has_ec_state_rating')) { |
| 1874 | 1874 | esdportal_api_query_has_ec_state_rating_alter($query); |
@@ -1884,7 +1884,7 @@ discard block |
||
| 1884 | 1884 | * @param \QueryAlterableInterface &$query |
| 1885 | 1885 | * A query, probably looking for school taxonomy terms. |
| 1886 | 1886 | */ |
| 1887 | -function esdportal_api_query_school_combined_total_pts_desc_alter(\QueryAlterableInterface &$query) { |
|
| 1887 | +function esdportal_api_query_school_combined_total_pts_desc_alter(\QueryAlterableInterface & $query) { |
|
| 1888 | 1888 | // Add bcode join. |
| 1889 | 1889 | if (!$query->hasTag('has_bcode')) { |
| 1890 | 1890 | esdportal_api_query_has_bcode_alter($query); |
@@ -1906,7 +1906,7 @@ discard block |
||
| 1906 | 1906 | $query->join($k8_scores, 'scores', 'score_bcode=field_bcode.field_bcode_value'); |
| 1907 | 1907 | |
| 1908 | 1908 | // Our orderBy comes first. |
| 1909 | - $order =& $query->getOrderBy(); |
|
| 1909 | + $order = & $query->getOrderBy(); |
|
| 1910 | 1910 | $order = array_reverse($order, TRUE); |
| 1911 | 1911 | $order['scores.score'] = 'DESC'; |
| 1912 | 1912 | $order = array_reverse($order, TRUE); |
@@ -1918,7 +1918,7 @@ discard block |
||
| 1918 | 1918 | * @param \QueryAlterableInterface &$query |
| 1919 | 1919 | * A query, probably looking for school taxonomy terms. |
| 1920 | 1920 | */ |
| 1921 | -function esdportal_api_query_school_combined_total_pts_asc_alter(\QueryAlterableInterface &$query) { |
|
| 1921 | +function esdportal_api_query_school_combined_total_pts_asc_alter(\QueryAlterableInterface & $query) { |
|
| 1922 | 1922 | // Add bcode join. |
| 1923 | 1923 | if (!$query->hasTag('has_bcode')) { |
| 1924 | 1924 | esdportal_api_query_has_bcode_alter($query); |
@@ -1940,7 +1940,7 @@ discard block |
||
| 1940 | 1940 | $query->join($k8_scores, 'scores', 'score_bcode=field_bcode.field_bcode_value'); |
| 1941 | 1941 | |
| 1942 | 1942 | // Our orderBy comes first. |
| 1943 | - $order =& $query->getOrderBy(); |
|
| 1943 | + $order = & $query->getOrderBy(); |
|
| 1944 | 1944 | $order = array_reverse($order, TRUE); |
| 1945 | 1945 | $order['scores.score'] = 'ASC'; |
| 1946 | 1946 | $order = array_reverse($order, TRUE); |
@@ -1952,7 +1952,7 @@ discard block |
||
| 1952 | 1952 | * @param \QueryAlterableInterface &$query |
| 1953 | 1953 | * A query, probably looking for school or EC taxonomy terms. |
| 1954 | 1954 | */ |
| 1955 | -function esdportal_api_query_has_geo_alter(\QueryAlterableInterface &$query) { |
|
| 1955 | +function esdportal_api_query_has_geo_alter(\QueryAlterableInterface & $query) { |
|
| 1956 | 1956 | $query->join('field_data_field_geo', 'field_geo', 'field_geo.entity_id=taxonomy_term_data.tid'); |
| 1957 | 1957 | } |
| 1958 | 1958 | |
@@ -1967,7 +1967,7 @@ discard block |
||
| 1967 | 1967 | * @param \QueryAlterableInterface &$query |
| 1968 | 1968 | * A query, probably looking for school or EC taxonomy terms. |
| 1969 | 1969 | */ |
| 1970 | -function esdportal_api_query_geoproximity_alter(\QueryAlterableInterface &$query) { |
|
| 1970 | +function esdportal_api_query_geoproximity_alter(\QueryAlterableInterface & $query) { |
|
| 1971 | 1971 | // Add geo join. |
| 1972 | 1972 | if (!$query->hasTag('has_geo')) { |
| 1973 | 1973 | esdportal_api_query_has_geo_alter($query); |
@@ -2016,7 +2016,7 @@ discard block |
||
| 2016 | 2016 | /** |
| 2017 | 2017 | * Adds a field_special_ed_level filter. |
| 2018 | 2018 | */ |
| 2019 | -function esdportal_api_query_field_special_ed_level_filter_alter(\QueryAlterableInterface &$query) { |
|
| 2019 | +function esdportal_api_query_field_special_ed_level_filter_alter(\QueryAlterableInterface & $query) { |
|
| 2020 | 2020 | // Get parameters from query metadata. |
| 2021 | 2021 | $levels = $query->getMetaData('field_special_ed_level_filter'); |
| 2022 | 2022 | |
@@ -2036,7 +2036,7 @@ discard block |
||
| 2036 | 2036 | /** |
| 2037 | 2037 | * Adds a field_special_ed_programs filter. |
| 2038 | 2038 | */ |
| 2039 | -function esdportal_api_query_field_special_ed_programs_filter_alter(\QueryAlterableInterface &$query) { |
|
| 2039 | +function esdportal_api_query_field_special_ed_programs_filter_alter(\QueryAlterableInterface & $query) { |
|
| 2040 | 2040 | // Get parameters from query metadata. |
| 2041 | 2041 | $programs = $query->getMetaData('field_special_ed_programs_filter'); |
| 2042 | 2042 | |
@@ -583,8 +583,7 @@ discard block |
||
| 583 | 583 | function _esdportal_api_retrieve_ec_state_rating($esd_ec_id, $batch_timestamp = NULL) { |
| 584 | 584 | if (isset($batch_timestamp) && $batch_timestamp > 0) { |
| 585 | 585 | $rating = db_query('SELECT * FROM {ec_state_ratings} WHERE timestamp=:batch_timestamp AND esd_ec_id=:esd_ec_id', array(':esd_ec_id' => $esd_ec_id, ':batch_timestamp' => $batch_timestamp))->fetchAssoc(); |
| 586 | - } |
|
| 587 | - else { |
|
| 586 | + } else { |
|
| 588 | 587 | $rating = db_query('SELECT * FROM {ec_state_ratings} WHERE timestamp=(SELECT MAX(timestamp) FROM {ec_state_ratings}) AND esd_ec_id=:esd_ec_id', array(':esd_ec_id' => $esd_ec_id))->fetchAssoc(); |
| 589 | 588 | } |
| 590 | 589 | return $rating; |
@@ -615,8 +614,7 @@ discard block |
||
| 615 | 614 | function _esdportal_api_index_ec_state_ratings($batch_timestamp = NULL) { |
| 616 | 615 | if (isset($batch_timestamp) && $batch_timestamp > 0) { |
| 617 | 616 | $ratings = db_query('SELECT * FROM {ec_state_ratings} WHERE timestamp=:batch_timestamp', array(':batch_timestamp' => $batch_timestamp))->fetchAssoc(); |
| 618 | - } |
|
| 619 | - else { |
|
| 617 | + } else { |
|
| 620 | 618 | $ratings = db_query('SELECT * FROM {ec_state_ratings} WHERE timestamp=(SELECT MAX(timestamp) FROM {ec_state_ratings})')->fetchAll(); |
| 621 | 619 | } |
| 622 | 620 | |
@@ -794,16 +792,14 @@ discard block |
||
| 794 | 792 | // Some schools don't have BCODEs. |
| 795 | 793 | if (!isset($school->field_bcode[LANGUAGE_NONE])) { |
| 796 | 794 | $school->bcode = NULL; |
| 797 | - } |
|
| 798 | - else { |
|
| 795 | + } else { |
|
| 799 | 796 | $school->bcode = $school->field_bcode[LANGUAGE_NONE][0]['value']; |
| 800 | 797 | } |
| 801 | 798 | |
| 802 | 799 | // Some schools don't have ESD internal school IDs. |
| 803 | 800 | if (!isset($school->field_esd_schid[LANGUAGE_NONE])) { |
| 804 | 801 | $school->esd_schid = NULL; |
| 805 | - } |
|
| 806 | - else { |
|
| 802 | + } else { |
|
| 807 | 803 | $school->esd_schid = $school->field_esd_schid[LANGUAGE_NONE][0]['value']; |
| 808 | 804 | } |
| 809 | 805 | |
@@ -843,13 +839,11 @@ discard block |
||
| 843 | 839 | |
| 844 | 840 | try { |
| 845 | 841 | $res = $q->execute(); |
| 846 | - } |
|
| 847 | - catch (Exception $e) { |
|
| 842 | + } catch (Exception $e) { |
|
| 848 | 843 | // No table? |
| 849 | 844 | if ($e->getCode() == '42') { |
| 850 | 845 | // Do nothing for now... |
| 851 | - } |
|
| 852 | - else { |
|
| 846 | + } else { |
|
| 853 | 847 | watchdog_exception('_esdportal_api_load_includes_for_schools', $e); |
| 854 | 848 | } |
| 855 | 849 | } |
@@ -877,13 +871,11 @@ discard block |
||
| 877 | 871 | |
| 878 | 872 | try { |
| 879 | 873 | $res = $q->execute(); |
| 880 | - } |
|
| 881 | - catch (Exception $e) { |
|
| 874 | + } catch (Exception $e) { |
|
| 882 | 875 | // No table? |
| 883 | 876 | if ($e->getCode() == '42') { |
| 884 | 877 | // Do nothing for now... |
| 885 | - } |
|
| 886 | - else { |
|
| 878 | + } else { |
|
| 887 | 879 | watchdog_exception('_esdportal_api_load_includes_for_schools', $e); |
| 888 | 880 | } |
| 889 | 881 | } |
@@ -919,8 +911,7 @@ discard block |
||
| 919 | 911 | // Some ecs don't have program_ids. |
| 920 | 912 | if (!isset($ec->field_esd_ec_id[LANGUAGE_NONE])) { |
| 921 | 913 | $ec->program_id = NULL; |
| 922 | - } |
|
| 923 | - else { |
|
| 914 | + } else { |
|
| 924 | 915 | $ec->program_id = $ec->field_esd_ec_id[LANGUAGE_NONE][0]['value']; |
| 925 | 916 | } |
| 926 | 917 | |
@@ -966,13 +957,11 @@ discard block |
||
| 966 | 957 | |
| 967 | 958 | try { |
| 968 | 959 | $res = $q->execute(); |
| 969 | - } |
|
| 970 | - catch (Exception $e) { |
|
| 960 | + } catch (Exception $e) { |
|
| 971 | 961 | // No table? |
| 972 | 962 | if ($e->getCode() == '42') { |
| 973 | 963 | // Do nothing for now... |
| 974 | - } |
|
| 975 | - else { |
|
| 964 | + } else { |
|
| 976 | 965 | watchdog_exception('_esdportal_api_load_includes_for_schools', $e); |
| 977 | 966 | } |
| 978 | 967 | } |
@@ -1136,16 +1125,14 @@ discard block |
||
| 1136 | 1125 | // Execute the query and load the terms it returns, if any. |
| 1137 | 1126 | try { |
| 1138 | 1127 | $result = $query->execute(); |
| 1139 | - } |
|
| 1140 | - catch (Exception $e) { |
|
| 1128 | + } catch (Exception $e) { |
|
| 1141 | 1129 | return services_error(t('request error'), 400); |
| 1142 | 1130 | } |
| 1143 | 1131 | |
| 1144 | 1132 | if (!empty($result['taxonomy_term'])) { |
| 1145 | 1133 | $tids = array_keys($result['taxonomy_term']); |
| 1146 | 1134 | $terms = taxonomy_term_load_multiple($tids); |
| 1147 | - } |
|
| 1148 | - else { |
|
| 1135 | + } else { |
|
| 1149 | 1136 | // Empty set. |
| 1150 | 1137 | $terms = []; |
| 1151 | 1138 | } |
@@ -1240,14 +1227,12 @@ discard block |
||
| 1240 | 1227 | if (!empty($args[$key])) { |
| 1241 | 1228 | if (is_string($args[$key])) { |
| 1242 | 1229 | $args[$key] = explode($value['commerce_services_explode'], $args[$key]); |
| 1243 | - } |
|
| 1244 | - elseif (is_array($args[$key])) { |
|
| 1230 | + } elseif (is_array($args[$key])) { |
|
| 1245 | 1231 | foreach ($args[$key] as &$param) { |
| 1246 | 1232 | $param = explode($value['commerce_services_explode'], $param); |
| 1247 | 1233 | } |
| 1248 | 1234 | } |
| 1249 | - } |
|
| 1250 | - else { |
|
| 1235 | + } else { |
|
| 1251 | 1236 | // Otherwise ensure it is just converted to an array. |
| 1252 | 1237 | $args[$key] = array(); |
| 1253 | 1238 | } |
@@ -1278,8 +1263,7 @@ discard block |
||
| 1278 | 1263 | // add it to the argument's value array now. |
| 1279 | 1264 | if (in_array($param_key, array_keys(\Drupal\esdportal_api\EcDataUtils::entityTypeProperties($value['commerce_services_field_populate'])), TRUE)) { |
| 1280 | 1265 | $args[$key][$param_key] = $param_value; |
| 1281 | - } |
|
| 1282 | - else { |
|
| 1266 | + } else { |
|
| 1283 | 1267 | // Otherwise look and see if the parameter key begins with a field |
| 1284 | 1268 | // name, assuming it must be either a field name or field column name. |
| 1285 | 1269 | foreach (array_keys(\Drupal\esdportal_api\EcDataUtils::entityTypeFields($value['commerce_services_field_populate'])) as $field_name) { |
@@ -1291,8 +1275,7 @@ discard block |
||
| 1291 | 1275 | if ($field_name == $param_key && count($field_info['columns']) == 1) { |
| 1292 | 1276 | $args[$key][$param_key] = $param_value; |
| 1293 | 1277 | break; |
| 1294 | - } |
|
| 1295 | - else { |
|
| 1278 | + } else { |
|
| 1296 | 1279 | // Otherwise if the parameter key contains a valid column |
| 1297 | 1280 | // specification for the field type, add it to the argument's |
| 1298 | 1281 | // value array as well. |