Exemplo n.º 1
0
 static function ApplyMask(MASK $mask = NULL, $list)
 {
     if (!$mask || !is_array($mask->ids)) {
         return $list;
     }
     $list_pos = 0;
     $res = array();
     $ids = $mask->ids;
     sort($ids);
     if ($ids) {
         $curid = array_shift($ids);
     } else {
         return $res;
     }
     foreach ($list as $key => &$gr) {
         if (is_array($gr['items'])) {
             $items = $gr['items'];
             $size = sizeof($items);
         } else {
             $req = new GROUPRequest($gr['props']);
             $rdr = $req->CreateReader();
             $size = $rdr->GetGroupSize();
             unset($rdr);
             unset($req);
             $items = range(0, $size - 1);
         }
         $ires = array();
         $ireal = array();
         while ($list_pos + $size > $curid) {
             array_push($ires, $items[$curid - $list_pos]);
             array_push($ireal, $curid - $list_pos);
             if ($ids) {
                 $curid = array_shift($ids);
             } else {
                 $curid = -1;
                 break;
             }
         }
         if ($ires) {
             $props = $gr['props'];
             $props['db_mask'] = implode(",", $ires);
             $props['real_mask'] = implode(",", $ireal);
             $res[$key] = array('props' => $props, 'items' => $ires);
         }
         $list_pos += $size;
         if ($curid < 0) {
             break;
         }
     }
     return $res;
 }
Exemplo n.º 2
0
             }
         } else {
             $release = 1;
         }
         if ($release) {
             $title = $version;
         } else {
             $title = "{$version}-{$date}";
         }
     } else {
         $error = translate("Version information is not available");
     }
     break;
 case "cache":
     try {
         $req = new GROUPRequest();
         $fix_time = $req->GetTimeFormat();
         $multi_mode = false;
     } catch (ADEIException $ae) {
         if ($_GET['db_server'] || $_GET['db_name'] || $_GET['db_group']) {
             throw $ae;
         }
         $multi_mode = true;
     }
     try {
         $cache = new CACHEDB();
         $flags = REQUEST::NEED_ITEMINFO | REQUEST::NEED_INFO | CACHE::TABLE_INFO;
         if ($multi_mode) {
             $info = $cache->GetCacheList($flags);
         } else {
             $info = array();
Exemplo n.º 3
0
 function __construct(&$props = NULL)
 {
     parent::__construct($props);
 }
Exemplo n.º 4
0
<?php

require "../../adei.php";
header("Content-type: text/xml");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$_GET['db_server'] = "test_zeus";
$_GET['db_name'] = "zeus";
$_GET['db_group'] = "0";
try {
    $req = new GROUPRequest($_GET);
    $reader = $req->CreateReader();
    $list = $reader->GetItemList(NULL, NULL, REQUEST::CONTROL);
    unset($reader);
} catch (ADEIException $ex) {
    $error = xml_escape($ex->getMessage());
}
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
if ($error) {
    echo "<result><Error>{$error}</Error></result>";
} else {
    echo "<result>";
    foreach ($list as $value => $info) {
        $extra = "";
        if ($info['uid']) {
            $extra .= " uid=\"{$info['uid']}\"";
        }
        $name = xml_escape($info['name']);
        echo "<Value name=\"" . $name . "\"{$extra} value=\"" . $value . "\"/>";
    }
    echo "</result>";
Exemplo n.º 5
0
     $value_arg = "mask";
     $mode = INFO_MODE;
     break;
 case 'alarms':
     $req = new SOURCERequest($_GET);
     $list = $req->GetAlarmList($flags);
     $mode = PASSTHROUGH_MODE;
     break;
 case 'controls':
     $flags |= REQUEST::CONTROL;
     $req = new CONTROLGroupRequest($_GET);
     $list = $req->GetItemList($flags);
     $mode = SOURCE_MODE;
     break;
 case 'items':
     $req = new GROUPRequest($_GET);
     $list = $req->GetItemList($flags);
     $mode = SOURCE_MODE;
     break;
 case 'experiments':
     $req = new SOURCERequest($_GET);
     $reader = $req->CreateReader();
     $elist = $reader->GetExperimentList();
     $list = array("-" => _("All Measurements"), "*-*" => _("Everything"));
     foreach ($elist as $db) {
         $list[$db['start'] . '-' . $db['stop']] = $db['name'];
     }
     if ($menu) {
         $list["0"] = _("Custom");
     }
     break;