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


PHP DBObjectSet::FromObject方法代码示例

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


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

示例1: 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

示例2: ShowDetailsRequest

/**
 * Displays the details of a request
 * @param WebPage $oP The current web page
 * @param Object $oObj The target object
 * @return void
 */
function ShowDetailsRequest(WebPage $oP, $oObj)
{
    $sClass = get_class($oObj);
    $sLogAttCode = GetConstant($sClass, 'PUBLIC_LOG');
    $sUserCommentAttCode = GetConstant($sClass, 'USER_COMMENT');
    $bIsReopenButton = false;
    $bIsCloseButton = false;
    $bIsEscalateButton = false;
    $bEditAttachments = false;
    $aEditAtt = array();
    // List of attributes editable in the main form
    if (!MetaModel::DBIsReadOnly()) {
        switch ($oObj->GetState()) {
            case 'resolved':
                $aEditAtt = array();
                $aTransitions = $oObj->EnumTransitions();
                $oSet = DBObjectSet::FromObject($oObj);
                // Add the "Reopen" button if this is valid action
                if (array_key_exists('ev_reopen', $aTransitions) && UserRights::IsStimulusAllowed($sClass, 'ev_reopen', $oSet)) {
                    $bIsReopenButton = true;
                    MakeStimulusForm($oP, $oObj, 'ev_reopen', array($sLogAttCode));
                }
                // Add the "Close" button if this is valid action
                if (array_key_exists('ev_close', $aTransitions) && UserRights::IsStimulusAllowed($sClass, 'ev_close', $oSet)) {
                    $bIsCloseButton = true;
                    MakeStimulusForm($oP, $oObj, 'ev_close', array('user_satisfaction', $sUserCommentAttCode));
                }
                break;
            case 'closed':
                // By convention 'closed' is the final state of a ticket and nothing can be done in such a state
                break;
            default:
                // In all other states, the only possible action is to update the ticket (both the case log and the attachments)
                // This update is possible only if the case log field is not read-only or hidden in the current state
                $iFlags = $oObj->GetAttributeFlags($sLogAttCode);
                $bReadOnly = ($iFlags & (OPT_ATT_READONLY | OPT_ATT_HIDDEN)) != 0;
                if ($bReadOnly) {
                    $aEditAtt = array();
                    $bEditAttachments = false;
                } else {
                    $aEditAtt = array($sLogAttCode => '????');
                    $bEditAttachments = true;
                }
                break;
        }
    }
    // REFACTORISER LA MISE EN FORME
    $oP->add("<h1 id=\"title_request_details\">" . $oObj->GetIcon() . "&nbsp;" . Dict::Format('Portal:TitleRequestDetailsFor_Request', $oObj->GetName()) . "</h1>\n");
    $aAttList = json_decode(GetConstant($sClass, 'DETAILS_ZLIST'), true);
    switch ($oObj->GetState()) {
        case 'closed':
            $aAttList['centered'][] = 'user_satisfaction';
            $aAttList['centered'][] = $sUserCommentAttCode;
    }
    // Remove the edited attribute from the shown attributes
    //
    foreach ($aEditAtt as $sAttCode => $foo) {
        foreach ($aAttList as $col => $aColumn) {
            if (in_array($sAttCode, $aColumn)) {
                if (($index = array_search($sAttCode, $aColumn)) !== false) {
                    unset($aAttList[$col][$index]);
                }
            }
        }
    }
    $oP->add("<div class=\"wizContainer\" id=\"form_commment_request\">\n");
    $oP->WizardFormStart('request_form', null);
    $oP->add('<div id="request_details">');
    $oP->add('<table id="request_details_table">');
    $oP->add('<tr>');
    $oP->add('<td style="vertical-align:top;">');
    $oP->DisplayObjectDetails($oObj, $aAttList['col:left']);
    $oP->add('</td>');
    $oP->add('<td style="vertical-align:top;">');
    $oP->DisplayObjectDetails($oObj, $aAttList['col:right']);
    $oP->add('</td>');
    $oP->add('</tr>');
    if (array_key_exists('centered', $aAttList)) {
        $oP->add('<tr>');
        $oP->add('<td style="vertical-align:top;" colspan="2">');
        $oP->DisplayObjectDetails($oObj, $aAttList['centered']);
        $oP->add('</td>');
        $oP->add('</tr>');
    }
    // REFACTORISER
    $oP->add('<tr>');
    $oP->add('<td colspan="2" style="vertical-align:top;">');
    $oAttPlugin = new AttachmentPlugIn();
    if ($bEditAttachments) {
        $oAttPlugin->EnableDelete(false);
        $oAttPlugin->OnDisplayRelations($oObj, $oP, true);
    } else {
        $oAttPlugin->OnDisplayRelations($oObj, $oP, false);
    }
//.........这里部分代码省略.........
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:101,代码来源:index.php

示例3: array

     // Fall through
     ///////////////////////////////////////////////////////////////////////////////////////////
 // Fall through
 ///////////////////////////////////////////////////////////////////////////////////////////
 case 'delete':
 case 'bulk_delete':
     // Actual bulk deletion (if confirmed)
     $sClass = utils::ReadParam('class', '', false, 'class');
     $sClassLabel = MetaModel::GetName($sClass);
     $aObjects = array();
     if ($operation == 'delete') {
         // Single object
         $id = utils::ReadParam('id', '');
         $oObj = MetaModel::GetObject($sClass, $id);
         $aObjects[] = $oObj;
         if (!UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, DBObjectSet::FromObject($oObj))) {
             throw new SecurityException(Dict::Format('UI:Error:DeleteNotAllowedOn_Class', $sClassLabel));
         }
     } else {
         // Several objects
         $sFilter = utils::ReadPostedParam('filter', '');
         $oFullSetFilter = DBObjectSearch::unserialize($sFilter);
         $aSelectObject = utils::ReadMultipleSelection($oFullSetFilter);
         if (empty($sClass) || empty($aSelectObject)) {
             throw new ApplicationException(Dict::Format('UI:Error:2ParametersMissing', 'class', 'selectObject[]'));
         }
         foreach ($aSelectObject as $iId) {
             $aObjects[] = MetaModel::GetObject($sClass, $iId);
         }
         if (count($aObjects) == 1) {
             if (!UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, DBObjectSet::FromArray($sClass, $aObjects))) {
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:31,代码来源:UI.php

示例4: CreateAdministrator

 public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
 {
     CMDBObject::SetTrackInfo('Initialization');
     $oChange = CMDBObject::GetCurrentChange();
     $iContactId = 0;
     // Support drastic data model changes: no organization class (or not writable)!
     if (MetaModel::IsValidClass('Organization') && !MetaModel::IsAbstract('Organization')) {
         $oOrg = new Organization();
         $oOrg->Set('name', 'My Company/Department');
         $oOrg->Set('code', 'SOMECODE');
         $iOrgId = $oOrg->DBInsertTrackedNoReload($oChange, true);
         // Support drastic data model changes: no Person class  (or not writable)!
         if (MetaModel::IsValidClass('Person') && !MetaModel::IsAbstract('Person')) {
             $oContact = new Person();
             $oContact->Set('name', 'My last name');
             $oContact->Set('first_name', 'My first name');
             if (MetaModel::IsValidAttCode('Person', 'org_id')) {
                 $oContact->Set('org_id', $iOrgId);
             }
             if (MetaModel::IsValidAttCode('Person', 'phone')) {
                 $oContact->Set('phone', '+00 000 000 000');
             }
             $oContact->Set('email', 'my.email@foo.org');
             $iContactId = $oContact->DBInsertTrackedNoReload($oChange, true);
         }
     }
     $oUser = new UserLocal();
     $oUser->Set('login', $sAdminUser);
     $oUser->Set('password', $sAdminPwd);
     if (MetaModel::IsValidAttCode('UserLocal', 'contactid') && $iContactId != 0) {
         $oUser->Set('contactid', $iContactId);
     }
     $oUser->Set('language', $sLanguage);
     // Language was chosen during the installation
     // Add this user to the very specific 'admin' profile
     $oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => ADMIN_PROFILE_NAME), true);
     if (is_object($oAdminProfile)) {
         $oUserProfile = new URP_UserProfile();
         //$oUserProfile->Set('userid', $iUserId);
         $oUserProfile->Set('profileid', $oAdminProfile->GetKey());
         $oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
         //$oUserProfile->DBInsertTrackedNoReload($oChange, true /* skip security */);
         $oSet = DBObjectSet::FromObject($oUserProfile);
         $oUser->Set('profile_list', $oSet);
     }
     $iUserId = $oUser->DBInsertTrackedNoReload($oChange, true);
     return true;
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:48,代码来源:userrightsprofile.class.inc.php

示例5: CheckUserRights

 /**
  * Helper to ultimately check user rights before writing (Insert, Update or Delete)
  * The check should never fail, because the UI should prevent from such a usage
  * Anyhow, if the user has found a workaround... the security gets enforced here	 	 
  */
 protected function CheckUserRights($bSkipStrongSecurity, $iActionCode)
 {
     if (is_null($bSkipStrongSecurity)) {
         // This is temporary
         // We have implemented this safety net right before releasing iTop 1.0
         // and we decided that it was too risky to activate it
         // Anyhow, users willing to have a very strong security could set
         // skip_strong_security = 0, in the config file
         $bSkipStrongSecurity = MetaModel::GetConfig()->Get('skip_strong_security');
     }
     if (!$bSkipStrongSecurity) {
         $sClass = get_class($this);
         $oSet = DBObjectSet::FromObject($this);
         if (!UserRights::IsActionAllowed($sClass, $iActionCode, $oSet)) {
             // Intrusion detected
             throw new SecurityException('You are not allowed to modify objects of class: ' . $sClass);
         }
     }
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:24,代码来源:cmdbobject.class.inc.php


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