Cron Jobs and Pseudo-APIs

sessionapi.php

location: theme (mainstreet-advocates/sessionapi.php)

Called in: template_session_add.php; template_session_list.php

Used for the bespoke Session Management UI.

if (isset($_GET['action'])and $_GET['action'] === 'list') 
...
SELECT * FROM session_info;
if (isset($_POST['action'] ) && $_POST['action'] == 'query')
...
SELECT DISTINCT(state) FROM legislation WHERE session = '{$session}' AND state NOT IN (SELECT session_state FROM session_info WHERE session_year = '{$session}');

dashboardapi.php

if($user->solr_active) {
  $end_result = $user->dashboardManagerSolrMain( $type,$category,$priority,$status);
  echo json_encode($end_result);
}else {
  echo json_encode( $user->dashboardManager( $_POST['category'], $_POST['type'], $_POST['state'], $priority ) );
}

Uses the MSAUser class to apply user-settings to queries and makes the request of solr via apply_filters( ' solr_get_dashboard_main', ...).

The msa-wp-solr plugin, class-solr-search.php, defines: add_filter('solr_get_dashboard_main',array($this,'getDashboardMain'),10,6);

Called from template_dashboard.php in javascript, getAjaxData() on load and when dropdowns are changed (in sidebar.)

Uses the Solr-flavored function when class MSAClient:

protected function checkSolr() {
        if ( has_filter( 'solr_get_core' ) ) {
            if ( apply_filters( 'solr_get_core', $this->client_id ) ) {
                $this->solr_active = true;
            }
        }
    }

legapi.php

Primary Data Retrieval Interface. Called in:

  • template_regulation_detailed_view.php:295
  • template_hearing_detailed_view.php:287
  • template_detailed_view.php:510
  • template_legislation_list.php (multiple)
  • manage_bills.php

HTTP POST

  • set Prioritized status
  • set Hidden status
  • Get Type-Ahead Sugestions
    if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) {
    $client_id = null;
    if ( isset( $_POST['client_id'] ) ) {
        $client_id = $_POST['client_id'];
    }
    if ( isset( $_POST['action'] ) && $_POST['action'] === 'priority' ) {
        $user->reindexSolrCore();
        $result = $user->updateBillPriority( $_POST['id'], $_POST['type'], $_POST['status'], $client_id );
        echo json_encode( array( 'status' => ( $result === true ) ? true : false ) );
    }else if (isset($_POST['action']) && $_POST['action'] === 'hide'){
        $result = $user->hideBill($_POST['id'],$_POST['type'],$_POST['status'],$client_id);
        echo json_encode( array( 'status' => ( $result === true ) ? true : false ) );
    } elseif ( isset( $_POST['searchFilter'] ) ) {
        echo json_encode( $user->typeheadSuggestion( $_POST['searchFilter'] ) );
    }
    }

HTTP Get

Retrieve data (bill) queries in Solr and RDBMS flavours (if $user->solr_active).

notes_api.php

Bill Note CRUD.

  • template_regulation_detailed_view.php
  • template_hearing_detailed_view.php
  • template_detailed_view.php
  • manage_bills.php