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


PHP Am_Form_Admin::addPassword方法代码示例

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


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

示例1: createForm

 public function createForm()
 {
     $mainForm = new Am_Form_Admin();
     $self_password = $mainForm->addPassword('self_password')->setLabel(___("Your Password\n" . "enter your current password\n" . "in order to edit admin record"));
     $self_password->addRule('callback', ___('Wrong password'), array($this, 'checkSelfPassword'));
     $form = $mainForm->addFieldset()->setLabel(___('Admin Settings'));
     $login = $form->addText('login')->setLabel(___('Admin Username'));
     $login->addRule('required')->addRule('length', ___('Length of username must be from %d to %d', 4, 16), array(4, 16))->addRule('regex', ___('Admin username must be alphanumeric in small caps'), '/^[a-z][a-z0-9_-]+$/');
     $set = $form->addGroup()->setLabel(___('First and Last Name'));
     $set->addText('name_f');
     $set->addText('name_l');
     $pass = $form->addPassword('_passwd')->setLabel(___('New Password'));
     $pass->addRule('length', ___('Length of admin password must be from %d to %d', 6, 16), array(6, 16));
     $pass->addRule('neq', ___('Password must not be equal to username'), $login);
     $pass0 = $form->addPassword('_passwd0')->setLabel(___('Confirm New Password'));
     $pass0->addRule('eq', ___('Passwords must be the same'), $pass);
     $form->addText('email')->setLabel(___('E-Mail Address'))->addRule('required');
     $super = $form->addAdvCheckbox('super_user')->setLabel(___('Super Admin'));
     $record = $this->grid->getRecord();
     if ($this->getDi()->authAdmin->getUserId() == $record->get('admin_id')) {
         $super->toggleFrozen(true);
     }
     $group = $form->addGroup('perms')->setLabel(___('Permissions'))->setSeparator('<br />');
     foreach ($this->getDi()->authAdmin->getPermissionsList() as $perm => $title) {
         if (is_string($title)) {
             $group->addCheckbox($perm)->setContent($title);
         } else {
             $gr = $group->addGroup($perm);
             $gr->addStatic()->setContent($title['__label']);
             unset($title['__label']);
             foreach ($title as $k => $v) {
                 $gr->addCheckbox($k)->setContent($v);
             }
         }
     }
     return $mainForm;
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:37,代码来源:AdminAdminsController.php

示例2: askRemoteAccess

    function askRemoteAccess()
    {
        $form = new Am_Form_Admin();
        $info = $this->loadRemoteAccess();
        if ($info && !empty($info['_tested'])) {
            return true;
        }
        if ($info) {
            $form->addDataSource(new Am_Request($info));
        }
        $method = $form->addSelect('method', null, array('options' => array('ftp' => 'FTP', 'sftp' => 'SFTP')))->setLabel(___('Access Method'));
        $gr = $form->addGroup('hostname')->setLabel(___('Hostname'));
        $gr->addText('host')->addRule('required')->addRule('regex', 'Incorrect hostname value', '/^[\\w\\._-]+$/');
        $gr->addHTML('port-label')->setHTML('&nbsp;<b>Port</b>');
        $gr->addText('port', array('size' => 3));
        $gr->addHTML('port-notice')->setHTML('&nbsp;leave empty if default');
        $form->addText('user')->setLabel(___('Username'))->addRule('required');
        $form->addPassword('pass')->setLabel(___('Password'));
        //        $form->addTextarea('ssh_public_key')->setLabel(___('SSH Public Key'));
        //        $form->addTextarea('ssh_private_key')->setLabel(___('SSH Private Key'));
        $form->addSubmit('', array('value' => ___('Continue')));
        $form->addScript()->setScript(<<<CUT
\$(function(){
    \$('#method-0').change(function(){
        \$('#ssh_public_key-0,#ssh_private_key-0').closest('.row').toggle( \$(this).val() == 'ssh' );
    }).change();
});
CUT
);
        $error = null;
        $vars = $form->getValue();
        if ($form->isSubmitted() && $form->validate() && !($error = $this->tryConnect($vars))) {
            $vars['_tested'] = true;
            $this->storeRemoteAccess($vars);
            return true;
        } else {
            //$this->view->title = ___("File Access Credentials Required");
            $this->view->title = ___('Upgrade');
            $this->view->content = "";
            $this->outStepHeader();
            if ($error) {
                $method->setError($error);
            }
            $this->view->content .= (string) $form;
            $this->view->display('admin/layout.phtml');
            $this->noDisplay = true;
        }
    }
开发者ID:grlf,项目名称:eyedock,代码行数:48,代码来源:AdminUpgradeController.php

示例3: createMysqlForm

 /** @return Am_Form_Admin */
 function createMysqlForm()
 {
     $form = new Am_Form_Admin();
     $el = $form->addText('host')->setLabel('Wordpress  MySQL Hostname');
     $el->addRule('required', 'This field is required');
     $form->addText('user')->setLabel('Wordpress  MySQL Username')->addRule('required', 'This field is required');
     $form->addPassword('pass')->setLabel('Wordpress MySQL Password');
     $form->addText('db')->setLabel('Wordpress MySQL Database Name')->addRule('required', 'This field is required');
     $form->addText('prefix')->setLabel('Wordpress Tables Prefix');
     $dbConfig = $this->getDi()->getParameter('db');
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('host' => $dbConfig['mysql']['host'], 'user' => $dbConfig['mysql']['user'], 'prefix' => 'wp_')));
     $el->addRule('callback2', '-', array($this, 'validateDbConnect'));
     $form->addSubmit(null, array('value' => 'Continue...'));
     return $form;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:16,代码来源:AdminImportYourMembersController.php


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