[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_modules/ -> admin.modules.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Modules
   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_modules {
  21  
  22      /**
  23      * Writes a list of the defined modules
  24      * @param array An array of category objects
  25      */
  26  	function showModules( &$rows, $myid, $client, &$pageNav, $option, &$lists, $search ) {
  27          global $my;
  28  
  29          mosCommonHTML::loadOverlib();
  30          ?>
  31          <form action="index2.php" method="post" name="adminForm">
  32  
  33          <table class="adminheading">
  34          <tr>
  35              <th class="modules" rowspan="2">
  36              <?php echo T_('Module Manager'); ?> <small><small>[ <?php echo $client == 'admin' ? T_('Administrator') : T_('Site');?> ]</small></small>
  37              </th>
  38              <td width="right">
  39              <?php echo $lists['position'];?>
  40              </td>
  41              <td width="right">
  42              <?php echo $lists['type'];?>
  43              </td>
  44          </tr>
  45          <tr>
  46              <td align="right">
  47              <?php echo T_('Filter:'); ?>
  48              </td>
  49              <td>
  50              <input type="text" name="search" value="<?php echo $search;?>" class="text_area" onChange="document.adminForm.submit();" />
  51              </td>
  52          </tr>
  53          </table>
  54  
  55          <table class="adminlist">
  56          <tr>
  57              <th width="20px">#</th>
  58              <th width="20px">
  59              <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows );?>);" />
  60              </th>
  61              <th class="title">
  62              <?php echo T_('Module Name'); ?>
  63              </th>
  64              <th nowrap="nowrap" width="10%">
  65              <?php echo T_('Published'); ?>
  66              </th>
  67              <th colspan="2" align="center" width="5%">
  68              <?php echo T_('Reorder'); ?>
  69              </th>
  70              <th width="2%">
  71              <?php echo T_('Order'); ?>
  72              </th>
  73              <th width="1%">
  74              <a href="javascript: saveorder( <?php echo count( $rows )-1; ?> )"><img src="images/filesave.png" border="0" width="16" height="16" alt="<?php echo T_('Save Order'); ?>" /></a>
  75              </th>
  76              <?php
  77              if ( !$client ) {
  78                  ?>
  79                  <th nowrap="nowrap" width="7%">
  80                  <?php echo T_('Access'); ?>
  81                  </th>
  82                  <?php
  83              }
  84              ?>
  85              <th nowrap="nowrap" width="7%">
  86              <?php echo T_('Position'); ?>
  87              </th>
  88              <th nowrap="nowrap" width="5%">
  89              <?php echo T_('Pages'); ?>
  90              </th>
  91              <th nowrap="nowrap" width="5%">
  92              <?php echo T_('ID'); ?>
  93              </th>
  94              <th nowrap="nowrap" width="10%" align="left">
  95              <?php echo T_('Type'); ?>
  96              </th>
  97          </tr>
  98          <?php
  99          $k = 0;
 100          for ($i=0, $n=count( $rows ); $i < $n; $i++) {
 101              $row     = &$rows[$i];
 102  
 103              $link = 'index2.php?option=com_modules&client='. $client .'&task=editA&hidemainmenu=1&id='. $row->id;
 104  
 105              $access     = mosCommonHTML::AccessProcessing( $row, $i );
 106              $checked     = mosCommonHTML::CheckedOutProcessing( $row, $i );
 107              $published     = mosCommonHTML::PublishedProcessing( $row, $i );
 108              ?>
 109              <tr class="<?php echo "row$k"; ?>">
 110                  <td align="right">
 111                  <?php echo $pageNav->rowNumber( $i ); ?>
 112                  </td>
 113                  <td>
 114                  <?php echo $checked; ?>
 115                  </td>
 116                  <td>
 117                  <?php
 118                  if ( $row->checked_out && ( $row->checked_out != $my->id ) ) {
 119                      echo $row->title;
 120                  } else {
 121                      ?>
 122                      <a href="<?php echo $link; ?>">
 123                      <?php echo $row->title; ?>
 124                      </a>
 125                      <?php
 126                  }
 127                  ?>
 128                  </td>
 129                  <td align="center">
 130                  <?php echo $published;?>
 131                  </td>
 132                  <td>
 133                  <?php echo $pageNav->orderUpIcon( $i, ($row->position == @$rows[$i-1]->position) ); ?>
 134                  </td>
 135                  <td>
 136                  <?php echo $pageNav->orderDownIcon( $i, $n, ($row->position == @$rows[$i+1]->position) ); ?>
 137                  </td>
 138                  <td align="center" colspan="2">
 139                  <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" class="text_area" style="text-align: center" />
 140                  </td>
 141                  <?php
 142                  if ( !$client ) {
 143                      ?>
 144                      <td align="center">
 145                      <?php echo $access;?>
 146                      </td>
 147                      <?php
 148                  }
 149                  ?>
 150                  <td align="center">
 151                  <?php echo $row->position; ?>
 152                  </td>
 153                  <td align="center">
 154                  <?php
 155                  if (is_null( $row->pages )) {
 156                      echo T_('None');
 157                  } else if ($row->pages > 0) {
 158                      echo T_('Varies');
 159                  } else {
 160                      echo T_('All');
 161                  }
 162                  ?>
 163                  </td>
 164                  <td align="center">
 165                  <?php echo $row->id;?>
 166                  </td>
 167                  <td align="left">
 168                  <?php echo $row->module ? $row->module : T_("User");?>
 169                  </td>
 170              </tr>
 171              <?php
 172              $k = 1 - $k;
 173          }
 174          ?>
 175          </table>
 176  
 177          <?php echo $pageNav->getListFooter(); ?>
 178  
 179          <input type="hidden" name="option" value="<?php echo $option;?>" />
 180          <input type="hidden" name="task" value="" />
 181          <input type="hidden" name="client" value="<?php echo $client;?>" />
 182          <input type="hidden" name="boxchecked" value="0" />
 183          <input type="hidden" name="hidemainmenu" value="0" />
 184          </form>
 185          <?php
 186      }
 187  
 188      /**
 189      * Writes the edit form for new and existing module
 190      *
 191      * A new record is defined when <var>$row</var> is passed with the <var>id</var>
 192      * property set to 0.
 193      * @param mosCategory The category object
 194      * @param array <p>The modules of the left side.  The array elements are in the form
 195      * <var>$leftorder[<i>order</i>] = <i>label</i></var>
 196      * where <i>order</i> is the module order from the db table and <i>label</i> is a
 197      * text label associciated with the order.</p>
 198      * @param array See notes for leftorder
 199      * @param array An array of select lists
 200      * @param object Parameters
 201      */
 202  	function editModule( &$row, &$orders2, &$lists, &$params, $option ) {
 203          global $mosConfig_live_site;
 204  
 205          $row->titleA = '';
 206          if ( $row->id ) {
 207              $row->titleA = '<small><small>[ '. $row->title .' ]</small></small>';
 208          }
 209  
 210          mosCommonHTML::loadOverlib();
 211          ?>
 212          <script type="text/javascript">
 213  		function submitbutton(pressbutton) {
 214              if ( pressbutton == 'save' ) {
 215                  if ( document.adminForm.title.value == "" ) {
 216                      alert("<?php echo T_('Module must have a title'); ?>");
 217                      return;
 218                  } else if ( (document.adminForm.access.value == 2) && (document.adminForm.elements['groups[]'].selectedIndex < 0) ) {
 219                          alert("<?php echo T_('Special Access groups required for access level Special'); ?>");
 220                          return;
 221                  }
 222              } else {
 223                  <?php if ($row->module == "") {
 224                      getEditorContents( 'editor1', 'content' );
 225                  }?>
 226                  submitform(pressbutton);
 227              }
 228              submitform(pressbutton);
 229          }
 230          <!--
 231          var originalOrder = '<?php echo $row->ordering;?>';
 232          var originalPos = '<?php echo $row->position;?>';
 233          var orders = new Array();    // array in the format [key,value,text]
 234          <?php    $i = 0;
 235          foreach ($orders2 as $k=>$items) {
 236              foreach ($items as $v) {
 237                  echo "\n    orders[".$i++."] = new Array( \"$k\",\"$v->value\",\"$v->text\" );";
 238              }
 239          }
 240          ?>
 241          //-->
 242          </script>
 243          <table class="adminheading">
 244          <tr>
 245              <th class="modules">
 246              <?php echo $lists['client_id'] ? T_('Administrator') : T_('Site');?>
 247              <?php echo T_('Module:'); ?>
 248              <small>
 249              <?php echo $row->id ? T_('Edit') : T_('New');?>
 250              </small>
 251              <?php echo $row->titleA; ?>
 252              </th>
 253          </tr>
 254          </table>
 255  
 256          <form action="index2.php" method="post" name="adminForm">
 257  
 258          <table cellspacing="0" cellpadding="0" width="100%">
 259          <tr valign="top">
 260              <td width="60%">
 261                  <table class="adminform">
 262                  <tr>
 263                      <th colspan="2">
 264                      <?php echo T_('Details'); ?>
 265                      </th>
 266                  </tr>
 267                  <tr>
 268                      <td width="100" align="left">
 269                      <?php echo T_('Title:'); ?>
 270                      </td>
 271                      <td>
 272                      <input class="text_area" type="text" name="title" size="35" value="<?php echo $row->title; ?>" />
 273                      </td>
 274                  </tr>
 275                  <!-- START selectable pages -->
 276                  <tr>
 277                      <td width="100" align="left">
 278                      <?php echo T_('Show title:'); ?>
 279                      </td>
 280                      <td>
 281                      <?php echo $lists['showtitle']; ?>
 282                      </td>
 283                  </tr>
 284                  <tr>
 285                      <td valign="top" align="left">
 286                      <?php echo T_('Position:'); ?>
 287                      </td>
 288                      <td>
 289                      <?php echo $lists['position']; ?>
 290                      </td>
 291                  </tr>
 292                  <tr>
 293                      <td valign="top" align="left">
 294                      <?php echo T_('Module Order:'); ?>
 295                      </td>
 296                      <td>
 297                      <script type="text/javascript">
 298                      <!--
 299                      writeDynaList( 'class="inputbox" name="ordering" size="1"', orders, originalPos, originalPos, originalOrder );
 300                      //-->
 301                      </script>
 302                      </td>
 303                  </tr>
 304                  <tr>
 305                      <td valign="top" align="left">
 306                      <?php echo T_('Access Level:'); ?>
 307                      </td>
 308                      <td>
 309                      <?php echo $lists['access']; ?>
 310                      </td>
 311                  </tr>
 312                  <tr>
 313                      <td valign="top" align="left">
 314                      <?php echo T_('Special Access:'); ?>
 315                      </td>
 316                      <td>
 317                      <?php echo $lists['groups']."&nbsp;".mosToolTip(T_('Special Access Groups'), T_('If Access Level is Special, only the selected groups will have access to the module')); ?>
 318                      </td>
 319                  </tr>
 320                  <tr>
 321                      <td valign="top">
 322                      <?php echo T_('Published:'); ?>
 323                      </td>
 324                      <td>
 325                      <?php echo $lists['published']; ?>
 326                      </td>
 327                  </tr>
 328                  <tr>
 329                      <td colspan="2">
 330                      </td>
 331                  </tr>
 332                  <tr>
 333                      <td valign="top">
 334                      <?php echo T_('ID:'); ?>
 335                      </td>
 336                      <td>
 337                      <?php echo $row->id; ?>
 338                      </td>
 339                  </tr>
 340                  <tr>
 341                      <td valign="top">
 342                      <?php echo T_('Description:'); ?>
 343                      </td>
 344                      <td>
 345                      <?php echo $row->description; ?>
 346                      </td>
 347                  </tr>
 348                  </table>
 349  
 350                  <table class="adminform">
 351                  <tr>
 352                      <th >
 353                      <?php echo T_('Parameters'); ?>
 354                      </th>
 355                  </tr>
 356                  <tr>
 357                      <td>
 358                      <?php echo $params->render();?>
 359                      </td>
 360                  </tr>
 361                  </table>
 362              </td>
 363              <td width="40%" >
 364                  <table width="100%" class="adminform">
 365                  <tr>
 366                      <th>
 367                      <?php echo T_('Pages / Items'); ?>
 368                      </th>
 369                  </tr>
 370                  <tr>
 371                      <td>
 372                      <?php echo T_('Menu Item Link(s):'); ?>
 373                      <br />
 374                      <?php echo $lists['selections']; ?>
 375                      </td>
 376                  </tr>
 377                  </table>
 378              </td>
 379          </tr>
 380          <?php
 381          if ($row->module == "") {
 382              ?>
 383              <tr>
 384                  <td colspan="2">
 385                          <table width="100%" class="adminform">
 386                          <tr>
 387                              <th colspan="2">
 388                              <?php echo T_('Custom Output'); ?>
 389                              </th>
 390                          </tr>
 391                          <tr>
 392                              <td valign="top" align="left">
 393                              <?php echo T_('Content:'); ?>
 394                              </td>
 395                              <td>
 396                              <?php
 397                              // parameters : areaname, content, hidden field, width, height, rows, cols
 398                              editorArea( 'editor1',  $row->content , 'content', '700', '350', '95', '30' ) ; ?>
 399                              </td>
 400                          </tr>
 401                          </table>
 402                  </td>
 403              </tr>
 404              <?php
 405          }
 406          ?>
 407          </table>
 408  
 409          <input type="hidden" name="option" value="<?php echo $option; ?>" />
 410          <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
 411          <input type="hidden" name="original" value="<?php echo $row->ordering; ?>" />
 412          <input type="hidden" name="module" value="<?php echo $row->module; ?>" />
 413          <input type="hidden" name="task" value="" />
 414          <input type="hidden" name="client_id" value="<?php echo $lists['client_id']; ?>" />
 415          <?php
 416          if ( $row->client_id || $lists['client_id'] ) {
 417              echo '<input type="hidden" name="client" value="admin" />';
 418          }
 419          ?>
 420          </form>
 421          <?php
 422      }
 423  
 424  }
 425  ?>