Source for file admin.banners.html.php

Documentation is available at admin.banners.html.php

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

Documentation generated on Mon, 05 May 2008 16:12:38 +0400 by phpDocumentor 1.4.0