Example #1
0
}
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "default" => true), array("id" => "LID", "content" => Loc::getMessage("LANG"), "default" => true), array("id" => "EVENT_NAME", "content" => Loc::getMessage("EVENT_TYPE"), "sort" => "event_name", "default" => true), array("id" => "NAME", "content" => Loc::getMessage("EVENT_NAME"), "default" => true), array("id" => "DESCRIPTION", "content" => Loc::getMessage("EVENT_DESCRIPTION"), "default" => false), array("id" => "TEMPLATES", "content" => Loc::getMessage("EVENT_TEMPLATES"), "default" => false)));
$resultMessageByTypeList = array();
$resultMessageByTypeDb = \Bitrix\Main\Mail\Internal\EventMessageTable::getList(array('select' => array('ID', 'EVENT_NAME')));
while ($messageByType = $resultMessageByTypeDb->fetch()) {
    $resultMessageByTypeList[$messageByType['EVENT_NAME']][] = $messageByType['ID'];
}
$resultList = array();
$runtimeList = array();
$arFilter['!EVENT_NAME'] = null;
if (isset($arFilter['MESSAGE_ID'])) {
    $runtimeList[] = new \Bitrix\Main\Entity\ReferenceField('MESSAGE', 'Bitrix\\Main\\Mail\\Internal\\EventMessageTable', array('=this.EVENT_NAME' => 'ref.EVENT_NAME'));
    $arFilter['MESSAGE.ID'] = $arFilter['MESSAGE_ID'];
    unset($arFilter['MESSAGE_ID']);
}
$resultDb = \Bitrix\Main\Mail\Internal\EventTypeTable::getList(array('filter' => $arFilter, 'runtime' => $runtimeList, 'order' => array('EVENT_NAME' => strtoupper($order) == 'DESC' ? 'DESC' : 'ASC')));
$resultTypeList = $resultDb->fetchAll();
foreach ($resultTypeList as $type) {
    if (!isset($resultList[$type['EVENT_NAME']])) {
        $typeTmp = $type;
        $typeTmp['BY_LANGUAGE'] = array();
        $typeTmp['ID'] = array($type['ID']);
        $typeTmp['LID'] = array($type['LID']);
        $resultList[$type['EVENT_NAME']] = $typeTmp;
    } else {
        $resultList[$type['EVENT_NAME']]['ID'][] = $type['ID'];
        $resultList[$type['EVENT_NAME']]['LID'][] = $type['LID'];
    }
    $resultList[$type['EVENT_NAME']]['BY_LANGUAGE'][$type['LID']] = $type;
}
foreach ($resultList as $eventName => $type) {
Example #2
0
 function GetByID($ID, $LID)
 {
     $result = Mail\Internal\EventTypeTable::getList(array('filter' => array('LID' => $LID, 'EVENT_NAME' => $ID)));
     return new CDBResult($result);
 }
Example #3
0
$resultObject = null;
if (isset($rsData->resultObject)) {
    $resultObject = $rsData->resultObject;
}
$rsData = new CAdminResult($rsData, $sTableID);
if (!isset($rsData->resultObject)) {
    $rsData->resultObject = $resultObject;
}
$rsData->NavStart();
// LIST
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("PAGES")));
// Header
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "id", "default" => true, "align" => "right"), array("id" => "TIMESTAMP_X", "content" => GetMessage('TIMESTAMP'), "default" => true, "align" => "center"), array("id" => "ACTIVE", "content" => GetMessage('ACTIVE'), "sort" => "active", "default" => true, "align" => "center"), array("id" => "LID", "content" => GetMessage('LANG'), "default" => true, "align" => "center"), array("id" => "EVENT_NAME", "content" => GetMessage("EVENT_TYPE"), "sort" => "event_name", "default" => true), array("id" => "SUBJECT", "content" => GetMessage('SUBJECT'), "sort" => "subject", "default" => true), array("id" => "EMAIL_FROM", "content" => GetMessage("F_FROM"), "sort" => "from"), array("id" => "EMAIL_TO", "content" => GetMessage("F_TO"), "sort" => "to"), array("id" => "BCC", "content" => GetMessage("F_BCC"), "sort" => "bcc"), array("id" => "BODY_TYPE", "content" => GetMessage("F_BODY_TYPE"), "sort" => "body_type")));
$arText_HTML = array("text" => GetMessage("MAIN_TEXT"), "html" => GetMessage("MAIN_HTML"));
$arEventTypes = array();
$eventTypeDb = \Bitrix\Main\Mail\Internal\EventTypeTable::getList(array('select' => array('EVENT_NAME', 'NAME'), 'filter' => array('LID' => LANGUAGE_ID), 'order' => array('EVENT_NAME' => 'ASC')));
while ($eventType = $eventTypeDb->fetch()) {
    $arEventTypes[$eventType["EVENT_NAME"]] = '[' . $eventType["EVENT_NAME"] . '] ' . $eventType["NAME"];
}
// Body
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arRes, "message_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $f_ID, GetMessage("MAIN_ADMIN_MENU_EDIT_TITLE"));
    $row->AddViewField("ID", '<a href="message_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $f_ID . '" title="' . GetMessage("MAIN_ADMIN_MENU_EDIT_TITLE") . '">' . $f_ID . '</a>');
    $strSITE_ID = '';
    $db_LID = CEventMessage::GetLang($f_ID);
    while ($ar_LID = $db_LID->Fetch()) {
        $strSITE_ID .= htmlspecialcharsbx($ar_LID["LID"]) . "<br>";
    }
    $row->AddViewField("LID", $strSITE_ID);
    $row->AddCheckField("ACTIVE");
    $row->AddInputField("SUBJECT", array("size" => 30));