[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_newsfeeds/ -> admin.newsfeeds.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Newsfeeds
   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_newsfeeds {
  21  
  22  	function showNewsFeeds( &$rows, &$lists, $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>
  31              <?php echo T_('News Feed Manager'); ?>
  32              </th>
  33              <td width="right">
  34              <?php echo $lists['category'];?>
  35              </td>
  36          </tr>
  37          </table>
  38  
  39          <table class="adminlist">
  40          <tr>
  41              <th width="20">
  42              #
  43              </th>
  44              <th width="20">
  45              <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
  46              </th>
  47              <th class="title">
  48              <?php echo T_('News Feed'); ?>
  49              </th>
  50              <th width="5%">
  51              <?php echo T_('Published'); ?>
  52              </th>
  53              <th colspan="2" width="5%">
  54              <?php echo T_('Reorder'); ?>
  55              </th>
  56              <th class="title" width="20%">
  57              <?php echo T_('Category'); ?>
  58              </th>
  59              <th width="5%" nowrap="nowrap">
  60              <?php echo T_('# Articles'); ?>
  61              </th>
  62              <th width="10%">
  63              <?php echo T_('Cache time'); ?>
  64              </th>
  65          </tr>
  66          <?php
  67          $k = 0;
  68          for ($i=0, $n=count( $rows ); $i < $n; $i++) {
  69              $row = &$rows[$i];
  70  
  71              $link     = 'index2.php?option=com_newsfeeds&task=editA&hidemainmenu=1&id='. $row->id;
  72  
  73              $img     = $row->published ? 'tick.png' : 'publish_x.png';
  74              $task     = $row->published ? 'unpublish' : 'publish';
  75              $alt     = $row->published ? 'Published' : 'Unpublished';
  76  
  77              $checked     = mosCommonHTML::CheckedOutProcessing( $row, $i );
  78  
  79              $row->cat_link     = 'index2.php?option=com_categories&section=com_newsfeeds&task=editA&hidemainmenu=1&id='. $row->catid;
  80              ?>
  81              <tr class="<?php echo 'row'. $k; ?>">
  82                  <td align="center">
  83                  <?php echo $pageNav->rowNumber( $i ); ?>
  84                  </td>
  85                  <td>
  86                  <?php echo $checked; ?>
  87                  </td>
  88                  <td>
  89                  <?php
  90                  if ( $row->checked_out && ( $row->checked_out != $my->id ) ) {
  91                      ?>
  92                      <?php echo $row->name; ?>
  93                      &nbsp;[ <i><?php echo T_('Checked Out'); ?></i> ]
  94                      <?php
  95                  } else {
  96                      ?>
  97                      <a href="<?php echo $link; ?>" title="<?php echo T_('Edit News Feed'); ?>">
  98                      <?php echo $row->name; ?>
  99                      </a>
 100                      <?php
 101                  }
 102                  ?>
 103                  </td>
 104                  <td width="10%" align="center">
 105                  <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
 106                  <img src="images/<?php echo $img;?>" border="0" alt="<?php echo $alt; ?>" />
 107                  </a>
 108                  </td>
 109                  <td align="center">
 110                  <?php echo $pageNav->orderUpIcon( $i ); ?>
 111                  </td>
 112                  <td align="center">
 113                  <?php echo $pageNav->orderDownIcon( $i, $n ); ?>
 114                  </td>
 115                  <td>
 116                  <a href="<?php echo $row->cat_link; ?>" title="<?php echo T_('Edit Category'); ?>">
 117                  <?php echo $row->catname;?>
 118                  </a>
 119                  </td>
 120                  <td align="center">
 121                  <?php echo $row->numarticles;?>
 122                  </td>
 123                  <td align="center">
 124                  <?php echo $row->cache_time;?>
 125                  </td>
 126              </tr>
 127              <?php
 128              $k = 1 - $k;
 129          }
 130          ?>
 131          </table>
 132          <?php echo $pageNav->getListFooter(); ?>
 133  
 134          <input type="hidden" name="option" value="<?php echo $option;?>" />
 135          <input type="hidden" name="task" value="" />
 136          <input type="hidden" name="boxchecked" value="0" />
 137          <input type="hidden" name="hidemainmenu" value="0">
 138          </form>
 139          <?php
 140      }
 141  
 142  
 143  	function editNewsFeed( &$row, &$lists, $option ) {
 144          mosMakeHtmlSafe( $row, ENT_QUOTES );
 145          ?>
 146          <script type="text/javascript">
 147  		function submitbutton(pressbutton) {
 148              var form = document.adminForm;
 149              if (pressbutton == 'cancel') {
 150                  submitform( pressbutton );
 151                  return;
 152              }
 153  
 154              // do field validation
 155              if (form.name.value == '') {
 156                  alert( "<?php echo T_('Please fill in the news feed name.'); ?>" );
 157              } else if (form.catid.value == 0) {
 158                  alert( "<?php echo T_('Please select a Category.'); ?>" );
 159              } else if (form.link.value == '') {
 160                  alert( "<?php echo T_('Please fill in the news feed link.'); ?>" );
 161              } else if (getSelectedValue('adminForm','catid') < 0) {
 162                  alert( "<?php echo T_('Please select a category.'); ?>" );
 163              } else if (form.numarticles.value == "" || form.numarticles.value == 0) {
 164                  alert( "<?php echo T_('Please fill in the number of articles to display.'); ?>" );
 165              } else if (form.cache_time.value == "" || form.cache_time.value == 0) {
 166                  alert( "<?php echo T_('Please fill in the cache refresh time.'); ?>" );
 167              } else {
 168                  submitform( pressbutton );
 169              }
 170          }
 171          </script>
 172  
 173          <form action="index2.php" method="post" name="adminForm">
 174          <table class="adminheading">
 175          <tr>
 176              <th class="edit">
 177              <?php echo T_('News Feed:'); ?> <small><?php echo $row->id ? T_('Edit') : T_('New');?></small> <small><small>[ <?php echo $row->name;?> ]</small></small>
 178              </th>
 179          </tr>
 180          </table>
 181  
 182          <table class="adminform">
 183          <tr>
 184              <th colspan="2">
 185              <?php echo T_('Details'); ?>
 186              </th>
 187          </tr>
 188          <tr>
 189              <td>
 190              <?php echo T_('Name'); ?>
 191              </td>
 192              <td>
 193              <input class="inputbox" type="text" size="40" name="name" value="<?php echo $row->name; ?>">
 194              </td>
 195          </tr>
 196          <tr>
 197              <td>
 198              <?php echo T_('Category'); ?>
 199              </td>
 200              <td>
 201              <?php echo $lists['category']; ?>
 202              </td>
 203          </tr>
 204          <tr>
 205              <td>
 206              <?php echo T_('Link'); ?>
 207              </td>
 208              <td>
 209              <input class="inputbox" type="text" size="60" name="link" value="<?php echo $row->link; ?>">
 210              </td>
 211          </tr>
 212          <tr>
 213              <td>
 214              <?php echo T_('Number of Articles'); ?>
 215              </td>
 216              <td>
 217              <input class="inputbox" type="text" size="2" name="numarticles" value="<?php echo $row->numarticles; ?>">
 218              </td>
 219          </tr>
 220          <tr>
 221              <td>
 222              <?php echo T_('Cache time (in seconds)'); ?>
 223              </td>
 224              <td>
 225              <input class="inputbox" type="text" size="4" name="cache_time" value="<?php echo $row->cache_time; ?>">
 226              </td>
 227          </tr>
 228          <tr>
 229              <td>
 230              <?php echo T_('Ordering'); ?>
 231              </td>
 232              <td>
 233              <?php echo $lists['ordering']; ?>
 234              </td>
 235          </tr>
 236          <tr>
 237              <td valign="top" align="right">
 238              <?php echo T_('Published:'); ?>
 239              </td>
 240              <td>
 241              <?php echo $lists['published']; ?>
 242              </td>
 243          </tr>
 244          <tr>
 245              <td colspan="2" align="center">
 246              </td>
 247          </tr>
 248          </table>
 249  
 250          <input type="hidden" name="id" value="<?php echo $row->id; ?>">
 251          <input type="hidden" name="option" value="<?php echo $option; ?>">
 252          <input type="hidden" name="task" value="">
 253          </form>
 254      <?php
 255      }
 256  }
 257  ?>