diff --git a/index.php b/index.php index b6ba55d..b99d490 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,7 @@
- 1 ){ #&&$path_info['call_parts'][1] - $DIR = ($path_info['call_parts'][1]); - } - else{ //This can be a little more graceful. - $DIR = "bm_mcm1890"; - } - // TODO: Maybe make a reference array for the DIR or pull from the query if - // available so that the $id can be passed around instead. - $title = $DIR; - $dirArray = [ - "bm_mcm1890", - "bm_mcm2062", - "bm_mcm2064", - "bm_mcm2212", - "bm_mcm4973_back", - "bm_mcm4973_front", - "bm_mcm5222", - "bm_mcm5241", - "bm_mcm5330_back", - "bm_mcm5330_front", - "mol_2016_33", - "mol_84_434", - "sbh_1019_back", - "sbh_1019_front", - "sbh_1090_s2_back", - "sbh_1090_s2_front", - "sbh_1094", - "sbh_1143_back", - "sbh_1143_front", - "sbh_1263", - "sbh_1290", - "sbh_1337", - "sbh_1550", - "sbh_1_s1", - "sbh_1_s2", - "sbh_881_back", - "sbh_881_front", - "tna_883a", - "tna_883b", - "tna_e26_1a_58_back", - "tna_e26_1a_58_front", - "tna_e40_11002_s1_back", - "tna_e40_11002_s1_front", - "tna_e40_11002_s2", - "tna_e40_6839", - "tna_e40_6884_back", - "tna_e40_6884_front", - "tna_e42_146_s1", - "tna_e42_146_s2", - "tna_e42_543_back", - "tna_e42_543_front", - "tna_sc13_h88_back", - "tna_sc13_h88_front", - "tna_sc13_i34_back", - "tna_sc13_i34_front", - "tna_sc13_i38_back", - "tna_sc13_i38_front", - "tna_sc13_k36_back", - "tna_sc13_k36_front", - "tna_sc13_q1_back", - "tna_sc13_q1_front" - ]; + + if (count($path_info['call_parts']) > 1) { + $id = ($path_info['call_parts'][1]); + } + else { + //set a default RTI + $id = 11887234; + } + $title = $id; } //Dataset statistics @@ -209,8 +155,49 @@ switch($path_info['call_parts'][0]) { case 'gallery' : + + #1:identify the RTI that needs to be displayed + $queryrti = "SELECT * FROM gallery_rti WHERE id_representation = $id"; + $queryrtiresult = mysqli_query($link, $queryrti); + $row = mysqli_fetch_assoc($queryrtiresult); + #establish the directory where the RTI is located + $val1_directory = $row['representation_folder']; + + #info to display about RTI + $val2_image_state = $row['image_state']; + $val3_itemID = $row['id_item']; + $val4_material = $row['material']; + $val5_credit1 = $row['name_first']; + $val6_credit2 = $row['name_last']; + $val7_dim_vert = $row['face_vertical']; + $val8_dim_hori = $row['face_horizontal']; + $val9_support = $row['id_support']; + $val10_repository1 = $row['repository_fulltitle']; + $val11_repository2 = $row['reference_full']; + $val12_id_digisig = $row['fk_digisig']; + + #test whether there is an RTI of another side of the object. If TRUE then we need button to reload RTI gallery with the target set to "gallery/" . $val13_alternaterti + $queryrti_dblsided = "SELECT id_representation FROM gallery_rti WHERE id_support = $val9_support and fk_digisig <> $val12_id_digisig"; + $queryrti_dblsided_result = mysqli_query($link, $queryrti_dblsided); + $row = mysqli_fetch_assoc($queryrti_dblsided_result); + $val13_alternaterti = $row['id_representation']; + if(isset($val_alternaterti)) { + $flip = TRUE; + } + else { + $flip = FALSE; + } + + #test whether this is a positive or negative object. If TRUE then offer 'flip' button (which should perhaps be renamed to invert + if ($val2_image_state == 'negative') { + $invert = TRUE; + } + else { + $invert = FALSE; + } + echo '