Exemplo n.º 1
0
     /**
  * get a new class instance
  */
 public static function get()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemplo n.º 2
0
    /**
     * converts a given value to the specified structure
     *
     * @param $value
     * @return mixed
     * @throws base_database_Exception
     * @throws base_exception_Mapper
     */
    public function mapFieldValue($value)
    {
        $obj = Factory::createObject('TSMCollocgroup');
        $table = DB::table($obj->getTable());
        $where = DB::where($table->getColumn('name'), DB::term($value));
        $where->addAnd($table->getColumn('FK_tsmserver'), DB::term(TSMServerManager::get()->getActualTsmServerLK()));
        $finder = Finder::create('TSMCollocgroup')->setWhere($where);
        $result = $finder->find(array($table->getColumn('LK')));

        if (count($result) > 1) {
            throw new base_exception_Mapper(TMS('tsmviewer.exception.mapper.collocgroupDuplicatedEntry'));
        }

        $lkArray = current($result);

        return $lkArray['LK'];
    }
Exemplo n.º 3
0
 /**
  */
 protected function addValuesToData(array $data)
 {
     $data['FK_tsmserver'] = TSMServerManager::get()->getActualTsmServerLK();
     return $data;
 }
Exemplo n.º 4
0
base_ui_Site::displayNavigation($od);
base_ui_Site::startMainContent($od);

$od->addContent(Html::startTag('h3'));
$od->addContent('Import der TSMServer Klassen');
$od->addContent(Html::endTag('h3'));

$importer = new base_importer_csv_BaseObject('tsmserver', ROOT . "/modules/tsmviewer/init/tsmserver_data.csv");
$importer->import();

$result = Finder::create('TSMServer')->find();

$od->addContent(Html::startTag('ul'));

foreach ($result as $obj) {
    TSMServerManager::get()->setActualTsmServerLK((int) $obj['LK']);
    $od->addContent(Html::startTag('li', array('class' => 'serverList')));
    $od->addContent("Import der Daten zu TSM Server '{$obj['name']}'");
    $od->addContent(Html::startTag('ul'));

    $importer = new tsmviewer_importer_csv_TSMObject('tsmdomain', ROOT . "/modules/tsmviewer/init/tsmdomain_{$obj['LK']}_data.csv", ',', false);
    $ret = $importer->import();

    if ($ret == tsmviewer_importer_csv_TSMObject::SUCCESS) {
        $od->addContent(Html::startTag('li'));
        $od->addContent("Die Domains wurden erfolgreich importiert");
        $od->addContent(Html::endTag('li'));
    }

    $importer = new tsmviewer_importer_csv_TSMObject('tsmcollocgroup', ROOT . "/modules/tsmviewer/init/tsmcollocgroup_{$obj['LK']}_data.csv", ',', false);
    $ret = $importer->import();