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


PHP MetaModel::EnumPlugins方法代码示例

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


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

示例1: session_id

     break;
 case 'set_pref':
     $sCode = utils::ReadPostedParam('code', '');
     $sValue = utils::ReadPostedParam('value', '', 'raw_data');
     appUserPreferences::SetPref($sCode, $sValue);
     break;
 case 'erase_all_pref':
     // Can be useful in case a user got some corrupted prefs...
     appUserPreferences::ClearPreferences();
     break;
 case 'on_form_cancel':
     // Called when a creation/modification form is cancelled by the end-user
     // Let's take this opportunity to inform the plug-ins so that they can perform some cleanup
     $iTransactionId = utils::ReadParam('transaction_id', 0);
     $sTempId = session_id() . '_' . $iTransactionId;
     foreach (MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance) {
         $oExtensionInstance->OnFormCancel($sTempId);
     }
     break;
 case 'reload_dashboard':
     $oPage->SetContentType('text/html');
     $sDashboardId = utils::ReadParam('dashboard_id', '', false, 'raw_data');
     $aExtraParams = utils::ReadParam('extra_params', '', false, 'raw_data');
     ApplicationMenu::LoadAdditionalMenus();
     $idx = ApplicationMenu::GetMenuIndexById($sDashboardId);
     $oMenu = ApplicationMenu::GetMenuNode($idx);
     $oDashboard = $oMenu->GetDashboard();
     $oDashboard->Render($oPage, false, $aExtraParams);
     break;
 case 'dashboard_editor':
     $sId = utils::ReadParam('id', '', false, 'raw_data');
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:31,代码来源:ajax.render.php

示例2: DoCheckToDelete

 protected function DoCheckToDelete(&$oDeletionPlan)
 {
     parent::DoCheckToDelete($oDeletionPlan);
     // Plugins
     //
     foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) {
         $aNewIssues = $oExtensionInstance->OnCheckToDelete($this);
         if (count($aNewIssues) > 0) {
             $this->m_aDeleteIssues = array_merge($this->m_aDeleteIssues, $aNewIssues);
         }
     }
     // User rights
     //
     $bDeleteAllowed = UserRights::IsActionAllowed(get_class($this), UR_ACTION_DELETE, DBObjectSet::FromObject($this));
     if (!$bDeleteAllowed) {
         // Security issue
         $this->m_bSecurityIssue = true;
         $this->m_aDeleteIssues[] = Dict::S('UI:Delete:NotAllowedToDelete');
     }
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:20,代码来源:cmdbabstract.class.inc.php

示例3: GetRenderContent


//.........这里部分代码省略.........
                     if (!is_null($oUser)) {
                         $oProfileSet = $oUser->Get('profile_list');
                         while ($oProfile = $oProfileSet->Fetch()) {
                             $aUserProfiles[$oProfile->Get('profile')] = true;
                         }
                     }
                     foreach ($aAllowedProfiles as $sProfile) {
                         if (array_key_exists($sProfile, $aUserProfiles)) {
                             $bCanKill = true;
                             break;
                         }
                     }
                     if ($bCanKill) {
                         $this->AddMenuSeparator($aActions);
                         $aActions['concurrent_lock_unlock'] = array('label' => Dict::S('UI:Menu:KillConcurrentLock'), 'url' => "{$sRootUrl}pages/{$sUIPage}?operation=kill_lock&class={$sClass}&id={$id}{$sContext}");
                     }
                 }
                 /*
                 $this->AddMenuSeparator($aActions);
                 // Static menus: Email this page & CSV Export
                 $sUrl = ApplicationContext::MakeObjectUrl($sClass, $id);
                 $aActions['UI:Menu:EMail'] = array ('label' => Dict::S('UI:Menu:EMail'), 'url' => "mailto:?subject=".urlencode($oObj->GetRawName())."&body=".urlencode($sUrl));
                 $aActions['UI:Menu:CSVExport'] = array ('label' => Dict::S('UI:Menu:CSVExport'), 'url' => "{$sRootUrl}pages/$sUIPage?operation=search&filter=".urlencode($sFilter)."&format=csv{$sContext}");
                 // The style tells us whether the menu is displayed on a list of one object, or on the details of the given object 
                 if ($this->m_sStyle == 'list')
                 {
                 	// Actions specific to the list
                 	$sOQL = addslashes($sFilterDesc);
                 	$aActions['UI:Menu:AddToDashboard'] = array ('label' => Dict::S('UI:Menu:AddToDashboard'), 'url' => "#", 'onclick' => "return DashletCreationDlg('$sOQL')");
                 }
                 */
             }
             $this->AddMenuSeparator($aActions);
             foreach (MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance) {
                 $oSet->Rewind();
                 foreach ($oExtensionInstance->EnumAllowedActions($oSet) as $sLabel => $sUrl) {
                     $aActions[$sLabel] = array('label' => $sLabel, 'url' => $sUrl);
                 }
             }
             break;
         default:
             // Check rights
             // New / Modify
             $bIsModifyAllowed = UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY, $oSet) && $oReflectionClass->IsSubclassOf('cmdbAbstractObject');
             $bIsBulkModifyAllowed = !MetaModel::IsAbstract($sClass) && UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_MODIFY, $oSet) && $oReflectionClass->IsSubclassOf('cmdbAbstractObject');
             $bIsBulkDeleteAllowed = UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_DELETE, $oSet);
             if (isset($aExtraParams['link_attr'])) {
                 $id = $aExtraParams['object_id'];
                 $sTargetAttr = $aExtraParams['target_attr'];
                 $oAttDef = MetaModel::GetAttributeDef($sClass, $sTargetAttr);
                 $sTargetClass = $oAttDef->GetTargetClass();
                 $bIsDeleteAllowed = UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, $oSet);
                 if ($bIsModifyAllowed) {
                     $aActions['UI:Menu:Add'] = array('label' => Dict::S('UI:Menu:Add'), 'url' => "{$sRootUrl}pages/{$sUIPage}?operation=modify_links&class={$sClass}&link_attr=" . $aExtraParams['link_attr'] . "&target_class={$sTargetClass}&id={$id}&addObjects=true{$sContext}");
                 }
                 if ($bIsBulkModifyAllowed) {
                     $aActions['UI:Menu:Manage'] = array('label' => Dict::S('UI:Menu:Manage'), 'url' => "{$sRootUrl}pages/{$sUIPage}?operation=modify_links&class={$sClass}&link_attr=" . $aExtraParams['link_attr'] . "&target_class={$sTargetClass}&id={$id}{$sContext}");
                 }
                 //if ($bIsBulkDeleteAllowed) { $aActions[] = array ('label' => 'Remove All...', 'url' => "#"); }
             } else {
                 // many objects in the set, possible actions are: new / modify all / delete all
                 if ($bIsCreationAllowed) {
                     $aActions['UI:Menu:New'] = array('label' => Dict::S('UI:Menu:New'), 'url' => "{$sRootUrl}pages/{$sUIPage}?operation=new&class={$sClass}{$sContext}{$sDefault}");
                 }
                 if ($bIsBulkModifyAllowed) {
                     $aActions['UI:Menu:ModifyAll'] = array('label' => Dict::S('UI:Menu:ModifyAll'), 'url' => "{$sRootUrl}pages/{$sUIPage}?operation=select_for_modify_all&class={$sClass}&filter=" . urlencode($sFilter) . "{$sContext}");
开发者ID:henryavila,项目名称:itop,代码行数:67,代码来源:displayblock.class.inc.php

示例4: output

    /**
     * Outputs (via some echo) the complete HTML page by assembling all its elements
     */
    public function output()
    {
        $sAbsURLAppRoot = addslashes($this->m_sRootUrl);
        //$this->set_base($this->m_sRootUrl.'pages/');
        $sForm = $this->GetSiloSelectionForm();
        $this->DisplayMenu();
        // Compute the menu
        // Call the extensions to add content to the page, so that they can also add styles or scripts
        $sBannerExtraHtml = '';
        foreach (MetaModel::EnumPlugins('iPageUIExtension') as $oExtensionInstance) {
            $sBannerExtraHtml .= $oExtensionInstance->GetBannerHtml($this);
        }
        $sNorthPane = '';
        foreach (MetaModel::EnumPlugins('iPageUIExtension') as $oExtensionInstance) {
            $sNorthPane .= $oExtensionInstance->GetNorthPaneHtml($this);
        }
        if (UserRights::IsAdministrator() && ExecutionKPI::IsEnabled()) {
            $sNorthPane .= '<div id="admin-banner"><span style="padding:5px;">' . ExecutionKPI::GetDescription() . '<span></div>';
        }
        //$sSouthPane = '<p>Peak memory Usage: '.sprintf('%.3f MB', memory_get_peak_usage(true) / (1024*1024)).'</p>';
        $sSouthPane = '';
        foreach (MetaModel::EnumPlugins('iPageUIExtension') as $oExtensionInstance) {
            $sSouthPane .= $oExtensionInstance->GetSouthPaneHtml($this);
        }
        // Put here the 'ready scripts' that must be executed after all others
        $aMultiselectOptions = array('header' => true, 'checkAllText' => Dict::S('UI:SearchValue:CheckAll'), 'uncheckAllText' => Dict::S('UI:SearchValue:UncheckAll'), 'noneSelectedText' => Dict::S('UI:SearchValue:Any'), 'selectedText' => Dict::S('UI:SearchValue:NbSelected'), 'selectedList' => 1);
        $sJSMultiselectOptions = json_encode($aMultiselectOptions);
        $this->add_ready_script(<<<EOF
\t\t// Since the event is only triggered when the hash changes, we need to trigger
\t\t// the event now, to handle the hash the page may have loaded with.
\t\t\$(window).trigger( 'hashchange' );
\t\t
\t\t// Some table are sort-able, some are not, let's fix this
\t\t\$('table.listResults').each( function() { FixTableSorter(\$(this)); } );
\t\t
\t\t\$('.multiselect').multiselect({$sJSMultiselectOptions});

\t\tFixSearchFormsDisposition();

EOF
);
        if ($this->GetOutputFormat() == 'html') {
            foreach ($this->a_headers as $s_header) {
                header($s_header);
            }
        }
        $s_captured_output = $this->ob_get_clean_safe();
        $sHtml = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
        $sHtml .= "<html>\n";
        $sHtml .= "<head>\n";
        // Make sure that Internet Explorer renders the page using its latest/highest/greatest standards !
        $sHtml .= "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n";
        $sHtml .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
        $sHtml .= "<title>" . htmlentities($this->s_title, ENT_QUOTES, 'UTF-8') . "</title>\n";
        $sHtml .= $this->get_base_tag();
        // Stylesheets MUST be loaded before any scripts otherwise
        // jQuery scripts may face some spurious problems (like failing on a 'reload')
        foreach ($this->a_linked_stylesheets as $a_stylesheet) {
            if ($a_stylesheet['condition'] != "") {
                $sHtml .= "<!--[if {$a_stylesheet['condition']}]>\n";
            }
            $sHtml .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$a_stylesheet['link']}\" />\n";
            if ($a_stylesheet['condition'] != "") {
                $sHtml .= "<![endif]-->\n";
            }
        }
        // special stylesheet for printing, hides the navigation gadgets
        $sHtml .= "<link rel=\"stylesheet\" media=\"print\" type=\"text/css\" href=\"../css/print.css\" />\n";
        if ($this->GetOutputFormat() == 'html') {
            $sHtml .= $this->output_dict_entries(true);
            // before any script so that they can benefit from the translations
            foreach ($this->a_linked_scripts as $s_script) {
                // Make sure that the URL to the script contains the application's version number
                // so that the new script do NOT get reloaded from the cache when the application is upgraded
                if (strpos($s_script, '?') === false) {
                    $s_script .= "?itopversion=" . ITOP_VERSION;
                } else {
                    $s_script .= "&itopversion=" . ITOP_VERSION;
                }
                $sHtml .= "<script type=\"text/javascript\" src=\"{$s_script}\"></script>\n";
            }
            $this->add_script("var iPaneVisWatchDog  = window.setTimeout('FixPaneVis()',5000);\n\$(document).ready(function() {\n{$this->m_sInitScript};\nwindow.setTimeout('onDelayedReady()',10)\n});");
            if (count($this->m_aReadyScripts) > 0) {
                $this->add_script("\nonDelayedReady = function() {\n" . implode("\n", $this->m_aReadyScripts) . "\n}\n");
            }
            if (count($this->a_scripts) > 0) {
                $sHtml .= "<script type=\"text/javascript\">\n";
                foreach ($this->a_scripts as $s_script) {
                    $sHtml .= "{$s_script}\n";
                }
                $sHtml .= "</script>\n";
            }
        }
        if (count($this->a_styles) > 0) {
            $sHtml .= "<style>\n";
            foreach ($this->a_styles as $s_style) {
                $sHtml .= "{$s_style}\n";
//.........这里部分代码省略.........
开发者ID:henryavila,项目名称:itop,代码行数:101,代码来源:itopwebpage.class.inc.php

示例5: MakeSQLObjectQuerySingleTable

 protected function MakeSQLObjectQuerySingleTable(&$oBuild, $aAttToLoad, $sTableClass, $aExtKeys, $aValues)
 {
     // $aExtKeys is an array of sTableClass => array of (sAttCode (keys) => array of sAttCode (fields))
     //echo "MakeSQLObjectQuery($sTableClass)-liste des clefs externes($sTableClass): <pre>".print_r($aExtKeys, true)."</pre><br/>\n";
     // Prepare the query for a single table (compound objects)
     // Ignores the items (attributes/filters) that are not on the target table
     // Perform an (inner or left) join for every external key (and specify the expected fields)
     //
     // Returns an SQLQuery
     //
     $sTargetClass = $this->GetFirstJoinedClass();
     $sTargetAlias = $this->GetFirstJoinedClassAlias();
     $sTable = MetaModel::DBGetTable($sTableClass);
     $sTableAlias = $oBuild->GenerateTableAlias($sTargetAlias . '_' . $sTable, $sTable);
     $aTranslation = array();
     $aExpectedAtts = array();
     $oBuild->m_oQBExpressions->GetUnresolvedFields($sTargetAlias, $aExpectedAtts);
     $bIsOnQueriedClass = array_key_exists($sTargetAlias, $oBuild->GetRootFilter()->GetSelectedClasses());
     self::DbgTrace("Entering: tableclass={$sTableClass}, filter=" . $this->ToOQL() . ", " . ($bIsOnQueriedClass ? "MAIN" : "SECONDARY"));
     // 1 - SELECT and UPDATE
     //
     // Note: no need for any values nor fields for foreign Classes (ie not the queried Class)
     //
     $aUpdateValues = array();
     // 1/a - Get the key and friendly name
     //
     // We need one pkey to be the key, let's take the first one available
     $oSelectedIdField = null;
     $oIdField = new FieldExpressionResolved(MetaModel::DBGetKey($sTableClass), $sTableAlias);
     $aTranslation[$sTargetAlias]['id'] = $oIdField;
     if ($bIsOnQueriedClass) {
         // Add this field to the list of queried fields (required for the COUNT to work fine)
         $oSelectedIdField = $oIdField;
     }
     // 1/b - Get the other attributes
     //
     foreach (MetaModel::ListAttributeDefs($sTableClass) as $sAttCode => $oAttDef) {
         // Skip this attribute if not defined in this table
         if (MetaModel::GetAttributeOrigin($sTargetClass, $sAttCode) != $sTableClass) {
             continue;
         }
         // Skip this attribute if not made of SQL columns
         if (count($oAttDef->GetSQLExpressions()) == 0) {
             continue;
         }
         // Update...
         //
         if ($bIsOnQueriedClass && array_key_exists($sAttCode, $aValues)) {
             assert($oAttDef->IsDirectField());
             foreach ($oAttDef->GetSQLValues($aValues[$sAttCode]) as $sColumn => $sValue) {
                 $aUpdateValues[$sColumn] = $sValue;
             }
         }
     }
     // 2 - The SQL query, for this table only
     //
     $oSelectBase = new SQLObjectQuery($sTable, $sTableAlias, array(), $bIsOnQueriedClass, $aUpdateValues, $oSelectedIdField);
     // 3 - Resolve expected expressions (translation table: alias.attcode => table.column)
     //
     foreach (MetaModel::ListAttributeDefs($sTableClass) as $sAttCode => $oAttDef) {
         // Skip this attribute if not defined in this table
         if (MetaModel::GetAttributeOrigin($sTargetClass, $sAttCode) != $sTableClass) {
             continue;
         }
         // Select...
         //
         if ($oAttDef->IsExternalField()) {
             // skip, this will be handled in the joined tables (done hereabove)
         } else {
             //echo "<p>MakeSQLObjectQuerySingleTable: Field $sAttCode is part of the table $sTable (named: $sTableAlias)</p>";
             // standard field, or external key
             // add it to the output
             foreach ($oAttDef->GetSQLExpressions() as $sColId => $sSQLExpr) {
                 if (array_key_exists($sAttCode . $sColId, $aExpectedAtts)) {
                     $oFieldSQLExp = new FieldExpressionResolved($sSQLExpr, $sTableAlias);
                     foreach (MetaModel::EnumPlugins('iQueryModifier') as $sPluginClass => $oQueryModifier) {
                         $oFieldSQLExp = $oQueryModifier->GetFieldExpression($oBuild, $sTargetClass, $sAttCode, $sColId, $oFieldSQLExp, $oSelectBase);
                     }
                     $aTranslation[$sTargetAlias][$sAttCode . $sColId] = $oFieldSQLExp;
                 }
             }
         }
     }
     //echo "MakeSQLObjectQuery- Classe $sTableClass<br/>\n";
     // 4 - The external keys -> joins...
     //
     $aAllPointingTo = $this->GetCriteria_PointingTo();
     if (array_key_exists($sTableClass, $aExtKeys)) {
         foreach ($aExtKeys[$sTableClass] as $sKeyAttCode => $aExtFields) {
             $oKeyAttDef = MetaModel::GetAttributeDef($sTableClass, $sKeyAttCode);
             $aPointingTo = $this->GetCriteria_PointingTo($sKeyAttCode);
             //echo "MakeSQLObjectQuery-Cle '$sKeyAttCode'<br/>\n";
             if (!array_key_exists(TREE_OPERATOR_EQUALS, $aPointingTo)) {
                 //echo "MakeSQLObjectQuery-Ajoutons l'operateur TREE_OPERATOR_EQUALS pour $sKeyAttCode<br/>\n";
                 // The join was not explicitely defined in the filter,
                 // we need to do it now
                 $sKeyClass = $oKeyAttDef->GetTargetClass();
                 $sKeyClassAlias = $oBuild->GenerateClassAlias($sKeyClass . '_' . $sKeyAttCode, $sKeyClass);
                 $oExtFilter = new DBObjectSearch($sKeyClass, $sKeyClassAlias);
                 $aAllPointingTo[$sKeyAttCode][TREE_OPERATOR_EQUALS][$sKeyClassAlias] = $oExtFilter;
//.........这里部分代码省略.........
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:101,代码来源:dbobjectsearch.class.php

示例6: MakeModifierProperties

 public static function MakeModifierProperties($oFilter)
 {
     // Compute query modifiers properties (can be set in the search itself, by the context, etc.)
     //
     $aModifierProperties = array();
     foreach (MetaModel::EnumPlugins('iQueryModifier') as $sPluginClass => $oQueryModifier) {
         // Lowest precedence: the application context
         $aPluginProps = ApplicationContext::GetPluginProperties($sPluginClass);
         // Highest precedence: programmatically specified (or OQL)
         foreach ($oFilter->GetModifierProperties($sPluginClass) as $sProp => $value) {
             $aPluginProps[$sProp] = $value;
         }
         if (count($aPluginProps) > 0) {
             $aModifierProperties[$sPluginClass] = $aPluginProps;
         }
     }
     return $aModifierProperties;
 }
开发者ID:henryavila,项目名称:itop,代码行数:18,代码来源:metamodel.class.php

示例7: GetPopupMenuItems

 /**
  * Merge standard menu items with plugin provided menus items
  */
 public static function GetPopupMenuItems($oPage, $iMenuId, $param, &$aActions, $sTableId = null, $sDataTableId = null)
 {
     // 1st - add standard built-in menu items
     //
     switch ($iMenuId) {
         case iPopupMenuExtension::MENU_OBJLIST_TOOLKIT:
             // $param is a DBObjectSet
             $oAppContext = new ApplicationContext();
             $sContext = $oAppContext->GetForLink();
             $sDataTableId = is_null($sDataTableId) ? '' : $sDataTableId;
             $sUIPage = cmdbAbstractObject::ComputeStandardUIPage($param->GetFilter()->GetClass());
             $sOQL = addslashes($param->GetFilter()->ToOQL(true));
             $sFilter = urlencode($param->GetFilter()->serialize());
             $sUrl = utils::GetAbsoluteUrlAppRoot() . "pages/{$sUIPage}?operation=search&filter=" . $sFilter . "&{$sContext}";
             $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/tabularfieldsselector.js');
             $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/jquery.dragtable.js');
             $oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot() . 'css/dragtable.css');
             $aResult = array(new SeparatorPopupMenuItem(), new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), "mailto:?body=" . urlencode($sUrl) . ' '));
             if (UserRights::IsActionAllowed($param->GetFilter()->GetClass(), UR_ACTION_BULK_READ, $param) && (UR_ALLOWED_YES || UR_ALLOWED_DEPENDS)) {
                 // Bulk export actions
                 $aResult[] = new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('{$sOQL}', '{$sDataTableId}', 'csv', " . json_encode(Dict::S('UI:Menu:CSVExport')) . ")");
                 $aResult[] = new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('{$sOQL}', '{$sDataTableId}', 'xlsx', " . json_encode(Dict::S('ExcelExporter:ExportMenu')) . ")");
                 $aResult[] = new JSPopupMenuItem('UI:Menu:ExportPDF', Dict::S('UI:Menu:ExportPDF'), "ExportListDlg('{$sOQL}', '{$sDataTableId}', 'pdf', " . json_encode(Dict::S('UI:Menu:ExportPDF')) . ")");
             }
             $aResult[] = new JSPopupMenuItem('UI:Menu:AddToDashboard', Dict::S('UI:Menu:AddToDashboard'), "DashletCreationDlg('{$sOQL}')");
             $aResult[] = new JSPopupMenuItem('UI:Menu:ShortcutList', Dict::S('UI:Menu:ShortcutList'), "ShortcutListDlg('{$sOQL}', '{$sDataTableId}', '{$sContext}')");
             break;
         case iPopupMenuExtension::MENU_OBJDETAILS_ACTIONS:
             // $param is a DBObject
             $oObj = $param;
             $sOQL = "SELECT " . get_class($oObj) . " WHERE id=" . $oObj->GetKey();
             $oFilter = DBObjectSearch::FromOQL($sOQL);
             $sFilter = $oFilter->serialize();
             $sUrl = ApplicationContext::MakeObjectUrl(get_class($oObj), $oObj->GetKey());
             $sUIPage = cmdbAbstractObject::ComputeStandardUIPage(get_class($oObj));
             $oAppContext = new ApplicationContext();
             $sContext = $oAppContext->GetForLink();
             $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/tabularfieldsselector.js');
             $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/jquery.dragtable.js');
             $oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot() . 'css/dragtable.css');
             $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/tabularfieldsselector.js');
             $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/jquery.dragtable.js');
             $oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot() . 'css/dragtable.css');
             $aResult = array(new SeparatorPopupMenuItem(), new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), "mailto:?subject=" . urlencode($oObj->GetRawName()) . "&body=" . urlencode($sUrl) . ' '), new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('{$sOQL}', '', 'csv', " . json_encode(Dict::S('UI:Menu:CSVExport')) . ")"), new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('{$sOQL}', '', 'xlsx', " . json_encode(Dict::S('ExcelExporter:ExportMenu')) . ")"));
             break;
         case iPopupMenuExtension::MENU_DASHBOARD_ACTIONS:
             // $param is a Dashboard
             $oAppContext = new ApplicationContext();
             $aParams = $oAppContext->GetAsHash();
             $sMenuId = ApplicationMenu::GetActiveNodeId();
             $sDlgTitle = addslashes(Dict::S('UI:ImportDashboardTitle'));
             $sDlgText = addslashes(Dict::S('UI:ImportDashboardText'));
             $sCloseBtn = addslashes(Dict::S('UI:Button:Cancel'));
             $aResult = array(new SeparatorPopupMenuItem(), new URLPopupMenuItem('UI:ExportDashboard', Dict::S('UI:ExportDashBoard'), utils::GetAbsoluteUrlAppRoot() . 'pages/ajax.render.php?operation=export_dashboard&id=' . $sMenuId), new JSPopupMenuItem('UI:ImportDashboard', Dict::S('UI:ImportDashBoard'), "UploadDashboard({dashboard_id: '{$sMenuId}', title: '{$sDlgTitle}', text: '{$sDlgText}', close_btn: '{$sCloseBtn}' })"));
             break;
         default:
             // Unknown type of menu, do nothing
             $aResult = array();
     }
     foreach ($aResult as $oMenuItem) {
         $aActions[$oMenuItem->GetUID()] = $oMenuItem->GetMenuItem();
     }
     // Invoke the plugins
     //
     foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance) {
         if (is_object($param) && !$param instanceof DBObject) {
             $tmpParam = clone $param;
             // In case the parameter is an DBObjectSet, clone it to prevent alterations
         } else {
             $tmpParam = $param;
         }
         foreach ($oExtensionInstance->EnumItems($iMenuId, $tmpParam) as $oMenuItem) {
             if (is_object($oMenuItem)) {
                 $aActions[$oMenuItem->GetUID()] = $oMenuItem->GetMenuItem();
                 foreach ($oMenuItem->GetLinkedScripts() as $sLinkedScript) {
                     $oPage->add_linked_script($sLinkedScript);
                 }
             }
         }
     }
 }
开发者ID:henryavila,项目名称:itop,代码行数:84,代码来源:utils.inc.php


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