echo $row_result['lname'] ?> |
ΑΡΧΕΙΟ |
ΥΠΟΑΡΧΕΙΟ |
ΕΝΟΤΗΤΑ |
ΓΕΝ. ΤΥΠΟΣ |
ΤΙΤΛΟΣ Φ.Τ. |
ΟΝΤΟΤΗΤΑ |
ΙΔΙΟΤΗΤΑ |
// Κάθε row του βασικού ερωτήματος στον πίνακα persons_occupations επιστρέφει
// το phys_item_id του Φ.Τ. που περιέχει το προς αναζήτηση πρόσωπο (το entity_id είναι 0)
// ή και το entity_id ( > 0) της οντότητας που περιέχει το προς αναζήτηση πρόσωπο
$color="#D4DBDf";
while($row_result) {
//$color=($color=="#ECE9E0")?"ECE9D0":"#ECE9E0";
$color = ($color=="#D4DBDf") ? '#E5E8ED' : '#D4DBDf' ;
$entity_t1=" ";
$phys_item_id = $row_result['phys_item_id'];
$entity_id = $row_result['entity_id'];
// Αρχικοποίηση των δυναμικών τμημάτων του προς σχηματισμό ερωτήματος
$q_select ="";
$q_from ="";
$q_where="";
// Αν το entity_id > 0 ψάχνουμε και στον πίνακα entity
if ($entity_id > 0) {
$q_select .=", entity.t1 as entity_t1 ";
$q_from .=", entity ";
$q_where .= " and entity.entity_id = $entity_id ";
}
$query_2= "SELECT
archive.name as archive_name,
sub_archive.name as sub_archive_name,
sub_archive_dir.name as sub_archive_dir_name,
phys_item.title as phys_item_title,
phys_items_gen_types.name as phys_items_gen_types_name
$q_select
FROM
phys_item, archive, sub_archive, sub_archive_dir, phys_items_gen_types
$q_from
WHERE
phys_item.phys_item_id = $phys_item_id and
phys_item.archive_id=archive.archive_id and
phys_item.sub_archive_id=sub_archive.sub_archive_id and
phys_item.sub_archive_dir_id=sub_archive_dir.sub_archive_dir_id and
phys_items_gen_types.phys_item_gen_id = phys_item.phys_item_gen_id
$q_where";
$result_2 = mysqli_query($testiema_conn, $query_2);
if (!$result_2) die('Invalid query_2: '.$query_2.mysqli_error($testiema_conn));
$row_result_2 = mysqli_fetch_assoc($result_2);
//echo " $query_2 ";
$archive_name=$row_result_2['archive_name'];
$sub_archive_name=$row_result_2['sub_archive_name'];
$sub_archive_dir_name=$row_result_2['sub_archive_dir_name'];
$phys_items_gen_types_name=$row_result_2['phys_items_gen_types_name'];
$phys_item_title=$row_result_2['phys_item_title'];
if($phys_item_title =="") $phys_item_title="[ΑΤΙΤΛΟ]";
// η $phys_item_title εμφανίζει τον τίτλο του Φ.Τ. και στην περίπτωση που δεν υπάρχει εμφανίζει
// το ανάλογο μήνυμα στον πίνακα αποτελεσμάτων
$description=$row_result['description']; // Προσοχή από το εξωτερικό query
// Διάβασμα του τίτλου (αν υπάρχει) της οντότητας
if($entity_id > 0) {
$entity_t1=$row_result_2['entity_t1'];
if($entity_t1=="") $entity_t1="[ΑΤΙΤΛΟ]";
}else{
$entity_t1=" - ";
}
echo "
$archive_name |
$sub_archive_name |
$sub_archive_dir_name |
$phys_items_gen_types_name | ";
if($entity_id == 0) // Ο τίτλος του Φ.Τ. έχει link στην περίπτωση που δεν υπάρχει οντότητα
echo "$phys_item_title | ";
else
echo"$phys_item_title | ";
if($entity_id > 0) // Υπάρχει οντότητα και πρέπει να έχει link
echo "$entity_t1 | ";
else
echo"$entity_t1 | ";
echo "$description |
";
$row_result = mysqli_fetch_assoc($result);
}
?>
|