本文整理汇总了PHP中MetaModel::GetName方法的典型用法代码示例。如果您正苦于以下问题:PHP MetaModel::GetName方法的具体用法?PHP MetaModel::GetName怎么用?PHP MetaModel::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaModel
的用法示例。
在下文中一共展示了MetaModel::GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetRelatedObjectsAsXml
/**
* Get the related objects through the given relation, output in XML
* @param DBObject $oObj The current object
* @param string $sRelation The name of the relation to search with
*/
function GetRelatedObjectsAsXml(DBObject $oObj, $sRelationName, &$oLinks, &$oXmlDoc, &$oXmlNode, $iDepth = 0, $aExcludedClasses)
{
global $G_aCachedObjects;
$iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth', 20);
$aResults = array();
$bAddLinks = false;
if ($iDepth > $iMaxRecursionDepth - 1) {
return;
}
$sIdxKey = get_class($oObj) . ':' . $oObj->GetKey();
if (!array_key_exists($sIdxKey, $G_aCachedObjects)) {
$oObj->GetRelatedObjects($sRelationName, 1, $aResults);
$G_aCachedObjects[$sIdxKey] = true;
} else {
return;
//$aResults = $G_aCachedObjects[$sIdxKey];
}
foreach ($aResults as $sRelatedClass => $aObjects) {
foreach ($aObjects as $id => $oTargetObj) {
if (is_object($oTargetObj)) {
if (in_array(get_class($oTargetObj), $aExcludedClasses)) {
GetRelatedObjectsAsXml($oTargetObj, $sRelationName, $oLinks, $oXmlDoc, $oXmlNode, $iDepth + 1, $aExcludedClasses);
} else {
$oLinkingNode = $oXmlDoc->CreateElement('link');
$oLinkingNode->SetAttribute('relation', $sRelationName);
$oLinkingNode->SetAttribute('arrow', 1);
// Such relations have a direction, display an arrow
$oLinkedNode = $oXmlDoc->CreateElement('node');
$oLinkedNode->SetAttribute('id', $oTargetObj->GetKey());
$oLinkedNode->SetAttribute('obj_class', get_class($oTargetObj));
$oLinkedNode->SetAttribute('obj_class_name', htmlspecialchars(MetaModel::GetName(get_class($oTargetObj))));
$oLinkedNode->SetAttribute('name', htmlspecialchars($oTargetObj->GetRawName()));
// htmlentities is too much for XML
$oLinkedNode->SetAttribute('icon', BuildIconPath($oTargetObj->GetIcon(false)));
AddNodeDetails($oLinkedNode, $oTargetObj);
$oSubLinks = $oXmlDoc->CreateElement('links');
// Recurse
GetRelatedObjectsAsXml($oTargetObj, $sRelationName, $oSubLinks, $oXmlDoc, $oLinkedNode, $iDepth + 1, $aExcludedClasses);
$oLinkingNode->AppendChild($oLinkedNode);
$oLinks->AppendChild($oLinkingNode);
$bAddLinks = true;
}
}
}
}
if ($bAddLinks) {
$oXmlNode->AppendChild($oLinks);
}
}
示例2: GetFooter
public function GetFooter()
{
$sData = parent::GetFooter();
$oPage = new PDFPage(Dict::Format('Core:BulkExportOf_Class', MetaModel::GetName($this->oSearch->GetClass())), $this->aStatusInfo['page_size'], $this->aStatusInfo['page_orientation']);
$oPDF = $oPage->get_tcpdf();
$oPDF->SetFont('dejavusans', '', 8, '', true);
$oPage->add(file_get_contents($this->aStatusInfo['tmp_file']));
$oPage->add($sData);
$sPDF = $oPage->get_pdf();
return $sPDF;
}
示例3: DoUpdateObjectFromPostedForm
/**
* Updates the object form POSTED arguments, and writes it into the DB (applies a stimuli if requested)
* @param DBObject $oObj The object to update
* $param array $aAttList If set, this will limit the list of updated attributes
* @return void
*/
public function DoUpdateObjectFromPostedForm(DBObject $oObj, $aAttList = null)
{
$sTransactionId = utils::ReadPostedParam('transaction_id', '');
if (!utils::IsTransactionValid($sTransactionId)) {
throw new TransactionException();
}
$sClass = get_class($oObj);
$sStimulus = trim(utils::ReadPostedParam('apply_stimulus', ''));
$sTargetState = '';
if (!empty($sStimulus)) {
// Compute the target state
$aTransitions = $oObj->EnumTransitions();
if (!isset($aTransitions[$sStimulus])) {
throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulus, $oObj->GetName(), $oObj->GetStateLabel()));
}
$sTargetState = $aTransitions[$sStimulus]['target_state'];
}
$oObj->UpdateObjectFromPostedForm('', $aAttList, $sTargetState);
// Optional: apply a stimulus
//
if (!empty($sStimulus)) {
if (!$oObj->ApplyStimulus($sStimulus)) {
throw new Exception("Cannot apply stimulus '{$sStimulus}' to {$oObj->GetName()}");
}
}
if ($oObj->IsModified()) {
// Record the change
//
$oObj->DBUpdate();
// Trigger ?
//
$aClasses = MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL);
$sClassList = implode(", ", CMDBSource::Quote($aClasses));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnPortalUpdate AS t WHERE t.target_class IN ({$sClassList})"));
while ($oTrigger = $oSet->Fetch()) {
$oTrigger->DoActivate($oObj->ToArgs('this'));
}
$this->p("<h1>" . Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($oObj)), $oObj->GetName()) . "</h1>\n");
}
$bLockEnabled = MetaModel::GetConfig()->Get('concurrent_lock_enabled');
if ($bLockEnabled) {
// Release the concurrent lock, if any
$sOwnershipToken = utils::ReadPostedParam('ownership_token', null, false, 'raw_data');
if ($sOwnershipToken !== null) {
// We're done, let's release the lock
iTopOwnershipLock::ReleaseLock(get_class($oObj), $oObj->GetKey(), $sOwnershipToken);
}
}
}
示例4: GetName
public function GetName($sClass)
{
return MetaModel::GetName($sClass);
}
示例5: DisplayHierarchy
/**
* Display the hierarchy of the 'target' class
*/
public function DisplayHierarchy(WebPage $oPage, $sFilter, $currValue, $oObj)
{
$sDialogTitle = addslashes(Dict::Format('UI:HierarchyOf_Class', MetaModel::GetName($this->sTargetClass)));
$oPage->add('<div id="dlg_tree_' . $this->iId . '"><div class="wizContainer" style="vertical-align:top;"><div style="overflow:auto;background:#fff;margin-bottom:5px;" id="tree_' . $this->iId . '">');
$oPage->add('<table style="width:100%"><tr><td>');
if (is_null($sFilter)) {
throw new Exception('Implementation: null value for allowed values definition');
}
try {
$oFilter = DBObjectSearch::FromOQL($sFilter);
$oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode);
$oSet = new DBObjectSet($oFilter, array(), array('this' => $oObj));
} catch (MissingQueryArgument $e) {
// When used in a search form the $this parameter may be missing, in this case return all possible values...
// TODO check if we can improve this behavior...
$sOQL = 'SELECT ' . $this->m_sTargetClass;
$oFilter = DBObjectSearch::FromOQL($sOQL);
$oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode);
$oSet = new DBObjectSet($oFilter);
}
$sHKAttCode = MetaModel::IsHierarchicalClass($this->sTargetClass);
$this->DumpTree($oPage, $oSet, $sHKAttCode, $currValue);
$oPage->add('</td></tr></table>');
$oPage->add('</div>');
$oPage->add("<input type=\"button\" id=\"btn_cancel_{$this->iId}\" value=\"" . Dict::S('UI:Button:Cancel') . "\" onClick=\"\$('#dlg_tree_{$this->iId}').dialog('close');\"> ");
$oPage->add("<input type=\"button\" id=\"btn_ok_{$this->iId}\" value=\"" . Dict::S('UI:Button:Ok') . "\" onClick=\"oACWidget_{$this->iId}.DoHKOk();\">");
$oPage->add('</div></div>');
$oPage->add_ready_script("\$('#tree_{$this->iId} ul').treeview();\n");
$oPage->add_ready_script("\$('#dlg_tree_{$this->iId}').dialog({ width: 'auto', height: 'auto', autoOpen: true, modal: true, title: '{$sDialogTitle}', resizeStop: oACWidget_{$this->iId}.OnHKResize, close: oACWidget_{$this->iId}.OnHKClose });\n");
}
示例6: GetDisplayOption
/**
* Display an option (form, or current value)
*/
protected function GetDisplayOption($sCurrentValue, $oPage, $sFormPrefix, $bEditMode, $sUserOption, $bSelected = true)
{
$sRet = '';
$iCurrentValue = $this->GetMinUpValue($sCurrentValue);
if ($bEditMode) {
$sHtmlNamesPrefix = 'rddcy_' . $this->Get('relation_code') . '_' . $this->Get('from_class') . '_' . $this->Get('neighbour_id');
switch ($sUserOption) {
case self::USER_OPTION_DISABLED:
$sValue = '';
// Empty placeholder
break;
case self::USER_OPTION_ENABLED_COUNT:
if ($bEditMode) {
$sName = $sHtmlNamesPrefix . '_min_up_count';
$sEditValue = $bSelected ? $iCurrentValue : '';
$sValue = '<input class="redundancy-min-up-count" type="string" size="3" name="' . $sName . '" value="' . $sEditValue . '">';
// To fix an issue on Firefox: focus set to the option (because the input is within the label for the option)
$oPage->add_ready_script("\$('[name=\"{$sName}\"]').click(function(){var me=this; setTimeout(function(){\$(me).focus();}, 100);});");
} else {
$sValue = $iCurrentValue;
}
break;
case self::USER_OPTION_ENABLED_PERCENT:
if ($bEditMode) {
$sName = $sHtmlNamesPrefix . '_min_up_percent';
$sEditValue = $bSelected ? $iCurrentValue : '';
$sValue = '<input class="redundancy-min-up-percent" type="string" size="3" name="' . $sName . '" value="' . $sEditValue . '">';
// To fix an issue on Firefox: focus set to the option (because the input is within the label for the option)
$oPage->add_ready_script("\$('[name=\"{$sName}\"]').click(function(){var me=this; setTimeout(function(){\$(me).focus();}, 100);});");
} else {
$sValue = $iCurrentValue;
}
break;
}
$sLabel = sprintf($this->GetUserOptionFormat($sUserOption), $sValue, MetaModel::GetName($this->GetHostClass()));
$sOptionName = $sHtmlNamesPrefix . '_user_option';
$sOptionId = $sOptionName . '_' . $sUserOption;
$sChecked = $bSelected ? 'checked' : '';
$sRet = '<input type="radio" name="' . $sOptionName . '" id="' . $sOptionId . '" value="' . $sUserOption . '"' . $sChecked . '> <label for="' . $sOptionId . '">' . $sLabel . '</label>';
} else {
// Read-only: display only the currently selected option
if ($bSelected) {
$sRet = sprintf($this->GetUserOptionFormat($sUserOption), $iCurrentValue, MetaModel::GetName($this->GetHostClass()));
}
}
return $sRet;
}
示例7: DisplayFinalStep
/**
* Display the final step of the wizard: a confirmation screen
*/
public function DisplayFinalStep($iStepIndex, $aFieldsMap)
{
$oAppContext = new ApplicationContext();
$this->m_oPage->add("<div class=\"wizContainer\" id=\"wizStep{$iStepIndex}\" style=\"display:none;\">\n");
$this->m_oPage->add("<a name=\"step{$iStepIndex}\" />\n");
$this->m_oPage->P(Dict::S('UI:Wizard:FinalStepTitle'));
$this->m_oPage->add("<input type=\"hidden\" name=\"operation\" value=\"wizard_apply_new\" />\n");
$this->m_oPage->add("<input type=\"hidden\" name=\"transaction_id\" value=\"" . utils::GetNewTransactionId() . "\" />\n");
$this->m_oPage->add("<input type=\"hidden\" id=\"wizard_json_obj\" name=\"json_obj\" value=\"\" />\n");
$sScript = "function OnEnterStep{$iStepIndex}() {\n";
foreach ($aFieldsMap as $iInputId => $sAttCode) {
$sScript .= "\toWizardHelper.UpdateCurrentValue('{$sAttCode}');\n";
}
$sScript .= "\toWizardHelper.Preview('object_preview');\n";
$sScript .= "\t\$('#wizard_json_obj').val(oWizardHelper.ToJSON());\n";
$sScript .= "}\n";
$this->m_oPage->add_script($sScript);
$this->m_oPage->add("<div id=\"object_preview\">\n");
$this->m_oPage->add("</div>\n");
$this->m_oPage->add($oAppContext->GetForForm());
$this->m_oPage->add("<input type=\"button\" value=\"" . Dict::S('UI:Button:Back') . "\" onClick=\"GoToStep({$iStepIndex}, {$iStepIndex} - 1)\" />");
$this->m_oPage->add("<input type=\"submit\" value=\"Create " . MetaModel::GetName($this->m_sClass) . "\" />\n");
$this->m_oPage->add("</div>\n");
$this->m_oPage->add("</form>\n");
}
示例8: DisplayClassDetails
/**
* Display the details of a given class of objects
*/
function DisplayClassDetails($oPage, $sClass, $sContext)
{
$oPage->add("<h2>" . MetaModel::GetName($sClass) . " ({$sClass}) - " . MetaModel::GetClassDescription($sClass) . "</h2>\n");
if (MetaModel::IsAbstract($sClass)) {
$oPage->p(Dict::S('UI:Schema:AbstractClass'));
} else {
$oPage->p(Dict::S('UI:Schema:NonAbstractClass'));
}
// $oPage->p("<h3>".Dict::S('UI:Schema:ClassHierarchyTitle')."</h3>");
$aParentClasses = array();
foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) {
$aParentClasses[] = MakeClassHLink($sParentClass, $sContext);
}
if (count($aParentClasses) > 0) {
$sParents = implode(' >> ', $aParentClasses) . " >> <b>{$sClass}</b>";
} else {
$sParents = '';
}
$oPage->p("[<a href=\"schema.php?operation=list{$sContext}\">" . Dict::S('UI:Schema:AllClasses') . "</a>] {$sParents}");
if (MetaModel::HasChildrenClasses($sClass)) {
$oPage->add("<ul id=\"ClassHierarchy\">");
$oPage->add("<li class=\"closed\">" . $sClass . "\n");
DisplaySubclasses($oPage, $sClass, $sContext);
$oPage->add("</li>\n");
$oPage->add("</ul>\n");
$oPage->add_ready_script('$("#ClassHierarchy").treeview();');
}
$oPage->p('');
$oPage->AddTabContainer('details');
$oPage->SetCurrentTabContainer('details');
// List the attributes of the object
$aForwardChangeTracking = MetaModel::GetTrackForwardExternalKeys($sClass);
$aDetails = array();
foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) {
if ($oAttDef->IsExternalKey()) {
$sValue = Dict::Format('UI:Schema:ExternalKey_To', MakeClassHLink($oAttDef->GetTargetClass(), $sContext));
if (array_key_exists($sAttCode, $aForwardChangeTracking)) {
$oLinkSet = $aForwardChangeTracking[$sAttCode];
$sRemoteClass = $oLinkSet->GetHostClass();
$sValue = $sValue . "<span title=\"Forward changes to {$sRemoteClass}\">*</span>";
}
} elseif ($oAttDef->IsLinkSet()) {
$sValue = MakeClassHLink($oAttDef->GetLinkedClass(), $sContext);
} else {
$sValue = $oAttDef->GetDescription();
}
$sType = $oAttDef->GetType() . ' (' . $oAttDef->GetTypeDesc() . ')';
$sOrigin = MetaModel::GetAttributeOrigin($sClass, $sAttCode);
$sAllowedValues = "";
$sMoreInfo = "";
$aCols = array();
foreach ($oAttDef->GetSQLColumns() as $sCol => $sFieldDesc) {
$aCols[] = "{$sCol}: {$sFieldDesc}";
}
if (count($aCols) > 0) {
$sCols = implode(', ', $aCols);
$aMoreInfo = array();
$aMoreInfo[] = Dict::Format('UI:Schema:Columns_Description', $sCols);
$aMoreInfo[] = Dict::Format('UI:Schema:Default_Description', $oAttDef->GetDefaultValue());
$aMoreInfo[] = $oAttDef->IsNullAllowed() ? Dict::S('UI:Schema:NullAllowed') : Dict::S('UI:Schema:NullNotAllowed');
$sMoreInfo .= implode(', ', $aMoreInfo);
}
if ($oAttDef instanceof AttributeEnum) {
// Display localized values for the enum (which depend on the localization provided by the class)
$aLocalizedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, array());
$aDescription = array();
foreach ($aLocalizedValues as $val => $sDisplay) {
$aDescription[] = htmlentities("{$val} => ", ENT_QUOTES, 'UTF-8') . $sDisplay;
}
$sAllowedValues = implode(', ', $aDescription);
} else {
$sAllowedValues = '';
}
$aDetails[] = array('code' => $oAttDef->GetCode(), 'type' => $sType, 'origin' => $sOrigin, 'label' => $oAttDef->GetLabel(), 'description' => $sValue, 'values' => $sAllowedValues, 'moreinfo' => $sMoreInfo);
}
$oPage->SetCurrentTab(Dict::S('UI:Schema:Attributes'));
$aConfig = array('code' => array('label' => Dict::S('UI:Schema:AttributeCode'), 'description' => Dict::S('UI:Schema:AttributeCode+')), 'label' => array('label' => Dict::S('UI:Schema:Label'), 'description' => Dict::S('UI:Schema:Label+')), 'type' => array('label' => Dict::S('UI:Schema:Type'), 'description' => Dict::S('UI:Schema:Type+')), 'origin' => array('label' => Dict::S('UI:Schema:Origin'), 'description' => Dict::S('UI:Schema:Origin+')), 'description' => array('label' => Dict::S('UI:Schema:Description'), 'description' => Dict::S('UI:Schema:Description+')), 'values' => array('label' => Dict::S('UI:Schema:AllowedValues'), 'description' => Dict::S('UI:Schema:AllowedValues+')), 'moreinfo' => array('label' => Dict::S('UI:Schema:MoreInfo'), 'description' => Dict::S('UI:Schema:MoreInfo+')));
$oPage->table($aConfig, $aDetails);
// List the search criteria for this object
$aDetails = array();
foreach (MetaModel::GetClassFilterDefs($sClass) as $sFilterCode => $oFilterDef) {
$aOpDescs = array();
foreach ($oFilterDef->GetOperators() as $sOpCode => $sOpDescription) {
$sIsTheLooser = $sOpCode == $oFilterDef->GetLooseOperator() ? " (loose search)" : "";
$aOpDescs[] = "{$sOpCode} ({$sOpDescription}){$sIsTheLooser}";
}
$aDetails[] = array('code' => $sFilterCode, 'description' => $oFilterDef->GetLabel(), 'operators' => implode(" / ", $aOpDescs));
}
$oPage->SetCurrentTab(Dict::S('UI:Schema:SearchCriteria'));
$aConfig = array('code' => array('label' => Dict::S('UI:Schema:FilterCode'), 'description' => Dict::S('UI:Schema:FilterCode+')), 'description' => array('label' => Dict::S('UI:Schema:FilterDescription'), 'description' => Dict::S('UI:Schema:FilterDescription+')), 'operators' => array('label' => Dict::S('UI:Schema:AvailOperators'), 'description' => Dict::S('UI:Schema:AvailOperators+')));
$oPage->table($aConfig, $aDetails);
$oPage->SetCurrentTab(Dict::S('UI:Schema:ChildClasses'));
DisplaySubclasses($oPage, $sClass, $sContext);
$oPage->SetCurrentTab(Dict::S('UI:Schema:ReferencingClasses'));
DisplayReferencingClasses($oPage, $sClass, $sContext);
$oPage->SetCurrentTab(Dict::S('UI:Schema:RelatedClasses'));
DisplayRelatedClasses($oPage, $sClass, $sContext);
//.........这里部分代码省略.........
示例9: DisplayNavigatorGraphicsTab
function DisplayNavigatorGraphicsTab($oP, $aResults, $sClass, $id, $sRelation, $oAppContext)
{
$oP->SetCurrentTab(Dict::S('UI:RelationshipGraph'));
$oP->add("<div id=\"ds_flash\" class=\"SearchDrawer\">\n");
$oP->add_ready_script(<<<EOF
\t\$("#dh_flash").click( function() {
\t\t\$("#ds_flash").slideToggle('normal', function() { \$("#ds_flash").parent().resize(); } );
\t\t\$("#dh_flash").toggleClass('open');
\t});
EOF
);
$aSortedElements = array();
foreach ($aResults as $sClassIdx => $aObjects) {
foreach ($aObjects as $oCurrObj) {
$sSubClass = get_class($oCurrObj);
$aSortedElements[$sSubClass] = MetaModel::GetName($sSubClass);
}
}
asort($aSortedElements);
$idx = 0;
foreach ($aSortedElements as $sSubClass => $sClassName) {
$oP->add("<span style=\"padding-right:2em; white-space:nowrap;\"><input type=\"checkbox\" id=\"exclude_{$idx}\" name=\"excluded[]\" value=\"{$sSubClass}\" checked onChange=\"\$('#ReloadMovieBtn').button('enable')\"><label for=\"exclude_{$idx}\"> " . MetaModel::GetClassIcon($sSubClass) . " {$sClassName}</label></span> ");
$idx++;
}
$oP->add("<p style=\"text-align:right\"><button type=\"button\" id=\"ReloadMovieBtn\" onClick=\"DoReload()\">" . Dict::S('UI:Button:Refresh') . "</button></p>");
$oP->add("</div>\n");
$oP->add("<div class=\"HRDrawer\"></div>\n");
$oP->add("<div id=\"dh_flash\" class=\"DrawerHandle\">" . Dict::S('UI:ElementsDisplayed') . "</div>\n");
$width = 1000;
$height = 700;
$sDrillUrl = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?operation=details&' . $oAppContext->GetForLink();
$sParams = "pWidth={$width}&pHeight={$height}&drillUrl=" . urlencode($sDrillUrl) . "&displayController=false&xmlUrl=" . urlencode("./xml.navigator.php") . "&obj_class={$sClass}&obj_id={$id}&relation={$sRelation}";
$oP->add("<div style=\"z-index:1;background:white;width:100%;height:{$height}px\"><object style=\"z-index:2\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"100%\" height=\"{$height}\" id=\"navigator\" align=\"middle\">\n\t<param name=\"allowScriptAccess\" value=\"always\" />\n\t<param name=\"allowFullScreen\" value=\"false\" />\n\t<param name=\"FlashVars\" value=\"{$sParams}\" />\n\t<param name=\"wmode\" value=\"transparent\"> \n\t<param name=\"movie\" value=\"../navigator/navigator.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />\n\t<embed src=\"../navigator/navigator.swf\" wmode=\"transparent\" flashVars=\"{$sParams}\" quality=\"high\" bgcolor=\"#ffffff\" width=\"100%\" height=\"{$height}\" name=\"navigator\" align=\"middle\" swliveconnect=\"true\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" />\n\t</object></div>\n");
$oP->add_script(<<<EOF
function getFlashMovieObject(movieName)
{
if (window.document[movieName])
{
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}
}\t
\tfunction DoReload()
\t{
\t\t\$('#ReloadMovieBtn').button('disable');
\t\tvar oMovie = getFlashMovieObject('navigator');
\t\ttry
\t\t{
\t\t\tvar aExcluded = [];
\t\t\t\$('input[name^=excluded]').each( function() {
\t\t\t\tif (!\$(this).attr('checked'))
\t\t\t\t{
\t\t\t\t\taExcluded.push(\$(this).val());
\t\t\t\t}
\t\t\t} );
\t\t\toMovie.Filter(aExcluded.join(','));
\t\t//oMovie.SetVariable("/:message", "foo");
\t\t}
\t\tcatch(err)
\t\t{
\t\t\talert(err);
\t\t}
\t}
EOF
);
$oP->add_ready_script(<<<EOF
\tvar ajax_request = null;
\t\$('#ReloadMovieBtn').button().button('disable');
\t
\tfunction UpdateImpactedObjects(sClass, iId, sRelation)
\t{
\t\tvar class_name = sClass; //\$('select[name=class_name]').val();
\t\tif (class_name != '')
\t\t{
\t\t\t\$('#impacted_objects').block();
\t
\t\t\t// Make sure that we cancel any pending request before issuing another
\t\t\t// since responses may arrive in arbitrary order
\t\t\tif (ajax_request != null)
\t\t\t{
\t\t\t\tajax_request.abort();
\t\t\t\tajax_request = null;
\t\t\t}
\t
\t\t\tajax_request = \$.get(GetAbsoluteUrlAppRoot()+'pages/xml.navigator.php', { 'class': sClass, id: iId, relation: sRelation, format: 'html' },
\t\t\t\t\tfunction(data)
\t\t\t\t\t{
\t\t\t\t\t\t\$('#impacted_objects').empty();
\t\t\t\t\t\t\$('#impacted_objects').append(data);
\t\t\t\t\t\t\$('#impacted_objects').unblock();
\t\t\t\t\t}
//.........这里部分代码省略.........
示例10: LoadValues
protected function LoadValues($aArgs)
{
// Call the parent to parse the additional values...
parent::LoadValues($aArgs);
// Translate the labels of the additional values
foreach ($this->m_aValues as $sClass => $void) {
if (MetaModel::IsValidClass($sClass)) {
$this->m_aValues[$sClass] = MetaModel::GetName($sClass);
} else {
unset($this->m_aValues[$sClass]);
}
}
// Then, add the classes from the category definition
foreach (MetaModel::GetClasses($this->m_sCategories) as $sClass) {
if (MetaModel::IsValidClass($sClass)) {
$this->m_aValues[$sClass] = MetaModel::GetName($sClass);
} else {
unset($this->m_aValues[$sClass]);
}
}
return true;
}
示例11: array
$oP->add_linked_script("../js/linkswidget.js");
$oP->add_linked_script("../js/extkeywidget.js");
$oP->add_linked_script("../js/jquery.blockUI.js");
// From now on the context is limited to the the selected organization ??
// Now render the content of the page
$sBaseClass = utils::ReadParam('baseClass', 'Organization', false, 'class');
$sClass = utils::ReadParam('class', $sBaseClass, false, 'class');
$sOQLClause = utils::ReadParam('oql_clause', '', false, 'raw_data');
$sFilter = utils::ReadParam('filter', '', false, 'raw_data');
$sOperation = utils::ReadParam('operation', '');
// First part: select the class to search for
$oP->add("<form>");
$oP->add(Dict::S('UI:UniversalSearch:LabelSelectTheClass') . "<select style=\"width: 150px;\" id=\"select_class\" name=\"baseClass\" onChange=\"this.form.submit();\">");
$aClassLabels = array();
foreach (MetaModel::GetClasses('bizmodel') as $sCurrentClass) {
$aClassLabels[$sCurrentClass] = MetaModel::GetName($sCurrentClass);
}
asort($aClassLabels);
foreach ($aClassLabels as $sCurrentClass => $sLabel) {
$sDescription = MetaModel::GetClassDescription($sCurrentClass);
$sSelected = $sCurrentClass == $sBaseClass ? " SELECTED" : "";
$oP->add("<option value=\"{$sCurrentClass}\" title=\"{$sDescription}\"{$sSelected}>{$sLabel}</option>");
}
$oP->add("</select>\n");
$oP->add($oAppContext->GetForForm());
$oP->add("</form>\n");
try {
if ($sOperation == 'search_form') {
$sOQL = "SELECT {$sClass} {$sOQLClause}";
$oFilter = DBObjectSearch::FromOQL($sOQL);
} else {
示例12: GetObjectPickerDialog
public function GetObjectPickerDialog($oPage, $oCurrentObj)
{
$sHtml = "<div class=\"wizContainer\" style=\"vertical-align:top;\">\n";
$oFilter = new DBObjectSearch($this->m_sRemoteClass);
$this->SetSearchDefaultFromContext($oCurrentObj, $oFilter);
$oBlock = new DisplayBlock($oFilter, 'search', false);
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}", array('open' => true));
$sHtml .= "<form id=\"ObjectsAddForm_{$this->m_sAttCode}{$this->m_sNameSuffix}\" OnSubmit=\"return oWidget{$this->m_iInputId}.DoAddObjects(this.id);\">\n";
$sHtml .= "<div id=\"SearchResultsToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}\" style=\"vertical-align:top;background: #fff;height:100%;overflow:auto;padding:0;border:0;\">\n";
$sHtml .= "<div style=\"background: #fff; border:0; text-align:center; vertical-align:middle;\"><p>" . Dict::S('UI:Message:EmptyList:UseSearchForm') . "</p></div>\n";
$sHtml .= "</div>\n";
$sHtml .= "<input type=\"hidden\" id=\"count_{$this->m_sAttCode}{$this->m_sNameSuffix}\" value=\"0\"/>";
$sHtml .= "<input type=\"button\" value=\"" . Dict::S('UI:Button:Cancel') . "\" onClick=\"\$('#dlg_{$this->m_sAttCode}{$this->m_sNameSuffix}').dialog('close');\"> <input id=\"btn_ok_{$this->m_sAttCode}{$this->m_sNameSuffix}\" disabled=\"disabled\" type=\"submit\" value=\"" . Dict::S('UI:Button:Add') . "\">";
$sHtml .= "</div>\n";
$sHtml .= "</form>\n";
$oPage->add($sHtml);
$oPage->add_ready_script("\$('#dlg_{$this->m_sAttCode}{$this->m_sNameSuffix}').dialog({ width: \$(window).width()*0.8, height: \$(window).height()*0.8, autoOpen: false, modal: true, resizeStop: oWidget{$this->m_iInputId}.UpdateSizes });");
$oPage->add_ready_script("\$('#dlg_{$this->m_sAttCode}{$this->m_sNameSuffix}').dialog('option', {title:'" . addslashes(Dict::Format('UI:AddObjectsOf_Class_LinkedWith_Class', MetaModel::GetName($this->m_sLinkedClass), MetaModel::GetName($this->m_sClass))) . "'});");
$oPage->add_ready_script("\$('#SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix} form').bind('submit.uilinksWizard', oWidget{$this->m_iInputId}.SearchObjectsToAdd);");
$oPage->add_ready_script("\$('#SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}').resize(oWidget{$this->m_iInputId}.UpdateSizes);");
}
示例13: DoShowGrantSumary
function DoShowGrantSumary($oPage, $sClassCategory)
{
if (UserRights::IsAdministrator($this)) {
// Looks dirty, but ok that's THE ONE
$oPage->p(Dict::S('UI:UserManagement:AdminProfile+'));
return;
}
$oKPI = new ExecutionKPI();
$aDisplayData = array();
foreach (MetaModel::GetClasses($sClassCategory) as $sClass) {
$aClassStimuli = MetaModel::EnumStimuli($sClass);
if (count($aClassStimuli) > 0) {
$aStimuli = array();
foreach ($aClassStimuli as $sStimulusCode => $oStimulus) {
if (UserRights::IsStimulusAllowed($sClass, $sStimulusCode, null, $this)) {
$aStimuli[] = '<span title="' . $sStimulusCode . ': ' . htmlentities($oStimulus->GetDescription(), ENT_QUOTES, 'UTF-8') . '">' . htmlentities($oStimulus->GetLabel(), ENT_QUOTES, 'UTF-8') . '</span>';
}
}
$sStimuli = implode(', ', $aStimuli);
} else {
$sStimuli = '<em title="' . Dict::S('UI:UserManagement:NoLifeCycleApplicable+') . '">' . Dict::S('UI:UserManagement:NoLifeCycleApplicable') . '</em>';
}
$aDisplayData[] = array('class' => MetaModel::GetName($sClass), 'read' => $this->GetGrantAsHtml($sClass, UR_ACTION_READ), 'bulkread' => $this->GetGrantAsHtml($sClass, UR_ACTION_BULK_READ), 'write' => $this->GetGrantAsHtml($sClass, UR_ACTION_MODIFY), 'bulkwrite' => $this->GetGrantAsHtml($sClass, UR_ACTION_BULK_MODIFY), 'stimuli' => $sStimuli);
}
$oKPI->ComputeAndReport('Computation of user rights');
$aDisplayConfig = array();
$aDisplayConfig['class'] = array('label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+'));
$aDisplayConfig['read'] = array('label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+'));
$aDisplayConfig['bulkread'] = array('label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+'));
$aDisplayConfig['write'] = array('label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+'));
$aDisplayConfig['bulkwrite'] = array('label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+'));
$aDisplayConfig['stimuli'] = array('label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+'));
$oPage->table($aDisplayConfig, $aDisplayData);
}
示例14: GetObjectCreationDlg
public function GetObjectCreationDlg(WebPage $oPage, $sProposedRealClass = '')
{
// For security reasons: check that the "proposed" class is actually a subclass of the linked class
// and that the current user is allowed to create objects of this class
$sRealClass = '';
$oPage->add('<div class="wizContainer" style="vertical-align:top;"><div>');
$aSubClasses = MetaModel::EnumChildClasses($this->sLinkedClass, ENUM_CHILD_CLASSES_ALL);
// Including the specified class itself
$aPossibleClasses = array();
foreach ($aSubClasses as $sCandidateClass) {
if (!MetaModel::IsAbstract($sCandidateClass) && UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES) {
if ($sCandidateClass == $sProposedRealClass) {
$sRealClass = $sProposedRealClass;
}
$aPossibleClasses[$sCandidateClass] = MetaModel::GetName($sCandidateClass);
}
}
// Only one of the subclasses can be instantiated...
if (count($aPossibleClasses) == 1) {
$aKeys = array_keys($aPossibleClasses);
$sRealClass = $aKeys[0];
}
if ($sRealClass != '') {
$oPage->add("<h1>" . MetaModel::GetClassIcon($sRealClass) . " " . Dict::Format('UI:CreationTitle_Class', MetaModel::GetName($sRealClass)) . "</h1>\n");
$oLinksetDef = MetaModel::GetAttributeDef($this->sClass, $this->sAttCode);
$sExtKeyToMe = $oLinksetDef->GetExtKeyToMe();
$aFieldFlags = array($sExtKeyToMe => OPT_ATT_HIDDEN);
cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, null, array(), array('formPrefix' => $this->sInputid, 'noRelations' => true, 'fieldsFlags' => $aFieldFlags));
} else {
$sClassLabel = MetaModel::GetName($this->sLinkedClass);
$oPage->add('<p>' . Dict::Format('UI:SelectTheTypeOf_Class_ToCreate', $sClassLabel));
$oPage->add('<nobr><select name="class">');
asort($aPossibleClasses);
foreach ($aPossibleClasses as $sClassName => $sClassLabel) {
$oPage->add("<option value=\"{$sClassName}\">{$sClassLabel}</option>");
}
$oPage->add('</select>');
$oPage->add(' <button type="button" onclick="$(\'#' . $this->sInputid . '\').directlinks(\'subclassSelected\');">' . Dict::S('UI:Button:Apply') . '</button><span class="indicator" style="display:inline-block;width:16px"></span></nobr></p>');
}
$oPage->add('</div></div>');
}
示例15: DisplayRequestLists
/**
* Helper to display lists (UserRequest, Incident, etc.)
* Adjust the presentation depending on the following cases:
* - no item at all
* - items of one class only
* - items of several classes
*/
function DisplayRequestLists(WebPage $oP, $aClassToSet)
{
$iNotEmpty = 0;
// Count of types for which there are some items to display
foreach ($aClassToSet as $sClass => $oSet) {
if ($oSet->Count() > 0) {
$iNotEmpty++;
}
}
if ($iNotEmpty == 0) {
$oP->p(Dict::S('Portal:NoOpenRequest'));
} else {
foreach ($aClassToSet as $sClass => $oSet) {
if ($iNotEmpty > 1) {
// Differentiate the sublists
$oP->add("<h2>" . MetaModel::GetName($sClass) . "</h2>\n");
}
if ($oSet->Count() > 0) {
$sZList = GetConstant($sClass, 'LIST_ZLIST');
$aZList = explode(',', $sZList);
$oP->DisplaySet($oSet, $aZList, Dict::S('Portal:NoOpenRequest'));
}
}
}
}