Bitrix Site Manager

CAdminList::IsUpdated

bool
CAdminList::IsUpdated(
  string $ID
)

The IsUpdated method returns true is any of the table rows have been changed when editing the table rows. The parameter is the table ID

Example


// save modified elements
if($lAdmin->EditAction() && $POST_RIGHT=="W")
{
    // walk the list of elements
    foreach($FIELDS as $ID=>$arFields)
    {
        // unchanged? do nothing
        if(!$lAdmin->IsUpdated($ID))
            continue;
        
        // otherwise, save changes
        $DB->StartTransaction();
        $ID = IntVal($ID);
        $cData = new CRubric;
        if(($rsData = $cData->GetByID($ID)) && ($arData = $rsData->Fetch()))
        {
            foreach($arFields as $key=>$value)
                $arData[$key]=$value;
            if(!$cData->Update($ID, $arData))
            {
                $lAdmin->AddGroupError(GetMessage("rub_save_error")." ".
                                       $cData->LAST_ERROR, $ID); $DB->Rollback(); } } else { $lAdmin->AddGroupError(GetMessage("rub_save_error")." ".
                                   GetMessage("rub_no_rubric"), $ID); $DB->Rollback(); } $DB->Commit(); } }