[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_checkin/ -> admin.checkin.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: admin.checkin.php 14401 2010-01-26 14:10:00Z louis $
   4   * @package        Joomla
   5   * @subpackage    Checkin
   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  // Make sure the user is authorized to view this page
  19  
  20  $user = & JFactory::getUser();
  21  if (!$user->authorize( 'com_checkin', 'manage' )) {
  22      $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') );
  23  }
  24  $db            =& JFactory::getDBO();
  25  $nullDate    = $db->getNullDate();
  26  ?>
  27  <div id="tablecell">
  28      <table class="adminform">
  29      <tr>
  30          <th class="title">
  31              <?php echo JText::_( 'Database Table' ); ?>
  32          </th>
  33          <th class="title">
  34              <?php echo JText::_( 'Num of Items' ); ?>
  35          </th>
  36          <th class="title">
  37              <?php echo JText::_( 'Checked-In' ); ?>
  38          </th>
  39          <th class="title">
  40          </th>
  41      </tr>
  42      <?php
  43      $tables = $db->getTableList();
  44      $k = 0;
  45      foreach ($tables as $tn) {
  46          // make sure we get the right tables based on prefix
  47          if (!preg_match( "/^".$mainframe->getCfg('dbprefix')."/i", $tn )) {
  48              continue;
  49          }
  50          $fields = $db->getTableFields( array( $tn ) );
  51  
  52          $foundCO = false;
  53          $foundCOT = false;
  54          $foundE = false;
  55  
  56          $foundCO    = isset( $fields[$tn]['checked_out'] );
  57          $foundCOT    = isset( $fields[$tn]['checked_out_time'] );
  58          $foundE        = isset( $fields[$tn]['editor'] );
  59  
  60          if ($foundCO && $foundCOT) {
  61              if ($foundE) {
  62                  $query = 'SELECT checked_out, editor FROM '.$tn.' WHERE checked_out > 0';
  63              } else {
  64                  $query = 'SELECT checked_out FROM '.$tn.' WHERE checked_out > 0';
  65              }
  66              $db->setQuery( $query );
  67              $res = $db->query();
  68              $num = $db->getNumRows( $res );
  69  
  70              if ($foundE) {
  71                  $query = 'UPDATE '.$tn.' SET checked_out = 0, checked_out_time = '.$db->Quote($nullDate).', editor = NULL WHERE checked_out > 0';
  72              } else {
  73                  $query = 'UPDATE '.$tn.' SET checked_out = 0, checked_out_time = '.$db->Quote($nullDate).' WHERE checked_out > 0';
  74              }
  75              $db->setQuery( $query );
  76              $res = $db->query();
  77  
  78              if ($res == 1) {
  79                  if ($num > 0) {
  80                      echo "<tr class=\"row$k\">";
  81                      echo "\n    <td width=\"350\">". JText::_( 'Checking table' ) ." - ". $tn ."</td>";
  82                      echo "\n    <td width=\"150\">". JText::_( 'Checked-In' ) ." <b>". $num ."</b> ". JText::_( 'items' ) ."</td>";
  83                      echo "\n    <td width=\"100\" align=\"center\"><img src=\"images/tick.png\" border=\"0\" alt=\"". JText::_( 'tick' ) ."\" /></td>";
  84                      echo "\n    <td>&nbsp;</td>";
  85                      echo "\n</tr>";
  86                  } else {
  87                      echo "<tr class=\"row$k\">";
  88                      echo "\n    <td width=\"350\">". JText::_( 'Checking table' ) ." - ". $tn ."</td>";
  89                      echo "\n    <td width=\"150\">". JText::_( 'Checked-In' ) ." <b>". $num ."</b> ". JText::_( 'items' ) ."</td>";
  90                      echo "\n    <td width=\"100\">&nbsp;</td>";
  91                      echo "\n    <td>&nbsp;</td>";
  92                      echo "\n</tr>";
  93                  }
  94                  $k = 1 - $k;
  95              }
  96          }
  97      }
  98      ?>
  99      <tr>
 100          <td colspan="4">
 101              <strong>
 102              <?php echo JText::_( 'Checked out items have now been all checked in' ); ?>
 103              </strong>
 104          </td>
 105      </tr>
 106      </table>
 107  </div>


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