protected function GetSampleData(DBObject $oObj, $sAttCode)
 {
     return $oObj->GetAsHTML($sAttCode);
 }
    /**
     * A one-row form for editing a link record
     * @param WebPage $oP Web page used for the ouput
     * @param DBObject $oLinkedObj The object to which all the elements of the linked set refer to
     * @param mixed $linkObjOrId Either the object linked or a unique number for new link records to add
     * @param Hash $aArgs Extra context arguments
     * @return string The HTML fragment of the one-row form
     */
    protected function GetFormRow(WebPage $oP, DBObject $oLinkedObj, $linkObjOrId = null, $aArgs = array(), $oCurrentObj)
    {
        $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;
    }