コード例 #1
0
ファイル: posting_admin.php プロジェクト: spas-viktor/books
}
$FilterArr = array("find", "find_type", "find_id", "find_timestamp_1", "find_timestamp_2", "find_date_sent_1", "find_date_sent_2", "find_auto_send_time_1", "find_auto_send_time_2", "find_status", "find_status_id", "find_subject", "find_from", "find_to", "find_body", "find_body_type", "find_rubric");
$lAdmin->InitFilter($FilterArr);
$arFilter = array();
if (CheckDateFilter($lAdmin, $_REQUEST["find_timestamp_1"], $_REQUEST["find_timestamp_2"]) && CheckDateFilter($lAdmin, $_REQUEST["find_date_sent_1"], $_REQUEST["find_date_sent_2"]) && CheckDateFilter($lAdmin, $_REQUEST["find_auto_send_time_1"], $_REQUEST["find_auto_send_time_2"])) {
    $arFilter = array("ID" => $find != "" && $find_type == "id" ? $find : $find_id, "TIMESTAMP_1" => $find_timestamp_1, "TIMESTAMP_2" => $find_timestamp_2, "DATE_SENT_1" => $find_date_sent_1, "DATE_SENT_2" => $find_date_sent_2, "AUTO_SEND_TIME_1" => $find_auto_send_time_1, "AUTO_SEND_TIME_2" => $find_auto_send_time_2, "STATUS" => $find != "" && $find_type == "status" ? $find : $find_status, "STATUS_ID" => $find_status_id, "SUBJECT" => $find != "" && $find_type == "subject" ? $find : $find_subject, "FROM" => $find_from, "TO" => $find_to, "BODY" => $find_body, "BODY_TYPE" => $find_body_type, "RUB_ID" => $find_rubric);
}
if ($lAdmin->EditAction() && $POST_RIGHT == "W") {
    foreach ($FIELDS as $ID => $arFields) {
        if (!$lAdmin->IsUpdated($ID)) {
            continue;
        }
        $DB->StartTransaction();
        $ID = IntVal($ID);
        $ob = new CPosting();
        if (!$ob->Update($ID, $arFields)) {
            $lAdmin->AddUpdateError(GetMessage("post_save_err") . $ID . ": " . $ob->LAST_ERROR, $ID);
            $DB->Rollback();
        }
        $DB->Commit();
    }
}
if (($arID = $lAdmin->GroupAction()) && $POST_RIGHT == "W") {
    if ($_REQUEST['action_target'] == 'selected') {
        $cData = new CPosting();
        $rsData = $cData->GetList(array($by => $order), $arFilter);
        while ($arRes = $rsData->Fetch()) {
            $arID[] = $arRes['ID'];
        }
    }
    foreach ($arID as $ID) {
コード例 #2
0
ファイル: posting_edit.php プロジェクト: DarneoStudio/bitrix
CModule::IncludeModule("fileman");
$ID = intval($ID);
// Id of the edited record
$bCopy = $action == "copy";
$message = null;
$bVarsFromForm = false;
if ($REQUEST_METHOD == "POST" && $save . $apply . $Send . $Resend . $Continue != "" && $POST_RIGHT == "W" && check_bitrix_sessid()) {
    $posting = new CPosting();
    $arFields = array("FROM_FIELD" => $_REQUEST["FROM_FIELD"], "TO_FIELD" => $_REQUEST["TO_FIELD"], "BCC_FIELD" => $_REQUEST["BCC_FIELD"], "EMAIL_FILTER" => $_REQUEST["EMAIL_FILTER"], "SUBJECT" => $_REQUEST["SUBJECT"], "BODY_TYPE" => $_REQUEST["BODY_TYPE"] != "html" ? "text" : "html", "BODY" => $_REQUEST["BODY"], "DIRECT_SEND" => $_REQUEST["DIRECT_SEND"] != "Y" ? "N" : "Y", "CHARSET" => $_REQUEST["CHARSET"], "SUBSCR_FORMAT" => $_REQUEST["SUBSCR_FORMAT"] != "html" && $_REQUEST["SUBSCR_FORMAT"] != "text" ? false : $_REQUEST["SUBSCR_FORMAT"], "RUB_ID" => $_REQUEST["RUB_ID"], "GROUP_ID" => $_REQUEST["GROUP_ID"], "AUTO_SEND_TIME" => $_REQUEST["AUTO_SEND_FLAG"] != "Y" ? false : $_REQUEST["AUTO_SEND_TIME"]);
    if ($STATUS != "") {
        if ($STATUS != "S" && $STATUS != "E" && $STATUS != "P" && $STATUS != "W") {
            $STATUS = "D";
        }
    }
    if ($ID > 0) {
        $res = $posting->Update($ID, $arFields);
        if (strlen($Resend) > 0) {
            $STATUS = "W";
        }
        if ($res && $STATUS != "") {
            $res = $posting->ChangeStatus($ID, $STATUS);
        }
    } else {
        $arFields["STATUS"] = "D";
        $ID = $posting->Add($arFields);
        $res = $ID > 0;
    }
    if ($res) {
        //Delete checked
        if (is_array($FILE_ID)) {
            foreach ($FILE_ID as $file) {