コード例 #1
0
ファイル: export.php プロジェクト: LeeGlendenning/formulize
function do_update_export($queryData, $frid, $fid, $groups)
{
    // this is the old export code, which is used for 'update' mode
    $fdchoice = "update";
    $GLOBALS['formulize_doingExport'] = true;
    unset($queryData[0]);
    // get rid of the fid and userid lines
    unset($queryData[1]);
    $queryData = implode(" ", $queryData);
    // merge all remaining lines into one string to send to getData
    $data = getData($frid, $fid, $queryData);
    $cols = explode(",", $_GET['cols']);
    $headers = array();
    foreach ($cols as $thiscol) {
        if ($thiscol == "creator_email") {
            $headers[] = _formulize_DE_CALC_CREATOR_EMAIL;
        } else {
            $colMeta = formulize_getElementMetaData($thiscol, true);
            $headers[] = $colMeta['ele_colhead'] ? trans($colMeta['ele_colhead']) : trans($colMeta['ele_caption']);
        }
    }
    $filename = prepExport($headers, $cols, $data, $fdchoice, "", "", false, $fid, $groups);
    $pathToFile = str_replace(XOOPS_URL, XOOPS_ROOT_PATH, $filename);
    if ($_GET['type'] == "update") {
        $fileForUser = str_replace(XOOPS_URL . SPREADSHEET_EXPORT_FOLDER, "", $filename);
    } else {
        $form_handler = xoops_getmodulehandler('forms', 'formulize');
        $formObject = $form_handler->get($fid);
        if (is_object($formObject)) {
            $formTitle = "'" . str_replace(array(" ", "-", "/", "'", "`", "\\", ".", "?", ",", ")", "(", "[", "]"), "_", trans($formObject->getVar('title'))) . "'";
        } else {
            $formTitle = "a_form";
        }
        $fileForUser = _formulize_EXPORT_FILENAME_TEXT . "_" . $formTitle . "_" . date("M_j_Y_Hi") . ".csv";
    }
    header('Content-Description: File Transfer');
    header('Content-Type: text/csv; charset=' . _CHARSET);
    header('Content-Disposition: attachment; filename=' . $fileForUser);
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    if (strstr(strtolower(_CHARSET), 'utf') and $_POST['excel'] == 1) {
        echo "";
        // necessary to trigger certain versions of Excel to recognize the file as unicode
    }
    if (strstr(strtolower(_CHARSET), 'utf-8') and $_POST['excel'] != 1) {
        ob_start();
        readfile($pathToFile);
        $fileContents = ob_get_clean();
        header('Content-Length: ' . filesize($pathToFile) * 2);
        // open office really wants it in UTF-16LE before it will actually trigger an automatic unicode opening?! -- this seems to cause problems on very large exports?
        print iconv("UTF-8", "UTF-16LE//TRANSLIT", $fileContents);
    } else {
        header('Content-Length: ' . filesize($pathToFile));
        readfile($pathToFile);
    }
}
コード例 #2
0
ファイル: import.php プロジェクト: LeeGlendenning/formulize
    $validateOverride = $_POST['validatedata'] == 0 ? true : false;
    importCsv(array($_FILES['csv_name']['name'], $csv_name), $id_reqs, $regfid, $validateOverride);
    print "</td></tr>\n";
} else {
    print "<tr><td class=head><p>" . _formulize_DE_IMPORT_STEP1 . "</p></td><td class=even>";
    // provide a blank template, and a blank update template
    // store the id_reqs and the filename in the DB for later reference in the case of the update template
    // determine if this is the profile form and if so, send special flag to template creation
    $cols1 = getAllColList($fid, "", $groups);
    $cols = array();
    foreach ($cols1[$fid] as $col) {
        $cols[] = $col['ele_id'];
    }
    $headers = getHeaders($cols);
    $template = $regfid == $fid ? "blankprofile" : "blank";
    $blank_template = prepExport($headers, $cols, "", "comma", "", "", $template);
    print "<p><b>" . _formulize_DE_IMPORT_EITHEROR . "</b><p>";
    print "<ul><li>" . _formulize_DE_IMPORT_BLANK . "<br><a href={$blank_template} target=_blank>" . _formulize_DE_IMPORT_BLANK2 . "</a></li></ul>\n";
    print "<Center><p><b>" . _formulize_DE_IMPORT_OR . "</b></p></center>";
    print "<ul><li>" . _formulize_DE_IMPORT_DATATEMP . "<br><a href=\"\" onclick=\"javascript:window.opener.showPop('" . XOOPS_URL . "/modules/formulize/include/export.php?fid={$fid}&frid=&colids=&eq=" . intval($_GET['eq']) . "&type=update');return false;\">" . _formulize_DE_IMPORT_DATATEMP2 . "</a>";
    print "</li></ul></td></tr>\n";
    print "<tr><td class=head><p>" . _formulize_DE_IMPORT_STEP2 . "</p></td><td class=even>" . _formulize_DE_IMPORT_INSTRUCTIONS;
    if ($regfid == $fid) {
        print _formulize_DE_IMPORT_INSTNEWPROFILE;
    } else {
        print _formulize_DE_IMPORT_INSTNEW;
    }
    print _formulize_DE_IMPORT_INSTUPDATE . "</td></tr>\n";
    print "<tr><td class=head><p>" . _formulize_DE_IMPORT_STEP3 . "</p></td><td class=even><p>" . _formulize_DE_IMPORT_FILE . ": <form method=\"post\" ENCTYPE=\"multipart/form-data\"><input type=\"file\" name=\"csv_name\" size=\"40\" /><br><input type=\"checkbox\" name=\"validatedata\" value=\"1\" checked>&nbsp;" . _formulize_DE_IMPORT_VALIDATEDATA . "</p><p><input type=\"submit\" value=\"" . _formulize_DE_IMPORT_GO . "\"></form></p></td></tr>\n";
}
print "</table>";
コード例 #3
0
function drawEntries($fid, $cols, $searches = "", $frid = "", $scope, $standalone = "", $currentURL, $gperm_handler, $uid, $mid, $groups, $settings, $member_handler, $screen, $data, $wq, $regeneratePageNumbers, $hiddenQuickSearches, $cResults)
{
    // , $loadview="") { // -- loadview removed from this function sept 24 2005
    // determine if the query reached a limit in the number of entries to return
    $LOE_limit = 0;
    if (!is_array($data)) {
        $LOE_limit = is_numeric($data) ? $data : 0;
        $data = array();
    }
    global $xoopsDB;
    $useScrollBox = true;
    $useHeadings = true;
    $repeatHeaders = 5;
    $columnWidth = 0;
    $textWidth = 35;
    $useCheckboxes = 0;
    $useViewEntryLinks = 1;
    $useSearch = 1;
    $deColumns = array();
    $useSearchCalcMsgs = 1;
    $listTemplate = false;
    $inlineButtons = array();
    $hiddenColumns = array();
    $formulize_LOEPageSize = 10;
    if ($screen) {
        $useScrollBox = $screen->getVar('usescrollbox');
        $useHeadings = $screen->getVar('useheadings');
        $repeatHeaders = $screen->getVar('repeatheaders');
        $columnWidth = $screen->getVar('columnwidth');
        $textWidth = $screen->getVar('textwidth');
        if ($textWidth == 0) {
            $textWidth = 10000;
        }
        $useCheckboxes = $screen->getVar('usecheckboxes');
        $useViewEntryLinks = $screen->getVar('useviewentrylinks');
        $useSearch = $screen->getVar('usesearch');
        $hiddenColumns = $screen->getVar('hiddencolumns');
        $deColumns = $screen->getVar('decolumns');
        $deDisplay = $screen->getVar('dedisplay');
        $useSearchCalcMsgs = $screen->getVar('usesearchcalcmsgs');
        $listTemplate = $screen->getTemplate("listtemplate");
        foreach ($screen->getVar('customactions') as $caid => $thisCustomAction) {
            if ($thisCustomAction['appearinline'] == 1) {
                list($caCode) = processCustomButton($caid, $thisCustomAction);
                if ($caCode) {
                    $inlineButtons[$caid] = $thisCustomAction;
                }
            }
        }
        $formulize_LOEPageSize = $screen->getVar('entriesperpage');
    }
    $filename = "";
    // $settings['xport'] no longer set by a page load, except if called as part of the import process to create a template for updating
    if (!$settings['xport']) {
        $settings['xport'] = $settings['hlist'] ? "calcs" : "comma";
        $xportDivText1 = "<div id=exportlink style=\"display: none;\">";
        // export button turns this link on and off now
        $xportDivText2 = "</div>";
    } else {
        $xportDivText1 = "";
        $xportDivText2 = "";
    }
    if (@$_POST['advcalc_acid']) {
        if ($_POST['acid'] > 0) {
            $result = formulize_runAdvancedCalculation(intval($_POST['acid']));
            // result will be an array with two or three keys: 'text' and 'output', and possibly 'groupingMap'.  Text is for display on screen "raw" and Output is a variable that can be used by a dev.  The output variable will be an array if groupings are in effect.  The keys of the array will be the various grouping values in effect.  The groupingMap will be present if there's a set of groupings in effect.  It is an array that contains all the grouping choices, their text equivalents and their data values (which are the keys in the output array) -- groupingMap is still to be developed/added to the mix....will be necessary when we are integrating with Drupal or other API uses.
            print "<br/>" . $result['text'] . "<br/><br/>";
        }
    }
    // export of Data is moved out to a popup
    // Calculations still handled in the old way for now
    if ($settings['xport'] == "calcs") {
        $filename = prepExport($headers, $cols, $data, $settings['xport'], $settings['xport_cust'], $settings['title'], false, $fid, $groups);
        $linktext = $_POST['xport'] == "update" ? _formulize_DE_CLICKSAVE_TEMPLATE : _formulize_DE_CLICKSAVE;
        print "{$xportDivText1}<center><p><a href='{$filename}' target=\"_blank\">{$linktext}</a></p></center>";
        print "<br>{$xportDivText2}";
    }
    $scrollBoxWasSet = false;
    if ($useScrollBox and count($data) > 0) {
        print "<div class=scrollbox id=resbox>\n";
        $scrollBoxWasSet = true;
    }
    // perform calculations...
    // calc_cols is the columns requested (separated by / -- ele_id for each, also metadata is indicated with uid, proxyid, creation_date, mod_date)
    // calc_calcs is the calcs for each column, columns separated by / and calcs for a column separated by ,. possible calcs are sum, avg, min, max, count, per
    // calc_blanks is the blank setting for each calculation, setup the same way as the calcs, possible settings are all,  noblanks, onlyblanks
    // calc_grouping is the grouping option.  same format as calcs.  possible values are ele_ids or the uid, proxyid, creation_date and mod_date metadata terms
    // 1. extract data from four settings into arrays
    // 2. loop through the array and perform all the requested calculations
    if ($settings['calc_cols'] and !$settings['hcalc']) {
        //		print "<p><input type=button style=\"width: 140px;\" name=cancelcalcs1 value='" . _formulize_DE_CANCELCALCS . "' onclick=\"javascript:cancelCalcs();\"></input></p>\n";
        //		print "<div";
        //		if($totalcalcs>4) { print " class=scrollbox"; }
        //		print " id=calculations>
        $calc_cols = $settings['calc_cols'];
        $calc_calcs = $settings['calc_calcs'];
        $calc_blanks = $settings['calc_blanks'];
        $calc_grouping = $settings['calc_grouping'];
        print "<table class=outer>";
        if ($useHeadings) {
            $headers = getHeaders($cols, true);
            // second param indicates we're using element headers and not ids
            drawHeaders($headers, $cols, $useCheckboxes, $useViewEntryLinks, count($inlineButtons), $settings['lockedColumns']);
        }
        if ($useSearch) {
            drawSearches($searches, $cols, $useCheckboxes, $useViewEntryLinks, count($inlineButtons), false, $hiddenQuickSearches);
        }
        print "</table>";
        print "<table class=outer><tr><th colspan=2>" . _formulize_DE_CALCHEAD . "</th></tr>\n";
        if (!$settings['lockcontrols'] and ($useSearchCalcMsgs == 1 or $useSearchCalcMsgs == 3)) {
            // AND !$loadview) { // -- loadview removed from this function sept 24 2005
            print "<tr><td class=head colspan=2><input type=button style=\"width: 140px;\" name=mod_calculations value='" . _formulize_DE_MODCALCS . "' onclick=\"javascript:showPop('" . XOOPS_URL . "/modules/formulize/include/pickcalcs.php?fid={$fid}&frid={$frid}&calc_cols=" . urlencode($calc_cols) . "&calc_calcs=" . urlencode($calc_calcs) . "&calc_blanks=" . urlencode($calc_blanks) . "&calc_grouping=" . urlencode($calc_grouping) . "&cols=" . urlencode(implode(",", $cols)) . "');\"></input>&nbsp;&nbsp;" . "<input type=button style=\"width: 140px;\" name=cancelcalcs value='" . _formulize_DE_CANCELCALCS . "' onclick=\"javascript:cancelCalcs();\"></input>&nbsp;&nbsp" . "<input type=button style=\"width: 140px;\" name=showlist value='" . _formulize_DE_SHOWLIST . "' onclick=\"javascript:showList();\"></input></td></tr>";
        }
        $exportFilename = $settings['xport'] == "calcs" ? $filename : "";
        //formulize_benchmark("before printing results");
        // 0 is the masterresults, 1 is the blanksettings, 2 is grouping settings -- exportFilename is the name of the file that we need to create and into which we need to dump a copy of the calcs
        printResults($cResults[0], $cResults[1], $cResults[2], $cResults[3], $cResults[4], $exportFilename, $settings['title']);
        //formulize_benchmark("after printing results");
        print "</table>\n";
    }
    // MASTER HIDELIST CONDITIONAL...
    if (!$settings['hlist'] and !$listTemplate) {
        print "<div class=\"list-of-entries-container\"><table class=\"outer\">";
        $count_colspan = count($cols) + 1;
        if ($useViewEntryLinks or $useCheckboxes != 2) {
            $count_colspan_calcs = $count_colspan;
        } else {
            $count_colspan_calcs = $count_colspan - 1;
        }
        $count_colspan_calcs = $count_colspan_calcs + count($inlineButtons);
        // add to the column count for each inline custom button
        $count_colspan_calcs++;
        // add one more for the hidden floating column
        if (!$screen) {
            print "<tr><th colspan={$count_colspan_calcs}>" . _formulize_DE_DATAHEADING . "</th></tr>\n";
        }
        if ($settings['calc_cols'] and !$settings['lockcontrols'] and ($useSearchCalcMsgs == 1 or $useSearchCalcMsgs == 3)) {
            // AND !$loadview) { // -- loadview removed from this function sept 24 2005
            $calc_cols = $settings['calc_cols'];
            $calc_calcs = $settings['calc_calcs'];
            $calc_blanks = $settings['calc_blanks'];
            $calc_grouping = $settings['calc_grouping'];
            print "<tr><td class=head colspan={$count_colspan_calcs}><input type=button style=\"width: 140px;\" name=mod_calculations value='" . _formulize_DE_MODCALCS . "' onclick=\"javascript:showPop('" . XOOPS_URL . "/modules/formulize/include/pickcalcs.php?fid={$fid}&frid={$frid}&calc_cols={$calc_cols}&calc_calcs={$calc_calcs}&calc_blanks={$calc_blanks}&calc_grouping=" . urlencode($calc_grouping) . "&cols=" . urlencode(implode(",", $cols)) . "');\"></input>&nbsp;&nbsp;<input type=button style=\"width: 140px;\" name=cancelcalcs value='" . _formulize_DE_CANCELCALCS . "' onclick=\"javascript:cancelCalcs();\"></input>&nbsp;&nbsp;<input type=button style=\"width: 140px;\" name=hidelist value='" . _formulize_DE_HIDELIST . "' onclick=\"javascript:hideList();\"></input></td></tr>";
        }
        // draw advanced search notification
        if ($settings['as_0'] and ($useSearchCalcMsgs == 1 or $useSearchCalcMsgs == 2)) {
            $writable_q = writableQuery($wq);
            $minus1colspan = $count_colspan - 1 + count($inlineButtons);
            if (!$asearch_parse_error) {
                print "<tr>";
                if ($useViewEntryLinks or $useCheckboxes != 2) {
                    // only include this column if necessary
                    print "<td class=head></td>";
                }
                print "<td colspan={$minus1colspan} class=head>" . _formulize_DE_ADVSEARCH . ": {$writable_q}";
            } else {
                print "<tr>";
                if ($useViewEntryLinks or $useCheckboxes != 2) {
                    print "<td class=head></td>";
                }
                print "<td colspan={$minus1colspan} class=head><span style=\"font-weight: normal;\">" . _formulize_DE_ADVSEARCH_ERROR . "</span>";
            }
            if (!$settings['lockcontrols']) {
                // AND !$loadview) { // -- loadview removed from this function sept 24 2005
                print "<br><input type=button style=\"width: 140px;\" name=advsearch value='" . _formulize_DE_MOD_ADVSEARCH . "' onclick=\"javascript:showPop('" . XOOPS_URL . "/modules/formulize/include/advsearch.php?fid={$fid}&frid={$frid}";
                foreach ($settings as $k => $v) {
                    if (substr($k, 0, 3) == "as_") {
                        $v = str_replace("'", "&#39;", $v);
                        $v = stripslashes($v);
                        print "&{$k}=" . urlencode($v);
                    }
                }
                print "');\"></input>&nbsp;&nbsp;<input type=button style=\"width: 140px;\" name=cancelasearch value='" . _formulize_DE_CANCELASEARCH . "' onclick=\"javascript:killSearch();\"></input>";
            }
            print "</td></tr>\n";
        }
        if ($useHeadings) {
            $headers = getHeaders($cols, true);
            // second param indicates we're using element headers and not ids
            drawHeaders($headers, $cols, $useCheckboxes, $useViewEntryLinks, count($inlineButtons), $settings['lockedColumns']);
        }
        if ($useSearch) {
            drawSearches($searches, $cols, $useCheckboxes, $useViewEntryLinks, count($inlineButtons), false, $hiddenQuickSearches);
        }
        if (count($data) == 0) {
            // kill an empty dataset so there's no rows drawn
            unset($data);
        } else {
            // get form handles in use
            $mainFormHandle = key($data[key($data)]);
        }
        $headcounter = 0;
        $blankentries = 0;
        $GLOBALS['formulize_displayElement_LOE_Used'] = false;
        $formulize_LOEPageStart = (isset($_POST['formulize_LOEPageStart']) and !$regeneratePageNumbers) ? intval($_POST['formulize_LOEPageStart']) : 0;
        // adjust formulize_LOEPageSize if the actual count of entries is less than the page size
        $formulize_LOEPageSize = $GLOBALS['formulize_countMasterResultsForPageNumbers'] < $formulize_LOEPageSize ? $GLOBALS['formulize_countMasterResultsForPageNumbers'] : $formulize_LOEPageSize;
        $actualPageSize = $formulize_LOEPageSize ? $formulize_LOEPageStart + $formulize_LOEPageSize : $GLOBALS['formulize_countMasterResultsForPageNumbers'];
        if (isset($data)) {
            foreach ($data as $id => $entry) {
                formulize_benchmark("starting to draw one row of results");
                // check to make sure this isn't an unset entry (ie: one that was blanked by the extraction layer just prior to sending back results
                // Since the extraction layer is unsetting entries to blank them, this condition should never be met?
                // If this condition is ever met, it may very well screw up the paging of results!
                // NOTE: this condition is met on the last page of a paged set of results, unless the last page as exactly the same number of entries on it as the limit of entries per page
                if ($entry != "") {
                    if ($headcounter == $repeatHeaders and $repeatHeaders > 0) {
                        if ($useHeadings) {
                            drawHeaders($headers, $cols, $useCheckboxes, $useViewEntryLinks, count($inlineButtons));
                        }
                        $headcounter = 0;
                    }
                    $headcounter++;
                    print "<tr>\n";
                    if ($class == "even") {
                        $class = "odd";
                    } else {
                        $class = "even";
                    }
                    unset($linkids);
                    $linkids = internalRecordIds($entry, $mainFormHandle);
                    // draw in the margin column where the links and metadata goes
                    if ($useViewEntryLinks or $useCheckboxes != 2) {
                        print "<td class=\"head formulize-controls\">\n";
                    }
                    if (!$settings['lockcontrols']) {
                        //  AND !$loadview) { // -- loadview removed from this function sept 24 2005
                        // check to see if we should draw in the delete checkbox
                        // 2 is none, 1 is all
                        if ($useCheckboxes != 2 and ($useCheckboxes == 1 or formulizePermHandler::user_can_delete_entry($fid, $uid, $linkids[0]))) {
                            print "<input type=checkbox title='" . _formulize_DE_DELBOXDESC . "' class='formulize_selection_checkbox' name='delete_" . $linkids[0] . "' id='delete_" . $linkids[0] . "' value='delete_" . $linkids[0] . "'>";
                        }
                        if ($useViewEntryLinks) {
                            print "<a href='" . $currentURL;
                            if (strstr($currentURL, "?")) {
                                // if params are already part of the URL...
                                print "&";
                            } else {
                                print "?";
                            }
                            print "ve=" . $linkids[0] . "' onclick=\"javascript:goDetails('" . $linkids[0] . "');return false;\" " . " class=\"loe-edit-entry\" alt=\"" . _formulize_DE_VIEWDETAILS . "\" title=\"" . _formulize_DE_VIEWDETAILS . "\" >";
                            print "&nbsp;</a>";
                        }
                    }
                    // end of IF NO LOCKCONTROLS
                    if ($useViewEntryLinks or $useCheckboxes != 2) {
                        print "</td>\n";
                    }
                    $column_counter = 0;
                    if ($columnWidth) {
                        $columnWidthParam = "style=\"width: {$columnWidth}" . "px\"";
                    } else {
                        $columnWidthParam = "";
                    }
                    for ($i = 0; $i < count($cols); $i++) {
                        //formulize_benchmark("drawing one column");
                        $col = $cols[$i];
                        $colhandle = $settings['columnhandles'][$i];
                        $classToUse = $class . " column column" . $i;
                        $cellRowAddress = $id + 2;
                        if ($i == 0) {
                            print "<td {$columnWidthParam} class=\"{$class} floating-column\" id='floatingcelladdress_{$cellRowAddress}'>\n";
                        }
                        print "<td {$columnWidthParam} class=\"{$classToUse}\" id=\"celladdress_" . $cellRowAddress . "_" . $i . "\">\n";
                        if ($col == "creation_uid" or $col == "mod_uid") {
                            $userObject = $member_handler->getUser(display($entry, $col));
                            if ($userObject) {
                                $nameToDisplay = $userObject->getVar('name') ? $userObject->getVar('name') : $userObject->getVar('uname');
                            } else {
                                $nameToDisplay = _FORM_ANON_USER;
                            }
                            $value = "<a href=\"" . XOOPS_URL . "/userinfo.php?uid=" . display($entry, $col) . "\" target=_blank>" . $nameToDisplay . "</a>";
                        } else {
                            $value = display($entry, $col);
                        }
                        // set in the display function, corresponds to the entry id of the record in the form where the current value was retrieved from.  If there is more than one local entry id, because of a one to many framework, then this will be an array that corresponds to the order of the values returned by display.
                        $currentColumnLocalId = $GLOBALS['formulize_mostRecentLocalId'];
                        // if we're supposed to display this column as an element... (only show it if they have permission to update this entry)
                        if (in_array($colhandle, $deColumns) and formulizePermHandler::user_can_edit_entry($fid, $uid, $entry)) {
                            include_once XOOPS_ROOT_PATH . "/modules/formulize/include/elementdisplay.php";
                            if ($frid) {
                                // need to work out which form this column belongs to, and use that form's entry ID.  Need to loop through the entry to find all possible internal IDs, since a subform situation would lead to multiple values appearing in a single cell, so multiple displayElement calls would be made each with their own internal ID.
                                foreach ($entry as $entryFormHandle => $entryFormData) {
                                    foreach ($entryFormData as $internalID => $entryElements) {
                                        $deThisIntId = false;
                                        foreach ($entryElements as $entryHandle => $values) {
                                            if ($entryHandle == $col) {
                                                // we found the element that we're trying to display
                                                if ($deThisIntId) {
                                                    print "\n<br />\n";
                                                }
                                                // could be a subform so we'd display multiple values
                                                if ($deDisplay) {
                                                    print '<div id="deDiv_' . $colhandle . '_' . $internalID . '">';
                                                    print getHTMLForList($values, $colhandle, $internalID, $deDisplay, $textWidth, $currentColumnLocalId, $fid, $cellRowAddress, $i);
                                                    print "</div>";
                                                } else {
                                                    displayElement("", $colhandle, $internalID);
                                                }
                                                $deThisIntId = true;
                                            }
                                        }
                                    }
                                }
                            } else {
                                // display based on the mainform entry id
                                if ($deDisplay) {
                                    print '<div id="deDiv_' . $colhandle . '_' . $linkids[0] . '">';
                                    print getHTMLForList($value, $colhandle, $linkids[0], $deDisplay, $textWidth, $currentColumnLocalId, $fid, $cellRowAddress, $i);
                                    print "</div>";
                                } else {
                                    displayElement("", $colhandle, $linkids[0]);
                                    // works for mainform only!  To work on elements from a framework, we need to figure out the form the element is from, and the entry ID in that form, which is done above
                                }
                            }
                            $GLOBALS['formulize_displayElement_LOE_Used'] = true;
                        } elseif ($col != "creation_uid" and $col != "mod_uid" and $col != "entry_id") {
                            print getHTMLForList($value, $col, $linkids[0], 0, $textWidth, $currentColumnLocalId, $fid, $cellRowAddress, $i);
                        } else {
                            // no special formatting on the uid columns:
                            print $value;
                        }
                        print "</td>\n";
                        $column_counter++;
                    }
                    // handle inline custom buttons
                    foreach ($inlineButtons as $caid => $thisCustomAction) {
                        list($caCode) = processCustomButton($caid, $thisCustomAction, $linkids[0], $entry);
                        // only bother with the code, since we already processed any clicked button above
                        if ($caCode) {
                            print "<td {$columnWidthParam} class={$class}>\n";
                            print "<center>{$caCode}</center>\n";
                            print "</td>\n";
                        }
                    }
                    // handle hidden elements for passing back to custom buttons
                    foreach ($hiddenColumns as $thisHiddenCol) {
                        print "\n<input type=\"hidden\" name=\"hiddencolumn_" . $linkids[0] . "_{$thisHiddenCol}\" value=\"" . htmlspecialchars(display($entry, $thisHiddenCol)) . "\"></input>\n";
                    }
                    print "</tr>\n";
                } else {
                    // this is a blank entry
                    $blankentries++;
                }
                // end of not "" check
            }
            // end of foreach data as entry
        }
        // end of if there is any data to draw
        print "</table></div>";
    } elseif ($listTemplate and !$settings['hlist']) {
        // USING A CUSTOM LIST TEMPLATE SO DO EVERYTHING DIFFERENTLY
        // print str_replace("\n", "<br />", $listTemplate); // debug code
        $mainFormHandle = key($data[key($data)]);
        $formulize_LOEPageStart = (isset($_POST['formulize_LOEPageStart']) and !$regeneratePageNumbers) ? intval($_POST['formulize_LOEPageStart']) : 0;
        $actualPageSize = $formulize_LOEPageSize ? $formulize_LOEPageStart + $formulize_LOEPageSize : $GLOBALS['formulize_countMasterResultsForPageNumbers'];
        if (strstr($listTemplate, "displayElement")) {
            include_once XOOPS_ROOT_PATH . "/modules/formulize/include/elementdisplay.php";
        }
        if (isset($data)) {
            //for($entryCounter=$formulize_LOEPageStart;$entryCounter<$actualPageSize;$entryCounter++) {
            // setup the view name variables, with true only set for the last loaded view
            $viewNumber = 1;
            foreach ($settings['publishedviewnames'] as $id => $thisViewName) {
                $thisViewName = str_replace(" ", "_", $thisViewName);
                if ($id == $settings['lastloaded']) {
                    ${$thisViewName} = true;
                    ${'view' . $viewNumber} = true;
                } else {
                    ${$thisViewName} = false;
                    $view['view' . $viewNumber] = false;
                }
                $viewNumber++;
            }
            foreach ($data as $id => $entry) {
                //$entry = $data[$entryCounter];
                //$id=$entryCounter;
                // check to make sure this isn't an unset entry (ie: one that was blanked by the extraction layer just prior to sending back results
                // Since the extraction layer is unsetting entries to blank them, this condition should never be met?
                // If this condition is ever met, it may very well screw up the paging of results!
                // NOTE: this condition is met on the last page of a paged set of results, unless the last page as exactly the same number of entries on it as the limit of entries per page
                if ($entry != "") {
                    // Set up the variables for the link to the current entry, and the checkbox that can be used to select the current entry
                    $linkids = internalRecordIds($entry, $mainFormHandle);
                    $entry_id = $linkids[0];
                    // make a nice way of referring to this for in the eval'd code
                    $form_id = $fid;
                    // make a nice way of referring to this for in the eval'd code
                    if (!$settings['lockcontrols']) {
                        //  AND !$loadview) { // -- loadview removed from this function sept 24 2005
                        $viewEntryLinkCode = "<a href='" . $currentURL;
                        if (strstr($currentURL, "?")) {
                            // if params are already part of the URL...
                            $viewEntryLinkCode .= "&";
                        } else {
                            $viewEntryLinkCode .= "?";
                        }
                        $viewEntryLinkCode .= "ve=" . $entry_id . "' onclick=\"javascript:goDetails('" . $entry_id . "');return false;\">";
                        $GLOBALS['formulize_viewEntryId'] = $entry_id;
                        // put into global scope so the function 'viewEntryLink' can pick it up if necessary
                        $GLOBALS['formulize_viewEntryLinkCode'] = $viewEntryLinkCode;
                        // check to see if we should draw in the delete checkbox
                        // 2 is none, 1 is all
                        if ($useCheckboxes != 2 and ($useCheckboxes == 1 or formulizePermHandler::user_can_delete_entry($fid, $uid, $entry_id))) {
                            $selectionCheckbox = "<input type=checkbox title='" . _formulize_DE_DELBOXDESC . "' class='formulize_selection_checkbox' name='delete_" . $entry_id . "' id='delete_" . $entry_id . "' value='delete_" . $entry_id . "'>";
                        } else {
                            $selectionCheckbox = "";
                        }
                    }
                    // end of IF NO LOCKCONTROLS
                    $ids = internalRecordIds($entry, $mainFormHandle);
                    foreach ($inlineButtons as $caid => $thisCustomAction) {
                        list($caCode) = processCustomButton($caid, $thisCustomAction, $ids[0], $entry);
                        // only bother with the code, since we already processed any clicked button above
                        if ($caCode) {
                            ${$thisCustomAction['handle']} = $caCode;
                            // assign the button code that was returned
                        }
                    }
                    // handle hidden elements for passing back to custom buttons
                    foreach ($hiddenColumns as $thisHiddenCol) {
                        print "\n<input type=\"hidden\" name=\"hiddencolumn_" . $linkids[0] . "_{$thisHiddenCol}\" value=\"" . htmlspecialchars(display($entry, $thisHiddenCol)) . "\"></input>\n";
                    }
                    include XOOPS_ROOT_PATH . "/modules/formulize/templates/screens/default/" . $screen->getVar('sid') . "/listtemplate.php";
                }
            }
        }
    }
    // END OF MASTER HIDELIST CONDITIONAL
    if ((!isset($data) or count($data) == $blankentries) and !$LOE_limit) {
        // if no data was returned, or the dataset was empty...
        print "<p><b>" . _formulize_DE_NODATAFOUND . "</b></p>\n";
    } elseif ($LOE_limit) {
        print "<p>" . _formulize_DE_LOE_LIMIT_REACHED1 . " <b>" . $LOE_limit . "</b> " . _formulize_DE_LOE_LIMIT_REACHED2 . " <a href=\"\" onclick=\"javascript:forceQ();return false;\">" . _formulize_DE_LOE_LIMIT_REACHED3 . "</a></p>\n";
    }
    if ($scrollBoxWasSet) {
        print "</div>";
    }
    formulize_benchmark("We're done");
}