function getTableRow($record, $value, $formType)
    {
        global $isMyAccountMenu;
        $parentTable = $GLOBALS['menu'];
        // set field attributes
        $relatedTable = $this->relatedTable;
        $relatedWhere = getEvalOutput(@$this->relatedWhere);
        $seeMoreLink = @$this->relatedMoreLink ? "?menu={$relatedTable}&search=1&_ignoreSavedSearch=1&" . getEvalOutput($this->relatedMoreLink) : '';
        // load list functions
        require_once "lib/menus/default/list_functions.php";
        require_once "lib/viewer_functions.php";
        // save and update globals
        list($originalMenu, $originalTableName, $originalSchema) = array($GLOBALS['menu'], $GLOBALS['tableName'], $GLOBALS['schema']);
        $GLOBALS['menu'] = $relatedTable;
        $GLOBALS['tableName'] = $relatedTable;
        $GLOBALS['schema'] = loadSchema($relatedTable);
        $GLOBALS['schema'] = array_merge($GLOBALS['schema'], getSchemaFields($GLOBALS['schema']));
        // v2.16+, add pseudo-fields name and _tableName to all fieldSchemas.  Doing this once here instead of every time in loadSchema() is less expensive
        // load list data
        list($listFields, $records, $metaData) = list_functions_init(array('isRelatedRecords' => true, 'tableName' => $relatedTable, 'where' => $relatedWhere, 'perPage' => @$this->relatedLimit));
        ### show header
        $html = '';
        $recordCount = count($records);
        $oneOrZero = $recordCount > 0 ? 1 : 0;
        $seeMoreHTML = $seeMoreLink ? "<br/><a href='{$seeMoreLink}'>" . htmlencode(t("see related records >>")) . "</a>" : '';
        $showingText = sprintf(t('Showing %1$s - %2$s of %3$s related records'), $oneOrZero, $recordCount, $metaData['totalRecords']);
        ob_start();
        ?>
<tr><td colspan="2">
  <div class="clear"></div>
  <div class="content-box">

    <div class="content-box-header">
      <div style="float:right; text-align: right; line-height: 110%">
        <?php 
        echo $showingText;
        ?>
        <?php 
        echo $seeMoreHTML;
        ?>
      </div>
      <h3><?php 
        echo $this->label;
        ?>
<!-- --></h3>
      <div class="clear"></div>
    </div> <!-- End .content-box-header -->

    <div class="content-box-content">
<?php 
        $html .= ob_get_clean();
        ### show body
        // show list
        ob_start();
        showListTable($listFields, $records, array('isRelatedRecords' => true, 'showView' => @$this->relatedView, 'showModify' => @$this->relatedModify, 'showErase' => @$this->relatedErase, 'showCreate' => @$this->relatedCreate));
        $html .= ob_get_clean();
        ### get footer
        $buttonsRight = '';
        if (@$this->relatedCreate) {
            // show "create" button for related records
            $buttonsRight = relatedRecordsButton(t('Create'), "?menu={$relatedTable}&action=edit&{$parentTable}Num=###");
        }
        $tableName = $relatedTable;
        $isRelatedTable = true;
        $buttonsRight = applyFilters('list_buttonsRight', $buttonsRight, $tableName, $isRelatedTable);
        $html .= <<<__FOOTER__

    <div style='float:right; padding-top: 3px'>
    {$buttonsRight}
    </div>
    <div class='clear'></div>

    </div><!-- End .content-box-content -->
  </div><!-- End .content-box -->
</td></tr>
__FOOTER__;
        // reset globals
        list($GLOBALS['menu'], $GLOBALS['tableName'], $GLOBALS['schema']) = array($originalMenu, $originalTableName, $originalSchema);
        //
        return $html;
    }
Example #2
0
<?php

global $TABLE_PREFIX, $CURRENT_USER, $tableName, $schema, $hasEditorAccess, $hasAuthorAccess, $hasViewerAccessOnly, $isMyAccountMenu, $menu;
if ($isMyAccountMenu) {
    die("Access not permitted for My Account menu!");
}
require_once "lib/menus/default/list_functions.php";
require_once "lib/viewer_functions.php";
//
redirectSingleRecordAuthorsToEditPage();
//
list($listFields, $records, $metaData) = list_functions_init();
//
doAction('list_postselect', $records, $listFields, $metaData);
//
showHeader();
?>

<form method="get" name="preview" action="<?php 
echo PREFIX_URL;
echo @$schema['_listPage'];
?>
" target="_blank" autocomplete="off">
</form>

<form method="post" name="searchForm" action="?" autocomplete="off">
<input type="submit" style="width: 0px; height: 0px; position: absolute; border: none; padding: 0px" /> <!-- bugfix: hitting enter in textfield submits first submit button on form -->
<input type="hidden" name="menu" id="menu" value="<?php 
echo htmlencode($tableName);
?>
" />