2
0
forked from Wavyzz/dolibarr

Opensurvey polls tab cards can now be extended from external modules

This commit is contained in:
Marcos García de La Fuente
2014-01-02 16:32:48 +01:00
parent 048ea8062a
commit 5f3d2aea51
5 changed files with 38 additions and 23 deletions

View File

@@ -16,7 +16,7 @@ For developers:
- New: Add path file of trigger into admin trigger list page. - New: Add path file of trigger into admin trigger list page.
- New: More phpunit tests. - New: More phpunit tests.
- New: Payments and supplier payment pages tabs can now be extended from modules. - New: Payments and supplier payment pages tabs can now be extended from modules.
- New: Opensurvey polls tab cards can now be extended from external modules.
***** ChangeLog for 3.5 compared to 3.4.* ***** ***** ChangeLog for 3.5 compared to 3.4.* *****

View File

@@ -134,6 +134,7 @@ class modMyModule extends DolibarrModules
// 'payment' to add a tab in payment view // 'payment' to add a tab in payment view
// 'payment_supplier' to add a tab in supplier payment view // 'payment_supplier' to add a tab in supplier payment view
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
// 'opensurveypoll' to add a tab in opensurvey poll view
$this->tabs = array(); $this->tabs = array();
// Dictionnaries // Dictionnaries

View File

@@ -173,17 +173,7 @@ $toutsujet=str_replace("°","'",$toutsujet);
print '<form name="updatesurvey" action="'.$_SERVER["PHP_SELF"].'?id='.$numsondageadmin.'" method="POST">'."\n"; print '<form name="updatesurvey" action="'.$_SERVER["PHP_SELF"].'?id='.$numsondageadmin.'" method="POST">'."\n";
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
$head = array(); $head = opensurvey_prepare_head($object);
$head[0][0] = '';
$head[0][1] = $langs->trans("Card");
$head[0][2] = 'general';
$h++;
$head[1][0] = 'adminstuds_preview.php?sondage='.$object->id_sondage_admin;
$head[1][1] = $langs->trans("SurveyResults").'/'.$langs->trans("Preview");
$head[1][2] = 'preview';
$h++;
print dol_get_fiche_head($head,'general',$langs->trans("Survey"),0,dol_buildpath('/opensurvey/img/object_opensurvey.png',1),1); print dol_get_fiche_head($head,'general',$langs->trans("Survey"),0,dol_buildpath('/opensurvey/img/object_opensurvey.png',1),1);

View File

@@ -406,17 +406,7 @@ $toutsujet=str_replace("°","'",$toutsujet);
print '<form name="formulaire4" action="#" method="POST" onkeypress="javascript:process_keypress(event)">'."\n"; print '<form name="formulaire4" action="#" method="POST" onkeypress="javascript:process_keypress(event)">'."\n";
$head = array(); $head = opensurvey_prepare_head($object);
$head[0][0] = 'adminstuds.php?sondage='.$object->id_sondage_admin;
$head[0][1] = $langs->trans("Card");
$head[0][2] = 'general';
$h++;
$head[1][0] = 'adminstuds_preview.php?sondage='.$object->id_sondage_admin;
$head[1][1] = $langs->trans("SurveyResults").'/'.$langs->trans("Preview");
$head[1][2] = 'preview';
$h++;
print dol_get_fiche_head($head,'preview',$langs->trans("Survey"),0,dol_buildpath('/opensurvey/img/object_opensurvey.png',1),1); print dol_get_fiche_head($head,'preview',$langs->trans("Survey"),0,dol_buildpath('/opensurvey/img/object_opensurvey.png',1),1);

View File

@@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -21,7 +22,40 @@
* \brief Functions for module * \brief Functions for module
*/ */
/**
* Returns an array with the tabs for the "Opensurvey poll" section
* It loads tabs from modules looking for the entity Opensurveyso
*
* @param Opensurveysondage $object Current viewing poll
* @return array Tabs for the opensurvey section
*/
function opensurvey_prepare_head(Opensurveysondage $object) {
global $langs, $conf;
$h = 0;
$head = array();
$head[0][0] = 'adminstuds.php?id='.$object->id_sondage_admin;
$head[0][1] = $langs->trans("Card");
$head[0][2] = 'general';
$h++;
$head[1][0] = 'adminstuds_preview.php?id='.$object->id_sondage_admin;
$head[1][1] = $langs->trans("SurveyResults").'/'.$langs->trans("Preview");
$head[1][2] = 'preview';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'opensurveypoll');
complete_head_from_modules($conf,$langs,$object,$head,$h,'opensurveypoll', 'remove');
return $head;
}
/** /**
* Show header for new member * Show header for new member