/** * Retorna un modelo de comandos administrativos disponibles */ function cargar_comandos($seleccionar_proyecto = null) { $instalacion = $this->toba_instalador->get_instalacion(); //---El formato es Nombre,Imagen,Clave, Label $modelo = new GtkTreeStore(Gtk::TYPE_STRING, Gtk::TYPE_OBJECT, Gtk::TYPE_STRING, Gtk::TYPE_STRING); $path = toba_nucleo::toba_dir() . '/www/img/instalacion.png'; $img = GdkPixbuf::new_from_file($path); $raiz = null; $path_inst = $instalacion->get_dir(); $nodo_instal = $modelo->append($raiz, array('Instalación', $img, 'instalacion', "Instalación")); $seleccion = null; if ($instalacion->existe_info_basica()) { //---Agrega las instancias foreach ($instalacion->get_lista_instancias() as $id_instancia) { $instancia = $instalacion->get_instancia($id_instancia); $path = toba_nucleo::toba_dir() . '/www/img/instancia.gif'; $img = GdkPixbuf::new_from_file($path); $nodo_inst = $modelo->append($nodo_instal, array($id_instancia, $img, 'instalacion/' . $id_instancia, "Instancia {$id_instancia}")); //---Agrega los proyectos $path = toba_nucleo::toba_dir() . '/www/img/nucleo/proyecto.gif'; $img = GdkPixbuf::new_from_file($path); foreach ($instancia->get_lista_proyectos_vinculados() as $id_proyecto) { $nodo_pro = $modelo->append($nodo_inst, array($id_proyecto, $img, 'instalacion/' . $id_instancia . '/' . $id_proyecto, "Proyecto {$id_proyecto}")); if ($id_proyecto == $seleccionar_proyecto) { $seleccion = $nodo_pro; } } } //---BASES $path = toba_nucleo::toba_dir() . '/www/img/fuente.png'; $img = GdkPixbuf::new_from_file($path); $nodo_bases = $modelo->append($raiz, array('Bases', $img, 'base', 'Bases de Toba')); foreach ($instalacion->get_lista_bases() as $db) { $modelo->append($nodo_bases, array($db, $img, 'base_' . $db, "Base '{$db}'")); } } //--- Comandos extra $path = toba_nucleo::toba_dir() . '/www/img/cpu.png'; $img = GdkPixbuf::new_from_file($path); $modelo->append($raiz, array('Núcleo', $img, 'nucleo', 'Núcleo de Toba')); $path = toba_nucleo::toba_dir() . '/www/img/ayuda.png'; $img = GdkPixbuf::new_from_file($path); $modelo->append($raiz, array('Documentación', $img, 'doc', 'Documentación')); $path = toba_nucleo::toba_dir() . '/www/img/objetos/item.gif'; $img = GdkPixbuf::new_from_file($path); $modelo->append($raiz, array('Items', $img, 'item', 'Items')); $path = toba_nucleo::toba_dir() . '/www/img/testing.gif'; $img = GdkPixbuf::new_from_file($path); $modelo->append($raiz, array('Testing', $img, 'test', 'Testing')); //--- Expansion $this->comp['arbol_comandos']->set_model($modelo); $this->comp['arbol_comandos']->expand_row(0, true); if (isset($seleccion)) { return $seleccion; } }
public function onFullTextSearchClick() { if (!$this->manual) { // TODO: One might think aobut using an external browser or the online docs... $dialog = new \GtkMessageDialog($this->glade->get_widget('mainwindow'), 0, \Gtk::MESSAGE_ERROR, \Gtk::BUTTONS_OK, 'GtkHTML needed'); $dialog->set_markup('For doing full text searches GtkHTML support is required in your PHP configuration.'); $dialog->run(); $dialog->destroy(); return; } $input = trim($this->glade->get_widget('searchentry')->get_text()); if (strlen($input) == 0) { $dialog = new \GtkMessageDialog($this->glade->get_widget('mainwindow'), 0, \Gtk::MESSAGE_ERROR, \Gtk::BUTTONS_OK, 'No input'); $dialog->set_markup('No search term entered'); $dialog->run(); $dialog->destroy(); return; } $results = $this->manual->searchFulltext($input); $store = new \GtkTreeStore(\GObject::TYPE_STRING, \GObject::TYPE_PHP_VALUE); foreach ($results as $title => $found) { $man_container = $store->append(null, array($title, null)); $basenamelen = strlen('phar://' . $found->getArchiveFileName()); echo 'phar://' . $found->getArchiveFileName(), "\n"; foreach ($found as $item) { /** @var $item \SplFileObject */ $doc = \DomDocument::loadHTMLFile($item->getPathname()); $caption = $doc->getElementsByTagName('title')->item(0)->firstChild->wholeText; $store->append($man_container, array($caption, $item)); } } $tree = $this->glade->get_widget('searchtreeview'); $tree->set_model($store); $tree->get_selection()->connect('changed', array($this->mainWindow, 'onSearchResultClick')); /* TODO: Move to view */ $cell_renderer = new \GtkCellRendererText(); $colExt = new \GtkTreeViewColumn('', $cell_renderer, 'text', 0); $tree->append_column($colExt); }