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())); } } } } } } }
if ($CURRENCY_RIGHT=="W") { $aContext[] = array( "ICON" => "btn_delete", "TEXT"=>GetMessage("MAIN_ADMIN_MENU_DELETE"), "ONCLICK" => "javascript:if(confirm('".GetMessage("CONFIRM_DEL_MESSAGE")."'))window.location='trigger_actions.php?action=delete&ID[]=".CUtil::JSEscape($ID)."&lang=".LANG."&".bitrix_sessid_get()."';", ); } } $context = new CAdminContextMenu($aContext); $context->Show(); //Defaults $f_SORT = "10"; $rsActionTypes = CFTriggerActionTypes::GetList(); while($arActionType = $rsActionTypes->Fetch()){ $arActionTypes[] = $arActionType; } //echo "<pre>";print_r($arActionTypes);echo "</pre>";die; if (strlen($ID) > 0 && !$bVarsFromForm) { $result = CFTriggerActions::GetByID($ID); $f_NAME = $result["NAME"]; $f_SORT = $result["SORT"] ; $f_ACTION_TYPE = $result["ACTION_TYPE"]; $f_ADDITIONAL_PROPS = unserialize($result["ADDITIONAL_PROPS"]); //$_BODY_PARAMS = unserialize(implode("\n", $result["BODY_PARAMS"])); $_BODY_PARAMS = unserialize($result["BODY_PARAMS"]);