PageRenderTime 23ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/Prohits/analyst/index.php

http://prohits.googlecode.com/
PHP | 256 lines | 234 code | 5 blank | 17 comment | 22 complexity | 2537b935d872c957d79fa443058ee9f0 MD5 | raw file
  1. <?
  2. /***********************************************************************
  3. Copyright 2010 Gingras and Tyers labs,
  4. Samuel Lunenfeld Research Institute, Mount Sinai Hospital.
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. *************************************************************************/
  15. $frm_Projects = '';
  16. $project_Name = '';
  17. $proj_changed = 0;
  18. $frm_show = '';
  19. require("../common/site_permission.inc.php");
  20. require("site_header.php");
  21. ?>
  22. <SCRIPT language=JavaScript>
  23. <!--
  24. function Is_ProjectSelected(theForm){
  25. selObj = theForm.frm_Projects;
  26. for (i=0; i < selObj.options.length; i++) {
  27. if (selObj.options[i].selected){
  28. return true;
  29. }
  30. }
  31. alert("Please select a project.");
  32. return false;
  33. }
  34. function projectSeleced(theForm){
  35. theForm.frm_show.value = "Y";
  36. theForm.submit();
  37. }
  38. -->
  39. </SCRIPT>
  40. <br>
  41. <?
  42. if(!$proj_changed){
  43. if($frm_Projects and !$frm_show){
  44. if(!isset($_SESSION["workingProjectID"]) || $_SESSION["workingProjectID"] != $frm_Projects){
  45. $current_Project = new Projects($frm_Projects);
  46. $_SESSION["workingProjectID"] = $current_Project->ID;
  47. $_SESSION["workingProjectName"] = $current_Project->Name;
  48. $_SESSION["workingProjectTaxID"] = $current_Project->TaxID;
  49. $_SESSION["workingFilterSetID"] = $current_Project->FilterSetID;
  50. $_SESSION["workingDBname"] = $HITS_DB[$current_Project->DBname];
  51. //$HITSDB->change_db($HITS_DB[$current_Project->DBname]);
  52. if($current_Project->Frequency){
  53. $_SESSION["workingProjectFrequency"] = $current_Project->Frequency;
  54. }else{
  55. $_SESSION["workingProjectFrequency"] = 0;
  56. }
  57. $SQL = "SELECT ID FROM User WHERE Type='MSTech' OR (Type!='user' AND LabID='".$current_Project->LabID."') ORDER BY Type";
  58. $UserArr = $mainDB->fetchAll($SQL);
  59. $superUsersArr = array();
  60. for($i=0; $i<count($UserArr); $i++){
  61. array_push($superUsersArr, $UserArr[$i]['ID']);
  62. }
  63. if(in_array($AccessUserID, $superUsersArr)){
  64. $_SESSION["superUsers"] = 1;
  65. }else{
  66. $_SESSION["superUsers"] = 0;
  67. }
  68. }
  69. echo "<script language=javascript>document.location.href='./index.php?proj_changed=1';</script>";
  70. exit;
  71. }else{
  72. ?>
  73. <table border="0" cellpadding="0" cellspacing="0" width="95%">
  74. <tr>
  75. <td align="left">
  76. &nbsp; <font color="<?=$TB_HD_COLOR;?>" face="helvetica,arial,futura" size="3"><b>Select Project
  77. </b>
  78. </font>
  79. </td>
  80. <td align="right">
  81. &nbsp;
  82. </td>
  83. </tr>
  84. <tr>
  85. <td colspan=2 height=1 bgcolor="black"><img src="./images/pixel.gif"></td>
  86. </tr>
  87. <tr>
  88. <td align="center" colspan=2><br>
  89. <form name="select_user" method=post action=<?=$_SERVER['PHP_SELF'];?>>
  90. <input type=hidden name=theaction value="selected">
  91. <input type=hidden name=frm_show value="">
  92. <table border="0" cellpadding="0" cellspacing="1" width="650">
  93. <tr bgcolor="<?=$TB_HD_COLOR;?>">
  94. <td colspan="2" align="center" height=25>
  95. <font color="white" face="helvetica,arial,futura" size="3"><b>High-throughput Projects</b></font>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td bgcolor="<?=$TB_CELL_COLOR;?>" valign=top align=center width=50% nowrap>&nbsp;<br>&nbsp; &nbsp;
  100. <?
  101. $Projects = new Projects();
  102. $Projects->getAccessProjects($_SESSION["USER"]->ID);
  103. if($frm_show){
  104. $AccessProjectID = $frm_Projects;
  105. }
  106. ?>
  107. <select name="frm_Projects" id="mySelect" size=25 onChange="projectSeleced(this.form)">
  108. <?
  109. if($Projects->count == 1){
  110. echo "<option value='".$Projects->ID[0]."'";
  111. echo " selected";
  112. echo ">".$Projects->Name[0]."\n";
  113. }else if($Projects->count){
  114. for ($i= 0;$i < $Projects->count; $i++) {
  115. echo "<option value='".$Projects->ID[$i]."'";
  116. echo ($Projects->ID[$i]==$AccessProjectID)?" selected":"";
  117. echo ">"."(".$Projects->ID[$i].") ".$Projects->Name[$i]."\n";
  118. }
  119. }
  120. ?>
  121. </select>&nbsp;&nbsp;<br>&nbsp;
  122. <input type=hidden name="project_Name" value="">
  123. </td>
  124. <td bgcolor="<?=$TB_CELL_COLOR;?>" valign=top align=center>
  125. <table border="0" cellpadding="0" cellspacing="1" width=80% >
  126. <tr>
  127. <td valign=top align=center><div class=maintext><br>
  128. Select the project to analyze.
  129. </div>
  130. </td>
  131. </tr>
  132. <tr valign=bottom>
  133. <td valign=bottom><br>
  134. &nbsp; &nbsp;<input type="submit" value="Select" Onclick="return Is_ProjectSelected(this.form);" class=green_but>&nbsp; &nbsp;
  135. <input type="reset" value="Reset" class=green_but>
  136. <div class=maintext>
  137. <br><br>
  138. <?
  139. if($AccessProjectID){
  140. $db = new mysqlDB();
  141. $SQL = "select P.ID,
  142. P.Name,
  143. P.TaxID,
  144. P.Description,
  145. L.Name as LabName,
  146. P.Frequency,
  147. A.Insert,
  148. A.Modify,
  149. A.Delete
  150. from Projects P, Lab L, ProPermission A where P.LabID=L.ID and A.ProjectID=P.ID and A.UserID=$AccessUserID
  151. and P.ID='$AccessProjectID'";
  152. $record = $db->fetch($SQL);
  153. if(count($record) > 0){
  154. echo "&nbsp;Lab Name: <b>". $record['LabName']."</b><br>";
  155. echo "&nbsp;Frequency filter : <b>". $record['Frequency']."%</b><br>";
  156. echo "&nbsp;Description : <b>". $record['Description']."</b><br>";
  157. echo "&nbsp;Species: ";
  158. $SQL = "select Name from ProteinSpecies where TaxID='". $record['TaxID'] . "'";
  159. $recordTaxID = $db->fetch($SQL);
  160. if(count($recordTaxID) > 0){
  161. echo "<b>" . $recordTaxID['Name'] . "</b>";
  162. }
  163. $Space = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  164. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  165. echo "<br>&nbsp;Permissions: ";
  166. echo "<b>Read</b><br>".$Space;
  167. if($record['Insert']){
  168. echo "<b>Insert</b><br>".$Space;
  169. }
  170. if($record['Modify']){
  171. echo "<b>Modify</b><br>".$Space;
  172. }
  173. if($record['Delete']){
  174. echo "<b>Delete</b><br>";
  175. }
  176. }
  177. }
  178. ?>
  179. </div>
  180. </td>
  181. </tr>
  182. </table>
  183. </td>
  184. </tr>
  185. </table>
  186. </form>
  187. </td>
  188. </tr>
  189. </table>
  190. <?
  191. }
  192. }else{
  193. $_SESSION['com_BaitIDs'] = '';
  194. $_SESSION['com_SampleIDs'] = '';
  195. $_SESSION['com_ExperimentIDs'] = '';
  196. ?>
  197. <table border="0" cellpadding="0" cellspacing="0" width="95%">
  198. <tr>
  199. <td align="left">
  200. &nbsp; <font color="<?=$bg_tb_header;?>" face="helvetica,arial,futura" size="3"><b>Database Information
  201. <?
  202. if($AccessProjectName){
  203. echo " <font color='red' face='helvetica,arial,futura' size='3'>(Project $AccessProjectID: $AccessProjectName)</font>";
  204. }
  205. ?>
  206. </b>
  207. </font>
  208. </td>
  209. </tr>
  210. <tr>
  211. <td height=1 bgcolor="black"><img src="./images/pixel.gif"></td>
  212. </tr>
  213. <tr>
  214. <td align="" colspan=1 >
  215. <br><div class=large>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  216. <b>Database structure</b></div>
  217. <table border=0 width=450 align=center>
  218. <tr>
  219. <td>
  220. <IMG SRC="./images/data_structure.png" >
  221. </td>
  222. </tr>
  223. <tr>
  224. <td><div class=maintext><b>Icons</b></div></td>
  225. </tr>
  226. <tr>
  227. <td><div class=maintext>
  228. Modify -- Click <img src='./images/icon_view.gif'> to modify a record.<br>
  229. Delete -- Click <img src='./images/icon_purge.gif'> to delete a record. You can only delete your own records.<br>
  230. Next Level -- Click <img src='./images/icon_tree.gif'> to go to next level of a record.<br>
  231. Picture -- Click <img src='./images/icon_picture.gif'> to have a pop-up window to show up and display a gel image.<br>
  232. Plate -- Click <img src='./images/icon_plate.gif'> to view the current plate.<br>
  233. Next -- Click <img src='./images/arrow_small.gif'> to go to next step when submitting samples.<br>
  234. Co-IP -- Co-IP results: Yes <img src='./images/icon_coip_green.gif'>
  235. No<img src='./images/icon_coip_red.gif'>
  236. Possible<img src='./images/icon_coip_yellow.gif'>
  237. In Progress<img src='./images/icon_coip_blue.gif'>
  238. </div>
  239. </td>
  240. </tr>
  241. </table>
  242. </td>
  243. </tr>
  244. </table>
  245. <?
  246. }
  247. require("site_footer.php");
  248. ?>