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


PHP MetaModel::GetAttributesList方法代码示例

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


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

示例1: __construct

 public function __construct($sClass, $sLinkageAttr, $iObjectId, $sLinkedClass = '')
 {
     $this->m_sClass = $sClass;
     $this->m_sLinkageAttr = $sLinkageAttr;
     $this->m_iObjectId = $iObjectId;
     $this->m_sLinkedClass = $sLinkedClass;
     // Will try to guess below, if it's empty
     $this->m_sLinkingAttCode = '';
     // Will be filled once we've found the attribute corresponding to the linked class
     $this->m_aEditableFields = array();
     $this->m_aTableConfig = array();
     $this->m_aTableConfig['form::checkbox'] = array('label' => "<input class=\"select_all\" type=\"checkbox\" value=\"1\" onChange=\"var value = this.checked; \$('.selection').each( function() { this.checked = value; } );OnSelectChange();\">", 'description' => Dict::S('UI:SelectAllToggle+'));
     foreach (MetaModel::GetAttributesList($this->m_sClass) as $sAttCode) {
         $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
         if ($oAttDef->IsExternalKey() && $sAttCode != $this->m_sLinkageAttr) {
             if (empty($this->m_sLinkedClass)) {
                 // This is a class of objects we can manage !
                 // Since nothing was specify, any class will do !
                 $this->m_sLinkedClass = $oAttDef->GetTargetClass();
                 $this->m_sLinkingAttCode = $sAttCode;
             } else {
                 if ($this->m_sLinkedClass == $oAttDef->GetTargetClass()) {
                     // This is the class of objects we want to manage !
                     $this->m_sLinkingAttCode = $sAttCode;
                 }
             }
         } else {
             if (!$oAttDef->IsExternalKey() && !$oAttDef->IsExternalField()) {
                 $this->m_aEditableFields[] = $sAttCode;
                 $this->m_aTableConfig[$sAttCode] = array('label' => $oAttDef->GetLabel(), 'description' => $oAttDef->GetDescription());
             }
         }
     }
     if (empty($this->m_sLinkedClass)) {
         throw new Exception(Dict::Format('UI:Error:IncorrectLinkDefinition_LinkedClass_Class', $sLinkedClass, $sClass));
     }
     foreach (MetaModel::GetZListItems($this->m_sLinkedClass, 'list') as $sFieldCode) {
         $oAttDef = MetaModel::GetAttributeDef($this->m_sLinkedClass, $sFieldCode);
         $this->m_aTableConfig['static::' . $sFieldCode] = array('label' => $oAttDef->GetLabel(), 'description' => $oAttDef->GetDescription());
     }
 }
开发者ID:henryavila,项目名称:itop,代码行数:41,代码来源:uilinkswizard.class.inc.php

示例2: DisplayStimulusForm

    public function DisplayStimulusForm(WebPage $oPage, $sStimulus)
    {
        $sClass = get_class($this);
        $iKey = $this->GetKey();
        $aTransitions = $this->EnumTransitions();
        $aStimuli = MetaModel::EnumStimuli($sClass);
        if (!isset($aTransitions[$sStimulus])) {
            // Invalid stimulus
            throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulus, $this->GetName(), $this->GetStateLabel()));
        }
        // Check for concurrent access lock
        $LockEnabled = MetaModel::GetConfig()->Get('concurrent_lock_enabled');
        $sOwnershipToken = null;
        if ($LockEnabled) {
            $sOwnershipToken = utils::ReadPostedParam('ownership_token', null, false, 'raw_data');
            $aLockInfo = iTopOwnershipLock::AcquireLock($sClass, $iKey);
            if ($aLockInfo['success']) {
                $sOwnershipToken = $aLockInfo['token'];
                $sOwnershipDate = $aLockInfo['acquired'];
            } else {
                $oOwner = $aLockInfo['lock']->GetOwner();
                // If the object is locked by the current user, it's worth trying again, since
                // the lock may be released by 'onunload' which is called AFTER loading the current page.
                //$bTryAgain = $oOwner->GetKey() == UserRights::GetUserId();
                self::ReloadAndDisplay($oPage, $this, array('operation' => 'stimulus', 'stimulus' => $sStimulus));
                return;
            }
        }
        $sActionLabel = $aStimuli[$sStimulus]->GetLabel();
        $sActionDetails = $aStimuli[$sStimulus]->GetDescription();
        $aTransition = $aTransitions[$sStimulus];
        $sTargetState = $aTransition['target_state'];
        $aTargetStates = MetaModel::EnumStates($sClass);
        $oPage->add("<div class=\"page_header\">\n");
        $oPage->add("<h1>{$sActionLabel} - <span class=\"hilite\">{$this->GetName()}</span></h1>\n");
        $oPage->set_title($sActionLabel);
        $oPage->add("</div>\n");
        $aTargetState = $aTargetStates[$sTargetState];
        $aExpectedAttributes = $aTargetState['attribute_list'];
        $oPage->add("<h1>{$sActionDetails}</h1>\n");
        $sButtonsPosition = MetaModel::GetConfig()->Get('buttons_position');
        if ($sButtonsPosition == 'bottom') {
            // bottom: Displays the ticket details BEFORE the actions
            $oPage->add('<div class="ui-widget-content">');
            $this->DisplayBareProperties($oPage);
            $oPage->add('</div>');
        }
        $oPage->add("<div class=\"wizContainer\">\n");
        $oPage->add("<form id=\"apply_stimulus\" method=\"post\" onSubmit=\"return OnSubmit('apply_stimulus');\">\n");
        $aDetails = array();
        $iFieldIndex = 0;
        $aFieldsMap = array();
        // The list of candidate fields is made of the ordered list of "details" attributes + other attributes
        $aAttributes = array();
        foreach ($this->FlattenZList(MetaModel::GetZListItems($sClass, 'details')) as $sAttCode) {
            $aAttributes[$sAttCode] = true;
        }
        foreach (MetaModel::GetAttributesList($sClass) as $sAttCode) {
            if (!array_key_exists($sAttCode, $aAttributes)) {
                $aAttributes[$sAttCode] = true;
            }
        }
        // Order the fields based on their dependencies, set the fields for which there is only one possible value
        // and perform this in the order of dependencies to avoid dead-ends
        $aDeps = array();
        foreach ($aAttributes as $sAttCode => $trash) {
            $aDeps[$sAttCode] = MetaModel::GetPrerequisiteAttributes($sClass, $sAttCode);
        }
        $aList = $this->OrderDependentFields($aDeps);
        foreach ($aList as $sAttCode) {
            // Consider only the "expected" fields for the target state
            if (array_key_exists($sAttCode, $aExpectedAttributes)) {
                $iExpectCode = $aExpectedAttributes[$sAttCode];
                // Prompt for an attribute if
                // - the attribute must be changed or must be displayed to the user for confirmation
                // - or the field is mandatory and currently empty
                if ($iExpectCode & (OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT) || $iExpectCode & OPT_ATT_MANDATORY && $this->Get($sAttCode) == '') {
                    $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
                    $aArgs = array('this' => $this);
                    // If the field is mandatory, set it to the only possible value
                    if (!$oAttDef->IsNullAllowed() || $iExpectCode & OPT_ATT_MANDATORY) {
                        if ($oAttDef->IsExternalKey()) {
                            $oAllowedValues = MetaModel::GetAllowedValuesAsObjectSet($sClass, $sAttCode, $aArgs);
                            if ($oAllowedValues->Count() == 1) {
                                $oRemoteObj = $oAllowedValues->Fetch();
                                $this->Set($sAttCode, $oRemoteObj->GetKey());
                            }
                        } else {
                            $aAllowedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, $aArgs);
                            if (count($aAllowedValues) == 1) {
                                $aValues = array_keys($aAllowedValues);
                                $this->Set($sAttCode, $aValues[0]);
                            }
                        }
                    }
                    $sHTMLValue = cmdbAbstractObject::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $this->Get($sAttCode), $this->GetEditValue($sAttCode), 'att_' . $iFieldIndex, '', $iExpectCode, $aArgs);
                    $aDetails[] = array('label' => '<span>' . $oAttDef->GetLabel() . '</span>', 'value' => "<span id=\"field_att_{$iFieldIndex}\">{$sHTMLValue}</span>");
                    $aFieldsMap[$sAttCode] = 'att_' . $iFieldIndex;
                    $iFieldIndex++;
                }
//.........这里部分代码省略.........
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:101,代码来源:cmdbabstract.class.inc.php

示例3: MakeSelectQuery

 /**
  * @param hash $aOrderBy Array of '[<classalias>.]attcode' => bAscending
  */
 public function MakeSelectQuery($aOrderBy = array(), $aArgs = array(), $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false)
 {
     // Check the order by specification, and prefix with the class alias
     // and make sure that the ordering columns are going to be selected
     //
     $sClass = $this->GetClass();
     $sClassAlias = $this->GetClassAlias();
     $aOrderSpec = array();
     foreach ($aOrderBy as $sFieldAlias => $bAscending) {
         if (!is_bool($bAscending)) {
             throw new CoreException("Wrong direction in ORDER BY spec, found '{$bAscending}' and expecting a boolean value");
         }
         $iDotPos = strpos($sFieldAlias, '.');
         if ($iDotPos === false) {
             $sAttClass = $sClass;
             $sAttClassAlias = $sClassAlias;
             $sAttCode = $sFieldAlias;
         } else {
             $sAttClassAlias = substr($sFieldAlias, 0, $iDotPos);
             $sAttClass = $this->GetClassName($sAttClassAlias);
             $sAttCode = substr($sFieldAlias, $iDotPos + 1);
         }
         if ($sAttCode != 'id') {
             MyHelpers::CheckValueInArray('field name in ORDER BY spec', $sAttCode, MetaModel::GetAttributesList($sAttClass));
             $oAttDef = MetaModel::GetAttributeDef($sAttClass, $sAttCode);
             foreach ($oAttDef->GetOrderBySQLExpressions($sAttClassAlias) as $sSQLExpression) {
                 $aOrderSpec[$sSQLExpression] = $bAscending;
             }
         } else {
             $aOrderSpec['`' . $sAttClassAlias . $sAttCode . '`'] = $bAscending;
         }
         // Make sure that the columns used for sorting are present in the loaded columns
         if (!is_null($aAttToLoad) && !isset($aAttToLoad[$sAttClassAlias][$sAttCode])) {
             $aAttToLoad[$sAttClassAlias][$sAttCode] = MetaModel::GetAttributeDef($sAttClass, $sAttCode);
         }
     }
     $oSQLQuery = $this->GetSQLQuery($aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount);
     $aScalarArgs = array_merge(MetaModel::PrepareQueryArguments($aArgs), $this->GetInternalParams());
     try {
         $bBeautifulSQL = self::$m_bTraceQueries || self::$m_bDebugQuery || self::$m_bIndentQueries;
         $sRes = $oSQLQuery->RenderSelect($aOrderSpec, $aScalarArgs, $iLimitCount, $iLimitStart, $bGetCount, $bBeautifulSQL);
         if ($sClassAlias == '_itop_') {
             IssueLog::Info('SQL Query (_itop_): ' . $sRes);
         }
     } catch (MissingQueryArgument $e) {
         // Add some information...
         $e->addInfo('OQL', $this->ToOQL());
         throw $e;
     }
     $this->AddQueryTraceSelect($aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount, $sRes);
     return $sRes;
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:55,代码来源:dbsearch.class.php

示例4: ComputeWizardStructure

 /**
  * Compute the order of the fields & pages in the wizard
  * @param $oPage iTopWebPage The current page (used to display error messages) 
  * @param $sClass string Name of the class
  * @param $sStateCode string Code of the target state of the object
  * @return hash Two dimensional array: each element represents the list of fields for a given page   
  */
 protected function ComputeWizardStructure()
 {
     $aWizardSteps = array('mandatory' => array(), 'optional' => array());
     $aFieldsDone = array();
     // Store all the fields that are already covered by a previous step of the wizard
     $aStates = MetaModel::EnumStates($this->m_sClass);
     $sStateAttCode = MetaModel::GetStateAttributeCode($this->m_sClass);
     $aMandatoryAttributes = array();
     // Some attributes are always mandatory independently of the state machine (if any)
     foreach (MetaModel::GetAttributesList($this->m_sClass) as $sAttCode) {
         $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
         if (!$oAttDef->IsExternalField() && !$oAttDef->IsNullAllowed() && $oAttDef->IsWritable() && $sAttCode != $sStateAttCode) {
             $aMandatoryAttributes[$sAttCode] = OPT_ATT_MANDATORY;
         }
     }
     // Now check the attributes that are mandatory in the specified state
     if (!empty($this->m_sTargetState) && count($aStates[$this->m_sTargetState]['attribute_list']) > 0) {
         // Check all the fields that *must* be included in the wizard for this
         // particular target state
         $aFields = array();
         foreach ($aStates[$this->m_sTargetState]['attribute_list'] as $sAttCode => $iOptions) {
             if (isset($aMandatoryAttributes[$sAttCode]) && $aMandatoryAttributes[$sAttCode] & (OPT_ATT_MANDATORY | OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) {
                 $aMandatoryAttributes[$sAttCode] |= $iOptions;
             } else {
                 $aMandatoryAttributes[$sAttCode] = $iOptions;
             }
         }
     }
     // Check all the fields that *must* be included in the wizard
     // i.e. all mandatory, must-change or must-prompt fields that are
     // not also read-only or hidden.
     // Some fields may be required (null not allowed) from the database
     // perspective, but hidden or read-only from the user interface perspective
     $aFields = array();
     foreach ($aMandatoryAttributes as $sAttCode => $iOptions) {
         if ($iOptions & (OPT_ATT_MANDATORY | OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT) && !($iOptions & (OPT_ATT_READONLY | OPT_ATT_HIDDEN))) {
             $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
             $aPrerequisites = $oAttDef->GetPrerequisiteAttributes();
             $aFields[$sAttCode] = array();
             foreach ($aPrerequisites as $sCode) {
                 $aFields[$sAttCode][$sCode] = '';
             }
         }
     }
     // Now use the dependencies between the fields to order them
     // Start from the order of the 'details'
     $aList = MetaModel::FlattenZlist(MetaModel::GetZListItems($this->m_sClass, 'details'));
     $index = 0;
     $aOrder = array();
     foreach ($aFields as $sAttCode => $void) {
         $aOrder[$sAttCode] = 999;
         // At the end of the list...
     }
     foreach ($aList as $sAttCode) {
         if (array_key_exists($sAttCode, $aFields)) {
             $aOrder[$sAttCode] = $index;
         }
         $index++;
     }
     foreach ($aFields as $sAttCode => $aDependencies) {
         // All fields with no remaining dependencies can be entered at this
         // step of the wizard
         if (count($aDependencies) > 0) {
             $iMaxPos = 0;
             // Remove this field from the dependencies of the other fields
             foreach ($aDependencies as $sDependentAttCode => $void) {
                 // position the current field after the ones it depends on
                 $iMaxPos = max($iMaxPos, 1 + $aOrder[$sDependentAttCode]);
             }
         }
     }
     asort($aOrder);
     $aCurrentStep = array();
     foreach ($aOrder as $sAttCode => $rank) {
         $aCurrentStep[] = $sAttCode;
         $aFieldsDone[$sAttCode] = '';
     }
     $aWizardSteps['mandatory'][] = $aCurrentStep;
     // Now computes the steps to fill the optional fields
     $aFields = array();
     // reset
     foreach (MetaModel::ListAttributeDefs($this->m_sClass) as $sAttCode => $oAttDef) {
         $iOptions = isset($aStates[$this->m_sTargetState]['attribute_list'][$sAttCode]) ? $aStates[$this->m_sTargetState]['attribute_list'][$sAttCode] : 0;
         if ($sStateAttCode != $sAttCode && !$oAttDef->IsExternalField() && ($iOptions & (OPT_ATT_HIDDEN | OPT_ATT_READONLY)) == 0 && !isset($aFieldsDone[$sAttCode])) {
             // 'State', external fields, read-only and hidden fields
             // and fields that are already listed in the wizard
             // are removed from the 'optional' part of the wizard
             $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
             $aPrerequisites = $oAttDef->GetPrerequisiteAttributes();
             $aFields[$sAttCode] = array();
             foreach ($aPrerequisites as $sCode) {
                 if (!isset($aFieldsDone[$sCode])) {
                     // retain only the dependencies that were not covered
//.........这里部分代码省略.........
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:101,代码来源:uiwizard.class.inc.php

示例5: CheckProjectionSpec

 public function CheckProjectionSpec($oProjectionSpec, $sProjectedClass)
 {
     $sExpression = $oProjectionSpec->Get('value');
     $sAttribute = $oProjectionSpec->Get('attribute');
     // Shortcut: "any value" or "no value" means no projection
     if (empty($sExpression)) {
         return;
     }
     if ($sExpression == '<any>') {
         return;
     }
     // 1st - compute the data type for the dimension
     //
     $sType = $this->Get('type');
     if (MetaModel::IsValidClass($sType)) {
         $sExpectedType = $sType;
     } else {
         $sExpectedType = '_scalar_';
     }
     // 2nd - compute the data type for the projection
     //
     $sTargetClass = '';
     if ($sExpression == '<this>' || $sExpression == '<user>') {
         $sTargetClass = $sProjectedClass;
     } elseif ($sExpression == '<any>') {
         $sTargetClass = '';
     } else {
         // Evaluate wether it is a constant or not
         try {
             $oObjectSearch = DBObjectSearch::FromOQL_AllData($sExpression);
             $sTargetClass = $oObjectSearch->GetClass();
         } catch (OqlException $e) {
         }
     }
     if (empty($sTargetClass)) {
         $sFoundType = '_void_';
     } else {
         if (empty($sAttribute)) {
             $sFoundType = $sTargetClass;
         } else {
             if (!MetaModel::IsValidAttCode($sTargetClass, $sAttribute)) {
                 throw new CoreException('Unkown attribute code in projection specification', array('found' => $sAttribute, 'expecting' => MetaModel::GetAttributesList($sTargetClass), 'class' => $sTargetClass, 'projection' => $oProjectionSpec));
             }
             $oAttDef = MetaModel::GetAttributeDef($sTargetClass, $sAttribute);
             if ($oAttDef->IsExternalKey()) {
                 $sFoundType = $oAttDef->GetTargetClass();
             } else {
                 $sFoundType = '_scalar_';
             }
         }
     }
     // Compare the dimension type and projection type
     if ($sFoundType != '_void_' && $sFoundType != $sExpectedType) {
         throw new CoreException('Wrong type in projection specification', array('found' => $sFoundType, 'expecting' => $sExpectedType, 'expression' => $sExpression, 'attribute' => $sAttribute, 'projection' => $oProjectionSpec));
     }
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:56,代码来源:userrightsprojection.class.inc.php

示例6: SetupUser

 protected function SetupUser($iUserId, $bNewUser = false)
 {
     foreach (array('bizmodel', 'application', 'gui', 'core/cmdb') as $sCategory) {
         foreach (MetaModel::GetClasses($sCategory) as $sClass) {
             foreach (self::$m_aActionCodes as $iActionCode => $sAction) {
                 if ($bNewUser) {
                     $bAddCell = true;
                 } else {
                     $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassGrant WHERE class = '{$sClass}' AND action = '{$sAction}' AND userid = {$iUserId}"));
                     $bAddCell = $oSet->Count() < 1;
                 }
                 if ($bAddCell) {
                     // Create a new entry
                     $oMyClassGrant = MetaModel::NewObject("UserRightsMatrixClassGrant");
                     $oMyClassGrant->Set("userid", $iUserId);
                     $oMyClassGrant->Set("class", $sClass);
                     $oMyClassGrant->Set("action", $sAction);
                     $oMyClassGrant->Set("permission", "yes");
                     $iId = $oMyClassGrant->DBInsertNoReload();
                 }
             }
             foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) {
                 if ($bNewUser) {
                     $bAddCell = true;
                 } else {
                     $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassStimulusGrant WHERE class = '{$sClass}' AND stimulus = '{$sStimulusCode}' AND userid = {$iUserId}"));
                     $bAddCell = $oSet->Count() < 1;
                 }
                 if ($bAddCell) {
                     // Create a new entry
                     $oMyClassGrant = MetaModel::NewObject("UserRightsMatrixClassStimulusGrant");
                     $oMyClassGrant->Set("userid", $iUserId);
                     $oMyClassGrant->Set("class", $sClass);
                     $oMyClassGrant->Set("stimulus", $sStimulusCode);
                     $oMyClassGrant->Set("permission", "yes");
                     $iId = $oMyClassGrant->DBInsertNoReload();
                 }
             }
             foreach (MetaModel::GetAttributesList($sClass) as $sAttCode) {
                 if ($bNewUser) {
                     $bAddCell = true;
                 } else {
                     $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixAttributeGrant WHERE class = '{$sClass}' AND attcode = '{$sAttCode}' AND userid = {$iUserId}"));
                     $bAddCell = $oSet->Count() < 1;
                 }
                 if ($bAddCell) {
                     foreach (array('read', 'modify') as $sAction) {
                         // Create a new entry
                         $oMyAttGrant = MetaModel::NewObject("UserRightsMatrixAttributeGrant");
                         $oMyAttGrant->Set("userid", $iUserId);
                         $oMyAttGrant->Set("class", $sClass);
                         $oMyAttGrant->Set("attcode", $sAttCode);
                         $oMyAttGrant->Set("action", $sAction);
                         $oMyAttGrant->Set("permission", "yes");
                         $iId = $oMyAttGrant->DBInsertNoReload();
                     }
                 }
             }
         }
     }
     /*
     // Create the "My Bookmarks" menu item (parent_id = 0, rank = 6)
     if ($bNewUser)
     {
     	$bAddMenu = true;
     }
     else
     {
     	$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT menuNode WHERE type = 'user' AND parent_id = 0 AND user_id = $iUserId"));
     	$bAddMenu = ($oSet->Count() < 1);
     }
     if ($bAddMenu)
     {
     	$oMenu = MetaModel::NewObject('menuNode');
     	$oMenu->Set('type', 'user');
     	$oMenu->Set('parent_id', 0);	// It's a toplevel entry
     	$oMenu->Set('rank', 6);			// Located just above the Admin Tools section (=7)
     	$oMenu->Set('name', 'My Bookmarks');
     	$oMenu->Set('label', 'My Favorite Items');
     	$oMenu->Set('hyperlink', 'UI.php');
     	$oMenu->Set('template', '<p></p><p></p><p style="text-align:center; font-family:Georgia, Times, serif; font-size:32px;">My bookmarks</p><p style="text-align:center; font-family:Georgia, Times, serif; font-size:14px;"><i>This section contains my most favorite search results</i></p>');
     	$oMenu->Set('user_id', $iUserId);
     	$oMenu->DBInsert();
     }
     */
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:86,代码来源:userrightsmatrix.class.inc.php

示例7: test_search

 function test_search()
 {
     echo "<h4>Two searches</h4>";
     $oFilterAllDevs = new DBObjectSearch("cmdbTeam");
     $oAllDevs = new DBObjectSet($oFilterAllDevs);
     echo "Found " . $oAllDevs->Count() . " items.</br>\n";
     while ($oDev = $oAllDevs->Fetch()) {
         $aValues = array();
         foreach (MetaModel::GetAttributesList($oAllDevs->GetClass()) as $sAttCode) {
             $aValues[] = MetaModel::GetLabel(get_class($oDev), $sAttCode) . " (" . MetaModel::GetDescription(get_class($oDev), $sAttCode) . ") = " . $oDev->GetAsHTML($sAttCode);
         }
         echo $oDev->GetKey() . " => " . implode(", ", $aValues) . "</br>\n";
     }
     // a second one
     $oMyFilter = new DBObjectSearch("cmdbContact");
     //$oMyFilter->AddCondition("name", "aii", "Finishes with");
     $oMyFilter->AddCondition("name", "aii");
     $this->search_and_show_list($oMyFilter);
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:19,代码来源:testlist.inc.php

示例8: show_list

 protected static function show_list($oObjectSet)
 {
     $oObjectSet->Rewind();
     $aData = array();
     while ($oItem = $oObjectSet->Fetch()) {
         $aValues = array();
         foreach (MetaModel::GetAttributesList(get_class($oItem)) as $sAttCode) {
             $aValues[$sAttCode] = $oItem->GetAsHTML($sAttCode);
         }
         //echo $oItem->GetKey()." => ".implode(", ", $aValues)."</br>\n";
         $aData[] = $aValues;
     }
     echo MyHelpers::make_table_from_assoc_array($aData);
 }
开发者ID:henryavila,项目名称:itop,代码行数:14,代码来源:test.class.inc.php


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