BaikalAdmin\Controller\Users::actionDelete PHP Method

actionDelete() protected method

protected actionDelete ( )
    protected function actionDelete()
    {
        $aParams = $this->getParams();
        $iUser = intval($aParams["delete"]);
        if ($this->actionDeleteConfirmed() !== false) {
            # catching Exception thrown when model already destroyed
            # happens when user refreshes delete-page, for instance
            try {
                $oUser = new \Baikal\Model\User($iUser);
                $oUser->destroy();
            } catch (\Exception $e) {
                # user is already deleted; silently discarding
            }
            # Redirecting to admin home
            \Flake\Util\Tools::redirectUsingMeta($this->link());
        } else {
            $oUser = new \Baikal\Model\User($iUser);
            $this->aMessages[] = \Formal\Core\Message::warningConfirmMessage("Check twice, you're about to delete " . $oUser->label() . "</strong> from the database !", "<p>You are about to delete a user and all it's calendars / contacts. This operation cannot be undone.</p><p>So, now that you know all that, what shall we do ?</p>", $this->linkDeleteConfirm($oUser), "Delete <strong><i class='" . $oUser->icon() . " icon-white'></i> " . $oUser->label() . "</strong>", $this->link());
        }
    }