Ejemplo n.º 1
0
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
require_once 'SSRSReport.php';
//load config file variables
$settings = parse_ini_file("app.config", 1);
try {
    $ssrs_report = new SSRSReport(new Credentials($settings["UID"], $settings["PASWD"]), $settings["SERVICE_URL"]);
    $controls = null;
    if (key_exists("exportSelect", $_POST)) {
        $executionInfo = $ssrs_report->LoadReport2($_POST["reportName"], NULL);
        $parameters = getReportParameters(true);
        $ssrs_report->SetExecutionParameters2($parameters);
        $render = getRenderType($_POST["exportSelect"]);
        $result_html = $ssrs_report->Render2($render, PageCountModeEnum::$Estimate, $Extension, $MimeType, $Encoding, $Warnings, $StreamIds);
        $saveName = $_POST["exportName"] . getExtension($_POST["exportSelect"]);
        if (!($handle = fopen("./Reports/" . $saveName, 'wb'))) {
            echo "Cannot open file for writing output";
            exit;
        }
        if (fwrite($handle, $result_html) === FALSE) {
            echo "Cannot write to file";
            exit;
        }
        fclose($handle);
        echo "<script type='text/javascript'>alert('Report {$saveName} exported'); window.location = 'GetReports.php';</script>";
    }
Ejemplo n.º 2
0
 if (isset($_REQUEST['rs:Command']) || key_exists("reportName", $_REQUEST) && (key_exists("parameters", $_REQUEST) && $_REQUEST["parameters"] != 'true')) {
     if (isset($_REQUEST['rs:ShowHideToggle'])) {
         $ssrs_report->ToggleItem($_REQUEST['rs:ShowHideToggle']);
     } else {
         if (isset($_REQUEST['rs:Command'])) {
             switch ($_REQUEST['rs:Command']) {
                 case 'Sort':
                     $ssrs_report->Sort2($_REQUEST['rs:SortId'], $_REQUEST['rs:SortDirection'], $_REQUEST['rs:ClearSort'], PageCountModeEnum::$Estimate, $ReportItem, $ExecutionInfo);
                     break;
                 default:
                     echo 'Unknown :' . $_REQUEST['rs:Command'];
                     exit;
             }
         } else {
             $query = $_REQUEST["reportName"];
             $parameters = getReportParameters();
             if (isset($_REQUEST['ps:OrginalUri'])) {
                 $length = strlen($settings["SERVICE_URL"]);
                 $query = substr($_REQUEST['ps:OrginalUri'], $length);
                 $parameters = getReportParametersFromGet();
             }
             $executionInfo = $ssrs_report->LoadReport2($query, NULL);
             //Use these if the SSRS DataSource is configured to use user prompt credentials
             //           $dsCredential = new DataSourceCredentials();
             //           $dsCredential->DataSourceName = $settings["DATA_SOURCE"]; /*AdventureWorks*/
             //           $dsCredential->UserName = $settings["UID"]; /*PHPDemoUser*/
             //           $dsCredential->Password = $settings["PASWD"]; /*Passw0rd!*/
             //           $ssrs_report->SetExecutionCredentials2(array($dsCredential));
             $ssrs_report->SetExecutionParameters2($parameters);
         }
     }