MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mnotification.class
Ir para a documentação deste ficheiro.
1<?php
2
4{
25 private $options;
26
27 public function __construct($title, $content = '', $icon = '', $otherOptions = array())
28 {
30
31 $this->options['title'] = $title;
32 $this->options['body'] = $content;
33 $this->options['icon'] = strlen($icon) > 0 ? $icon : $MIOLO->getUI()->getImageTheme($MIOLO->getTheme()->id, 'logo.png');
34 }
35
36 public function generate()
37 {
38 $title = $this->options['title'];
39 unset($this->options['title']);
40
41 $options = array();
42 foreach ($this->options as $name => $value)
43 {
44 $options[] = "$name: '{$value}'";
45 }
46
47 $optionsString = count($options) > 0 ? '{' . implode(', ', $options) . '}' : '';
48 $component = "if (location.protocol == 'https:') Push.create(\"$title\", $optionsString);";
49 MIOLO::getInstance()->page->addJsCode($component);
50 }
51
52
56 public function setRequireInteraction($requireInteraction)
57 {
58 $this->options['requireInteraction'] = $requireInteraction;
59 }
60
64 public function setTimeout($timeout)
65 {
66 $this->options['timeout'] = $timeout;
67 }
68
69}
70
71?>
static getInstance()
Definição miolo.class:134
setRequireInteraction($requireInteraction)
__construct($title, $content='', $icon='', $otherOptions=array())
$title
Definição base.php:3