function checkAction($event) { $arActionID = array(); $rsTriggers = CFTrigger::GetList($by = "s_today_hits", $order = "desc", array("EVENT_ID" => $event["ID"])); while ($arTrigger = $rsTriggers->GetNext()) { $TriggerList[] = $arTrigger; $returnValue = unserialize(base64_decode($arTrigger["ACTION_ID"])); if (is_array($returnValue)) { $arActionID = array_merge($returnValue, $arActionID); } else { $arActionID[] = $arTrigger["ACTION_ID"]; } $TriggerActionList[$arTrigger["ID"]][] = $returnValue; } if (!empty($arActionID)) { $ActionTypesID = array(); $rsActions = CFTriggerActions::GetList($order, $by, array("ID" => $arActionID)); while ($arAction = $rsActions->GetNext()) { $ActionList[$arAction["ID"]] = $arAction; } $rsActionTypes = CFTriggerActionTypes::GetList(); while ($arActionType = $rsActionTypes->GetNext()) { $arActionTypeList[$arActionType["ID"]] = $arActionType["CODE"]; } if (!empty($ActionList)) { foreach ($TriggerActionList as $key => $triggerAction) { foreach ($triggerAction as $actionID) { if (is_array($actionID)) { foreach ($actionID as $k => $value) { if (intval($ActionList[$value]["ACTION_TYPE"]) > 0 && isset($arActionTypeList[$ActionList[$value]["ACTION_TYPE"]])) { //Проверяем и выполняем действие CFoodclubEventDoAction::doAction(array("ID" => $ActionList[$value]["ID"], "NAME" => $ActionList[$value]["NAME"], "ACTION_TYPE" => $ActionList[$value]["ACTION_TYPE"], "ACTION_CODE" => $arActionTypeList[$ActionList[$value]["ACTION_TYPE"]], "ADDITIONAL_PROPS" => $ActionList[$value]["ADDITIONAL_PROPS"], "BODY_PARAMS" => $ActionList[$value]["BODY_PARAMS"])); //Заносим в журнал CFTriggerLog::Add(array("NAME" => $ActionList[$value]["NAME"], "TRIGGER_ID" => $key, "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "CREATED_BY" => CUser::GetID())); } } } else { if (intval($ActionList[$actionID]["ACTION_TYPE"]) > 0 && isset($arActionTypeList[$ActionList[$actionID]["ACTION_TYPE"]])) { //Проверяем и выполняем действие CFoodclubEventDoAction::doAction(array("ID" => $ActionList[$actionID]["ID"], "NAME" => $ActionList[$actionID]["NAME"], "ACTION_TYPE" => $ActionList[$actionID]["ACTION_TYPE"], "ACTION_CODE" => $arActionTypeList[$ActionList[$actionID]["ACTION_TYPE"]], "ADDITIONAL_PROPS" => $ActionList[$actionID]["ADDITIONAL_PROPS"], "BODY_PARAMS" => $ActionList[$actionID]["BODY_PARAMS"])); //Заносим в журнал CFTriggerLog::Add(array("NAME" => $ActionList[$actionID]["NAME"], "TRIGGER_ID" => $key, "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "CREATED_BY" => CUser::GetID())); } } } } } } }
function GetList(&$by, &$order, $lang = LANGUAGE_ID) { global $DB; global $CACHE_MANAGER; $dbActionTypeList = CFTriggerActionTypes::__GetList($by, $order, $lang); return $dbActionTypeList; }
if(strlen($TYPE["CODE"]) > 0){ $arActionTypeFields = CFTriggerActionTypeFields::GetByID($TYPE["CODE"]); if(intval($_REQUEST["ADDITIONAL_PROPS"][0])){ $strAdditionalActionTypeFields = CFTriggerActionTypeFields::GetAdditionalFields(intval($_REQUEST["ADDITIONAL_PROPS"][0])); } } }elseif(strlen($f_ACTION_TYPE)){ $ACTION_TYPE = $f_ACTION_TYPE; $TYPE = CFTriggerActionTypes::GetByID($ACTION_TYPE); //echo "<pre>";print_r($TYPE);echo "</pre>"; if(strlen($TYPE["CODE"]) > 0){ $arActionTypeFields = CFTriggerActionTypeFields::GetByID($TYPE["CODE"]); } }elseif(!empty($arActionTypes) && intval(key($arActionTypes))){ $ACTION_TYPE = key($arActionTypes); $TYPE = CFTriggerActionTypes::GetByID($ACTION_TYPE); if(strlen($TYPE["CODE"]) > 0) $arActionTypeFields = CFTriggerActionTypeFields::GetByID($TYPE["CODE"]); } //echo "<pre>";print_r($arActionTypeFields);echo "</pre>"; if($bVarsFromForm) { $DB->InitTableVarsForEdit("f_actions", "", "f_"); } if($message) echo $message->Show(); ?> <form method="post" action="<?$APPLICATION->GetCurPage()?>" name="form1">