Skip to content

Commit 3817bbb

Browse files
committed
Exhibition tweaks
1 parent 1ac50be commit 3817bbb

2 files changed

Lines changed: 101 additions & 78 deletions

File tree

generate/exhibition.php

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,52 +59,36 @@ function get_curated($curated, $start = 0, $num = 12)
5959
{
6060
// output html
6161
$html = '<table width="448" cellspacing="0" cellpadding="0" border="0">';
62-
6362
$j = 0;
64-
6563
for ($i = $start; $i < $start+$num; $i++) {
64+
if ($curated[$i]) {
6665

67-
if ($curated[$i]) {
68-
69-
if ($j % 2 == 0) $html .= '<tr>';
66+
if ($j % 2 == 0) $html .= '<tr>';
7067
$html .= '<td>' . $curated[$i]->display() . '</td>';
7168
if ($j % 2 != 0) $html .= '</tr>';
72-
7369
$j++;
74-
7570
}
76-
7771
}
78-
7972
if ($j % 2 != 0) $html .= '<td>&nbsp;</td></tr>';
8073
return $html . '</table>';
8174
}
8275

8376
function get_curated_one($curated, $start = 0, $num = 12)
8477
{
78+
// output html
79+
$html = '<table width="224" cellspacing="0" cellpadding="0" border="0">';
80+
$j = 0;
81+
for ($i = $start; $i < $start+$num; $i++) {
82+
if ($curated[$i]) {
83+
$html .= '<tr>';
8584

86-
// output html
87-
88-
$html = '<table width="224" cellspacing="0" cellpadding="0" border="0">';
89-
90-
$j = 0;
91-
92-
for ($i = $start; $i < $start+$num; $i++) {
85+
$html .= '<td>' . $curated[$i]->display() . '</td>';
86+
$html .= '</tr>';
87+
$j++;
88+
}
89+
}
9390

94-
if ($curated[$i]) {
95-
96-
$html .= '<tr>';
97-
98-
$html .= '<td>' . $curated[$i]->display() . '</td>';
99-
$html .= '</tr>';
100-
101-
$j++;
102-
103-
}
104-
105-
}
106-
107-
// if ($j % 2 != 0) $html .= '<td>&nbsp;</td></tr>';
91+
// if ($j % 2 != 0) $html .= '<td>&nbsp;</td></tr>';
10892

10993
return $html . '</table>';
11094

@@ -137,6 +121,7 @@ function get_curated_three($curated, $start = 0, $num = 12)
137121
if ($j % 3 == 1) $html .= '<td>&nbsp;</td></tr>';
138122

139123
if ($j % 3 == 2) $html .= '<td>&nbsp;</td><td>&nbsp;</td></tr>';
124+
140125
return $html . '</table>';
141126
}
142127

generate/lib/Curated.class.php

Lines changed: 86 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,121 @@
1-
<?
2-
3-
class Curated
4-
{
1+
<?
2+
3+
class Curated
4+
{
55
var $name;
66
var $by;
7+
78
var $scroll;
9+
810
var $resize;
11+
912
var $width;
13+
1014
var $height;
15+
1116
var $image;
17+
1218
var $description;
19+
1320
var $location;
14-
var $links = array();
15-
16-
function Curated($xml)
17-
{
21+
22+
var $links = array();
23+
24+
function Curated($xml)
25+
{
1826
$this->name = getAttribute($xml, 'name');
1927
$this->by = getAttribute($xml, 'by');
28+
2029
$this->scroll = getAttribute($xml, 'scroll');
30+
2131
$this->resize = getAttribute($xml, 'resize');
32+
2233
$this->width = getAttribute($xml, 'width');
23-
$this->height = getAttribute($xml, 'height');
24-
25-
$this->image = getValue($xml, 'image');
26-
$this->description = innerHTML($xml, 'description');
27-
$this->location = getValue($xml, 'location');
28-
34+
35+
$this->height = getAttribute($xml, 'height');
36+
37+
$this->image = getValue($xml, 'image');
38+
$this->description = innerHTML($xml, 'description');
39+
$this->location = getValue($xml, 'location');
40+
2941
$links = $xml->getElementsByTagName('link');
42+
3043
$links = $links->toArray();
44+
3145
foreach($links as $link) {
46+
3247
$this->links[] = array('href' => $link->getAttribute('href'), 'title' => $link->getText());
33-
}
34-
}
35-
36-
function display()
48+
49+
}
50+
}
51+
52+
function display()
3753
{
38-
$html = $this->display_piece();
39-
$html .= "\t<p>{$this->description}</p><p>Links: \n";
54+
$html = $this->display_piece();
55+
$html .= "\t<p>{$this->description}</p><p>Links: \n";
4056
$linkcount = count($links);
4157
$ii = 0;
42-
foreach ($this->links as $link) {
58+
foreach ($this->links as $link) {
4359
if ($ii > 0) {
4460
$html .= sprintf(", ");
4561
}
46-
$html .= sprintf("<a href=\"%s\">%s</a>", $link['href'], $link['title']);
62+
$html .= sprintf("<a href=\"%s\">%s</a>", $link['href'], $link['title']);
4763
$ii++;
48-
}
49-
$html .= "</p></div>\n\n";
50-
return $html;
64+
}
65+
$html .= "</p></div>\n\n";
66+
return $html;
5167
}
5268

69+
70+
5371
function display_short()
5472
{
55-
$html = $this->display_piece();
56-
$html .= "</div>\n\n";
73+
74+
$html = $this->display_piece();
75+
76+
$html .= "</div>\n\n";
5777
return $html;
58-
}
5978

60-
function display_piece()
61-
{
79+
}
80+
81+
function display_piece()
82+
{
6283
//$link = sprintf("<a href=\"%s\" onclick=\"javascript:MM_openBrWindow(this.href,'%s','menubar=yes,location=yes,
84+
6385
// status=yes,scrollbars=%s,resizable=%s,width=%d,height=%d');return false;\">",
86+
6487
// $this->location, $this->name, $this->scroll, $this->resize, $this->width, $this->height);
65-
$link = sprintf("<a href=\"%s\" onclick=\"javascript:MM_openBrWindow(this.href,'%s',''toolbar=yes,
66-
status=yes,
67-
scrollbars=yes,
68-
menubar=yes,
69-
location=yes,
70-
status=yes,
71-
resizable=yes,
72-
width=%d,height=%d');return false;\">",
73-
$this->location, $this->name, $this->width, $this->height);
74-
75-
$html = "<div class=\"curated-item\">\n";
76-
$html .= "\t$link<img src=\"/exhibition/{$this->image}\" width=\"223\" height=\"72\" alt=\"preview image\" title=\"{$this->name} by {$this->by}\" /></a>\n";
77-
$html .= "\t<p><br />$link{$this->name}</a><br />\n";
78-
$html .= "\tby {$this->by}</p>\n";
79-
return $html;
80-
}
81-
}
82-
88+
89+
90+
// Removed window open link 20 Sep 2011 --CR
91+
//$link = sprintf("<a href=\"%s\" onclick=\"javascript:MM_openBrWindow(this.href,'%s',''toolbar=yes,
92+
93+
//status=yes,
94+
95+
//scrollbars=yes,
96+
97+
//menubar=yes,
98+
99+
//location=yes,
100+
101+
//status=yes,
102+
103+
//resizable=yes,
104+
105+
//width=%d,height=%d');return false;\">",
106+
107+
//$this->location, $this->name, $this->width, $this->height);
108+
109+
110+
$link = sprintf("<a href=\"%s\">",
111+
112+
$this->location, $this->name, $this->width, $this->height);
113+
$html = "<div class=\"curated-item\">\n";
114+
$html .= "\t$link<img src=\"/exhibition/{$this->image}\" width=\"223\" height=\"72\" alt=\"preview image\" title=\"{$this->name} by {$this->by}\" /></a>\n";
115+
$html .= "\t<p>$link{$this->name}</a><br />\n";
116+
$html .= "\tby {$this->by}</p>\n";
117+
return $html;
118+
}
119+
}
120+
83121
?>

0 commit comments

Comments
 (0)