public function Execute()
 {
     if ($this->isInEventActivityMode) {
         return CBPActivityExecutionStatus::Closed;
     }
     if ($this->TimeoutTime != null && intval($this->TimeoutTime) . "|" != $this->TimeoutTime . "|") {
         $this->TimeoutTime = MakeTimeStamp($this->TimeoutTime);
     }
     $this->Subscribe($this);
     if ($this->TimeoutDuration != null) {
         $timeoutDuration = $this->CalculateTimeoutDuration();
         $this->WriteToTrackingService(str_replace("#PERIOD#", CBPHelper::FormatTimePeriod($timeoutDuration), GetMessage("BPDA_TRACK")));
     } elseif ($this->TimeoutTime != null) {
         $this->WriteToTrackingService(str_replace("#PERIOD#", ConvertTimeStamp($this->TimeoutTime, "FULL"), GetMessage("BPDA_TRACK1")));
     } else {
         $this->WriteToTrackingService(GetMessage("BPDA_TRACK2"));
     }
     $this->isInEventActivityMode = false;
     return CBPActivityExecutionStatus::Executing;
 }
Example #2
0
echo $arCurrentValues["timeout_duration_type"] == "d" ? " selected" : "";
?>
><?php 
echo GetMessage("BPAA_PD_TIME_D");
?>
</option>
		</select>
		<?php 
$delayMinLimit = CBPSchedulerService::getDelayMinLimit();
if ($delayMinLimit) {
    ?>
		<p style="color: red;">* <?php 
    echo GetMessage("BPAA_PD_TIMEOUT_LIMIT");
    ?>
: <?php 
    echo CBPHelper::FormatTimePeriod($delayMinLimit);
    ?>
</p>
		<?php 
}
?>
	</td>
</tr>
<tr>
	<td align="right"><?php 
echo GetMessage("BPAR_PD_ACCESS_CONTROL");
?>
:</td>
	<td>
		<select name="access_control">
			<option value="Y"<?php 
Example #3
0
    public static function GetPropertiesDialog($documentType, $activityName, $workflowTemplate, $workflowParameters, $workflowVariables, $currentValues = null, $formName = "")
    {
        $runtime = CBPRuntime::GetRuntime();
        $map = array('AuthUserId', 'SetStatusMessage', 'StatusMessage', 'UseSubscription', 'TimeoutDuration', 'TimeoutDurationType');
        $activityData = self::getRestActivityData();
        $properties = isset($activityData['PROPERTIES']) && is_array($activityData['PROPERTIES']) ? $activityData['PROPERTIES'] : array();
        foreach ($properties as $name => $property) {
            if (!in_array($name, $map)) {
                $map[] = $name;
            }
        }
        if (!is_array($currentValues)) {
            $currentValues = array();
            $currentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($workflowTemplate, $activityName);
            if (is_array($currentActivity['Properties'])) {
                foreach ($map as $k) {
                    if (array_key_exists($k, $currentActivity['Properties'])) {
                        $currentValues[strtolower($k)] = $currentActivity['Properties'][$k];
                    } else {
                        $currentValues[strtolower($k)] = "";
                    }
                }
            } else {
                foreach ($map as $k) {
                    $currentValues[strtolower($k)] = "";
                }
            }
        }
        if (strlen($currentValues['statusmessage']) <= 0) {
            $currentValues['statusmessage'] = Loc::getMessage('BPRA_DEFAULT_STATUS_MESSAGE');
        }
        if (strlen($currentValues["timeoutdurationtype"]) <= 0) {
            $currentValues["timeoutdurationtype"] = "s";
        }
        if (empty($currentValues["authuserid"])) {
            $currentValues["authuserid"] = 'user_' . $activityData['AUTH_USER_ID'];
        }
        $currentValues["authuserid"] = CBPHelper::UsersArrayToString($currentValues["authuserid"], $workflowTemplate, $documentType);
        if (!empty($activityData['USE_SUBSCRIPTION'])) {
            $currentValues['usesubscription'] = $activityData['USE_SUBSCRIPTION'];
        }
        /** @var CBPDocumentService $documentService */
        $documentService = $runtime->GetService("DocumentService");
        $activityDocumentType = is_array($activityData['DOCUMENT_TYPE']) ? $activityData['DOCUMENT_TYPE'] : $documentType;
        foreach ($properties as $name => $property) {
            $required = CBPHelper::getBool($property['REQUIRED']);
            $value = !CBPHelper::isEmptyValue($currentValues[strtolower($name)]) ? $currentValues[strtolower($name)] : $property['DEFAULT'];
            ?>
			<tr>
				<td align="right" width="40%" valign="top">
					<span class="<?php 
            echo $required ? 'adm-required-field' : '';
            ?>
">
						<?php 
            echo htmlspecialcharsbx(RestActivityTable::getLocalization($property['NAME'], LANGUAGE_ID));
            ?>
:
					</span>
					<?php 
            if (isset($property['DESCRIPTION'])) {
                ?>
					<br/><?php 
                echo htmlspecialcharsbx(RestActivityTable::getLocalization($property['DESCRIPTION'], LANGUAGE_ID));
                ?>
					<?php 
            }
            ?>
				</td>
				<td width="60%">
					<?php 
            echo $documentService->getFieldInputControl($activityDocumentType, $property, array('Field' => strtolower($name), 'Form' => $formName), $value, true, false);
            ?>
				</td>
			</tr>

		<?php 
        }
        if (static::checkAdminPermissions()) {
            ?>
			<tr>
				<td align="right" width="40%" valign="top"><span class=""><?php 
            echo Loc::getMessage("BPRA_PD_USER_ID");
            ?>
:</span></td>
				<td width="60%">
					<?php 
            echo CBPDocument::ShowParameterField("user", 'authuserid', $currentValues['authuserid'], array('rows' => '1'));
            ?>
				</td>
			</tr>
		<?php 
        }
        ?>
			<tr>
				<td align="right"><?php 
        echo Loc::getMessage("BPRA_PD_SET_STATUS_MESSAGE");
        ?>
:</td>
				<td>
					<select name="setstatusmessage">
						<option value="Y"<?php 
        echo $currentValues["setstatusmessage"] == "Y" ? " selected" : "";
        ?>
><?php 
        echo Loc::getMessage("BPRA_PD_YES");
        ?>
</option>
						<option value="N"<?php 
        echo $currentValues["setstatusmessage"] == "N" ? " selected" : "";
        ?>
><?php 
        echo Loc::getMessage("BPRA_PD_NO");
        ?>
</option>
					</select>
				</td>
			</tr>
			<tr>
				<td align="right"><?php 
        echo Loc::getMessage("BPRA_PD_STATUS_MESSAGE");
        ?>
:</td>
				<td valign="top"><?php 
        echo CBPDocument::ShowParameterField("string", 'statusmessage', $currentValues['statusmessage'], array('size' => '45'));
        ?>
</td>
			</tr>
			<tr>
				<td align="right"><?php 
        echo Loc::getMessage("BPRA_PD_USE_SUBSCRIPTION");
        ?>
:</td>
				<td>
					<select name="usesubscription" <?php 
        echo !empty($activityData['USE_SUBSCRIPTION']) ? 'disabled' : '';
        ?>
>
						<option value="Y"<?php 
        echo $currentValues["usesubscription"] == 'Y' ? " selected" : "";
        ?>
><?php 
        echo Loc::getMessage("BPRA_PD_YES");
        ?>
</option>
						<option value="N"<?php 
        echo $currentValues["usesubscription"] == 'N' ? " selected" : "";
        ?>
><?php 
        echo Loc::getMessage("BPRA_PD_NO");
        ?>
</option>
					</select>
				</td>
			</tr>
			<?php 
        if ($activityData['USE_SUBSCRIPTION'] != 'N') {
            ?>
			<tr>
				<td align="right"><?php 
            echo Loc::getMessage("BPRA_PD_TIMEOUT_DURATION");
            ?>
:<br/><?php 
            echo Loc::getMessage("BPRA_PD_TIMEOUT_DURATION_HINT");
            ?>
</td>
				<td valign="top">
					<input type="text" name="timeoutduration" id="id_timeoutduration" value="<?php 
            echo htmlspecialcharsbx($currentValues["timeoutduration"]);
            ?>
" size="20" />
					<input type="button" value="..." onclick="BPAShowSelector('id_timeoutduration', 'int');" />
					<select name="timeoutdurationtype">
						<option value="s"<?php 
            echo $currentValues["timeoutdurationtype"] == "s" ? " selected" : "";
            ?>
><?php 
            echo Loc::getMessage("BPRA_PD_TIME_S");
            ?>
</option>
						<option value="m"<?php 
            echo $currentValues["timeoutdurationtype"] == "m" ? " selected" : "";
            ?>
><?php 
            echo Loc::getMessage("BPRA_PD_TIME_M");
            ?>
</option>
						<option value="h"<?php 
            echo $currentValues["timeoutdurationtype"] == "h" ? " selected" : "";
            ?>
><?php 
            echo Loc::getMessage("BPRA_PD_TIME_H");
            ?>
</option>
						<option value="d"<?php 
            echo $currentValues["timeoutdurationtype"] == "d" ? " selected" : "";
            ?>
><?php 
            echo Loc::getMessage("BPRA_PD_TIME_D");
            ?>
</option>
					</select>
					<?php 
            $delayMinLimit = CBPSchedulerService::getDelayMinLimit();
            if ($delayMinLimit) {
                ?>
						<p style="color: red;">* <?php 
                echo Loc::getMessage("BPRA_PD_TIMEOUT_LIMIT");
                ?>
: <?php 
                echo CBPHelper::FormatTimePeriod($delayMinLimit);
                ?>
</p>
						<?php 
            }
            ?>
				</td>
			</tr>
			<?php 
        }
    }