菜单

staticinfotables调用方法

2010年07月12日 - typo3

pi中常用到国家列表,我们调用static info tables,方法如下:

if (t3lib_extMgm::isLoaded(STATIC_INFO_TABLES_EXTkey)) {
$this->staticInfo = &t3lib_div::getUserObj(‘&tx_staticinfotables_pi1’);
}


/**
* Adds Static Info markers to a marker array
*
* @param array  $markerArray: the input marker array
* @param array  $row: the table record
* @return void
*/
function addStaticInfoMarkers (&$markerArray, $row=”, $viewOnly=FALSE) {
if (!$markerArray)    {
$markerArray = $this->getArray();
}

if (is_object($this->staticInfo))    {
$cmd = $this->controlData->getCmd();
$theTable = $this->controlData->getTable();
if ($this->controlData->getMode() == MODE_PREVIEW || $viewOnly) {
$markerArray[‘###FIELD_static_info_country###’] = $this->staticInfo->getStaticInfoName(‘COUNTRIES’, is_array($row)?$row[‘static_info_country’]:”);
$markerArray[‘###FIELD_zone###’] = $this->staticInfo->getStaticInfoName(‘SUBDIVISIONS’, is_array($row)?$row[‘zone’]:”, is_array($row)?$row[‘static_info_country’]:”);
if (!$markerArray[‘###FIELD_zone###’] ) {
$markerArray[‘###HIDDENFIELDS###’] .= ‘<input type=”hidden” name=”FE[‘.$theTable.’][zone]” value=”” />’;
}
$markerArray[‘###FIELD_language###’] = $this->staticInfo->getStaticInfoName(‘LANGUAGES’, is_array($row)?$row[‘language’]:”);
} else {
if ($this->conf[‘templateStyle’] == ‘css-styled’) {
$idCountry = $this->pibase->pi_getClassName(‘static_info_country’);
$titleCountry = $this->langObj->getLL(‘tooltip_’ . (($cmd == ‘invite’)?’invitation_’:”)  . ‘static_info_country’);
$idZone = $this->pibase->pi_getClassName(‘zone’);
$titleZone = $this->langObj->getLL(‘tooltip_’ . (($cmd == ‘invite’)?’invitation_’:”)  . ‘zone’);
$idLanguage = $this->pibase->pi_getClassName(‘language’);
$titleLanguage = $this->langObj->getLL(‘tooltip_’ . (($cmd == ‘invite’)?’invitation_’:”)  . ‘language’);
}
$selected = (is_array($row) && isset($row[‘static_info_country’]) ? $row[‘static_info_country’] : array());
if (isset($this->conf[‘where.’]) && is_array($this->conf[‘where.’]))    {
$where = $this->conf[‘where.’][‘static_countries’];
}
$markerArray[‘###SELECTOR_STATIC_INFO_COUNTRY###’] = $this->staticInfo->buildStaticInfoSelector(
‘COUNTRIES’,
‘FE[‘.$theTable.’]’.'[static_info_country]’,
”,
$selected,
”,
$this->conf[‘onChangeCountryAttribute’],
$idCountry,
$titleCountry,
$where
);
$markerArray[‘###SELECTOR_ZONE###’] =
$this->staticInfo->buildStaticInfoSelector(
‘SUBDIVISIONS’,
‘FE[‘.$theTable.’]’.'[zone]’,
”,
is_array($row)?$row[‘zone’]:”,
is_array($row)?$row[‘static_info_country’]:”,
”,
$idZone,
$titleZone
);
if (!$markerArray[‘###SELECTOR_ZONE###’] ) {
$markerArray[‘###HIDDENFIELDS###’] .= ‘<input type=”hidden” name=”FE[‘.$theTable.’][zone]” value=”” />’;
}

$markerArray[‘###SELECTOR_LANGUAGE###’] =
$this->staticInfo->buildStaticInfoSelector(
‘LANGUAGES’,
‘FE[‘.$theTable.’]’.'[language]’,
”,
is_array($row)?$row[‘language’]:”,
”,
”,
$idLanguage,
$titleLanguage
);
}
}
}    // addStaticInfoMarkers

发表评论

电子邮件地址不会被公开。 必填项已用*标注