<?php
// ***************************
// *                         *
// *  get_image_label_list *
// *                         *
// ***************************
function get_image_label_list() {
  include ("db_connection.php");
  /*
$query = "SELECT * " .
"FROM image_name_suggestions ";
if ($default_select) $query .= "WHERE default_select=true ";
$query .= "ORDER BY sort_order ASC";
$result = $bwb_wiz_dbh->query($query);
$rows = $result->fetchALL(PDO::FETCH_ASSOC);
*/
    $rows = array(
    array("id"=>"0", "tag"=>"upload_only", "name"=>"Upload File - do not place"),
    array("id"=>"1", "tag"=>"logo", "name"=>"Site Logo"),
    array("id"=>"2", "tag"=>"body_bg_image", "name"=>"Body Background"),
    array("id"=>"3", "tag"=>"header_bg_image", "name"=>"Header Background"),
    array("id"=>"4", "tag"=>"wrap_bg_image", "name"=>"Wrap Background"),
    array("id"=>"5", "tag"=>"content_td_bg_image", "name"=>"Content_cell Background"),
    array("id"=>"6", "tag"=>"top_td_bg_image", "name"=>"Top Cell Background"),
    array("id"=>"7", "tag"=>"right_td_bg_image", "name"=>"Right Cell Background"),
    array("id"=>"8", "tag"=>"bottom_td_bg_image", "name"=>"Bottom Cell Background"),
    array("id"=>"9", "tag"=>"left_td_bg_image", "name"=>"Left Cell Background"));
  /*print "<pre style=\"text-align:left;\">";
print_r($rows);
print "</pre>";
*/
  return $rows;
}
function get_image_label_selector($row,$selected="") {
  static $myImageSelector = null;
  if ($myImageSelector === null) {
    $myImageSelector = get_image_label_list();
  }
  $myString1 = str_pad("", 6) . "<select name='image_tag_" . $row . "' \n";
  $myString1 .= str_pad("", 6) . "id='image_tag_" . $row . "' \n";
  $myString1 .= str_pad("", 13) . "class='hide_value image_tag' \n";
  $myString1 .= str_pad("", 10) . "onchange='set_value(this," . $row . ");' \n";
  $myString1 .= str_pad("", 12) . "onblur='set_value(this," . $row . ");' >\n";
  $myString1 .= str_pad("", 8) . "<option value=''> *** Select where to place image *** </option>\n";
  foreach ($myImageSelector as $val) {
    $myString1 .= str_pad("", 8) . "<option value='" . $val["tag"];
    $myString1 .= ($val["tag"]===$selected?"' selected>":"'>");
    $myString1 .= $val["name"] . "</option>\n";
  }
  $myString1 .= str_pad("", 6) . "</select>\n";
  return $myString1;
}
function get_image_progress_class($row,$selected="") {
  static $myImageSelector = null;
  if ($myImageSelector === null) {
    $myImageSelector = get_image_label_list();
  }
  foreach ($myImageSelector as $val) {
    $myString1 = str_pad("", 6) . ($val["tag"]==='upload_only'?"uploaded":"tagged");
  }
  return $myString1;
}
function get_image_tag_list () {
  static $myImageTags = null;
  if ($myImageTags === null) {
    $myImageTags = get_image_label_list();
  }
  static $myList = null;
  if ($myList === null) {
    foreach ($myImageTags as $val) {
      $myList[$val["tag"]] = $val["name"];
    }
  }
  $myList['0'] = 'undefined';
  return $myList;
}
?>