예제 #1
0
function GetTriggerNameByID($TRIGGER_ID){
	if(intval($TRIGGER_ID)){
		$arTrigger = CFTrigger::GetByID($TRIGGER_ID);
		return $arTrigger["NAME"];
	}else{
		return "";
	}
}
예제 #2
0
 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()));
                         }
                     }
                 }
             }
         }
     }
 }
예제 #3
0
		$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";

if (strlen($ID) > 0 && !$bVarsFromForm)
{
	$result = CFTrigger::GetByID($ID);
	$f_NAME = $result["NAME"];
	$f_SORT = $result["SORT"];
	$f_EVENT_ID = $result["EVENT_ID"];
	$f_ACTION_ID = $result["ACTION_ID"];
	if(intval($f_ACTION_ID)){
		$f_ACTION_ID = array(
			$f_ACTION_ID
		);
	}else{
		$f_ACTION_ID = unserialize(base64_decode($f_ACTION_ID));
	}
	if(is_array($f_ACTION_ID)){
		$f_ACTION_ID_P = array();
		foreach ($f_ACTION_ID as $value) {
			$f_ACTION_ID_P[] = Array("VALUE" => $value,"DESCRIPTION" => "");
예제 #4
0
		case "delete":
			if ($CURRENCY_RIGHT=="W")
				if (!CFTrigger::Delete($ID))
				{
					if ($ex = $APPLICATION->GetException())
						$lAdmin->AddGroupError($ex->GetString(), $ID);
					else
						$lAdmin->AddGroupError(GetMessage("action_err1"), $ID);
				}
		break;

		}
	}
}

$rsData = CFTrigger::GetList($by, $order);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();

$lAdmin->NavText($rsData->GetNavPrint(GetMessage("ACTION_TITLE")));

$arHeaders = array();
$arHeaders[] = array("id"=>"ID", "content"=>GetMessage('action'), "sort"=>"ID", "default"=>true);
$arHeaders[] = array("id"=>"NAME", "content"=>GetMessage('ACTION_NAME'), "sort"=>"name", "default"=>true);
$arHeaders[] = array("id"=>"SORT", "content"=>GetMessage('action_sort'), "sort" => "sort", "default"=>true);

$lAdmin->AddHeaders($arHeaders);

while($arRes = $rsData->NavNext(true, "f_"))
{
	$row =& $lAdmin->AddRow($f_ID, $arRes, "/bitrix/admin/trigger_edit.php?ID=".$f_ID."&lang=".LANGUAGE_ID, GetMessage('ACTION_A_EDIT'));