[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> banner_manager.php (source)

   1  <?php
   2  /*

   3  $Id: banner_manager.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    require ('includes/application_top.php');
  14  
  15    $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  16  
  17    $banner_extension = tep_banner_image_extension();
  18  
  19    if (tep_not_null($action)) {
  20      switch ($action) {
  21        case 'setflag':
  22          if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
  23            tep_set_banner_status($HTTP_GET_VARS['bID'], $HTTP_GET_VARS['flag']);
  24  
  25            $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success');
  26          } else {
  27            $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error');
  28          }
  29  
  30          tep_redirect(tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $HTTP_GET_VARS['bID']));
  31          break;
  32        case 'insert':
  33        case 'update':
  34          if (isset($HTTP_POST_VARS['banners_id'])) $banners_id = tep_db_prepare_input($HTTP_POST_VARS['banners_id']);
  35          $banners_title = tep_db_prepare_input($HTTP_POST_VARS['banners_title']);
  36          $banners_url = tep_db_prepare_input($HTTP_POST_VARS['banners_url']);
  37          $new_banners_group = tep_db_prepare_input($HTTP_POST_VARS['new_banners_group']);
  38          $banners_group = (empty($new_banners_group)) ? tep_db_prepare_input($HTTP_POST_VARS['banners_group']) : $new_banners_group;
  39          $banners_html_text = tep_db_prepare_input($HTTP_POST_VARS['banners_html_text']);
  40          $banners_image_local = tep_db_prepare_input($HTTP_POST_VARS['banners_image_local']);
  41          $banners_image_target = tep_db_prepare_input($HTTP_POST_VARS['banners_image_target']);
  42          $db_image_location = '';
  43          $expires_date = tep_db_prepare_input($HTTP_POST_VARS['expires_date']);
  44          $expires_impressions = tep_db_prepare_input($HTTP_POST_VARS['expires_impressions']);
  45          $date_scheduled = tep_db_prepare_input($HTTP_POST_VARS['date_scheduled']);
  46  
  47          $banner_error = false;
  48          if (empty($banners_title)) {
  49            $messageStack->add(ERROR_BANNER_TITLE_REQUIRED, 'error');
  50            $banner_error = true;
  51          }
  52  
  53          if (empty($banners_group)) {
  54            $messageStack->add(ERROR_BANNER_GROUP_REQUIRED, 'error');
  55            $banner_error = true;
  56          }
  57  
  58          if (empty($banners_html_text)) {
  59            if (empty($banners_image_local)) {
  60              $banners_image = new upload('banners_image');
  61              $banners_image->set_destination(DIR_FS_CATALOG_IMAGES . $banners_image_target);
  62              if ( ($banners_image->parse() == false) || ($banners_image->save() == false) ) {
  63                $banner_error = true;
  64              }
  65            }
  66          }
  67  
  68          if ($banner_error == false) {
  69            $db_image_location = (tep_not_null($banners_image_local)) ? $banners_image_local : $banners_image_target . $banners_image->filename;
  70            $sql_data_array = array('banners_title' => $banners_title,
  71                                    'banners_url' => $banners_url,
  72                                    'banners_image' => $db_image_location,
  73                                    'banners_group' => $banners_group,
  74                                    'banners_html_text' => $banners_html_text);
  75  
  76            if ($action == 'insert') {
  77              $insert_sql_data = array('date_added' => 'now()',
  78                                       'status' => '1');
  79  
  80              $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  81  
  82              tep_db_perform(TABLE_BANNERS, $sql_data_array);
  83  
  84              $banners_id = tep_db_insert_id();
  85  
  86              $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
  87            } elseif ($action == 'update') {
  88              tep_db_perform(TABLE_BANNERS, $sql_data_array, 'update', "banners_id = '" . (int)$banners_id . "'");
  89  
  90              $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success');
  91            }
  92  
  93            if (tep_not_null($expires_date)) {
  94              list($day, $month, $year) = explode('/', $expires_date);
  95  
  96              $expires_date = $year .
  97                              ((strlen($month) == 1) ? '0' . $month : $month) .
  98                              ((strlen($day) == 1) ? '0' . $day : $day);
  99  
 100              tep_db_query("update " . TABLE_BANNERS . " set expires_date = '" . tep_db_input($expires_date) . "', expires_impressions = null where banners_id = '" . (int)$banners_id . "'");
 101            } elseif (tep_not_null($expires_impressions)) {
 102              tep_db_query("update " . TABLE_BANNERS . " set expires_impressions = '" . tep_db_input($expires_impressions) . "', expires_date = null where banners_id = '" . (int)$banners_id . "'");
 103            }
 104  
 105            if (tep_not_null($date_scheduled)) {
 106              list($day, $month, $year) = explode('/', $date_scheduled);
 107  
 108              $date_scheduled = $year .
 109                                ((strlen($month) == 1) ? '0' . $month : $month) .
 110                                ((strlen($day) == 1) ? '0' . $day : $day);
 111  
 112              tep_db_query("update " . TABLE_BANNERS . " set status = '0', date_scheduled = '" . tep_db_input($date_scheduled) . "' where banners_id = '" . (int)$banners_id . "'");
 113            }
 114  
 115            tep_redirect(tep_href_link(FILENAME_BANNER_MANAGER, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'bID=' . $banners_id));
 116          } else {
 117            $action = 'new';
 118          }
 119          break;
 120        case 'deleteconfirm':
 121          $banners_id = tep_db_prepare_input($HTTP_GET_VARS['bID']);
 122  
 123          if (isset($HTTP_POST_VARS['delete_image']) && ($HTTP_POST_VARS['delete_image'] == 'on')) {
 124            $banner_query = tep_db_query("select banners_image from " . TABLE_BANNERS . " where banners_id = '" . (int)$banners_id . "'");
 125            $banner = tep_db_fetch_array($banner_query);
 126  
 127            if (is_file(DIR_FS_CATALOG_IMAGES . $banner['banners_image'])) {
 128              if (is_writeable(DIR_FS_CATALOG_IMAGES . $banner['banners_image'])) {
 129                unlink(DIR_FS_CATALOG_IMAGES . $banner['banners_image']);
 130              } else {
 131                $messageStack->add_session(ERROR_IMAGE_IS_NOT_WRITEABLE, 'error');
 132              }
 133            } else {
 134              $messageStack->add_session(ERROR_IMAGE_DOES_NOT_EXIST, 'error');
 135            }
 136          }
 137  
 138          tep_db_query("delete from " . TABLE_BANNERS . " where banners_id = '" . (int)$banners_id . "'");
 139          tep_db_query("delete from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . (int)$banners_id . "'");
 140  
 141          if (function_exists('imagecreate') && tep_not_null($banner_extensio)) {
 142            if (is_file(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension)) {
 143              if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension)) {
 144                unlink(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension);
 145              }
 146            }
 147  
 148            if (is_file(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension)) {
 149              if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension)) {
 150                unlink(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension);
 151              }
 152            }
 153  
 154            if (is_file(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension)) {
 155              if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension)) {
 156                unlink(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension);
 157              }
 158            }
 159  
 160            if (is_file(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) {
 161              if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) {
 162                unlink(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension);
 163              }
 164            }
 165          }
 166  
 167          $messageStack->add_session(SUCCESS_BANNER_REMOVED, 'success');
 168  
 169          tep_redirect(tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page']));
 170          break;
 171      }
 172    }
 173  
 174  // check if the graphs directory exists

 175    $dir_ok = false;
 176    if (function_exists('imagecreate') && tep_not_null($banner_extension)) {
 177      if (is_dir(DIR_WS_IMAGES . 'graphs')) {
 178        if (is_writeable(DIR_WS_IMAGES . 'graphs')) {
 179          $dir_ok = true;
 180        } else {
 181          $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error');
 182        }
 183      } else {
 184        $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error');
 185      }
 186    }
 187  ?>
 188  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
 189  <html <?php echo HTML_PARAMS; ?>>
 190  <head>
 191  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 192  <title><?php echo TITLE; ?></title>
 193  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
 194  <script language="javascript" src="includes/general.js"></script>
 195  <script language="javascript"><!--
 196  function popupImageWindow(url) {
 197    window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
 198  }
 199  //--></script>

 200  </head>
 201  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
 202  <div id="spiffycalendar" class="text"></div>
 203  <!-- header //-->
 204  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
 205  <!-- header_eof //-->
 206  
 207  <!-- body //-->
 208  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 209    <tr>
 210      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
 211  <!-- left_navigation //-->
 212  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
 213  <!-- left_navigation_eof //-->
 214      </table></td>
 215  <!-- body_text //-->
 216      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 217        <tr>
 218          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 219            <tr>
 220              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 221              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 222            </tr>
 223          </table></td>
 224        </tr>
 225  <?php
 226    if ($action == 'new') {
 227      $form_action = 'insert';
 228  
 229      $parameters = array('expires_date' => '',
 230                          'date_scheduled' => '',
 231                          'banners_title' => '',
 232                          'banners_url' => '',
 233                          'banners_group' => '',
 234                          'banners_image' => '',
 235                          'banners_html_text' => '',
 236                          'expires_impressions' => '');
 237  
 238      $bInfo = new objectInfo($parameters);
 239  
 240      if (isset($HTTP_GET_VARS['bID'])) {
 241        $form_action = 'update';
 242  
 243        $bID = tep_db_prepare_input($HTTP_GET_VARS['bID']);
 244  
 245        $banner_query = tep_db_query("select banners_title, banners_url, banners_image, banners_group, banners_html_text, status, date_format(date_scheduled, '%d/%m/%Y') as date_scheduled, date_format(expires_date, '%d/%m/%Y') as expires_date, expires_impressions, date_status_change from " . TABLE_BANNERS . " where banners_id = '" . (int)$bID . "'");
 246        $banner = tep_db_fetch_array($banner_query);
 247  
 248        $bInfo->objectInfo($banner);
 249      } elseif (tep_not_null($HTTP_POST_VARS)) {
 250        $bInfo->objectInfo($HTTP_POST_VARS);
 251      }
 252  
 253      $groups_array = array();
 254      $groups_query = tep_db_query("select distinct banners_group from " . TABLE_BANNERS . " order by banners_group");
 255      while ($groups = tep_db_fetch_array($groups_query)) {
 256        $groups_array[] = array('id' => $groups['banners_group'], 'text' => $groups['banners_group']);
 257      }
 258  ?>
 259  <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
 260  <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
 261  <script language="javascript">
 262    var dateExpires = new ctlSpiffyCalendarBox("dateExpires", "new_banner", "expires_date","btnDate1","<?php echo $bInfo->expires_date; ?>",scBTNMODE_CUSTOMBLUE);
 263    var dateScheduled = new ctlSpiffyCalendarBox("dateScheduled", "new_banner", "date_scheduled","btnDate2","<?php echo $bInfo->date_scheduled; ?>",scBTNMODE_CUSTOMBLUE);
 264  </script>
 265        <tr>
 266          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 267        </tr>
 268        <tr><?php echo tep_draw_form('new_banner', FILENAME_BANNER_MANAGER, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'action=' . $form_action, 'post', 'enctype="multipart/form-data"'); if ($form_action == 'update') echo tep_draw_hidden_field('banners_id', $bID); ?>
 269          <td><table border="0" cellspacing="0" cellpadding="2">
 270            <tr>
 271              <td class="main"><?php echo TEXT_BANNERS_TITLE; ?></td>
 272              <td class="main"><?php echo tep_draw_input_field('banners_title', $bInfo->banners_title, '', true); ?></td>
 273            </tr>
 274            <tr>
 275              <td class="main"><?php echo TEXT_BANNERS_URL; ?></td>
 276              <td class="main"><?php echo tep_draw_input_field('banners_url', $bInfo->banners_url); ?></td>
 277            </tr>
 278            <tr>
 279              <td class="main" valign="top"><?php echo TEXT_BANNERS_GROUP; ?></td>
 280              <td class="main"><?php echo tep_draw_pull_down_menu('banners_group', $groups_array, $bInfo->banners_group) . TEXT_BANNERS_NEW_GROUP . '<br>' . tep_draw_input_field('new_banners_group', '', '', ((sizeof($groups_array) > 0) ? false : true)); ?></td>
 281            </tr>
 282            <tr>
 283              <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 284            </tr>
 285            <tr>
 286              <td class="main" valign="top"><?php echo TEXT_BANNERS_IMAGE; ?></td>
 287              <td class="main"><?php echo tep_draw_file_field('banners_image') . ' ' . TEXT_BANNERS_IMAGE_LOCAL . '<br>' . DIR_FS_CATALOG_IMAGES . tep_draw_input_field('banners_image_local', (isset($bInfo->banners_image) ? $bInfo->banners_image : '')); ?></td>
 288            </tr>
 289            <tr>
 290              <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 291            </tr>
 292            <tr>
 293              <td class="main"><?php echo TEXT_BANNERS_IMAGE_TARGET; ?></td>
 294              <td class="main"><?php echo DIR_FS_CATALOG_IMAGES . tep_draw_input_field('banners_image_target'); ?></td>
 295            </tr>
 296            <tr>
 297              <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 298            </tr>
 299            <tr>
 300              <td valign="top" class="main"><?php echo TEXT_BANNERS_HTML_TEXT; ?></td>
 301              <td class="main"><?php echo tep_draw_textarea_field('banners_html_text', 'soft', '60', '5', $bInfo->banners_html_text); ?></td>
 302            </tr>
 303            <tr>
 304              <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 305            </tr>
 306            <tr>
 307              <td class="main"><?php echo TEXT_BANNERS_SCHEDULED_AT; ?><br><small>(dd/mm/yyyy)</small></td>
 308              <td valign="top" class="main"><script language="javascript">dateScheduled.writeControl(); dateScheduled.dateFormat="dd/MM/yyyy";</script></td>
 309            </tr>
 310            <tr>
 311              <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 312            </tr>
 313            <tr>
 314              <td valign="top" class="main"><?php echo TEXT_BANNERS_EXPIRES_ON; ?><br><small>(dd/mm/yyyy)</small></td>
 315              <td class="main"><script language="javascript">dateExpires.writeControl(); dateExpires.dateFormat="dd/MM/yyyy";</script><?php echo TEXT_BANNERS_OR_AT . '<br>' . tep_draw_input_field('expires_impressions', $bInfo->expires_impressions, 'maxlength="7" size="7"') . ' ' . TEXT_BANNERS_IMPRESSIONS; ?></td>
 316            </tr>
 317          </table></td>
 318        </tr>
 319        <tr>
 320          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 321        </tr>
 322        <tr>
 323          <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 324            <tr>
 325              <td class="main"><?php echo TEXT_BANNERS_BANNER_NOTE . '<br>' . TEXT_BANNERS_INSERT_NOTE . '<br>' . TEXT_BANNERS_EXPIRCY_NOTE . '<br>' . TEXT_BANNERS_SCHEDULE_NOTE; ?></td>
 326              <td class="main" align="right" valign="top" nowrap><?php echo (($form_action == 'insert') ? tep_image_submit('button_insert.gif', IMAGE_INSERT) : tep_image_submit('button_update.gif', IMAGE_UPDATE)). '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_BANNER_MANAGER, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . (isset($HTTP_GET_VARS['bID']) ? 'bID=' . $HTTP_GET_VARS['bID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
 327            </tr>
 328          </table></td>
 329        </form></tr>
 330  <?php
 331    } else {
 332  ?>
 333        <tr>
 334          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 335            <tr>
 336              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 337                <tr class="dataTableHeadingRow">
 338                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_BANNERS; ?></td>
 339                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_GROUPS; ?></td>
 340                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATISTICS; ?></td>
 341                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
 342                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 343                </tr>
 344  <?php
 345      $banners_query_raw = "select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added from " . TABLE_BANNERS . " order by banners_title, banners_group";
 346      $banners_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $banners_query_raw, $banners_query_numrows);
 347      $banners_query = tep_db_query($banners_query_raw);
 348      while ($banners = tep_db_fetch_array($banners_query)) {
 349        $info_query = tep_db_query("select sum(banners_shown) as banners_shown, sum(banners_clicked) as banners_clicked from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . (int)$banners['banners_id'] . "'");
 350        $info = tep_db_fetch_array($info_query);
 351  
 352        if ((!isset($HTTP_GET_VARS['bID']) || (isset($HTTP_GET_VARS['bID']) && ($HTTP_GET_VARS['bID'] == $banners['banners_id']))) && !isset($bInfo) && (substr($action, 0, 3) != 'new')) {
 353          $bInfo_array = array_merge($banners, $info);
 354          $bInfo = new objectInfo($bInfo_array);
 355        }
 356  
 357        $banners_shown = ($info['banners_shown'] != '') ? $info['banners_shown'] : '0';
 358        $banners_clicked = ($info['banners_clicked'] != '') ? $info['banners_clicked'] : '0';
 359  
 360        if (isset($bInfo) && is_object($bInfo) && ($banners['banners_id'] == $bInfo->banners_id)) {
 361          echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_BANNER_STATISTICS, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $bInfo->banners_id) . '\'">' . "\n";
 362        } else {
 363          echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $banners['banners_id']) . '\'">' . "\n";
 364        }
 365  ?>
 366                  <td class="dataTableContent"><?php echo '<a href="javascript:popupImageWindow(\'' . FILENAME_POPUP_IMAGE . '?banner=' . $banners['banners_id'] . '\')">' . tep_image(DIR_WS_IMAGES . 'icon_popup.gif', 'View Banner') . '</a>&nbsp;' . $banners['banners_title']; ?></td>
 367                  <td class="dataTableContent" align="right"><?php echo $banners['banners_group']; ?></td>
 368                  <td class="dataTableContent" align="right"><?php echo $banners_shown . ' / ' . $banners_clicked; ?></td>
 369                  <td class="dataTableContent" align="right">
 370  <?php
 371        if ($banners['status'] == '1') {
 372          echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', 'Active', 10, 10) . '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $banners['banners_id'] . '&action=setflag&flag=0') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', 'Set Inactive', 10, 10) . '</a>';
 373        } else {
 374          echo '<a href="' . tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $banners['banners_id'] . '&action=setflag&flag=1') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', 'Set Active', 10, 10) . '</a>&nbsp;&nbsp;' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', 'Inactive', 10, 10);
 375        }
 376  ?></td>
 377                  <td class="dataTableContent" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_BANNER_STATISTICS, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $banners['banners_id']) . '">' . tep_image(DIR_WS_ICONS . 'statistics.gif', ICON_STATISTICS) . '</a>&nbsp;'; if (isset($bInfo) && is_object($bInfo) && ($banners['banners_id'] == $bInfo->banners_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $banners['banners_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 378                </tr>
 379  <?php
 380      }
 381  ?>
 382                <tr>
 383                  <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 384                    <tr>
 385                      <td class="smallText" valign="top"><?php echo $banners_split->display_count($banners_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_BANNERS); ?></td>
 386                      <td class="smallText" align="right"><?php echo $banners_split->display_links($banners_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
 387                    </tr>
 388                    <tr>
 389                      <td align="right" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_BANNER_MANAGER, 'action=new') . '">' . tep_image_button('button_new_banner.gif', IMAGE_NEW_BANNER) . '</a>'; ?></td>
 390                    </tr>
 391                  </table></td>
 392                </tr>
 393              </table></td>
 394  <?php
 395    $heading = array();
 396    $contents = array();
 397    switch ($action) {
 398      case 'delete':
 399        $heading[] = array('text' => '<b>' . $bInfo->banners_title . '</b>');
 400  
 401        $contents = array('form' => tep_draw_form('banners', FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $bInfo->banners_id . '&action=deleteconfirm'));
 402        $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
 403        $contents[] = array('text' => '<br><b>' . $bInfo->banners_title . '</b>');
 404        if ($bInfo->banners_image) $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('delete_image', 'on', true) . ' ' . TEXT_INFO_DELETE_IMAGE);
 405        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $HTTP_GET_VARS['bID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 406        break;
 407      default:
 408        if (is_object($bInfo)) {
 409          $heading[] = array('text' => '<b>' . $bInfo->banners_title . '</b>');
 410  
 411          $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $bInfo->banners_id . '&action=new') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $bInfo->banners_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
 412          $contents[] = array('text' => '<br>' . TEXT_BANNERS_DATE_ADDED . ' ' . tep_date_short($bInfo->date_added));
 413  
 414          if ( (function_exists('imagecreate')) && ($dir_ok) && ($banner_extension) ) {
 415            $banner_id = $bInfo->banners_id;
 416            $days = '3';
 417            include (DIR_WS_INCLUDES . 'graphs/banner_infobox.php');
 418            $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banner_id . '.' . $banner_extension));
 419          } else {
 420            include (DIR_WS_FUNCTIONS . 'html_graphs.php');
 421            $contents[] = array('align' => 'center', 'text' => '<br>' . tep_banner_graph_infoBox($bInfo->banners_id, '3'));
 422          }
 423  
 424          $contents[] = array('text' => tep_image(DIR_WS_IMAGES . 'graph_hbar_blue.gif', 'Blue', '5', '5') . ' ' . TEXT_BANNERS_BANNER_VIEWS . '<br>' . tep_image(DIR_WS_IMAGES . 'graph_hbar_red.gif', 'Red', '5', '5') . ' ' . TEXT_BANNERS_BANNER_CLICKS);
 425  
 426          if ($bInfo->date_scheduled) $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_SCHEDULED_AT_DATE, tep_date_short($bInfo->date_scheduled)));
 427  
 428          if ($bInfo->expires_date) {
 429            $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_EXPIRES_AT_DATE, tep_date_short($bInfo->expires_date)));
 430          } elseif ($bInfo->expires_impressions) {
 431            $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_EXPIRES_AT_IMPRESSIONS, $bInfo->expires_impressions));
 432          }
 433  
 434          if ($bInfo->date_status_change) $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_STATUS_CHANGE, tep_date_short($bInfo->date_status_change)));
 435        }
 436        break;
 437    }
 438  
 439    if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
 440      echo '            <td width="25%" valign="top">' . "\n";
 441  
 442      $box = new box;
 443      echo $box->infoBox($heading, $contents);
 444  
 445      echo '            </td>' . "\n";
 446    }
 447  ?>
 448            </tr>
 449          </table></td>
 450        </tr>
 451  <?php
 452    }
 453  ?>
 454      </table></td>
 455  <!-- body_text_eof //-->
 456    </tr>
 457  </table>
 458  <!-- body_eof //-->
 459  
 460  <!-- footer //-->
 461  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 462  <!-- footer_eof //-->
 463  <br>
 464  </body>
 465  </html>
 466  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7