Exemplo n.º 1
0
Arquivo: Lk.php Projeto: kafruhs/fws
    public function fromDBToExternal($value)
    {
        $obj = Factory::createObject($this->fi->getConnectedClass());
        $select = new base_database_statement_Select();
        $table = DB::table($obj->getTable());
        $where = DB::where($table->getColumn('LK'), DB::intTerm((int) $value));
        $select->setTable($table);
        $select->setWhere($where);
        $select->setColumns(array($table->getColumn($this->fi->getFieldsOfConnectedClass())));
        $result = $select->fetchDatabase();
        $value = current($result);
        return $value[$this->fi->getFieldsOfConnectedClass()];

    }
Exemplo n.º 2
0
    /**
     * show the data without input element, because editing is not possible
     *
     * @return string
     */
    protected function getReadOnlyDisplay()
    {
        $table = DB::table('selectionListEntry');
        $where = DB::where($table->getColumn('PK'), DB::intTerm($this->value));
        $select = new base_database_statement_Select();
        $select->setTable($table);
        $select->setWhere($where);
        $select->setColumns([$table->getColumn('name')]);
        $res = $select->fetchDatabase();
        if (empty($res)) {
            return 'keine Angabe';
        }

        return $res[0]['name'];
    }
Exemplo n.º 3
0
 private function _load()
 {
     $table = DB::table('sequence');
     $colNum = $table->getColumn('num');
     $colClass = $table->getColumn('class');
     $statement = new base_database_statement_Select();
     $statement->setColumns(array($colNum));
     $statement->setTable($table);
     $where = DB::where($colClass, DB::term($this->class));
     $statement->setWhere($where);
     $result = $statement->fetchDatabase();
     if (empty($result)) {
         $this->actSeq = 0;
     } else {
         $values = $result[0];
         $this->actSeq = $values['num'];
     }
     $this->nextSeq = $this->actSeq + 1;
 }
Exemplo n.º 4
0
Arquivo: CSV.php Projeto: kafruhs/fws
 /**
  * @param $where
  * @return array
  */
 private function getExistingObjects($where)
 {
     $colPK = $this->table->getColumn('PK');
     $selectStatement = new base_database_statement_Select();
     $selectStatement->setTable($this->table);
     $selectStatement->setWhere($where);
     $selectStatement->setColumns(array($colPK));
     $result = $selectStatement->fetchDatabase();
     if (empty($result)) {
         return null;
     }
     return $result[0]['PK'];
 }
Exemplo n.º 5
0
    /**
     * create the select statement
     *
     * @param $columns
     * @return base_database_statement_Select
     */
    private function _createSelectStatement($columns)
    {
        $select = new base_database_statement_Select();
        $select->setTable($this->table);
        $select->setColumns($columns);
        if (!empty($this->order)) {
            $select->setOrder($this->order);
        }

        if (!empty($this->limit)) {
            $select->setLimit($this->limit);
        }

        if (!empty($this->where)) {
            $select->setWhere($this->where);
        }

        return $select;
    }
Exemplo n.º 6
0
Arquivo: TMS.php Projeto: kafruhs/fws
    /**
     * set the select statement for the db fetch
     *
     * @return base_database_statement_Select
     * @throws base_database_Exception
     */
    private function _setSelectStatement()
    {
        $table = DB::table('tms');
        $colName = $table->getColumn('name');
        $colValue = $table->getColumn(Language::get()->getSelectedLanguage());
        $where = DB::where($colName, DB::stringTerm($this->module));

        $select = new base_database_statement_Select();
        $select->setTable($table);
        $select->setColumns(array($colValue));
        $select->setWhere($where);
        return $select;
    }
Exemplo n.º 7
0
    private static function _loadDataPermissionClass($className)
    {
        $table = DB::table('datapermission');
        $where = DB::where($table->getColumn('objClass'), DB::term($className));
        $selectStatement = new base_database_statement_Select();
        $selectStatement->setTable($table);
        $selectStatement->setWhere($where);
        $selectStatement->setColumns(array($table->getColumn('dpClass')));
        $result = $selectStatement->fetchDatabase();
        /** @todo tabelle anlegen!!!!! */
        if (count($result) != 1) {
            return ucfirst('nobody');
        }
        return ucfirst($result[0]['dpClass']);

    }
Exemplo n.º 8
0
 /**
  * get all fieldNames for the given class
  *
  * @return array
  * @throws base_database_Exception
  */
 public function getAllFieldNames()
 {
     $table = DB::table($this->table);
     $colClass = $table->getColumn('class');
     $where = DB::where($colClass, DB::stringTerm($this->class));
     $sqlStatement = new base_database_statement_Select();
     $sqlStatement->setTable($table);
     $sqlStatement->setWhere($where);
     $sqlStatement->setColumns(array($table->getColumn('fieldName')));
     $result = $sqlStatement->fetchDatabase();
     $fieldNames = [];
     foreach ($result as $row) {
         $fieldNames[] = $row['fieldName'];
     }
     return $fieldNames;
 }