Пример #1
0
            // for saving
            if ($BOARD['required_permission_id'] != null) {
                $permission = new StaffPermission($db);
                $permission = $permission->findOneByStaffPermissionId($BOARD['required_permission_id']);
                if ($permission == null) {
                    $ERRORS[] = 'Invalid permission specified.';
                } else {
                    $permission_id = $permission->getStaffPermissionId();
                }
            }
            // end perm specified; check it
            if (sizeof($ERRORS) > 0) {
                draw_errors($ERRORS);
            } else {
                $board->setBoardName($BOARD['name']);
                $board->setBoardDescr($BOARD['description']);
                $board->setBoardLocked($BOARD['locked']);
                $board->setNewsSource($BOARD['news_source']);
                $board->setOrderBy($BOARD['order_by']);
                $board->setRequiredPermissionId($permission_id);
                $board->setBoardCategoryId($category->getBoardCategoryId());
                $board->save();
                $_SESSION['board_notice'] = "You have saved <strong>{$board->getBoardName()}</strong>.";
                redirect('admin-boards');
            }
            // end no errors
            break;
            // end save
    }
    // end state switch
}