Exemple #1
0
function generateCitations($result, $rowsFound, $query, $queryURL, $showQuery, $showLinks, $rowOffset, $showRows, $previousOffset, $nextOffset, $wrapResults, $nothingChecked, $citeStyle, $citeOrder, $citeType, $orderBy, $headerMsg, $userID, $viewType)
{
    global $contentTypeCharset;
    // these variables are defined in 'ini.inc.php'
    global $defaultCiteStyle;
    global $client;
    global $userOptionsArray;
    // get all user options for the current user:
    // (note that '$userOptionsArray' is made globally available)
    $userOptionsArray = getUserOptions($userID);
    // function 'getUserOptions()' is defined in 'include.inc.php'
    // if the query has results ...
    if ($rowsFound > 0) {
        // Save the current Citation view query to a session variable:
        //			saveSessionVariable("lastCitationViewQuery", $query);
        // fetch the name of the citation style file that's associated with the style given in '$citeStyle':
        $citeStyleFile = getStyleFile($citeStyle);
        // function 'getStyleFile()' is defined in 'include.inc.php'
        if (empty($citeStyleFile)) {
            $citeStyle = $defaultCiteStyle;
            // if the given cite style could not be found, we'll use the default cite style which is defined by the '$defaultCiteStyle' variable in 'ini.inc.php'
            $citeStyleFile = getStyleFile($citeStyle);
        }
        // include the found citation style file *once*:
        include_once "cite/" . $citeStyleFile;
        // fetch the name of the citation format file that's associated with the format given in '$citeType':
        $citeFormatFile = getFormatFile($citeType, "cite");
        // function 'getFormatFile()' is defined in 'include.inc.php()'
        if (empty($citeFormatFile)) {
            if (preg_match("/^cli/i", $client)) {
                // if the query originated from a command line client such as the refbase CLI clients ("cli-refbase-1.1", "cli-refbase_import-1.0")
                $citeType = "ASCII";
            } else {
                $citeType = "html";
            }
            $citeFormatFile = getFormatFile($citeType, "cite");
        }
        // include the found citation format file *once*:
        include_once "cite/" . $citeFormatFile;
        $citationData = citeRecords($result, $rowsFound, $query, $queryURL, $showQuery, $showLinks, $rowOffset, $showRows, $previousOffset, $nextOffset, $wrapResults, $citeStyle, $citeOrder, $citeType, $orderBy, $headerMsg, $userID, $viewType);
        if (preg_match("/^RTF\$/i", $citeType)) {
            $citeContentType = "application/rtf";
            $citeFileName = "citations.rtf";
        } elseif (preg_match("/^PDF\$/i", $citeType)) {
            $citeContentType = "application/pdf";
            $citeFileName = "citations.pdf";
        } elseif (preg_match("/^LaTeX\$/i", $citeType)) {
            $citeContentType = "application/x-latex";
            $citeFileName = "citations.tex";
        } elseif (preg_match("/^LaTeX \\.bbl\$/i", $citeType)) {
            $citeContentType = "application/x-latex";
            $citeFileName = "citations.bbl";
        } elseif (preg_match("/^Markdown\$/i", $citeType)) {
            $citeContentType = "text/plain";
            $citeFileName = "citations.txt";
        } elseif (preg_match("/^ASCII\$/i", $citeType)) {
            $citeContentType = "text/plain";
            $citeFileName = "citations.txt";
        } else {
            $citeContentType = "text/html";
            $citeFileName = "citations.html";
        }
        if (!preg_match("/^html\$/i", $citeType)) {
            // set the appropriate mimetype & set the character encoding to the one given in '$contentTypeCharset' (which is defined in 'ini.inc.php'):
            setHeaderContentType($citeContentType, $contentTypeCharset);
        }
        // function 'setHeaderContentType()' is defined in 'include.inc.php'
        if (preg_match("/^application/i", $citeContentType)) {
            // instruct the browser to download the resulting output as file:
            header('Content-Disposition: attachment; filename="' . $citeFileName . '"');
        }
        // Note that this doesn't seem to work with all browsers (notably not with Safari & OmniWeb on MacOSX Panther, but it does work with Mozilla & Camino as well as Safari on Tiger)
        echo $citationData;
    } else {
        $nothingFoundFeedback = nothingFound($nothingChecked);
        echo $nothingFoundFeedback;
    }
}
Exemple #2
0
    $query = "SELECT checklist.checklistId, checklist.title, checklist.description,\n\t\t\t\tchecklist.categoryId, categories.category \n\t\t\t\tFROM checklist, categories \n\t\t\t\tWHERE checklist.categoryId=categories.categoryId \n\t\t\t\tORDER BY categories.category ASC";
    $result = mysql_query($query) or die("Error in query");
} else {
    $query = "SELECT checklist.checklistId, checklist.title, checklist.description,\n\t\t\t\tchecklist.categoryId, categories.category \n\t\t\t\tFROM checklist, categories \n\t\t\t\tWHERE checklist.categoryId=categories.categoryId AND checklist.categoryId='{$categoryId}' \n\t\t\t\tORDER BY categories.category ASC";
    $result = mysql_query($query) or die("Error in query");
}
if (mysql_num_rows($result) > 0) {
    echo "<p>Select checklist for report.</p>\n";
    echo "<table class='datatable'>\n";
    echo "\t<thead>\n";
    echo "\t\t<td>Category</td>\n";
    echo "\t\t<td>Title</td>\n";
    echo "\t\t<td>Description</td>\n";
    echo "\t</thead>\n";
    while ($row = mysql_fetch_row($result)) {
        echo "\t<tr>\n";
        echo "\t\t<td>" . stripslashes($row[4]) . "</td>\n";
        echo '		<td><a href="checklistReport.php?checklistId=' . $row[0] . '&checklistTitle=' . urlencode($row[1]) . '">' . stripslashes($row[1]) . "</a></td>\n";
        echo "\t\t<td>" . stripslashes($row[2]) . "</td>\n";
        echo "\t</tr>\n";
    }
    echo "</table>\n";
} else {
    $message = "You have not defined any checklists yet.";
    $prompt = "Would you like to create a new checklist?";
    $yeslink = "newchecklist.php";
    nothingFound($message, $prompt, $yeslink);
}
mysql_free_result($result);
mysql_close($connection);
include_once 'footer.php';