本文整理汇总了PHP中Tab类的典型用法代码示例。如果您正苦于以下问题:PHP Tab类的具体用法?PHP Tab怎么用?PHP Tab使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tab类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->insertBefore($shoptab = new Tab('Shop', 'Shop'), 'Access');
$fields->addFieldsToTab("Root.Shop", new TabSet("ShopTabs", $maintab = new Tab("Main", TreeDropdownField::create('TermsPageID', _t("ShopConfig.TERMSPAGE", 'Terms and Conditions Page'), 'SiteTree'), TreeDropdownField::create("CustomerGroupID", _t("ShopConfig.CUSTOMERGROUP", "Group to add new customers to"), "Group"), UploadField::create('DefaultProductImage', _t('ShopConfig.DEFAULTIMAGE', 'Default Product Image'))), $countriestab = new Tab("Countries", CheckboxSetField::create('AllowedCountries', 'Allowed Ordering and Shipping Countries', self::config()->iso_3166_country_codes))));
$fields->removeByName("CreateTopLevelGroups");
$countriestab->setTitle("Allowed Countries");
}
示例2: updateCMSFields
function updateCMSFields(&$fields)
{
/*
* don't want slideshow on a redirector page
*/
if ($this->owner->ClassName == 'RedirectorPage') {
return $fields;
}
/*
* if this is a new page set defaults
*/
if ($this->owner->Version == 1) {
$this->set_defaults();
}
$tabSlides = new Tab('Slides');
$tabSlides->setTitle(_t('Slideshow.SLIDESTABTITLE', 'Slides'));
$tabSettings = new Tab('Settings');
$tabSettings->setTitle(_t('Slideshow.SETTINGSTABTITLE', 'Settings'));
$tabSlideShow = new TabSet('SlideshowTabs', $tabSlides, $tabSettings);
$tabSlideShow->setTitle(_t('Slideshow.SLIDESHOWTABTITLE', 'Slideshow'));
$fields->addFieldToTab('Root.Content', $tabSlideShow);
$image_manager = new ImageDataObjectManager($this->owner, 'SlideshowSlides', 'SlideshowSlide', 'SlideImage', array(), 'getCMSFields_forPopup');
$image_manager->copyOnImport = false;
$fields->addFieldToTab('Root.Content.SlideshowTabs.Slides', $image_manager);
/*
* settings
*/
if (count(self::$effects) > 1) {
$fields->addFieldToTab('Root.Content.SlideshowTabs.Settings', new DropdownField($name = 'SlideEffect', $title = _t('Slideshow.EFFECT', 'Slide effect'), $source = array_combine(array_keys(self::$effects), array_keys(self::$effects))));
} else {
$fields->addFieldToTab('Root.Content.SlideshowTabs.Settings', new HiddenField($name = 'SlideEffect', $title = 'Slide Effect', $value = key(self::$effects)));
}
$fields->addFieldsToTab('Root.Content.SlideshowTabs.Settings', array(new TextField($name = 'SlideDuration', $title = _t('Slideshow.SLIDEDURATIOM', 'Duration of Each Slide (milliseconds)')), new TextField($name = 'TransitionDuration', $title = _t('Slideshow.TRANSITIONDURATION', 'Duration of Transition Between Slides (milliseconds)')), new CheckboxField($name = 'AutoPlay', $title = _t('Slideshow.AUTOPLAY', 'Start slideshow automatically')), new CheckboxField($name = 'Loop', $title = _t('Slideshow.LOOP', 'Loop slides')), new CheckboxField($name = 'PauseOnHover', $title = _t('Slideshow.PAUSEONHOVER', 'Pause the slideshow when the mouse hovers over it')), new OptionsetField($name = 'UpdateSlideshows', $title = _t('Slideshow.UPDATE', 'Update slideshows'), $source = array('page' => _t('Slideshow.UPDATEPAGEONLY', 'Apply to this page only'), 'section' => _t('Slideshow.UPDATESECTION', 'Apply to all slideshows in this section'), 'site' => _t('Slideshow.UPDATEALL', 'Apply to all slideshows on this site')), $value = 'page')));
}
示例3: user_profile
public static function user_profile(Model_User $user, Tabs $tabs)
{
$pets = ORM::factory('User_Pet')->where('user_id', '=', $user->id)->order_by('active', 'desc')->find_all();
$tab = new Tab('Pets');
$tab->add_content(new Tab_PetList($user, $pets->as_array()));
$tabs->add_tab($tab);
}
示例4: getEditForm
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
$fields = $form->Fields();
$title = _t('AssetAdmin.FILES', 'Files');
// File listing
$gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldSortableHeader(), new GridFieldFilterHeader(), new GridFieldDataColumns(), new GridFieldPaginator(self::config()->page_length), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm());
$gridField = GridField::create('CloudinaryFile', $title, $this->getList(), $gridFieldConfig);
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
$columns->setDisplayFields(array('StripThumbnail' => '', 'NameForSummaryField' => _t('File.Name'), 'Created' => _t('AssetAdmin.CREATED', 'Date'), 'getSize' => _t('AssetAdmin.SIZE', 'Size')));
$columns->setFieldCasting(array('Created' => 'Date->Nice'));
$gridField->setAttribute('data-url-folder-template', Controller::join_links($this->Link('show'), '%s'));
if (!$fields->hasTabset()) {
$tabs = new TabSet('Root', $tabList = new Tab('ListView', _t('AssetAdmin.ListView', 'List View')));
$tabList->addExtraClass("content-listview cms-tabset-icon list");
$fields->push($tabs);
}
$uploadBtn = new LiteralField('UploadButton', sprintf('<a class="ss-ui-button ss-ui-action-constructive cms-panel-link" data-pjax-target="Content" data-icon="drive-upload" href="%s">%s</a>', Controller::join_links(singleton('CloudinaryFileAddController')->Link()), _t('Folder.UploadFilesButton', 'Upload')));
$actionButtonsComposite = CompositeField::create()->addExtraClass('cms-actions-row');
$actionButtonsComposite->push($uploadBtn);
$fields->addFieldsToTab('Root.ListView', array($actionsComposite = CompositeField::create($actionButtonsComposite)->addExtraClass('cms-content-toolbar field'), $gridField));
$fields->setForm($form);
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$form->addExtraClass('cms-edit-form center ' . $this->BaseCSSClasses());
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
$this->extend('updateEditForm', $form);
return $form;
}
示例5: uninstall
public function uninstall ()
{
$tab = new Tab(Tab::getIdFromClassName('AdminNewsletter'));
return parent::uninstall()
&& $tab->delete()
&& Configuration::deleteByName('NSletter_id_parent_tab');;
}
示例6: uninstall
public function uninstall()
{
Configuration::deleteByName('poslogo');
// Uninstall Tabs
$tab = new Tab((int) Tab::getIdFromClassName('AdminPosLogo'));
$tab->delete();
Configuration::deleteByName($this->name . '_auto');
Configuration::deleteByName($this->name . '_speed_slide');
Configuration::deleteByName($this->name . '_a_speed');
// Configuration::deleteByName($this->name . '_show_price');
//Configuration::deleteByName($this->name . '_show_des');
Configuration::deleteByName($this->name . '_qty_products');
Configuration::deleteByName($this->name . '_qty_items');
Configuration::deleteByName($this->name . '_width_item');
Configuration::deleteByName($this->name . '_show_nextback');
Configuration::deleteByName($this->name . '_show_control');
Configuration::deleteByName($this->name . '_min_item');
Configuration::deleteByName($this->name . '_max_item');
Configuration::deleteByName($this->name . '_mode_dir');
include dirname(__FILE__) . '/sql/uninstall_sql.php';
foreach ($sql as $s) {
if (!Db::getInstance()->execute($s)) {
return false;
}
}
// Uninstall Module
if (!parent::uninstall()) {
return false;
}
// !$this->unregisterHook('actionObjectExampleDataAddAfter')
return true;
}
示例7: upgrade_module_1_0_3
function upgrade_module_1_0_3($object)
{
$sql = array();
$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'simpleblog_tag` (
`id_simpleblog_tag` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_lang` INT( 11 ) unsigned NOT NULL,
`name` VARCHAR(60) NOT NULL,
PRIMARY KEY (`id_simpleblog_tag`)
) ENGINE = ' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8';
$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'simpleblog_post_tag` (
`id_simpleblog_post` INT( 11 ) unsigned NOT NULL,
`id_simpleblog_tag` INT( 11 ) unsigned NOT NULL,
PRIMARY KEY (`id_simpleblog_tag`)
) ENGINE = ' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8';
foreach ($sql as $s) {
if (!Db::getInstance()->Execute($s)) {
return false;
}
}
$context = Context::getContext();
$tab = new Tab();
$tab->name[$context->language->id] = $object->l('Tags');
$tab->class_name = 'AdminSimpleBlogTags';
$tab->id_parent = Tab::getIdFromClassName('AdminSimpleBlog');
$tab->module = $object->name;
$tab->add();
return true;
}
示例8: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// vars
$config = SiteConfig::current_site_config();
$owner = $this->owner;
// decode data into array
$data = json_decode($owner->OpenGraphData, true);
// @todo Add repair method if data is missing / corrupt ~ for fringe cases
// tab
$tab = new Tab('OpenGraph');
// add disabled/error state if `off`
if ($data['og:type'] === 'off') {
$tab->addExtraClass('error');
}
// add the tab
$fields->addFieldToTab('Root.Metadata', $tab, 'FullOutput');
// new identity
$tab = 'Root.Metadata.OpenGraph';
// add description
// type always visible
$fields->addFieldsToTab($tab, array(LabelField::create('OpenGraphHeader', '@todo Information</a>')->addExtraClass('information'), DropdownField::create('OpenGraphType', '<a href="http://ogp.me/#types">og:type</a>', self::$types, $data['og:type'])));
if ($data['og:type'] !== 'off') {
$fields->addFieldsToTab($tab, array(ReadonlyField::create('OpenGraphURL', 'Canonical URL', $owner->AbsoluteLink()), TextField::create('OpenGraphSiteName', 'Site Name', $data['og:site_name'])->setAttribute('placeholder', $config->Title), TextField::create('OpenGraphTitle', 'Page Title', $data['og:title'])->setAttribute('placeholder', $owner->Title), TextareaField::create('OpenGraphDescription', 'Description', $data['og:description'])->setAttribute('placeholder', $owner->GenerateDescription()), UploadField::create('OpenGraphImage', 'Image<pre>type: png/jpg/gif</pre><pre>size: variable *</pre>', $owner->OpenGraphImage)->setAllowedExtensions(array('png', 'jpg', 'jpeg', 'gif'))->setFolderName(self::$SEOOpenGraphUpload . $owner->Title)->setDescription('* <a href="https://developers.facebook.com/docs/sharing/best-practices#images" target="_blank">Facebook image best practices</a>, or use any preferred Open Graph guide.')));
}
}
开发者ID:graphiques-digitale,项目名称:silverstripe-seo-open-graph,代码行数:25,代码来源:SEO_OpenGraph_SiteTree_DataExtension.php
示例9: uninstall
public function uninstall()
{
Configuration::deleteByName('POSSEQUENCE');
// Uninstall Tabs
//$tab = new Tab((int)Tab::getIdFromClassName('AdminPosMenu'));
//$tab->delete();
$tab = new Tab((int) Tab::getIdFromClassName('AdminPossequence'));
$tab->delete();
Configuration::deleteByName($this->name . '_pause_time');
Configuration::deleteByName($this->name . '_animation_speed');
Configuration::deleteByName($this->name . '_show_arrow');
Configuration::deleteByName($this->name . '_show_navigation');
Configuration::deleteByName($this->name . '_auto_slide');
//uninstall db
include dirname(__FILE__) . '/sql/uninstall_sql.php';
foreach ($sql as $s) {
if (!Db::getInstance()->execute($s)) {
return false;
}
}
// Uninstall Module
if (!parent::uninstall()) {
return false;
}
// !$this->unregisterHook('actionObjectExampleDataAddAfter')
return true;
}
示例10: getEditForm
public function getEditForm($id = null, $fields = null)
{
// TODO Duplicate record fetching (see parent implementation)
if (!$id) {
$id = $this->currentPageID();
}
$form = parent::getEditForm($id);
// TODO Duplicate record fetching (see parent implementation)
$record = $this->getRecord($id);
if ($record && !$record->canView()) {
return Security::permissionFailure($this);
}
$memberList = GridField::create('Members', false, Member::get(), $memberListConfig = GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldButtonRow('after'))->addComponent(new GridFieldExportButton('buttons-after-left')))->addExtraClass("members_grid");
if ($record && method_exists($record, 'getValidator')) {
$validator = $record->getValidator();
} else {
$validator = Injector::inst()->get('Member')->getValidator();
}
$memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator($validator);
$groupList = GridField::create('Groups', false, Group::get(), GridFieldConfig_RecordEditor::create());
$columns = $groupList->getConfig()->getComponentByType('GridFieldDataColumns');
$columns->setDisplayFields(array('Breadcrumbs' => singleton('Group')->fieldLabel('Title')));
$columns->setFieldFormatting(array('Breadcrumbs' => function ($val, $item) {
return Convert::raw2xml($item->getBreadcrumbs(' > '));
}));
$fields = new FieldList($root = new TabSet('Root', $usersTab = new Tab('Users', _t('SecurityAdmin.Users', 'Users'), $memberList, new LiteralField('MembersCautionText', sprintf('<p class="caution-remove"><strong>%s</strong></p>', _t('SecurityAdmin.MemberListCaution', 'Caution: Removing members from this list will remove them from all groups and the' . ' database')))), $groupsTab = new Tab('Groups', singleton('Group')->i18n_plural_name(), $groupList)), new HiddenField('ID', false, 0));
// Add import capabilities. Limit to admin since the import logic can affect assigned permissions
if (Permission::check('ADMIN')) {
$fields->addFieldsToTab('Root.Users', array(new HeaderField(_t('SecurityAdmin.IMPORTUSERS', 'Import users'), 3), new LiteralField('MemberImportFormIframe', sprintf('<iframe src="%s" id="MemberImportFormIframe" width="100%%" height="250px" frameBorder="0">' . '</iframe>', $this->Link('memberimport')))));
$fields->addFieldsToTab('Root.Groups', array(new HeaderField(_t('SecurityAdmin.IMPORTGROUPS', 'Import groups'), 3), new LiteralField('GroupImportFormIframe', sprintf('<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="250px" frameBorder="0">' . '</iframe>', $this->Link('groupimport')))));
}
// Tab nav in CMS is rendered through separate template
$root->setTemplate('CMSTabSet');
// Add roles editing interface
if (Permission::check('APPLY_ROLES')) {
$rolesField = GridField::create('Roles', false, PermissionRole::get(), GridFieldConfig_RecordEditor::create());
$rolesTab = $fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.TABROLES', 'Roles'));
$rolesTab->push($rolesField);
}
$actionParam = $this->getRequest()->param('Action');
if ($actionParam == 'groups') {
$groupsTab->addExtraClass('ui-state-active');
} elseif ($actionParam == 'users') {
$usersTab->addExtraClass('ui-state-active');
} elseif ($actionParam == 'roles') {
$rolesTab->addExtraClass('ui-state-active');
}
$actions = new FieldList();
$form = Form::create($this, 'EditForm', $fields, $actions)->setHTMLID('Form_EditForm');
$form->addExtraClass('cms-edit-form');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
// Tab nav in CMS is rendered through separate template
if ($form->Fields()->hasTabset()) {
$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
}
$form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses());
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
$this->extend('updateEditForm', $form);
return $form;
}
示例11: getFieldList
/**
* Gets the form fields as defined through the metadata
* on {@link $obj} and the custom parameters passed to FormScaffolder.
* Depending on those parameters, the fields can be used in ajax-context,
* contain {@link TabSet}s etc.
*
* @return FieldList
*/
public function getFieldList()
{
$fields = new FieldList();
// tabbed or untabbed
if ($this->tabbed) {
$fields->push(new TabSet("Root", $mainTab = new Tab("Main")));
$mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
}
//var_dump($this->obj->db());exit();
// add database fields
foreach ($this->obj->db() as $fieldName => $fieldType) {
if ($this->restrictFields && !in_array($fieldName, $this->restrictFields)) {
continue;
}
// @todo Pass localized title
if ($this->fieldClasses && isset($this->fieldClasses[$fieldName])) {
$fieldClass = $this->fieldClasses[$fieldName];
$fieldObject = new $fieldClass($fieldName);
} else {
$fieldObject = $this->obj->dbObject($fieldName)->scaffoldFormField(null, $this->getParamsArray());
}
$fieldObject->setTitle($this->obj->fieldLabel($fieldName));
if ($this->tabbed) {
$fields->addFieldToTab("Root.Main", $fieldObject);
} else {
$fields->push($fieldObject);
}
}
return $fields;
}
示例12: action_index
/**
* View users profile
*/
public function action_index()
{
$id = $this->request->param('id');
$user = ORM::factory('User', $id);
if (!$user->loaded()) {
throw HTTP_Exception::Factory('404', 'No such user');
}
$container = new Tabs();
$about = new Tab('About me');
$about->add_content(new Tab_Text($user->get_property('about')));
$about->add_content(new Tab_Text($user->get_property('signature')));
$container->add_tab($about);
Event::fire('user.profile_tabs', array($user, $container));
$this->view = new View_User_Profile();
$this->view->user = $user;
$this->view->tabs = $container->render();
/*
// @TODO, This belongs to the pet module, better to use events?
$pets = ORM::factory('User_Pet')
->where('user_id', '=', $user->id)
->order_by('active', 'desc');
$paginate = Paginate::factory($pets)
->execute();
$this->view = new View_User_Profile;
$this->view->pagination = $paginate->render();
$this->view->profile_user = $user;
// $this->view->pets = ORM::factory('User_Pet')->where('user_id', '=', $user->id)->order_by('active', 'desc')->find_all()->as_array();
$this->view->pets = $paginate->result();
*/
}
示例13: install
/**
* @return boolean
*/
public function install()
{
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
// Install invisible tab
$tab = new Tab();
$tab->name[$this->context->language->id] = $this->l('SecurionPay');
$tab->class_name = 'AdminSecurionPay';
$tab->id_parent = -1;
// No parent tab
$tab->module = $this->name;
$tab->add();
//Init
Configuration::updateValue('SECURIONPAY_CONF', '');
if (!parent::install()) {
return false;
}
if (!Configuration::updateValue(self::MODE, self::MODE_TEST)) {
return false;
}
if (!$this->registerHook('payment') || !$this->registerHook('displayAdminOrder')) {
return false;
}
return true;
}
示例14: getCMSFields
/**
* Get the fields that are sent to the CMS. In
* your decorators: updateCMSFields(&$fields)
*
* @return Fieldset
*/
function getCMSFields()
{
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
$fields = new FieldSet(new TabSet("Root", $tabMain = new Tab('Main', $titleField = new TextField("Title", _t('SiteConfig.SITETITLE', "Site title")), $taglineField = new TextField("Tagline", _t('SiteConfig.SITETAGLINE', "Site Tagline/Slogan")), new DropdownField("Theme", _t('SiteConfig.THEME', 'Theme'), $this->getAvailableThemes(), '', null, _t('SiteConfig.DEFAULTTHEME', '(Use default theme)'))), $tabAccess = new Tab('Access', new HeaderField('WhoCanViewHeader', _t('SiteConfig.VIEWHEADER', "Who can view pages on this site?"), 2), $viewersOptionsField = new OptionsetField("CanViewType"), $viewerGroupsField = new TreeMultiselectField("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups")), new HeaderField('WhoCanEditHeader', _t('SiteConfig.EDITHEADER', "Who can edit pages on this site?"), 2), $editorsOptionsField = new OptionsetField("CanEditType"), $editorGroupsField = new TreeMultiselectField("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups")), new HeaderField('WhoCanCreateTopLevelHeader', _t('SiteConfig.TOPLEVELCREATE', "Who can create pages in the root of the site?"), 2), $topLevelCreatorsOptionsField = new OptionsetField("CanCreateTopLevelType"), $topLevelCreatorsGroupsField = new TreeMultiselectField("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators")))));
$viewersOptionsSource = array();
$viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
$viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
$viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
$viewersOptionsField->setSource($viewersOptionsSource);
$editorsOptionsSource = array();
$editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS");
$editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
$editorsOptionsField->setSource($editorsOptionsSource);
$topLevelCreatorsOptionsField->setSource($editorsOptionsSource);
// Translatable doesn't handle updateCMSFields on DataObjects,
// so add it here to save the current Locale,
// because onBeforeWrite does not work.
if (Object::has_extension('SiteConfig', "Translatable")) {
$fields->push(new HiddenField("Locale"));
}
if (!Permission::check('EDIT_SITECONFIG')) {
$fields->makeFieldReadonly($viewersOptionsField);
$fields->makeFieldReadonly($viewerGroupsField);
$fields->makeFieldReadonly($editorsOptionsField);
$fields->makeFieldReadonly($editorGroupsField);
$fields->makeFieldReadonly($topLevelCreatorsOptionsField);
$fields->makeFieldReadonly($topLevelCreatorsGroupsField);
$fields->makeFieldReadonly($taglineField);
$fields->makeFieldReadonly($titleField);
}
$tabMain->setTitle(_t('SiteConfig.TABMAIN', "Main"));
$tabAccess->setTitle(_t('SiteConfig.TABACCESS', "Access"));
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例15: testFormat_returnsString_ifFormatIsText
/**
* format() should return string if format is html
*/
public function testFormat_returnsString_ifFormatIsText()
{
$word = new Tab();
$expected = "\t";
$actual = $word->format('text');
$this->assertEquals($expected, $actual);
return;
}