I want to create an icingadb-web module and I’m successful except for the header.
I’m trying to create a header like this:
I thought that by placing $this->addTitleTab(t('CSV Export'));
in the controller, it would create the header.
Does anyone know what else is needed to display the header on the screen?
The version of icinga/icingaweb/icingadb-web is the latest snapshot version
See here the code :
<?php
namespace Icinga\Module\export\Controllers;
use Icinga\Module\Icingadb\Web\Controller;
use ipl\Web\Url;
use ipl\Web\Compat\CompatController;
use Icinga\Application\Config;
class exportController extends Controller
{
public function csvexportAction()
{
$this->addTitleTab(t('CSV Export'));
$config = $this->Config();
... my code ....
}
}
For security reasons, I had adjusted the name and forgot to consider the capital letters.
My module is working, but only the line of code addTitleTab is not functioning.
It doesn’t create the header.
What do you mean on GitHub? Should I open an issue in icingadb-web?
I don’t think this is a bug but rather that I don’t know how to do it because I’m not a PHP programmer.
I’d like to be able to set the title, with the refresh symbol next to it, and the close button on the right.
I thought this could be done for icingadb-web by placing the following line at the beginning of the code,
$this->addTitleTab(t(‘icingadb/hosts’));
but it does nothing at all.
Do you happen to know what I need to change in my code to display the title, refresh button, and close button on the screen?
you are mixing CompatController features with the in icingaweb2 previously more often used view part of the MVC-Pattern.
You can get rid of the whole columnexport.phtml (remove from disk) and use ipl code in your controller action:
use ipl\Html\Html;
$a = Html::tag('a',['href'=>"/path/",'name of the url']);
$div = Html::tag('div',['class'=>"test"]);
$div->add($a);
$this->addContent($div);