本文整理汇总了PHP中WebPage::GetUniqueId方法的典型用法代码示例。如果您正苦于以下问题:PHP WebPage::GetUniqueId方法的具体用法?PHP WebPage::GetUniqueId怎么用?PHP WebPage::GetUniqueId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebPage
的用法示例。
在下文中一共展示了WebPage::GetUniqueId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RenderContent
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
if (!isset($aExtraParams['currentId'])) {
$sId = $oPage->GetUniqueId();
// Works only if the page is not an Ajax one !
} else {
$sId = $aExtraParams['currentId'];
}
$oPage->add($this->GetRenderContent($oPage, $aExtraParams, $sId));
}
示例2: GetSearchForm
public static function GetSearchForm(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = array())
{
static $iSearchFormId = 0;
$bMultiSelect = false;
$oAppContext = new ApplicationContext();
$sHtml = '';
$numCols = 4;
$sClassName = $oSet->GetFilter()->GetClass();
// Romain: temporarily removed the tab "OQL query" because it was not finalized
// (especially when used to add a link)
/*
$sHtml .= "<div class=\"mini_tabs\" id=\"mini_tabs{$iSearchFormId}\"><ul>
<li><a href=\"#\" onClick=\"$('div.mini_tab{$iSearchFormId}').toggle();$('#mini_tabs{$iSearchFormId} ul li a').toggleClass('selected');\">".Dict::S('UI:OQLQueryTab')."</a></li>
<li><a class=\"selected\" href=\"#\" onClick=\"$('div.mini_tab{$iSearchFormId}').toggle();$('#mini_tabs{$iSearchFormId} ul li a').toggleClass('selected');\">".Dict::S('UI:SimpleSearchTab')."</a></li>
</ul></div>\n";
*/
// Simple search form
if (isset($aExtraParams['currentId'])) {
$sSearchFormId = $aExtraParams['currentId'];
} else {
$iSearchFormId = $oPage->GetUniqueId();
$sSearchFormId = 'SimpleSearchForm' . $iSearchFormId;
$sHtml .= "<div id=\"ds_{$sSearchFormId}\" class=\"mini_tab{$iSearchFormId}\">\n";
}
// Check if the current class has some sub-classes
if (isset($aExtraParams['baseClass'])) {
$sRootClass = $aExtraParams['baseClass'];
} else {
$sRootClass = $sClassName;
}
$aSubClasses = MetaModel::GetSubclasses($sRootClass);
if (count($aSubClasses) > 0) {
$aOptions = array();
$aOptions[MetaModel::GetName($sRootClass)] = "<option value=\"{$sRootClass}\">" . MetaModel::GetName($sRootClass) . "</options>\n";
foreach ($aSubClasses as $sSubclassName) {
$aOptions[MetaModel::GetName($sSubclassName)] = "<option value=\"{$sSubclassName}\">" . MetaModel::GetName($sSubclassName) . "</options>\n";
}
$aOptions[MetaModel::GetName($sClassName)] = "<option selected value=\"{$sClassName}\">" . MetaModel::GetName($sClassName) . "</options>\n";
ksort($aOptions);
$sContext = $oAppContext->GetForLink();
$sClassesCombo = "<select name=\"class\" onChange=\"ReloadSearchForm('{$sSearchFormId}', this.value, '{$sRootClass}', '{$sContext}')\">\n" . implode('', $aOptions) . "</select>\n";
} else {
$sClassesCombo = MetaModel::GetName($sClassName);
}
$oUnlimitedFilter = new DBObjectSearch($sClassName);
$sAction = isset($aExtraParams['action']) ? $aExtraParams['action'] : utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php';
$sHtml .= "<form id=\"fs_{$sSearchFormId}\" action=\"{$sAction}\">\n";
// Don't use $_SERVER['SCRIPT_NAME'] since the form may be called asynchronously (from ajax.php)
$sHtml .= "<h2>" . Dict::Format('UI:SearchFor_Class_Objects', $sClassesCombo) . "</h2>\n";
$index = 0;
$sHtml .= "<p>\n";
$aMapCriteria = array();
$aList = MetaModel::GetZListItems($sClassName, 'standard_search');
$aConsts = $oSet->ListConstantFields();
// Some fields are constants based on the query/context
$sClassAlias = $oSet->GetFilter()->GetClassAlias();
foreach ($aList as $sFilterCode) {
//$oAppContext->Reset($sFilterCode); // Make sure the same parameter will not be passed twice
$sHtml .= '<span style="white-space: nowrap;padding:5px;display:inline-block;">';
$sFilterValue = isset($aConsts[$sClassAlias][$sFilterCode]) ? $aConsts[$sClassAlias][$sFilterCode] : '';
$sFilterValue = utils::ReadParam($sFilterCode, $sFilterValue, false, 'raw_data');
$sFilterOpCode = null;
// Use the default 'loose' OpCode
if (empty($sFilterValue)) {
if (isset($aMapCriteria[$sFilterCode])) {
if (count($aMapCriteria[$sFilterCode]) > 1) {
$sFilterValue = Dict::S('UI:SearchValue:Mixed');
} else {
$sFilterValue = $aMapCriteria[$sFilterCode][0]['value'];
$sFilterOpCode = $aMapCriteria[$sFilterCode][0]['opcode'];
}
// Todo: Investigate...
if ($sFilterCode != 'company') {
$oUnlimitedFilter->AddCondition($sFilterCode, $sFilterValue, $sFilterOpCode);
}
}
}
$oAttDef = MetaModel::GetAttributeDef($sClassName, $sFilterCode);
if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) {
$oKeyAttDef = $oAttDef->GetFinalAttDef();
$sKeyAttClass = $oKeyAttDef->GetHostClass();
$sKeyAttCode = $oKeyAttDef->GetCode();
$sTargetClass = $oKeyAttDef->GetTargetClass();
$oSearch = new DBObjectSearch($sTargetClass);
$oSearch->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', true);
$oAllowedValues = new DBObjectSet($oSearch);
$iFieldSize = $oKeyAttDef->GetMaxSize();
$iMaxComboLength = $oKeyAttDef->GetMaximumComboLength();
$sHtml .= "<label>" . MetaModel::GetFilterLabel($sKeyAttClass, $sKeyAttCode) . ":</label> ";
$aExtKeyParams = $aExtraParams;
$aExtKeyParams['iFieldSize'] = $oKeyAttDef->GetMaxSize();
$aExtKeyParams['iMinChars'] = $oKeyAttDef->GetMinAutoCompleteChars();
$sHtml .= UIExtKeyWidget::DisplayFromAttCode($oPage, $sKeyAttCode, $sKeyAttClass, $oAttDef->GetLabel(), $oAllowedValues, $sFilterValue, $sSearchFormId . 'search_' . $sFilterCode, false, $sFilterCode, '', $aExtKeyParams, true);
} else {
$aAllowedValues = MetaModel::GetAllowedValues_flt($sClassName, $sFilterCode, $aExtraParams);
if (is_null($aAllowedValues)) {
// Any value is possible, display an input box
$sHtml .= "<label>" . MetaModel::GetFilterLabel($sClassName, $sFilterCode) . ":</label> <input class=\"textSearch\" name=\"{$sFilterCode}\" value=\"" . htmlentities($sFilterValue, ENT_QUOTES, 'utf-8') . "\"/>\n";
} else {
//Enum field, display a multi-select combo
//.........这里部分代码省略.........
示例3: RenderContent
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
if (empty($aExtraParams['currentId'])) {
$sId = 'sqlblock_' . $oPage->GetUniqueId();
// Works only if the page is not an Ajax one !
} else {
$sId = $aExtraParams['currentId'];
}
// $oPage->add($this->GetRenderContent($oPage, $aExtraParams, $sId));
$sQuery = $this->BuildQuery();
$res = CMDBSource::Query($sQuery);
$aQueryCols = CMDBSource::GetColumns($res);
// Prepare column definitions (check + give default values)
//
foreach ($this->m_aColumns as $sName => $aColumnData) {
if (!in_array($sName, $aQueryCols)) {
throw new Exception("Unknown column name '{$sName}' in sqlblock column");
}
if (!isset($aColumnData['label'])) {
$this->m_aColumns[$sName]['label'] = $sName;
}
if (isset($aColumnData['drilldown']) && !empty($aColumnData['drilldown'])) {
// Check if the OQL is valid
try {
$this->m_aColumns[$sName]['filter'] = DBObjectSearch::FromOQL($aColumnData['drilldown']);
} catch (OQLException $e) {
unset($aColumnData['drilldown']);
}
}
}
if (strlen($this->m_sTitle) > 0) {
$oPage->add("<h2>" . Dict::S($this->m_sTitle) . "</h2>\n");
}
switch ($this->m_sType) {
case 'bars':
case 'pie':
$aColNames = array_keys($this->m_aColumns);
$sXColName = $aColNames[0];
$sYColName = $aColNames[1];
$aData = array();
$aRows = array();
while ($aRow = CMDBSource::FetchArray($res)) {
$aData[$aRow[$sXColName]] = $aRow[$sYColName];
$aRows[$aRow[$sXColName]] = $aRow;
}
$this->RenderChart($oPage, $sId, $aData, $this->m_aColumns[$sYColName]['drilldown'], $aRows);
break;
default:
case 'table':
$oAppContext = new ApplicationContext();
$sContext = $oAppContext->GetForLink();
if (!empty($sContext)) {
$sContext = '&' . $sContext;
}
$aDisplayConfig = array();
foreach ($this->m_aColumns as $sName => $aColumnData) {
$aDisplayConfig[$sName] = array('label' => $aColumnData['label'], 'description' => '');
}
$aDisplayData = array();
while ($aRow = CMDBSource::FetchArray($res)) {
$aSQLColNames = array_keys($aRow);
$aDisplayRow = array();
foreach ($this->m_aColumns as $sName => $aColumnData) {
if (isset($aColumnData['filter'])) {
$sFilter = $aColumnData['drilldown'];
$sClass = $aColumnData['filter']->GetClass();
$sFilter = str_replace('SELECT ' . $sClass, '', $sFilter);
foreach ($aSQLColNames as $sColName) {
$sFilter = str_replace(':' . $sColName, "'" . addslashes($aRow[$sColName]) . "'", $sFilter);
}
$sURL = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?operation=search_oql&search_form=0&oql_class=' . $sClass . '&oql_clause=' . urlencode($sFilter) . '&format=html' . $sContext;
$aDisplayRow[$sName] = '<a href="' . $sURL . '">' . $aRow[$sName] . "</a>";
} else {
$aDisplayRow[$sName] = $aRow[$sName];
}
}
$aDisplayData[] = $aDisplayRow;
}
$oPage->table($aDisplayConfig, $aDisplayData);
break;
}
}