[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/system/ -> viewmods.php (source)

   1  <?php /* $Id: viewmods.php 141 2008-04-05 16:41:20Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/system/viewmods.php $ */
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not access this file directly.');
   4  }
   5  
   6  // check permissions
   7  $perms = &$AppUI->acl();
   8  $canEdit = $perms->checkModule('system', 'edit');
   9  $canRead = $perms->checkModule('system', 'view');
  10  if (!$canRead) {
  11      $AppUI->redirect('m=public&a=access_denied');
  12  }
  13  
  14  $AppUI->savePlace();
  15  
  16  $hidden_modules = array('public', 'install', );
  17  $q = new DBQuery;
  18  $q->addQuery('*');
  19  $q->addTable('modules');
  20  foreach ($hidden_modules as $no_show) {
  21      $q->addWhere('mod_directory <> \'' . $no_show . '\'');
  22  }
  23  $q->addOrder('mod_ui_order');
  24  $modules = $q->loadList();
  25  // get the modules actually installed on the file system
  26  $modFiles = $AppUI->readDirs('modules');
  27  
  28  $titleBlock = new CTitleBlock('Modules', 'power-management.png', $m, "$m.$a");
  29  $titleBlock->addCrumb('?m=system', 'System Admin');
  30  $titleBlock->show();
  31  ?>
  32  
  33  <table border="0" cellpadding="2" cellspacing="1" width="100%" class="tbl">
  34  <tr>
  35      <th colspan="2"><?php echo $AppUI->_('Module'); ?></th>
  36      <th><?php echo $AppUI->_('Status'); ?></th>
  37      <th><?php echo $AppUI->_('Type'); ?></th>
  38      <th><?php echo $AppUI->_('Version'); ?></th>
  39      <th><?php echo $AppUI->_('Menu Text'); ?></th>
  40      <th><?php echo $AppUI->_('Menu Icon'); ?></th>
  41      <th><?php echo $AppUI->_('Menu Status'); ?></th>
  42      <th><?php echo $AppUI->_('#'); ?></th>
  43  </tr>
  44  <?php
  45  // do the modules that are installed on the system
  46  foreach ($modules as $row) {
  47      // clear the file system entry
  48      if (isset($modFiles[$row['mod_directory']])) {
  49          $modFiles[$row['mod_directory']] = '';
  50      }
  51      $query_string = '?m=' . $m . '&a=domodsql&mod_id=' . $row['mod_id'];
  52      $s = '';
  53      $s .= '<td width="64" align="center">';
  54      if ($canEdit) {
  55          $s .= w2PtoolTip('Modules', 'Move to First') . '<a href="' . $query_string . '&cmd=movefirst"><img src="' . w2PfindImage('icons/2uparrow.png') . '" border="0"/></a>' . w2PendTip();
  56          $s .= w2PtoolTip('Modules', 'Move Up') . '<a href="' . $query_string . '&cmd=moveup"><img src="' . w2PfindImage('icons/1uparrow.png') . '" border="0"/></a>' . w2PendTip();
  57          $s .= w2PtoolTip('Modules', 'Move Down') . '<a href="' . $query_string . '&cmd=movedn"><img src="' . w2PfindImage('icons/1downarrow.png') . '" border="0"/></a>' . w2PendTip();
  58          $s .= w2PtoolTip('Modules', 'Move to Last') . '<a href="' . $query_string . '&cmd=movelast"><img src="' . w2PfindImage('icons/2downarrow.png') . '" border="0"/></a>' . w2PendTip();
  59      }
  60      $s .= '</td>';
  61  
  62      $s .= '<td width="1%" nowrap="nowrap">' . $AppUI->_($row['mod_name']) . '</td>';
  63      $s .= '<td>';
  64      $s .= '<img src="' . w2PfindImage('obj/dot' . ($row['mod_active'] ? 'green' : 'yellowanim') . '.gif') . '" />&nbsp;';
  65      if ($canEdit) {
  66          $s .= '<a href="' . $query_string . '&cmd=toggle&">';
  67      }
  68      $s .= ($row['mod_active'] ? $AppUI->_('active') : $AppUI->_('disabled'));
  69      if ($canEdit) {
  70          $s .= '</a>';
  71      }
  72      if ($row['mod_type'] != 'core' && $canEdit) {
  73          $s .= ' | <a href="' . $query_string . '&cmd=remove" onclick="return window.confirm(' . "'" . $AppUI->_('This will delete all data associated with the module!') . "\\n\\n" . $AppUI->_('Are you sure?') . "\\n" . "'" . ');">' . $AppUI->_('remove') . '</a>';
  74      }
  75  
  76      // check for upgrades
  77      $ok = file_exists(W2P_BASE_DIR . '/modules/' . $row['mod_directory'] . '/setup.php');
  78      if ($ok) {
  79          include_once (W2P_BASE_DIR . '/modules/' . $row['mod_directory'] . '/setup.php');
  80      }
  81      if ($ok) {
  82          if ($config['mod_version'] != $row['mod_version'] && $canEdit) {
  83              $s .= ' | <a href="' . $query_string . '&cmd=upgrade" onclick="return window.confirm(' . "'" . $AppUI->_('Are you sure?') . "'" . ');" >' . $AppUI->_('upgrade') . '</a>';
  84          }
  85      }
  86  
  87      // check for configuration
  88  
  89      if ($ok) {
  90          if (isset($config['mod_config']) && $config['mod_config'] == true && $canEdit) {
  91              $s .= ' | <a href="' . $query_string . '&cmd=configure">' . $AppUI->_('configure') . '</a>';
  92          }
  93      }
  94  
  95      $s .= '</td>';
  96      $s .= '<td>' . $row['mod_type'] . '</td>';
  97      $s .= '<td>' . $row['mod_version'] . '</td>';
  98      $s .= '<td>' . $AppUI->_($row['mod_ui_name']) . '</td>';
  99      $s .= '<td>' . $row['mod_ui_icon'] . '</td>';
 100  
 101      $s .= '<td>';
 102      $s .= '<img src="' . w2PfindImage('/obj/' . ($row['mod_ui_active'] ? 'dotgreen.gif' : 'dotredanim.gif')) . '" />&nbsp;';
 103      if ($canEdit) {
 104          $s .= '<a href="' . $query_string . '&cmd=toggleMenu">';
 105      }
 106      $s .= ($row['mod_ui_active'] ? $AppUI->_('visible') : $AppUI->_('hidden'));
 107      if ($canEdit) {
 108          $s .= '</a>';
 109      }
 110      $s .= '</td>';
 111  
 112      $s .= '<td align="right">' . $row['mod_ui_order'] . '</td>';
 113  
 114      echo '<tr>' . $s . '</tr>';
 115  }
 116  
 117  foreach ($modFiles as $v) {
 118      // clear the file system entry
 119      if ($v && !in_array($v, $hidden_modules)) {
 120          $s = '';
 121          $s .= '<td></td>';
 122          $s .= '<td>' . $v . '</td>';
 123          $s .= '<td>';
 124          $s .= '<img src="' . w2PfindImage('obj/dotgrey.gif') . '" />&nbsp;';
 125          if ($canEdit) {
 126              $s .= '<a href="?m=' . $m . '&a=domodsql&cmd=install&mod_directory=' . $v . '">';
 127          }
 128          $s .= $AppUI->_('install');
 129          if ($canEdit) {
 130              $s .= '</a>';
 131          }
 132          $s .= '</td>';
 133          echo '<tr>' . $s . '</tr>';
 134      }
 135  
 136  }
 137  ?>
 138  </table>


Generated: Thu Jan 8 03:00:03 2009 Cross-referenced by PHPXref 0.7