示例#1
0
 foreach ($subjectAsObjects as $subjectObject => $tmp) {
     $subjectAsObjectsCount[$subjectObject] = count(array_filter($tmp));
 }
 asort($subjectAsObjectsCount, SORT_NUMERIC);
 #echo '<pre>';print_r($Info);exit;
 foreach ($Info as $line => $tmp) {
     foreach ($subjectAsObjectsCount as $subject_id => $count) {
         //echo '<pre>';print_r($Info[$subject_id]);exit;
         //create item
         if (count($Info[$line][$subject_id]) > 1) {
             $item_id = insertItem($url, $key, $subject_id, urlencode($Info[$line][$subject_id]['label']), $repeat = False);
             $Info[$line][$subject_id]['item_id'] = $item_id;
             //create the statements
             foreach ($Info[$line][$subject_id] as $rule_id => $value) {
                 if ($rule_id != 'label') {
                     $statement_id = insertStatement($url, $key, $item_id, $rule_id, urlencode($value));
                     if ($statement_id) {
                         $Info[$line][$subject_id][$rule_id . '_statement_id'] = $statement_id;
                     }
                 }
             }
             //If this collection is used elsewhere as object, add the appropriate rule_id and value to each of the subject where she is used
             if ($subjectAsObjectsInverse[$subject_id]) {
                 foreach ($subjectAsObjectsInverse[$subject_id] as $tmp => $collectionHolder) {
                     $rule_id = $subjectAsObjectsInverseRule[$subject_id][$tmp];
                     $value = $item_id;
                     $Info[$line][$collectionHolder][$rule_id] = $value;
                 }
             }
         }
     }
示例#2
0
    $isltPFGEInserted = insertStatement($url, $key, $itemIsolateId, $isltPFGERuleId, $isltPFGEValue);
    #Find the rule for isolate CC
    $isltCCRuleId = $isltRule[array_search('mlst cc', $isltObj)];
    $isltCCValue = $cells[$line][$ccCol];
    #Insert statement for isolate cc
    $isltCCInserted = insertStatement($url, $key, $itemIsolateId, $isltCCRuleId, $isltCCValue);
    #Find the rule for isolate Sample
    $isltSampleRuleId = $isltRule[array_search('sample', $isltObj)];
    $isltSampleValue = $itemSampleId;
    #Insert statement for isolate Sample
    $isltSampleInserted = insertStatement($url, $key, $itemIsolateId, $isltSampleRuleId, $isltSampleValue);
    #Find the rule for isolate Antibiogram Database
    $isltAtbRuleId = $isltRule[array_search('antibiogram database', $isltObj)];
    $isltAtbValue = $atbItem_id;
    #Insert statement for isolate Antibiogram Database
    $isltSampleInserted = insertStatement($url, $key, $itemIsolateId, $isltAtbRuleId, $isltAtbValue);
}
$report .= '</table>';
echo $report;
function read_excel($file, $lowerize = TRUE)
{
    $lines = file($file);
    for ($row = 0; $row < count($lines); $row++) {
        $cells[$row] = explode(chr(9), $lines[$row]);
    }
    if ($lowerize) {
        foreach ($cells[0] as $tmp) {
            $lowercells[0][] = strtolower($tmp);
        }
        $cells[0] = $lowercells[0];
    }