<?php 
$sTableID = $this->getCode();
$lAdmin = new CAdminList($sTableID);
$aHeaders = array(array('id' => 'name', 'content' => GetMessage('NAME'), 'default' => true), array('id' => 'value', 'content' => GetMessage('VALUE'), 'default' => true));
$lAdmin->AddHeaders($aHeaders);
foreach ($aOptions as $sKey => $aDescription) {
    $row =& $lAdmin->AddRow($sKey, $aDescription);
    $row->AddViewField("name", $aDescription['name']);
    $mValue = $aDescription['value'];
    //if( !is_array( $aDescription['value'] ) ) $aDescription['value'] = array( $aDescription['value'] );
    $sResult = '';
    $Name = $this->getCode() . '[' . $sKey . ']' . (isset($aDescription['multiple']) ? '[]' : '');
    switch ($aDescription['type']) {
        case 'select|usergroup':
            $sResult = BitrixGemsHelper::GetUserGroupSelect($Name, $mValue, $aDescription['multiple']);
            break;
        case 'select':
            if ($aDescription['multiple']) {
                $sResult .= '<select name="' . $Name . '" multiple="multiple">';
            } else {
                $sResult .= '<select name="' . $Name . '">';
                if (!is_array($mValue)) {
                    $mValue = array($mValue);
                }
            }
            if (!empty($aDescription['options'])) {
                foreach ($aDescription['options'] as $sKey => $sOption) {
                    $sResult .= '<option value="' . $sKey . '" ' . (in_array($sKey, $mValue) ? 'selected="selected"' : '') . ' >' . $sOption . '</option>';
                }
            }
Example #2
0
$tabControl = new CAdminTabControl("tabControl", $aTabs);

$tabControl->Begin();
?>
<form method="POST" action="<?echo $APPLICATION->GetCurPage()?>?mid=<?=htmlspecialchars($mid)?>&lang=<?=LANGUAGE_ID?>"><?=bitrix_sessid_post()?>
<?$tabControl->BeginNextTab();?>
<?
$aInstalledGems = $oGemManager->getInstalledGems( $bReturnGems = true );
?>
<tr><td>
	<table>
	<?foreach( $aInstalledGems as $sGem => $oGem ):?>
		<?
		if( $oGem->needAdminPage() === false ) continue;
		?>
		<tr>
			<td valign="top"><?=$sGem?></td>
			<td><?=BitrixGemsHelper::GetUserGroupSelect('GEMS_ACCESS['.$sGem.'][]',$oGemManager->getGemAccessRights($sGem), true)?></td>
		</tr>
	<?endforeach;?>
	</table>
</td></tr>
<?$tabControl->BeginNextTab();?>
<?require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/admin/group_rights.php");?>
<?$tabControl->Buttons();?>
<input <?if ($GEMS_RIGHT<"W") echo "disabled" ?> type="submit" name="Update" value="<?=GetMessage("SAVE")?>">
<input type="hidden" name="Update" value="Y">
<?$tabControl->End();?>
</form>
<?endif;?>