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


PHP MetaModel::DBIsReadOnly方法代码示例

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


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

示例1: DBDeleteSingleObject

 protected function DBDeleteSingleObject()
 {
     $this->OnDelete();
     if (!MetaModel::DBIsReadOnly()) {
         $oDataSource = MetaModel::GetObject('SynchroDataSource', $this->Get('sync_source_id'), false);
         if ($oDataSource) {
             $sTable = $oDataSource->GetDataTable();
             $sSQL = "DELETE FROM `{$sTable}` WHERE id = '{$this->GetKey()}'";
             CMDBSource::Query($sSQL);
         }
         // else the whole datasource has probably been already deleted
     }
     $this->AfterDelete();
     $this->m_bIsInDB = false;
     $this->m_iKey = null;
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:16,代码来源:synchrodatasource.class.inc.php

示例2: DBDeleteSingleObject

 protected function DBDeleteSingleObject()
 {
     if (!MetaModel::DBIsReadOnly()) {
         $this->OnDelete();
         $this->RecordObjDeletion($this->m_iKey);
         // May cause a reload for storing history information
         foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) {
             if ($oAttDef->IsHierarchicalKey()) {
                 // Update the left & right indexes for each hierarchical key
                 $sTable = $sTable = MetaModel::DBGetTable(get_class($this), $sAttCode);
                 $sSQL = "SELECT `" . $oAttDef->GetSQLRight() . "` AS `right`, `" . $oAttDef->GetSQLLeft() . "` AS `left` FROM `{$sTable}` WHERE id=" . CMDBSource::Quote($this->m_iKey);
                 $aRes = CMDBSource::QueryToArray($sSQL);
                 $iMyLeft = $aRes[0]['left'];
                 $iMyRight = $aRes[0]['right'];
                 $iDelta = $iMyRight - $iMyLeft + 1;
                 MetaModel::HKTemporaryCutBranch($iMyLeft, $iMyRight, $oAttDef, $sTable);
                 // No new parent for now, insert completely at the right of the tree
                 $sSQL = "SELECT max(`" . $oAttDef->GetSQLRight() . "`) AS max FROM `{$sTable}`";
                 $aRes = CMDBSource::QueryToArray($sSQL);
                 if (count($aRes) == 0) {
                     $iNewLeft = 1;
                 } else {
                     $iNewLeft = $aRes[0]['max'] + 1;
                 }
                 MetaModel::HKReplugBranch($iNewLeft, $iNewLeft + $iDelta - 1, $oAttDef, $sTable);
             }
         }
         foreach (MetaModel::EnumParentClasses(get_class($this), ENUM_PARENT_CLASSES_ALL) as $sParentClass) {
             $this->DBDeleteSingleTable($sParentClass);
         }
         $this->AfterDelete();
         $this->m_bIsInDB = false;
         // Fix for #926: do NOT reset m_iKey as it can be used to have it for reporting purposes (see the REST service to delete objects, reported as bug #926)
         // Thought the key is not reset, using DBInsert or DBWrite will create an object having the same characteristics and a new ID. DBUpdate is protected
     }
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:36,代码来源:dbobject.class.php

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

示例4: IsActionAllowedOnAttribute

 public static function IsActionAllowedOnAttribute($sClass, $sAttCode, $iActionCode, $oInstanceSet = null, $oUser = null)
 {
     // When initializing, we need to let everything pass trough
     if (!self::CheckLogin()) {
         return true;
     }
     if (MetaModel::DBIsReadOnly()) {
         if ($iActionCode == UR_ACTION_MODIFY) {
             return false;
         }
         if ($iActionCode == UR_ACTION_DELETE) {
             return false;
         }
         if ($iActionCode == UR_ACTION_BULK_MODIFY) {
             return false;
         }
         if ($iActionCode == UR_ACTION_BULK_DELETE) {
             return false;
         }
     }
     if (self::IsAdministrator($oUser)) {
         return true;
     }
     // this module is forbidden for non admins
     if (MetaModel::HasCategory($sClass, 'addon/userrights')) {
         return false;
     }
     // the rest is allowed (#@# to be improved)
     if (!MetaModel::HasCategory($sClass, 'bizmodel')) {
         return true;
     }
     if (is_null($oUser)) {
         $oUser = self::$m_oUser;
     }
     return self::$m_oAddOn->IsActionAllowedOnAttribute($oUser, $sClass, $sAttCode, $iActionCode, $oInstanceSet);
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:36,代码来源:userrights.class.inc.php


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