INO Photogallery

// CODE FOR PHOTO VIEWS:
// DO NOT EDIT THIS PAGE
// URL path = photogallery
$pgpath = 'photogallery';
drupal_add_css(drupal_get_path('theme', 'ino6').'/photogallery.css');
if(isset($_GET['nid'])) {
$nodeid = $_GET['nid'];
if(isset($_GET['fid'])) {
$picid = $_GET['fid'];
$x = node_load($nodeid);
if(!$picid) {
$picid = $x->field_more_pics[0]['fid'];
}
$piccount = count($x->field_more_pics);
echo ‘

‘ . check_plain($x->title) . ‘

‘;
if ($_GET['large']) {
$GLOBALS['largegallery'] = $large = TRUE;
} else {
$large = FALSE;
}
echo ‘

‘.($large ? ‘Click image for original version.’ : ‘Click image for larger version.’).’

‘;
$g = count($x->field_more_pics);
if($g) {
$i = 0;
foreach($x->field_more_pics AS $thing) {
$previtem = $i-1;
$nextitem = $i+1;
$finalpic = $g-1;
if($i == 0) {
$prevpic = $x->field_more_pics[$finalpic];
$nextpic = $x->field_more_pics[$nextitem];
} elseif($i == $finalpic) {
$prevpic = $x->field_more_pics[$previtem];
$nextpic = $x->field_more_pics[0];
} else {
$prevpic = $x->field_more_pics[$previtem];
$nextpic = $x->field_more_pics[$nextitem];
}
$thedesc = check_plain($thing['alt']);
if($thing['fid'] == $picid) {
$theanchor = ($large) ? NULL : ‘#photogallery-title’;
echo “

“;
echo “

‘;
echo “

‘;
echo “

‘;
echo ‘

“;
if ($i == 0) {
echo ‘ ’;
} else {
// echo l(”, $pgpath, array(), “nid=$nodeid&fid={$prevpic['fid']}”.($large?’&large=1′:”), ‘photogallery-title’);
echo ““;
}
echo ‘
“;
// echo “" . strip_tags($x->title) . “‘>”;<br />
							$thesize = ($large) ? ‘article_pic_full’ : ‘article_pic’;<br />
							$picstr = theme(‘imagecache’, $thesize, $thing[title), check_plain($x->title));
// $thelink = ($large) ? $thing['filepath'] : $pgpath;
$theargs = ($large) ? ” : ‘&large=1′;
echo ““;
echo $picstr;
echo ‘
‘;
echo “

$thedesc

“;
echo ‘

“;
if ($i == $finalpic) {
echo ‘ ’;
} else {
// echo l(”, $pgpath, array(), “nid=$nodeid&fid={$nextpic['fid']}”.($large?’&large=1′:”), ‘photogallery-title’);
echo ““;
}
echo ‘

‘;
echo “
« PREV | NEXT »
“;
}
$i++;
}
// echo “


“;
$i = 0;
echo “

“;
foreach($x->field_more_pics AS $thing) {
$thetitle = $thing['title'];
$alt = $node->title;
echo ““;
print theme(‘imagecache’, ‘thumbnail_pic’, $thing['filepath'], $alt, $thetitle);
echo ‘
‘;
$i++;
// if($i % 5 == 0) { echo ‘
‘; }
}
echo “


“;
}

echo ‘
‘;
echo “

Edit Article“; }
echo ‘

‘;
} elseif(isset($_GET['pic'])) {
// THIS IS A LEGACY PIC
$farray = explode(‘/’, $pic);
$fcount = count($farray);
$fnid = $fcount-1;
$filename = $farray[$fnid];
$x = node_load($nodeid);
echo ‘

‘ . $x->title . ‘

‘;
// $thefid = $thepic['fid'];
$thetitle = $x->title;
$thedesc = $filename;
$thepath = $_GET['pic'];
echo “

“;
echo “

‘;
echo ‘

“;
echo “" . $thetitle . "“;
echo “

$thedesc

“;
echo ‘

‘;
echo ‘
‘;
echo “

Edit Article“; }
echo ‘

‘;
} else { echo ‘No Picture Selected’; }
} else { echo ‘No Gallery Selected’; }
?>