Exemplo n.º 1
0
 protected function Opcao18()
 {
     $block = new XmlBlockCollection("Exemplo 18: UI Alert", BlockPosition::Center);
     //XmlnukeBreakLine br = new XmlnukeBreakLine();
     $para = new XmlParagraphCollection();
     $para->addXmlnukeObject(new XmlnukeText("Esse exemplo mostra como mostrar uma mensagem de alert no cliente"));
     $block->addXmlnukeObject($para);
     if ($this->_context->get("type") != "") {
         switch ($this->_context->get("type")) {
             case 1:
                 $uialert = new XmlnukeUIAlert($this->_context, UIAlert::Dialog, "Isso é um teste");
                 break;
             case 2:
                 $uialert = new XmlnukeUIAlert($this->_context, UIAlert::ModalDialog, "Isso é um teste");
                 $uialert->setAutoHide(10000);
                 break;
             case 3:
                 $uialert = new XmlnukeUIAlert($this->_context, UIAlert::ModalDialog, "Isso é um teste");
                 $uialert->addRedirectButton("Ok", $this->_url);
                 $uialert->addCloseButton("Cancel");
                 break;
             case 4:
                 $uialert = new XmlnukeUIAlert($this->_context, UIAlert::ModalDialog, "Isso é um teste");
                 $uialert->addRedirectButton("Ok, proceed!", $this->_url);
                 $uialert->addCloseButton("Cancel");
                 $uialert->setOpenAction(UIAlertOpenAction::Button, "Clique me");
                 break;
             case 5:
                 $uialert = new XmlnukeUIAlert($this->_context, UIAlert::BoxInfo, "Isso é um teste");
                 $uialert->setAutoHide(2000);
                 break;
             case 6:
                 $uialert = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert, "Isso é um teste");
                 break;
         }
         $uialert->addXmlnukeObject(new XmlnukeText("Isso é um novo teste, novo teste"));
         $block->addXmlnukeObject($uialert);
     }
     $list = array();
     $list[$this->_url . "?op=18&type=1"] = "Caixa de Diálogo";
     $list[$this->_url . "?op=18&type=2"] = "Caixa de Diálogo Modal";
     $list[$this->_url . "?op=18&type=3"] = "Caixa de Diálogo Modal com botão de fechar";
     $list[$this->_url . "?op=18&type=4"] = "Caixa de Diálogo Modal com botões de confirmação e abrir personalizado";
     $list[$this->_url . "?op=18&type=5"] = "Box de Informação com auto hide";
     $list[$this->_url . "?op=18&type=6"] = "Box de Alerta";
     $listElement = new XmlListCollection(XmlListType::UnorderedList, "Opções");
     foreach ($list as $key => $value) {
         $href = new XmlAnchorCollection($key);
         $href->addXmlnukeObject(new XmlnukeText($value));
         $listElement->addXmlnukeObject($href);
     }
     $block->addXmlnukeObject($listElement);
     $this->_document->addXmlnukeObject($block);
 }