Repository navigation
Expand file tree
/
Copy pathArchitecture.php
More file actions
64 lines (59 loc) · 1.58 KB
/
Copy pathArchitecture.php
File metadata and controls
64 lines (59 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
include_once("Region.php");
include_once("sql.php");
class Arch{
public $length = "1000";
public $secId;
public $regions = array();
public $markups = array();
public $empty = TRUE;
public $exist = FALSE;
public $colors = array();
public $notation;
function getArchNotation(){
$notation = "";
foreach($this->regions as $dom){
if($dom->type != "pfamb"){
$notation .= $dom->text."~";
}
}
$notation = trim($notation, '~');
$this->notation = $notation;
return $notation;
}
function exist(){
$link = connect();
$query = "SELECT architecture FROM architecture WHERE architecture='$this->notation'";
$result = mysqli_query($link, $query);
$exist = mysqli_num_rows($result);
if ($exist > 0) {
foreach ($this->regions as $reg) {
$acc.=$reg->metadata->accession.'+';
}
return "<a href='exist.php?$acc' target='_blank'><img src='images/yes.gif'></a>";
}else{
return "<img src='images/no.png'>";
}
}
function setColors(){
foreach($this->regions as &$dom){
if($dom->colour == ""){
$newColor = $this->random_color();
$dom->colour = $newColor;
for($i=0;$i<count($this->regions);$i++){
if($this->regions[$i]->text == $dom->text){
$this->regions[$i]->colour = $newColor;
}
}
}
}
//klahksjhs
}
function random_color_part() {
return str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
}
function random_color() {
return $this->random_color_part() . $this->random_color_part() . $this->random_color_part();
}
}//end class Arch
?>