Example #1
0
 /**
  * Rozdělí stránku do třísloupcového layoutu
  */
 function addPageColumns()
 {
     $row = $this->container->addItem(new EaseHtmlDivTag(null, null, array('class' => 'row')));
     $this->columnI = $row->addItem(new EaseHtmlDivTag(null, null, array('class' => 'col-md-4')));
     $this->columnII = $row->addItem(new EaseHtmlDivTag(null, null, array('class' => 'col-md-4')));
     $this->columnIII = $row->addItem(new EaseHtmlDivTag(null, null, array('class' => 'col-md-4')));
 }
 /**
  * Umožňuje měnit parametry služeb
  *
  * @param IEService $service
  * @param IEHost    $host    ObjektHostu
  */
 public function __construct($service, $host)
 {
     parent::__construct();
     $this->service = $service;
     $this->host = $host;
     $this->command = new IECommand();
     $this->command->setmyKeyColumn($this->command->nameColumn);
     $checkLocal = $this->service->getDataValue('check_command');
     //        $checkRemote = $this->service->getDataValue('check_command-remote');
     if (isset($checkLocal)) {
         $this->command->loadFromMySQL($checkLocal);
     }
     $configurator = $this->service->getDataValue('configurator');
     if ($configurator) {
         $module = 'modules/' . $configurator . '.inc.php';
         if (file_exists($module)) {
             require_once $module;
             $this->configurator = $this->addItem(new $configurator($this));
         } else {
             $this->addStatusMessage(sprintf(_('Modul %s nebyl nalezen'), $module), 'error');
         }
     } else {
         $this->configurator = $this->addItem(new IEServiceConfigurator($this));
     }
 }
Example #3
0
 /**
  * Nastavuje titulek
  *
  * @param string $pageTitle
  */
 public function __construct($pageTitle = null)
 {
     parent::__construct('header');
     if (!is_null($pageTitle)) {
         EaseShared::webPage()->setPageTitle($pageTitle);
     }
 }
 /**
  * Potvrzovací dialog Twitter Bootstrapu
  *
  * @param string $name
  * @param string $url
  * @param string $title
  * @param mixed  $content
  * @param array  $properties
  */
 function __construct($name = null, $url, $title, $content = null, $properties = null)
 {
     if (isset($properties['class'])) {
         $properties['class'] .= ' modal fade';
     } else {
         $properties['class'] = 'modal fade';
     }
     parent::__construct($name, null, $properties);
     $modalDialog = $this->addItem(new EaseHtmlDivTag(null, null, array('class' => 'modal-dialog')));
     $modalContent = $modalDialog->addItem(new EaseHtmlDivTag(null, null, array('class' => 'modal-content')));
     $modalContent->addItem(new EaseHtmlDivTag(null, array(new EaseHtmlButtonTag('<span aria-hidden="true">&times;</span>', array('class' => 'close', 'data-dismiss' => 'modal', 'aria-label' => _('Zavřít'))), new EaseHtmlH4Tag($title, array('class' => 'modal-title'))), array('class' => 'modal-header')));
     $modalContent->addItem(new EaseHtmlDivTag(null, $content, array('class' => 'modal-body')));
     $modalContent->addItem(new EaseHtmlDivTag(null, array(new EaseHtmlButtonTag(_('Ne'), array('class' => "btn btn-default", 'data-dismiss' => "modal")), new EaseTWBLinkButton($url, _('Ano'), 'danger')), array('class' => 'modal-footer')));
 }
 /**
  * Umožňuje měnit parametry služeb
  *
  * @param IEContact $contact
  * @param IEHost    $host    ObjektHostu
  */
 public function __construct($contact)
 {
     parent::__construct();
     $this->subcontactTypes = array_combine($this->subcontactTypes, $this->subcontactTypes);
     $this->contact = $contact;
     $this->addItem(new EaseHtmlDivTag(null, _('Založeno') . ': ' . $this->contact->getDataValue('DatCreate')));
     $oPage = EaseShared::webPage();
     if ($oPage->isPosted()) {
         $oldId = $this->contact->getId();
         $contactType = $oPage->getRequestValue('contact');
         $contactData = $oPage->getRequestValue('cnt');
         if (isset($contactType) && strlen($contactData)) {
             if ($this->contact->fork(array($contactType => $contactData))) {
                 $this->addStatusMessage(sprintf(_('Kontaktní údaj %s %s byl přidán'), $contactType, $contactData), 'success');
                 $this->cnt = '';
             } else {
                 $this->addStatusMessage(sprintf(_('Kontaktní údaj %s %s nebyl přidán'), $contactType, $contactData), 'error');
                 $this->cnt = EaseShared::webPage()->getRequestValue('cnt');
             }
         }
         $this->contact->loadFromMySQL($oldId);
     }
 }
Example #6
0
 /**
  * Vloží do stránky widget pro editaci hodnoty
  *
  * @param EaseHtmlDivTag $fieldBlock
  * @param string         $fieldName
  * @param mixed          $value
  */
 public function insertWidget($fieldBlock, $fieldName, $value)
 {
     $disabled = false;
     $hint = '';
     $keywordInfo = $this->objectEdited->keywordsInfo[$fieldName];
     $fieldType = $this->objectEdited->useKeywords[$fieldName];
     $fType = preg_replace('/\\(.*\\)/', '', $fieldType);
     $required = isset($keywordInfo['requeired']) && $keywordInfo['requeired'] === true;
     if ($this->objectEdited->allowTemplating) {
         $effective = $this->objectEdited->getCfg($fieldName, true);
         $templateName = key($effective);
         $templateValue = current($effective);
         if ($fType == 'BOOL') {
             EaseShared::webPage()->addJavaScript("\$(\"#useTpl{$fieldName}\").change(function(){\n    if( this.checked ){\n        \$(\"[name='{$fieldName}']\").prop('disabled', true);\n        \$(\"input[name='{$fieldName}']\").bootstrapSwitch('toggleDisabled', true);\n\n    } else {\n        \$(\"[name='{$fieldName}']\").prop('disabled', false);\n        \$(\"input[name='{$fieldName}']\").bootstrapSwitch('toggleDisabled', false);\n    }\n\n});", null, true);
         } else {
             EaseShared::webPage()->addJavaScript("\$(\"#useTpl{$fieldName}\").change(function(){\n    if( this.checked ){\n        \$(\"[name='{$fieldName}']\").prop('disabled', true);\n    } else {\n        \$(\"[name='{$fieldName}']\").prop('disabled', false);\n    }\n\n});", null, true);
         }
         if ($templateName && !is_null($templateValue)) {
             $fieldBlock->addItem(new EaseHtmlCheckboxTag(null, true, 1, array('id' => 'useTpl' . $fieldName)));
             $hint = current($effective);
             $disabled = true;
         } else {
             $fieldBlock->addItem(new EaseHtmlCheckboxTag(null, false, 1, array('id' => 'useTpl' . $fieldName)));
             $hint = $value;
         }
         $fieldBlock->addItem(' ' . _('Hodnota z předlohy') . ':');
         $fieldBlock->addItem(new EaseHtmlATag('search.php?search=' . key($effective), key($effective)));
         $fieldBlock->addItem(': ' . current($effective));
     }
     if ($disabled) {
         EaseShared::webPage()->addJavaScript("\$(\"[name='{$fieldName}']\").prop('disabled', true);", null, true);
     }
     switch ($fType) {
         case 'INT':
         case 'STRING':
         case 'VARCHAR':
             //$fieldBlock->addItem($this->optionEnabler($fieldName));
             if ($required) {
                 $fieldBlock->addItem(new EaseTWBFormGroup($fieldName, new EaseHtmlInputTextTag($fieldName, $value, array('class' => 'required form-control', 'title' => $fieldName)), $hint, $keywordInfo['title']));
                 //                    $fieldBlock->addItem(new EaseHtmlDivTag(null, new EaseLabeledTextInput($fieldName, $value, $keywordInfo['title'], array('class' => 'required form-control', 'title' => $fieldName))));
             } else {
                 $fieldBlock->addItem(new EaseTWBFormGroup($fieldName, new EaseHtmlInputTextTag($fieldName, $value, array('title' => $fieldName, 'class' => 'form-control')), $hint, $keywordInfo['title']));
                 //                    $fieldBlock->addItem(new EaseLabeledTextInput($fieldName, $value, $keywordInfo['title'], array('title' => $fieldName, 'class' => 'form-control')));
             }
             break;
         case 'TINYINT':
         case 'BOOL':
             $fieldBlock->addItem(new EaseTWBFormGroup($keywordInfo['title'], new IEYesNoSwitch($fieldName, $value, 'on', array('id' => $keywordInfo['title'] . 'sw'))));
             break;
         case 'FLAGS':
             $values = array();
             $checkboxes = array();
             $flags = explode(',', str_replace(array($fType, "'", '(', ')'), '', $fieldType));
             foreach ($flags as $flag) {
                 if (isset($keywordInfo[$flag])) {
                     $checkboxes[$flag] = $keywordInfo[$flag];
                 } else {
                     $this->addStatusMessage(_('Chybi definice') . ' ' . $fieldName . ' ' . $flag, 'error');
                 }
             }
             foreach ($checkboxes as $chKey => $chTopic) {
                 $checkboxes[$chKey] = '&nbsp;' . $chTopic . '</br>';
                 if (strchr($value, $chKey)) {
                     $values[$chKey] = true;
                 } else {
                     $values[$chKey] = false;
                 }
             }
             $sliderField = $fieldBlock->addItem(new EaseTWBPanel($keywordInfo['title'], 'default', new EaseHtmlCheckboxGroup($fieldName, $checkboxes, $values)));
             $sliderField->setTagCss(array('width' => '100%'));
             break;
         case 'IDLIST':
             if (!is_array($value)) {
                 $values = array();
             }
             $fieldBlock->addItem(new IEGroupMembersEditor($fieldName, $keywordInfo['title'], $this->objectEdited, $value));
             break;
         case 'SLIDER':
             $sliderField = $fieldBlock->addItem(new EaseTWBPanel($keywordInfo['title'], 'default', new EaseTWBSlider($fieldName, (int) $value, array('data-slider-min' => 0))));
             $sliderField->setTagCss(array('width' => '100%'));
             break;
         case 'TEXT':
             $fieldBlock->addItem(new EaseTWBFormGroup($keywordInfo['title'], new EaseTWBTextarea($fieldName, $value, array('style' => 'width:100%'))));
             break;
         case 'ENUM':
             $flags = explode(',', str_replace(array($fType, "'", '(', ')'), '', $fieldType));
             $selector = $fieldBlock->addItem(new EaseLabeledSelect($fieldName, $value, $keywordInfo['title']));
             $selector->addItems(array_combine($flags, $flags));
             $selector->enclosedElement->setTagCss(array('width' => '100%'));
             $selector->enclosedElement->setTagClass('form-control');
             break;
         case 'PLATFORM':
             $fieldBlock->addItem(new EaseTWBFormGroup($keywordInfo['title'], new IEPlatformSelector($fieldName, null, $value)));
             break;
         case 'RADIO':
             $flags = explode(',', str_replace(array($fType, "'", '(', ')'), '', $fieldType));
             if (is_array($flags)) {
                 foreach (array_values($flags) as $flag) {
                     $infoFlags[$flag] = '&nbsp;' . $keywordInfo[$flag];
                 }
                 $buttons = new EaseHtmlRadiobuttonGroup($fieldName, $infoFlags);
                 $buttons->setValue($value);
                 $FB = $fieldBlock->addItem(new EaseTWBPanel($keywordInfo['title'], 'default', new EaseTWRadioButtonGroup($fieldName, $infoFlags, $value)));
                 $FB->setTagCss(array('width' => '100%'));
             }
             break;
         case 'SELECT':
             $IDColumn = $keywordInfo['refdata']['idcolumn'];
             $nameColumn = $keywordInfo['refdata']['captioncolumn'];
             $sTable = $keywordInfo['refdata']['table'];
             if (isset($keywordInfo['refdata']['condition'])) {
                 $conditions = $keywordInfo['refdata']['condition'];
             } else {
                 $conditions = array();
             }
             $sqlConds = " ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array($this->objectEdited->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array('public' => 1))) . ")  ";
             $membersAviableArray = EaseShared::myDbLink()->queryTo2DArray('SELECT ' . $nameColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE ' . $sqlConds . ' ' . 'ORDER BY ' . $nameColumn, $IDColumn);
             $selector = $fieldBlock->addItem(new EaseLabeledSelect($fieldName, $value, $keywordInfo['title']));
             $selector->enclosedElement->setTagClass('form-control');
             if (!$required) {
                 $selector->addItems(array('NULL' => _('Výchozí')));
             }
             if (count($membersAviableArray)) {
                 $selector->addItems(array_combine($membersAviableArray, $membersAviableArray));
             }
             break;
         case 'SELECTID':
             $IDColumn = $keywordInfo['refdata']['idcolumn'];
             $nameColumn = $keywordInfo['refdata']['captioncolumn'];
             $sTable = $keywordInfo['refdata']['table'];
             if (isset($keywordInfo['refdata']['condition'])) {
                 $conditions = $keywordInfo['refdata']['condition'];
             } else {
                 $conditions = array();
             }
             $sqlConds = " ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array($this->objectEdited->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array('public' => 1))) . ")  ";
             $membersAviableArray = EaseShared::myDbLink()->queryToArray('SELECT ' . $nameColumn . ',' . $IDColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE ' . $sqlConds . ' ' . 'ORDER BY ' . $nameColumn, $IDColumn);
             $selector = $fieldBlock->addItem(new EaseLabeledSelect($fieldName, $value, $keywordInfo['title']));
             $selector->enclosedElement->setTagClass('form-control');
             if (!$required) {
                 $selector->addItems(array('NULL' => _('Výchozí')));
             }
             if (count($membersAviableArray)) {
                 foreach ($membersAviableArray as $option) {
                     $options[$option[$IDColumn]] = $option[$nameColumn];
                 }
                 $selector->addItems($options);
             }
             break;
         case 'SELECT+PARAMS':
             $IDColumn = $keywordInfo['refdata']['idcolumn'];
             $nameColumn = $keywordInfo['refdata']['captioncolumn'];
             $sTable = $keywordInfo['refdata']['table'];
             if (isset($keywordInfo['refdata']['condition'])) {
                 $conditions = $keywordInfo['refdata']['condition'];
             } else {
                 $conditions = array();
             }
             $conditions['command_type'] = 'check';
             $sqlConds = " ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array('command_local' => true, $this->objectEdited->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $this->objectEdited->myDbLink->prepSelect($conditions) . " AND public=1 )  ";
             //                    $SqlConds = $this->ObjectEdited->myDbLink->prepSelect(array_merge($Conditions, array($this->ObjectEdited->userColumn => EaseShared::user()->getUserID())));
             if (isset($this->objectEdited->keywordsInfo['platform'])) {
                 $platform = $this->objectEdited->getDataValue('platform');
                 $sqlConds .= " AND ((`platform` =  '" . $platform . "') OR (`platform` = 'generic') OR (`platform` IS NULL) OR (`platform`='') ) ";
             }
             $membersAviableArray = EaseShared::myDbLink()->queryTo2DArray('SELECT ' . $nameColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE ' . $sqlConds . ' ' . 'ORDER BY ' . $nameColumn, $IDColumn);
             $selector = $fieldBlock->addItem(new EaseLabeledSelect($fieldName, $value, $keywordInfo['title']));
             $selector->enclosedElement->setTagClass('form-control');
             if (!$required) {
                 $selector->addItems(array('' => ''));
             }
             if (count($membersAviableArray)) {
                 $selector->addItems(array_combine($membersAviableArray, $membersAviableArray));
             }
             $sqlConds = " ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array('command_remote' => true, $this->objectEdited->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $this->objectEdited->myDbLink->prepSelect($conditions) . " AND public=1 )  ";
             //                    $SqlConds = $this->ObjectEdited->myDbLink->prepSelect(array_merge($Conditions, array($this->ObjectEdited->userColumn => EaseShared::user()->getUserID())));
             $membersAviableArray = EaseShared::myDbLink()->queryTo2DArray('SELECT ' . $nameColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE ' . $sqlConds . ' ' . 'ORDER BY ' . $nameColumn, $IDColumn);
             $addNewItem = $fieldBlock->addItem(new EaseHtmlInputSearchTag($fieldName . '-remote', $this->objectEdited->getDataValue($fieldName . '-remote'), array('class' => 'search-input', 'title' => _('vzdálený test'))));
             $addNewItem->setDataSource('jsoncommand.php?maxRows=10');
             $fieldBlock->addItem(new EaseLabeledTextInput($fieldName . '-params', $this->objectEdited->getDataValue($fieldName . '-params'), _('Parametry'), array('style' => 'width: 100%')));
             break;
         case 'USER':
             $fieldBlock->addItem(new IEUserSelect($fieldName, null, $this->objectEdited->getDataValue($fieldName), null, array('style' => 'width: 100%')));
             break;
         default:
             $fieldBlock->addItem(new EaseLabeledTextInput($fieldName, $value, $keywordInfo['title'], array('title' => $fieldName)));
             $this->addStatusMessage(sprintf(_('Neznámý typ %s pro sloupec %s'), $fType, $fieldName), 'warning');
             break;
     }
 }
 public function __construct($id = null)
 {
     parent::__construct($id, null, array('class' => 'loader', 'data-initialize' => 'loader'));
 }
Example #8
0
 /**
  * Vytvoří hlavní menu
  */
 public function __construct()
 {
     parent::__construct('MainMenu');
 }
Example #9
0
    $forceID = $oPage->getRequestValue('force_id', 'int');
    if (!is_null($forceID)) {
        EaseShared::user(new IEUser($forceID));
        EaseShared::user()->SettingsColumn = 'settings';
        $oUser->setSettingValue('admin', TRUE);
        $oUser->addStatusMessage(_('Přihlášen jako: ') . $oUser->getUserLogin(), 'success');
        EaseShared::user()->loginSuccess();
        $oPage->redirect('main.php');
        exit;
    } else {
        $oPage->addStatusMessage(_('Prosím zadejte vaše přihlašovací udaje'));
    }
}
$oPage->addItem(new IEPageTop(_('Přihlaš se')));
$oPage->addPageColumns();
$loginFace = new EaseHtmlDivTag('LoginFace');
$oPage->columnI->addItem(new EaseHtmlDivTag('WelcomeHint', _('Zadejte, prosím, Vaše přihlašovací údaje:')));
$loginForm = $loginFace->addItem(new EaseTWBForm('Login'));
$loginForm->addItem(new EaseTWBFormGroup(_('Uživatelské jméno'), new EaseHtmlInputTextTag('login', $login)));
$loginForm->addItem(new EaseTWBFormGroup(_('Heslo'), new EaseHtmlInputPasswordTag('password')));
$loginForm->addItem(new EaseTWSubmitButton('LogIn', _('Přihlášení')));
$oPage->columnII->addItem($loginFace);
$oPage->columnI->addItem(new EaseTWBLinkButton('passwordrecovery.php', _('Obnova hesla')));
/*
 $oPage->columnII->addItem(new EaseHtmlDivTag('TwitterAuth', IETwitter::AuthButton('twauth.php')));

 $oPage->columnIII->addItem( '
 <a class="twitter-timeline"  href="https://twitter.com/VSMonitoring" data-widget-id="255378607919210497">Tweets by @VSMonitoring</a>
 <script>!function (d,s,id) {var js,fjs=d.getElementsByTagName(s)[0];if (!d.getElementById(id)) {js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
 ' );
*/