Пример #1
0
$role = validateRequest($userid, $userval);
if (!$role) {
    failRequest("There was a problem validating your request");
}
switch ($requestType) {
    case "FILTERED":
        if (!authoriseUserRoles($role, ["SUPER_USER", "STAFF"])) {
            failRequest("You are not authorised to complete that request");
        }
        getAllCompletedWorksheetsForGroup($groupid, $staffid, $orderby, $desc);
        break;
    case "ALLWORKSHEETS":
        if (!authoriseUserRoles($role, ["SUPER_USER", "STAFF"])) {
            failRequest("You are not authorised to complete that request");
        }
        getAllWorksheets($orderby, $desc);
    default:
        if (!authoriseUserRoles($role, ["SUPER_USER", "STAFF"])) {
            failRequest("You are not authorised to complete that request");
        }
        getAllWorksheetNames($orderby, $desc);
        break;
}
function getAllWorksheetNames($orderby, $desc)
{
    $query = "SELECT WV.`Version ID` ID, WV.`WName` WName, WV.`VName` VName " . "FROM TWORKSHEETVERSION WV " . "WHERE WV.`Deleted` = 0";
    if (isset($orderby)) {
        $query .= " ORDER BY {$orderby}";
        if (isset($desc) && $desc == "TRUE") {
            $query .= " DESC";
        }
Пример #2
0
<?php

print_r(getAllWorksheets("Globecast.xls"));
function getAllWorksheets($inputFileName)
{
    set_time_limit(0);
    /** Include path **/
    set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');
    /** PHPExcel_IOFactory */
    include 'PHPExcel/IOFactory.php';
    $inputFileType = 'Excel5';
    //	$inputFileType = 'Excel2007';
    //	$inputFileType = 'Excel2003XML';
    //	$inputFileType = 'OOCalc';
    //	$inputFileType = 'Gnumeric';
    //	$inputFileName = 'Globecast.xls';
    //$sheetnames = array('Data Sheet #1','Data Sheet #3');
    $objReader = PHPExcel_IOFactory::createReader($inputFileType);
    //$objReader->setLoadSheetsOnly($sheetnames);
    $objReader->setLoadAllSheets();
    $objPHPExcel = $objReader->load($inputFileName);
    $loadedSheetNames = $objPHPExcel->getSheetNames();
    $result = array();
    foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
        //	echo $sheetIndex,' -> ',$loadedSheetName,'<br />';
        $sheetData = $objPHPExcel->getSheet($sheetIndex)->toArray(null, true, true, true);
        //	print_r($sheetData);
        if (trim($loadedSheetName) == "Worksheet") {
            continue;
        }
        foreach ($sheetData as $key => $value) {