[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/components/com_poll/ -> admin.poll.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Polls
   5  * @author Mambo Foundation Inc see README.php
   6  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   7  * See COPYRIGHT.php for copyright notices and details.
   8  * @license GNU/GPL Version 2, see LICENSE.php
   9  *
  10  * Redistributions of files must retain the above copyright notice.
  11  *
  12  * Mambo is free software; you can redistribute it and/or
  13  * modify it under the terms of the GNU General Public License
  14  * as published by the Free Software Foundation; version 2 of the License.
  15  */
  16  
  17  /** ensure this file is being included by a parent file */
  18  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  19  
  20  class HTML_poll {
  21  
  22  	function showPolls( &$rows, &$pageNav, $option ) {
  23          global $my;
  24  
  25          mosCommonHTML::loadOverlib();
  26          ?>
  27          <form action="index2.php" method="post" name="adminForm">
  28          <table class="adminheading">
  29          <tr>
  30              <th><?php echo T_('Poll Manager'); ?></th>
  31          </tr>
  32          </table>
  33  
  34          <table class="adminlist">
  35          <tr>
  36              <th width="5">
  37              #
  38              </th>
  39              <th width="20">
  40              <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $rows ); ?>);" />
  41              </th>
  42              <th align="left">
  43              <?php echo T_('Poll Question'); ?>
  44              </th>
  45              <th width="10%" align="center">
  46              <?php echo T_('Published'); ?>
  47              </th>
  48              <th width="10%" align="center">
  49              <?php echo T_('Options'); ?>
  50              </th>
  51              <th width="10%" align="center">
  52              <?php echo T_('Lag'); ?>
  53              </th>
  54          </tr>
  55          <?php
  56          $k = 0;
  57          for ($i=0, $n=count( $rows ); $i < $n; $i++) {
  58              $row = &$rows[$i];
  59  
  60              $link     = 'index2.php?option=com_poll&task=editA&hidemainmenu=1&id='. $row->id;
  61  
  62              $task     = $row->published ? 'unpublish' : 'publish';
  63              $img     = $row->published ? 'publish_g.png' : 'publish_x.png';
  64              $alt     = $row->published ? T_('Published') : T_('Unpublished');
  65  
  66              $checked     = mosCommonHTML::CheckedOutProcessing( $row, $i );
  67              ?>
  68              <tr class="<?php echo "row$k"; ?>">
  69                  <td>
  70                  <?php echo $pageNav->rowNumber( $i ); ?>
  71                  </td>
  72                  <td>
  73                  <?php echo $checked; ?>
  74                  </td>
  75                  <td>
  76                  <a href="<?php echo $link; ?>" title="<?php echo T_('Edit Poll'); ?>">
  77                  <?php echo $row->title; ?>
  78                  </a>
  79                  </td>
  80                  <td align="center">
  81                  <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
  82                  <img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="<?php echo $alt; ?>" />
  83                  </a>
  84                  </td>
  85                  <td align="center">
  86                  <?php echo $row->numoptions; ?>
  87                  </td>
  88                  <td align="center">
  89                  <?php echo $row->lag; ?>
  90                  </td>
  91              </tr>
  92              <?php
  93              $k = 1 - $k;
  94          }
  95          ?>
  96          </table>
  97          <?php echo $pageNav->getListFooter(); ?>
  98  
  99          <input type="hidden" name="option" value="<?php echo $option;?>" />
 100          <input type="hidden" name="task" value="" />
 101          <input type="hidden" name="boxchecked" value="0" />
 102          <input type="hidden" name="hidemainmenu" value="0">
 103          </form>
 104          <?php
 105      }
 106  
 107  
 108  	function editPoll( &$row, &$options, &$lists ) {
 109          mosMakeHtmlSafe( $row, ENT_QUOTES );
 110          ?>
 111          <script type="text/javascript">
 112  		function submitbutton(pressbutton) {
 113              var form = document.adminForm;
 114              if (pressbutton == 'cancel') {
 115                  submitform( pressbutton );
 116                  return;
 117              }
 118              // do field validation
 119              if (form.title.value == "") {
 120                  alert( "<?php echo T_('Poll must have a title'); ?>" );
 121              } else if( isNaN( parseInt( form.lag.value ) ) ) {
 122                  alert( "<?php echo T_('Poll must have a non-zero lag time'); ?>" );
 123              //} else if (form.menu.options.value == ""){
 124              //    alert( "Poll must have pages." );
 125              //} else if (form.adminForm.textfieldcheck.value == 0){
 126              //    alert( "Poll must have options." );
 127              } else {
 128                  submitform( pressbutton );
 129              }
 130          }
 131          </script>
 132          <form action="index2.php" method="post" name="adminForm">
 133          <table class="adminheading">
 134          <tr>
 135              <th>
 136              <?php echo T_('Poll:'); ?>
 137              <small>
 138              <?php echo $row->id ? T_('Edit') : T_('New');?>
 139              </small>
 140              </th>
 141          </tr>
 142          </table>
 143  
 144          <table class="adminform">
 145          <tr>
 146              <th colspan="4">
 147              <?php echo T_('Details'); ?>
 148              </th>
 149          </tr>
 150          <tr>
 151              <td width="10%">
 152              <?php echo T_('Question:'); ?>
 153              </td>
 154              <td>
 155              <input class="inputbox" type="text" name="title" size="60" value="<?php echo $row->title; ?>" />
 156              </td>
 157                 <td width="20px">&nbsp;
 158  
 159              </td>
 160              <td width="100%" rowspan="20" valign="top">
 161              <?php echo T_('Show on menu items:'); ?>
 162              <br />
 163              <?php echo $lists['select']; ?>
 164              </td>
 165          </tr>
 166          <tr>
 167              <td>
 168              <?php echo T_('Lag:'); ?>
 169              </td>
 170              <td>
 171              <input class="inputbox" type="text" name="lag" size="10" value="<?php echo $row->lag; ?>" /> (seconds between votes)
 172              </td>
 173          </tr>
 174          <tr>
 175              <td colspan="3">
 176              <br /><br />
 177              <?php echo T_('Options:'); ?>
 178              </td>
 179          </tr>
 180          <?php
 181          for ($i=0, $n=count( $options ); $i < $n; $i++ ) {
 182              ?>
 183              <tr>
 184                  <td>
 185                  <?php echo ($i+1); ?>
 186                  </td>
 187                  <td>
 188                  <input class="inputbox" type="text" name="polloption[<?php echo $options[$i]->id; ?>]" value="<?php echo htmlspecialchars( $options[$i]->text, ENT_QUOTES ); ?>" size="60" />
 189                  </td>
 190              </tr>
 191              <?php
 192          }
 193          for (; $i < 12; $i++) {
 194              ?>
 195              <tr>
 196                  <td>
 197                  <?php echo ($i+1); ?>
 198                  </td>
 199                  <td>
 200                  <input class="inputbox" type="text" name="polloption[]" value="" size="60"/>
 201                  </td>
 202              </tr>
 203              <?php
 204          }
 205          ?>
 206          </table>
 207  
 208          <input type="hidden" name="task" value="">
 209          <input type="hidden" name="option" value="com_poll" />
 210          <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
 211          <input type="hidden" name="textfieldcheck" value="<?php echo $n; ?>" />
 212          </form>
 213          <?php
 214      }
 215  
 216  }
 217  ?>