| Current Path : /var/www/homesaver/www/bitrix/modules/ram.calc/classes/ |
| Current File : /var/www/homesaver/www/bitrix/modules/ram.calc/classes/iblockproperty.php |
<?
Class CRamCalcIblockProperty
{
public static function GetUserTypeDescription()
{
return Array(
"PROPERTY_TYPE" => "S",
"USER_TYPE" => "RamCalcIblockProperty",
"DESCRIPTION" => GetMessage("RAM_CALC_IBLOCKPROPERTY_DESCRIPTION"),
"GetSettingsHTML" => Array("CRamCalcIblockProperty", "GetSettingsHTML"),
"GetPropertyFieldHtml" => Array("CRamCalcIblockProperty", "GetPropertyFieldHtml"),
"GetAdminListViewHTML" => Array("CRamCalcIblockProperty", "GetAdminListViewHTML"),
"GetAdminFilterHTML" => Array("CRamCalcIblockProperty", "GetAdminFilterHTML"),
"GetPublicViewHTML" => Array("CRamCalcIblockProperty", "GetPublicViewHTML"),
);
}
function GetSettingsHTML($arProperty, $strHTMLControlName, &$arPropertyFields)
{
$arPropertyFields = Array("HIDE" => array("ROW_COUNT", "COL_COUNT", "DEFAULT_VALUE"));
return '';
}
function GetPublicViewHTML($arProperty, $value, $strHTMLControlName)
{
if (intval($value['VALUE']))
{
$arService = \Ram\Calc\ServiceTable::getRowById(intval($value['VALUE']));
if ($arService)
{
return $arService['NAME'];
}
else return ' ';
}
else return ' ';
}
function GetAdminFilterHTML($arProperty, $strHTMLControlName)
{
$lAdmin = new CAdminList($strHTMLControlName["TABLE_ID"]);
$lAdmin->InitFilter(Array($strHTMLControlName["VALUE"]));
$filterValue = $GLOBALS[$strHTMLControlName["VALUE"]];
if (isset($filterValue) && is_array($filterValue)) $values = $filterValue;
else $values = Array();
if ($arProperty["MULTIPLE"] === 'Y') $multiple = ' multiple size="5"';
else $multiple = '';
$html = "<select name='".$strHTMLControlName['VALUE']."' ".$multiple."><option value=''>".GetMessage("RAM_CALC_IBLOCKPROPERTY_NO")."</option>";
$dbService = \Ram\Calc\ServiceTable::getList(array("order" => array($by => $order), "select" => array("ID", "ACTIVE", "NAME")));
while ($arService = $dbService->Fetch())
{
$html .= "<option ".($arService['ID'] == $filterValue["VALUE"]?'selected':'')." value='".$arService['ID']."'>[".$arService['ID']."] ".$arService['NAME']."</option>";
}
$html .= "</select>";
return $html;
}
function GetAdminListViewHTML($arProperty, $value, $strHTMLControlName)
{
if (intval($value['VALUE']))
{
$arService = \Ram\Calc\ServiceTable::getRowById(intval($value['VALUE']));
if ($arService)
{
return $arService['NAME'];
}
else return ' ';
}
else return ' ';
}
function GetPropertyFieldHtml($arProperty, $value, $strHTMLControlName)
{
$return = "<select name='".$strHTMLControlName['VALUE']."'><option value=''>".GetMessage("RAM_CALC_IBLOCKPROPERTY_NO")."</option>";
$dbService = \Ram\Calc\ServiceTable::getList(array("order" => array("ID" => "ASC"), "select" => array("ID", "ACTIVE", "NAME")));
while ($arService = $dbService->Fetch())
{
$return .= "<option ".($arService['ID'] == $value["VALUE"]?'selected':'')." value='".$arService['ID']."'>[".$arService['ID']."] ".$arService['NAME']."</option>";
}
$return .= "</select>";
return $return;
}
}
?>