当前位置: 首页>>代码示例>>PHP>>正文


PHP HTML_QuickForm::toHtml方法代码示例

本文整理汇总了PHP中HTML_QuickForm::toHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm::toHtml方法的具体用法?PHP HTML_QuickForm::toHtml怎么用?PHP HTML_QuickForm::toHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTML_QuickForm的用法示例。


在下文中一共展示了HTML_QuickForm::toHtml方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

    public function execute() {

       	$request = $this->getContext()->getRequest();

    	$postLoginUser = $request->getParameter('user');
    	$postLoginId = $postLoginUser['id'];

    	$id = $request->getParameter('id');

		$login = $this->getContext()->getUser()->getAttribute('Login');
    	$loginRole = $this->getLoginRole();

    	if ($loginRole == 'editor'){
    		if ($id != $login->id && $postLoginId != $login->id){

				$this->log("Unauthorized attempt edit login record. Login id: $id, user name: ". $login->name);
    					
    			$this->getContext()->getController()->forward('Default', "Secure");	
    		}
    	}

//    	$this->checkAdminAuth();

		if($request->getParameter('cancel')) {

			if ($loginRole == 'admin'){
				$this->getContext()->getController()->forward('Default', "ListLogin");
			} else {
				header("Location:Search?searchFor=Member");
			}

			return View::NONE;
		}
        
    	$form = new HTML_QuickForm("loginForm", 'post');

    	$loginDao = new BaseDao("Login");

		$affDao = new BaseDao("Affiliate"); 

    	if ($id){
    		$user = $loginDao->get($id);	

			$this->log("Editing login: ".$user->login." ,name: ".$user->name);
			$this->log("Editing login: ".$user->login." ,name: ".$user->name, true);

    		$affiliate = $affDao->getPattern();
    		$affiliate->editor = $user->id;
			$currentAffs = $affDao->search($affiliate);
			$affIds = $this->getListOfCertainFieldValues($currentAffs, 'id');

    		$form->setDefaults(array('user' => (array) $user, 
    								 "password2" => $user->password,
    								 "affiliates" => $affIds));
    	} else{
			$this->log("Creating new login.", true);

	    	$user = $loginDao->getPattern();
    	}

		$request->setAttribute('user', $user);

		$roleDao = new BaseDao("Role"); 
		$roles = $this->prepareDropdown($roleDao->search(), 'id', 'name');

		$affs = $this->prepareDropdown($affDao->searchWhereWithOrder($affDao->getPattern(), "1=1", 'name'), 'id', 'name');

		$form->addElement("text", "user[name]", "Name:", array('size' => 50, "maxlength" => 255));
		$form->addElement("text", "user[login]", "Login:", array('size' => 50, "maxlength" => 255));
		$form->addElement("password", "user[password]", "Password:", array('size' => 50, "maxlength" => 255));
		$form->addElement("password", "password2", "Repeat Password:", array('size' => 50, "maxlength" => 255));
		$form->addElement('text', "user[email]", 'Email:', array('size' => 50, "maxlength" => 255));
		$form->addElement('select', "user[roleFid]", "User Role:", $roles);
		$form->addElement('select', "affiliates", "Affiliate:", $affs, array('multiple' => 'multiple', 'id' => "affDropdown") );
		$form->addElement('checkbox', "user[nationalOfficer]", "National Officer:", "", array());

		$element =& $form->getElement("affiliates");
		$element->setSize(5);
		if ($loginRole != 'admin') $element->freeze();

		$form->addElement('hidden', 'user[id]');
		$form->addElement("submit", null, "Save Changes");
		$form->addElement("submit", 'cancel', "Cancel");

		$form->addRule("user[name]", "Please enter your name.", 'required', null);
		$form->addRule("user[login]", "Login can't be blank.", 'required', null);
		$form->addRule("user[password]", "You haven't entered password.", 'required', null);
		$form->addRule("user[email]", "Please enter your email.", 'required', null);
		$form->addRule("user[email]", "Please enter valid email.", 'email', null);

		$form->addFormRule(array(&$this, "validatePassword"));
		$form->addFormRule(array(&$this, "checkEmail"));
		$form->addFormRule(array(&$this, "max5admins"));



		if (!$form->validate()) {

			$request->setAttribute("editLoginForm", $form->toHtml());

//.........这里部分代码省略.........
开发者ID:bobah,项目名称:acbdb,代码行数:101,代码来源:LoginEditAction.class.php

示例2: unserialize

 $frmAdd->addRule('txtTitle', 'You must enter a title.', 'required');
 $frmAdd->addRule('txtTitle', 'The title must be no more than 64 characters long.', 'maxlength', '64');
 $frmAdd->addRule('fleArtwork', 'You must upload an image.', 'uploadedfile');
 $frmAdd->addRule('fleArtwork', 'The file size must not exceed ' . MAX_IMG_KILOBYTES . ' kilobytes.', 'maxfilesize', MAX_IMG_KILOBYTES * ONE_KILOBYTE);
 $frmAdd->addRule('fleArtwork', 'Invalid file format. Only the .JPG extension is allowed.', 'mimetype', unserialize(ARTWORK_ALLOWED_MIME_TYPES));
 $frmAdd->addRule('selGallery', 'You must select a gallery.', 'required');
 /* Try to validate the form. */
 if ($frmAdd->validate()) {
     /* Get the temporary filename of the uploaded file and determine it's dimentions. */
     $tempFilename = $frmAdd->_submitFiles['fleArtwork']['tmp_name'];
     $tempFilenameDimensions = getimagesize($tempFilename);
     /* A limitation of HTML_QuickForm requires the uploaded image dimentions to be validated manually here. */
     if ($tempFilenameDimensions[IMG_WIDTH_INDEX] > MAX_IMG_WIDTH || $tempFilenameDimensions[IMG_HEIGHT_INDEX] > MAX_IMG_HEIGHT) {
         /* The uploaded image is larger than the maximum allowed dimensions. */
         $error = "Image size too large! You tried to upload an image with a width of {$tempFilenameDimensions[IMG_WIDTH_INDEX]} pixels and a height of {$tempFilenameDimensions[IMG_HEIGHT_INDEX]} pixels.";
         $frmAddHtml = $frmAdd->toHtml();
         include 'add.html.php';
         exit;
     }
     if ($tempFilenameDimensions[IMG_WIDTH_INDEX] < THUMBNAIL_WIDTH || $tempFilenameDimensions[IMG_HEIGHT_INDEX] < THUMBNAIL_HEIGHT) {
         /* Catch any uploaded images that are smaller than the thumbnail size. */
         $error = "Image size too small! You must upload an image larger than the thumbnail size of " . THUMBNAIL_WIDTH . " pixels wide by " . THUMBNAIL_HEIGHT . " pixels high.";
         $frmAddHtml = $frmAdd->toHtml();
         include 'add.html.php';
         exit;
     }
     /* This class is used to create a thumbnail from the uploaded image. */
     require_once INCLUDES_PATH . "Thumbnail.class.php";
     /* Generate a unique filename based on the server time and the users ip address. */
     $uniqueFilename = md5(time() . $_SERVER['REMOTE_ADDR']);
     /* Build the artwork and thumb filenames and folder names. */
开发者ID:AdrianBav,项目名称:helenapluskowska,代码行数:31,代码来源:index.php

示例3: returnForm

 /**
  * Returns the HTML code of the form.
  * @return string $return_value HTML code of the form
  */
 public function returnForm()
 {
     $error = false;
     /** @var HTML_QuickForm_element $element */
     foreach ($this->_elements as $element) {
         if (!is_null(parent::getElementError($element->getName()))) {
             $error = true;
             break;
         }
     }
     $returnValue = '';
     $js = null;
     if ($error) {
         $returnValue = Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'warning');
     }
     $returnValue .= $js;
     $returnValue .= parent::toHtml();
     // Add div-element which is to hold the progress bar
     if (isset($this->with_progress_bar) && $this->with_progress_bar) {
         $returnValue .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>';
     }
     return $returnValue;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:27,代码来源:FormValidator.class.php

示例4: define

                $sent_mail = $mail->send();
                if (PEAR::isError($sent_mail)) {
                    $this->registry->Error($sent_mail->getMessage(), 'email failed due to a system error');
                }
                // mail to merchant.
                $mail->setHeaders(array('From' => $user->email, 'To' => $this->ushop->checkout['orders_email']));
                // mail to customer.
                $mail->setRecipients($this->ushop->checkout['orders_email']);
                $sent_mail = $mail->send();
                if (PEAR::isError($sent_mail)) {
                    $this->registry->Error($sent_mail->getMessage(), 'email failed due to a system error');
                }
                // load payment info.
                define('SHOP_STAGE_2', 1);
                require_once 'ushop/checkout/payment/' . $values['payment_method'] . '.php';
            } else {
                //Uthando::go();
            }
        } else {
            $form->addElement('submit', null, 'Submit Order', array('class' => 'button'));
            // Output the form
            $title .= ' - Comfirm Order';
            $this->addContent('<h2>Confirm Order: Step 2 of 3</h2>');
            $this->addContent($this->ushop->displayCartInvoice($_SESSION['user_id']));
            $this->addContent($form->toHtml());
        }
        $this->addContent('</div>');
    } else {
        Uthando::go();
    }
}
开发者ID:shaunfreeman,项目名称:Uthando-CMS,代码行数:31,代码来源:stage2.php

示例5: toHtml

 /**
  * Strip tabs from original toHtml
  */
 function toHtml()
 {
     return preg_replace('/^\\t+/m', '', parent::toHtml());
 }
开发者ID:ajisantoso,项目名称:kateglo,代码行数:7,代码来源:class_form.php

示例6: array

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Simple HTML_QuickForm Example</title>
  </head>
  <body>
    <h1>Simple HTML_QuickForm Example</h1>
<?php 
require_once "HTML/QuickForm.php";
$form = new HTML_QuickForm("", "post", "", "", null, true);
$form->addElement("text", "username", "Username");
$password = $form->addElement("password", "password", "Password");
$password->setValue("");
$buttons = array();
$buttons[] = HTML_QuickForm::createElement("submit", "submitButton", "Send Details");
$buttons[] = HTML_QuickForm::createElement("reset", "resetButton", "Reset Form");
$form->addGroup($buttons, null, null, "&nbsp;");
if ($form->isSubmitted()) {
    echo "<p>Thanks for your details!</p>";
} else {
    echo $form->toHtml();
}
?>
  </body>
</html>
开发者ID:raynaldmo,项目名称:php-education,代码行数:26,代码来源:quickform_example.php

示例7: header

}
if ($mode == 'delete') {
    Wiki::deleteNode($node);
    header("Location: {$_SERVER['SCRIPT_NAME']}");
    exit;
}
if ($mode == 'mail') {
    if (empty($_REQUEST['email'])) {
        include_once "HTML/QuickForm.php";
        include_once "HTML/Template/IT.php";
        $form = new HTML_QuickForm($_SERVER['SCRIPT_NAME'], 'GET');
        $form->addElement('text', 'email', null, 'size="40"');
        $form->addRule('email', 'Please enter email address', 'required', null, 'client');
        $form->addElement('submit');
        $form->addElement('hidden', 'mode', $mode);
        $form_html = $form->toHtml();
        $tpl =& new HTML_Template_IT($template_dir);
        $tpl->loadTemplatefile("mail.tpl");
        $tpl->setVariable("Node", $node);
        $tpl->setVariable("MailForm", $form_html);
        $tpl->show();
        exit;
    } else {
        include_once "Mail.php";
        include_once "Mail/mime.php";
        $html = Wiki::process(Wiki::getNodeContents($node));
        $text = unhtmlentities(strip_tags($html));
        $hdrs = array('From' => $a->getUsername() . '@php.net', 'Subject' => 'PEAR Wiki: ' . Wiki::formatWord($node));
        $mime = new Mail_mime();
        $mime->setTXTBody($text);
        $mime->setHTMLBody($html);
开发者ID:SandyS1,项目名称:presentations,代码行数:31,代码来源:index.php

示例8: return_form

 /**
  * Returns the HTML code of the form.
  * If an element in the form didn't validate, an error message is showed
  * asking the user to complete the form.
  *
  * @return string $return_value HTML code of the form
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, august 2006
  */
 public function return_form()
 {
     $error = false;
     $addDateLibraries = false;
     $dateElementTypes = array('date_range_picker', 'date_time_picker', 'date_picker', 'datepicker', 'datetimepicker');
     /** @var HTML_QuickForm_element $element */
     foreach ($this->_elements as $element) {
         if (in_array($element->getType(), $dateElementTypes)) {
             $addDateLibraries = true;
         }
         if (!is_null(parent::getElementError($element->getName()))) {
             $error = true;
             break;
         }
     }
     $return_value = '';
     $js = null;
     if ($addDateLibraries) {
         /*
                     $js = api_get_js('jquery-ui/jquery-ui-i18n.min.js');
                     $js .= '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'datetimepicker/jquery-ui-timepicker-addon.js" type="text/javascript"></script>';
                     $js .= '<link href="'.api_get_path(WEB_LIBRARY_JS_PATH).'datetimepicker/jquery-ui-timepicker-addon.css" rel="stylesheet" type="text/css" />';
                     $js .= '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'daterange/moment.min.js" type="text/javascript"></script>';
                     $js .= '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'daterange/daterangepicker.js" type="text/javascript"></script>';
                     $js .= '<link href="'.api_get_path(WEB_LIBRARY_JS_PATH).'daterange/daterangepicker-bs2.css" rel="stylesheet" type="text/css" />';
         
                     $isocode = api_get_language_isocode();
                     if ($isocode != 'en') {
                         $js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/datetimepicker/i18n/jquery-ui-timepicker-'.$isocode.'.js" type="text/javascript"></script>';
                         $js .= '<script>
                         $(function(){
                             $.datepicker.setDefaults($.datepicker.regional["'.$isocode.'"]);
                              moment.lang("'.$isocode.'");
                         });
                         </script>';
                     }*/
     }
     if ($error) {
         $return_value = Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'warning');
     }
     $return_value .= $js;
     $return_value .= parent::toHtml();
     // Add div-element which is to hold the progress bar
     if (isset($this->with_progress_bar) && $this->with_progress_bar) {
         $return_value .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>';
     }
     return $return_value;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:57,代码来源:FormValidator.class.php

示例9: die

<?php

// no direct access
defined('PARENT_FILE') or die('Restricted access');
if (!UthandoUser::authorize()) {
    $form = new HTML_QuickForm('reset_password', 'post', '/user/reminder');
    $user_config = new Config($registry, array('path' => $this->registry->ini_dir . '/user/user.ini.php'));
    // Remove name attribute for xhtml strict compliance.
    $form->removeAttribute('name');
    $form->addElement('text', 'email', 'Enter your email address:', array('size' => 20, 'maxlength' => 100, 'class' => 'inputbox'));
    // Add form element rules.
    // email rules.
    $form->addRule('email', 'Please enter your email address', 'required');
    $form->addRule('email', 'Enter a valid email address.', 'email', null, 'server');
    // validate the form or just display it.
    if ($user_config->get('captcha_status', 'reminder') == 'on') {
        require_once 'user/captcha/index.php';
    } else {
        if ($form->validate()) {
            require_once 'user/validate/reminder.php';
        } else {
            $form->addElement('submit', null, 'Send', array('class' => 'button'));
            // Output the form
            $this->content .= $form->toHtml();
        }
    }
}
开发者ID:shaunfreeman,项目名称:Uthando-CMS,代码行数:27,代码来源:reminder.php

示例10: returnForm

 /**
  * Returns the HTML code of the form.
  * @return string $return_value HTML code of the form
  */
 public function returnForm()
 {
     $returnValue = '';
     /** @var HTML_QuickForm_element $element */
     foreach ($this->_elements as $element) {
         $elementError = parent::getElementError($element->getName());
         if (!is_null($elementError)) {
             $returnValue .= Display::return_message($elementError, 'warning') . '<br />';
             break;
         }
     }
     $returnValue .= parent::toHtml();
     // Add div-element which is to hold the progress bar
     if (isset($this->with_progress_bar) && $this->with_progress_bar) {
         $returnValue .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>';
     }
     return $returnValue;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:22,代码来源:FormValidator.class.php


注:本文中的HTML_QuickForm::toHtml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。