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


PHP HTML_QuickForm::addRule方法代码示例

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


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

示例1: getForm

 function getForm()
 {
     if ($this->form) {
         return $this->form;
     }
     $options = array('format' => 'd m Y H i', 'optionIncrement' => array('i' => 15), 'minYear' => date('Y') - 2, 'maxYear' => date('Y') + 2);
     $form = new HTML_QuickForm('protokol', 'POST', $this->url());
     $form->addElement('hidden', 'elev_id');
     $form->addElement('hidden', 'id');
     $form->addElement('date', 'date_start', 'Startdato:', $options);
     $form->addElement('date', 'date_end', 'Slutdato:', $options);
     $radio[0] =& HTML_QuickForm::createElement('radio', null, null, 'fri', '1');
     $radio[1] =& HTML_QuickForm::createElement('radio', null, null, 'syg', '2');
     $radio[2] =& HTML_QuickForm::createElement('radio', null, null, 'fraværende', '3');
     $radio[5] =& HTML_QuickForm::createElement('radio', null, null, 'henstilling', '6');
     $radio[3] =& HTML_QuickForm::createElement('radio', null, null, 'mundtlig advarsel', '4');
     $radio[4] =& HTML_QuickForm::createElement('radio', null, null, 'skriftlig advarsel', '5');
     $radio[6] =& HTML_QuickForm::createElement('radio', null, null, 'hjemsendt', '7');
     $radio[7] =& HTML_QuickForm::createElement('radio', null, null, 'andet', '8');
     $form->addGroup($radio, 'type', 'Type:', ' ');
     $form->addElement('textarea', 'text', '');
     $form->addElement('submit', null, 'Send');
     $form->addRule('date_start', 'Husk dato', 'required', null, 'client');
     $form->addRule('date_end', 'Husk dato', 'required', null, 'client');
     $form->addRule('type', 'Husk type', 'required', null, 'client');
     $form->addRule('text', 'Tekst', 'required', null, 'client');
     return $this->form = $form;
 }
开发者ID:vih,项目名称:intranet.vih.dk,代码行数:28,代码来源:Item.php

示例2: drawLogin

 /**
  * function_description
  *
  * @author	John.meng
  * @since    version - Jan 5, 2006
  * @param	datatype paramname description
  * @return   datatype description
  */
 function drawLogin()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $FlushPHPObj, $form, $smarty;
     include_once PEAR_DIR . 'HTML/QuickForm.php';
     $form = new HTML_QuickForm('firstForm');
     $replace_str = "../";
     $html_code = str_replace(ROOT_DIR, $replace_str, THEMES_DIR);
     echo "<link href='" . $html_code . "style.css' rel='stylesheet' type='text/css'>";
     $renderer =& $form->defaultRenderer();
     $renderer->setFormTemplate("\n<form{attributes}>\n<table border=\"0\" class=\"log_table\" align=\"center\">\n{content}\n</table>\n</form>");
     $renderer->setHeaderTemplate("\n\t<tr>\n\t\t<td class=\"log_table_head\" align=\"left\" valign=\"top\" colspan=\"2\" ><b>{header}</b></td>\n\t</tr>");
     $form->addElement('header', null, "<img src=\"" . $html_code . "images/logo.gif\" border=\"0\" >");
     $form->addElement('text', 'user_name', $__Lang__['langMenuUser'] . $__Lang__['langGeneralName'] . ' : ');
     $form->addElement('password', 'user_passwd', $__Lang__['langMenuUser'] . $__Lang__['langGeneralPassword'] . ' : ');
     $form->addRule('user_name', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langMenuUser'] . " " . $__Lang__['langGeneralName'], 'required');
     $form->addRule('user_passwd', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langMenuUser'] . " " . $__Lang__['langGeneralPassword'], 'required');
     $form->addElement('hidden', 'Action', 'LOGON');
     $form->setDefaults(array('user_name' => $_COOKIE['UserName']));
     $form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
     $form->addElement('static', 'login_message');
     if ($form->validate() && $_POST['Action'] == 'LOGON') {
         $user_name = $_POST['user_name'];
         $user_password = md5($_POST['user_passwd']);
         $this->checkAuth($user_name, $user_password);
     }
     $form->display();
     exit;
 }
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:36,代码来源:Auth.class.php

示例3: execute

 function execute(ActionMapping $map, ActionForm $form, Request $req)
 {
     global $papyrine;
     $papyrine->entries =& $papyrine->getEntries();
     // Instantiate the HTML_QuickForm object
     require_once 'HTML/QuickForm.php';
     require_once 'HTML/QuickForm/group.php';
     $form = new HTML_QuickForm('create_entry');
     $form->addElement('text', 'title', 'Title:');
     $form->addElement('text', 'date', 'Date:');
     $form->addElement('text', 'status', 'Status:');
     // Get the default handler
     $form->addElement('text', 'body', 'Body:');
     $form->addElement('submit', null, 'Create');
     // Define filters and validation rules
     $form->applyFilter('name', 'trim');
     $form->addRule('name', 'Please enter your name', 'required', null, 'client');
     //get classes registered for entry
     //call method
     $plugin = new PapyrinePlugin(BASE . 'plugins/categories/');
     $object = $plugin->getInstance();
     $object->recieveNewEntryForm($form);
     $plugin = new PapyrinePlugin(BASE . 'plugins/comments/');
     $object = $plugin->getInstance();
     $object->recieveNewEntryForm($form);
     // Output the form
     $papyrine->form = $form->toHTML();
     header("Content-Type: application/xhtml+xml;charset=UTF-8");
     $papyrine->display('admin/header.html');
     $papyrine->display($map->getParameter());
     $papyrine->display('admin/footer.html');
 }
开发者ID:BackupTheBerlios,项目名称:papyrine-svn,代码行数:32,代码来源:EntryAdministrationAction.php

示例4: opAdd

 /**
  * function_description
  *
  * @author	John.meng
  * @since    version - Jan 19, 2006
  * @param	datatype paramname description
  * @return   datatype description
  */
 function opAdd()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $__SITE_VAR__, $form, $FlushPHPObj, $thisDAO, $smarty, $class_path;
     include_once PEAR_DIR . 'HTML/QuickForm.php';
     $form = new HTML_QuickForm('firstForm', 'post', '', '_self', "onsubmit='save_in_textarea_all();'");
     $renderer =& $form->defaultRenderer();
     $renderer->setFormTemplate("\n<form{attributes}>\n<table border=\"0\" class=\"new_table\" width='100%'>\n{content}\n</table>\n</form>");
     $renderer->setHeaderTemplate("\n\t<tr>\n\t\t<td class=\"grid_table_head\" align=\"left\" valign=\"top\" colspan=\"2\"><b>{header}</b></td>\n\t</tr>");
     $Content = $_POST['Content'];
     if ($_REQUEST['Action'] == 'Update') {
         $this_data = $this->_DAO->getRowByID(SITE_NEWS_TABLE, "NewsID", $_REQUEST['ID']);
         $form->setDefaults(array("Title" => $this_data['Title'], "Summary" => $this_data['Summary'], "Source" => $this_data['Source'], "Author" => $this_data['Author']));
         $Content = $this_data['Content'];
         $form->addElement('hidden', 'ID', $this_data['NewsID']);
     }
     $class_path = INCLUDE_DIR . "editor/";
     $CurrentUserPathImages = HTML_IMAGES_DIR;
     $SiteCssFile = CURRENT_HTML_DIR . "style.css";
     $ed_4 =& new rich("", 'Content', $Content, "380", "350", "../../" . $CurrentUserPathImages, "../../" . $CurrentUserPathImages, false, false);
     $ed_4->set_default_stylesheet($SiteCssFile);
     $ed_4->myModule(true);
     $editors = $ed_4->draw();
     $smarty->assign("class_path_editor", $class_path);
     $form->addElement('header', null, $__Lang__['langGeneralAdd'] . " " . $__Lang__['langSiteModuleNews']);
     $form->addElement('text', 'Title', $__Lang__['langModuleNewsTitle'] . ' : ', array('size' => 40));
     $form->addElement('textarea', 'Summary', $__Lang__['langModuleNewsSummary'] . ' : ', array('rows' => 5, 'cols' => 40));
     $form->addElement('static', 'Content', NULL, $editors);
     $form->addElement('text', 'Source', $__Lang__['langModuleNewsSource'] . ' : ', array('size' => 30));
     $form->addElement('text', 'Author', $__Lang__['langModuleNewsAuthor'] . ' : ', array('size' => 20));
     $form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
     $form->addRule('Title', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langModuleNewsTitle'], 'required');
     $form->addElement('hidden', 'Module', $_REQUEST['Module']);
     $form->addElement('hidden', 'Page', $_REQUEST['Page']);
     $form->addElement('hidden', 'Action', $_REQUEST['Action']);
     $form->addElement('hidden', 'MenuID', $_GET['MenuID']);
     if ($form->validate()) {
         if (get_magic_quotes_gpc()) {
             $record["Content"] = stripslashes($_POST['Content']);
         } else {
             $record["Content"] = $_POST['Content'];
         }
         $record["Title"] = $_POST['Title'];
         $record["Summary"] = $_POST['Summary'];
         $record["Source"] = $_POST['Source'];
         $record["Author"] = $_POST['Author'];
         $record["SiteMenuID"] = $_POST['MenuID'];
         $record = $record + $this->_DAO->baseField();
         if ($_POST['ID'] && $_POST['Action'] == 'Update') {
             $this->_DAO->opUpdate(SITE_NEWS_TABLE, $record, " NewsID = " . $_POST['ID']);
         } else {
             $this->_DAO->opAdd(SITE_NEWS_TABLE, $record);
         }
         echo "<SCRIPT LANGUAGE='JavaScript'>opener.window.location.reload();window.close();</SCRIPT>";
     }
     $html_code = "<link rel=\"StyleSheet\" type=\"text/css\" href=\"" . $class_path . "rich_files/rich.css\"><script language=\"JScript.Encode\" src=\"" . $class_path . "rich_files/rich.js\"></script>" . $form->toHTML();
     $smarty->assign("Main", str_replace(ROOT_DIR, "../", $html_code));
 }
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:65,代码来源:ModuleNews.class.php

示例5: getForm

 function getForm()
 {
     if ($this->form) {
         return $this->form;
     }
     $form = new HTML_QuickForm('underviser', 'POST', $this->url());
     $form->addElement('text', 'navn', 'Navn');
     $form->addElement('text', 'email', 'E-mail');
     $form->addElement('textarea', 'besked', 'Besked', array('rows' => 12, 'cols' => 30));
     $form->addElement('submit', null, 'Send');
     $form->addRule('navn', 'Du skal indtaste et navn', 'required');
     $form->addRule('email', 'Du skal indtaste en email', 'required');
     $form->addRule('email', 'Du skal indtaste en gyldig email', 'email');
     $form->addRule('besked', 'Du skal indtaste en gyldig besked', 'required');
     $form->applyFilter('__ALL__', 'trim');
     $form->applyFilter('__ALL__', 'strip_tags');
     $form->applyFilter('__ALL__', 'addslashes');
     return $this->form = $form;
 }
开发者ID:vih,项目名称:vih.dk,代码行数:19,代码来源:Kontakt.php

示例6: getForm

 function getForm()
 {
     if ($this->form) {
         return $this->form;
     }
     $form = new HTML_QuickForm('confirm', 'POST', $this->url());
     $form->addElement('header', null, 'Accepterer du betingelserne?');
     $form->addElement('checkbox', 'confirm', null, 'Ja, jeg accepterer betingelserne', 'id="confirm"');
     $form->addElement('submit', null, 'Send');
     $form->addRule('confirm', 'Du skal acceptere betingelserne', 'required');
     return $this->form = $form;
 }
开发者ID:vih,项目名称:vih.dk,代码行数:12,代码来源:Confirm.php

示例7: form

 static function form()
 {
     try {
         $anonymous = Variable::get('anonymous_setup');
     } catch (NoSuchVariableException $e) {
         $anonymous = true;
     }
     if (!Base_AclCommon::is_user() && Base_User_LoginCommon::is_banned()) {
         return self::t('You have exceeded the number of allowed login attempts.');
     }
     require_once 'modules/Libs/QuickForm/requires.php';
     if (!Base_AclCommon::is_user() && !$anonymous) {
         Base_User_LoginCommon::autologin();
     }
     if (!Base_AclCommon::is_user() && !$anonymous) {
         $get = count($_GET) ? '?' . http_build_query($_GET) : '';
         $form = new HTML_QuickForm('loginform', 'post', $_SERVER['PHP_SELF'] . $get);
         $form->setRequiredNote('<span style="font-size:80%; color:#ff0000;">*</span><span style="font-size:80%;">' . self::t('denotes required field') . '</span>');
         $form->addElement('text', 'username', self::t('Username'));
         $form->addRule('username', 'Field required', 'required');
         $form->addElement('password', 'password', self::t('Password'));
         $form->addRule('password', 'Field required', 'required');
         // register and add a rule to check if user is banned
         $form->registerRule('check_user_banned', 'callback', 'rule_login_banned', 'Base_User_LoginCommon');
         $form->addRule('username', self::t('You have exceeded the number of allowed login attempts.'), 'check_user_banned');
         // register and add a rule to check if user and password exists
         $form->registerRule('check_login', 'callback', 'submit_login', 'Base_User_LoginCommon');
         $form->addRule(array('username', 'password'), self::t('Login or password incorrect'), 'check_login', $form);
         $form->addElement('submit', null, self::t('Login'));
         if ($form->validate()) {
             $user = $form->exportValue('username');
             Base_AclCommon::set_user(Base_UserCommon::get_user_id($user), true);
             // redirect below is used to better browser refresh behavior.
             header('Location: ' . $_SERVER['REQUEST_URI']);
         } else {
             return "<center>" . $form->toHtml() . "</center>";
         }
     }
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:39,代码来源:simple_login.php

示例8: __construct

 public function __construct()
 {
     parent::__construct('login');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars(true, false);
     $this->password_hash = "aicml";
     if ($this->access_level > 0) {
         echo 'You are already logged in as ', $_SESSION['user']->login, '.';
         $this->pageError = true;
         return;
     }
     if (empty($this->redirect) || strpos($this->redirect, 'login.php') !== false) {
         // never redirect to the login page
         $this->redirect = 'index.php';
     }
     $form = new HTML_QuickForm('login');
     $form->addElement('header', 'login_header', 'Login');
     $form->addElement('text', 'username', 'Login:', array('size' => 25, 'maxlength' => 40));
     $form->addRule('username', 'login cannot be empty', 'required', null, 'client');
     $form->addElement('password', 'password', 'Password:', array('size' => 25, 'maxlength' => 40));
     $form->addRule('password', 'password cannot be empty', 'required', null, 'client');
     $form->addElement('submit', 'submit_username', 'Login');
     $form->addElement('header', 'new_users', 'New Users Only');
     $form->addElement('password', 'password_again', 'Confirm Password:', array('size' => 25, 'maxlength' => 40));
     $form->addElement('text', 'email', 'email:', array('size' => 25, 'maxlength' => 80));
     $form->addRule('email', 'invalid email address', 'email', null, 'client');
     $form->addElement('text', 'realname', 'Real Name:', array('size' => 25, 'maxlength' => 80));
     $form->addElement('submit', 'newaccount', 'Create new account');
     $form->addElement('hidden', 'redirect', $this->redirect);
     $this->form =& $form;
     if ($form->validate()) {
         $this->processForm();
         return;
     }
     // only get here if form hasn't been submitted
     echo '<h2><a href="#">Log In or Create a New Account</a></h2>';
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:39,代码来源:login.php

示例9: getForm

 function getForm()
 {
     if ($this->form) {
         return $this->form;
     }
     $form = new HTML_QuickForm('', 'post', $this->url());
     $form->addElement('text', 'email', 'E-mail');
     $radio[0] =& HTML_QuickForm::createElement('radio', null, null, 'tilmeld', '1');
     $radio[1] =& HTML_QuickForm::createElement('radio', null, null, 'frameld', '2');
     $form->addGroup($radio, 'mode', null, null);
     $form->addElement('submit', null, 'Gem');
     $form->setDefaults(array('mode' => 1));
     $form->addRule('email', 'Du skal skrive en e-mail-adresse', 'required', null);
     return $this->form = $form;
 }
开发者ID:vih,项目名称:kursuscenter.vih.dk,代码行数:15,代码来源:index.php

示例10: array

$addr['zip'] =& HTML_QuickForm::createElement('text', 'zip', 'Zip', 'size=6 maxlength=10');
$addr['city'] =& HTML_QuickForm::createElement('text', 'city', 'City', 'size=15');
$form->addGroup($addr, 'address', 'Zip, city:');
$select = array('' => 'Please select...', 'AU' => 'Australia', 'FR' => 'France', 'DE' => 'Germany', 'IT' => 'Italy');
$form->addElement('select', 'country', 'Country:', $select);
$checkbox[] =& HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] =& HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] =& HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$checkbox[] =& HTML_QuickForm::createElement('checkbox', 'D', null, 'D');
$form->addGroup($checkbox, 'destination', 'Destination:', array('&nbsp;', '<br />'));
// Other elements
$form->addElement('checkbox', 'news', '', " Check this box if you don't want to receive our newsletter.");
$form->addElement('reset', 'reset', 'Reset');
$form->addElement('submit', 'submit', 'Register');
// Adds some validation rules
$form->addRule('email', 'Email address is required', 'required');
$form->addGroupRule('name', 'Name is required', 'required');
$form->addRule('pass', 'Password must be between 8 to 10 characters', 'rangelength', array(8, 10));
$form->addRule('country', 'Country is a required field', 'required');
$form->addGroupRule('destination', 'Please check at least two boxes', 'required', null, 2);
$form->addGroupRule('phone', 'Please fill all phone fields', 'required');
$form->addGroupRule('phone', 'Values must be numeric', 'numeric');
$AddrRules['zip'][0] = array('Zip code is required', 'required');
$AddrRules['zip'][1] = array('Zip code is numeric only', 'numeric');
$AddrRules['city'][0] = array('City is required', 'required');
$AddrRules['city'][1] = array('City is letters only', 'lettersonly');
$form->addGroupRule('address', $AddrRules);
// Tries to validate the form
if ($form->validate()) {
    // Form is validated, then freezes the data
    $form->freeze();
开发者ID:alex-k,项目名称:velotur,代码行数:31,代码来源:SmartyStatic_example.php

示例11: limitsForm

 /**
  * limitsForm 
  * 
  * Create limits form
  * 
  * @access protected
  * @return HTML_QuickForm object
  */
 protected function limitsForm()
 {
     $defaults = $this->user->getLimits($this->domain);
     // To MB
     if ($defaults['default_quota'] > 0) {
         $defaults['default_quota'] = $defaults['default_quota'] / 1024 / 1024;
     }
     $url = './?module=Main&class=Limits&event=modifyLimitsNow&domain=';
     $url .= $this->domain;
     $form = new HTML_QuickForm('limitsForm', 'post', $url);
     $form->setDefaults($defaults);
     $form->addElement('text', 'max_aliases', _('Maximum Aliases (-1 for unlimited)'), array('size' => 4));
     $form->addElement('text', 'max_forwards', _('Maximum Forwards (-1 for unlimited)'), array('size' => 4));
     $form->addElement('text', 'max_autoresponders', _('Maximum Mail Robots (-1 for unlimited)'), array('size' => 4));
     $form->addElement('text', 'max_mailinglists', _('Maximum EZMLM-IDX Mailing Lists (-1 for unlimited)'), array('size' => 4));
     $form->addElement('text', 'default_quota', _('Default Quota in MB (0 for unlimited)'), array('size' => 4));
     $form->addElement('text', 'default_maxmsgcount', _('Default Message Count Limit (0 for unlimited)'), array('size' => 4));
     $form->addElement('checkbox', 'disable_pop', _('Disable POP'));
     $form->addElement('checkbox', 'disable_imap', _('Disable IMAP'));
     $form->addElement('checkbox', 'disable_dialup', _('Disable Dial-Up'));
     $form->addElement('checkbox', 'disable_password_changing', _('Disable Password Changing'));
     $form->addElement('checkbox', 'disable_webmail', _('Disable Webmail (SqWebmail)'));
     $form->addElement('checkbox', 'disable_external_relay', _('Disable Relaying'));
     $form->addElement('checkbox', 'disable_smtp', _('Disable SMTP-AUTH'));
     $form->addElement('submit', 'submit', _('Modify'));
     $form->registerRule('minusOne', 'regex', '/^(-1|[0-9]+)$/');
     $form->registerRule('zero', 'regex', '/^(0|[1-9][0-9]+)$/');
     $form->addRule('max_aliases', _('Error: only integers of -1 and greater allowed here'), 'minusOne', null, 'client');
     $form->addRule('max_forwards', _('Error: only integers of -1 and greater allowed here'), 'minusOne', null, 'client');
     $form->addRule('max_autoresponders', _('Error: only integers of -1 and greater allowed here'), 'minusOne', null, 'client');
     $form->addRule('max_mailinglists', _('Error: only integers of -1 and greater allowed here'), 'minusOne', null, 'client');
     $form->addRule('default_quota', _('Error: only integers of 0 and greater allowed here'), 'zero', null, 'client');
     $form->addRule('default_maxmsgcount', _('Error: only integers of 0 and greater allowed here'), 'zero', null, 'client');
     $form->applyFilter('__ALL__', 'trim');
     return $form;
 }
开发者ID:shupp,项目名称:toasteradmin,代码行数:44,代码来源:Limits.php

示例12: basename

     $userTemplates[$value['id']] = $value['id'];
 }
 if (!in_array($_GET['template_id'], $userTemplates)) {
     $message = _CERTIFICATETEMPLATENOACCESS;
     $message_type = 'failure';
     $redirectUrl = "" . basename($_SERVER['PHP_SELF']) . "?" . $baseUrl . "&op=format_certificate&message=" . urlencode($message);
     $redirectUrl .= "&message_type=" . $message_type . "&reset_popup=1";
     $smarty->assign('T_CLONE_CERTIFICATE_TEMPLATE_REDIRECT', $redirectUrl);
 }
 $tid = $_GET['template_id'];
 $postTarget = basename($_SERVER['PHP_SELF']) . '?' . $baseUrl . '&op=clone_certificate_template&template_id=' . $tid;
 $form = new HTML_QuickForm("clone_certificate_template_form", "post", $postTarget, "", null, true);
 $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
 // Register this rule for checking user input with eF_checkParameter
 $form->addElement('text', 'certificate_name', _CERTIFICATENAME, 'class="inputText"');
 $form->addRule('certificate_name', _THEFIELD . ' "' . _CERTIFICATENAME . '" ' . _ISMANDATORY, 'required', null, 'client');
 $form->addElement('submit', 'clone_certificate_template', _SAVE, 'class="flatButton"');
 if ($form->isSubmitted() && $form->validate()) {
     $cloneTemplate = eF_getTableData("certificate_templates", "certificate_xml", "id=" . $tid);
     $formValues = $form->exportValues();
     $dbFields = array("certificate_name" => $formValues['certificate_name'], "certificate_xml" => $cloneTemplate[0]['certificate_xml'], "certificate_type" => "course", "users_LOGIN" => $GLOBALS['currentUser']->user['login']);
     if ($cloned = eF_insertTableData("certificate_templates", $dbFields)) {
         $message = _SUCCESSFULLYCLONECERTIFICATETEMPLATE;
         $message_type = 'success';
     } else {
         $message = _PROBLEMCLONECERTIFICATETEMPLATE;
         $message_type = 'failure';
     }
     $redirectUrl = "" . basename($_SERVER['PHP_SELF']) . "?" . $baseUrl . "&op=format_certificate&message=" . urlencode($message);
     $redirectUrl .= "&message_type=" . $message_type . "&reset_popup=1&tid=" . $cloned;
     $smarty->assign('T_CLONE_CERTIFICATE_TEMPLATE_REDIRECT', $redirectUrl);
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:course_settings.php

示例13: 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

示例14: elseif

} elseif (isset($_GET['add_lesson']) || isset($_GET['edit_lesson']) && eF_checkParameter($_GET['edit_lesson'], 'id')) {
    //The administrator asked to add or edit a lesson
    //Set the form post target in correspondance to the current function we are performing
    if (isset($_GET['add_lesson'])) {
        $post_target = 'add_lesson=1';
    } else {
        $post_target = 'edit_lesson=' . $_GET['edit_lesson'];
        $smarty->assign("T_LESSON_OPTIONS", array(array('text' => _LESSONSETTINGS, 'image' => "16x16/generic.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=lessons&lesson_settings=" . $_GET['edit_lesson'])));
    }
    $form = new HTML_QuickForm("add_lessons_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=lessons&" . $post_target, "", null, true);
    //Build the form
    $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
    //Register our custom input check function
    $form->addElement('text', 'name', _LESSONNAME, 'class = "inputText"');
    //The lesson name, it is required and of type 'text'
    $form->addRule('name', _THEFIELD . ' "' . _LESSONNAME . '" ' . _ISMANDATORY, 'required', null, 'client');
    $form->addRule('name', _INVALIDFIELDDATA, 'checkParameter', 'noscript');
    if ($GLOBALS['configuration']['onelanguage'] != true) {
        $form->addElement('select', 'languages_NAME', _LANGUAGE, EfrontSystem::getLanguages(true, true));
        //Add a language select box to the form
    }
    try {
        //If there are no direction set, redirect to add direction page
        $directionsTree = new EfrontDirectionsTree();
        if (sizeof($directionsTree->tree) == 0) {
            eF_redirect(basename($_SERVER['PHP_SELF']) . '?ctg=directions&add_direction=1&message=' . urlencode(_YOUMUSTFIRSTCREATEDIRECTION) . '&message_type=failure');
            exit;
        }
        $form->addElement('select', 'directions_ID', _DIRECTION, $directionsTree->toPathString());
        //Append a directions select box to the form
    } catch (Exception $e) {
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:lessons.php

示例15: catch

     include "file_manager.php";
 } catch (Exception $e) {
     handleNormalFlowExceptions($e);
 }
 //These are the entities that will be automatically replaced in custom header/footer
 $systemEntities = array('logo.png', '#siteName', '#siteMoto', '#languages', '#path', '#version');
 $smarty->assign("T_SYSTEM_ENTITIES", $systemEntities);
 //And these are the replacements of the above entities
 $systemEntitiesReplacements = array('{$T_LOGO}', '{$T_CONFIGURATION.site_name}', '{$T_CONFIGURATION.site_motto}', '{$smarty.capture.header_language_code}', '{$title}', '{$smarty.const.G_VERSION_NUM}');
 $load_editor = true;
 $layout_form = new HTML_QuickForm("add_block_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=themes&theme=" . $layoutTheme->{$layoutTheme->entity}['id'] . (isset($_GET['edit_block']) ? '&edit_block=' . $_GET['edit_block'] : '&add_block=1') . (isset($_GET['theme_layout']) ? '&theme_layout=' . $_GET['theme_layout'] : ''), "", null, true);
 $layout_form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
 $layout_form->addElement('text', 'title', _BLOCKTITLE, 'class = "inputText"');
 $layout_form->addElement('textarea', 'content', _BLOCKCONTENT, 'id="editor_data" class = "mceEditor" style = "width:100%;height:300px;"');
 $layout_form->addElement('submit', 'submit_block', _SAVE, 'class = "flatButton"');
 $layout_form->addRule('title', _THEFIELD . ' "' . _BLOCKTITLE . '" ' . _ISMANDATORY, 'required', null, 'client');
 if (isset($_GET['edit_block'])) {
     $customBlocks[$_GET['edit_block']]['content'] = file_get_contents($basedir . $customBlocks[$_GET['edit_block']]['name'] . '.tpl');
     $layout_form->setDefaults($customBlocks[$_GET['edit_block']]);
     $layout_form->freeze(array('name'));
 }
 if ($layout_form->isSubmitted() && $layout_form->validate()) {
     $values = $layout_form->exportValues();
     if (isset($_GET['edit_block'])) {
         // not rename blocks by editing. It created many unused files
         $values['name'] = $customBlocks[$_GET['edit_block']]['name'];
     } else {
         $values['name'] = time();
         //Use the timestamp as name
     }
     $block = array('name' => $values['name'], 'title' => $values['title']);
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:themes.php


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