Esempio n. 1
0
# http://www.bitrixsoft.com                  #
# mailto:admin@bitrixsoft.com                #
##############################################
require_once dirname(__FILE__) . "/../include/prolog_admin_before.php";
ClearVars();
if (!$USER->CanDoOperation('edit_ratings')) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
IncludeModuleLangFile(__FILE__);
$ID = intval($ID);
$message = null;
$bVarsFromForm = false;
if ($_SERVER['REQUEST_METHOD'] == "POST" && ($_POST['save'] != "" || $_POST['apply'] != "") && check_bitrix_sessid()) {
    $arFields = array("ACTIVE" => isset($_POST['ACTIVE']) ? $_POST['ACTIVE'] : 'N', "NAME" => $_POST['NAME'], "ENTITY_ID" => $_POST['ENTITY_ID'], "CALCULATION_METHOD" => $_POST['CALCULATION_METHOD'], "CONFIGS" => $_POST['CONFIGS'], "POSITION" => isset($_POST['POSITION']) ? 'Y' : 'N', "AUTHORITY" => isset($_POST['AUTHORITY']) ? 'Y' : 'N', "NEW_CALC" => isset($_POST['NEW_CALC']) ? 'Y' : 'N');
    if ($ID > 0) {
        $res = CRatings::Update($ID, $arFields);
    } else {
        $ID = CRatings::Add($arFields);
        $res = $ID > 0;
    }
    if ($res) {
        if ($apply != "") {
            $_SESSION["SESS_ADMIN"]["RATING_EDIT_MESSAGE"] = array("MESSAGE" => GetMessage("RATING_EDIT_SUCCESS"), "TYPE" => "OK");
            LocalRedirect("rating_edit.php?ID=" . $ID . "&lang=" . LANG);
        } else {
            LocalRedirect($_REQUEST["addurl"] != "" ? $_REQUEST["addurl"] : "rating_list.php?lang=" . LANG);
        }
    } else {
        if ($e = $APPLICATION->GetException()) {
            $message = new CAdminMessage(GetMessage("RATING_EDIT_ERROR"), $e);
        }
Esempio n. 2
0
		"ACTIVE"	=> $find_active,
		"ID"		=> $find_id,
		"ENTITY_ID"	=> $find_entity_id,
	);
}

if($lAdmin->EditAction())
{
	foreach($FIELDS as $ID=>$arFields)
	{
		$ID = IntVal($ID);
		if($ID <= 0)
			continue;
		$arUpdate['NAME'] = $arFields['NAME'];
		$arUpdate['ACTIVE'] = $arFields['ACTIVE'] == 'Y' ? 'Y' : 'N';
		if(!CRatings::Update($ID, $arUpdate))
		{
			$e = $APPLICATION->GetException();
			$lAdmin->AddUpdateError(($e? $e->GetString():GetMessage("RATING_LIST_ERR_EDIT")), $ID);
		}
	}
}

if(($arID = $lAdmin->GroupAction()))
{
	if($_REQUEST['action_target']=='selected')
	{
		$rsData = CRatings::GetList(array($by=>$order), $arFilter);
		while($arRes = $rsData->Fetch())
			$arID[] = $arRes['ID'];
	}