Changeset 17818
- Timestamp:
- 05/10/14 13:43:36 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/viewer/index.php
r17813 r17818 6 6 $path = array( 7 7 "cal" => "/daq/caltest/", 8 "raw" => "/daq/raw/" 8 "raw" => "/daq/raw/", 9 "mc" => "/daq/mctest/", 9 10 ); 10 11 … … 95 96 */ 96 97 97 function getList( $path, $sub, $check)98 function getList(&$list, $path, $ext, $id, $sub = "") 98 99 { 99 100 $hasdir = false; 100 101 101 $ list = array();102 foreach ( new DirectoryIterator($path."/".$sub)as $file)102 $dir = new DirectoryIterator($path."/".$sub); 103 foreach ($dir as $file) 103 104 { 104 105 if ($file->isDot()) … … 108 109 109 110 if ($file->isDir()) 110 $list = array_merge($list, getList($path, $sub."/".$name, $check)); 111 112 if ($file->isFile() && $file->isReadable()) 113 { 114 if (substr($name, 12)!=".fits.fz") 115 continue; 116 117 $rc = substr($name, 0, 4)."/".substr($name, 4, 2)."/".substr($name, 6, 2)."-".substr($name, 9, 3); 118 119 $list[$rc] = array_key_exists($rc, $check); 120 } 111 getList($list, $path, $ext, $id, $sub."/".$name); 112 113 if (!$file->isFile() || !$file->isReadable()) 114 continue; 115 116 if (substr($name, -strlen($ext))!=$ext) 117 continue; 118 119 $rc = substr($name, 0, 4)."/".substr($name, 4, 2)."/".substr($name, 6, 2)."-".substr($name, 9, 3); 120 121 if (!isset($list[$rc])) 122 $list[$rc] = 0; 123 124 $list[$rc] |= $id; 121 125 } 122 123 return $list;124 126 } 125 127 126 128 try 127 129 { 128 $cal = getList($path['cal'], "", array()); 129 $raw = getList($path['raw'], "", $cal); 130 ksort($raw); 130 $list = array(); 131 getList($list, $path['raw'], ".fits.fz", 1); 132 getList($list, $path['raw'], ".drs.fits", 2); 133 getList($list, $path['cal'], ".fits.fz", 4); 134 getList($list, $path['mc'], ".fits", 8); 135 ksort($list); 131 136 } 132 137 catch (Exception $e) … … 135 140 } 136 141 137 print(json_encode($ raw));142 print(json_encode($list)); 138 143 return; 139 144 } … … 178 183 $r = substr($file, 11, 3); 179 184 180 $rootpath = isset($_POST['calibrated']) ? $path['cal'] : $path['raw']; 181 182 $filename = $rootpath.$y."/".$m."/".$d."/".$y.$m.$d."_".$r.".fits.fz"; 185 $rootpath = isset($_POST['calibrated']) && !isset($_POST['drsfile']) ? $path['cal'] : $path['raw']; 186 $extension = isset($_POST['drsfile']) ? ".drs.fits" : ".fits.fz"; 187 $filename = $rootpath.$y."/".$m."/".$d."/".$y.$m.$d."_".$r.$extension; 188 189 if (isset($_POST['montecarlo'])) 190 { 191 $rootpath = $path['mc']; 192 $extension = ".fits"; 193 $filename = $rootpath.$y.$m.$d."_".$r.$extension; 194 } 183 195 184 196 if (!file_exists($filename))
Note:
See TracChangeset
for help on using the changeset viewer.