Esempio n. 1
0
 /**
  * @param DetectedNewFiles $event
  */
 public function onDetectedNewFilesSendNotice(DetectedNewFiles $event)
 {
     // get link for search item
     $link = null;
     if ($plugin = $this->search->getDafeultPlugin()) {
         $link = $plugin->getLinkForSearch($event->getName());
     } elseif ($this->search->hasPlugins()) {
         $link = $this->router->generate('fill_search_in_all', [SearchPluginForm::FORM_NAME => ['name' => $event->getName()]]);
     }
     $this->sendNotice(self::NOTICE_TYPE_DETECTED_FILES_FOR_NEW_ITEM, ['storage' => $event->getStorage(), 'name' => $event->getName(), 'link' => $link]);
 }
Esempio n. 2
0
 /**
  * @return ItemInterface
  */
 public function createMainMenu()
 {
     /* @var $menu ItemInterface */
     $menu = $this->factory->createItem('root')->setUri($this->request_stack->getMasterRequest()->getRequestUri());
     $menu->addChild('Search', ['route' => 'home_search'])->setLinkAttribute('class', 'icon-label icon-gray-search');
     $add = $menu->addChild('Add record')->setLabelAttribute('class', 'icon-label icon-gray-add');
     // synchronization items
     if ($this->plugin_import->hasPlugins() || $this->plugin_export->hasPlugins()) {
         $sync = $menu->addChild('Synchronization')->setLabelAttribute('class', 'icon-label icon-white-cloud-sync');
         // add import plugin items
         $this->addPluginItems($this->plugin_import, $sync, 'Import items', '', 'icon-label icon-white-cloud-download');
         // add export plugin items
         $this->addPluginItems($this->plugin_export, $sync, 'Export items', '', 'icon-label icon-white-cloud-arrow-up');
     }
     $settings = $menu->addChild('Settings')->setLabelAttribute('class', 'icon-label icon-gray-settings');
     // add search plugin items
     $this->addPluginItems($this->plugin_search, $add, 'Search by name', 'Search by name the source of filling item', 'icon-label icon-white-search');
     if ($this->plugin_search->hasPlugins()) {
         $add->addChild('Search in all plugins', ['route' => 'fill_search_in_all'])->setAttribute('title', $this->translator->trans('Search by name in all plugins'))->setLinkAttribute('class', 'icon-label icon-white-cloud-search');
         $add->addChild('Add from URL', ['route' => 'fill_search_filler'])->setAttribute('title', $this->translator->trans('Search plugin by the URL for filling item'))->setLinkAttribute('class', 'icon-label icon-white-cloud-search');
     }
     // add filler plugin items
     $this->addPluginItems($this->plugin_filler, $add, 'Fill from source', 'Fill record from source (example source is URL)', 'icon-label icon-white-share');
     // add manually
     $add->addChild('Fill manually', ['route' => 'item_add_manually'])->setLinkAttribute('class', 'icon-label icon-white-add');
     $settings->addChild('File storages', ['route' => 'storage_list'])->setLinkAttribute('class', 'icon-label icon-white-storage');
     $settings->addChild('List of notice', ['route' => 'notice_list'])->setLinkAttribute('class', 'icon-label icon-white-alert');
     $settings->addChild('Labels', ['route' => 'label'])->setLinkAttribute('class', 'icon-label icon-white-label');
     $plugins = $settings->addChild('Plugins')->setLabelAttribute('class', 'icon-label icon-white-plugin');
     $settings->addChild('Update', ['route' => 'update'])->setLinkAttribute('class', 'icon-label icon-white-update');
     $settings->addChild('General', ['route' => 'home_settings'])->setLinkAttribute('class', 'icon-label icon-white-settings');
     // plugins
     $plugins->addChild('Installed', ['route' => 'plugin_installed'])->setLinkAttribute('class', 'icon-label icon-white-plugin');
     $plugins->addChild('Store', ['route' => 'plugin_store'])->setLinkAttribute('class', 'icon-label icon-white-shop');
     // add settings plugin items
     foreach ($this->plugin_setting->getPlugins() as $plugin) {
         /* @var $plugin PluginInMenuInterface */
         $plugin->buildMenu($plugins);
     }
     // add link to guide
     $settings->addChild('Help', ['uri' => $this->api_client->getSiteUrl(self::GUIDE_LINK)])->setLinkAttribute('class', 'icon-label icon-white-help');
     return $menu;
 }