Example #1
0
include DOCROOT . '/skin/header.php';
$form = new Form('nbssv2login');
$form->class = 'neoAdminForm';
$form->validationerrormsg = 'The following fields must be completed:';
if ($form->submitted && $form->submiterrors == 0) {
    $user = getUserLogin(md5(strtoupper(trim(ltrim($request->get('post', 'membershipno'), '0')))), md5(strtoupper(str_replace(' ', '', $request->get('post', 'postcode')))));
    if ($user !== false) {
        Session::set('user', $user);
        Session::set('welcomed', false);
        getQueryResults('UPDATE ' . $config->get('database', 'tablePrefix') . 'user SET lastlogin='******'YmdHis', time()) . ' WHERE id=' . $user['id']);
        header('Location: ' . $config->get('web', 'root') . '/');
        exit;
    } else {
        $form->submiterrormsg .= 'Invalid membership number, postcode or inactive account.';
    }
}
$form->addFieldsetOpen('Login');
$form->addField('membershipno', 'text', $request->get('post', 'membershipno'));
$form->addLabel('Membership Number');
$form->addFieldValidation('required');
$form->addHelp('Please use the membership number from your CAMRA membership card.');
$form->addField('postcode', 'text', $request->get('post', 'postcode'));
$form->addLabel('Postcode');
$form->addFieldValidation('required');
$form->addHelp('Enter your postcode from your normal residence (You know, where CAMRA sends your "What\'s Brewing".)');
$form->addFieldsetClose();
$form->addField('login', 'submit', 'Login');
$form->addInputClass('btnSubmit');
$form->addContent('<div class="reset"><a href="' . $config->get('web', 'root') . '/signup/" class="btnSubmit fleft" title="sign up for an account">Sign up for an account</a></div>');
echo $form->submiterrormsg . $form->display();
include DOCROOT . '/skin/loginfooter.php';
Example #2
0
$form->addFieldValidation('required');
$form->addField('lastname', 'text', $member['lastname']);
$form->addLabel('Lastname');
$form->addFieldValidation('required');
$form->addField('email', 'text', $member['email']);
$form->addLabel('Email Address');
$form->addFieldValidation('required email');
$form->addField('camra_number', 'text', $member['camra_number']);
if ($config->get('web', 'signupNonCamra')) {
    $form->addLabel('CAMRA Membership Number/Username');
    $form->addFieldValidation('required');
} else {
    $form->addLabel('CAMRA Membership Number');
    $form->addFieldValidation('required numeric');
}
$form->addField('postcode', 'text', $member['postcode']);
$form->addLabel('Postcode');
$form->addFieldValidation('required');
if ($config->get('web', 'signupNonCamra')) {
    $form->addField('camra_member', 'checkbox', $member['camra_member']);
    $form->addLabel('I am a CAMRA Member', null, 'right');
    $form->addOptions(array(1, 0));
}
$form->addFieldsetClose();
$form->addField('register', 'submit', 'Register');
$form->addInputClass('btnSubmit');
$form->addField('reset', 'reset', 'Reset form');
$form->addInputClass('btnReset');
$form->addContent('<div class="reset"><a href="' . $config->get('web', 'root') . '/login/" class="btnReset fleft">Cancel &amp; back to Login</a></div>');
echo $form->submiterrormsg . $form->display();
include DOCROOT . '/skin/loginfooter.php';
Example #3
0
    } else {
        $towns = getQueryResults('SELECT id, name FROM ' . $config->get('database', 'tablePrefix') . 'town WHERE active=1 ORDER BY name;');
    }
}
if (isset($towns)) {
    $form->addField('town_id', 'select');
    $form->addLabel('Select town');
    $form->addOptions(array('new' => 'Add new town'));
    $form->addOptions($towns, 'id', 'name');
    $form->addField('selecttown', 'submit', 'Select town');
    $form->addInputClass('btnSubmit');
} else {
    $form->addField('town_id', 'hidden', $town['id']);
    $form->addField('name', 'text', $town['name']);
    $form->addLabel('Town Name');
    $form->addFieldValidation('required');
    $form->addField('active', 'checkbox', $town['active']);
    $form->addLabel('Active', null, 'right');
    $form->addOptions(array(1, 0));
    if ('new' == $town_id) {
        $form->addField('updateTown', 'submit', 'Create town');
    } else {
        $form->addField('updateTown', 'submit', 'Update town');
    }
    $form->addInputClass('btnSubmit');
    $form->addField('resetForm', 'reset', 'Reset Form');
    $form->addInputClass('btnReset');
    $form->addContent('<div class="reset"><a href="' . $config->get('web', 'root') . '/admin/towns/" class="btnReset fleft">Cancel &amp; Select another town</a></div>');
}
print $form->display() . $form->submiterrormsg;
include DOCROOT . '/skin/footer.php';
Example #4
0
    $form->addField('camra_number', 'text');
    $form->addLabel('CAMRA Membership Number');
    if ('new' == $member['id']) {
        $form->addFieldValidation('required numeric');
    } else {
        $form->addFieldValidation('numeric');
    }
    $form->addField('postcode', 'text');
    $form->addLabel('Postcode');
    if ('new' == $member['id']) {
        $form->addFieldValidation('required');
    }
    $form->addField('active', 'checkbox', $member['active']);
    $form->addLabel('Active', null, 'right');
    $form->addOptions(array(1, 0));
    if ('new' == $member_id) {
        $form->addField('updateUser', 'submit', 'Create User');
    } else {
        $form->addField('updateUser', 'submit', 'Update User');
    }
    $form->addInputClass('btnSubmit');
    if (0 == $member['active']) {
        $form->addField('deleteUser', 'submit', 'Delete User');
        $form->addInputClass('btnReset');
    }
    $form->addField('resetForm', 'reset', 'Reset Form');
    $form->addInputClass('btnReset');
    $form->addContent('<div class="reset"><a href="' . $config->get('web', 'root') . '/admin/members/" class="btnReset fleft" title="go back to the list of members and pick another">Cancel &amp; Back to members list</a></div>');
}
print $form->display() . $form->submiterrormsg;
include DOCROOT . '/skin/footer.php';
Example #5
0
        $form->addOptions(array('0' => 'None/Freehold'));
        $form->addOptions(getQueryResults('SELECT id,name FROM ' . $config->get('database', 'tablePrefix') . 'brewery ORDER by name'), 'id', 'name');
        $form->addField('active', 'checkbox', $pub['active']);
        $form->addLabel('Active', null, 'right');
        $form->addOptions(array(1, 0));
        $form->addField('notes', 'textarea', $pub['notes']);
        $form->addLabel('Notes');
        if ('new' == $pub_id) {
            $form->addField('updatePub', 'submit', 'Create pub');
        } else {
            $form->addField('updatePub', 'submit', 'Update pub');
        }
        $form->addInputClass('btnSubmit');
        $form->addField('resetForm', 'reset', 'Reset Form');
        $form->addInputClass('btnReset');
        $form->addContent('<div class="reset"><a class="btnReset fleft" href="' . $config->get('web', 'root') . '/admin/pubs/?town_id=' . $town_id . '">Cancel &amp; Pick another pub</a></div>');
    } else {
        $pubs = getQueryResults('SELECT * FROM ' . $config->get('database', 'tablePrefix') . 'pub WHERE town_id=' . $town_id);
        ?>
			<div class="reset"><a class="btnReset fleft" href="<?php 
        echo $config->get('web', 'root');
        ?>
/admin/pubs/?town_id=<?php 
        echo $town_id;
        ?>
&amp;pub_id=new">Add new pub</a></div>
			<div class="reset"><a class="btnReset fleft" href="<?php 
        echo $config->get('web', 'root');
        ?>
/admin/pubs/">Go back to the town list</a></div>
			<p class="clear">Or edit existing pubs:</p>
Example #6
0
    $form->addField('town_id', 'select');
    $form->addLabel('Select town');
    $form->addOptions(array('' => 'Select town first'));
    $form->addOptions($towns, 'id', 'name');
    $form->addField('selectTown', 'submit', 'Select this town');
    $form->addInputClass('btnSubmit');
} else {
    if ('' != $pub_id) {
        $pub = reset(getQueryResults('SELECT * FROM ' . $config->get('database', 'tablePrefix') . 'pub WHERE id=' . $pub_id));
        $form->addField('town_id', 'hidden', $town_id);
        $form->addField('pub_id', 'hidden', $pub_id);
        $form->addField('name', 'hidden', $pub['name']);
        $form->addField('date', 'text', date('d-M-Y', time()));
        $form->addLabel('Date of Change');
        $form->addFieldValidation('required');
        $form->addContent('<img id="cal1Open" src="' . $config->get('web', 'root') . '/skin/images/cal.gif" /><div id="cal1Container"></div>');
        $form->addField('notes', 'textarea', $pub['notes']);
        $form->addLabel('Notes');
        $form->addField('updatePub', 'submit', 'Submit change');
        $form->addInputClass('btnSubmit');
        $form->addField('resetForm', 'reset', 'Reset Form');
        $form->addInputClass('btnReset');
        $form->addContent('<div class="reset"><a class="btnReset fleft" href="' . $config->get('web', 'root') . '/admin/pubs/newlandlord/?town_id=' . $town_id . '">Cancel &amp; Pick another pub</a></div>');
    } else {
        $pubs = getQueryResults('SELECT * FROM ' . $config->get('database', 'tablePrefix') . 'pub WHERE town_id=' . $town_id);
        $form->addFieldsetOpen('Pubs in ' . $town['name']);
        $form->addField('town_id', 'hidden', $town_id);
        $form->addField('pub_id', 'select');
        $form->addLabel('Pub');
        $form->addOptions($pubs, 'id', 'name');
        $form->addField('selectPub', 'submit', 'Change of landlord');
Example #7
0
 if ('' == $brewery_id) {
     /* brewery not selected so show the list */
     $form->addField('brewery_id-' . $pubIndex . '-' . $drinkIndex, 'select', $brewery_id);
     $form->addLabel('Brewery');
     $form->addOptions(array('' => 'Select brewery'));
     $form->addOptions($breweries, 'id', 'name');
     $form->addField('selectBrewery', 'submit', 'Select this brewery');
     $form->addInputClass('btnSubmit');
     $beers = array('' => 'Select brewery first');
 } else {
     /* brewery selected, get beers */
     $brewery = getItemFromArray($brewery_id, $breweries);
     $beers = array('' => 'Select beer');
     $beers = array_merge($beers, getQueryResults('SELECT * FROM ' . $config->get('database', 'tablePrefix') . 'beer WHERE brewery_id=' . $brewery_id . ';'));
     $form->addField('brewery_id-' . $pubIndex . '-' . $drinkIndex, 'hidden', $brewery_id);
     $form->addContent('<div><p class="fieldSubstitute"><span class="label">Brewery:</span><span class="input">' . $brewery['name'] . '</span></p></div>');
 }
 $form->addField('beer_id-' . $pubIndex . '-' . $drinkIndex, 'select', $request->get('post', 'beer_id-' . $pubIndex . '-' . $drinkIndex));
 $form->addLabel('Beer');
 $form->addOptions($beers, 'id', 'name');
 $form->addContent('<p class="optionseparator">or</p>');
 $form->addField('beername-' . $pubIndex . '-' . $drinkIndex, 'text', $request->get('post', 'beername-' . $pubIndex . '-' . $drinkIndex));
 $form->addLabel('Unlisted Brewery/Beer');
 $form->addHelp('If your beer cannot be found in the lists above, please include the Brewery and the Name of the beer and we will add popular ones to the list.');
 $form->addField('rating_id-' . $pubIndex . '-' . $drinkIndex, 'select', $request->get('post', 'rating_id-' . $pubIndex . '-' . $drinkIndex));
 $form->addLabel('Rating');
 $form->addOptions($ratings, 'id', 'name');
 $form->addHelp($ratingsHelpContent);
 $form->addField('notes-' . $pubIndex . '-' . $drinkIndex, 'textarea', $request->get('post', 'notes-' . $pubIndex . '-' . $drinkIndex));
 $form->addLabel('Notes');
 $form->addFieldsetClose();
Example #8
0
    }
}
if (isset($breweries)) {
    $form->addField('brewery_id', 'select');
    $form->addLabel('Select Brewery');
    $form->addOptions(array('new' => 'Add New Brewery'));
    $form->addOptions($breweries, 'id', 'name');
    $form->addField('selectBrewery', 'submit', 'Select Brewery');
    $form->addInputClass('btnSubmit');
} else {
    $form->addField('brewery_id', 'hidden', $brewery['id']);
    $form->addField('name', 'text', $brewery['name']);
    $form->addLabel('Brewery Name');
    $form->addFieldValidation('required');
    $form->addField('location', 'text', $brewery['location']);
    $form->addLabel('Location');
    $form->addField('active', 'checkbox', $brewery['active']);
    $form->addLabel('Active', null, 'right');
    $form->addOptions(array(1, 0));
    if ('new' == $brewery_id) {
        $form->addField('updateBrewery', 'submit', 'Create brewery');
    } else {
        $form->addField('updateBrewery', 'submit', 'Update brewery');
    }
    $form->addInputClass('btnSubmit');
    $form->addField('resetForm', 'reset', 'Reset form');
    $form->addInputClass('btnReset');
    $form->addContent('<div class="reset"><a href="' . $config->get('web', 'root') . '/admin/breweries/" class="btnReset fleft" title="go back to the list of breweries and pick another">Cancel &amp; Pick another brewery</a></div>');
}
print $form->display() . $form->submiterrormsg;
include DOCROOT . '/skin/footer.php';
Example #9
0
        $content = 'There has been new feedback' . CR . CR;
        $content .= 'From: ' . $user['firstname'] . ' ' . $user['lastname'] . CR;
        $content .= 'About:  ' . $request->get('post', 'about') . CR;
        $content .= 'Message:' . CR;
        $content .= '--------------------------------------' . CR;
        $content .= $request->get('post', 'message') . CR;
        $content .= '--------------------------------------' . CR;
        $content .= 'Post from IP address: ' . $_SERVER['REMOTE_ADDR'] . CR;
        $content .= 'On: ' . date('D jS M Y H:i:s');
        $content .= CR . CR . 'Thank you.';
        mail($config->get('web', 'feedbackEmail'), $subject, $content, $headers);
        header('Location: ' . $config->get('web', 'root') . '/feedback/thankyou/');
        exit;
    }
    $form->addFieldsetOpen('Feedback');
    $form->addContent('<div><p class="fieldSubstitute"><span class="label">From:</span><span class="input">' . $user['firstname'] . ' ' . $user['lastname'] . '</span></p></div>');
    $form->addField('about', 'select');
    $form->addLabel('About');
    $form->addOptions(array('' => 'Select a subject', 'missbeer' => 'Missing Beer', 'missbrewery' => 'Missing Brewery', 'misspubs' => 'Missing Pub', 'misstowns' => 'Missing Town', 'newlandlord' => 'New Landlords', 'suggestion' => 'NBSS Suggestions', 'other' => 'Other'));
    $form->addFormValidationErrorMessage('required');
    $form->addField('message', 'textarea');
    $form->addLabel('Text');
    $form->addFormValidationErrorMessage('required');
    $form->addField('send', 'submit', 'Send');
    $form->addInputClass('btnSubmit');
    $form->addField('reset', 'reset', 'Clear');
    $form->addInputClass('btnReset');
    $form->addFieldsetClose();
    print $form->display();
} else {
    ?>