| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: banner.php 18162 2010-07-16 07:00:47Z ian $ 4 * @package Joomla 5 * @subpackage Banners 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license 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( '_JEXEC' ) or die( 'Restricted access' ); 17 18 /** 19 * @package Joomla 20 * @subpackage Banners 21 */ 22 class BannersViewBanner 23 { 24 function setBannersToolbar() 25 { 26 JToolBarHelper::title( JText::_( 'Banner Manager' ), 'generic.png' ); 27 JToolBarHelper::publishList(); 28 JToolBarHelper::unpublishList(); 29 JToolBarHelper::customX( 'copy', 'copy.png', 'copy_f2.png', 'Copy' ); 30 JToolBarHelper::deleteList(); 31 JToolBarHelper::editListX(); 32 JToolBarHelper::addNewX(); 33 JToolBarHelper::preferences('com_banners', '200'); 34 JToolBarHelper::help( 'screen.banners' ); 35 } 36 37 function banners( &$rows, &$pageNav, &$lists ) 38 { 39 BannersViewBanner::setBannersToolbar(); 40 $user =& JFactory::getUser(); 41 $ordering = ($lists['order'] == 'b.ordering'); 42 JHTML::_('behavior.tooltip'); 43 ?> 44 <form action="index.php?option=com_banners" method="post" name="adminForm"> 45 <table> 46 <tr> 47 <td align="left" width="100%"> 48 <?php echo JText::_( 'Filter' ); ?>: 49 <input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" /> 50 <button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button> 51 <button onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Filter Reset' ); ?></button> 52 </td> 53 <td nowrap="nowrap"> 54 <?php 55 echo $lists['catid']; 56 echo $lists['state']; 57 ?> 58 </td> 59 </tr> 60 </table> 61 62 <table class="adminlist"> 63 <thead> 64 <tr> 65 <th width="20"> 66 <?php echo JText::_( 'Num' ); ?> 67 </th> 68 <th width="20"> 69 <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" /> 70 </th> 71 <th nowrap="nowrap" class="title"> 72 <?php echo JHTML::_('grid.sort', 'Name', 'b.name', @$lists['order_Dir'], @$lists['order'] ); ?> 73 </th> 74 <th width="10%" nowrap="nowrap"> 75 <?php echo JHTML::_('grid.sort', 'Client', 'c.name', @$lists['order_Dir'], @$lists['order'] ); ?> 76 </th> 77 <th width="10%" nowrap="nowrap"> 78 <?php echo JHTML::_('grid.sort', 'Category', 'cc.title', @$lists['order_Dir'], @$lists['order'] ); ?> 79 </th> 80 <th width="5%" nowrap="nowrap"> 81 <?php echo JHTML::_('grid.sort', 'Published', 'b.showBanner', @$lists['order_Dir'], @$lists['order'] ); ?> 82 </th> 83 <th width="8%" nowrap="nowrap"> 84 <?php echo JHTML::_('grid.sort', 'Order', 'b.ordering', @$lists['order_Dir'], @$lists['order'] ); ?> 85 <?php if ($ordering) echo JHTML::_('grid.order', $rows ); ?> 86 </th> 87 <th width="5%" nowrap="nowrap"> 88 <?php echo JHTML::_('grid.sort', 'Sticky', 'b.Sticky', @$lists['order_Dir'], @$lists['order'] ); ?> 89 </th> 90 <th width="5%" nowrap="nowrap"> 91 <?php echo JHTML::_('grid.sort', 'Impressions', 'b.impmade', @$lists['order_Dir'], @$lists['order'] ); ?> 92 </th> 93 <th width="80"> 94 <?php echo JHTML::_('grid.sort', 'Clicks', 'b.clicks', @$lists['order_Dir'], @$lists['order'] ); ?> 95 </th> 96 <th width="5%" nowrap="nowrap"> 97 <?php echo JText::_( 'Tags' ); ?> 98 </th> 99 <th width="1%" nowrap="nowrap"> 100 <?php echo JHTML::_('grid.sort', 'ID', 'b.bid', @$lists['order_Dir'], @$lists['order'] ); ?> 101 </th> 102 </tr> 103 </thead> 104 <tfoot> 105 <tr> 106 <td colspan="13"> 107 <?php echo $pageNav->getListFooter(); ?> 108 </td> 109 </tr> 110 </tfoot> 111 <tbody> 112 <?php 113 $k = 0; 114 for ($i=0, $n=count( $rows ); $i < $n; $i++) { 115 $row = &$rows[$i]; 116 117 $row->id = $row->bid; 118 $link = JRoute::_( 'index.php?option=com_banners&task=edit&cid[]='. $row->id ); 119 120 if( $row->imptotal <= 0 ) { 121 $row->imptotal = JText::_('unlimited'); 122 } 123 124 if ( $row->impmade != 0 ) { 125 $percentClicks = 100 * $row->clicks/$row->impmade; 126 } else { 127 $percentClicks = 0; 128 } 129 130 $row->published = $row->showBanner; 131 $published = JHTML::_('grid.published', $row, $i ); 132 $checked = JHTML::_('grid.checkedout', $row, $i ); 133 ?> 134 <tr class="<?php echo "row$k"; ?>"> 135 <td align="center"> 136 <?php echo $pageNav->getRowOffset($i); ?> 137 </td> 138 <td align="center"> 139 <?php echo $checked; ?> 140 </td> 141 <td> 142 <span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit' );?>::<?php echo htmlspecialchars($row->name); ?>"> 143 <?php 144 if ( JTable::isCheckedOut($user->get ('id'), $row->checked_out ) ) { 145 echo htmlspecialchars($row->name); 146 } else { 147 ?> 148 149 <a href="<?php echo $link; ?>"> 150 <?php echo htmlspecialchars($row->name); ?></a> 151 <?php 152 } 153 ?> 154 </span> 155 </td> 156 <td align="center"> 157 <?php echo htmlspecialchars($row->client_name);?> 158 </td> 159 <td align="center"> 160 <?php echo htmlspecialchars($row->category_name);?> 161 </td> 162 <td align="center"> 163 <?php echo $published;?> 164 </td> 165 <td class="order"> 166 <?php $disabled = $ordering ? '' : 'disabled="disabled"'; ?> 167 <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo $disabled ?> class="text_area" style="text-align: center" /> 168 </td> 169 <td align="center"> 170 <?php echo $row->sticky ? JText::_( 'Yes' ) : JText::_( 'No' );?> 171 </td> 172 <td align="center"> 173 <?php echo $row->impmade.' '.JText::_('of').' '.$row->imptotal?> 174 </td> 175 <td align="center"> 176 <?php echo $row->clicks;?> - 177 <?php echo sprintf( '%.2f%%', $percentClicks );?> 178 </td> 179 <td> 180 <?php echo $row->tags; ?> 181 </td> 182 <td align="center"> 183 <?php echo $row->id; ?> 184 </td> 185 </tr> 186 <?php 187 $k = 1 - $k; 188 } 189 ?> 190 </tbody> 191 </table> 192 193 <input type="hidden" name="c" value="banner" /> 194 <input type="hidden" name="option" value="com_banners" /> 195 <input type="hidden" name="task" value="" /> 196 <input type="hidden" name="boxchecked" value="0" /> 197 <input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?>" /> 198 <input type="hidden" name="filter_order_Dir" value="<?php echo $lists['order_Dir']; ?>" /> 199 <?php echo JHTML::_( 'form.token' ); ?> 200 </form> 201 <?php 202 } 203 204 function setBannerToolbar() 205 { 206 $task = JRequest::getVar( 'task', '', 'method', 'string'); 207 208 JToolBarHelper::title( $task == 'add' ? JText::_( 'Banner' ) . ': <small><small>[ '. JText::_( 'New' ) .' ]</small></small>' : JText::_( 'Banner' ) . ': <small><small>[ '. JText::_( 'Edit' ) .' ]</small></small>', 'generic.png' ); 209 JToolBarHelper::save( 'save' ); 210 JToolBarHelper::apply('apply'); 211 JToolBarHelper::cancel( 'cancel' ); 212 JToolBarHelper::help( 'screen.banners.edit' ); 213 } 214 215 function banner( &$row, &$lists ) 216 { 217 BannersViewBanner::setBannerToolbar(); 218 JRequest::setVar( 'hidemainmenu', 1 ); 219 JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'custombannercode' ); 220 ?> 221 <script language="javascript" type="text/javascript"> 222 <!-- 223 function changeDisplayImage() { 224 if (document.adminForm.imageurl.value !='') { 225 document.adminForm.imagelib.src='../images/banners/' + document.adminForm.imageurl.value; 226 } else { 227 document.adminForm.imagelib.src='images/blank.png'; 228 } 229 } 230 function submitbutton(pressbutton) { 231 var form = document.adminForm; 232 if (pressbutton == 'cancel') { 233 submitform( pressbutton ); 234 return; 235 } 236 // do field validation 237 if (form.name.value == "") { 238 alert( "<?php echo JText::_( 'You must provide a banner name.', true ); ?>" ); 239 } else if (getSelectedValue('adminForm','cid') < 1) { 240 alert( "<?php echo JText::_( 'Please select a client.', true ); ?>" ); 241 /*} else if (!getSelectedValue('adminForm','imageurl')) { 242 alert( "<?php echo JText::_( 'Please select an image.', true ); ?>" );*/ 243 /*} else if (form.clickurl.value == "") { 244 alert( "<?php echo JText::_( 'Please fill in the URL for the banner.', true ); ?>" );*/ 245 } else if ( getSelectedValue('adminForm','catid') == 0 ) { 246 alert( "<?php echo JText::_( 'Please select a category.', true ); ?>" ); 247 } else { 248 submitform( pressbutton ); 249 } 250 } 251 //--> 252 </script> 253 <form action="index.php" method="post" name="adminForm"> 254 255 <div class="col100"> 256 <fieldset class="adminform"> 257 <legend><?php echo JText::_( 'Details' ); ?></legend> 258 259 <table class="admintable"> 260 <tbody> 261 <tr> 262 <td width="20%" class="key"> 263 <label for="name"> 264 <?php echo JText::_( 'Name' ); ?>: 265 </label> 266 </td> 267 <td width="80%"> 268 <input class="inputbox" type="text" name="name" id="name" size="50" value="<?php echo $row->name;?>" /> 269 </td> 270 </tr> 271 <tr> 272 <td width="20%" class="key"> 273 <label for="alias"> 274 <?php echo JText::_( 'Alias' ); ?>: 275 </label> 276 </td> 277 <td width="80%"> 278 <input class="inputbox" type="text" name="alias" id="alias" size="50" value="<?php echo $row->alias;?>" /> 279 </td> 280 </tr> 281 <tr> 282 <td class="key"> 283 <?php echo JText::_( 'Show Banner' ); ?>: 284 </td> 285 <td> 286 <?php echo $lists['showBanner']; ?> 287 </td> 288 </tr> 289 <tr> 290 <td class="key"> 291 <?php echo JText::_( 'Sticky' ); ?>: 292 </td> 293 <td> 294 <?php echo $lists['sticky']; ?> 295 </td> 296 </tr> 297 <tr> 298 <td class="key"> 299 <label for="ordering"> 300 <?php echo JText::_( 'Ordering' ); ?>: 301 </label> 302 </td> 303 <td> 304 <input class="inputbox" type="text" name="ordering" id="ordering" size="6" value="<?php echo $row->ordering;?>" /> 305 </td> 306 </tr> 307 <tr> 308 <td valign="top" align="right" class="key"> 309 <label for="catid"> 310 <?php echo JText::_( 'Category' ); ?>: 311 </label> 312 </td> 313 <td> 314 <?php echo $lists['catid']; ?> 315 </td> 316 </tr> 317 <tr> 318 <td class="key"> 319 <label for="cid"> 320 <?php echo JText::_( 'Client Name' ); ?>: 321 </label> 322 </td> 323 <td > 324 <?php echo $lists['cid']; ?> 325 </td> 326 </tr> 327 <tr> 328 <td class="key"> 329 <label for="imptotal"> 330 <?php echo JText::_( 'Impressions Purchased' ); ?>: 331 </label> 332 </td> 333 <?php 334 $unlimited = ''; 335 if ($row->imptotal == 0) { 336 $unlimited = 'checked="checked"'; 337 $row->imptotal = ''; 338 } 339 ?> 340 <td> 341 <input class="inputbox" type="text" name="imptotal" id="imptotal" size="12" maxlength="11" value="<?php echo $row->imptotal;?>" /> 342 343 <label for="unlimited"> 344 <?php echo JText::_( 'Unlimited' ); ?> 345 </label> 346 <input type="checkbox" name="unlimited" id="unlimited" <?php echo $unlimited;?> /> 347 </td> 348 </tr> 349 <tr> 350 <td class="key"> 351 <label for="clickurl"> 352 <?php echo JText::_( 'Click URL' ); ?>: 353 </label> 354 </td> 355 <td> 356 <input class="inputbox" type="text" name="clickurl" id="clickurl" size="100" maxlength="200" value="<?php echo $row->clickurl;?>" /> 357 </td> 358 </tr> 359 <tr > 360 <td valign="top" align="right" class="key"> 361 <?php echo JText::_( 'Clicks' ); ?>: 362 </td> 363 <td colspan="2"> 364 <?php echo $row->clicks;?> 365 366 <input name="reset_hits" type="button" class="button" value="<?php echo JText::_( 'Reset Clicks' ); ?>" onclick="submitbutton('resethits');" /> 367 </td> 368 </tr> 369 <tr> 370 <td valign="top" class="key"> 371 <label for="custombannercode"> 372 <?php echo JText::_( 'Custom banner code' ); ?>: 373 </label> 374 </td> 375 <td> 376 <textarea class="inputbox" cols="70" rows="8" name="custombannercode" id="custombannercode"><?php echo $row->custombannercode;?></textarea> 377 </td> 378 </tr> 379 <tr> 380 <td valign="top" class="key"> 381 <label for="description"> 382 <?php echo JText::_( 'Description/Notes' ); ?>: 383 </label> 384 </td> 385 <td> 386 <textarea class="inputbox" cols="70" rows="3" name="description" id="description"><?php echo $row->description;?></textarea> 387 </td> 388 </tr> 389 <tr> 390 <td colspan="3"> 391 </td> 392 </tr> 393 <tr> 394 <td valign="top" class="key"> 395 <label for="imageurl"> 396 <?php echo JText::_( 'Banner Image Selector' ); ?>: 397 </label> 398 </td> 399 <td > 400 <?php echo $lists['imageurl']; ?> 401 </td> 402 </tr> 403 <tr> 404 <td class="key"> 405 <label for="width"> 406 <?php echo JText::_( 'Width' ); ?>: 407 </label> 408 </td> 409 <td> 410 <input class="inputbox" type="text" name="width" id="width" size="6" value="<?php echo $lists['width'];?>" /> 411 </td> 412 </tr> 413 <tr> 414 <td class="key"> 415 <label for="height"> 416 <?php echo JText::_( 'Height' ); ?>: 417 </label> 418 </td> 419 <td> 420 <input class="inputbox" type="text" name="height" id="height" size="6" value="<?php echo $lists['height'];?>" /> 421 </td> 422 </tr> 423 <tr> 424 <td valign="top" class="key"> 425 <?php echo JText::_( 'Banner Image' ); ?>: 426 </td> 427 <td valign="top"> 428 <?php 429 if (preg_match("#swf$#i", $row->imageurl)) { 430 ?> 431 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" border="0" width="<?php echo $lists['width'];?>" height="<?php echo $lists['height'];?>"> 432 <param name="movie" value="../images/banners/<?php echo $row->imageurl; ?>"><embed src="../images/banners/<?php echo $row->imageurl; ?>" loop="false" pluginspage="http://www.macromedia.com/go/get/flashplayer" type="application/x-shockwave-flash" width="<?php echo $lists['width'];?>" height="<?php echo $lists['height'];?>"></embed> 433 </object> 434 <?php 435 } elseif (preg_match("#gif|jpg|png#i", $row->imageurl)) { 436 ?> 437 <img src="../images/banners/<?php echo $row->imageurl; ?>" name="imagelib" /> 438 <?php 439 } else { 440 ?> 441 <img src="images/blank.png" name="imagelib" /> 442 <?php 443 } 444 ?> 445 </td> 446 </tr> 447 <tr> 448 <td valign="top" class="key"> 449 <label for="tags"> 450 <?php echo JText::_( 'Tags' ); ?>: 451 </label> 452 </td> 453 <td> 454 <textarea class="inputbox" cols="70" rows="3" name="tags" id="tags"><?php echo $row->tags;?></textarea> 455 </td> 456 </tr> 457 </tbody> 458 </table> 459 </fieldset> 460 </div> 461 <div class="clr"></div> 462 463 <input type="hidden" name="c" value="banner" /> 464 <input type="hidden" name="option" value="com_banners" /> 465 <input type="hidden" name="bid" value="<?php echo $row->bid; ?>" /> 466 <input type="hidden" name="clicks" value="<?php echo $row->clicks; ?>" /> 467 <input type="hidden" name="task" value="" /> 468 <input type="hidden" name="impmade" value="<?php echo $row->impmade; ?>" /> 469 <?php echo JHTML::_( 'form.token' ); ?> 470 </form> 471 <?php 472 } 473 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |