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


PHP Form::set方法代码示例

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


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

示例1: getForm

 private function getForm(EditedCssFile $css)
 {
     $form = new Form($this->getValidator('cssFile', $this->request));
     $form->setData($css->toArray());
     $form->set('code', '');
     $form->set('fileName', $css->getFileName());
     $form->set('file', $css->getTheme());
     return $form;
 }
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:CssEditorController.php

示例2: testFormOptions

 /**
  */
 public function testFormOptions()
 {
     $this->object->set('test', 'existing');
     $this->assertFalse($this->object->get('nonExisting'));
     $this->assertEquals('existing', $this->object->get('test'));
     $this->assertEquals('default', $this->object->get('nonExists', 'default'));
     $this->assertTrue(is_array($this->object->getAll()));
     $this->assertEquals(1, count($this->object->getAll()));
     $this->object->setAll(array('test' => 'merged', 'second' => 'test'));
     $this->assertEquals(2, count($this->object->getAll()));
     $this->assertEquals('merged', $this->object->get('test'));
 }
开发者ID:fwk,项目名称:form,代码行数:14,代码来源:FormTest.php

示例3: index

 public function index()
 {
     $view = $this->getView();
     $request = $this->getPageRequest();
     if (!\Core\user()->checkAccess('g:admin')) {
         return View::ERROR_ACCESSDENIED;
     }
     if ($request->isPost()) {
         // Update/save the site id.
         ConfigHandler::Set('/livefyre/siteid', $_POST['siteid']);
         \Core\set_message('Set Site ID Successfully!', 'success');
         \Core\reload();
     }
     // Pull the configuration options to see if livefyre is currently setup.
     $siteid = ConfigHandler::Get('/livefyre/siteid');
     // Generate the form to either set or update the siteid.
     $form = new Form();
     $form->set('method', 'POST');
     $form->addElement('text', ['name' => 'siteid', 'title' => 'Site ID', 'value' => $siteid]);
     $view->assign('siteid', $siteid);
     $view->assign('url', ROOT_URL_NOSSL);
     $view->assign('form', $form);
     // Setup instructions:
     // http://www.livefyre.com/install/
 }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:25,代码来源:LivefyreController.php

示例4: quickdraft

 /**
  * Widget to quickly create a new Content page as a draft.
  */
 public function quickdraft()
 {
     $view = $this->getView();
     if (!\Core\user()->checkAccess('p:/content/manage_all')) {
         // Users who do not have access to manage page content do not get this.
         return '';
     }
     $form = new Form();
     $form->set('orientation', 'vertical');
     $form->set('callsmethod', 'ContentAdminWidget::QuickDraftSave');
     $form->addElement('text', ['name' => 'title', 'placeholder' => 'Page or Post Title']);
     $form->addElement('textarea', ['name' => 'content', 'placeholder' => "What's up?", 'cols' => 50]);
     $form->addElement('submit', ['value' => 'Save Draft']);
     // Load in all the pages on the site that are currently set as draft too, why not? ;)
     $drafts = PageModel::Find(['published_status = draft'], 10, 'updated DESC');
     $view->assign('form', $form);
     $view->assign('drafts', $drafts);
 }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:21,代码来源:ContentAdminWidget.php

示例5: render

 function render($page = false)
 {
     global $DB, $Controller;
     if (!$page && isset($this)) {
         $page = $this;
     } elseif (!is_object($page)) {
         $page = $Controller->retrieve($page);
     }
     $r = $DB->formfields->get(array('id' => $page->ID, 'language' => $page->loadedLanguage), '*', false, 'sort');
     if (!Database::numRows($r)) {
         return '';
     }
     $uForm = new Form('uform');
     $form = array();
     while (false !== ($field = Database::fetchAssoc($r))) {
         $fieldName = 'uform[' . $field['field_id'] . ']';
         switch ($field['type']) {
             case 'Checkbox':
             case 'pCheckbox':
                 $Values = array_filter(array_map('trim', explode(',', $field['value'])));
                 $Names = array_map('idfy', $Values);
                 if (count($Values) > 1) {
                     $form[] = new checkset($field['label'], $fieldName, array_combine($Names, $Values), $field['type'] == 'pCheckbox');
                 } else {
                     $form[] = new Checkbox($field['label'], $fieldName, $field['type'] == 'pCheckbox');
                 }
                 break;
             case 'select':
             case 'mselect':
                 $Values = array_map('trim', explode(',', $field['value']));
                 $Names = array_map('idfy', $Values);
                 $form[] = new select($field['label'], $fieldName, array_combine($Names, $Values), false, $field['type'] == 'mselect');
                 break;
             case 'Radio':
                 $Values = array_map('trim', explode(',', $field['value']));
                 $Names = array_map('idfy', $Values);
                 $form[] = new Radioset($field['label'], $fieldName, array_combine($Names, $Values));
                 break;
             case 'input':
             case 'textarea':
             case 'htmlfield':
                 $form[] = new $field['type']($field['label'], $fieldName, $field['value']);
                 break;
         }
     }
     if (empty($form)) {
         return '';
     }
     return $uForm->set($form);
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:50,代码来源:Formhandler.php

示例6: admin

 public function admin()
 {
     $view = $this->getView();
     $request = $this->getPageRequest();
     if (!\Core\user()->checkAccess('g:admin')) {
         return View::ERROR_ACCESSDENIED;
     }
     $image = ConfigHandler::Get('/favicon/image');
     $form = new Form();
     $form->set('callsmethod', 'AdminController::_ConfigSubmit');
     $form->addElement(ConfigHandler::GetConfig('/favicon/image')->getAsFormElement());
     $form->addElement('submit', ['value' => t('STRING_SAVE')]);
     $view->title = 'Site Favicon';
     $view->assign('current', $image);
     $view->assign('form', $form);
 }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:16,代码来源:FaviconController.php

示例7: postResetPassword

 public function postResetPassword($p, $z)
 {
     Form::set('Person', function ($person) {
         $person->password = Person::hashPassword($person->password);
     });
     $objects = Form::save();
     $person = current($objects);
     assert($person instanceof Person);
     $person->login();
     $message = new GuiMessage();
     $message->setFrom('thesystem@rickgigger.com', 'The System');
     $message->addTo($person->username);
     $message->setSubject("{$person->firstname}, your password has been reset");
     $message->assign('person', $person);
     $message->send('messages/confirmPasswordReset.tpl');
     BaseRedirect('install/list');
 }
开发者ID:rgigger,项目名称:zinc,代码行数:17,代码来源:ZoneDefault.php

示例8: run

 function run()
 {
     global $DB, $Templates;
     if (!$this->mayI(READ)) {
         errorPage(401);
     }
     $_REQUEST->setType('delsd', 'string');
     $_REQUEST->setType('editsd', 'string');
     $_POST->setType('sdname', 'string');
     $_POST->setType('sdassoc', 'string');
     if ($_POST['sdname']) {
         if ($_REQUEST['editsd']) {
             if ($DB->subdomains->update(array('subdomain' => $_POST['sdname'], 'assoc' => $_POST['sdassoc']), array('subdomain' => $_REQUEST['editsd']))) {
                 Flash::create(__('Subdomain updated'), 'confirmation');
             } else {
                 Flash::create(__('Subdomain in use'), 'warning');
             }
         } else {
             if ($DB->subdomains->insert(array('subdomain' => $_POST['sdname'], 'assoc' => $_POST['sdassoc']))) {
                 Flash::create(__('New subdomain inserted'), 'confirmation');
             } else {
                 Flash::create(__('Subdomain in use'), 'warning');
             }
         }
     } elseif ($_REQUEST['delsd'] && $this->mayI(EDIT)) {
         $DB->subdomains->delete(array('subdomain' => $_REQUEST['delsd']));
     }
     $r = $DB->subdomains->get(false, false, false, 'subdomain');
     $tablerows = array();
     while (false !== ($subdomain = Database::fetchAssoc($r))) {
         $tablerows[] = new Tablerow($subdomain['subdomain'], $subdomain['assoc'], icon('small/delete', __('Delete subdomain'), url(array('delsd' => $subdomain['subdomain']), 'id')) . icon('small/pencil', __('Edit subdomain'), url(array('editsd' => $subdomain['subdomain']), 'id')));
     }
     if ($_REQUEST['editsd']) {
         $sd = $DB->subdomains->getRow(array('subdomain' => $_REQUEST['editsd']));
         $form = new Form('editSubdomain');
     } else {
         $sd = false;
         $form = new Form('newSubdomain');
     }
     $this->setContent('main', (!empty($tablerows) ? new Table(new Tableheader(__('Subdomain'), __('Associated with..'), __('Actions')), $tablerows) : '') . $form->set($_REQUEST['editsd'] ? new Hidden('editsd', $_REQUEST['editsd']) : null, new input(__('Subdomain'), 'sdname', @$sd['subdomain']), new input(__('Associate with'), 'sdassoc', @$sd['assoc'], false, __('ID or alias to associate with the subdomain'))));
     $Templates->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:42,代码来源:Subdomains.php

示例9: configure

 /**
  * View to set google API keys and other configuration options.
  */
 public function configure()
 {
     $view = $this->getView();
     $request = $this->getPageRequest();
     $configs = ['general' => ['title' => 'General', 'configs' => ['/google/services/public_api_key']], 'analytics' => ['title' => 'Analytics', 'configs' => ['/google-analytics/accountid', '/google/tagmanager/tagid']], 'maps' => ['title' => 'Maps', 'configs' => ['/googlemaps/enterprise/privatekey', '/googlemaps/enterprise/clientname']], 'cse' => ['title' => 'Custom Search', 'configs' => ['/google/cse/key']]];
     $form = new Form();
     $form->set('callsmethod', 'GoogleController::ConfigureSave');
     foreach ($configs as $gk => $gdat) {
         $group = new FormTabsGroup(['name' => $gk, 'title' => $gdat['title']]);
         foreach ($gdat['configs'] as $c) {
             /** @var ConfigModel $config */
             $config = ConfigHandler::GetConfig($c);
             $group->addElement($config->getAsFormElement());
         }
         $form->addElement($group);
     }
     $form->addElement('submit', ['name' => 'submit', 'value' => 'Update Settings']);
     $view->title = 'Google Keys and Apps ';
     $view->assign('form', $form);
 }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:23,代码来源:GoogleController.php

示例10: GetArticleForm

 /**
  * Get the form for article creation and updating.
  *
  * @param BlogArticleModel $article
  *
  * @return Form
  */
 public static function GetArticleForm(BlogArticleModel $article)
 {
     $page = $article->getLink('Page');
     $blog = $article->getLink('Blog');
     $page->set('parenturl', $blog->get('baseurl'));
     $form = new Form();
     $form->set('callsmethod', 'BlogHelper::BlogArticleFormHandler');
     $form->addModel($page, 'page');
     $form->addModel($article, 'model');
     if (Core::IsComponentAvailable('facebook') && Core::IsLibraryAvailable('jquery')) {
         // Is this article already posted?
         if ($article->get('fb_post_id')) {
             $form->addElement('select', ['disabled' => true, 'title' => 'Post to Facebook', 'options' => ['' => 'Posted!'], 'group' => 'Publish Settings']);
         } else {
             $form->addElement('select', ['class' => 'facebook-post-to-select', 'title' => 'Post to Facebook', 'name' => 'facebook_post', 'options' => ['' => '-- Please enable javascript --'], 'group' => 'Publish Settings']);
         }
     }
     // Lock in some elements for this blog article page.
     $form->getElement('page[parenturl]')->setFromArray(array('value' => $blog->get('baseurl'), 'readonly' => 'readonly'));
     // And remove a few other elements.
     $form->removeElement('model[title]');
     return $form;
 }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:30,代码来源:BlogHelper.php

示例11: edit

 public function edit()
 {
     $request = $this->getPageRequest();
     $view = $this->getView();
     $manager = \Core\user()->checkAccess('p:/package_repository/licenses/manager');
     if (!$manager) {
         return View::ERROR_ACCESSDENIED;
     }
     $model = PackageRepositoryLicenseModel::Construct($request->getParameter(0));
     if (!$model->exists()) {
         return View::ERROR_NOTFOUND;
     }
     $form = new Form();
     $form->set('callsmethod', 'PackageRepositoryLicenseController::_SaveLicense');
     $form->addModel($model);
     $form->addElement('submit', ['value' => 'Update License']);
     $view->title = 'Edit License';
     $view->assign('form', $form);
 }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:19,代码来源:PackageRepositoryLicenseController.php

示例12: GetForm

	/**
	 * @param \UserModel|null $user
	 *
	 * @return \Form
	 */
	public static function GetForm($user = null){
		$form = new \Form();
		if($user === null) $user = new \UserModel();

		$type               = ($user->exists()) ? 'edit' : 'registration';
		$usermanager        = \Core\user()->checkAccess('p:/user/users/manage');
		$groupmanager       = \Core\user()->checkAccess('p:/user/groups/manage');
		$allowemailchanging = \ConfigHandler::Get('/user/email/allowchanging');

		if($type == 'registration'){
			$form->set('callsmethod', 'Core\\User\\Helper::RegisterHandler');
		}
		else{
			$form->set('callsmethod', 'Core\\User\\Helper::UpdateHandler');
		}

		$form->addElement('system', ['name' => 'user', 'value' => $user]);

		// Because the user system may not use a traditional Model for the backend, (think LDAP),
		// I cannot simply do a setModel() call here.

		// Only enable email changes if the current user is an admin or it's new.
		// (Unless the admin allows it via the site config)
		if($type != 'registration' && ( $usermanager || $allowemailchanging)){
			$form->addElement('text', array('name' => 'email', 'title' => 'Email', 'required' => true, 'value' => $user->get('email')));
		}

		// Tack on the active option if the current user is an admin.
		if($usermanager){
			$form->addElement(
				'checkbox',
				array(
					'name' => 'active',
					'title' => 'Active',
					'checked' => ($user->get('active') == 1),
				)
			);

			$form->addElement(
				'checkbox',
				array(
					'name' => 'admin',
					'title' => 'System Admin',
					'checked' => $user->get('admin'),
					'description' => 'The system admin, (or root user), has complete control over the site and all systems.',
				)
			);
		}
		
		if($usermanager){
			$elements = array_keys($user->getKeySchemas());
		}
		elseif($type == 'registration'){
			$elements = explode('|', \ConfigHandler::Get('/user/register/form_elements'));
		}
		else{
			$elements = explode('|', \ConfigHandler::Get('/user/edit/form_elements'));
		}
		
		// If avatars are disabled globally, remove that from the list if it's set.
		if(!\ConfigHandler::Get('/user/enableavatar') && in_array('avatar', $elements)){
			array_splice($elements, array_search('avatar', $elements), 1);
		}
		
		foreach($elements as $k){
			if($k){
				// Skip blank elements that can be caused by string|param|foo| or empty strings.
				$el = $user->getColumn($k)->getAsFormElement();
				if($el){
					$form->addElement($el);	
				}
			}
		}

		// Tack on the group registration if the current user is an admin.
		if($groupmanager){
			// Find all the groups currently on the site.

			$where = new DatasetWhereClause();
			$where->addWhere('context = ');
			if(\Core::IsComponentAvailable('multisite') && \MultiSiteHelper::IsEnabled()){
				$where->addWhereSub('OR', ['site = ' . \MultiSiteHelper::GetCurrentSiteID(), 'site = -1']);
			}

			$groups = \UserGroupModel::Find($where, null, 'name');

			if(sizeof($groups)){
				$groupopts = array();
				foreach($groups as $g){
					$groupopts[$g->get('id')] = $g->get('name');
				}

				$form->addElement(
					'checkboxes',
					array(
//.........这里部分代码省略.........
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:101,代码来源:Helper.php

示例13: buildCreditCardForm

 public function buildCreditCardForm(CreditCardPayment $ccHandler)
 {
     $form = new Form($this->buildCreditCardValidator($ccHandler));
     $form->set('ccExpiryMonth', date('n'));
     $form->set('ccExpiryYear', date('Y'));
     return $form;
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:CheckoutController.php

示例14: options

 /**
  * Change currency options
  * @role update
  * @return ActionResponse
  */
 public function options()
 {
     $form = new Form($this->buildOptionsValidator());
     $form->set('updateCb', $this->config->get('currencyAutoUpdate'));
     $form->set('frequency', $this->config->get('currencyUpdateFrequency'));
     // get all feeds
     $dir = new DirectoryIterator(ClassLoader::getRealPath('library.currency'));
     foreach ($dir as $file) {
         $p = pathinfo($file->getFilename());
         if ($p['extension'] == 'php') {
             include_once $file->getPathName();
             $className = basename($file->getFilename(), '.php');
             $classInfo = new ReflectionClass($className);
             if (!$classInfo->isAbstract()) {
                 $feeds[$className] = call_user_func(array($className, 'getName'));
             }
         }
     }
     // get currency settings
     $currencies = $this->getCurrencySet()->toArray();
     $settings = $this->config->get('currencyFeeds');
     foreach ($currencies as $id => &$currency) {
         if (isset($settings[$currency['ID']])) {
             $form->set('curr_' . $currency['ID'], $settings[$currency['ID']]['enabled']);
             $form->set('feed_' . $currency['ID'], $settings[$currency['ID']]['feed']);
         }
     }
     $frequency = array();
     foreach (array(15, 60, 240, 1440) as $mins) {
         $frequency[$mins] = $this->translate('_freq_' . $mins);
     }
     $response = new ActionResponse();
     $response->set('form', $form);
     $response->set('currencies', $currencies);
     $response->set('frequency', $frequency);
     $response->set('feeds', $feeds);
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:43,代码来源:CurrencyController.php

示例15: payment

 public function payment()
 {
     if ($this->config->get('REQUIRE_SAME_ADDRESS')) {
         $this->order->billingAddress->set($this->order->shippingAddress->get());
         $this->order->billingAddress->resetModifiedStatus();
     }
     $this->ignoreValidation = true;
     $response = $this->postProcessResponse($this->pay());
     $this->ignoreValidation = false;
     $paymentMethodForm = new Form($this->getPaymentMethodValidator());
     if ($this->isTosRequired) {
         $paymentMethodForm->set('tos', $this->session->get('tos'));
     }
     $paymentMethodForm->set('payMethod', $this->session->get('paymentMethod'));
     $response->set('form', $paymentMethodForm);
     $response->set('selectedMethod', $this->session->get('paymentMethod'));
     $response->set('requireTos', $this->isTosRequired);
     return $response;
 }
开发者ID:saiber,项目名称:www,代码行数:19,代码来源:OnePageCheckoutController.php


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