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


PHP FormUI::get方法代码示例

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


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

示例1: get_additem_form

 /**
  * Add the Add Item form to the theme for display
  */
 public function get_additem_form()
 {
     $additem_form = new FormUI('dash_additem');
     $additem_form->append('select', 'module', 'null:unused');
     $additem_form->module->options = Plugins::filter('dashboard_block_list', array());
     $additem_form->append('submit', 'submit', _t('+'));
     //$form->on_success( array( $this, 'dash_additem' ) );
     $additem_form->properties['onsubmit'] = "dashboard.add(); return false;";
     $this->theme->additem_form = $additem_form->get();
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:13,代码来源:admindashboardhandler.php

示例2: post_options

 /**
  * Handles POST requests from the options admin page
  */
 public function post_options()
 {
     $option_items = array();
     $timezones = DateTimeZone::listIdentifiers();
     $timezones = array_merge(array('' => ''), array_combine(array_values($timezones), array_values($timezones)));
     $option_items[_t('Name & Tagline')] = array('title' => array('label' => _t('Site Name'), 'type' => 'text', 'helptext' => ''), 'tagline' => array('label' => _t('Site Tagline'), 'type' => 'text', 'helptext' => ''), 'about' => array('label' => _t('About'), 'type' => 'textarea', 'helptext' => ''));
     $option_items[_t('Publishing')] = array('pagination' => array('label' => _t('Items per Page'), 'type' => 'text', 'helptext' => ''), 'atom_entries' => array('label' => _t('Entries to show in Atom feed'), 'type' => 'text', 'helptext' => ''), 'comments_require_id' => array('label' => _t('Require Comment Author Info'), 'type' => 'checkbox', 'helptext' => ''), 'spam_percentage' => array('label' => _t('Comment SPAM Threshold'), 'type' => 'text', 'helptext' => _t('The likelihood a comment is considered SPAM, in percent.')));
     $option_items[_t('Time & Date')] = array('timezone' => array('label' => _t('Time Zone'), 'type' => 'select', 'selectarray' => $timezones, 'helptext' => _t('Current Date Time: %s', array(HabariDateTime::date_create()->format()))), 'dateformat' => array('label' => _t('Date Format'), 'type' => 'text', 'helptext' => _t('Current Date: %s', array(HabariDateTime::date_create()->date))), 'timeformat' => array('label' => _t('Time Format'), 'type' => 'text', 'helptext' => _t('Current Time: %s', array(HabariDateTime::date_create()->time))));
     $option_items[_t('Language')] = array('locale' => array('label' => _t('Locale'), 'type' => 'select', 'selectarray' => array_merge(array('' => 'default'), array_combine(HabariLocale::list_all(), HabariLocale::list_all())), 'helptext' => _t('International language code')), 'system_locale' => array('label' => _t('System Locale'), 'type' => 'text', 'helptext' => _t('The appropriate locale code for your server')));
     $option_items[_t('Troubleshooting')] = array('log_min_severity' => array('label' => _t('Minimum Severity'), 'type' => 'select', 'selectarray' => LogEntry::list_severities(), 'helptext' => _t('Only log entries with a this or higher severity.')), 'log_backtraces' => array('label' => _t('Log Backtraces'), 'type' => 'checkbox', 'helptext' => _t('Logs error backtraces to the log table\'s data column. Can drastically increase log size!')));
     /*$option_items[_t('Presentation')] = array(
     		'encoding' => array(
     			'label' => _t('Encoding'),
     			'type' => 'select',
     			'selectarray' => array(
     				'UTF-8' => 'UTF-8'
     				),
     			'helptext' => '',
     			),
     		);*/
     $option_items = Plugins::filter('admin_option_items', $option_items);
     $form = new FormUI('Admin Options');
     $tab_index = 3;
     foreach ($option_items as $name => $option_fields) {
         $fieldset = $form->append('wrapper', Utils::slugify(_u($name)), $name);
         $fieldset->class = 'container settings';
         $fieldset->append('static', $name, '<h2>' . htmlentities($name, ENT_COMPAT, 'UTF-8') . '</h2>');
         foreach ($option_fields as $option_name => $option) {
             $field = $fieldset->append($option['type'], $option_name, $option_name, $option['label']);
             $field->template = 'optionscontrol_' . $option['type'];
             $field->class = 'item clear';
             if ($option['type'] == 'select' && isset($option['selectarray'])) {
                 $field->options = $option['selectarray'];
             }
             $field->tabindex = $tab_index;
             $tab_index++;
             if (isset($option['helptext'])) {
                 $field->helptext = $option['helptext'];
             } else {
                 $field->helptext = '';
             }
         }
     }
     /* @todo: filter for additional options from plugins
      * We could either use existing config forms and simply extract
      * the form controls, or we could create something different
      */
     $submit = $form->append('submit', 'apply', _t('Apply'), 'admincontrol_submit');
     $submit->tabindex = $tab_index;
     $form->on_success(array($this, 'form_options_success'));
     $this->theme->form = $form->get();
     $this->theme->option_names = array_keys($option_items);
     $this->theme->display('options');
 }
开发者ID:ringmaster,项目名称:system,代码行数:57,代码来源:adminoptionshandler.php

示例3: configure

 public function configure()
 {
     $form = new FormUI('lipsum');
     // $form->set_settings( array( 'use_session_errors' => true ) );
     $form->append(FormControlText::create('num_posts', 'option:lipsum__num_posts')->add_validator('validate_lipsum_numbers')->label(_t('Number of posts to have present:', __CLASS__)));
     $form->append(FormControlText::create('num_comments', 'option:lipsum__num_comments')->add_validator('validate_lipsum_numbers')->label(_t('Max number of comments for each post:', __CLASS__)));
     $form->append(FormControlText::create('num_tags', 'option:lipsum__num_tags')->add_validator('validate_lipsum_numbers')->label(_t('Max number of tags for each post:', __CLASS__)));
     $form->append(FormControlSubmit::create('save')->set_caption('Save'));
     $form->on_success(array($this, 'updated_config'));
     echo $form->get();
 }
开发者ID:habari-extras,项目名称:Lipsum,代码行数:11,代码来源:lipsum.plugin.php

示例4: configure

 /**
  * Implement the simple plugin configuration.
  * @return FormUI The configuration form
  */
 public function configure()
 {
     $form = new FormUI('piwik');
     $form->append('text', 'siteurl', 'option:piwik__siteurl', _t('Piwik site URL', 'piwik'));
     $form->append('text', 'sitenum', 'option:piwik__sitenum', _t('Piwik site number', 'piwik'));
     $form->append('text', 'auth_token', 'option:piwik__auth_token', _t('Piwik Auth Token', 'piwik'));
     $form->append('checkbox', 'trackloggedin', 'option:piwik__trackloggedin', _t('Track logged-in users', 'piwik'));
     $form->append('checkbox', 'use_clickheat', 'option:piwik__use_clickheat', _t('Include PiWik Click Heat Plugin JS', 'piwik'));
     $form->append('submit', 'save', _t('Save', 'piwik'));
     $form->on_success(array($this, 'save_config'));
     return $form->get();
 }
开发者ID:habari-extras,项目名称:piwik,代码行数:16,代码来源:piwik.plugin.php

示例5: filter_dash_module_latest_log_activity

 /**
  * filter_dash_module_latest_log_activity
  * Sets theme variables and handles logic for the
  * dashboard's log history module.
  * @param string $module_id
  * @return string The contents of the module
  */
 public function filter_dash_module_latest_log_activity($module, $module_id, $theme)
 {
     if (FALSE === ($num_logs = Modules::get_option($module_id, 'logs_number_display'))) {
         $num_logs = 8;
     }
     $params = array('where' => array('user_id' => User::identify()->id), 'orderby' => 'id DESC', 'limit' => $num_logs);
     $theme->logs = EventLog::get($params);
     // Create options form
     $form = new FormUI('dash_logs');
     $form->append('text', 'logs_number_display', 'option:' . Modules::storage_name($module_id, 'logs_number_display'), _t('Number of items'));
     $form->append('submit', 'submit', _t('Submit'));
     $form->properties['onsubmit'] = "dashboard.updateModule({$module_id}); return false;";
     $module['title'] = User::identify()->can('manage_logs') ? '<a href="' . Site::get_url('admin') . '/logs">' . _t('Latest Log Activity') . '</a>' : _t('Latest Log Activity');
     $module['options'] = $form->get();
     $module['content'] = $theme->fetch('dash_logs');
     return $module;
 }
开发者ID:anupom,项目名称:my-blog,代码行数:24,代码来源:coredashmodules.plugin.php

示例6: filter_dash_module_add_item

 /**
  * Function used to set theme variables to the add module dashboard widget.
  * TODO make this form use an AJAX call instead of reloading the page
  */
 public function filter_dash_module_add_item($module, $id, $theme)
 {
     $modules = Modules::get_all();
     if ($modules) {
         $modules = array_combine(array_values($modules), array_values($modules));
     }
     $form = new FormUI('dash_additem');
     $form->append('select', 'module', 'null:unused');
     $form->module->options = $modules;
     $form->append('submit', 'submit', _t('+'));
     //$form->on_success( array( $this, 'dash_additem' ) );
     $form->properties['onsubmit'] = "dashboard.add(); return false;";
     $theme->additem_form = $form->get();
     $module['content'] = $theme->fetch('dash_additem');
     $module['title'] = _t('Add Item');
     return $module;
 }
开发者ID:ringmaster,项目名称:system,代码行数:21,代码来源:admindashboardhandler.php

示例7: post_options

 /**
  * Handles POST requests from the options admin page
  */
 public function post_options()
 {
     $form = new FormUI('Admin Options', 'admin_options');
     $this->theme->form = $form->get();
     $this->theme->display('options');
 }
开发者ID:habari,项目名称:system,代码行数:9,代码来源:adminoptionshandler.php

示例8: filter_media_panels

	/**
	 * Provide requested media panels for this plugin
	 *
	 * Regarding Uploading:
	 * A panel is returned to the media bar that contains a form, an iframe, and a javascript function.
	 * The form allows the user to select a file, and is submitted back to the same URL that produced this panel in the first place.
	 * This has the result of submitting the uploaded file to here when the form is submitted.
	 * To prevent the panel form from reloading the whole publishing page, the form is submitted into the iframe.
	 * An onload event attached to the iframe calls the function.
	 * The function accesses the content of the iframe when it loads, which should contain the results of the request to obtain this panel, which are in JSON format.
	 * The JSON data is passed to the habari.media.jsonpanel() function in media.js to process the data and display the results, just like when displaying a panel normally.
	 *
	 * @param string $panel The HTML content of the panel to be output in the media bar
	 * @param MediaSilo $silo The silo for which the panel was requested
	 * @param string $path The path within the silo (silo root omitted) for which the panel was requested
	 * @param string $panelname The name of the requested panel
	 * @return string The modified $panel to contain the HTML output for the requested panel
	 *
	 * @todo Move the uploaded file from the temporary location to the location indicated by the path field.
	 */
	public function filter_media_panels( $panel, $silo, $path, $panelname)
	{
		$class = __CLASS__;
		if ( $silo instanceof $class ) {
			switch ( $panelname ) {
				case 'mkdir':

					$fullpath = self::SILO_NAME . '/' . $path;

					$form = new FormUI( 'habarisilomkdir' );
					$form->append( 'static', 'ParentDirectory', '<div style="margin: 10px auto;">' . _t('Parent Directory:') . " <strong>/{$path}</strong></div>" );

					// add the parent directory as a hidden input for later validation
					$form->append( 'hidden', 'path', 'null:unused' )->value = $path;
					$form->append( 'hidden', 'action', 'null:unused')->value = $panelname;
					$dir_text_control = $form->append( 'text', 'directory', 'null:unused', _t('What would you like to call the new directory?') );
					$dir_text_control->add_validator( array( $this, 'mkdir_validator' ) );
					$form->append( 'submit', 'submit', _t('Submit') );
					$form->media_panel($fullpath, $panelname, 'habari.media.forceReload();');
					$form->on_success( array( $this, 'dir_success' ) );
					$panel = $form->get(); /* form submission magicallly happens here */

					return $panel;

					break;
				case 'rmdir':
					$fullpath = self::SILO_NAME . '/' . $path;

					$form = new FormUI( 'habarisilormdir' );
					$form->append( 'static', 'RmDirectory', '<div style="margin: 10px auto;">' . _t('Directory:') . " <strong>/{$path}</strong></div>" );

					// add the parent directory as a hidden input for later validation
					$form->append( 'hidden', 'path', 'null:unused' )->value = $path;
					$form->append( 'hidden', 'action', 'null:unused')->value = $panelname;
					$dir_text_control = $form->append( 'static', 'directory', _t('Are you sure you want to delete this directory?') );
					$form->append( 'submit', 'submit', _t('Delete') );
					$form->media_panel($fullpath, $panelname, 'habari.media.forceReload();');
					$form->on_success( array( $this, 'dir_success' ) );
					$panel = $form->get(); /* form submission magicallly happens here */

					return $panel;

					break;
				case 'delete':
					$fullpath = self::SILO_NAME . '/' . $path;

					$form = new FormUI( 'habarisilodelete' );
					$form->append( 'static', 'RmFile', '<div style="margin: 10px auto;">' . _t('File:') . " <strong>/{$path}</strong></div>" );

					// add the parent directory as a hidden input for later validation
					$form->append( 'hidden', 'path', 'null:unused' )->value = $path;
					$dir_text_control = $form->append( 'static', 'directory', '<p>' . _t('Are you sure you want to delete this file?') . '</p>');
					$form->append( 'submit', 'submit', _t('Delete') );
					$form->media_panel($fullpath, $panelname, 'habari.media.forceReload();');
					$form->on_success( array( $this, 'do_delete' ) );
					$panel = $form->get();

					return $panel;
					break;
				case 'upload':
					if ( isset( $_FILES['file'] ) ) {
						$size = Utils::human_size($_FILES['file']['size']);
						$panel .= "<div class=\"span-18\" style=\"padding-top:30px;color: #e0e0e0;margin: 0px auto;\"><p>" . _t( "File Uploaded: " ) . "{$_FILES['file']['name']} ($size)</p>";

						$path = self::SILO_NAME . '/' . preg_replace('%\.{2,}%', '.', $path). '/' . $_FILES['file']['name'];
						$asset = new MediaAsset($path, false);
						$asset->upload( $_FILES['file'] );

						if ( $asset->put() ) {
							$panel .= '<p>' . _t( 'File added successfully.' ) . '</p>';
						}
						else {
							$panel .= '<p>' . _t( 'File could not be added to the silo.' ) . '</p>';
						}

						$panel .= '<p><a href="#" onclick="habari.media.forceReload();habari.media.showdir(\'' . dirname($path) . '\');">' . _t( 'Browse the current silo path.' ) . '</a></p></div>';
					}
					else {

						$fullpath = self::SILO_NAME . '/' . $path;
//.........这里部分代码省略.........
开发者ID:nerdfiles,项目名称:habari_boilerplate,代码行数:101,代码来源:habarisilo.plugin.php

示例9: action_admin_theme_get_menus

 /**
  * Prepare and display admin page
  *
  **/
 public function action_admin_theme_get_menus(AdminHandler $handler, Theme $theme)
 {
     $theme->page_content = '';
     $action = isset($_GET['action']) ? $_GET['action'] : 'create';
     switch ($action) {
         case 'edit':
             $vocabulary = Vocabulary::get_by_id(intval($handler->handler_vars['menu']));
             if ($vocabulary == false) {
                 $theme->page_content = _t('<h2>Invalid Menu.</h2>', 'termmenus');
                 // that's it, we're done. Maybe we show the list of menus instead?
                 break;
             }
             $form = new FormUI('edit_menu');
             $form->append(new FormControlText('menuname', 'null:null', _t('Name', 'termmenus'), 'transparent_text'))->add_validator('validate_required', _t('You must supply a valid menu name', 'termmenus'))->add_validator(array($this, 'validate_newvocab'))->value = $vocabulary->name;
             $form->append(new FormControlHidden('oldname', 'null:null'))->value = $vocabulary->name;
             $form->append(new FormControlText('description', 'null:null', _t('Description', 'termmenus'), 'transparent_text'))->value = $vocabulary->description;
             $edit_items_array = $this->get_menu_type_data();
             $edit_items = '';
             foreach ($edit_items_array as $action => $menu_type) {
                 $edit_items .= '<a class="modal_popup_form menu_button_dark" href="' . URL::get('admin', array('page' => 'menu_iframe', 'action' => $action, 'menu' => $vocabulary->id)) . "\">" . _t('Add %s', array($menu_type['label']), 'termmenus') . "</a>";
             }
             if (!$vocabulary->is_empty()) {
                 $form->append('tree', 'tree', $vocabulary->get_tree(), _t('Menu', 'termmenus'));
                 $form->tree->config = array('itemcallback' => array($this, 'tree_item_callback'));
                 //						$form->tree->value = $vocabulary->get_root_terms();
                 // append other needed controls, if there are any.
                 $form->append('static', 'buttons', _t("<div id='menu_item_button_container'>{$edit_items}</div>", 'termmenus'));
                 $form->append('submit', 'save', _t('Apply Changes', 'termmenus'));
             } else {
                 $form->append('static', 'buttons', _t("<div id='menu_item_button_container'>{$edit_items}</div>", 'termmenus'));
             }
             $delete_link = URL::get('admin', array('page' => 'menus', 'action' => 'delete_menu', 'menu' => $handler->handler_vars['menu']));
             $form->append('static', 'deletebutton', _t("<a class='a_button' href='{$delete_link}'>Delete Menu</a>", 'termmenus'));
             $form->append(new FormControlHidden('menu', 'null:null'))->value = $handler->handler_vars['menu'];
             $form->on_success(array($this, 'rename_menu_form_save'));
             $form->properties['onsubmit'] = "return habari.menu_admin.submit_menu_update();";
             $theme->page_content .= $form->get();
             break;
         case 'create':
             $form = new FormUI('create_menu');
             $form->append('text', 'menuname', 'null:null', _t('Menu Name', 'termmenus'), 'transparent_text')->add_validator('validate_required', _t('You must supply a valid menu name', 'termmenus'))->add_validator(array($this, 'validate_newvocab'));
             $form->append('text', 'description', 'null:null', _t('Description', 'termmenus'), 'transparent_text');
             $form->append('submit', 'submit', _t('Create Menu', 'termmenus'));
             $form->on_success(array($this, 'add_menu_form_save'));
             $theme->page_content = $form->get();
             break;
         case 'delete_menu':
             $menu_vocab = Vocabulary::get_by_id(intval($handler->handler_vars['menu']));
             $menu_vocab->delete();
             // log that it has been deleted?
             Session::notice(_t('Menu deleted.', 'termmenus'));
             // redirect to a blank menu creation form
             Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'create')));
             break;
         case 'delete_term':
             $term = Term::get(intval($handler->handler_vars['term']));
             $menu_vocab = $term->vocabulary_id;
             $term->delete();
             // log that it has been deleted?
             Session::notice(_t('Item deleted.', 'termmenus'));
             Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'edit', 'menu' => $menu_vocab)));
             break;
         default:
             Utils::debug($_GET, $action);
             die;
     }
     $theme->display('menus_admin');
     // End everything
     exit;
 }
开发者ID:habari-extras,项目名称:termmenus,代码行数:74,代码来源:termmenus.plugin.php

示例10: action_admin_theme_get_menus

 /**
  * Prepare and display admin page
  *
  */
 public function action_admin_theme_get_menus(AdminHandler $handler, Theme $theme)
 {
     $theme->page_content = '';
     $action = isset($_GET['action']) ? $_GET['action'] : 'create';
     switch ($action) {
         case 'edit':
             $vocabulary = Vocabulary::get_by_id(intval($handler->handler_vars['menu']));
             if ($vocabulary == false) {
                 $theme->page_content = '<h2>' . _t('Invalid Menu.');
                 // that's it, we're done. Maybe we show the list of menus instead?
                 break;
             }
             $form = new FormUI('edit_menu');
             $form->append(new FormControlText('menuname', 'null:null', _t('Name'), 'transparent_text'))->add_validator('validate_required', _t('You must supply a valid menu name'))->add_validator(array($this, 'validate_newvocab'))->value = $vocabulary->name;
             $form->append(new FormControlHidden('oldname', 'null:null'))->value = $vocabulary->name;
             $form->append(new FormControlText('description', 'null:null', _t('Description'), 'transparent_text'))->value = $vocabulary->description;
             $edit_items_array = $this->get_menu_type_data();
             $edit_items = '';
             foreach ($edit_items_array as $action => $menu_type) {
                 $edit_items .= '<a class="modal_popup_form menu_button_dark" href="' . URL::get('admin', array('page' => 'menu_iframe', 'action' => $action, 'menu' => $vocabulary->id)) . "\">" . _t('Add %s', array($menu_type['label'])) . "</a>";
             }
             if (!$vocabulary->is_empty()) {
                 $form->append('tree', 'tree', $vocabulary->get_tree(), _t('Menu'));
                 $form->tree->options = $vocabulary->get_tree();
                 $form->tree->config = array('itemcallback' => array($this, 'tree_item_callback'));
                 //						$form->tree->value = $vocabulary->get_root_terms();
                 // append other needed controls, if there are any.
                 $form->append('static', 'buttons', '<div id="menu_item_button_container">' . $edit_items . '</div>');
                 $form->append('submit', 'save', _t('Apply Changes'));
             } else {
                 $form->append('static', 'buttons', '<div id="menu_item_button_container">' . $edit_items . '</div>');
             }
             $delete_link = URL::get('admin', Utils::WSSE(array('page' => 'menus', 'action' => 'delete_menu', 'menu' => $handler->handler_vars['menu'])));
             //$delete_link = URL::get( 'admin', array( 'page' => 'menus', 'action' => 'delete_menu', 'menu' => $handler->handler_vars[ 'menu' ] ) );
             $form->append('static', 'deletebutton', '<a class="a_button" href="' . $delete_link . '">' . _t('Delete Menu') . '</a>');
             $form->append(new FormControlHidden('menu', 'null:null'))->value = $handler->handler_vars['menu'];
             $form->on_success(array($this, 'rename_menu_form_save'));
             $form->properties['onsubmit'] = "return habari.menu_admin.submit_menu_update();";
             $theme->page_content .= $form->get();
             break;
         case 'create':
             $form = new FormUI('create_menu');
             $form->append('text', 'menuname', 'null:null', _t('Menu Name'), 'transparent_text')->add_validator('validate_required', _t('You must supply a valid menu name'))->add_validator(array($this, 'validate_newvocab'));
             $form->append('text', 'description', 'null:null', _t('Description'), 'transparent_text');
             $form->append('submit', 'submit', _t('Create Menu'));
             $form->on_success(array($this, 'add_menu_form_save'));
             $theme->page_content = $form->get();
             break;
         case 'delete_menu':
             if (Utils::verify_wsse($_GET, true)) {
                 $menu_vocab = Vocabulary::get_by_id(intval($handler->handler_vars['menu']));
                 // Delete blocks using this menu
                 $at = Themes::get_active_data(true);
                 $t = Themes::create(Themes::get_active()['name']);
                 $i = 0;
                 foreach ($at['areas'] as $area) {
                     foreach ($t->get_blocks($area['name'], 0, $t) as $block) {
                         if ($block->type == 'menu' && $block->menu_taxonomy == $handler->handler_vars['menu']) {
                             $block->delete();
                             $i++;
                         }
                     }
                 }
                 Session::notice(sprintf(_n('%s block linking to this menu deleted.', '%s blocks linking to this menu deleted.', $i), $i));
                 $menu_vocab->delete();
                 // log that it has been deleted?
                 Session::notice(_t('Menu deleted.'));
                 // redirect to a blank menu creation form
                 Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'create')));
             } else {
                 Session::notice(_t('Menu deletion failed - please try again.'));
                 Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'edit', 'menu' => $handler->handler_vars['menu'])));
             }
             break;
         case 'delete_term':
             $term = Term::get(intval($handler->handler_vars['term']));
             $menu_vocab = $term->vocabulary_id;
             if (Utils::verify_wsse($_GET, true)) {
                 $term->delete();
                 // log that it has been deleted?
                 Session::notice(_t('Item deleted.'));
                 Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'edit', 'menu' => $menu_vocab)));
             } else {
                 Session::notice(_t('Item deletion failed - please try again.'));
                 Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'edit', 'menu' => $menu_vocab)));
             }
             break;
         default:
             Utils::debug($_GET, $action);
             die;
     }
     $theme->display('menus_admin');
     // End everything
     exit;
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:99,代码来源:menus.plugin.php

示例11: filter_media_panels

    /**
     * Display the different media panels
     *
     * @param string $panel HTML content to be output
     * @param object $silo Silo object
     * @param string $path Current silo path
     * @param string $panelname Curren panel name
     * @return string The modified panel output
     */
    public function filter_media_panels($panel, $silo, $path, $panelname)
    {
        $class = __CLASS__;
        if ($silo instanceof $class) {
            switch ($panelname) {
                case 'new-album':
                    $fullpath = self::SILO_NAME . '/' . $path;
                    $form = new FormUI('picasasilo-newalbum');
                    $today = date('d/m/Y', time());
                    // first column
                    $form->append('static', 'col1', '<div class="column">');
                    $form->append('text', 'album_name', 'null:unused', 'Album name');
                    $form->append('textarea', 'album_summary', 'null:unused', 'Summary');
                    $form->append('text', 'album_date', 'null:unused', 'Date');
                    $form->album_date->value = $today;
                    $form->append('static', 'col2', '</div>');
                    // second column
                    $form->append('static', 'col3', '<div class="column">');
                    $form->append('text', 'album_location', 'null:unused', 'Location');
                    $form->append('select', 'album_visibility', 'null:unused', 'Visibility');
                    $form->album_visibility->options = array('public' => 'Public', 'private' => 'Anyone with the link', 'protected' => 'Private');
                    $form->append('static', 'col4', '</div>');
                    // clear columns
                    $form->append('static', 'colend', '<br style="clear: both">');
                    $form->append('submit', 'create-album', 'Create');
                    $form->media_panel($fullpath, $panelname, 'habari.media.forceReload();');
                    $form->on_success(array($this, 'create_album'));
                    $panel = $form->get();
                    return $panel;
                    break;
                case 'upload':
                    if (isset($_FILES['upload_file'])) {
                        $panel = $this->upload_photo();
                    } else {
                        $fullpath = self::SILO_NAME . '/' . $path;
                        $action = URL::get('admin_ajax', array('context' => 'media_panel'));
                        $picasa = new Picasa();
                        // collect album names
                        $xml = $picasa->get_albums();
                        foreach ($xml->channel->item as $album) {
                            $title = (string) $album->title;
                            $options .= "<option value='" . $title . "'>" . $title . "</option>";
                        }
                        // create a form that sends the request to an IFrame (as done in the Habari Silo)
                        $static = <<<PICASA_UPLOAD
\t\t\t\t\t\t<form enctype="multipart/form-data" method="post" id="picasasilo-upload" target="picasa_upload_frame" action="{$action}" class="span-10" style="margin:0px auto;" target="picasa_upload_frame">

\t\t\t\t\t\t  <div class="formcontrol"><input type="file" name="upload_file"></div>
  \t\t\t\t\t\t<div class="formcontrol">
\t\t\t\t\t\t\t\t<label for="upload">Album:</label>
\t\t\t\t\t\t\t\t<select name="upload_album">{$options}</select>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div class="formcontrol">
\t\t\t\t\t\t\t\t<label for="summary">Summary:</label>
\t\t\t\t\t\t\t\t<textarea name="summary"></textarea>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t  <div class="formcontrol"><input type="submit" name="upload" value="Upload"></div>
\t\t\t\t\t\t  <input type="hidden" name="path" value="{$fullpath}">
\t\t\t\t\t\t  <input type="hidden" name="panel" value="{$panelname}">
\t\t\t\t\t\t  
            </form>

\t\t\t\t\t\t<iframe id="picasa_upload_frame" name="picasa_upload_frame" style="width:1px;height:1px;" onload="picasa_uploaded();">
\t\t\t\t\t\t</iframe>

\t\t\t\t\t\t<script type="text/javascript">
\t\t\t\t\t\t\t\tvar responsedata;
\t\t\t\t\t      function picasa_uploaded() 
\t\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\t\tif(!jQuery('#picasa_upload_frame')[0].contentWindow)return;
\t\t\t\t\t\t\t\t\tvar response = jQuery(jQuery('#picasa_upload_frame')[0].contentWindow.document.body).text();
\t\t\t\t\t\t\t\t\tif(response) 
\t\t\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\t\t\teval('responsedata = ' + response);
\t\t\t\t\t\t\t\t\t\twindow.setTimeout(picasa_uploaded_complete, 500);
\t\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t\t}

\t\t\t\t\t\t\t\tfunction picasa_uploaded_complete() 
\t\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\t\thabari.media.jsonpanel(responsedata);
\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t</script>
PICASA_UPLOAD;
                        $panel = $static;
                    }
                    return $panel;
                    break;
            }
        }
    }
开发者ID:habari-extras,项目名称:picasasilo,代码行数:100,代码来源:picasasilo.plugin.php

示例12: filter_dash_module_fire_eagle

 /**
  * filter: dash_module_fire_eagle
  *
  * @access public
  * @param array $module
  * @param string $module_id
  * @param object $theme
  * @return array
  */
 public function filter_dash_module_fire_eagle($module, $module_id, $theme)
 {
     $module['title'] = _t('Fire Eagle', 'fireeagle') . '<img src="' . $this->get_url() . '/img/fireeagle.png" alt= "Fire Eagle" />';
     $form = new FormUI('dash_fireeagle');
     $form->append('text', 'location', 'null:unused', _t('Location: ', 'fireeagle'));
     $user = User::identify();
     if (isset($user->info->fireeagle_location)) {
         $form->location->value = $user->info->fireeagle_location;
     }
     $form->append('submit', 'submit', _t('Update', 'fireeagle'));
     $form->properties['onsubmit'] = 'fireeagle.update(); return false;';
     $theme->fireeagle_form = $form->get();
     $module['content'] = $theme->fetch('dash_fireeagle');
     return $module;
 }
开发者ID:habari-extras,项目名称:fireeagle,代码行数:24,代码来源:fireeagle.plugin.php

示例13: configure

 /**
  * Implement the simple plugin configuration.
  * @return FormUI The configuration form
  */
 public function configure()
 {
     $form = new FormUI('blogroll');
     // display settings
     $display_wrap = $form->append('fieldset', 'display', _t('Display Settings', self::DOMAIN));
     $title = $display_wrap->append('text', 'list_title', 'option:blogroll__list_title', _t('List title: ', self::DOMAIN));
     $max = $display_wrap->append('text', 'max_links', 'option:blogroll__max_links', _t('Max. displayed links: ', self::DOMAIN));
     $sort_bys = array_merge(array_combine(array_keys(Post::default_fields()), array_map('ucwords', array_keys(Post::default_fields()))), array('RAND()' => _t('Randomly', self::DOMAIN)));
     $sortby = $display_wrap->append('select', 'sort_by', 'option:blogroll__sort_by', _t('Sort By: ', self::DOMAIN), $sort_bys);
     $orders = array('ASC' => _t('Ascending', self::DOMAIN), 'DESC' => _t('Descending', self::DOMAIN));
     $order = $display_wrap->append('select', 'direction', 'option:blogroll__direction', _t('Order: ', self::DOMAIN), $orders);
     // other settings
     $other_wrap = $form->append('fieldset', 'settings', _t('More Settings', self::DOMAIN));
     $update = $other_wrap->append('checkbox', 'use_updated', 'option:blogroll__use_updated', _t('Use Weblogs.com to get updates? ', self::DOMAIN));
     $form->append('submit', 'save', 'Save');
     $form->on_success(array($this, 'formui_submit'));
     return $form->get();
 }
开发者ID:habari-extras,项目名称:blogroll,代码行数:22,代码来源:blogroll.plugin.php

示例14: FormUI

 function test_encode_textinput()
 {
     $form = new FormUI('encode');
     $encoded = $form->append('text', 'encoded')->set_value('<b>strong</b>')->add_class('target');
     $html = $form->get();
     $this->assert_true(strpos($html, 'value="&lt;b&gt;strong&lt;/b&gt;"') !== false, 'The output value was not encoded.');
     $encoded->set_value('&lt;b&gt;strong&lt;/b&gt;');
     $html = $form->get();
     $this->assert_true(strpos($html, 'value="&amp;lt;b&amp;gt;strong&amp;lt;/b&amp;gt;"') !== false, 'The output value was not encoded.');
 }
开发者ID:habari,项目名称:tests,代码行数:10,代码来源:test_formui.php

示例15: create_add_option_form_tab

 /**
  * Creates (attaches) the 'add new option' form/tab
  * @todo Determine if this is a hack :)
  *
  * @param  $theme The theme being attached to
  * @return Theme The modified Theme object
  */
 public function create_add_option_form_tab(Theme $theme)
 {
     $form = new FormUI('options-view-new');
     $form->set_option('form_action', URL::get('admin', 'page=options_view'));
     $form->class[] = 'form comment';
     $tabs = $form->append('tabs', 'publish_controls');
     $new = $tabs->append('fieldset', 'settings', _t('Add a new option'));
     $action = $new->append('hidden', 'action', 'null:null');
     $action->value = 'add';
     $name = $new->append('text', 'option_name', 'null:null', _t('Name'), 'tabcontrol_text');
     $name->value = '';
     $name->helptext = _t('Name of the new option');
     $value = $new->append('text', 'option_value', 'null:null', _t('Value'), 'tabcontrol_text');
     $value->value = '';
     $value->helptext = _t('Value of the new option');
     $new->append('submit', 'save', _t('Save'));
     $form->on_success(array($this, 'formui_submit_add'));
     $theme->form = $form->get();
     return $theme;
 }
开发者ID:habari-extras,项目名称:optionsmanager,代码行数:27,代码来源:optionsmanager.plugin.php


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