[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_weblinks/ -> admin.weblinks.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Weblinks
   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_weblinks {
  21  
  22  	function showWeblinks( $option, &$rows, &$lists, &$search, &$pageNav ) {
  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_('Web Link Manager'); ?>
  32              </th>
  33              <td>
  34              <?php echo T_('Filter:'); ?>
  35              </td>
  36              <td>
  37              <input type="text" name="search" value="<?php echo $search;?>" class="text_area" onChange="document.adminForm.submit();" />
  38              </td>
  39              <td width="right">
  40              <?php echo $lists['catid'];?>
  41              </td>
  42          </tr>
  43          </table>
  44  
  45          <table class="adminlist">
  46          <tr>
  47              <th width="5">
  48              #
  49              </th>
  50              <th width="20">
  51              <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
  52              </th>
  53              <th class="title">
  54              <?php echo T_('Title'); ?>
  55              </th>
  56              <th width="5%">
  57              <?php echo T_('Published'); ?>
  58              </th>
  59              <th width="5%">
  60              <?php echo T_('Approved'); ?>
  61              </th>
  62              <th colspan="2" width="5%">
  63              <?php echo T_('Reorder'); ?>
  64              </th>
  65              <th width="25%" align="left">
  66              <?php echo T_('Category'); ?>
  67              </th>
  68              <th width="5%">
  69              <?php echo T_('Hits'); ?>
  70              </th>
  71          </tr>
  72          <?php
  73          $k = 0;
  74          for ($i=0, $n=count( $rows ); $i < $n; $i++) {
  75              $row = &$rows[$i];
  76  
  77              $link     = 'index2.php?option=com_weblinks&task=editA&hidemainmenu=1&id='. $row->id;
  78  
  79              $task     = $row->published ? 'unpublish' : 'publish';
  80              $img     = $row->published ? 'publish_g.png' : 'publish_x.png';
  81              $alt     = $row->published ? 'Published' : 'Unpublished';
  82  
  83              $checked     = mosCommonHTML::CheckedOutProcessing( $row, $i );
  84  
  85              $row->cat_link     = 'index2.php?option=com_categories&section=com_weblinks&task=editA&hidemainmenu=1&id='. $row->catid;
  86              ?>
  87              <tr class="<?php echo "row$k"; ?>">
  88                  <td>
  89                  <?php echo $pageNav->rowNumber( $i ); ?>
  90                  </td>
  91                  <td>
  92                  <?php echo $checked; ?>
  93                  </td>
  94                  <td>
  95                  <?php
  96                  if ( $row->checked_out && ( $row->checked_out != $my->id ) ) {
  97                      echo stripslashes($row->title);
  98                  } else {
  99                      ?>
 100                      <a href="<?php echo $link; ?>" title="<?php echo T_('Edit Weblinks'); ?>">
 101                      <?php echo stripslashes($row->title); ?>
 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                  <?php
 113                  if ( $row->approved ) {
 114                      ?>
 115                      <td align="center">
 116                      <img src="images/tick.png">
 117                      </td>
 118                      <?php
 119                  } else {
 120                      ?>
 121                      <td align="center">
 122                      </td>
 123                      <?php
 124                  }
 125                  ?>
 126                  <td>
 127                  <?php echo $pageNav->orderUpIcon( $i, ($row->catid == @$rows[$i-1]->catid) ); ?>
 128                  </td>
 129                    <td>
 130                  <?php echo $pageNav->orderDownIcon( $i, $n, ($row->catid == @$rows[$i+1]->catid) ); ?>
 131                  </td>
 132                  <td>
 133                  <a href="<?php echo $row->cat_link; ?>" title="<?php echo T_('Edit Category'); ?>">
 134                  <?php echo $row->category; ?>
 135                  </a>
 136                  </td>
 137                  <td align="center">
 138                  <?php echo $row->hits; ?>
 139                  </td>
 140              </tr>
 141              <?php
 142              $k = 1 - $k;
 143          }
 144          ?>
 145          </table>
 146          <?php echo $pageNav->getListFooter(); ?>
 147          <input type="hidden" name="option" value="<?php echo $option;?>" />
 148          <input type="hidden" name="task" value="" />
 149          <input type="hidden" name="boxchecked" value="0" />
 150          <input type="hidden" name="hidemainmenu" value="0">
 151          </form>
 152          <?php
 153      }
 154  
 155      /**
 156      * Writes the edit form for new and existing record
 157      *
 158      * A new record is defined when <var>$row</var> is passed with the <var>id</var>
 159      * property set to 0.
 160      * @param mosWeblink The weblink object
 161      * @param array An array of select lists
 162      * @param object Parameters
 163      * @param string The option
 164      */
 165  	function editWeblink( &$row, &$lists, &$params, $option ) {
 166          mosMakeHtmlSafe( $row, ENT_QUOTES, 'description' );
 167          ?>
 168          <script type="text/javascript">
 169  		function submitbutton(pressbutton) {
 170              var form = document.adminForm;
 171              if (pressbutton == 'cancel') {
 172                  submitform( pressbutton );
 173                  return;
 174              }
 175  
 176              // do field validation
 177              if (form.title.value == ""){
 178                  alert( "<?php echo T_('Weblink item must have a title'); ?>" );
 179              } else if (form.catid.value == "0"){
 180                  alert( "<?php echo T_('You must select a category.'); ?>" );
 181              } else if (form.url.value == ""){
 182                  alert( "<?php echo T_('You must have a url.'); ?>" );
 183              } else {
 184                  submitform( pressbutton );
 185              }
 186          }
 187          </script>
 188          <form action="index2.php" method="post" name="adminForm" id="adminForm">
 189          <table class="adminheading">
 190          <tr>
 191              <th>
 192              <?php echo T_('Web Link:'); ?>
 193              <small>
 194              <?php echo $row->id ? T_('Edit') : T_('New');?>
 195              </small>
 196              </th>
 197          </tr>
 198          </table>
 199  
 200          <table width="100%">
 201          <tr>
 202              <td width="60%" valign="top">
 203                  <table class="adminform">
 204                  <tr>
 205                      <th colspan="2">
 206                      <?php echo T_('Details'); ?>
 207                      </th>
 208                  </tr>
 209                  <tr>
 210                      <td width="20%" align="right">
 211                      <?php echo T_('Name:'); ?>
 212                      </td>
 213                      <td width="80%">
 214                      <input class="text_area" type="text" name="title" size="50" maxlength="250" value="<?php echo stripslashes($row->title);?>" />
 215                      </td>
 216                  </tr>
 217                  <tr>
 218                      <td valign="top" align="right">
 219                      <?php echo T_('Category:'); ?>
 220                      </td>
 221                      <td>
 222                      <?php echo $lists['catid']; ?>
 223                      </td>
 224                  </tr>
 225                  <tr>
 226                      <td valign="top" align="right">
 227                      <?php echo T_('URL:'); ?>
 228                      </td>
 229                      <td>
 230                      <input class="text_area" type="text" name="url" value="<?php echo $row->url; ?>" size="50" maxlength="250" />
 231                      </td>
 232                  </tr>
 233                  <tr>
 234                      <td valign="top" align="right">
 235                      <?php echo T_('Description:'); ?>
 236                      </td>
 237                      <td>
 238                      <textarea class="text_area" cols="50" rows="5" name="description" style="width:500px" width="500"><?php echo $row->description; ?></textarea>
 239                      </td>
 240                  </tr>
 241  
 242                  <tr>
 243                      <td valign="top" align="right">
 244                      <?php echo T_('Ordering:'); ?>
 245                      </td>
 246                      <td>
 247                      <?php echo $lists['ordering']; ?>
 248                      </td>
 249                  </tr>
 250                  <tr>
 251                      <td valign="top" align="right">
 252                      <?php echo T_('Approved:'); ?>
 253                      </td>
 254                      <td>
 255                      <?php echo $lists['approved']; ?>
 256                      </td>
 257                  </tr>
 258                  <tr>
 259                      <td valign="top" align="right">
 260                      <?php echo T_('Published:'); ?>
 261                      </td>
 262                      <td>
 263                      <?php echo $lists['published']; ?>
 264                      </td>
 265                  </tr>
 266                  </table>
 267              </td>
 268              <td width="40%" valign="top">
 269                  <table class="adminform">
 270                  <tr>
 271                      <th colspan="1">
 272                      <?php echo T_('Parameters'); ?>
 273                      </th>
 274                  </tr>
 275                  <tr>
 276                      <td>
 277                      <?php echo $params->render();?>
 278                      </td>
 279                  </tr>
 280                  </table>
 281              </td>
 282          </tr>
 283          </table>
 284  
 285          <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
 286          <input type="hidden" name="option" value="<?php echo $option;?>" />
 287          <input type="hidden" name="task" value="" />
 288          </form>
 289          <script type="text/javascript" src="<?php echo mamboCore::get('mosConfig_live_site');?>/includes/js/tooltip/tooltip.js"></script>
 290          <?php
 291      }
 292  }
 293  ?>