<?php

namespace ArticleRatings\Admin;

//$formSubmitted = filter_input(INPUT_POST, 'save-new-poll-group') ? true : false;
$viewPollGroupModuleURL = \ArticleRatings\URLs::moduleURL('poll-group-edit') . '&poll-group-id=1';
$createPollGroupModuleURL = \ArticleRatings\URLs::moduleURL('poll-group-create');
if (filter_input(INPUT_POST, 'save-new-poll-group')) {
    $createGroupResult = \ArticleRatings\PollGroups::createGroup($_POST);
    d($createGroupResult);
}
// Load views
require_once AR_PLUGIN_DIR . '/admin/views/polls/poll-group-create.v.php';
<h2>Редактиране на анкетна група <a href="<?php 
echo \ArticleRatings\URLs::moduleURL('poll-groups');
?>
" class="add-new-h2">Списък анкетни групи</a> <a href="<?php 
echo \ArticleRatings\URLs::moduleURL('poll-group-create');
?>
" class="add-new-h2">Създай анкетна група</a></h2>

<?php 
//d( $getGroupData );
//d($getGroupData['group'][0]->name);
//d($getGroupData['sections']);
?>

<form method="post" name="new-poll-group">
    <table class="form-table">
        <tr>
            <th>Име*</th>
            <td><input type="text" name="name" class="large-text" value="<?php 
echo $getGroupData['group'][0]->name;
?>
" /></td>
        </tr>
        <tr>
            <th>Описание</th>
            <td><textarea name="description" class="large-text" rows="5"><?php 
echo $getGroupData['group'][0]->description;
?>
</textarea></td>
        </tr>
        <tr>
echo \ArticleRatings\URLs::moduleURL('poll-group-create');
?>
" class="add-new-h2">Създай нова анкетна група</a></h2>

<?php 
$ifSuccess = isset($createGroupResult) && $createGroupResult['success'];
$readOnlyInput = '';
if ($ifSuccess) {
    $readOnlyInput = 'readonly="readonly"';
}
if ($ifSuccess) {
    ?>
<div class="updated below-h2">
    <p>
        Анкетната група бе създадена успешно! <a href="<?php 
    echo \ArticleRatings\URLs::moduleURL('poll-group-edit');
    ?>
&poll-id=<?php 
    echo $createGroupResult['pollId'];
    ?>
">Редактирай анкетната група</a>
    </p>
</div>
<?php 
}
?>
<form method="post" name="new-poll-group" class="poll-group-create">
    <table class="form-table">
        <tr class="<?php 
if (isset($createGroupResult) && isset($createGroupResult['errors']['emptyName'])) {
    echo "error";