function commentform($pageid) { //global $session; $process = new ProcessForm(); $validate = $process::validate(); $postcomment = new Table("Comments"); //Process Page Form if ($process->submitForm()) { /*@setting validation rules*/ $required = array("name", "comment"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_requiredFields($required)); $massage = $process->message("Comment has been successfully submmited."); //$sucessmsg = $_REQUEST["msg"]=$massage; if ($process->successflag) { //put database table here $postcomment::$tablefields = array("Name" => $process->post("name"), "Comment" => $process->post("comment"), "Pageid" => $pageid); /*saved to database*/ $postcomment->save(); //echo "new recored was added with id=".$postcomment->lastInsertedId(); //echo "<br> success happened and all fields are sent to database, Thank you ! :)"; } } $form = new Form("commentform", filter_var($_SERVER['PHP_SELF']) . "?" . filter_var($_SERVER['QUERY_STRING']), "post"); //Company; $form->startForm(); $form->setFormField("", $form->addFormInfo("<h2>Comment Form</h2>")); //Page Title $form->setFormField($form->inputLabel("name", "*Name"), $form->inputField("text", "name", $process->post("name")), $validate->displayErrorField($process->errorinfo, "name")); // Page Content $form->setFormField($form->inputLabel("comment", "*Comment (HTML is not allowed)"), $form->textAreaField("comment", $process->post("comment"), 10, 45, 'placeholder="Type comment here"'), $validate->displayErrorField($process->errorinfo, "comment")); //Submit Form $form->setFormField(null, $form->inputField("hidden", "userid", $process->post("userid", $authorid = "")) . $form->inputField("submit", "submit", "Add Comment")); $form->endForm(); return $form->DisplayFields($GLOBALS["form_labling"], $process->message); }
function changePassword() { //put contents here include_once "../includes/admin_init.php"; $process = new ProcessForm(); $validate = $process::validate(); $postdata = new User("users"); $id = $postdata::$id = isset($GLOBALS["id"]) ? "Id=" . $GLOBALS["id"] : null; //id recieved form querystring if ($process->submitForm()) { /*@setting validation rules*/ $required = array("old_password", "new_password"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_requiredFields($required)); $process->errorinfo = array_merge($process->errorinfo, $validate->check_PasswordFields("new_password", "cpassword")); //$process->message("Hey successfully submmited the form"); $linkto = GenerateUrl::buildLink("../auth", ".", "Login"); $process->message("Your password was successfully changed, please you can {$linkto} now."); if ($process->successflag) { //echo "success happened and all fields are sent to database, Thank you ! :)"; $oldpass = isset($_POST["old_password"]) ? md5($_POST["old_password"]) : null; $getrow = $postdata::fieldExists("Password={$oldpass}"); var_dump($getrow); if ($getrow != null) { $postdata::$id = isset($GLOBALS["id"]) ? "Id=" . $GLOBALS["id"] : null; $postdata::$tablefields = array("Password" => md5($_POST["new_password"])); $postdata->save(); } } } $querystr = isset($_SERVER['QUERY_STRING']) ? "?" . $_SERVER['QUERY_STRING'] : null; $form = new Form("changepass", $_SERVER['PHP_SELF'] . $querystr, "post", "enctype=\"application/x-www-form-urlencoded\"\n"); $form->startForm(); //form heading $form->setFormField(null, $form->addFormInfo("<h2>Change My Password</h2>")); //Password $form->setFormField($form->inputLabel("Old password", "*Old Password"), $form->inputField("password", "old_password", $process->post("old_password")), $validate->displayErrorField($process->errorinfo, "old_password")); //Password $form->setFormField($form->inputLabel("new_password", "*New Password"), $form->inputField("password", "new_password", $process->post("new_password")), $validate->displayErrorField($process->errorinfo, "new_password")); $form->setFormField($form->inputLabel("cpassword", "*Confirm Password"), $form->inputField("password", "cpassword", $process->post("cpassword")), $validate->displayErrorField($process->errorinfo, "cpassword")); //checks submit type $form->setFormField(null, $form->inputField("submit", "change", "Change My Password")); $form->endForm(); return $form->DisplayFields($GLOBALS["form_labling"], $process->message); }
function businessdirform() { //put contents here //include_once"../../includes/initialize.inc.php"; $process = new ProcessForm(); $validate = $process::validate(); if (isset($GLOBALS["action"]) == "edit") { //$id = $GLOBALS["id"]; //$editbiz = BusinessDirectory::findById($id); } if ($process->submitForm()) { /*@setting validation rules*/ $required = array("company", "address", "website", "email_address", "location", "cellphone", "business_description"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_requiredFields($required)); $check_invalidchars = array("company", "address", "website", "location", "description"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_invalidChars($check_invalidchars)); $requiredlen = array("company" => 80, "address" => 50, "website" => 255, "location" => 50, "phone" => 15); $process->errorinfo = array_merge($process->errorinfo, $validate->check_FieldLength($requiredlen)); $selectedindex = array("category" => "--Select Category--", "region" => "--Select Region--"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_selectField($selectedindex)); $process->errorinfo = array_merge($process->errorinfo, $validate->check_number("cellphone", "phone")); $process->errorinfo = array_merge($process->errorinfo, $validate->check_number("fax", "phone")); //Sucess $process->message("Hey successfully submmited the form"); if ($process->successflag) { echo "success happened and all fields are sent to database, Thank you ! :)"; //put database table here } } $form = new Form("Addbusiness", $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'], "post", "enctype=\"application/x-www-form-urlencoded\"\n"); //Company); $form->startForm(); $form->setFormField("", $form->addFormInfo("<h2>Use this form to add Bussiness Profiles..</h2>")); $form->setFormField($form->inputLable("company", "Company"), $form->inputField("text", "company", $process->post("company")), $validate->displayErrorField($process->errorinfo, "company")); //Category $bizcategory = function () { $category = new GetTableRecord("bizcategory"); $category_options = $category::findAllRecords(); $options[] = "--Select Category--"; foreach ($category_options as $opt) { $options[] = $opt->Category; } return $options; }; //$category_options = array('--Select Category--',"IT"); $form->setFormField($form->inputLable("category", "Category"), $form->selectOptions("category", $bizcategory(), $process->post("category")), $validate->displayErrorField($process->errorinfo, "category")); //Location Address $form->setFormField($form->inputLable("address", "Address"), $form->textAreaField("address", $process->post("address"), "2", "20"), $validate->displayErrorField($process->errorinfo, "address")); //Regions, this fn returns db object into an array $regions = function () { $region = new GetTableRecord("Regions"); $region_options = $region::findAllRecords(); $options[] = "--Select Region--"; foreach ($region_options as $opt) { $options[] = $opt->Region; } return $options; }; $form->setFormField($form->inputLable("region", "Region"), $form->selectOptions("region", $regions(), $process->post("region")), $validate->displayErrorField($process->errorinfo, "region")); //Website Address $form->setFormField($form->inputLable("website", "Website (URL)"), $form->inputField("url", "website", $process->post("website")), $validate->displayErrorField($process->errorinfo, "website")); //Email Address $form->setFormField($form->inputLable("email", "Email"), $form->inputField("email", "email_address", $process->post("email_address")), $validate->displayErrorField($process->errorinfo, "email_address")); // Location Address $form->setFormField($form->inputLable("location", "Location"), $form->inputField("text", "location", $process->post("location")), $validate->displayErrorField($process->errorinfo, "location")); //Cellphone $form->setFormField($form->inputLable("cellphone", "Cellphone"), $form->inputField("tel", "cellphone", $process->post("cellphone")), $validate->displayErrorField($process->errorinfo, "cellphone")); //Fax $form->setFormField($form->inputLable("fax", "Fax (Optional)"), $form->inputField("tel", "fax", $process->post("fax")), $validate->displayErrorField($process->errorinfo, "fax")); // Business Description $form->setFormField($form->inputLable("business_description", "Business Description"), $form->textAreaField("business_description", $process->post("business_description"), "10", "40"), $validate->displayErrorField($process->errorinfo, "business_description")); //Submit Form $form->setFormField(null, $form->inputField("submit", "send", "Add Bussiness Directory")); $form->endForm(); return $form->DisplayFields($GLOBALS["form_labling"], $process->message); }
function categoryForm() { //put contents here $process = new ProcessForm(); $validate = $process::validate(); $postdata = new Table("pagecategory"); if ($GLOBALS["action"] == "editpgcate") { $postdata::$id = "Id=" . $GLOBALS["id"]; $editcate = $postdata::findRow($postdata::$id); $category = $editcate->Category; $visible = $editcate->Visible; $position = $editcate->Position; } else { $category = ""; $visible = ""; $position = ""; } if ($process->submitForm()) { /*@setting validation rules*/ $required = array("category"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_requiredFields($required)); $check_invalidchars = array("category"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_invalidChars($check_invalidchars)); $requiredlen = array("category" => 30); $process->errorinfo = array_merge($process->errorinfo, $validate->check_FieldLength($requiredlen)); $selectedindex = array("position" => "--Select Menu Position--"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_selectField($selectedindex)); $process->message("category has been successfully submmited."); if ($process->successflag) { //echo "success happened and all fields are sent to database, Thank you ! :)";// $postdata::$tablefields = array("Category" => $_POST["category"], "Position" => $_POST["position"], "Visible" => $_POST["visible"]); $postdata->save(); } } $form = new Form("sitenavform", $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'], "post", "enctype=\"application/x-www-form-urlencoded\"\n"); //Company $form->startForm(); $form->setFormField("", $form->addFormInfo("<p>" . GenerateUrl::buildLink(".", "dashboard.php", "«Back to Sammary Page", "action=view,target=managesite") . "</p>" . "<h2>Use this form to add new page category.</h2><p>Required Fields are labelled with asterics (*)<hr/>")); //Category $form->setFormField($form->inputLabel("category", "*Category Name"), $form->inputField("text", "category", $process->post("category", $category)), $validate->displayErrorField($process->errorinfo, "category")); //Position $cateposition = function () { $getposition = new Table("sitemenu"); $position_options = $getposition::findAllRecords("ORDER BY Id ASC"); foreach ($position_options as $opt) { $options[0] = "--Select Menu Position--"; $options[$opt->Position] = $opt->Nav_name; } return $options; }; $form->setFormField($form->inputLabel("position", "*Menu Position"), $form->selectOptions("position", $cateposition(), $process->post("position", $position)), $validate->displayErrorField($process->errorinfo, "position")); //Radio for Visible// $form->setFormField($form->inputLabel("visible", "Menu Visibility"), $form->radioButton("Yes", "visible", "Y", $process->post("visible", $visible) == "Y" ? true : false) . $form->radioButton("No", "visible", "N", $process->post("visible", $visible) == "N" ? true : false)); //Submit Form// $form->setFormField(null, $form->inputField("submit", "send", "Save")); $form->endForm(); return $form->DisplayFields($GLOBALS["form_labling"], $process->message); }
function register() { //put contents here include_once "../includes/admin_init.php"; $process = new ProcessForm(); $validate = $process::validate(); $postdata = new User("users"); $id = $postdata::$id = isset($GLOBALS["id"]) ? "Id=" . $GLOBALS["id"] : null; //id recieved form querystring if ($GLOBALS["action"] == "editregister") { $edit = $postdata::findRow($id); // $firstname = $edit->Firstname; $lastname = $edit->Lastname; $gender = $edit->Gender; $username = $edit->Username; $email = $edit->Email; } else { $firstname = ""; $lastname = ""; $gender = ""; $username = ""; $password = ""; $email = ""; } if ($process->submitForm()) { /*@setting validation rules*/ $required = array("firstname", "lastname", "gender", "username", "email_address"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_requiredFields($required)); $check_invalidchars = array("firstname", "lastname", "username"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_invalidChars($check_invalidchars)); $requiredlen = array("firstname" => 50, "lastname" => 50, "username" => 50); $process->errorinfo = array_merge($process->errorinfo, $validate->check_FieldLength($requiredlen)); //$selectedindex = $setuserlevel==true?array("gender"=>"--Select Gender--","ulevel"=>"--Select User Level--"):array("gender"=>"--Select Gender--"); //$process->errorinfo = array_merge($process->errorinfo,$validate->check_selectField($selectedindex)); if ($_POST) { $getrow = $postdata::fieldExists("Username={$_POST["username"]}"); //$uservalidate = (isset($_POST["username"]))?$getrow->Username:null; if ($getrow != null) { $process->errorinfo["username"] = $_POST["username"] . " already a users, try anther username please"; } } if ($GLOBALS["action"] == "register" || $GLOBALS["action"] == "adduser") { array_push($required, "password"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_requiredFields($required)); $process->errorinfo = array_merge($process->errorinfo, $validate->check_PasswordFields("password", "cpassword")); } //Sucess //$process->message("Hey successfully submmited the form"); $linkto = GenerateUrl::buildLink("../auth", ".", "Login"); $process->message("Your registeration was successfully, please you can {$linkto} now."); if ($process->successflag) { //echo "success happened and all fields are sent to database, Thank you ! :)"; $postdata::$tablefields = array("Firstname" => $_POST["firstname"], "Lastname" => $_POST["lastname"], "Gender" => $_POST["gender"], "Username" => $_POST["username"], "Email" => $_POST["email_address"], "Password" => md5($_POST["password"])); $postdata->save(); } } $querystr = isset($_SERVER['QUERY_STRING']) ? "?" . $_SERVER['QUERY_STRING'] : null; $form = new Form("Register", $_SERVER['PHP_SELF'] . $querystr, "post", "enctype=\"application/x-www-form-urlencoded\"\n"); $form->startForm(); //form heading if ($GLOBALS["action"] == "editregister") { $form->setFormField(null, $form->addFormInfo("<h2>Edit your profile ..</h2>")); } elseif ($GLOBALS["action"] == "edituser") { $form->setFormField(null, $form->addFormInfo("<h2>Edit User Account</h2>")); } else { $form->setFormField(null, $form->addFormInfo("<h2>Use this form to add register new users..</h2>")); } //FIrstname $form->setFormField($form->inputLabel("firstname", "Firstname"), $form->inputField("text", "firstname", $process->post("firstname", $firstname)), $validate->displayErrorField($process->errorinfo, "firstname")); //Lastname $form->setFormField($form->inputLabel("lastname", "Lastname"), $form->inputField("text", "lastname", $process->post("lastname", $lastname)), $validate->displayErrorField($process->errorinfo, "lastname")); //gender $gender_options = array("--Select Gender--", "M" => "Male", "F" => "Female"); $form->setFormField($form->inputLabel("gender", "Gender"), $form->selectOptions("gender", $gender_options, $process->post("gender", $gender)), $validate->displayErrorField($process->errorinfo, "gender")); //Username $form->setFormField($form->inputLabel("username", "Username"), $form->inputField("text", "username", $process->post("username", $username)), $validate->displayErrorField($process->errorinfo, "username")); //Email Address $form->setFormField($form->inputLabel("email", "Email"), $form->inputField("email", "email_address", $process->post("email_address", $email)), $validate->displayErrorField($process->errorinfo, "email_address")); //checks userlevel //if in edit mode if ($GLOBALS["action"] != "editregister") { //Password $form->setFormField($form->inputLabel("password", "Password"), $form->inputField("password", "password", $process->post("password")), $validate->displayErrorField($process->errorinfo, "password")); $form->setFormField($form->inputLabel("cpassword", "Confirm Password"), $form->inputField("password", "cpassword", $process->post("cpassword")), $validate->displayErrorField($process->errorinfo, "cpassword")); } //Submit Form $hyperlink = GenerateUrl::buildLink("..", ".", "Terms and Conditions of use", "target=terms.html"); //checks submit type if ($GLOBALS["action"] == "editregister") { $form->setFormField(null, $form->inputField("submit", "send", "Update My Profile ")); } else { $form->setFormField(null, $form->addFormInfo("<strong role=\"agreement\">By Clicking on Register you Agree to our {$hyperlink}.</strong>")); $form->setFormField(null, $form->inputField("submit", "send", "Register")); } $form->endForm(); return $form->DisplayFields($GLOBALS["form_labling"], $process->message); }
if ($process->submitForm()) { $required = array("firstname", "lastname", "username", "email"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_requiredFields($required)); $check_invalidchars = array("firstname", "lastname", "username"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_invalidChars($check_invalidchars)); $requiredlen = array("firstname" => 50, "lastname" => 50, "username" => 30); $process->errorinfo = array_merge($process->errorinfo, $validate->check_FieldLength($requiredlen)); $selectedindex = array("gender" => "--Select Your Gender--"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_selectField($selectedindex)); //validate password array_push($required, "password"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_PasswordLength(array("password" => 6))); $process->errorinfo = array_merge($process->errorinfo, $validate->check_requiredFields($required)); $process->errorinfo = array_merge($process->errorinfo, $validate->check_PasswordFields("password", "cpassword")); /** Insert Data into Database **/ $process->message("You have successfully registered {$process->post("firstname")}"); if ($process->successflag) { echo "<p style='background:white;text-align:center'>Hooray your form is ready to be inserted into the database :)</p>"; //echo "Form_submitted - ".$process->post("firstname"); //$rec::$tablefields = array('fieldname1'=>'?','fieldname2'=>'?',...); //array("firstname","lastname","gender","username","email","password","cpassword",); //$sql = $query->getTable("users"); // $result = $query->tablefields = array('fieldname1'=>'?','fieldname2'=>'?'); // return parent::setData($key,$result); } } $form = new BuildForm("signupform", filter_var($_SERVER["PHP_SELF"]), "post"); $form->form_heading = $form->formHtml("<h2>User Sign Up Form </h2>"); //First name $form->createInputField(array("label" => "*Firstname", "type" => "text", "name" => "firstname", "value" => "", "optionalattr" => "class=\"forminput\" placeholder=\"Enter Firstname\""), $validate->displayErrorField($process->errorinfo, "firstname")); //Last name $form->createInputField(array("label" => "*Lastname", "type" => "text", "name" => "lastname", "value" => "", "optionalattr" => "class=\"forminput\" placeholder=\"Enter Lastname\""), $validate->displayErrorField($process->errorinfo, "lastname"));
$process->errorinfo = array_merge($process->errorinfo, $validate->check_number("fax", "phone")); //sucess $process->message("Hey successfully submmited the form"); if ($process->successflag) { echo "success happened and all fields are sent to database, Thank you ! :)"; //put database table here } } //Create form //array("company","address","website","location","cellphone","fax","description"); // $process->successmsg ="Hey successfully submmited the form"; echo $process->message(); //if(strlen(@$msg) > 0) echo "<p class=\"error\">".$msg."</p>"; $form->startForm("Addbusiness", $_SERVER['PHP_SELF'], "post", "enctype=\"application/x-www-form-urlencoded\"") . "\n"; //Company $form->setFormField($form->inputLable("company", "Company"), $form->inputField("text", "company", $process->post("company")), $validate->displayErrorField($process->errorinfo, "company")); //Category $category_options = array('--Select Category--', "IT"); $form->setFormField($form->inputLable("category", "Category"), $form->selectOptions("category", $category_options, $process->post("category")), $validate->displayErrorField($process->errorinfo, "category")); //Location Address $form->setFormField($form->inputLable("address", "Address"), $form->textAreaField("address", $process->post("address"), "2", "20"), $validate->displayErrorField($process->errorinfo, "address")); //Region $region_options = array('--Select Region--', "GT"); $form->setFormField($form->inputLable("region", "Region"), $form->selectOptions("region", $region_options, $process->post("region")), $validate->displayErrorField($process->errorinfo, "region")); //Website Address $form->setFormField($form->inputLable("website", "Website (URL)"), $form->inputField("url", "website", $process->post("website")), $validate->displayErrorField($process->errorinfo, "website")); //Email Address $form->setFormField($form->inputLable("email", "Email"), $form->inputField("email", "email_address", $process->post("email_address")), $validate->displayErrorField($process->errorinfo, "email_address")); // Location Address $form->setFormField($form->inputLable("location", "Location"), $form->inputField("text", "location", $process->post("location")), $validate->displayErrorField($process->errorinfo, "location")); //Cellphone
function pageform() { global $session; $process = new ProcessForm(); $validate = $process::validate(); $postdata = new Page("pages"); $user = new User("users"); $uid = $user::findRow("Id={$session->userid}"); //change this to login session id when login is activated $id = $postdata::$id = isset($GLOBALS["id"]) ? "Id=" . $GLOBALS["id"] : null; //id recieved form querystring if ($GLOBALS["action"] == "editpage") { $edit = $postdata::findRow($id); // $title = $edit->Title; $category = $edit->Position; $source = $edit->Source; $pgcontent = $edit->Content; $published = $edit->Published; $featured = $edit->Featured; $authorid = $uid->Id; //image to upload $pgimage = ""; $imgcaption = ""; } else { $title = ""; $category = ""; $source = ""; $pgcontent = ""; $published = ""; $featured = ""; $authorid = $uid->Id; //image to upload $pgimage = ""; $imgcaption = ""; //debug($authorid); } //Process Page Form //Process Image Uploads here $upload_path = "../"; $upload = new UploadFiles($upload_path . PAGEIMG_DIR, $upload_path . TEMP_DIR); if ($process->submitForm()) { /*@setting validation rules*/ $upload->Mimetype = array('image/pjpeg' => "jpeg", 'image/jpeg' => "jpeg", 'image/png' => "png", 'image/gif' => "gif"); $required = array("title", "page_content", "source"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_requiredFields($required)); $check_invalidchars = array("title", "source"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_invalidChars($check_invalidchars)); $requiredlen = array("title" => 100); $process->errorinfo = array_merge($process->errorinfo, $validate->check_FieldLength($requiredlen)); $selectedindex = array("category" => "--Select Category--"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_selectField($selectedindex)); if ($id == null) { $getrow = $postdata::fieldExists("Title={$_POST["title"]}"); if ($getrow) { $process->errorinfo["title"] = $_POST["title"] . " already exist"; } } /* upload info on validation ,//Sucess*/ $massage = $process->message("Page has been successfully submmited."); if ($process->successflag) { //put database table here $postdata::$tablefields = array("Title" => $_POST["title"], "Content" => $_POST["page_content"], "Source" => $_POST["source"], "Postedby" => $_POST["authorid"], "Position" => $_POST["category"], "Published" => $_POST["publish"], "Featured" => $_POST["feature"]); /*saved to database*/ $postdata->save(); //echo "new recored was added with id=".$postdata->lastInsertedId(); //echo "<br> success happened and all fields are sent to database, Thank you ! :)"; /*uploads info*/ $upload->uploadFile("uploadimg"); //upolads an image if ($upload->Upload_status == true) { $postimg = new Image("pageimgs"); $pageid = $id != null ? $id : $postdata->lastInsertedId(); $postimg::$tablefields = array("Imgname" => $upload->Newfilename, "Width" => $upload->Width, "Height" => $upload->Height, "Imgcaption" => $_POST["imgcaption"], "Mimetype" => $upload->Filetype, "Extention" => $upload->File_ext, "Pageid" => $pageid); //check and delete old image record in pageimg table $pid = $postimg->findRow("Pageid=" . $pageid); if ($pid != null) { //if(file_exists($upload_path.PAGEIMG_DIR.$pid->Imgname.".".$pid->Extention)){ $upload->deleteFile($upload_path . PAGEIMG_DIR . $pid->Imgname . "." . $pid->Extention); $upload->deleteFile($upload_path . PAGEIMG_DIR . "thumbnails/" . $pid->Imgname . "." . $pid->Extention); } // } $postimg->save(); } } //upload image } $form = new Form("Pageform", filter_var($_SERVER['PHP_SELF']) . "?" . filter_var($_SERVER['QUERY_STRING']), "post", "enctype=\"multipart/form-data\"\n"); //Company; $form->startForm(); $form->setFormField("", $form->addFormInfo("<h2>Use this form add new Page..</h2><p>Required Fields are labelled with asterics (*)</p><hr/>")); //Page Title $form->setFormField($form->inputLabel("title", "*Title"), $form->inputField("text", "title", $process->post("title", $title)), $validate->displayErrorField($process->errorinfo, "title")); //Category $pgcategory = function () { $category = new GetTableRecord("pagecategory"); $category_options = $category::findAllRecords(); $options[] = "--Select Category--"; foreach ($category_options as $opt) { $options[$opt->Position] = $opt->Category; } return $options; }; $form->setFormField($form->inputLabel("category", "*Category"), $form->selectOptions("category", $pgcategory(), $process->post("category", $category)), $validate->displayErrorField($process->errorinfo, "category")); //Page Source $form->setFormField($form->inputLabel("source", "*Source"), $form->inputField("text", "source", $process->post("source", $source)), $validate->displayErrorField($process->errorinfo, "source")); // Page Content $form->setFormField($form->inputLabel("page_content", "*Content"), $form->textAreaField("page_content", $process->post("page_content", $pgcontent), "10", "50", "class=\"ckeditor\""), $validate->displayErrorField($process->errorinfo, "page_content")); //Upload Image $form->setFormField($form->inputLabel("uploadimg", "Upload Image"), $form->uploadField("uploadimg[]", "uploadimg") . "<br>" . $form->textAreaField("imgcaption", $process->post("imgcaption", $imgcaption), "1", "45", 'placeholder="Image Caption"') . $form->inputField("hidden", "MAX_FILE_SIZE", "40000000"), $validate->displayErrorField($process->errorinfo, "uploadimg")); //Radio for Visible/ $form->setFormField($form->inputLabel("publish", "Publish"), $form->radioButton("Yes", "publish", "Y", $process->post("publish", $published) == "Y" ? true : false) . $form->radioButton("No", "publish", "N", $process->post("publish", $published) == "N" ? true : false)); //Featured Page $form->setFormField($form->inputLabel("feature", "Feature"), $form->radioButton("Yes", "feature", "Y", $process->post("feature", $featured) == "Y" ? true : false) . $form->radioButton("No", "feature", "N", $process->post("feature", $featured) == "N" ? true : false)); //Submit Form $form->setFormField(null, $form->inputField("hidden", "authorid", $process->post("authorid", $authorid)) . $form->inputField("submit", "send", "Save")); $form->endForm(); return $form->DisplayFields($GLOBALS["form_labling"], $process->message); }