Ejemplo n.º 1
0
 /**
  * Editor k přidávání členů skupiny
  *
  * @param IEService|IEHost $holder
  */
 public function __construct($holder)
 {
     $contactsAssigned = array();
     parent::__construct();
     $fieldName = $this->getmyKeyColumn();
     $initialContent = new EaseTWBPanel(_('Cíle notifikací'));
     $initialContent->setTagCss(array('width' => '100%'));
     if (is_null($holder->getMyKey())) {
         $initialContent->addItem(_('Nejprve je potřeba uložit záznam'));
     } else {
         $serviceName = $holder->getName();
         $contact = new IEContact();
         $allContacts = $contact->getListing(null, true, array('alias', 'parent_id'));
         foreach ($holder->getDataValue('contacts') as $contactId => $contactName) {
             if (isset($allContacts[$contactId])) {
                 $contactsAssigned[$contactId] = $allContacts[$contactId];
             }
         }
         foreach ($allContacts as $contactID => $contactInfo) {
             if ($contactInfo['register'] != 1) {
                 unset($allContacts[$contactID]);
             }
             if (!$contactInfo['parent_id']) {
                 unset($allContacts[$contactID]);
             }
         }
         foreach ($contactsAssigned as $contactID => $contactInfo) {
             unset($allContacts[$contactID]);
         }
         if (count($allContacts)) {
             foreach ($allContacts as $contactID => $contactInfo) {
                 $initialContent->addItem(new EaseTWBButtonDropdown($contactInfo[$contact->nameColumn], 'inverse', 'xs', array(new EaseHtmlATag('contacttweak.php?contact_id=' . $contactInfo['parent_id'] . '&service_id=' . $holder->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag('?addcontact=' . $contactInfo[$contact->nameColumn] . '&contact_id=' . $contactID . '&' . $holder->getmyKeyColumn() . '=' . $holder->getMyKey() . '&' . $holder->nameColumn . '=' . $holder->getName(), EaseTWBPart::GlyphIcon('plus') . ' ' . _('Začít obesílat')))));
             }
         }
         if (count($contactsAssigned)) {
             $initialContent->addItem('<br/>');
             foreach ($contactsAssigned as $contactID => $contactInfo) {
                 $initialContent->addItem(new EaseTWBButtonDropdown($contactInfo[$contact->nameColumn], 'success', 'xs', array(new EaseHtmlATag('?delcontact=' . $contactInfo[$contact->nameColumn] . '&amp;contact_id=' . $contactID . '&amp;' . $holder->getmyKeyColumn() . '=' . $holder->getMyKey() . '&amp;' . $holder->nameColumn . '=' . $holder->getName(), EaseTWBPart::GlyphIcon('remove') . ' ' . _('Přestat obesílat')), new EaseHtmlATag('contacttweak.php?contact_id=' . $contactInfo['parent_id'] . '&amp;service_id=' . $holder->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')))));
             }
         }
     }
     $this->addItem($initialContent);
 }
Ejemplo n.º 2
0
 /**
  * Vložení menu
  */
 public function afterAdd()
 {
     $nav = $this->addItem(new IEBootstrapMenu());
     $user = EaseShared::user();
     $userID = $user->getUserID();
     if ($userID) {
         //Authenticated user
         $nav->addMenuItem(new IENavBarSearchBox('search', 'search.php'));
         if ($user->getSettingValue('admin')) {
             $users = $user->getColumnsFromMySQL(array('id', 'login'), array('id' => '!0'), 'login', $user->getmyKeyColumn());
             $userList = array();
             if ($users) {
                 foreach ($users as $uID => $uInfo) {
                     $userList['userinfo.php?user_id=' . $uInfo['id']] = EaseTWBPart::GlyphIcon('user') . '&nbsp;' . $uInfo['login'];
                 }
                 if (count($userList)) {
                     $userList[] = '';
                 }
             }
             //                $usergroups = $this->myDbLink->queryToArray('SELECT * FROM user_groups' . 'usergroup_id');
             $nav->addDropDownMenu(_('Uživatelé'), array_merge($userList, array('createaccount.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nový uživatel'), 'users.php' => EaseTWBPart::GlyphIcon('list') . '&nbsp;' . _('Přehled uživatelů'), 'usergroup.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nová skupina uživatelů'), 'usergroups.php' => EaseTWBPart::GlyphIcon('list') . '&nbsp;' . _('Přehled skupin uživatelů'))));
         }
         $this->changesButton($nav);
         $this->groupsHostsMenu($nav);
         //            $nav->addDropDownMenu(_('Hosti'), $hostGroupHostsMenuItem);
         if (EaseShared::user()->getSettingValue('admin')) {
             $nav->addDropDownMenu(_('Služby'), array('wizard-service.php' => EaseTWBPart::GlyphIcon('forward') . ' ' . _('Průvodce založením služby'), 'service.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nová služba'), 'services.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled služeb'), 'servicegroup.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nová skupina služeb'), 'servicegroups.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled skupin služeb'), '' => '', 'stemplate.php?action=new' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nová předloha sledované služby'), 'stemplates.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled předloh sled. sl.')));
         } else {
             $service = new IEService();
             $services = $service->getListing(null, null, array('icon_image', 'platform'));
             if (count($services)) {
                 $services_menu = array('services.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled služeb'));
                 foreach ($services as $serviceID => $serviceInfo) {
                     $services_menu['servicetweak.php?service_id=' . $serviceID] = $serviceInfo[$service->nameColumn];
                 }
                 $nav->addDropDownMenu(_('Služby'), $services_menu);
             }
         }
         $contact = new IEContact();
         $contacts = $contact->getListing(null, null, array('parent_id'));
         foreach ($contacts as $contactID => $contactInfo) {
             //Vyfiltrovat pouze primární kontakty
             if ($contactInfo['parent_id']) {
                 unset($contacts[$contactID]);
             }
         }
         if (count($contacts)) {
             $contacts_menu = array('contacts.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled Kontaktů'));
             foreach ($contacts as $contactID => $contactInfo) {
                 $contacts_menu['contacttweak.php?contact_id=' . $contactID] = $contactInfo[$contact->nameColumn];
             }
             $contacts_menu[] = '';
         } else {
             $contacts_menu = array();
         }
         $nav->addDropDownMenu(_('Kontakty'), array_merge($contacts_menu, array('contacts.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled kontaktů'), 'newcontact.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nový kontakt'), 'contactgroups.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled skupin kontaktů'), 'contactgroup.php' => EaseTWBPart::GlyphIcon('edit') . ' ' . _('Nová skupina kontaktů'))));
         if ($user->getSettingValue('admin')) {
             $nav->addDropDownMenu(_('Příkaz'), array('command.php' => EaseTWBPart::GlyphIcon('edit') . ' ' . _('Nový příkaz'), 'commands.php' => EaseTWBPart::GlyphIcon('list-alt') . ' ' . _('Přehled příkazů'), 'importcommand.php' => EaseTWBPart::GlyphIcon('import') . ' ' . _('Importovat'), '', 'script.php' => EaseTWBPart::GlyphIcon('edit') . ' ' . _('Nový skript'), 'scripts.php' => EaseTWBPart::GlyphIcon('list-alt') . ' ' . _('Přehled skriptů')));
             $nav->addDropDownMenu(_('Rozšířené'), array('timeperiods.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled časových period'), 'timeperiod.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nová časová perioda'), 'preferences.php' => EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Nastavení icingy'), 'regenall.php' => EaseTWBPart::GlyphIcon('ok') . ' ' . _('Přegenerovat všechny konfiguráky'), 'reset.php' => EaseTWBPart::GlyphIcon('cog') . ' ' . _('Reset Objektů'), 'dbrecreate.php' => EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Reinicializovat databázi'), 'fixer.php' => EaseTWBPart::GlyphIcon('ok-circle') . ' ' . _('Opravit databázi'), 'import.php' => EaseTWBPart::GlyphIcon('import') . ' ' . _('Importovat')));
         }
         $results = array('nagstamon.php' => EaseTWBPart::GlyphIcon('info') . ' ' . _('PC Lin/Win/Mac'), 'anag.php' => EaseTWBPart::GlyphIcon('info') . ' ' . _('Android'), 'wpnag.php' => EaseTWBPart::GlyphIcon('Info') . ' ' . _('Win Phone'));
         if (file_exists('/etc/apache2/conf-enabled/icinga-web.conf')) {
             $results['/icinga-web/'] = EaseTWBPart::GlyphIcon('Info') . ' ' . _('Web');
         }
         $nav->addDropDownMenu(_('Výsledky testů'), $results);
     }
 }