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


PHP MetaModel::GetLabel方法代码示例

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


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

示例1: GetLabel

 public function GetLabel($sClass, $sAttCodeEx)
 {
     return MetaModel::GetLabel($sClass, $sAttCodeEx);
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:4,代码来源:modelreflection.class.inc.php

示例2: GetHTMLTableConfig

 protected function GetHTMLTableConfig($aColumns, $sSelectMode, $bViewLink)
 {
     $aAttribs = array();
     if ($sSelectMode == 'multiple') {
         $aAttribs['form::select'] = array('label' => "<input type=\"checkbox\" onClick=\"CheckAll('.selectList{$this->iListId}:not(:disabled)', this.checked);\" class=\"checkAll\"></input>", 'description' => Dict::S('UI:SelectAllToggle+'));
     } else {
         if ($sSelectMode == 'single') {
             $aAttribs['form::select'] = array('label' => "", 'description' => '');
         }
     }
     foreach ($this->aClassAliases as $sAlias => $sClassName) {
         foreach ($aColumns[$sAlias] as $sAttCode => $aData) {
             if ($aData['checked']) {
                 if ($sAttCode == '_key_') {
                     $aAttribs['key_' . $sAlias] = array('label' => MetaModel::GetName($sClassName), 'description' => '');
                 } else {
                     $oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode);
                     $aAttribs[$sAttCode . '_' . $sAlias] = array('label' => MetaModel::GetLabel($sClassName, $sAttCode), 'description' => $oAttDef->GetOrderByHint());
                 }
             }
         }
     }
     return $aAttribs;
 }
开发者ID:henryavila,项目名称:itop,代码行数:24,代码来源:datatable.class.inc.php

示例3: GetRenderContent

    public function GetRenderContent(WebPage $oPage, $aExtraParams = array(), $sId)
    {
        $sHtml = '';
        // Add the extra params into the filter if they make sense for such a filter
        $bDoSearch = utils::ReadParam('dosearch', false);
        if ($this->m_oSet == null) {
            $aQueryParams = array();
            if (isset($aExtraParams['query_params'])) {
                $aQueryParams = $aExtraParams['query_params'];
            }
            if ($this->m_sStyle != 'links') {
                $oAppContext = new ApplicationContext();
                $sClass = $this->m_oFilter->GetClass();
                $aFilterCodes = array_keys(MetaModel::GetClassFilterDefs($sClass));
                $aCallSpec = array($sClass, 'MapContextParam');
                if (is_callable($aCallSpec)) {
                    foreach ($oAppContext->GetNames() as $sContextParam) {
                        $sParamCode = call_user_func($aCallSpec, $sContextParam);
                        //Map context parameter to the value/filter code depending on the class
                        if (!is_null($sParamCode)) {
                            $sParamValue = $oAppContext->GetCurrentValue($sContextParam, null);
                            if (!is_null($sParamValue)) {
                                $aExtraParams[$sParamCode] = $sParamValue;
                            }
                        }
                    }
                }
                foreach ($aFilterCodes as $sFilterCode) {
                    $externalFilterValue = utils::ReadParam($sFilterCode, '', false, 'raw_data');
                    $condition = null;
                    if (isset($aExtraParams[$sFilterCode])) {
                        $condition = $aExtraParams[$sFilterCode];
                    }
                    if ($bDoSearch && $externalFilterValue != "") {
                        // Search takes precedence over context params...
                        unset($aExtraParams[$sFilterCode]);
                        if (!is_array($externalFilterValue)) {
                            $condition = trim($externalFilterValue);
                        } else {
                            if (count($externalFilterValue) == 1) {
                                $condition = trim($externalFilterValue[0]);
                            } else {
                                $condition = $externalFilterValue;
                            }
                        }
                    }
                    if (!is_null($condition)) {
                        $sOpCode = null;
                        // default operator
                        if (is_array($condition)) {
                            // Multiple values, add them as AND X IN (v1, v2, v3...)
                            $sOpCode = 'IN';
                        }
                        $this->AddCondition($sFilterCode, $condition, $sOpCode);
                    }
                }
                if ($bDoSearch) {
                    // Keep the table_id identifying this table if we're performing a search
                    $sTableId = utils::ReadParam('_table_id_', null, false, 'raw_data');
                    if ($sTableId != null) {
                        $aExtraParams['table_id'] = $sTableId;
                    }
                }
            }
            $aOrderBy = array();
            if (isset($aExtraParams['order_by'])) {
                // Convert the string describing the order_by parameter into an array
                // The syntax is +attCode1,-attCode2
                // attCode1 => ascending, attCode2 => descending
                $aTemp = explode(',', $aExtraParams['order_by']);
                foreach ($aTemp as $sTemp) {
                    $aMatches = array();
                    if (preg_match('/^([+-])?(.+)$/', $sTemp, $aMatches)) {
                        $bAscending = true;
                        if ($aMatches[1] == '-') {
                            $bAscending = false;
                        }
                        $aOrderBy[$aMatches[2]] = $bAscending;
                    }
                }
            }
            $this->m_oSet = new CMDBObjectSet($this->m_oFilter, $aOrderBy, $aQueryParams);
        }
        switch ($this->m_sStyle) {
            case 'count':
                if (isset($aExtraParams['group_by'])) {
                    if (isset($aExtraParams['group_by_label'])) {
                        $oGroupByExp = Expression::FromOQL($aExtraParams['group_by']);
                        $sGroupByLabel = $aExtraParams['group_by_label'];
                    } else {
                        // Backward compatibility: group_by is simply a field id
                        $sAlias = $this->m_oFilter->GetClassAlias();
                        $oGroupByExp = new FieldExpression($aExtraParams['group_by'], $sAlias);
                        $sGroupByLabel = MetaModel::GetLabel($this->m_oFilter->GetClass(), $aExtraParams['group_by']);
                    }
                    $aGroupBy = array();
                    $aGroupBy['grouped_by_1'] = $oGroupByExp;
                    $sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy, true);
                    $aRes = CMDBSource::QueryToArray($sSql);
                    $aGroupBy = array();
//.........这里部分代码省略.........
开发者ID:henryavila,项目名称:itop,代码行数:101,代码来源:displayblock.class.inc.php

示例4: DisplayBareProperties

 function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = array())
 {
     if ($bEditMode) {
         return;
     }
     // Not editable
     $oPage->add('<table style="vertical-align:top"><tr style="vertical-align:top"><td>');
     $aDetails = array();
     $sClass = get_class($this);
     $oPage->add('<fieldset>');
     $oPage->add('<legend>' . Dict::S('Core:SynchroReplica:PrivateDetails') . '</legend>');
     $aZList = MetaModel::FlattenZlist(MetaModel::GetZListItems($sClass, 'details'));
     foreach ($aZList as $sAttCode) {
         $sDisplayValue = $this->GetAsHTML($sAttCode);
         $aDetails[] = array('label' => '<span title="' . MetaModel::GetDescription($sClass, $sAttCode) . '">' . MetaModel::GetLabel($sClass, $sAttCode) . '</span>', 'value' => $sDisplayValue);
     }
     $oPage->Details($aDetails);
     $oPage->add('</fieldset>');
     if (strlen($this->Get('dest_class')) > 0) {
         $oDestObj = MetaModel::GetObject($this->Get('dest_class'), $this->Get('dest_id'), false);
         if (is_object($oDestObj)) {
             $oPage->add('<fieldset>');
             $oPage->add('<legend>' . Dict::Format('Core:SynchroReplica:TargetObject', $oDestObj->GetHyperlink()) . '</legend>');
             $oDestObj->DisplayBareProperties($oPage, false, $sPrefix, $aExtraParams);
             $oPage->add('<fieldset>');
         }
     }
     $oPage->add('</td><td>');
     $oPage->add('<fieldset>');
     $oPage->add('<legend>' . Dict::S('Core:SynchroReplica:PublicData') . '</legend>');
     $oSource = MetaModel::GetObject('SynchroDataSource', $this->Get('sync_source_id'));
     $sSQLTable = $oSource->GetDataTable();
     $aData = $this->LoadExtendedDataFromTable($sSQLTable);
     $aHeaders = array('attcode' => array('label' => 'Attribute Code', 'description' => ''), 'data' => array('label' => 'Value', 'description' => ''));
     $aRows = array();
     foreach ($aData as $sKey => $value) {
         $aRows[] = array('attcode' => $sKey, 'data' => $value);
     }
     $oPage->Table($aHeaders, $aRows);
     $oPage->add('</fieldset>');
     $oPage->add('</td></tr></table>');
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:42,代码来源:synchrodatasource.class.inc.php

示例5: GetMappingForField

/**
 * Helper function to build the mapping drop-down list for a field
 * Spec: Possible choices are "writable" fields in this class plus external fields that are listed as reconciliation keys
 *       for any class pointed to by an external key in the current class.
 *       If not in advanced mode, all "id" fields (id and external keys) must be mapped to ":none:" (i.e -- ignore this field --)
 *       External fields that do not correspond to a reconciliation key must be mapped to ":none:"
 *       Otherwise, if a field equals either the 'code' or the 'label' (translated) of a field, then it's mapped automatically
 * @param string $sClassName Name of the class used for the mapping
 * @param string $sFieldName Name of the field, as it comes from the data file (header line)
 * @param integer $iFieldIndex Number of the field in the sequence
 * @param bool $bAdvancedMode Whether or not advanced mode was chosen
 * @param string $sDefaultChoice If set, this will be the item selected by default
 * @return string The HTML code corresponding to the drop-down list for this field
 */
function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMode, $sDefaultChoice)
{
    $aChoices = array('' => Dict::S('UI:CSVImport:MappingSelectOne'));
    $aChoices[':none:'] = Dict::S('UI:CSVImport:MappingNotApplicable');
    $sFieldCode = '';
    // Code of the attribute, if there is a match
    $aMatches = array();
    if (preg_match('/^(.+)\\*$/', $sFieldName, $aMatches)) {
        // Remove any trailing "star" character.
        // A star character at the end can be used to indicate a mandatory field
        $sFieldName = $aMatches[1];
    } else {
        if (preg_match('/^(.+)\\*->(.+)$/', $sFieldName, $aMatches)) {
            // Remove any trailing "star" character before the arrow (->)
            // A star character at the end can be used to indicate a mandatory field
            $sFieldName = $aMatches[1] . '->' . $aMatches[2];
        }
    }
    if ($sFieldName == 'id') {
        $sFieldCode = 'id';
    }
    if ($bAdvancedMode) {
        $aChoices['id'] = Dict::S('UI:CSVImport:idField');
    }
    foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) {
        $sStar = '';
        if ($oAttDef->IsExternalKey()) {
            if ($sFieldName == $oAttDef->GetLabel() || $sFieldName == $sAttCode) {
                $sFieldCode = $sAttCode;
            }
            if ($bAdvancedMode) {
                $aChoices[$sAttCode] = $oAttDef->GetLabel();
            }
            $oExtKeyAttDef = MetaModel::GetAttributeDef($sClassName, $oAttDef->GetKeyAttCode());
            if (!$oExtKeyAttDef->IsNullAllowed()) {
                $sStar = '*';
            }
            // Get fields of the external class that are considered as reconciliation keys
            $sTargetClass = $oAttDef->GetTargetClass();
            foreach (MetaModel::ListAttributeDefs($sTargetClass) as $sTargetAttCode => $oTargetAttDef) {
                if (MetaModel::IsReconcKey($sTargetClass, $sTargetAttCode)) {
                    $bExtKey = $oTargetAttDef->IsExternalKey();
                    $sSuffix = '';
                    if ($bExtKey) {
                        $sSuffix = '->id';
                    }
                    if ($bAdvancedMode || !$bExtKey) {
                        // When not in advanced mode do not allow to use reconciliation keys (on external keys) if they are themselves external keys !
                        $aChoices[$sAttCode . '->' . $sTargetAttCode] = MetaModel::GetLabel($sClassName, $sAttCode . '->' . $sTargetAttCode, true);
                        if (strcasecmp($sFieldName, $oAttDef->GetLabel() . '->' . $oTargetAttDef->GetLabel() . $sSuffix) == 0 || strcasecmp($sFieldName, $sAttCode . '->' . $sTargetAttCode . $sSuffix) == 0) {
                            $sFieldCode = $sAttCode . '->' . $sTargetAttCode;
                        }
                    }
                }
            }
        } else {
            if ($oAttDef->IsWritable() && (!$oAttDef->IsLinkset() || $bAdvancedMode && $oAttDef->IsIndirect())) {
                $aChoices[$sAttCode] = MetaModel::GetLabel($sClassName, $sAttCode, true);
                if ($sFieldName == $oAttDef->GetLabel() || $sFieldName == $sAttCode) {
                    $sFieldCode = $sAttCode;
                }
            }
        }
    }
    asort($aChoices);
    $sHtml = "<select id=\"mapping_{$iFieldIndex}\" name=\"field[{$iFieldIndex}]\">\n";
    $bIsIdField = IsIdField($sClassName, $sFieldCode);
    foreach ($aChoices as $sAttCode => $sLabel) {
        $sSelected = '';
        if ($bIsIdField && !$bAdvancedMode) {
            if ($sAttCode == ':none:') {
                $sSelected = ' selected';
            }
        } else {
            if (empty($sFieldCode) && strpos($sFieldName, '->') !== false) {
                if ($sAttCode == ':none:') {
                    $sSelected = ' selected';
                }
            } else {
                if (is_null($sDefaultChoice) && $sFieldCode == $sAttCode) {
                    $sSelected = ' selected';
                } else {
                    if (!is_null($sDefaultChoice) && $sDefaultChoice == $sAttCode) {
                        $sSelected = ' selected';
                    }
                }
//.........这里部分代码省略.........
开发者ID:henryavila,项目名称:itop,代码行数:101,代码来源:ajax.csvimport.php

示例6: GetFieldsList

 protected function GetFieldsList($oSet, $bFieldsAdvanced = false, $bLocalize = true, $aFields = null)
 {
     $this->aFieldsList = array();
     $oAppContext = new ApplicationContext();
     $aClasses = $oSet->GetFilter()->GetSelectedClasses();
     $this->aAuthorizedClasses = array();
     foreach ($aClasses as $sAlias => $sClassName) {
         if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) && (UR_ALLOWED_YES || UR_ALLOWED_DEPENDS)) {
             $this->aAuthorizedClasses[$sAlias] = $sClassName;
         }
     }
     $aAttribs = array();
     $this->aTableHeaders = array();
     foreach ($this->aAuthorizedClasses as $sAlias => $sClassName) {
         $aList[$sAlias] = array();
         foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) {
             if (is_null($aFields) || count($aFields) == 0) {
                 // Standard list of attributes (no link sets)
                 if ($oAttDef->IsScalar() && ($oAttDef->IsWritable() || $oAttDef->IsExternalField())) {
                     $sAttCodeEx = $oAttDef->IsExternalField() ? $oAttDef->GetKeyAttCode() . '->' . $oAttDef->GetExtAttCode() : $sAttCode;
                     if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) {
                         if ($bFieldsAdvanced) {
                             $aList[$sAlias][$sAttCodeEx] = $oAttDef;
                             if ($oAttDef->IsExternalKey(EXTKEY_RELATIVE)) {
                                 $sRemoteClass = $oAttDef->GetTargetClass();
                                 foreach (MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) {
                                     $this->aFieldsList[$sAlias][$sAttCode . '->' . $sRemoteAttCode] = MetaModel::GetAttributeDef($sRemoteClass, $sRemoteAttCode);
                                 }
                             }
                         }
                     } else {
                         // Any other attribute
                         $this->aFieldsList[$sAlias][$sAttCodeEx] = $oAttDef;
                     }
                 }
             } else {
                 // User defined list of attributes
                 if (in_array($sAttCode, $aFields) || in_array($sAlias . '.' . $sAttCode, $aFields)) {
                     $this->aFieldsList[$sAlias][$sAttCode] = $oAttDef;
                 }
             }
         }
         if ($bFieldsAdvanced) {
             $this->aTableHeaders['id'] = '0';
         }
         foreach ($this->aFieldsList[$sAlias] as $sAttCodeEx => $oAttDef) {
             $sLabel = $bLocalize ? MetaModel::GetLabel($sClassName, $sAttCodeEx, isset($aParams['showMandatoryFields'])) : $sAttCodeEx;
             if ($oAttDef instanceof AttributeDateTime) {
                 $this->aTableHeaders[$sLabel] = 'datetime';
             } else {
                 $this->aTableHeaders[$sLabel] = 'string';
             }
         }
     }
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:55,代码来源:excelexporter.class.inc.php

示例7: MakeStimulusForm

/**
 * Create form to apply a stimulus
 * @param WebPage $oP The current web page
 * @param Object $oObj The target object
 * @param String $sStimulusCode Stimulus that will be applied
 * @param Array $aEditAtt List of attributes to edit
 * @return void
 */
function MakeStimulusForm(WebPage $oP, $oObj, $sStimulusCode, $aEditAtt)
{
    static $bHasStimulusForm = false;
    $sDialogId = $sStimulusCode . "_dialog";
    $sFormId = $sStimulusCode . "_form";
    $sCancelButtonLabel = Dict::S('UI:Button:Cancel');
    $oP->add('<div id="' . $sDialogId . '" style="display: none;">');
    $sClass = get_class($oObj);
    $oP->add('<form id="' . $sFormId . '" method="post">');
    $sTransactionId = utils::GetNewTransactionId();
    $oP->add("<input type=\"hidden\" id=\"transaction_id\" name=\"transaction_id\" value=\"{$sTransactionId}\">\n");
    $oP->add("<input type=\"hidden\" name=\"class\" value=\"{$sClass}\">");
    $oP->add("<input type=\"hidden\" name=\"id\" value=\"" . $oObj->GetKey() . "\">");
    $oP->add("<input type=\"hidden\" name=\"operation\" value=\"update_request\">");
    $oP->add("<input type=\"hidden\" id=\"stimulus_to_apply\" name=\"apply_stimulus\" value=\"{$sStimulusCode}\">\n");
    foreach ($aEditAtt as $sAttCode) {
        $sValue = $oObj->Get($sAttCode);
        $sDisplayValue = $oObj->GetEditValue($sAttCode);
        $aArgs = array('this' => $oObj, 'formPrefix' => '');
        $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
        $sInputId = 'input_' . $sAttCode;
        $sHTMLValue = "<span id=\"field_{$sStimulusCode}_{$sInputId}\">" . cmdbAbstractObject::GetFormElementForField($oP, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', 0, $aArgs) . '</span>';
        $oP->add('<h1>' . MetaModel::GetLabel($sClass, $sAttCode) . '</h1>');
        $oP->add($sHTMLValue);
    }
    $oP->add('</form>');
    $oP->add('</div>');
    if (!$bHasStimulusForm) {
        $bHasStimulusForm = true;
        $oP->add_script(<<<EOF

function RunStimulusDialog(sStimulusCode, sTitle, sOkButtonLabel)
{
\tvar sWidth = 'auto';
\tif (sStimulusCode == 'ev_reopen')
\t{
\t\t// Avoid having a dialog spanning the complete width of the window
\t\t// just because it contains a CaseLog entry
\t\tsWidth = '80%';
\t}
\t\t\t\t
\t\$('#'+sStimulusCode+'_dialog').dialog({
\t\theight: 'auto',
\t\twidth: sWidth,
\t\tmodal: true,
\t\ttitle: sTitle,
\t\tbuttons: [
\t\t{ text: sOkButtonLabel, click: function() {
\t\t\t\$(this).find('#'+sStimulusCode+'_form').submit();
\t\t} },
\t\t{ text: "{$sCancelButtonLabel}", click: function() {
\t\t\t\$(this).dialog( "close" );
\t\t} }
\t\t]
\t});
\t// Start the validation
\tCheckFields(sStimulusCode+'_form', false);
\t\$('#'+sStimulusCode+'_form').submit( function() {
\t\treturn OnSubmit(sStimulusCode+'_form');
\t});
}
EOF
);
    }
}
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:73,代码来源:index.php

示例8: ProcessCSVData


//.........这里部分代码省略.........
                } else {
                    if ($sAttCode == 'id') {
                        $aAttributes['id'] = $iIndex;
                    } else {
                        $oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode);
                        if ($oAttDef->IsExternalKey()) {
                            $aExtKeys[$sAttCode]['id'] = $iIndex;
                            $aExternalKeysByColumn[$iIndex] = $sAttCode;
                        } else {
                            $aAttributes[$sAttCode] = $iIndex;
                        }
                    }
                }
            }
        }
        $oMyChange = null;
        if (!$bSimulate) {
            // We're doing it for real, let's create a change
            $sUserString = CMDBChange::GetCurrentUserName() . ' (CSV)';
            CMDBObject::SetTrackInfo($sUserString);
            CMDBObject::SetTrackOrigin('csv-interactive');
            $oMyChange = CMDBObject::GetCurrentChange();
        }
        $oBulk = new BulkChange($sClassName, $aData, $aAttributes, $aExtKeys, array_keys($aSearchKeys), empty($sSynchroScope) ? null : $sSynchroScope, $aSynchroUpdate, null, true);
        $oBulk->SetReportHtml();
        $oPage->add('<input type="hidden" name="csvdata_truncated" id="csvdata_truncated" value="' . htmlentities($sCSVDataTruncated, ENT_QUOTES, 'UTF-8') . '"/>');
        $aRes = $oBulk->Process($oMyChange);
        $sHtml = '<table id="bulk_preview" style="border-collapse: collapse;">';
        $sHtml .= '<tr><th style="padding:2px;border-right: 2px #fff solid;">Line</th>';
        $sHtml .= '<th style="padding:2px;border-right: 2px #fff solid;">Status</th>';
        $sHtml .= '<th style="padding:2px;border-right: 2px #fff solid;">Object</th>';
        foreach ($aFieldsMapping as $iNumber => $sAttCode) {
            if (!empty($sAttCode) && $sAttCode != ':none:' && $sAttCode != 'finalclass') {
                $sHtml .= "<th style=\"padding:2px;border-right: 2px #fff solid;\">" . MetaModel::GetLabel($sClassName, $sAttCode) . "</th>";
            }
        }
        $sHtml .= '<th>Message</th>';
        $sHtml .= '</tr>';
        $iErrors = 0;
        $iCreated = 0;
        $iModified = 0;
        $iUnchanged = 0;
        foreach ($aRes as $iLine => $aResRow) {
            $oStatus = $aResRow['__STATUS__'];
            $sUrl = '';
            $sMessage = '';
            $sCSSRowClass = '';
            $sCSSMessageClass = 'cell_ok';
            switch (get_class($oStatus)) {
                case 'RowStatus_NoChange':
                    $iUnchanged++;
                    $sFinalClass = $aResRow['finalclass'];
                    $oObj = MetaModel::GetObject($sFinalClass, $aResRow['id']->GetPureValue());
                    $sUrl = $oObj->GetHyperlink();
                    $sStatus = '<img src="../images/unchanged.png" title="' . Dict::S('UI:CSVReport-Icon-Unchanged') . '">';
                    $sCSSRowClass = 'row_unchanged';
                    break;
                case 'RowStatus_Modify':
                    $iModified++;
                    $sFinalClass = $aResRow['finalclass'];
                    $oObj = MetaModel::GetObject($sFinalClass, $aResRow['id']->GetPureValue());
                    $sUrl = $oObj->GetHyperlink();
                    $sStatus = '<img src="../images/modified.png" title="' . Dict::S('UI:CSVReport-Icon-Modified') . '">';
                    $sCSSRowClass = 'row_modified';
                    break;
                case 'RowStatus_Disappeared':
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:67,代码来源:csvimport.php

示例9: ReadParameters

 public function ReadParameters()
 {
     parent::ReadParameters();
     $sQueryId = utils::ReadParam('query', null, true);
     $sFields = utils::ReadParam('fields', null, true, 'raw_data');
     if (($sFields === null || $sFields === '') && $sQueryId === null) {
         throw new BulkExportMissingParameterException('fields');
     } else {
         if ($sQueryId !== null && $sQueryId !== null) {
             $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', array('query_id' => $sQueryId));
             $oQueries = new DBObjectSet($oSearch);
             if ($oQueries->Count() > 0) {
                 $oQuery = $oQueries->Fetch();
                 if ($sFields === null || $sFields === '') {
                     // No 'fields' parameter supplied, take the fields from the query phrasebook definition
                     $sFields = trim($oQuery->Get('fields'));
                     if ($sFields === '') {
                         throw new BulkExportMissingParameterException('fields');
                     }
                 }
             } else {
                 throw BulkExportException('Invalid value for the parameter: query. There is no Query Phrasebook with id = ' . $sQueryId, Dict::Format('Core:BulkExport:InvalidParameter_Query', $sQueryId));
             }
         }
     }
     // Interpret (and check) the list of fields
     //
     $aSelectedClasses = $this->oSearch->GetSelectedClasses();
     $aAliases = array_keys($aSelectedClasses);
     $aAuthorizedClasses = array();
     foreach ($aSelectedClasses as $sAlias => $sClassName) {
         if (UserRights::IsActionAllowed($sClassName, UR_ACTION_BULK_READ) == UR_ALLOWED_YES) {
             $aAuthorizedClasses[$sAlias] = $sClassName;
         }
     }
     $aFields = explode(',', $sFields);
     $this->aStatusInfo['fields'] = array();
     foreach ($aFields as $sFieldSpec) {
         // Trim the values since it's natural to write: fields=name, first_name, org_name instead of fields=name,first_name,org_name
         $sExtendedAttCode = trim($sFieldSpec);
         if (preg_match('/^([^\\.]+)\\.(.+)$/', $sExtendedAttCode, $aMatches)) {
             $sAlias = $aMatches[1];
             $sAttCode = $aMatches[2];
         } else {
             $sAlias = reset($aAliases);
             $sAttCode = $sExtendedAttCode;
         }
         if (!array_key_exists($sAlias, $aSelectedClasses)) {
             throw new Exception("Invalid alias '{$sAlias}' for the column '{$sExtendedAttCode}'. Availables aliases: '" . implode("', '", $aAliases) . "'");
         }
         $sClass = $aSelectedClasses[$sAlias];
         if (!array_key_exists($sAlias, $aAuthorizedClasses)) {
             throw new Exception("You do not have enough permissions to bulk read data of class '{$sClass}' (alias: {$sAlias})");
         }
         if ($this->bLocalizeOutput) {
             try {
                 $sLabel = MetaModel::GetLabel($sClass, $sAttCode);
             } catch (Exception $e) {
                 throw new Exception("Wrong field specification '{$sFieldSpec}': " . $e->getMessage());
             }
         } else {
             $sLabel = $sAttCode;
         }
         if (count($aAuthorizedClasses) > 1) {
             $sColLabel = $sAlias . '.' . $sLabel;
         } else {
             $sColLabel = $sLabel;
         }
         $this->aStatusInfo['fields'][] = array('sFieldSpec' => $sExtendedAttCode, 'sAlias' => $sAlias, 'sClass' => $sClass, 'sAttCode' => $sAttCode, 'sLabel' => $sLabel, 'sColLabel' => $sColLabel);
     }
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:71,代码来源:tabularbulkexport.class.inc.php

示例10: GetHeader

 public function GetHeader()
 {
     $oSet = new DBObjectSet($this->oSearch);
     $this->aStatusInfo['status'] = 'running';
     $this->aStatusInfo['position'] = 0;
     $this->aStatusInfo['total'] = $oSet->Count();
     $aSelectedClasses = $this->oSearch->GetSelectedClasses();
     $aData = array();
     foreach ($this->aStatusInfo['fields'] as $sExtendedAttCode) {
         if (preg_match('/^([^\\.]+)\\.(.+)$/', $sExtendedAttCode, $aMatches)) {
             $sAlias = $aMatches[1];
             $sAttCode = $aMatches[2];
         } else {
             $sAlias = reset($aSelectedClasses);
             $sAttCode = $sExtendedAttCode;
         }
         if (!array_key_exists($sAlias, $aSelectedClasses)) {
             throw new Exception("Invalid alias '{$sAlias}' for the column '{$sExtendedAttCode}'. Availables aliases: '" . implode("', '", array_keys($aSelectedClasses)) . "'");
         }
         $sClass = $aSelectedClasses[$sAlias];
         switch ($sAttCode) {
             case 'id':
                 if (count($aSelectedClasses) > 1) {
                     $aData[] = $sAlias . '.id';
                     //@@@
                 } else {
                     $aData[] = 'id';
                     //@@@
                 }
                 break;
             default:
                 $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
                 $sColLabel = $this->aStatusInfo['localize'] ? MetaModel::GetLabel($sClass, $sAttCode) : $sAttCode;
                 $oFinalAttDef = $oAttDef->GetFinalAttDef();
                 if (get_class($oFinalAttDef) == 'AttributeDateTime') {
                     if (count($aSelectedClasses) > 1) {
                         $aData[] = $sAlias . '.' . $sColLabel . ' (' . Dict::S('UI:SplitDateTime-Date') . ')';
                         $aData[] = $sAlias . '.' . $sColLabel . ' (' . Dict::S('UI:SplitDateTime-Time') . ')';
                     } else {
                         $aData[] = $sColLabel . ' (' . Dict::S('UI:SplitDateTime-Date') . ')';
                         $aData[] = $sColLabel . ' (' . Dict::S('UI:SplitDateTime-Time') . ')';
                     }
                 } else {
                     if (count($aSelectedClasses) > 1) {
                         $aData[] = $sAlias . '.' . $sColLabel;
                     } else {
                         $aData[] = $sColLabel;
                     }
                 }
         }
     }
     $sData = "<table border=\"1\">\n";
     $sData .= "<tr>\n";
     foreach ($aData as $sLabel) {
         $sData .= "<td>" . $sLabel . "</td>\n";
     }
     $sData .= "</tr>\n";
     return $sData;
 }
开发者ID:henryavila,项目名称:itop,代码行数:59,代码来源:spreadsheetbulkexport.class.inc.php

示例11: GetTableConfig

 protected function GetTableConfig()
 {
     $aAttribs = array();
     $aAttribs['form::select'] = array('label' => "<input type=\"checkbox\" onClick=\"CheckAll('.selectList{$this->sInputid}:not(:disabled)', this.checked);\" class=\"checkAll\"></input>", 'description' => Dict::S('UI:SelectAllToggle+'));
     foreach ($this->aZlist as $sLinkedAttCode) {
         $oAttDef = MetaModel::GetAttributeDef($this->sLinkedClass, $sLinkedAttCode);
         $aAttribs[$sLinkedAttCode] = array('label' => MetaModel::GetLabel($this->sLinkedClass, $sLinkedAttCode), 'description' => $oAttDef->GetOrderByHint());
     }
     return $aAttribs;
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:10,代码来源:ui.linksdirectwidget.class.inc.php

示例12: array

             $aExtKeys[$sExtKeyAttCode][$sRemoteAttCode] = $iFieldId;
         } else {
             $aAttList[$sFieldName] = $iFieldId;
         }
     }
 }
 // Make sure there are some reconciliation keys
 //
 if (empty($sReconcKeys)) {
     $aReconcSpec = array();
     // Base reconciliation scheme on the default one
     // The reconciliation attributes not present in the data will be ignored
     foreach (MetaModel::GetReconcKeys($sClass) as $sReconcKeyAttCode) {
         if (in_array($sReconcKeyAttCode, $aFieldList)) {
             if ($bLocalize) {
                 $aReconcSpec[] = MetaModel::GetLabel($sClass, $sReconcKeyAttCode);
             } else {
                 $aReconcSpec[] = $sReconcKeyAttCode;
             }
         }
     }
     if (count($aReconcSpec) == 0) {
         throw new BulkLoadException("No reconciliation scheme could be defined, please add a column corresponding to one defined reconciliation key (class: '{$sClass}', reconciliation:" . implode(',', MetaModel::GetReconcKeys($sClass)) . ")");
     }
     $sReconcKeys = implode(',', $aReconcSpec);
 }
 // Interpret the list of reconciliation keys
 //
 $aFinalReconcilKeys = array();
 $aReconcilKeysReport = array();
 foreach (explode(',', $sReconcKeys) as $sReconcKey) {
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:31,代码来源:import.php

示例13: DisplayBareProperties

 function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = array())
 {
     if ($bEditMode) {
         return array();
     }
     // Not editable
     $aDetails = array();
     $sClass = get_class($this);
     $aZList = MetaModel::FlattenZlist(MetaModel::GetZListItems($sClass, 'details'));
     foreach ($aZList as $sAttCode) {
         $sDisplayValue = $this->GetAsHTML($sAttCode);
         $aDetails[] = array('label' => '<span title="' . MetaModel::GetDescription($sClass, $sAttCode) . '">' . MetaModel::GetLabel($sClass, $sAttCode) . '</span>', 'value' => $sDisplayValue);
     }
     $oPage->Details($aDetails);
     return array();
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:16,代码来源:event.class.inc.php

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

示例15: GetFieldAsHtml

 protected function GetFieldAsHtml($sClass, $sAttCode, $sStateAttCode)
 {
     $retVal = null;
     if ($this->IsNew()) {
         $iFlags = $this->GetInitialStateAttributeFlags($sAttCode);
     } else {
         $iFlags = $this->GetAttributeFlags($sAttCode);
     }
     $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
     if (!$oAttDef->IsLinkSet() && ($iFlags & OPT_ATT_HIDDEN) == 0) {
         // The field is visible in the current state of the object
         if ($sStateAttCode == $sAttCode) {
             // Special display for the 'state' attribute itself
             $sDisplayValue = $this->GetStateLabel();
         } else {
             if ($oAttDef->GetEditClass() == 'Document') {
                 $oDocument = $this->Get($sAttCode);
                 $sDisplayValue = $this->GetAsHTML($sAttCode);
                 $sDisplayValue .= "<br/>" . Dict::Format('UI:OpenDocumentInNewWindow_', $oDocument->GetDisplayLink(get_class($this), $this->GetKey(), $sAttCode)) . ", \n";
                 $sDisplayValue .= "<br/>" . Dict::Format('UI:DownloadDocument_', $oDocument->GetDownloadLink(get_class($this), $this->GetKey(), $sAttCode)) . ", \n";
             } else {
                 $sDisplayValue = $this->GetAsHTML($sAttCode);
             }
         }
         $retVal = array('label' => '<span title="' . MetaModel::GetDescription($sClass, $sAttCode) . '">' . MetaModel::GetLabel($sClass, $sAttCode) . '</span>', 'value' => $sDisplayValue);
     }
     return $retVal;
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:28,代码来源:cmdbabstract.class.inc.php


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