$lastColumn = $objWorksheet->getHighestColumn();
        $lastColumn++;
        $array_variant = array();
        $array_variant[0] = $objWorksheet->getCell("D" . $row)->getValue();
        $i = 1;
        for ($column = 'E'; $column != $lastColumn; $column++) {
            $cell_head = $objWorksheet->getCell($column . "1")->getValue();
            if (preg_match_all("/^rs/", $cell_head) && !in_array($cell_head, $snps_not_in_dbSNP)) {
                $cell_value = $objWorksheet->getCell($column . $row)->getValue();
                $cell_value = trim(str_replace("[tag]", "", $cell_value));
                $cell_value = trim(str_replace("del", "D", $cell_value));
                if (empty($cell_value) || !(preg_match_all("/^[ACGTD]+\$/", $cell_value) || preg_match_all("/^\\([ACGT]+\\)\\d+\$/", $cell_value))) {
                    $cell_value = "*";
                }
                $array_variant[$i] = $cell_value;
                $objWorksheet->setCellValue($column . $row, $cell_value);
                $i++;
            }
        }
        if (overlaps($array_polymorphisms, $array_variant)) {
            $objWorksheet->setCellValue("A" . $row, "disabled");
        } else {
            $objWorksheet->setCellValue("A" . $row, "");
            $array_polymorphisms[count($array_polymorphisms)] = $array_variant;
        }
    }
}
$writer = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$writer->save($haplotype_spreadsheet_file_location_v2);
?>
 
예제 #2
0
파일: netdevmap.php 프로젝트: Akheon23/lms
function makemap(&$map, &$seen, $device = 0, $x = 500, $y = 500, $parent = 0)
{
    global $DB, $nodelist, $devicelinks, $mini;
    if ($mini) {
        $in = array(0, 3, -3, 6, -6, 9, -9, 12, -12, 15, -15, 18, -18, 21, -21);
    } else {
        $in = array(0, 5, -5, 10, -10, 20, -20, 25, -25, 30, -30, 35, -35, 40, -40);
    }
    // net size: count($in)^2 - 1
    foreach ($in as $ii => $i) {
        foreach ($in as $ij => $j) {
            if (($i != 0 || $j != 0) && $ij <= $ii) {
                $fields["x{$j}{$i}"] = array('x' => $j, 'y' => $i);
                $fields["x{$i}{$j}"] = array('x' => $i, 'y' => $j);
            }
        }
    }
    if ($device == 0) {
        if ($device = $DB->GetOne('SELECT id FROM netdevices ORDER BY name LIMIT 1')) {
            makemap($map, $seen, $device, $x, $y);
        }
    } else {
        // remember that current device was processed
        $seen[$device] = array('x' => $x, 'y' => $y);
        // place device in space ...
        $map[$x][$y] = $device;
        // ... and connected nodes (if they wasn't processed before)
        if (isset($nodelist[$device])) {
            $nodefields = getnodearray(count($nodelist[$device]));
            $i = 0;
            foreach ($nodefields as $field) {
                if (!isset($map[$x + $field['x']][$y + $field['y']])) {
                    $ntx = $x + $field['x'];
                    $nty = $y + $field['y'];
                    $map[$ntx][$nty] = 'n' . $nodelist[$device][$i]['id'] . '.' . $device . '.' . $nodelist[$device][$i]['linktype'];
                    $i++;
                }
            }
            unset($nodefields);
            unset($nodelist[$device]);
        }
        // now do recursion for connected devices
        if (isset($devicelinks[$device])) {
            foreach ($devicelinks[$device] as $deviceid) {
                if (!isset($seen[$deviceid])) {
                    if (isset($nodelist[$deviceid])) {
                        $nodefields = getnodearray(count($nodelist[$deviceid]));
                    }
                    foreach ($fields as $devfield) {
                        $tx = $x + $devfield['x'];
                        $ty = $y + $devfield['y'];
                        if (!isset($map[$tx][$ty])) {
                            // we don't want to overlap connection lines
                            if (overlaps($seen, $deviceid, $x, $y, $tx, $ty)) {
                                continue;
                            }
                            // try to place all connected nodes on map
                            // if there's no place, go to next field
                            if (isset($nodelist[$deviceid])) {
                                $map2 = $map;
                                $cnt = 0;
                                foreach ($nodefields as $field) {
                                    if (!isset($map2[$tx + $field['x']][$ty + $field['y']])) {
                                        $ntx = $tx + $field['x'];
                                        $nty = $ty + $field['y'];
                                        $map2[$ntx][$nty] = 'n' . $nodelist[$deviceid][$cnt]['id'] . '.' . $deviceid . '.' . $nodelist[$deviceid][$cnt]['linktype'];
                                        $cnt++;
                                    }
                                }
                                // not found place for all nodes, let's try next field
                                if ($cnt < count($nodelist[$deviceid])) {
                                    continue;
                                }
                                $map = $map2;
                                unset($nodelist[$deviceid]);
                                unset($nodefields);
                                unset($map2);
                            }
                            makemap($map, $seen, $deviceid, $tx, $ty, $device);
                            break;
                        }
                    }
                }
            }
        }
    }
}
예제 #3
0
 }
 //skip demo courses
 $sql = 'SELECT * FROM mdl_block_timetracker_workerinfo WHERE courseid=' . $cid . ' ORDER BY lastname,firstname';
 //get workers for this course
 $workers = $DB->get_records_sql($sql);
 //each worker for this course
 //echo "Checking courseid: $cid\n";
 foreach ($workers as $worker) {
     //get all workunits for this course for this worker
     $wid = $worker->id;
     $sql = 'SELECT * from ' . $CFG->prefix . 'block_timetracker_workunit ' . 'WHERE courseid=' . $cid . ' AND userid=' . $wid . ' AND timeout BETWEEN ' . $start . ' AND ' . $end;
     $units = $DB->get_records_sql($sql);
     //$count = 0;
     foreach ($units as $unit) {
         //echo ($unit->timein."\t".$unit->timeout."\n");
         if (overlaps($unit->timein, $unit->timeout, $worker->id, $unit->id, $cid)) {
             echo "<br />\n**ERROR**<br />\n";
             //echo ("cid: $cid<br />\n");
             //echo("uid: $worker->id<br />\n");
             echo "Worker ID: {$unit->id}<br />\n";
             echo "Modified by ID <a href=\"http://moodle.mhc.edu/workstudy" . "/user/profile.php?id={$unit->lasteditedby}" . "\">{$unit->lasteditedby}</a><br />\n";
             echo "Modified: " . userdate($unit->lastedited, get_string('datetimeformat', 'block_timetracker')) . "<br />\n";
             echo "Worker: " . $worker->lastname . ', ' . $worker->firstname . "<br />\n";
             echo "timein: " . userdate($unit->timein, get_string('datetimeformat', 'block_timetracker')) . "<br />\n";
             echo "timeout: " . userdate($unit->timeout, get_string('datetimeformat', 'block_timetracker')) . "<br />\n";
             echo "<a href=\"http://moodle.mhc.edu/workstudy/blocks/timetracker/" . "reports.php?id={$cid}&userid={$worker->id}\">View Reports Page</a><br />\n";
             echo "*********<br />\n";
             $count++;
         }
     }
     //echo("Checked $count units\n");