Пример #1
0
            }
        }
}
$delete = $oPage->getGetValue('delete', 'bool');
if ($delete == 'true') {
    $script->delete();
}
$oPage->addItem(new IEPageTop(_('Editace skriptu') . ' ' . $script->getName()));
switch ($oPage->getRequestValue('action')) {
    case 'delete':
        $form = new EaseContainer();
        $form->addItem(new EaseHtmlH2Tag($script->getName()));
        $confirmator = $form->addItem(new EaseTWBPanel(_('Opravdu smazat ?')), 'danger');
        $confirmator->addItem(new EaseTWBWell(nl2br($script->getDataValue('body'))));
        $confirmator->addItem(new EaseTWBLinkButton('?' . $script->myKeyColumn . '=' . $script->getID(), _('Ne') . ' ' . EaseTWBPart::glyphIcon('ok'), 'success'));
        $confirmator->addItem(new EaseTWBLinkButton('?delete=true&' . $script->myKeyColumn . '=' . $script->getID(), _('Ano') . ' ' . EaseTWBPart::glyphIcon('remove'), 'danger'));
        break;
    default:
        $scriptEditor = new IECfgEditor($script);
        $form = new EaseTWBForm('Script', 'script.php', 'POST', $scriptEditor, array('class' => 'form-horizontal'));
        if (!$script->getId()) {
            $form->addItem(new EaseTWSubmitButton(_('Založit'), 'success'));
        } else {
            $form->addItem(new EaseTWSubmitButton(_('Uložit'), 'success'));
        }
        break;
}
$oPage->addItem(new IEPageBottom());
$infopanel = new IEInfoBox($script);
$tools = new EaseTWBPanel(_('Nástroje'), 'warning');
if ($script->getId()) {
Пример #2
0
 /**
  * Vrací řádek dat v HTML interpretaci
  *
  * @param array $row
  * @return array
  */
 public function htmlizeRow($row)
 {
     if (is_array($row) && count($row)) {
         foreach ($row as $key => $value) {
             if ($key == $this->myKeyColumn) {
                 continue;
             }
             if (!isset($this->useKeywords[$key])) {
                 continue;
             }
             $fieldType = $this->useKeywords[$key];
             $fType = preg_replace('/\\(.*\\)/', '', $fieldType);
             switch ($fType) {
                 case 'PLATFORM':
                     switch ($value) {
                         case 'windows':
                             $icon = 'logos/base/win40.gif';
                             break;
                         case 'linux':
                             $icon = 'logos/base/linux40.gif';
                             break;
                         default:
                             $icon = 'logos/unknown.gif';
                             break;
                     }
                     $row[$key] = '<img class="gridimg" src="' . $icon . '"> ' . $value;
                     break;
                 case 'BOOL':
                     if (is_null($value) || !strlen($value)) {
                         $row[$key] = '<em>NULL</em>';
                     } else {
                         if ($value === '0') {
                             $row[$key] = EaseTWBPart::glyphIcon('unchecked')->__toString();
                         } else {
                             if ($value === '1') {
                                 $row[$key] = EaseTWBPart::glyphIcon('check')->__toString();
                             }
                         }
                     }
                     break;
                 case 'IDLIST':
                     if (!is_array($value) && strlen($value)) {
                         if (strstr($value, ':{')) {
                             $values = unserialize(stripslashes($value));
                         } else {
                             $values = array('0' => $value);
                         }
                         if (!is_array($values)) {
                             $this->addStatusMessage(sprintf(_('Chyba unserializace %s #%s '), $value, $key));
                         }
                         if (isset($this->keywordsInfo[$key]['refdata'])) {
                             $idcolumn = $this->keywordsInfo[$key]['refdata']['idcolumn'];
                             $table = $this->keywordsInfo[$key]['refdata']['table'];
                             $searchColumn = $this->keywordsInfo[$key]['refdata']['captioncolumn'];
                             $target = str_replace('_id', '.php', $idcolumn);
                             foreach ($values as $id => $name) {
                                 if ($id) {
                                     $values[$id] = '<a title="' . $table . '" href="' . $target . '?' . $idcolumn . '=' . $id . '">' . $name . '</a>';
                                 } else {
                                     $values[$id] = '<a title="' . $table . '" href="search.php?search=' . $name . '&table=' . $table . '&column=' . $searchColumn . '">' . $name . '</a> ' . EaseTWBPart::glyphIcon('search');
                                 }
                             }
                         }
                         $value = implode(',', $values);
                         $row[$key] = $value;
                     }
                     break;
                 case 'USER':
                     $row[$key] = (string) $this->ownerLink((int) $row[$key]);
                     break;
                 default:
                     if (isset($this->keywordsInfo[$key]['refdata']) && strlen(trim($value))) {
                         $table = $this->keywordsInfo[$key]['refdata']['table'];
                         $searchColumn = $this->keywordsInfo[$key]['refdata']['captioncolumn'];
                         $row[$key] = '<a title="' . $table . '" href="search.php?search=' . $value . '&table=' . $table . '&column=' . $searchColumn . '">' . $value . '</a> ' . EaseTWBPart::glyphIcon('search');
                     }
                     if (strstr($key, 'image') && strlen(trim($value))) {
                         $row[$key] = '<img title="' . $value . '" src="logos/' . $value . '" class="gridimg">';
                     }
                     if (strstr($key, 'url')) {
                         $row[$key] = '<a href="' . $value . '">' . $value . '</a>';
                     }
                     break;
             }
         }
     }
     return $row;
 }