示例#1
0
 public function getForm()
 {
     $strMaxLength = "Your input is too long. Maximum length is %s";
     $strMinLength = "Your input is too short. Minimum length is %s";
     $strRequired = "This field is required.";
     $objForm = new ValidForm("installForm");
     $objForm->setMainAlert("One or more errors occured. Check the marked fields and try again.");
     $objForm->addFieldset("CMS type", NULL, "PunchCMS can be installed for a single website or multiple websites at once.");
     $objForm->addField("single_instance", "Single website", VFORM_BOOLEAN);
     $objForm->addFieldset("Administrator settings", NULL, "This is the account for the admin area. Later you can create an admin per website.");
     $objForm->addField("username", "Username", VFORM_STRING, array("maxLength" => 255, "required" => true), array("maxLength" => $strMaxLength, "required" => $strRequired, "type" => "Enter only letters and spaces."));
     $objForm->addField("passwd", "Password", VFORM_PASSWORD, array("maxLength" => 255, "required" => true), array("maxLength" => $strMaxLength, "required" => $strRequired, "type" => "Enter only letters and numbers."));
     $objForm->addField("email", "Email address", VFORM_EMAIL, array("maxLength" => 32, "required" => true), array("maxLength" => $strMaxLength, "required" => $strRequired, "type" => "Use the format name@domain.extension."), array("tip" => "This address will be used as the sender address for password reminders."));
     $objForm->addFieldset("MySQL settings", NULL, "The database and user must already exist, otherwise the installation will fail.");
     $objForm->addField("db_server", "Server address", VFORM_STRING, array("maxLength" => 255, "required" => true), array("maxLength" => $strMaxLength, "required" => $strRequired, "type" => "Enter the address of the MySQL server."), array("default" => "localhost"));
     $objForm->addField("db_name", "Database name", VFORM_STRING, array("maxLength" => 255, "required" => true), array("maxLength" => $strMaxLength, "required" => $strRequired, "type" => "Enter the name of the designated database."), array("default" => "punchcms"));
     $objForm->addField("db_username", "Username", VFORM_STRING, array("maxLength" => 255, "required" => true), array("maxLength" => $strMaxLength, "required" => $strRequired, "type" => "Enter the username for the database."));
     $objForm->addField("db_passwd", "Password", VFORM_PASSWORD, array("maxLength" => 32, "required" => false), array("maxLength" => $strMaxLength, "type" => "Enter the password for the database."));
     $objForm->setSubmitLabel("Submit");
     return $objForm;
 }