Révision 49db860c

b/src/footers.php
1 1
<?php
2
if ($tb != "home" & $tb != "rack" & $tb != "add_box") {
2
if ($tb != "home" & $tb != "rack" & $tb != "add_box" & $tb != "publish_it") {
3 3
  // TRIGGER
4 4
  $opts['triggers']['select']['pre'][] = 'last_trigger.MVC.php';
5 5
  $opts['triggers']['update']['pre'][] = 'last_trigger.MVC.php';
b/src/headers.php
48 48

  
49 49
<?php
50 50

  
51
function dump_genotype($strain) {
52
  $geno = "<p>$strain->Name_ Genotype: ".
53
  	"<I>".
54
 	"<B>". 
55
  	$strain->Mating_Type ." ".
56
 	"</B>" .
57
 	$strain->ADE2 ." ".
58
 	$strain->HIS3 ." ".
59
 	$strain->LEU2 ." ".
60
 	$strain->LYS2 ." ".
61
 	$strain->MET15 ." ".
62
 	$strain->TRP1 ." ".
63
 	$strain->URA3 ." ".
64
 	$strain->HO_ ." ".
65
 	$strain->locus1 ." ".
66
 	$strain->locus2 ." ".
67
 	$strain->locus3 ." ".
68
 	$strain->locus4 ." ".
69
 	$strain->locus5 ." ".
70
 	"</I>".
71
 	" [" .
72
 	$strain->Cytoplasmic_Character ." ".
73
 	"] (" .
74
 	$strain->extrachromosomal_plasmid ." ".
75
 	")" .
76
 	"</p>"; 
77
  return($geno);
78
} 
79

  
80

  
51 81
$to_be_post_list_content = "";
52 82
$to_be_pre_list_content = "";
53 83
// print($_SERVER["SCRIPT_FILENAME"]);
......
88 118
  // to pass to phpMyEdit
89 119
  //
90 120
  //check that visitor is allowed to use this table
91
  if (($tb == "admin" || $tb == "add_box") && $session->mode != "super") {
121
  if (($tb == "admin" || $tb == "add_box" || $tb == "publish_it") && $session->mode != "super") {
92 122
    echo "<p>Sorry, your session is not granted access to admin panel. Please logout and try again with appropriate login...</p>";
93 123
    exit;
94 124
  } else if ($session->target_table != $tb && $session->target_table != "all") {
b/src/publish_it.php
1
<?php
2
session_start();
3
require("headers.php");
4

  
5
if (isset($_REQUEST["action"])) {
6
  // print_r($_REQUEST);
7
  $ids = $_REQUEST["ids"];
8
  $all_ids = explode(" ", preg_replace("/([^0-9]+)/"," ",$ids));
9
  // print("<pre>");
10
  // print_r($all_ids);
11
  // print("</pre>");
12
  if ($_REQUEST["action"] == "publish_genotypes") {
13
    $where_clause = "id IN (" . implode(",", $all_ids) . ")";
14
    $qry = "SELECT * FROM strains WHERE $where_clause";
15
    $result = mysql_query($qry, $connexion);
16
    while($strain = mysql_fetch_object($result)) {
17
      // print("<pre>");
18
      // print_r($strain);
19
      // print("</pre>");
20
      echo dump_genotype($strain);
21
    }
22
  }
23
}
24

  
25

  
26
  $output = "";
27
  $output .= "<p>Enter IDs of strains (blank separated) that you want to publish genotypes.</p>";
28
  $output .= "<form>";
29

  
30
  $output .= "<textarea name='ids' cols='25' rows='5'>$ids</textarea><br>";
31
  $output .= "<input type='hidden' name='action' value='publish_genotypes'>\n";
32
  $output .= "<br><input type='submit' value='Extract genotypes.'>\n";
33
  $output .= "</form>";
34

  
35
  echo $output;
36

  
37
  // session_start ();
38
  require("footers.php");
39

  
40
  
41
?>
42

  
43

  
b/src/rack.php
66 66
  $output .= "<form>";
67 67

  
68 68
  $output .= "Which passage do you want to precise storage?<br>";
69
  $output .= "Passage: <select name='passage' >";
69
  $output .= "Passage: <select name='passage' onChange='submit()'>";
70 70
  $qry = "SELECT * FROM cl_passages";
71 71
  $result = mysql_query($qry, $connexion);
72 72
  while($tmp_passage = mysql_fetch_object($result)) {
......
87 87

  
88 88

  
89 89

  
90
  $output .= "Container: <select name='container' >";
91
  $qry = "SELECT DISTINCT container FROM cl_storage";
90
  $output .= "Container: <select name='container' onChange='submit()'>";
91
  $qry = "SELECT DISTINCT container FROM cl_storage ORDER BY container";
92 92
  $result = mysql_query($qry, $connexion);
93 93
  while($storage = mysql_fetch_object($result)) {
94 94
    if (!isset($container)) {
......
103 103

  
104 104

  
105 105

  
106
  $output .= "Rack: <select name='rack' >";
107
  $qry = "SELECT DISTINCT rack FROM cl_storage WHERE container='$container'";
106
  $output .= "Rack: <select name='rack' onChange='submit()'>";
107
  $qry = "SELECT DISTINCT rack FROM cl_storage WHERE container='$container' ORDER BY rack";
108 108
  $result = mysql_query($qry, $connexion);
109
  $tmp_racks = array();
109 110
  while($storage = mysql_fetch_object($result)) {
111
    array_push($tmp_racks, $storage->rack);
112
  }
113
  if (isset($rack)) {
114
    if (!in_array($rack, $tmp_racks)) {
115
      unset($rack);
116
    }
117
  }  
118
  foreach ($tmp_racks as $storage_rack) {
110 119
    if (!isset($rack)) {
111
      $rack = $storage->rack;
120
      $rack = $storage_rack;
112 121
    }
113
    $rack == $storage->rack ? $selected = "selected" : $selected = "";
114
    $output .= "<option value='$storage->rack' $selected>$storage->rack</option>";
122
    $rack == $storage_rack ? $selected = "selected" : $selected = "";
123
    $output .= "<option value='$storage_rack' $selected>$storage_rack</option>";
115 124
  }
125
  // while($storage = mysql_fetch_object($result)) {
126
  // if (!isset($rack)) {
127
  //   $rack = $storage->rack;
128
  // }
129
  // $rack == $storage->rack ? $selected = "selected" : $selected = "";
130
  // $output .= "<option value='$storage->rack' $selected>$storage->rack</option>";
131
  // }
116 132
  $output .= "</select><br>";
117 133
  
118 134

  
119 135

  
120 136

  
121
  $output .= "Box: <select name='box' >";
122
  $qry = "SELECT DISTINCT box FROM cl_storage WHERE container='$container' AND rack='$rack'";
137
  $output .= "Box: <select name='box' onChange='submit()'>";
138
  $qry = "SELECT DISTINCT box FROM cl_storage WHERE container='$container' AND rack='$rack' ORDER BY box";
123 139
  $result = mysql_query($qry, $connexion);
140
  $tmp_boxes = array();
124 141
  while($storage = mysql_fetch_object($result)) {
142
    array_push($tmp_boxes, $storage->box);
143
  }
144
  if (isset($box)) {
145
    if (!in_array($box, $tmp_boxes)) {
146
      unset($box);
147
    }
148
  }  
149
  foreach ($tmp_boxes as $storage_box) {
125 150
    if (!isset($box)) {
126
      $box = $storage->box;
151
      $box = $storage_box;
127 152
    }
128
    $rack == $storage->box ? $selected = "selected" : $selected = "";
129
    $output .= "<option value='$storage->box' $selected>$storage->box</option>";
153
    $box == $storage_box ? $selected = "selected" : $selected = "";
154
    $output .= "<option value='$storage_box' $selected>$storage_box</option>";
130 155
  }
131 156
  $output .= "</select><br>";
132 157

  
158

  
159

  
160

  
161
  $qry = "SELECT name FROM cl_passages WHERE ID='$passage'";
162
  $result = mysql_query($qry, $connexion);
163
  $cell_line = mysql_fetch_object($result)->name;
164
  
165

  
166

  
133 167
  $qry = "SELECT * FROM cl_storage, cl_passages WHERE container='$container' AND rack='$rack' AND  box='$box'  AND cl_storage.cl_passages=cl_passages.ID";
134 168
  $result = mysql_query($qry, $connexion);
135 169
  $content = array();
136 170
  $content_index = array();
171
  $content_cell_line = array();
137 172
  while($joint_passage = mysql_fetch_object($result)) {
138 173
    $key = $joint_passage->container . $joint_passage->rack . $joint_passage->box . $joint_passage->field_y . $joint_passage->field_x;;
139 174
    $value = $joint_passage->name . "<br>" . $joint_passage->passage . "<br>" . $joint_passage->date_of_freezing;
140 175
    $content[$key] = $value;
141 176
    $content_index[$key] = $joint_passage->cl_passages ;
177
    $content_cell_line[$key] = $joint_passage->name ;
142 178
  }
143 179

  
144 180

  
......
167 203
    foreach($fields as $field_x) {
168 204
      $key = $container . $rack . $box . $field_y . $field_x;
169 205
      isset($content[$key]) ? $color="LightGray" : $color="LightGreen";
170
      @$content_index[$key] == $passage ? $color="PowderBlue": $color=$color;
206
      @$content_cell_line[$key] == $cell_line ? $color="PowderBlue": $color=$color;
207
      @$content_index[$key] == $passage ? $color="RoyalBlue": $color=$color;
171 208
      $output .= "<td style='background-color: $color; width:80; border: 1px solid black;''>";
172 209
      if ($session->mode != "view") {
173 210
        $output .= "<input type='checkbox' name='fieldy_fieldx_" . $field_y . "_" . $field_x . " value='on'>$field_x</input><br>";
......
191 228

  
192 229
  echo $output;
193 230

  
231

  
232

  
233

  
234

  
235

  
236

  
237

  
238

  
239

  
240

  
241

  
242

  
243
  $output2 = "<table class='pme-main'><tr class='pme-header'><th class='pme-header'>Cell Line</th><th class='pme-header'>#Vials</th><th class='pme-header'>Note</th></tr>";
244

  
245
  $qry = "SELECT name, COUNT(cl_passages) as cnt FROM cl_storage, cl_passages WHERE cl_storage.cl_passages=cl_passages.ID GROUP BY name";
246
  $result = mysql_query($qry, $connexion);
247
  $content = array();
248
  $content_index = array();
249
  while($joint_passage = mysql_fetch_object($result)) {
250
    if ($joint_passage->cnt <= 5) {
251
      $note = "<blink><b>Please freeze additional passages to maintain frozen stocks!</b></blink>";
252
    } else {
253
      $note = "Sufficient stock.";
254
    }
255
    $output2 .= "<tr class='pme-row-0'><td class='pme-cell-0'>$joint_passage->name</td><td class='pme-cell-0'>$joint_passage->cnt</td><td class='pme-cell-0'>$note</td></tr>";    
256
    // print($joint_passage->name . " "  . $joint_passage->cnt . "<pre>");
257
    // print_r($joint_passage);
258
    // print("</pre>");
259
    // $key = $joint_passage->container . $joint_passage->rack . $joint_passage->box . $joint_passage->field_y . $joint_passage->field_x;;
260
    // $value = $joint_passage->name . "<br>" . $joint_passage->passage . "<br>" . $joint_passage->date_of_freezing;
261
    // $content[$key] = $value;
262
    // $content_index[$key] = $joint_passage->cl_passages ;
263
  }
264
  $output2 .= "</table>";
265

  
266
    print($output2);
267

  
268

  
269

  
270

  
271

  
272

  
273

  
274

  
275

  
194 276
  // session_start ();
195 277
  require("footers.php");
196 278

  
b/src/strains.TSP.php
12 12

  
13 13
if ($strain){
14 14
 // print full genotype
15
 echo " Genotype: ".
16
 	"<I>".
17
	"<B>". 
18
 	$strain->Mating_Type ." ".
19
	"</B>" .
20
	$strain->ADE2 ." ".
21
	$strain->HIS3 ." ".
22
	$strain->LEU2 ." ".
23
	$strain->LYS2 ." ".
24
	$strain->MET15 ." ".
25
	$strain->TRP1 ." ".
26
	$strain->URA3 ." ".
27
	$strain->HO_ ." ".
28
	$strain->locus1 ." ".
29
	$strain->locus2 ." ".
30
	$strain->locus3 ." ".
31
	$strain->locus4 ." ".
32
	$strain->locus5 ." ".
33
	"</I>".
34
	" [" .
35
	$strain->Cytoplasmic_Character ." ".
36
	"] (" .
37
	$strain->extrachromosomal_plasmid ." ".
38
	")" .
39
	"<BR>". "<BR>";
15
 echo dump_genotype($strain);
40 16
  /*	
41 17
 // find author in table labmembers
42 18
 $allauth = $this->myQuery("SELECT * FROM labmembers");
b/src/strains.php
2 2
session_start ();
3 3
require("headers.php");
4 4

  
5

  
6

  
7
if ($session->mode == "super") {
8
  print("<p><a href='publish_it.php'>Publish genotypes.</a></p>");
9
}
10

  
11

  
5 12
// if (array_key_exists("action", $_REQUEST)) {
6 13
//   if ($_REQUEST["action"] == "SEARCH_IN_GENOTYPE") {
7 14
//     $keys = split(" ", $_REQUEST["geno"]); 

Formats disponibles : Unified diff