当前位置: 首页>>代码示例>>PHP>>正文


PHP WebPage::GetTable方法代码示例

本文整理汇总了PHP中WebPage::GetTable方法的典型用法代码示例。如果您正苦于以下问题:PHP WebPage::GetTable方法的具体用法?PHP WebPage::GetTable怎么用?PHP WebPage::GetTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebPage的用法示例。


在下文中一共展示了WebPage::GetTable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetHTMLTable

 public function GetHTMLTable(WebPage $oPage, $aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams)
 {
     $iNbPages = $iPageSize < 1 ? 1 : ceil($this->iNbObjects / $iPageSize);
     if ($iPageSize < 1) {
         $iPageSize = -1;
         // convention: no pagination
     }
     $aAttribs = $this->GetHTMLTableConfig($aColumns, $sSelectMode, $bViewLink);
     $aValues = $this->GetHTMLTableValues($aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams);
     $sHtml = $oPage->GetTable($aAttribs, $aValues);
     return $sHtml;
 }
开发者ID:henryavila,项目名称:itop,代码行数:12,代码来源:datatable.class.inc.php

示例2: GetHistoryTable

 protected function GetHistoryTable(WebPage $oPage, DBObjectSet $oSet)
 {
     $sHtml = '';
     // First the latest change that the user is allowed to see
     $oSet->Rewind();
     // Reset the pointer to the beginning of the set
     $aChanges = array();
     while ($oChangeOp = $oSet->Fetch()) {
         $sChangeDescription = $oChangeOp->GetDescription();
         if ($sChangeDescription != '') {
             // The change is visible for the current user
             $changeId = $oChangeOp->Get('change');
             $aChanges[$changeId]['date'] = $oChangeOp->Get('date');
             $aChanges[$changeId]['userinfo'] = $oChangeOp->Get('userinfo');
             if (!isset($aChanges[$changeId]['log'])) {
                 $aChanges[$changeId]['log'] = array();
             }
             $aChanges[$changeId]['log'][] = $sChangeDescription;
         }
     }
     $aAttribs = array('date' => array('label' => Dict::S('UI:History:Date'), 'description' => Dict::S('UI:History:Date+')), 'userinfo' => array('label' => Dict::S('UI:History:User'), 'description' => Dict::S('UI:History:User+')), 'log' => array('label' => Dict::S('UI:History:Changes'), 'description' => Dict::S('UI:History:Changes+')));
     $aValues = array();
     foreach ($aChanges as $aChange) {
         $aValues[] = array('date' => $aChange['date'], 'userinfo' => htmlentities($aChange['userinfo'], ENT_QUOTES, 'UTF-8'), 'log' => "<ul><li>" . implode('</li><li>', $aChange['log']) . "</li></ul>");
     }
     $sHtml .= $oPage->GetTable($aAttribs, $aValues);
     return $sHtml;
 }
开发者ID:henryavila,项目名称:itop,代码行数:28,代码来源:displayblock.class.inc.php

示例3: GetHTMLTable

    public function GetHTMLTable(WebPage $oPage, $aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams)
    {
        $iNbPages = $iPageSize < 1 ? 1 : ceil($this->iNbObjects / $iPageSize);
        if ($iPageSize < 1) {
            $iPageSize = -1;
            // convention: no pagination
        }
        $aAttribs = $this->GetHTMLTableConfig($aColumns, $sSelectMode, $bViewLink);
        $aValues = $this->GetHTMLTableValues($aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams);
        $sHtml = '<table class="listContainer">';
        foreach ($this->oSet->GetFilter()->GetInternalParams() as $sName => $sValue) {
            $aExtraParams['query_params'][$sName] = $sValue;
        }
        $sHtml .= "<tr><td>";
        $sHtml .= $oPage->GetTable($aAttribs, $aValues);
        $sHtml .= '</td></tr>';
        $sHtml .= '</table>';
        $iCount = $this->iNbObjects;
        $aArgs = $this->oSet->GetArgs();
        $sExtraParams = addslashes(str_replace('"', "'", json_encode(array_merge($aExtraParams, $aArgs))));
        // JSON encode, change the style of the quotes and escape them
        $sSelectModeJS = '';
        $sHeaders = '';
        if ($sSelectMode == 'single' || $sSelectMode == 'multiple') {
            $sSelectModeJS = $sSelectMode;
            $sHeaders = 'headers: { 0: {sorter: false}},';
        }
        $sDisplayKey = $bViewLink ? 'true' : 'false';
        // Protect against duplicate elements in the Zlist
        $aUniqueOrderedList = array();
        foreach ($this->aClassAliases as $sAlias => $sClassName) {
            foreach ($aColumns[$sAlias] as $sAttCode => $aData) {
                if ($aData['checked']) {
                    $aUniqueOrderedList[$sAttCode] = true;
                }
            }
        }
        $aUniqueOrderedList = array_keys($aUniqueOrderedList);
        $sJSColumns = json_encode($aColumns);
        $sJSClassAliases = json_encode($this->aClassAliases);
        $sCssCount = isset($aExtraParams['cssCount']) ? ", cssCount: '{$aExtraParams['cssCount']}'" : '';
        $this->oSet->ApplyParameters();
        // Display the actual sort order of the table
        $aRealSortOrder = $this->oSet->GetRealSortOrder();
        $aDefaultSort = array();
        $iColOffset = 0;
        if ($sSelectMode == 'single' || $sSelectMode == 'multiple') {
            $iColOffset += 1;
        }
        if ($bViewLink) {
            //			$iColOffset += 1;
        }
        foreach ($aRealSortOrder as $sColCode => $bAscending) {
            $iPos = array_search($sColCode, $aUniqueOrderedList);
            if ($iPos !== false) {
                $aDefaultSort[] = "[" . ($iColOffset + $iPos) . "," . ($bAscending ? '0' : '1') . "]";
            } else {
                if (($iPos = array_search(preg_replace('/_friendlyname$/', '', $sColCode), $aUniqueOrderedList)) !== false) {
                    // if sorted on the friendly name of an external key, then consider it sorted on the column that shows the links
                    $aDefaultSort[] = "[" . ($iColOffset + $iPos) . "," . ($bAscending ? '0' : '1') . "]";
                } else {
                    if ($sColCode == 'friendlyname' && $bViewLink) {
                        $aDefaultSort[] = "[" . $iColOffset . "," . ($bAscending ? '0' : '1') . "]";
                    }
                }
            }
        }
        $sFakeSortList = '';
        if (count($aDefaultSort) > 0) {
            $sFakeSortList = '[' . implode(',', $aDefaultSort) . ']';
        }
        $sOQL = addslashes($this->oSet->GetFilter()->serialize());
        $oPage->add_ready_script(<<<EOF
var oTable = \$('#{$this->iListId} table.listResults');
oTable.tablesorter( { {$sHeaders} widgets: ['myZebra', 'truncatedList']} ).tablesorterPager({container: \$('#pager{$this->iListId}'), totalRows:{$iCount}, size: {$iPageSize}, filter: '{$sOQL}', extra_params: '{$sExtraParams}', select_mode: '{$sSelectModeJS}', displayKey: {$sDisplayKey}, columns: {$sJSColumns}, class_aliases: {$sJSClassAliases} {$sCssCount}});
EOF
);
        if ($sFakeSortList != '') {
            $oPage->add_ready_script("oTable.trigger(\"fakesorton\", [{$sFakeSortList}]);");
        }
        //if ($iNbPages == 1)
        if (false) {
            if (isset($aExtraParams['cssCount'])) {
                $sCssCount = $aExtraParams['cssCount'];
                if ($sSelectMode == 'single') {
                    $sSelectSelector = ":radio[name^=selectObj]";
                } else {
                    if ($sSelectMode == 'multiple') {
                        $sSelectSelector = ":checkbox[name^=selectObj]";
                    }
                }
                $oPage->add_ready_script(<<<EOF
\t\$('#{$this->iListId} table.listResults {$sSelectSelector}').change(function() {
\t\tvar c = \$('{$sCssCount}');\t\t\t\t\t\t\t
\t\tvar v = \$('#{$this->iListId} table.listResults {$sSelectSelector}:checked').length;
\t\tc.val(v);
\t\t\$('#{$this->iListId} .selectedCount').text(v);
\t\tc.trigger('change');\t
\t});
EOF
//.........这里部分代码省略.........
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:101,代码来源:datatable.class.inc.php


注:本文中的WebPage::GetTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。