[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_categories/ -> admin.categories.html.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: admin.categories.html.php 17299 2010-05-27 16:06:54Z ian $
   4   * @package        Joomla
   5   * @subpackage    Categories
   6   * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant
   9   * to the GNU General Public License, and as distributed it includes or
  10   * is derivative of works licensed under the GNU General Public License or
  11   * other free or open source software licenses.
  12   * See COPYRIGHT.php for copyright notices and details.
  13   */
  14  
  15  // no direct access
  16  defined( '_JEXEC' ) or die( 'Restricted access' );
  17  
  18  /**
  19  * @package        Joomla
  20  * @subpackage    Categories
  21  */
  22  class categories_html
  23  {
  24  
  25      /**
  26      * Writes a list of the categories for a section
  27      * @param array An array of category objects
  28      * @param string The name of the category section
  29      */
  30  	function show( &$rows, $section, $section_name, &$page, &$lists, $type )
  31      {
  32          $limitstart = JRequest::getVar('limitstart', '0', '', 'int');
  33          $user =& JFactory::getUser();
  34  
  35          //Ordering allowed ?
  36          $ordering = ($lists['order'] == 'c.ordering');
  37  
  38          JHTML::_('behavior.tooltip');
  39          ?>
  40          <form action="index.php?option=com_categories&amp;section=<?php echo $section; ?>" method="post" name="adminForm">
  41  
  42          <table>
  43              <tr>
  44                  <td align="left" width="100%">
  45                      <?php echo JText::_( 'Filter' ); ?>:
  46                      <input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
  47                      <button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
  48                      <button onclick="document.getElementById('search').value='';this.form.getElementById('sectionid').value='-1';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
  49                  </td>
  50                  <td nowrap="nowrap">
  51                      <?php
  52                      if ( $section == 'com_content') {
  53                          echo $lists['sectionid'];
  54                      }
  55                      ?>
  56                      <?php
  57                      echo $lists['state'];
  58                      ?>
  59                  </td>
  60              </tr>
  61          </table>
  62  
  63          <table class="adminlist">
  64          <thead>
  65              <tr>
  66                  <th width="10" align="left">
  67                      <?php echo JText::_( 'Num' ); ?>
  68                  </th>
  69                  <th width="20">
  70                      <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows );?>);" />
  71                  </th>
  72                  <th class="title">
  73                      <?php echo JHTML::_('grid.sort',   'Title', 'c.title', @$lists['order_Dir'], @$lists['order'] ); ?>
  74                  </th>
  75                  <th width="5%">
  76                      <?php echo JHTML::_('grid.sort',   'Published', 'c.published', @$lists['order_Dir'], @$lists['order'] ); ?>
  77                  </th>
  78                  <th width="8%" nowrap="nowrap">
  79                      <?php echo JHTML::_('grid.sort',   'Order by', 'c.ordering', @$lists['order_Dir'], @$lists['order'] ); ?>
  80                      <?php if ($ordering) echo JHTML::_('grid.order',  $rows ); ?>
  81                  </th>
  82                  <th width="7%">
  83                      <?php echo JHTML::_('grid.sort',   'Access', 'groupname', @$lists['order_Dir'], @$lists['order'] ); ?>
  84                  </th>
  85                  <?php
  86                  if ( $section == 'com_content') {
  87                      ?>
  88                      <th width="20%"  class="title">
  89                          <?php echo JHTML::_('grid.sort',   'Section', 'section_name', @$lists['order_Dir'], @$lists['order'] ); ?>
  90                      </th>
  91                      <?php
  92                  }
  93                  ?>
  94                  <?php
  95                  if ( $type == 'content') {
  96                      ?>
  97                      <th width="5%">
  98                          <?php echo JText::_( 'Num Active' ); ?>
  99                      </th>
 100                      <th width="5%">
 101                          <?php echo JText::_( 'Num Trash' ); ?>
 102                      </th>
 103                      <?php
 104                  }
 105                  ?>
 106                  <th width="1%" nowrap="nowrap">
 107                      <?php echo JHTML::_('grid.sort',   'ID', 'c.id', @$lists['order_Dir'], @$lists['order'] ); ?>
 108                  </th>
 109              </tr>
 110          </thead>
 111          <tfoot>
 112          <tr>
 113              <td colspan="13">
 114                  <?php echo $page->getListFooter(); ?>
 115              </td>
 116          </tr>
 117          </tfoot>
 118          <tbody>
 119          <?php
 120          $k = 0;
 121          if( count( $rows ) ) {
 122          for ($i=0, $n=count( $rows ); $i < $n; $i++) {
 123              $row     = &$rows[$i];
 124  
 125              JFilterOutput::objectHtmlSafe($row);
 126  
 127              $row->sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->section );
 128  
 129              $link = 'index.php?option=com_categories&section='. $section .'&task=edit&cid[]='. $row->id .'&type='.$type;
 130  
 131              $access     = JHTML::_('grid.access',   $row, $i );
 132              $checked     = JHTML::_('grid.checkedout',   $row, $i );
 133              $published     = JHTML::_('grid.published', $row, $i );
 134              ?>
 135              <tr class="<?php echo "row$k"; ?>">
 136                  <td>
 137                      <?php echo $page->getRowOffset( $i ); ?>
 138                  </td>
 139                  <td>
 140                      <?php echo $checked; ?>
 141                  </td>
 142                  <td>
 143                      <span class="editlinktip hasTip" title="<?php echo JText::_( 'Title' );?>::<?php echo $row->title; ?>">
 144                      <?php
 145                      if (  JTable::isCheckedOut($user->get ('id'), $row->checked_out )  ) {
 146                          echo $row->title;
 147                      } else {
 148                          ?>
 149                          <a href="<?php echo JRoute::_( $link ); ?>">
 150                              <?php echo $row->title; ?></a>
 151                          <?php
 152                      }
 153                      ?></span>
 154                  </td>
 155                  <td align="center">
 156                      <?php echo $published;?>
 157                  </td>
 158                  <td class="order">
 159                      <span><?php echo $page->orderUpIcon( $i, ($row->section == @$rows[$i-1]->section), 'orderup', 'Move Up', $ordering ); ?></span>
 160                      <span><?php echo $page->orderDownIcon( $i, $n, ($row->section == @$rows[$i+1]->section), 'orderdown', 'Move Down', $ordering ); ?></span>
 161                      <?php $disabled = $ordering ?  '' : 'disabled="disabled"'; ?>
 162                      <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo $disabled ?> class="text_area" style="text-align: center" />
 163                  </td>
 164                  <td align="center">
 165                      <?php echo $access;?>
 166                  </td>
 167                  <?php
 168                  if ( $section == 'com_content' ) {
 169                      ?>
 170                      <td>
 171                          <a href="<?php echo $row->sect_link; ?>" title="<?php echo JText::_( 'Edit Section' ); ?>">
 172                              <?php echo $row->section_name; ?></a>
 173                      </td>
 174                      <?php
 175                  }
 176                  ?>
 177                  <?php
 178                  if ( $type == 'content') {
 179                      ?>
 180                      <td align="center">
 181                          <?php echo $row->active; ?>
 182                      </td>
 183                      <td align="center">
 184                          <?php echo $row->trash; ?>
 185                      </td>
 186                      <?php
 187                  }
 188                  $k = 1 - $k;
 189                  ?>
 190                  <td align="center">
 191                      <?php echo $row->id; ?>
 192                  </td>
 193              </tr>
 194              <?php
 195          }
 196          } else {
 197              if( $type == 'content') {
 198                  ?>
 199                  <tr><td colspan="10"><?php echo JText::_('There are no Categories'); ?></td></tr>
 200                  <?php
 201              } else {
 202                  ?>
 203                  <tr><td colspan="8"><?php echo JText::_('There are no Categories'); ?></td></tr>
 204                  <?php
 205              }
 206          }
 207          ?>
 208          </tbody>
 209          </table>
 210  
 211          <input type="hidden" name="option" value="com_categories" />
 212          <input type="hidden" name="section" value="<?php echo $section;?>" />
 213          <input type="hidden" name="task" value="" />
 214          <input type="hidden" name="chosen" value="" />
 215          <input type="hidden" name="act" value="" />
 216          <input type="hidden" name="boxchecked" value="0" />
 217          <input type="hidden" name="type" value="<?php echo $type; ?>" />
 218          <input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?>" />
 219          <input type="hidden" name="filter_order_Dir" value="<?php echo $lists['order_Dir']; ?>" />
 220          <?php echo JHTML::_( 'form.token' ); ?>
 221          </form>
 222          <?php
 223      }
 224  
 225      /**
 226      * Writes the edit form for new and existing categories
 227      * @param JTableCategory The category object
 228      * @param string
 229      * @param array
 230      */
 231  	function edit( &$row, &$lists, $redirect )
 232      {
 233          JRequest::setVar( 'hidemainmenu', 1 );
 234  
 235          $editor =& JFactory::getEditor();
 236  
 237          if ($row->image == '') {
 238              $row->image = 'blank.png';
 239          }
 240  
 241          if ( $redirect == 'content' ) {
 242              $component = 'Content';
 243          } else {
 244              $component = ucfirst( substr( $redirect, 4 ) );
 245              if ( $redirect == 'com_contact_details' ) {
 246                  $component = 'Contact';
 247              }
 248          }
 249  
 250          JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'description' );
 251          $cparams = JComponentHelper::getParams ('com_media');
 252          ?>
 253          <script language="javascript" type="text/javascript">
 254  		function submitbutton(pressbutton, section) {
 255              var form = document.adminForm;
 256              if (pressbutton == 'cancel') {
 257                  submitform( pressbutton );
 258                  return;
 259              }
 260  
 261              if ( pressbutton == 'menulink' ) {
 262                  if ( form.menuselect.value == "" ) {
 263                      alert( "<?php echo JText::_( 'Please select a Menu', true ); ?>" );
 264                      return;
 265                  } else if ( form.link_type.value == "" ) {
 266                      alert( "<?php echo JText::_( 'Please select a menu type', true ); ?>" );
 267                      return;
 268                  } else if ( form.link_name.value == "" ) {
 269                      alert( "<?php echo JText::_( 'Please enter a Name for this menu item', true ); ?>" );
 270                      return;
 271                  }
 272              }
 273  
 274              if ( form.title.value == "" ) {
 275                  alert("<?php echo JText::_( 'Category must have a title', true ); ?>");
 276              } else {
 277                  <?php
 278                  echo $editor->save( 'description' ) ; ?>
 279                  submitform(pressbutton);
 280              }
 281          }
 282          </script>
 283  
 284          <form action="index.php" method="post" name="adminForm">
 285  
 286          <div class="col width-60">
 287              <fieldset class="adminform">
 288                  <legend><?php echo JText::_( 'Details' ); ?></legend>
 289  
 290                      <table class="admintable">
 291                      <tr>
 292                          <td class="key">
 293                              <label for="title" width="100">
 294                                  <?php echo JText::_( 'Title' ); ?>:
 295                              </label>
 296                          </td>
 297                          <td colspan="2">
 298                              <input class="text_area" type="text" name="title" id="title" value="<?php echo $row->title; ?>" size="50" maxlength="50" title="<?php echo JText::_( 'A long name to be displayed in headings' ); ?>" />
 299                          </td>
 300                      </tr>
 301                      <tr>
 302                          <td class="key">
 303                              <label for="alias">
 304                                  <?php echo JText::_( 'Alias' ); ?>:
 305                              </label>
 306                          </td>
 307                          <td colspan="2">
 308                              <input class="text_area" type="text" name="alias" id="alias" value="<?php echo $row->alias; ?>" size="50" maxlength="255" title="<?php echo JText::_( 'ALIASTIP' ); ?>" />
 309                          </td>
 310                      </tr>
 311                      <tr>
 312                          <td width="120" class="key">
 313                              <?php echo JText::_( 'Published' ); ?>:
 314                          </td>
 315                          <td>
 316                              <?php echo $lists['published']; ?>
 317                          </td>
 318                      </tr>
 319                      <tr>
 320                          <td class="key">
 321                              <label for="section">
 322                                  <?php echo JText::_( 'Section' ); ?>:
 323                              </label>
 324                          </td>
 325                          <td colspan="2">
 326                              <?php echo $lists['section']; ?>
 327                          </td>
 328                      </tr>
 329                      <tr>
 330                          <td class="key">
 331                              <label for="ordering">
 332                                  <?php echo JText::_( 'Ordering' ); ?>:
 333                              </label>
 334                          </td>
 335                          <td colspan="2">
 336                              <?php echo $lists['ordering']; ?>
 337                          </td>
 338                      </tr>
 339                      <tr>
 340                          <td valign="top" class="key">
 341                              <label for="access">
 342                                  <?php echo JText::_( 'Access Level' ); ?>:
 343                              </label>
 344                          </td>
 345                          <td>
 346                              <?php echo $lists['access']; ?>
 347                          </td>
 348                      </tr>
 349                      <tr>
 350                          <td class="key">
 351                              <label for="image">
 352                                  <?php echo JText::_( 'Image' ); ?>:
 353                              </label>
 354                          </td>
 355                          <td>
 356                              <?php echo $lists['image']; ?>
 357                          </td>
 358                      </tr>
 359                      <tr>
 360                          <td class="key">
 361                              <label for="image_position">
 362                                  <?php echo JText::_( 'Image Position' ); ?>:
 363                              </label>
 364                          </td>
 365                          <td>
 366                              <?php echo $lists['image_position']; ?>
 367                          </td>
 368                      </tr>
 369                      <tr>
 370                          <td>&nbsp;</td>
 371                          <td>
 372                          <script language="javascript" type="text/javascript">
 373                          if (document.forms.adminForm.image.options.value!=''){
 374                              jsimg='../<?php echo $cparams->get('image_path'); ?>/' + getSelectedValue( 'adminForm', 'image' );
 375                          } else {
 376                              jsimg='../images/M_images/blank.png';
 377                          }
 378                          document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="<?php echo JText::_( 'Preview', true ); ?>" />');
 379                          </script>
 380                          </td>
 381                      </tr>
 382  
 383                  </table>
 384              </fieldset>
 385  
 386              <fieldset class="adminform">
 387                  <legend><?php echo JText::_( 'Description' ); ?></legend>
 388  
 389                  <table class="admintable">
 390                      <tr>
 391                          <td valign="top" colspan="3">
 392                              <?php
 393                              // parameters : areaname, content, width, height, cols, rows, show xtd buttons
 394                              echo $editor->display( 'description',  htmlspecialchars($row->description, ENT_QUOTES), '550', '300', '60', '20', array('pagebreak', 'readmore') ) ;
 395                              ?>
 396                          </td>
 397                      </tr>
 398                      </table>
 399              </fieldset>
 400          </div>
 401          <div class="clr"></div>
 402  
 403          <input type="hidden" name="option" value="com_categories" />
 404          <input type="hidden" name="oldtitle" value="<?php echo $row->title ; ?>" />
 405          <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
 406          <input type="hidden" name="sectionid" value="<?php echo $row->section; ?>" />
 407          <input type="hidden" name="task" value="" />
 408          <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
 409          <?php echo JHTML::_( 'form.token' ); ?>
 410          </form>
 411          <?php
 412      }
 413  
 414      /**
 415      * Form to select Section to move Category to
 416      */
 417  	function moveCategorySelect( $option, $cid, $SectionList, $items, $sectionOld, $contents, $redirect ) {
 418          ?>
 419          <script language="javascript" type="text/javascript">
 420  		function submitbutton(pressbutton) {
 421              var form = document.adminForm;
 422              if (pressbutton == 'cancel') {
 423                  submitform( pressbutton );
 424                  return;
 425              }
 426  
 427              // do field validation
 428              if (!getSelectedValue( 'adminForm', 'sectionmove' )) {
 429                  alert( "<?php echo JText::_( 'Please select a section from the list', true ); ?>" );
 430              } else {
 431                  submitform( pressbutton );
 432              }
 433          }
 434          </script>
 435  
 436          <form action="index.php" method="post" name="adminForm">
 437  
 438          <br />
 439          <table class="adminform">
 440          <tr>
 441              <td width="3%"></td>
 442              <td  valign="top" width="30%">
 443              <strong><?php echo JText::_( 'Move to Section' ); ?>:</strong>
 444              <br />
 445              <?php echo $SectionList ?>
 446              <br /><br />
 447              </td>
 448              <td  valign="top" width="20%">
 449              <strong><?php echo JText::_( 'Categories being moved' ); ?>:</strong>
 450              <br />
 451              <?php
 452              echo "<ol>";
 453              foreach ( $items as $item ) {
 454                  echo "<li>". $item->title ."</li>";
 455              }
 456              echo "</ol>";
 457              ?>
 458              </td>
 459              <td valign="top" width="20%">
 460              <strong><?php echo JText::_( 'Articles being moved' ); ?>:</strong>
 461              <br />
 462              <?php
 463              echo "<ol>";
 464              foreach ( $contents as $content ) {
 465                  echo "<li>". $content->title ."</li>";
 466              }
 467              echo "</ol>";
 468              ?>
 469              </td>
 470              <td valign="top">
 471              <?php echo JText::_( 'This will move the Categories listed' ); ?>
 472              <br />
 473              <?php echo JText::_( 'and all the items within the category (also listed)' ); ?>
 474              <br />
 475              <?php echo JText::_( 'to the selected Section' ); ?>.
 476              </td>.
 477          </tr>
 478          </table>
 479          <br /><br />
 480  
 481          <input type="hidden" name="option" value="<?php echo $option;?>" />
 482          <input type="hidden" name="section" value="<?php echo $sectionOld;?>" />
 483          <input type="hidden" name="boxchecked" value="1" />
 484          <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
 485          <input type="hidden" name="task" value="" />
 486          <?php
 487          foreach ( $cid as $id ) {
 488              echo "\n <input type=\"hidden\" name=\"cid[]\" value=\"$id\" />";
 489          }
 490          ?>
 491          <?php echo JHTML::_( 'form.token' ); ?>
 492          </form>
 493          <?php
 494      }
 495  
 496      /**
 497       * Form to select Section to copy Category to
 498       */
 499  	function copyCategorySelect( $option, $cid, $SectionList, $items, $sectionOld, $contents, $redirect ) {
 500          ?>
 501          <script language="javascript" type="text/javascript">
 502  		function submitbutton(pressbutton) {
 503              var form = document.adminForm;
 504              if (pressbutton == 'cancel') {
 505                  submitform( pressbutton );
 506                  return;
 507              }
 508  
 509              // do field validation
 510              if (!getSelectedValue( 'adminForm', 'sectionmove' )) {
 511                  alert( "<?php echo JText::_( 'Please select a section from the list', true ); ?>" );
 512              } else {
 513                  submitform( pressbutton );
 514              }
 515          }
 516          </script>
 517  
 518          <form action="index.php" method="post" name="adminForm">
 519  
 520          <br />
 521          <table class="adminform">
 522          <tr>
 523              <td width="3%"></td>
 524              <td  valign="top" width="30%">
 525              <strong><?php echo JText::_( 'Copy to Section' ); ?>:</strong>
 526              <br />
 527              <?php echo $SectionList ?>
 528              <br /><br />
 529              </td>
 530              <td  valign="top" width="20%">
 531              <strong><?php echo JText::_( 'Categories being copied' ); ?>:</strong>
 532              <br />
 533              <?php
 534              echo "<ol>";
 535              foreach ( $items as $item ) {
 536                  echo "<li>". $item->title ."</li>";
 537              }
 538              echo "</ol>";
 539              ?>
 540              </td>
 541              <td valign="top" width="20%">
 542              <strong><?php echo JText::_( 'Articles being copied' ); ?>:</strong>
 543              <br />
 544              <?php
 545              echo "<ol>";
 546              foreach ( $contents as $content ) {
 547                  echo "<li>". $content->title ."</li>";
 548                  echo "\n <input type=\"hidden\" name=\"item[]\" value=\"$content->id\" />";
 549              }
 550              echo "</ol>";
 551              ?>
 552              </td>
 553              <td valign="top">
 554              <?php echo JText::_( 'This will copy the Categories listed' ); ?>
 555              <br />
 556              <?php echo JText::_( 'and all the items within the Category (also listed)' ); ?>
 557              <br />
 558              <?php echo JText::_( 'to the selected Section' ); ?>
 559              <br />
 560              <?php echo JText::_( 'NOTE: IF SAME SECTION' ); ?>.
 561              </td>.
 562          </tr>
 563          </table>
 564          <br /><br />
 565  
 566          <input type="hidden" name="option" value="<?php echo $option;?>" />
 567          <input type="hidden" name="section" value="<?php echo $sectionOld;?>" />
 568          <input type="hidden" name="boxchecked" value="1" />
 569          <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
 570          <input type="hidden" name="task" value="" />
 571          <?php
 572          foreach ( $cid as $id ) {
 573              echo "\n <input type=\"hidden\" name=\"cid[]\" value=\"$id\" />";
 574          }
 575          ?>
 576          <?php echo JHTML::_( 'form.token' ); ?>
 577          </form>
 578          <?php
 579      }
 580  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1