Location: PHPKode > projects > Modular Railroad Asset/Meeting Mgmt > fredl-2-1-9-Release/module/deletemodule.php
<?php
    require_once('../php/fredlSession.php');
    /****************************************************************
     * FREMO Asset Management
     * Module: deletemodule.php
     * Description: Delete a module from the database
     *
     * Created: 6/2004, Dirk Jahnke
     * Parameter:
     *   moduleid
     *   backuri = link back to calling page
     *
     * $Log: deletemodule.php,v $
     * Revision 1.5  2005/06/07 21:53:30  dirkj
     * Added logDebug calls.
     *
     * Revision 1.4  2005/06/07 19:58:00  dirkj
     * Finalized multilingualization.
     *
     * Revision 1.3  2005/06/06 22:37:47  dirkj
     * Made multilingual.
     *
     * Revision 1.2  2004/11/01 12:35:47  dirkj
     * Modified session handling.
     *
     * Revision 1.1  2004/10/29 20:53:38  dirkj
     * Initial Revision.
     *
     ****************************************************************/
    require_once '../php/sessionhelpers.inc.php';
    require_once '../php/uihelpers.inc.php';
    require_once '../lib/module.php';
    require_once '../lib/lang.php';
    $objUser=getUserObject();
    $l = new Lang($usrObj->langid, 'module-delete','general,module');


    print "<html>";
    print "<head>";
    print '<link rel="stylesheet" type="text/css" href="../'.$myStyleSheet.'">';
    print "</head>";
    print '<body class=right>';
    print '<h1>'.$l->get('module-delete-title','Modul löschen').'</h1>';

   $backuri=$_GET['backuri'];
   $moduleid=$_GET['moduleid'];
   $thisuri=$_SERVER['REQUEST_URI'];
   
   logDebug("module-delete moduleid=$moduleid | backuri=$backuri");

   $module=new Module();
   $module->dbRead($moduleid);

   print '<table>';
   print '<tr><td>'.$l->get('module-nreid','NRE-ID:').'</td><td>'.$module->get('nreid').'</td></tr>';
   print '<tr><td>'.$l->get('module-fremonid','Fremo-N-ID:').'</td><td>'.$module->get('fremonid').'</td></tr>';
   print '<tr><td>'.$l->get('module-topic','Name:').'</td><td>'.$module->get('name').'</td></tr>';
   print '<tr><td>'.$l->get('module-type','Typ:').'</td><td>'.$module->getLookedUp('moduletypeid').'</td></tr>';
   print '<tr><td>'.$l->get('general-owner-colon','Eigentümer:').'</td><td>'.$module->getLookedUp('ownerid').'</td></tr>';
   print '</table>';

   // echo "<p>backuri=$backuri</p>";
   // echo "<p>locoid=$locoid</p>";
   echo "<form action='deletemodule.php?moduleid=$moduleid&backuri=$backuri' method='post'>";

   echo '<p>';
   if (isset($_POST['doDelModule']))
   {
      echo "<b>".$l->get('module-delete-start','Löschen ...');
      $module->dbDelete();
      $msg=sprintf($l->get('module-delete-logmsg','Modul %d gelöscht'), $moduleid);
      logAudit("deletemodule.php: $msg");
      echo $l->get('module-delete-end','gelöscht</b>');
   }
   else
   {
	   // show referers and button to show details
	   $referer = $module->getReferer();
	   if (count($referer) > 0)
	   {
		   print '<p>';
		   print $l->get('module-delete-inuse','Dieses Modul wird noch verwendet und kann deshalb nicht gelöscht werden:');
		   print '<ul>';
		   foreach ($referer as $row)
		   {
			   print '<li>'.$row.'</li>';
		   }
		   print '</ul></p>';
		   echo '<p>';
		   echo '<input class="cmd" type="Submit" name="doShowRefererDetails" value="'.$l->get('general-more-info','Weitere Details').'">';
		   echo "</p>";
	   } else {
		   // allow deletion
		   echo '<p>';
		   echo '<input class="cmd" type="Submit" name="doDelModule" value="'.$l->get('module-delete-button','Modul Löschen').'">';
		   echo '</p>';
	   }
   }
   echo '</p>';


   if (isset($_POST['doShowRefererDetails']))
   {
	   print '<p><table border=1>';
	   $newFlag=true;
	   foreach ($module->getRefererDetails() as $row)
	   {
		   if ($row[0] == '-----')
		   {
			   $newFlag=true;
		   } else {
			   print '<tr>';
			   foreach ($row as $field)
			   {
				   print '<td>';
				   if ($newFlag) print '<b>';
				   print $field;
				   if ($newFlag) print '</b>';
				   print '</td>';
			   }
			   print '</tr>';
			   $newFlag=false;
		   }
	   }
	   print '</table></p>';
   }
   echo '<p>';
   echo '<input type="Button" 
                class="cmd" 
	        onClick=\'parent.frames["rechts"].location.href="'.$backuri.'"\' 
	        value="'.$l->get('general-back-button','Zurück').'" >';
   echo "</p>";
   echo "</form><p>";
   print $l->getTranslationHelperUI();
   print '</body></html>';

?>
Return current item: Modular Railroad Asset/Meeting Mgmt