Esempio n. 1
0
 function makeTables($dbh, $data)
 {
     //make participant table
     $pid = $data["pid"];
     makeParticipantTable($dbh, $pid);
     //make page tables and fill columns for master table
     $pages = $data["pages"];
     $cols = array();
     foreach ($pages as $p => $page) {
         $pageCols = array();
         if (isset($page["interactions"])) {
             $interactions = $page["interactions"];
             foreach ($interactions as $interaction => $junk) {
                 $pageCols[] = $interaction;
                 if (!in_array($interaction, $cols)) {
                     $cols[] = $interaction;
                 }
             }
         }
         if (!empty($pageCols)) {
             makeBigTable($dbh, 'interactions_page_' . (string) ($p + 1), $pageCols);
         }
     }
     //make master table
     if (!empty($cols)) {
         makeBigTable($dbh, 'interactions_master', $cols);
     }
 }
Esempio n. 2
0
 function makeTables($dbh, $data)
 {
     $pages = $data["pages"];
     $cols = array();
     foreach ($pages as $p => $page) {
         $pageCols = array();
         $sets = $page["sets"];
         foreach ($sets as $s => $set) {
             $blocks = $set["blocks"];
             foreach ($blocks as $b => $block) {
                 if (isset($block["input"])) {
                     $blockLabel = isset($block["label"]) ? $block["label"] : 'p' . (string) ($p + 1) . 's' . (string) ($s + 1) . 'b' . (string) ($b + 1);
                     $input = $block["input"];
                     if (isset($input["items"])) {
                         $items = $input["items"];
                         foreach ($items as $i => $item) {
                             if (isset($item["label"])) {
                                 $itemLabel = $item["label"];
                             } else {
                                 $itemLabel = $blockLabel . 'i' . (string) ($i + 1);
                             }
                             $pageCols[] = $itemLabel;
                             $cols[] = $itemLabel;
                             $pageCols[] = $itemLabel . '_time';
                             $cols[] = $itemLabel . '_time';
                         }
                     } else {
                         $pageCols[] = $blockLabel;
                         $cols[] = $blockLabel;
                         $pageCols[] = $blockLabel . '_time';
                         $cols[] = $blockLabel . '_time';
                     }
                 }
             }
         }
         if (!empty($pageCols)) {
             makeBigTable($dbh, 'data_page_' . (string) ($p + 1), $pageCols);
         }
     }
     if (!empty($cols)) {
         makeBigTable($dbh, 'data_master', $cols);
     }
 }