コード例 #1
0
ファイル: cml2.php プロジェクト: nycmic/bittest
 function DeactivateElement($action, $start_time, $interval)
 {
     $counter = array("DEL" => 0, "DEA" => 0, "NON" => 0);
     if (array_key_exists("bUpdateOnly", $this->next_step) && $this->next_step["bUpdateOnly"]) {
         return $counter;
     }
     if ($action != "D" && $action != "A") {
         return $counter;
     }
     $bDelete = $action == "D";
     //This will protect us from deactivating when next_step is lost
     $IBLOCK_ID = intval($this->next_step["IBLOCK_ID"]);
     if ($IBLOCK_ID < 1) {
         return $counter;
     }
     $arFilter = array(">ID" => $this->next_step["LAST_ID"], "IBLOCK_ID" => $IBLOCK_ID);
     if (!$bDelete) {
         $arFilter["ACTIVE"] = "Y";
     }
     $obElement = new CIBlockElement();
     $rsElement = $obElement->GetList(array("ID" => "asc"), $arFilter, false, false, array("ID", "ACTIVE"));
     while ($arElement = $rsElement->Fetch()) {
         $rs = $this->_xml_file->GetList(array(), array("PARENT_ID+0" => 0, "LEFT_MARGIN" => $arElement["ID"]), array("ID"));
         $ar = $rs->Fetch();
         if (!$ar) {
             if ($bDelete) {
                 $obElement->Delete($arElement["ID"]);
                 $counter["DEL"]++;
             } else {
                 $obElement->Update($arElement["ID"], array("ACTIVE" => "N"));
                 $counter["DEA"]++;
             }
         } else {
             $counter["NON"]++;
         }
         $this->next_step["LAST_ID"] = $arElement["ID"];
         if ($interval > 0 && time() - $start_time > $interval) {
             break;
         }
     }
     return $counter;
 }
コード例 #2
0
        fwrite($f, $xml);
        fclose($f);
        $xml = trim($xml);
        echo '<pre style="background:white; text-align:right">текст xml-файла, который будет передан в 1С при следующем обмене</pre>';
        echo '<div onmousedown="moveState = false;" onmousemove="moveState = false;" style="overflow-y:scroll;height:90%;width:100%;background:white;">';
        highlight_string($xml);
        echo '</div>';
    } else {
        echo $xml;
    }
    die;
}
if ($_GET["action"] == "show_bxmltree") {
    CModule::IncludeModule('iblock');
    $xmlfile = new CIBlockXMLFile();
    $dbres = $xmlfile->GetList();
    if (!$dbres) {
        die;
    }
    echo '<div  style="overflow:auto;height:100%;width:100%;">';
    echo '<table cellspacing=2 cellpadding=5 style="border:0px solid #E6E6FA;font-size:11px;background:white;">';
    echo '<tr style="background:grey;color:white;">';
    echo '<td>' . 'ID' . '</td>';
    echo '<td>' . 'PARENT_ID' . '</td>';
    echo '<td>' . 'LEFT_MARGIN' . '</td>';
    echo '<td>' . 'RIGHT_MARGIN' . '</td>';
    echo '<td>' . 'DEPTH_LEVEL' . '</td>';
    echo '<td>' . 'NAME' . '</td>';
    echo '<td>' . 'VALUE' . '</td>';
    echo '<td>' . 'ATTRIBUTES' . '</td>';
    echo '</tr>';