Location: PHPKode > projects > Knowledge Box > knowledgebox/wizard/base.php
<?php

  /*
   * Free IT Foundation
   * Free Technology Serving Knowledge
   * http://www.free-it-foundation.org
   * 
   * This file is part of Knowledge Box.
   * 
   * Knowledge Box is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   * 
   * Knowledge Box is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   * 
   * You should have received a copy of the GNU General Public License
   * along with Knowledge Box.  If not, see <http://www.gnu.org/licenses/>.
   */

  
  // restrict access
  if (!KB_IS_ADMINISTRATOR)
    $AppUI->redirect (KB_ACCESS_DENIED);

  // retrieve id
  $base_id = (int) dPgetParam ($_GET, 'id');

  // instanciate
  $base = new KBModuleBase ();

  // load record
  if ($base_id > 0 && !$base->load ($base_id))
  {
    // failed
    $AppUI->setMsg ('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect ();
  }

  // title block
  $titleBlock = new CTitleBlock (utf8_encode (html_entity_decode ($AppUI->_($base_id > 0 ? 'titleEditBase' : 'titleNewBase'))), KB_MODULE_ICON);

  // breadcrumb
  $titleBlock->addCrumb ('?m=' . KB_MODULE, utf8_encode (html_entity_decode ($AppUI->_('backToBox'))));

  // delete link
  if ($base_id > 0)
    $titleBlock->addCrumbDelete (utf8_encode (html_entity_decode ($AppUI->_('actionDeleteBase'))));

  // show the title block
  $titleBlock->show ();

?>

<script type="text/javascript">

  function submitIt ()
  {
    var f = document.baseForm;

    if (f.name.value.length == 0) {
      alert ("<?= utf8_encode (html_entity_decode ($AppUI->_('alertEmptyBaseName'))); ?>");
      f.name.focus ();
      return false;
    }

    return true;
  }
  
  function delIt ()
  {
    if (confirm ("<?= utf8_encode (html_entity_decode ($AppUI->_('alertDeleteBase'))); ?>"))
    {
      var f = document.baseForm;
      f.del.value = "1";
      f.submit ();
    }
  }
  
  function cancelIt ()
  {
    location.href = "index.php?m=<?= KB_MODULE ?>";
  }
  
</script>

<form name="baseForm" action="index.php?m=<?= KB_MODULE ?>" method="post" onSubmit="return submitIt();">

<input type="hidden" name="dosql" value="radix" />
<input type="hidden" name="del" value="0" />
<input type="hidden" name="id" value="<?= $base_id ?>" />

<table cellspacing="0" cellpadding="4" border="0" width="100%" class="std">
<tr>
  <td width="50%" valign="top">
    <table cellspacing="0" cellpadding="2" border="0">
    <tr>
      <td align="right" nowrap="nowrap"><?= $AppUI->_('inputBaseName') ?></td>
      <td width="20">&nbsp;</td>
      <td width="100%">
        <input type="text" size="32" name="name" value="<?= str_replace ('&amp;', '&', dPformSafe ($base->getName ())) ?>" maxlength="64" />
      </td>
    </tr>
    </table>
  </td>
  <td></td>
</tr>
<tr>
  <td>
    <input class="button" type="button" name="cancel" value="<?= $AppUI->_('actionCancel') ?>" onClick="cancelIt();" />
  </td>
  <td align="right">
    <input class="button" type="submit" name="btnFuseAction" value="<?= $AppUI->_('actionSubmit') ?>"/>
  </td>
</tr>
</table>

</form>
Return current item: Knowledge Box