Exemple #1
0
$box2->AddChild(new RTK_Link('woop', 'a link'));
$box2->AddChild(new RTK_Box(null, 'clearfix'));
$box3 = new RTK_Box(null, 'subtest3');
$list = new RTK_ListView(array('woop', 'test', 'wahoo', 'pebkac', 'kesmit'));
$list->AddRow(array('1111', '1111', '1111', '1111', '1111'));
$list->AddRow(array('2222', '2222', '2222', '2222', '2222'));
$list->AddRow(array('3333', '3333', '3333', '3333', '3333'));
$box3->AddChild($list);
$box4 = new RTK_Box(null, 'subtest4');
$form = new RTK_Form('testform');
$form->AddText($text2 . $text3);
$form->AddHiddenField('supersecret', 2);
$form->AddTextField('pfffth', 'Pfft!');
$form->AddTextField('pfffth', 'Pfft!');
$form->AddTextField('pfffth', 'Pfft!');
$form->AddTextField('pfffth', 'Pfft!');
$form->AddTextField('pfffth', 'Pfft!');
$form->AddFileUpload('pffile', 'Phajl!');
$form->AddTextField('pfffffffth', 'Pffffft!', null, 5);
$form->AddPasswordField('passw0rds', 'A password: '******'chk_salmon', 'Has salmon: ', true, 'salmon');
$form->AddRadioButtons('rad_options', '_buttons: ', array(array('opt_1', 'fisk'), 'opt_2', array('opt_3', 'ikkefisk')), 'opt_2');
$form->AddDropDown('DROP', 'daun', array(array('opt_1', 'fisk'), 'opt_2', array('opt_3', 'ikkefisk')), 'opt_3');
$form->AddElement('custom', 'Custom "input": ', new RTK_Image('/imgtest.png', 'bleh', array('customarg1' => 'nisser')));
$form->AddButton('submit2', 'Submit2!');
$box4->AddChild($form);
$box4->AddChild(new RTK_Box(null, 'clearfix'));
$box1->AddChild($box2);
$box1->AddChild($box3);
$box1->AddChild($box4);
$RTK->AddElement($box1);
Exemple #2
0
$box2 = new RTK_Box(null, 'subtest1');
$box2->AddChild(new RTK_Header("Create a recipe"));
$box2->AddChild(new RTK_Textview($text1, true));
$box2->AddChild(new RTK_Box(null, 'clearfix'));
$box3 = new RTK_Box(null, 'subtest3');
$items = array();
$items[] = array('0', 'fisk');
$items[] = array('1', 'ost');
$items[] = array('2', 'ikkefisk');
$box4 = new RTK_Box(null, 'subtest4');
$form = new RTK_Form('testform');
$form->AddTextField('title', 'Recipe title:');
$form->AddTextField('description', 'Description:', null, 5);
$form->AddDropDown('type', 'Type:', $items, $items[2][0]);
$form->AddFileUpload('imagepath', 'Image: ');
$form->AddButton('Submit', 'Submit recipe');
$box4->AddChild($form);
$box4->AddChild(new RTK_Box(null, 'clearfix'));
$box1->AddChild($box2);
$box1->AddChild($box3);
$box1->AddChild($box4);
$RTK->AddElement($box1);
//$recipeId = "1";
if (Value::SetAndNotNull($_POST, 'Submit')) {
    $imagepath = Site::GetPostValueSafely("imagepath");
    $title = Site::GetPostValueSafely("title");
    $type = Site::GetPostValueSafely("type");
    $description = Site::GetPostValueSafely("description");
    //$image = new Image($imagepath);
    //$image->Save();
    $recipe = new Recipe($title, $type, $description, $imagepath);
Exemple #3
0
// Handle the login
if (!Login::IsLoggedIn() && Site::CheckSecurityToken()) {
    if (Login::TryToLogin()) {
        Site::BackToHome();
    }
}
// Page Output
include_once 'Pages/OnAllPages.php';
$RTK->AddJavascript('/jquery-2.1.4.min.js');
$RTK->AddJavascript('/login.js');
if (Login::GetError() != EMPTYSTRING) {
    $RTK->AddElement(new RTK_Textview(Login::GetError()));
}
$loginbox = new RTK_Box('loginbox');
if (Login::IsLoggedIn()) {
    // If a user is logged in
    $loginbox->AddChild(new RTK_Textview('You are logged in as: ' . Login::GetUsername()));
    $loginbox->AddChild(new RTK_Link('Logout' . URLPAGEEXT, 'click here for log out', true));
} elseif (Site::HasHttps()) {
    // If a user is not logged in, but the site is running secure
    $loginform = new RTK_Form('loginform', EMPTYSTRING, 'POST');
    $loginform->AddTextField('loginname', 'Username:'******'loginpass', 'Password:'******'submit', 'log in');
    $loginbox->AddChild($loginform);
} else {
    // If a user is not logged in, and the site is not running secure
    $loginbox->AddChild(new RTK_Textview('You are not running secure and therefore cannot be allowed to log in.'));
    $loginbox->AddChild(new RTK_Link('Login' . URLPAGEEXT, 'click here for encrypted login', true));
}
$RTK->AddElement($loginbox);
    Site::ValidatePassword($password, $password2, $errors);
    Site::ValidateEmail($email, $errors);
    Site::ValidatePhoneNo($telNo, $errors);
    if (sizeof($errors) == 0) {
        $user = new User();
        $user->create($userName, $password, $firstName, $lastName, $email, $telNo);
        $user->save();
        Site::BackToHome();
    } else {
        $errors = implode('<br />', $errors);
    }
}
// Page Output
include_once 'Pages/OnAllPages.php';
$RTK->AddJavascript('jquery-2.1.4.min.js');
$RTK->AddJavascript('login.js');
$RTK->AddElement(new RTK_Header("Create User"));
$RTK->AddElement(new RTK_Textview("Please fill out this form to recieve your very own user account at our magnificent site.\n" . "Please note however that we have a few rules. For instance: Usernames have to be at least 5 characters long.\n" . "Passwords have to be at least 8 characters long, and must contain numbers as well as both lower and upper case letters."));
$form = new RTK_Form("createUserForm");
$form->AddTextField("UserName", "User Name", $userName);
$form->AddPasswordField("Password", "Password");
$form->AddPasswordField("Password2", "Password repeat");
$form->AddTextField("FirstName", "First Name", $firstName);
$form->AddTextField("LastName", "Last Name", $lastName);
$form->AddTextField("email", "Email", $email);
$form->AddTextField("telNo", "Phone No", $telNo);
$form->AddButton("Submit", "Create my user account");
$RTK->AddElement($form);
if ($errors != null) {
    $RTK->AddElement(new RTK_Textview($errors));
}