Get a view with users who flagged me? - drupal-6

i'm using views and flags modules. Users can flag users. I could easily create a list of users i've flagged. But I cannot create a view with users, who flagged me.

I tried this out with a very simply Drupal install... just Core, Views 2 and Flags.
You can in fact do this. I created a Flag called flag_user_test and 3 test accounts plus admin. I flagged the admin account using the other test accounts and was able to get this list of users to display using the user id as an argument, defaulting to currently logged in user.
First, create the view to be of type User (not Node).
Next, you need to create a relationship with "Flags: User's flagged content" and select the user flag on the settings for the relationship. I did not select "Include only users who have flagged content".
Then, create an Argument using the "Flags: Content ID" type. Set this argument to use the "user flagged content" relationship you defined in the last step. I also provided the default argument to be the User ID of the currently logged in user.
Now just add the fields you want from the user profile and your done!
And here's an export of the view if you want to try it out. It looks really awful right there I know. But I don't know how to include it as an attachment, so that's the best I can do. If anyone knows how to make that code block look better, be my guest.
$view = new view;
$view->name = 'flag_me_view';
$view->description = 'User\'s who flagged me';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'flag_user_content_rel' => array(
'label' => 'user flagged content',
'required' => 0,
'flag' => 'flag_user_test',
'id' => 'flag_user_content_rel',
'table' => 'users',
'field' => 'flag_user_content_rel',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'name' => array(
'label' => 'Name',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'picture' => array(
'label' => 'Picture',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'picture',
'table' => 'users',
'field' => 'picture',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'content_id' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'current_user',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'content_id',
'table' => 'flag_content',
'field' => 'content_id',
'relationship' => 'flag_user_content_rel',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'override' => array(
'button' => 'Override',
),
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_php' => '',
'validate_argument_node_type' => array(
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_node_flag_name' => 'relationship',
'validate_argument_node_flag_test' => 'flaggable',
'validate_argument_node_flag_id_type' => 'id',
'validate_argument_user_flag_name' => 'relationship',
'validate_argument_user_flag_test' => 'flaggable',
'validate_argument_user_flag_id_type' => 'id',
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'flagged' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'flagged',
'table' => 'flag_content',
'field' => 'flagged',
'relationship' => 'flag_user_content_rel',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'flagged');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));

Related

TYPO3 - indexed_search generates wrong URL's in result

I am using indexed_search for the frontend, so users can search on my page, e.g. search for news.
But the URLs in the result of the search is wrong!
E.g.
Expected URL:
http://my-page.com/de/neuigkeiten/produktneuheiten/detail/neue-nachricht.html
Result URL:
http://my-page.com/de/neuigkeiten/produktneuheiten/detail/detail/News/neue-nachricht.html
You can see from the Result URL that /detail/News is rendered into the URL.
The structure of the pages looks like this:
Questions:
Why does /detail/News appear in the URL?
How can I fix it?
Please let me know if you need any informations from me.
typo3conf/realurl_conf.php
<?php
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] .= ',tx_realurl_pathsegment';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array (
'_DEFAULT' => array (
'init' => array (
'enableCHashCache' => '1',
'appendMissingSlash' => 'ifNotFile,redirect',
'enableUrlDecodeCache' => '1',
'enableUrlEncodeCache' => '1',
'emptyUrlReturnValue' => '/',
'postVarSet_failureMode' => ''
//'postVarSet_failureMode' => 'redirect_goodUpperDir'
),
'redirects' => array(
'de.html'=>'de/',
'en.html'=>'en/',
'fr.html'=>'fr/',
'es.html'=>'es/',
),
'preVars' => array (
array (
'GETvar' => 'no_cache',
'valueMap' => array (
'nc' => '1',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
'fr' => '2',
'es' => '3',
),
'valueDefault' => 'de',
),
array (
'GETvar' => 'lang',
'valueMap' => array (
'de' => 'de',
'en' => 'en',
'fr' => 'fr',
),
'noMatch' => 'bypass',
),
),
'pagePath' => array (
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '7',
'firstHitPathCache' => 1,
'rootpage_id' => '1',
),
'fixedPostVars' => array (
'newsDetailConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
)
)
),
'newsCategoryConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
'lookUpTable' => array(
'table' => 'sys_category',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
'newsTagConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_tag',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
'154' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
'155' => 'newsDetailConfiguration',
'156' => 'newsDetailConfiguration',
'157' => 'newsDetailConfiguration',
'399' => 'newsDetailConfiguration',
'71' => 'newsTagConfiguration',
'72' => 'newsCategoryConfiguration',
),
'postVarSets' => array (
'_DEFAULT' => array(
'productfinder' => array(
array(
'GETvar' => 'tx_mbclpdb_mbclproductfinder[controller]',
'noMatch' => 'bypass'
)
),
'filelist' => array(
array(
'GETvar' => 'tx_mbdownloads_mbfilelist[controller]',
'GETvar' => 'tx_mbdownloads_mbfilelistmarginal[controller]',
),
array(
'GETvar' => 'tx_mbdownloads_mbfilelist[action]',
'GETvar' => 'tx_mbdownloads_mbfilelistmarginal[action]',
'noMatch' => 'bypass'
),
),
'controller' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass'
)
),
'dateFilter' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
),
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
),
),
'page' => array(
array(
'GETvar' => 'tx_news_pi1[#widget_0][currentPage]',
),
),
),
),
'fileName' => array (
//
// if you don't want .html-URLs set the following to "false" (e.g. 'defaultToHTMLsuffixOnPrev' => false,)
// then you get http://www.yourdomain.com/imprint/ instead of http://www.yourdomain.com/imprint.html
//
'defaultToHTMLsuffixOnPrev' => true,
'index' => array (
'sitemap.xml' => array (
'keyValues' => array(
'type' => 776,
)
),
'rss.xml' => array (
'keyValues' => array (
'type' => '100',
),
),
'rss091.xml' => array (
'keyValues' => array (
'type' => '101',
),
),
'rdf.xml' => array (
'keyValues' => array (
'type' => '102',
),
),
'atom.xml' => array (
'keyValues' => array (
'type' => '103',
),
),
'news.rss' => array (
'keyValues' => array (
'type' => '9818',
),
),
'products.rss' => array (
'keyValues' => array (
'type' => '9819',
),
),
'events.rss' => array (
'keyValues' => array (
'type' => '9820',
),
),
'workshops.rss' => array (
'keyValues' => array (
'type' => '9821',
),
),
'news.json' => array (
'keyValues' => array (
'type' => '9898',
),
),
),
),
),
);
?>
I was able to solve it by deleting these two arrays from the filetypo3conf/realurl_conf.php:
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass'
),

i want use and/or connectors in cakedc search :its not working when i search" php+sql,java" the request dont change '+' to AND the same for',' to OR

im my model User.php
public $hasAndBelongsToMany = array(
'Competence' => array(
'with' => 'CompetencesUser',
'className' => 'Competence',
'joinTable' => 'competences_users',
'foreignKey' => 'user_id',
'associationForeignKey' => 'competence_id',
'unique' => 'keepExisting',
my $filterArgs () in my model User.php i use before to modifie my request in $query
'competences' => array(
'type' => 'subquery',
'method' => 'findByCompetences',
'field' => 'User.id',
'before'=>true)
im my function findByCompetences($data=array()) i want have cometence1 and competence2 and competence 3 or competence4
$this->CompetencesUser->Behaviors->attach('Containable', array(
'autoFields' => false
)
);
$this->CompetencesUser->Behaviors->attach('Search.Searchable');
$query = $this->CompetencesUser->getQuery('all', array(
'conditions' =>
array(
'Competence.competence' => $data['competences'],
'fields' => array(
'foreign_key'
),
'contain' => array(
'Competence'
),
'search_with_connectors' => array(
'type' => 'like',
'field' => 'Competence.competence',
'connectorAnd' => '+', 'connectorOr' => ','
)
)));
return $query;
}

RealURL extension not working for typo3 v6.2.x when domain given as IP Address

I have a webpage tree structure given below
In this tree when I access like http://localhost/mysite its redirect to "Root Local" and accessed like http://192.168.1.20/mysite/ its redirect to "Root IP" by setting it in domain.
I implemented realURL extension. and it working fine for localhost and URL become http://localhost/mysite/en/home/ .
But when I tried to access it by 192.168.1.20 as domain, the URL shows like http://192.168.1.20/mysite/en/home/.
Bur it shows the blank web page with error "This webpage has a redirect loop" .
My realurl_conf.php looks like
<?php
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
// sitename
'_DEFAULT' => array(
// initialization
'init' => array(
'useCHashCache' => '0', // für tt_news
'enableCHashCache' => true,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => true,
'enableUrlEncodeCache' => true,
'emptyUrlReturnValue' => '/'
),
// first url rewriting segment
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => 3,
'en' => 1,
),
'valueDefault' => 1,
),
),
// second url rewriting segment
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 30,
'rootpage_id' => 1
),
// third url rewriting segment
'fixedPostVars' => array(
),
// forth url rewriting segment
'postVarSets' => array(
'_DEFAULT' => array(
/*
no_cache setting should not be used in preVars
#see http://dmitry-dulepov.com/article/do-not-use-no-cache-as-prevar.html
*/
'nc' => array(
'type' => 'single',
'GETvar' => 'no_cache',
),
)
),
)
);
$byPassLVar = array(
array(
'GETvar' => 'L',
'valueMap' => array(),
'noMatch' => 'bypass'
)
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'];
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local']['pagePath']['rootpage_id'] = 1;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local']['preVars'] = $byPassLVar;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['192.168.1.20'];
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP']['pagePath']['rootpage_id'] = 3;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP']['preVars'] = $byPassLVar;
switch (t3lib_div::getIndpEnv('HTTP_HOST')) {
case 'Root_Local':
$_GET['L'] = 1;
break;
case 'Root_IP':
$_GET['L'] = 1;
break;
default:
$_GET['L'] = 1;
break;
}
?>
And I added in the main Template
config.simulateStaticDocuments = 0
config.baseURL = http://192.168.1.20/mysite/
config.tx_realurl_enable = 1
for the IP Address and
config.simulateStaticDocuments = 0
config.baseURL = http://localhost/mysite/
config.tx_realurl_enable = 1
for local host
Why it not working for the IP address as domain.??
How can I make it work ?
Thanks in advance
Finally I found an answer myself. I am not fully known how it works. If anyone can help me please be free to add it.
I edited my realurl_conf.php like this and work like a charm..
<?php
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
// sitename
'_DEFAULT' => array(
// initialization
'init' => array(
'useCHashCache' => '0',
'enableCHashCache' => true,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => true,
'enableUrlEncodeCache' => true,
'emptyUrlReturnValue' => '/'
),
// first url rewriting segment
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => 3,
'en' => 1,
),
'valueDefault' => 'en',
),
),
// second url rewriting segment
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 30,
'rootpage_id' => 1
),
// third url rewriting segment
'fixedPostVars' => array(
),
// forth url rewriting segment
'postVarSets' => array(
'_DEFAULT' => array(
/*
no_cache setting should not be used in preVars
#see http://dmitry-dulepov.com/article/do-not-use-no-cache-as-prevar.html
*/
'nc' => array(
'type' => 'single',
'GETvar' => 'no_cache',
),
)
),
)
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['192.168.1.20'] = array(
// sitename
// initialization
'init' => array(
'useCHashCache' => '0',
'enableCHashCache' => true,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => true,
'enableUrlEncodeCache' => true,
'emptyUrlReturnValue' => '/'
),
// first url rewriting segment
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => 3,
'en' => 1,
),
'valueDefault' => 'en',
),
),
// second url rewriting segment
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 30,
'rootpage_id' => 3
),
// third url rewriting segment
'fixedPostVars' => array(
),
// forth url rewriting segment
'postVarSets' => array(
'192.168.1.20' => array(
/*
no_cache setting should not be used in preVars
#see http://dmitry-dulepov.com/article/do-not-use-no-cache-as-prevar.html
*/
'nc' => array(
'type' => 'single',
'GETvar' => 'no_cache',
),
)
),
);
$byPassLVar = array(
array(
'GETvar' => 'L',
'valueMap' => array(),
'noMatch' => 'bypass'
)
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'];
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local']['pagePath']['rootpage_id'] = 1;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local']['preVars'] = $byPassLVar;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['192.168.1.20'];
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP']['pagePath']['rootpage_id'] = 3; //overwrite root page ID with the one for this specific domain
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP']['preVars'] = $byPassLVar;
switch (t3lib_div::getIndpEnv('HTTP_HOST')) {
case 'Root_Local':
case 'Root_Local':
$_GET['L'] = 1;
break;
case 'Root_IP':
case 'Root_IP':
$_GET['L'] = 1;
break;
default:
$_GET['L'] = 1;
break;
}
?>
Thank you.

generated url by paginator is not right in ZF2

I come across an issue with ZF2 Paginating. The generate url by paginator is not correct. Could anyone help point wrong place in my configuration? I just made small change for example in page:
http://framework.zend.com/manual/2.2/en/modules/zend.paginator.usage.html
Below is my change: module.config.php:
'routes' => array(
'shop' => array(
'type' => 'Literal',
'options' => array(
'route' => '/shop',
'defaults' => array(
'__NAMESPACE__' => 'Shop\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'paginator' => array(
'type' => 'segment',
'options' => array(
'route' => '/index/list[/page/:page]',
'defaults' => array(
'page' => 1,
),
),
),
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action][/:id]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
),
),
'view_manager' => array(
....
'template_map' => array(
...
'index/page' => __DIR__ . '/../view/shop/index/page.phtml',
),
'template_path_stack' => array(
__DIR__ . '/../view',
),
),
In the IndexController:
public function listAction(){
$array = array(
0 => array('id'=>1, 'name'=>'samsonasik'),
.......
);
$paginator = new \Zend\Paginator\Paginator(new \Zend\Paginator\Adapter\ArrayAdapter($array));
$paginator->setCurrentPageNumber($this->params()->fromRoute('page'));
$paginator->setItemCountPerPage(1);
$vm = new ViewModel();
$vm->setVariable('paginator', $paginator);
return $vm;
}
For the list.phtml:
<?php echo $this->paginationControl($this->paginator,
'Sliding',
'index/page', array('route' => 'shop/paginator')); ?>
The script type index/pgae is mapped to page.phtml. I tried all three example controls in:
http://framework.zend.com/manual/2.2/en/modules/zend.paginator.usage.html#example-pagination-controls and changes arguments of $this->url() but all fail. For example, for search pagination, I change all:
$this->url($this->route, array('page' => $this->previous));
to
$this->url($this->route, array('controller'=>'index','action'=>'list','page' => $page));
For page:HOST/shop/index/list, all href of 2,3..and next in pagination control point to
HOST/shop/index/list/page/2 HOST/shop/index/list/page/3
This is what I expected, but this url matches shop/default instead of shop/paginator
Now the problem become simple:
how to write shop/paginator router so that url HOST/shop/index/list/page/2 can be matched:
'paginator' => array(
'type' => 'segment',
'options' => array(
'route' => '/index/list[/page/:page]',
'defaults' => array(
'page' => 1,
),
),
),
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action][/:id]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),

Expression Engine: Create multiple publish form tabs when installing a module

Is it possible to create a module that outputs two tabs into the publish screen, or do I have two create another module to to create my second tab or just another tab.file.php file?
CODE
FILE: upd.my_module.php
class My_module_upd {
var $version = '1.0';
public function __construct(){
$this->EE =& get_instance();
}
public function install(){
$this->EE->load->dbforge();
$data = array(
'module_name' => 'My Module',
'module_version' => $this->version,
'has_cp_backend' => 'y',
'has_publish_fields' => 'y'
);
$this->EE->db->insert('modules', $data);
return true;
}
public function tabs(){
$tabs['tab_1'] = array(
'field_1' => array(
'visible' => TRUE,
'collapse' => FALSE,
'htmlbuttons' => TRUE,
'width' => '100%'
),
'field_2' => array(
'visible' => TRUE,
'collapse' => FALSE,
'htmlbuttons' => TRUE,
'width' => '100%'
)
);
$tabs['tab_2'] = array(
'field_1' => array(
'visible' => TRUE,
'collapse' => FALSE,
'htmlbuttons' => TRUE,
'width' => '100%'
),
);
return $tabs;
}
}
FILE: tab.my_module.php
class My_module_tab {
public function __construct(){
$this->EE =& get_instance();
}
public function publish_tabs($channel_id, $entry_id = ''){
$settings = array(
'field_1' => array(
'field_id' => 'field_1',
'field_label' => 'Field 1',
'field_type' => 'text',
'field_required' => 'n',
'field_data' => '',
'field_text_direction' => 'ltr',
'field_maxl' => 100,
'field_instructions' => '',
),
'field_2' => array(
'field_id' => 'field_2',
'field_label' => 'Field 2',
'field_type' => 'text',
'field_required' => 'n',
'field_data' => '',
'field_text_direction' => 'ltr',
'field_maxl' => 100,
'field_instructions' => '',
),
);
return $settings;
}
}
In the My_module_upd->tabs() method it looks like to can declare multiple tabs in the array but the My_module_tab class seems geared to controlling just one tab. Can anyone point me in the right direction?

Resources