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


PHP DBObject::GetHyperLink方法代码示例

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


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

示例1: GetFormRow


//.........这里部分代码省略.........
    {
        $sPrefix = "{$this->m_sAttCode}{$this->m_sNameSuffix}";
        $aRow = array();
        $aFieldsMap = array();
        if (is_object($linkObjOrId) && !$linkObjOrId->IsNew()) {
            $key = $linkObjOrId->GetKey();
            $iRemoteObjKey = $linkObjOrId->Get($this->m_sExtKeyToRemote);
            $sPrefix .= "[{$key}][";
            $sNameSuffix = "]";
            // To make a tabular form
            $aArgs['prefix'] = $sPrefix;
            $aArgs['wizHelper'] = "oWizardHelper{$this->m_iInputId}{$key}";
            $aArgs['this'] = $linkObjOrId;
            $aRow['form::checkbox'] = "<input class=\"selection\" type=\"checkbox\" onClick=\"oWidget" . $this->m_iInputId . ".OnSelectChange();\" value=\"{$key}\">";
            $aRow['form::checkbox'] .= "<input type=\"hidden\" name=\"attr_{$sPrefix}id{$sNameSuffix}\" value=\"{$key}\">";
            foreach ($this->m_aEditableFields as $sFieldCode) {
                $sFieldId = $this->m_iInputId . '_' . $sFieldCode . '[' . $linkObjOrId->GetKey() . ']';
                $sSafeId = utils::GetSafeId($sFieldId);
                $oAttDef = MetaModel::GetAttributeDef($this->m_sLinkedClass, $sFieldCode);
                $aRow[$sFieldCode] = cmdbAbstractObject::GetFormElementForField($oP, $this->m_sLinkedClass, $sFieldCode, $oAttDef, $linkObjOrId->Get($sFieldCode), '', $sSafeId, $sNameSuffix, 0, $aArgs);
                $aFieldsMap[$sFieldCode] = $sSafeId;
            }
            $sState = $linkObjOrId->GetState();
        } else {
            // form for creating a new record
            if (is_object($linkObjOrId)) {
                // New link existing only in memory
                $oNewLinkObj = $linkObjOrId;
                $iRemoteObjKey = $oNewLinkObj->Get($this->m_sExtKeyToRemote);
                $oRemoteObj = MetaModel::GetObject($this->m_sRemoteClass, $iRemoteObjKey);
                $oNewLinkObj->Set($this->m_sExtKeyToMe, $oCurrentObj);
                // Setting the extkey with the object also fills the related external fields
                $linkObjOrId = -$iRemoteObjKey;
            } else {
                $iRemoteObjKey = -$linkObjOrId;
                $oNewLinkObj = MetaModel::NewObject($this->m_sLinkedClass);
                $oRemoteObj = MetaModel::GetObject($this->m_sRemoteClass, -$linkObjOrId);
                $oNewLinkObj->Set($this->m_sExtKeyToRemote, $oRemoteObj);
                // Setting the extkey with the object alsoo fills the related external fields
                $oNewLinkObj->Set($this->m_sExtKeyToMe, $oCurrentObj);
                // Setting the extkey with the object also fills the related external fields
            }
            $sPrefix .= "[{$linkObjOrId}][";
            $sNameSuffix = "]";
            // To make a tabular form
            $aArgs['prefix'] = $sPrefix;
            $aArgs['wizHelper'] = "oWizardHelper{$this->m_iInputId}_" . -$linkObjOrId;
            $aArgs['this'] = $oNewLinkObj;
            $aRow['form::checkbox'] = "<input class=\"selection\" type=\"checkbox\" onClick=\"oWidget" . $this->m_iInputId . ".OnSelectChange();\" value=\"{$linkObjOrId}\">";
            $aRow['form::checkbox'] .= "<input type=\"hidden\" name=\"attr_{$sPrefix}id{$sNameSuffix}\" value=\"\">";
            foreach ($this->m_aEditableFields as $sFieldCode) {
                $sFieldId = $this->m_iInputId . '_' . $sFieldCode . '[' . $linkObjOrId . ']';
                $sSafeId = utils::GetSafeId($sFieldId);
                $oAttDef = MetaModel::GetAttributeDef($this->m_sLinkedClass, $sFieldCode);
                $aRow[$sFieldCode] = cmdbAbstractObject::GetFormElementForField($oP, $this->m_sLinkedClass, $sFieldCode, $oAttDef, $oNewLinkObj->Get($sFieldCode), '', $sSafeId, $sNameSuffix, 0, $aArgs);
                $aFieldsMap[$sFieldCode] = $sSafeId;
            }
            $sState = '';
            $oP->add_script(<<<EOF
\$(".date-pick").datepicker({
\t\tshowOn: 'button',
\t\tbuttonImage: '../images/calendar.png',
\t\tbuttonImageOnly: true,
\t\tdateFormat: 'yy-mm-dd',
\t\tconstrainInput: false,
\t\tchangeMonth: true,
\t\tchangeYear: true
\t});
\$(".datetime-pick").datepicker({
\t\tshowOn: 'button',
\t\tbuttonImage: '../images/calendar.png',
\t\tbuttonImageOnly: true,
\t\tdateFormat: 'yy-mm-dd 00:00:00',
\t\tconstrainInput: false,
\t\tchangeMonth: true,
\t\tchangeYear: true
});
EOF
);
        }
        $sExtKeyToMeId = utils::GetSafeId($sPrefix . $this->m_sExtKeyToMe);
        $aFieldsMap[$this->m_sExtKeyToMe] = $sExtKeyToMeId;
        $aRow['form::checkbox'] .= "<input type=\"hidden\" id=\"{$sExtKeyToMeId}\" value=\"" . $oCurrentObj->GetKey() . "\">";
        $sExtKeyToRemoteId = utils::GetSafeId($sPrefix . $this->m_sExtKeyToRemote);
        $aFieldsMap[$this->m_sExtKeyToRemote] = $sExtKeyToRemoteId;
        $aRow['form::checkbox'] .= "<input type=\"hidden\" id=\"{$sExtKeyToRemoteId}\" value=\"{$iRemoteObjKey}\">";
        $iFieldsCount = count($aFieldsMap);
        $sJsonFieldsMap = json_encode($aFieldsMap);
        $oP->add_script(<<<EOF
var {$aArgs['wizHelper']} = new WizardHelper('{$this->m_sLinkedClass}', '', '{$sState}');
{$aArgs['wizHelper']}.SetFieldsMap({$sJsonFieldsMap});
{$aArgs['wizHelper']}.SetFieldsCount({$iFieldsCount});
EOF
);
        $aRow['static::key'] = $oLinkedObj->GetHyperLink();
        foreach (MetaModel::GetZListItems($this->m_sRemoteClass, 'list') as $sFieldCode) {
            $aRow['static::' . $sFieldCode] = $oLinkedObj->GetAsHTML($sFieldCode);
        }
        return $aRow;
    }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:101,代码来源:ui.linkswidget.class.inc.php


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