private function getFormattedResults($results) {
    $profileName = $results->getProfileInfo()->getProfileName();
    $output = '<h3>Results for profile: '
        . htmlspecialchars($profileName, ENT_NOQUOTES)
        . '</h3>';

    if (count($results->getRows()) > 0) {
      $table = '<table>';

      // Print headers.
      $table .= '<tr>';

      foreach ($results->getColumnHeaders() as $header) {
        $table .= '<th>' . $header->getName() . '</th>';
      }
      $table .= '</tr>';

      // Print table rows.
      foreach ($results->getRows() as $row) {
        $table .= '<tr>';
          foreach ($row as $cell) {
            $table .= '<td>'
                   . htmlspecialchars($cell, ENT_NOQUOTES)
                   . '</td>';
          }
        $table .= '</tr>';
      }
      $table .= '</table>';

    } else {
      $table = '<p>No results found.</p>';
    }
    return $output . $table;
  }
private function getFormattedResults($results) {
    $profileName = $results->getProfileInfo()->getProfileName();
    $output = '<h3>Results for profile: '
        . htmlspecialchars($profileName, ENT_NOQUOTES)
        . '</h3>';

    if (count($results->getRows()) > 0) {
      $table = '<table>';

      // Print headers.
      $table .= '<tr>';

      foreach ($results->getColumnHeaders() as $header) {
        $table .= '<th>' . $header->getName() . '</th>';
      }
      $table .= '</tr>';

      // Print table rows.
      foreach ($results->getRows() as $row) {
        $table .= '<tr>';
          foreach ($row as $cell) {
            $table .= '<td>'
                   . htmlspecialchars($cell, ENT_NOQUOTES)
                   . '</td>';
          }
        $table .= '</tr>';
      }
      $table .= '</table>';

    } else {
      $table = '<p>No results found.</p>';
    }
    return $output . $table;
  }
private function getFormattedResults ( $ results ) { $ profileName = $ results -> getProfileInfo ( ) -> getProfileName ( ) ; $ output = '<h3>Results for profile: ' . htmlspecialchars ( $ profileName , ENT_NOQUOTES ) . '</h3>' ; if ( count ( $ results -> getRows ( ) ) > 0 ) { $ table = '<table>' ; // Print headers. $ table .= '<tr>' ; foreach ( $ results -> getColumnHeaders ( ) as $ header ) { $ table .= '<th>' . $ header -> getName ( ) . '</th>' ; } $ table .= '</tr>' ; // Print table rows. foreach ( $ results -> getRows ( ) as $ row ) { $ table .= '<tr>' ; foreach ( $ row as $ cell ) { $ table .= '<td>' . htmlspecialchars ( $ cell , ENT_NOQUOTES ) . '</td>' ; } $ table .= '</tr>' ; } $ table .= '</table>' ; } else { $ table = '<p>No results found.</p>' ; } return $ output . $ table ; }
Formats the results from the Core Reporting API into some nice
HTML. The profile name is printed as a header. The results of
the query is printed as a table. Note, all the results from the
API are html escaped to prevent malicious code from running on the
page.
@param GaData $results The Results from the Core Reporting API.
@return string The nicely formatted results.
Formats the results from the Core Reporting API into some nice HTML . The profile name is printed as a header . The results of the query is printed as a table . Note all the results from the API are html escaped to prevent malicious code from running on the page .