formHelper::getFormClose PHP Method

getFormClose() public method

Closes a form if one is open
public getFormClose ( ) : string
return string
    public function getFormClose()
    {
        if ($this->_formopen) {
            $this->_formopen = false;
            return '</fieldset></form>';
        } else {
            if (DEBUG_MODE) {
                $errorMsg = 'Invalid usage of ' . __METHOD__ . '() - there is no open form to close';
                trigger_error($errorMsg, E_USER_NOTICE);
            }
        }
    }

Usage Example

echo '<div id="bodycontent" class="ui-widget-content"><h1 style="float: right;">' . $html->link('http://www.phpmoadmin.com', $phpmoadmin, array('title' => 'phpMoAdmin')) . '</h1>';
if (isset($accessControl) && !isset($_SESSION['user'])) {
    if (isset($_POST['username'])) {
        $_POST = array_map('trim', $_POST);
        if (isset($accessControl[$_POST['username']]) && $accessControl[$_POST['username']] == $_POST['password']) {
            $_SESSION['user'] = $_POST['username'];
        } else {
            $_POST['errors']['username'] = '******';
        }
    }
    if (!isset($_SESSION['user'])) {
        echo $form->getFormOpen();
        echo $html->div($form->getInput(array('name' => 'username', 'focus' => true)));
        echo $html->div($form->getInput(array('type' => 'password', 'name' => 'password')));
        echo $html->div($form->getInput(array('type' => 'submit', 'value' => 'Login', 'class' => 'ui-state-hover')));
        echo $form->getFormClose();
        exit(0);
    }
}
echo '<div id="dbcollnav">';
$formArgs = array('method' => 'get');
if (isset($mo->mongo['repairDb'])) {
    $formArgs['alert'] = isset($mo->mongo['repairDb']['ok']) && $mo->mongo['repairDb']['ok'] ? 'Database has been repaired and compacted' : 'Database could not be repaired';
}
echo $form->getFormOpen($formArgs);
echo $html->div($form->getSelect(array('name' => 'db', 'options' => $mo->mongo['dbs'], 'label' => '', 'value' => $db, 'addBreak' => false)) . $form->getInput(array('type' => 'submit', 'value' => 'Change database', 'class' => 'ui-state-hover')) . ' <span style="font-size: xx-large;">' . get::htmlentities($db) . '</span> [' . $html->link("javascript: mo.repairDatabase('" . get::htmlentities($db) . "'); void(0);", 'repair database') . '] [' . $html->link("javascript: mo.dropDatabase('" . get::htmlentities($db) . "'); void(0);", 'drop database') . ']');
echo $form->getFormClose() . $html->jsInline('var mo = {}
mo.urlEncode = function(str) {
    return escape(str)' . '.replace(/\\+/g, "%2B").replace(/%20/g, "+").replace(/\\*/g, "%2A").replace(/\\//g, "%2F").replace(/@/g, "%40");
}
mo.repairDatabase = function(db) {