[Index]    [Classes]    [Variables]

PHP Cross Reference of Joomla 1.0.15 Documentation

title

Body

[close]

/administrator/components/com_banners/ -> admin.banners.html.php (source)

   1  <?php
   2  /**
   3  * @version $Id: admin.banners.html.php 10002 2008-02-08 10:56:57Z willebil $
   4  * @package Joomla
   5  * @subpackage Banners
   6  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   7  * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // no direct access
  16  defined( '_VALID_MOS' ) or die( 'Restricted access' );
  17  
  18  /**
  19  * @package Joomla
  20  * @subpackage Banners
  21  */
  22  class HTML_banners {
  23  
  24  	function showBanners( &$rows, &$pageNav, $option ) {
  25          global $my;
  26  
  27          mosCommonHTML::loadOverlib();
  28          ?>
  29          <form action="index2.php" method="post" name="adminForm">
  30          <table class="adminheading">
  31          <tr>
  32              <th>
  33              Banner Manager
  34              </th>
  35          </tr>
  36          </table>
  37  
  38          <table class="adminlist">
  39          <tr>
  40              <th width="20">
  41              #
  42              </th>
  43              <th width="20">
  44              <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
  45              </th>
  46              <th align="left" nowrap="nowrap">
  47              Banner Name
  48              </th>
  49              <th width="10%" nowrap="nowrap">
  50              Published
  51              </th>
  52              <th width="11%" nowrap="nowrap">
  53              Impressions Made
  54              </th>
  55              <th width="11%" nowrap="nowrap">
  56              Impressions Left
  57              </th>
  58              <th width="8%">
  59              Clicks
  60              </th>
  61              <th width="8%" nowrap="nowrap">
  62              % Clicks
  63              </th>
  64          </tr>
  65          <?php
  66          $k = 0;
  67          for ($i=0, $n=count( $rows ); $i < $n; $i++) {
  68              $row = &$rows[$i];
  69              mosMakeHtmlSafe($row);
  70              $row->id     = $row->bid;
  71              $link         = 'index2.php?option=com_banners&task=editA&hidemainmenu=1&id='. $row->id;
  72  
  73              $impleft     = $row->imptotal - $row->impmade;
  74              if( $impleft < 0 ) {
  75                  $impleft     = "unlimited";
  76              }
  77  
  78              if ( $row->impmade != 0 ) {
  79                  $percentClicks = substr(100 * $row->clicks/$row->impmade, 0, 5);
  80              } else {
  81                  $percentClicks = 0;
  82              }
  83  
  84              $task     = $row->showBanner ? 'unpublish' : 'publish';
  85              $img     = $row->showBanner ? 'publish_g.png' : 'publish_x.png';
  86              $alt     = $row->showBanner ? 'Published' : 'Unpublished';
  87  
  88              $checked     = mosCommonHTML::CheckedOutProcessing( $row, $i );
  89              ?>
  90              <tr class="<?php echo "row$k"; ?>">
  91                  <td align="center">
  92                  <?php echo $pageNav->rowNumber( $i ); ?>
  93                  </td>
  94                  <td align="center">
  95                  <?php echo $checked; ?>
  96                  </td>
  97                  <td align="left">
  98                  <?php
  99                  if ( $row->checked_out && ( $row->checked_out != $my->id ) ) {
 100                      echo $row->name;
 101                  } else {
 102                      ?>
 103                      <a href="<?php echo $link; ?>" title="Edit Banner">
 104                      <?php echo $row->name; ?>
 105                      </a>
 106                      <?php
 107                  }
 108                  ?>
 109                  </td>
 110                  <td align="center">
 111                  <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
 112                  <img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="<?php echo $alt; ?>" />
 113                  </a>
 114                  </td>
 115                  <td align="center">
 116                  <?php echo $row->impmade;?>
 117                  </td>
 118                  <td align="center">
 119                  <?php echo $impleft;?>
 120                  </td>
 121                  <td align="center">
 122                  <?php echo $row->clicks;?>
 123                  </td>
 124                  <td align="center">
 125                  <?php echo $percentClicks;?>
 126                  </td>
 127              </tr>
 128              <?php
 129              $k = 1 - $k;
 130          }
 131          ?>
 132          </table>
 133          <?php echo $pageNav->getListFooter(); ?>
 134  
 135          <input type="hidden" name="option" value="<?php echo $option; ?>" />
 136          <input type="hidden" name="task" value="" />
 137          <input type="hidden" name="boxchecked" value="0" />
 138          <input type="hidden" name="hidemainmenu" value="0" />
 139          <input type="hidden" name="<?php echo josSpoofValue(); ?>" value="1" />
 140          </form>
 141          <?php
 142      }
 143  
 144  	function bannerForm( &$_row, &$lists, $_option ) {
 145          mosMakeHtmlSafe( $_row, ENT_QUOTES, 'custombannercode' );
 146          ?>
 147          <script language="javascript" type="text/javascript">
 148          <!--
 149  		function changeDisplayImage() {
 150              if (document.adminForm.imageurl.value !='') {
 151                  document.adminForm.imagelib.src='../images/banners/' + document.adminForm.imageurl.value;
 152              } else {
 153                  document.adminForm.imagelib.src='images/blank.png';
 154              }
 155          }
 156  		function submitbutton(pressbutton) {
 157              var form = document.adminForm;
 158              if (pressbutton == 'cancel') {
 159                  submitform( pressbutton );
 160                  return;
 161              }
 162              // do field validation
 163              if (form.name.value == "") {
 164                  alert( "You must provide a banner name." );
 165              } else if (getSelectedValue('adminForm','cid') < 1) {
 166                  alert( "Please select a client." );
 167              } else if (!getSelectedValue('adminForm','imageurl')) {
 168                  alert( "Please select an image." );
 169              } else if (form.clickurl.value == "") {
 170                  alert( "Please fill in the URL for the banner." );
 171              } else {
 172                  submitform( pressbutton );
 173              }
 174          }
 175          //-->
 176          </script>
 177          <form action="index2.php" method="post" name="adminForm">
 178          <table class="adminheading">
 179          <tr>
 180              <th>
 181              Banner:
 182              <small>
 183              <?php echo $_row->cid ? 'Edit' : 'New';?>
 184              </small>
 185              </th>
 186          </tr>
 187          </table>
 188  
 189          <table class="adminform">
 190          <tr>
 191              <th colspan="2">
 192              Details
 193              </th>
 194          </tr>
 195          <tr>
 196              <td width="20%">
 197              Banner Name:
 198              </td>
 199              <td width="80%">
 200              <input class="inputbox" type="text" name="name" value="<?php echo $_row->name;?>" />
 201              </td>
 202          </tr>
 203          <tr>
 204              <td>
 205              Client Name:
 206              </td>
 207              <td align="left">
 208              <?php echo $lists['cid']; ?>
 209              </td>
 210          </tr>
 211          <tr>
 212              <td>
 213              Impressions Purchased:
 214              </td>
 215              <?php
 216              $unlimited = '';
 217              if ($_row->imptotal == 0) {
 218                  $unlimited = 'checked="checked"';
 219                  $_row->imptotal = '';
 220              }
 221              ?>
 222              <td>
 223              <input class="inputbox" type="text" name="imptotal" size="12" maxlength="11" value="<?php echo $_row->imptotal;?>" />
 224              &nbsp;&nbsp;&nbsp;&nbsp;
 225              Unlimited <input type="checkbox" name="unlimited" <?php echo $unlimited;?> />
 226              </td>
 227          </tr>
 228          <tr>
 229              <td>
 230              Show Banner :
 231              </td>
 232              <td>
 233              <?php echo $lists['showBanner']; ?>
 234              </td>
 235          </tr>
 236          <tr>
 237              <td>
 238              Click URL:
 239              </td>
 240              <td>
 241              <input class="inputbox" type="text" name="clickurl" size="100" maxlength="200" value="<?php echo $_row->clickurl;?>" />
 242              </td>
 243          </tr>
 244          <tr >
 245              <td valign="top" align="right">
 246              Clicks
 247              </td>
 248              <td colspan="2">
 249              <?php echo $_row->clicks;?>
 250              &nbsp;&nbsp;&nbsp;&nbsp;
 251              <input name="reset_hits" type="button" class="button" value="Reset Clicks" onclick="submitbutton('resethits');" />
 252              </td>
 253          </tr>
 254          <tr>
 255              <td valign="top">
 256              Custom banner code:
 257              </td>
 258              <td>
 259              <textarea class="inputbox" cols="70" rows="5" name="custombannercode"><?php echo $_row->custombannercode;?></textarea>
 260              </td>
 261          </tr>
 262          <tr>
 263              <td valign="top">
 264              Banner Image Selector:
 265              </td>
 266              <td align="left">
 267              <?php echo $lists['imageurl']; ?>
 268              </td>
 269          </tr>
 270          <tr>
 271              <td valign="top">
 272              Banner Image:
 273              </td>
 274              <td valign="top">
 275              <?php
 276              if (eregi("swf", $_row->imageurl)) {
 277                  ?>
 278                  <img src="images/blank.png" name="imagelib">
 279                  <?php
 280              } elseif (eregi("gif|jpg|png", $_row->imageurl)) {
 281                  ?>
 282                  <img src="../images/banners/<?php echo $_row->imageurl; ?>" name="imagelib" />
 283                  <?php
 284              } else {
 285                  ?>
 286                  <img src="images/blank.png" name="imagelib" />
 287                  <?php
 288              }
 289              ?>
 290              </td>
 291          </tr>
 292          <tr>
 293              <td colspan="3">
 294              </td>
 295          </tr>
 296          </table>
 297  
 298          <input type="hidden" name="option" value="<?php echo $_option; ?>" />
 299          <input type="hidden" name="bid" value="<?php echo $_row->bid; ?>" />
 300          <input type="hidden" name="clicks" value="<?php echo $_row->clicks; ?>" />
 301          <input type="hidden" name="task" value="" />
 302          <input type="hidden" name="impmade" value="<?php echo $_row->impmade; ?>" />
 303          <input type="hidden" name="<?php echo josSpoofValue(); ?>" value="1" />
 304          </form>
 305          <?php
 306      }
 307  }
 308  
 309  /**
 310  * Banner clients
 311  * @package Joomla
 312  */
 313  class HTML_bannerClient {
 314  
 315  	function showClients( &$rows, &$pageNav, $option ) {
 316          global $my;
 317  
 318          mosCommonHTML::loadOverlib();
 319          ?>
 320          <form action="index2.php" method="post" name="adminForm">
 321          <table class="adminheading">
 322          <tr>
 323              <th>
 324              Banner Client Manager
 325              </th>
 326          </tr>
 327          </table>
 328  
 329          <table class="adminlist">
 330          <tr>
 331              <th width="20">
 332              #
 333              </th>
 334              <th width="20">
 335              <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
 336              </th>
 337              <th align="left" nowrap="nowrap">
 338              Client Name
 339              </th>
 340              <th align="left" nowrap="nowrap">
 341              Contact
 342              </th>
 343              <th align="center" nowrap="nowrap">
 344              No. of Active Banners
 345              </th>
 346              <th align="center" nowrap="nowrap">
 347              Client ID
 348              </th>
 349          </tr>
 350          <?php
 351          $k = 0;
 352          for ($i=0, $n=count( $rows ); $i < $n; $i++) {
 353              $row = &$rows[$i];
 354              mosMakeHtmlSafe($row);
 355              $row->id     = $row->cid;
 356              $link         = 'index2.php?option=com_banners&task=editclientA&hidemainmenu=1&id='. $row->id;
 357  
 358              $checked     = mosCommonHTML::CheckedOutProcessing( $row, $i );
 359              ?>
 360              <tr class="<?php echo "row$k"; ?>">
 361                  <td width="20" align="center">
 362                  <?php echo $pageNav->rowNumber( $i ); ?>
 363                  </td>
 364                  <td width="20">
 365                  <?php echo $checked; ?>
 366                  </td>
 367                  <td width="35%">
 368                  <?php
 369                  if ( $row->checked_out && ( $row->checked_out != $my->id ) ) {
 370                      echo $row->name;
 371                  } else {
 372                      ?>
 373                      <a href="<?php echo $link; ?>" title="Edit Banner Client">
 374                      <?php echo $row->name; ?>
 375                      </a>
 376                      <?php
 377                  }
 378                  ?>
 379                  </td>
 380                  <td width="35%">
 381                  <?php echo $row->contact;?>
 382                  </td>
 383                  <td width="15%" align="center">
 384                  <?php echo $row->bid;?>
 385                  </td>
 386                  <td width="15%" align="center">
 387                  <?php echo $row->cid; ?>
 388                  </td>
 389              </tr>
 390              <?php
 391              $k = 1 - $k;
 392          }
 393          ?>
 394          </table>
 395          <?php echo $pageNav->getListFooter(); ?>
 396  
 397          <input type="hidden" name="option" value="<?php echo $option; ?>" />
 398          <input type="hidden" name="task" value="listclients" />
 399          <input type="hidden" name="boxchecked" value="0" />
 400          <input type="hidden" name="hidemainmenu" value="0" />
 401          <input type="hidden" name="<?php echo josSpoofValue(); ?>" value="1" />
 402          </form>
 403          <?php
 404      }
 405  
 406  	function bannerClientForm( &$row, $option ) {
 407          mosMakeHtmlSafe( $row, ENT_QUOTES, 'extrainfo' );
 408          ?>
 409          <script language="javascript" type="text/javascript">
 410          <!--
 411  		function submitbutton(pressbutton) {
 412              var form = document.adminForm;
 413              if (pressbutton == 'cancelclient') {
 414                  submitform( pressbutton );
 415                  return;
 416              }
 417              // do field validation
 418              if (form.name.value == "") {
 419                  alert( "Please fill in the Client Name." );
 420              } else if (form.contact.value == "") {
 421                  alert( "Please fill in the Contact Name." );
 422              } else if (form.email.value == "") {
 423                  alert( "Please fill in the Contact E-mail." );
 424              } else {
 425                  submitform( pressbutton );
 426              }
 427          }
 428          //-->
 429          </script>
 430          <table class="adminheading">
 431          <tr>
 432              <th>
 433              Banner Client:
 434              <small>
 435              <?php echo $row->cid ? 'Edit' : 'New';?>
 436              </small>
 437              </th>
 438          </tr>
 439          </table>
 440  
 441          <form action="index2.php" method="post" name="adminForm">
 442          <table class="adminform">
 443          <tr>
 444              <th colspan="2">
 445              Details
 446              </th>
 447          </tr>
 448          <tr>
 449              <td width="10%">
 450              Client Name:
 451              </td>
 452              <td>
 453              <input class="inputbox" type="text" name="name" size="30" maxlength="60" valign="top" value="<?php echo $row->name; ?>" />
 454              </td>
 455          </tr>
 456          <tr>
 457              <td width="10%">
 458              Contact Name:
 459              </td>
 460              <td>
 461              <input class="inputbox" type="text" name="contact" size="30" maxlength="60" value="<?php echo $row->contact; ?>" />
 462              </td>
 463          </tr>
 464          <tr>
 465              <td width="10%">
 466              Contact E-mail:
 467              </td>
 468              <td>
 469              <input class="inputbox" type="text" name="email" size="30" maxlength="60" value="<?php echo $row->email; ?>" />
 470              </td>
 471          </tr>
 472          <tr>
 473              <td valign="top">
 474              Extra Info:
 475              </td>
 476              <td>
 477              <textarea class="inputbox" name="extrainfo" cols="60" rows="10"><?php echo str_replace('&','&amp;',$row->extrainfo);?></textarea>
 478              </td>
 479          </tr>
 480          <tr>
 481              <td colspan="3">
 482              </td>
 483          </tr>
 484          </table>
 485  
 486          <input type="hidden" name="option" value="<?php echo $option; ?>" />
 487          <input type="hidden" name="cid" value="<?php echo $row->cid; ?>" />
 488          <input type="hidden" name="task" value="" />
 489          <input type="hidden" name="<?php echo josSpoofValue(); ?>" value="1" />
 490          </form>
 491          <?php
 492      }
 493  }
 494  ?>