CBPRestActivity :: renderPropertiesDialog: Bitrix method

      
<?php 
//  CBPRestActivity :: renderPropertiesDialog()
//  /dist/bitrix/modules/bizproc/classes/general/restactivity.php:428

    
public static function renderPropertiesDialog(\Bitrix\Bizproc\Activity\PropertiesDialog $dialog)
    {
        
$runtime CBPRuntime::GetRuntime();
        
$data $dialog->getRuntimeData();
        
$activityData $data['ACTIVITY_DATA'];

        
/** @var CBPDocumentService $documentService */
        
$documentService $runtime->GetService("DocumentService");
        
$activityDocumentType is_array($activityData['DOCUMENT_TYPE']) ? $activityData['DOCUMENT_TYPE'] : $dialog->getDocumentType();
        
$properties = isset($activityData['PROPERTIES']) && is_array($activityData['PROPERTIES']) ? $activityData['PROPERTIES'] : array();

        
$currentValues $dialog->getCurrentValues();

        
ob_start();
        foreach (
$properties as $name => $property):
            
$required CBPHelper::getBool($property['REQUIRED']);
            
$name strtolower($name);
            
$value = !CBPHelper::isEmptyValue($currentValues[static::PROPERTY_NAME_PREFIX.$name]) ? $currentValues[static::PROPERTY_NAME_PREFIX.$name] : $property['DEFAULT'];

            
$property['NAME'] = RestActivityTable::getLocalization($property['NAME'], LANGUAGE_ID);
            if (isset(
$property['DESCRIPTION']))
            {
                
$property['DESCRIPTION'] = RestActivityTable::getLocalization($property['DESCRIPTION'], LANGUAGE_ID);
            }

            
?>
            <tr>
                <td align="right" width="40%" valign="top">
                    <span class="<?=$required?'adm-required-field':''?>">
                        <?= htmlspecialcharsbx($property['NAME']) ?>:
                    </span>
                    <?if (!empty($property['DESCRIPTION'])):?>
                        <br/><?= htmlspecialcharsbx($property['DESCRIPTION']) ?>
                    <?endif;?>
                </td>
                <td width="60%">
                    <?=$documentService->getFieldInputControl(
                        
$activityDocumentType,
                        
$property,
                        array(
'Field' => static::PROPERTY_NAME_PREFIX.$name'Form' => $dialog->getFormName()),
                        
$value,
                        
true,
                        
false
                    
)?>
                </td>
            </tr>

            <?
        
endforeach;

        if (static::
checkAdminPermissions()):?>
            <tr>
                <td align="right" width="40%" valign="top"><span class=""><?= Loc::getMessage("BPRA_PD_USER_ID"?>:</span></td>
                <td width="60%">
                    <?=$dialog->renderFieldControl('AuthUserId'$currentValues['authuserid'], true0)?>
                </td>
            </tr>
        <?endif?>
        <tr>
            <td align="right"><?= Loc::getMessage("BPRA_PD_SET_STATUS_MESSAGE"?>:</td>
            <td>
                <select name="setstatusmessage">
                    <option value="Y"<?= $currentValues["setstatusmessage"] == "Y" " selected" "" ?>><?= Loc::getMessage("BPRA_PD_YES"?></option>
                    <option value="N"<?= $currentValues["setstatusmessage"] == "N" " selected" "" ?>><?= Loc::getMessage("BPRA_PD_NO"?></option>
                </select>
            </td>
        </tr>
        <tr>
            <td align="right"><?= Loc::getMessage("BPRA_PD_STATUS_MESSAGE"?>:</td>
            <td valign="top"><?=CBPDocument::ShowParameterField("string"'statusmessage'$currentValues['statusmessage'], Array('size'=>'45'))?></td>
        </tr>
        <tr>
            <td align="right"><?= Loc::getMessage("BPRA_PD_USE_SUBSCRIPTION"?>:</td>
            <td>
                <select name="usesubscription" <?=!empty($activityData['USE_SUBSCRIPTION'])? 'disabled' ''?>>
                    <option value="Y"<?= $currentValues["usesubscription"] == 'Y' " selected" "" ?>><?= Loc::getMessage("BPRA_PD_YES"?></option>
                    <option value="N"<?= $currentValues["usesubscription"] == 'N' " selected" "" ?>><?= Loc::getMessage("BPRA_PD_NO"?></option>
                </select>
            </td>
        </tr>
        <? if ($activityData['USE_SUBSCRIPTION'] != 'N'):?>
        <tr>
            <td align="right"><?= Loc::getMessage("BPRA_PD_TIMEOUT_DURATION"?>:<br/><?= Loc::getMessage("BPRA_PD_TIMEOUT_DURATION_HINT"?></td>
            <td valign="top">
                <?=CBPDocument::ShowParameterField('int''timeoutduration'$currentValues["timeoutduration"], array('size' => 20))?>
                <select name="timeoutdurationtype">
                    <option value="s"<?= ($currentValues["timeoutdurationtype"] == "s") ? " selected" "" ?>><?= Loc::getMessage("BPRA_PD_TIME_S"?></option>
                    <option value="m"<?= ($currentValues["timeoutdurationtype"] == "m") ? " selected" "" ?>><?= Loc::getMessage("BPRA_PD_TIME_M"?></option>
                    <option value="h"<?= ($currentValues["timeoutdurationtype"] == "h") ? " selected" "" ?>><?= Loc::getMessage("BPRA_PD_TIME_H"?></option>
                    <option value="d"<?= ($currentValues["timeoutdurationtype"] == "d") ? " selected" "" ?>><?= Loc::getMessage("BPRA_PD_TIME_D"?></option>
                </select>
                <?
                $delayMinLimit 
CBPSchedulerService::getDelayMinLimit();
                if (
$delayMinLimit):
                    
?>
                    <p style="color: red;">* <?= Loc::getMessage("BPRA_PD_TIMEOUT_LIMIT"?><?=CBPHelper::FormatTimePeriod($delayMinLimit)?></p>
                    <?
                
endif;
                
?>
            </td>
        </tr>
        <?endif;

        if (
$activityData['USE_PLACEMENT'] === 'Y' && !empty($activityData['APP_ID_INT'])):
            
CJSCore::Init(['applayout']);

            
$appJs $appJs = (int) $activityData['APP_ID_INT'];
            
$codeJs htmlspecialcharsbx(CUtil::JSEscape($activityData['CODE']));
            
$actNameJs htmlspecialcharsbx(CUtil::JSEscape($dialog->getActivityName()));
        
?>
        <tr>
            <td align="right"></td>
            <td align="right">
                <button onclick="if (BX.rest) {BX.rest.AppLayout.openApplication(<?=$appJs?>, {
                        action: 'bp_activity_settings',
                        code: '<?=$codeJs?>',
                        activity_name: '<?=$actNameJs?>'
                        });} return false;">
                    <?=GetMessage('BPRA_PD_CONFIGURE')?>
                </button>
            </td>
        </tr>
    <?endif;

        return 
ob_get_clean();
    }