Commit c98f5edd authored by Carsten  Rose's avatar Carsten Rose
Browse files

Reformat PHP Code

parent 13647f3a
......@@ -615,11 +615,11 @@ EOF;
* - if $formElement[$wrapName] is given: wrap with that one. Else: wrap with $wrapArray
* - if $htmlId is give, inject it in $wrap.
*
* @param array $formElement Complete FormElement, especially some FE_WRAP
* @param array $formElement Complete FormElement, especially some FE_WRAP
* @param string $htmlElement Content to wrap.
* @param string $wrapName FE_WRAP_ROW, FE_WRAP_LABEL, FE_WRAP_INPUT, FE_WRAP_NOTE
* @param int $bsColumns
* @param array $wrapArray Systemwide Defaults: [ 'open wrap', 'close wrap' ]
* @param string $wrapName FE_WRAP_ROW, FE_WRAP_LABEL, FE_WRAP_INPUT, FE_WRAP_NOTE
* @param int $bsColumns
* @param array $wrapArray Systemwide Defaults: [ 'open wrap', 'close wrap' ]
* @param string $htmlId
* @param string $class
*
......
......@@ -621,8 +621,8 @@ class Database {
* Wrapper for sql(), to simplyfy access.
*
* @param $sql
* @param array $keys
* @param array $stat
* @param array $keys
* @param array $stat
*
* @return array|bool
* @throws \qfq\CodeException
......@@ -735,7 +735,7 @@ class Database {
* Only when $keyName1 and $keyName2 exist, those will be used. Else the first column becomes $keyName1 and the
* second becomes $keyName2. If there is only one column, that column will be doubled.
*
* @param array $arr
* @param array $arr
* @param string $srcColumn1
* @param string $srcColumn2
* @param string $destColumn1
......
......@@ -205,8 +205,8 @@ class Dirty {
/**
* Write a 'Dirty'-Record.
*
* @param string $s SIP given by URL GET
* @param int $recordId extracted from SIP
* @param string $s SIP given by URL GET
* @param int $recordId extracted from SIP
* @param array $tableVars columns: F_TABLE_NAME, F_DIRTY_MODE, F_RECORD_LOCK_TIMEOUT_SECONDS
* @param string $feUser
* @param string $recordHashMd5
......@@ -302,7 +302,7 @@ class Dirty {
* Release a dirtyRecord. This is only possible if the current user owns the dirtyRecord.
* In case of not owner, throws an exception and the save should break.
*
* @param string $formMode FORM_DELETE, FORM_SAVE
* @param string $formMode FORM_DELETE, FORM_SAVE
* @param int $lockTimeout
* @param string $dirtyMode DIRTY_MODE_EXCLUSIVE, DIRTY_MODE_ADVISORY, DIRTY_MODE_NONE
* @param string $tableName
......
......@@ -38,7 +38,7 @@ class KeyValueStringParser {
/**
* Builds a string based on kvp array. Concatenatet by the given delimiter.
*
* @param array $keyValueArray
* @param array $keyValueArray
* @param string $keyValueDelimiter
* @param string $listDelimiter
*
......
......@@ -49,8 +49,8 @@ class Ldap {
/**
* @param $ds
* @param array $config
* @param array $attr
* @param array $config
* @param array $attr
*
* @return resource
*/
......@@ -150,7 +150,7 @@ class Ldap {
}
/**
* @param array $config
* @param array $config
* @param string $searchValue
* @param string $mode
*
......
......@@ -65,7 +65,8 @@ class Support {
}
/**
* Extract Tag(s) from $tag (eg: <div><input class="form-control">, might contain further attributes) and wrap it around
* Extract Tag(s) from $tag (eg: <div><input class="form-control">, might contain further attributes) and wrap it
* around
* $value. If $flagOmitEmpty==true && $value=='': return ''.
*
* @param string $tag
......
......@@ -341,7 +341,8 @@ VALUES
'', '', '', '', 103, '', 'no', '', '', '', '', '', 'none'),
(2, 'parameter', 'Parameter', 'show', 'text', 'all', 'native', 520, '40,8', 0, '<a href="{{DOCUMENTATION_QFQ:Y}}#fe-parameter-attributes">Info</a>',
'', '', '', '', 103, '', 'no', '', '', '', '', '', 'none'),
(2, 'adminNote', 'Admin Note', 'show', 'text', 'all', 'native', 600, 0, 0, '', '', '', '', '', 104, '', 'no', '', '', '', '', '', 'specialchar'),
(2, 'adminNote', 'Admin Note', 'show', 'text', 'all', 'native', 600, 0, 0, '', '', '', '', '', 104, '', 'no', '', '',
'', '', '', 'specialchar'),
(2, 'feGroup', 'feGroup', 'show', 'text', 'all', 'native', 610, 0, 0, '', '', '', '', '', 104, '', 'no', '', '', '',
'', '', 'specialchar'),
(2, 'deleted', 'Deleted', 'show', 'checkbox', 'all', 'native', 620, 0, 0, '', '', '', '', '', 104, '', 'no', '', '',
......
......@@ -328,107 +328,107 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
// id: 1, firstName: John, name: Doe
$formElement['sql1'] = $this->db->sql('SELECT id, name, firstName FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>id</th><th>name</th><th>firstName</th></tr><tr class="record" ><td>1</td><td>Doe</td><td>John</td></tr><tr class="record" ><td>2</td><td>Smith</td><td>Jane</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>id</th><th>name</th><th>firstName</th></tr></thead><tr class="record" ><td>1</td><td>Doe</td><td>John</td></tr><tr class="record" ><td>2</td><td>Smith</td><td>Jane</td></tr></table>', $result);
// _id: 1, name: Doe,
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>name</th></tr><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>name</th></tr></thead><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></table>', $result);
// _id: 1, name: Doe,title=''
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name AS "title=" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th></th></tr><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th></th></tr></thead><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></table>', $result);
// _id: 1, name: Doe, column: _Person
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name AS "unused|width=2|title=_Person", firstName FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>firstName</th></tr><tr class="record" ><td>John</td></tr><tr class="record" ><td>Jane</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>firstName</th></tr></thead><tr class="record" ><td>John</td></tr><tr class="record" ><td>Jane</td></tr></table>', $result);
// _id: 1, name: Doe, title: PERSON
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name AS "PERSON" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>PERSON</th></tr><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>PERSON</th></tr></thead><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></table>', $result);
// _id: 1, "This is a much longer text than necessary": Default max:20
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", "This is a much longer text than necessary" FROM Person ORDER BY id LIMIT 1');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>This is a much longe</th></tr><tr class="record" ><td>This is a much longe</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>This is a much longe</th></tr></thead><tr class="record" ><td>This is a much longe</td></tr></table>', $result);
// _id: 1, name: Jo (width:2)
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name AS "2" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th></th></tr><tr class="record" ><td>Do</td></tr><tr class="record" ><td>Sm</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th></th></tr></thead><tr class="record" ><td>Do</td></tr><tr class="record" ><td>Sm</td></tr></table>', $result);
// _id: 1, name: Jo (width:2)
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name AS "2|PERSON" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>PE</th></tr><tr class="record" ><td>Do</td></tr><tr class="record" ><td>Sm</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>PE</th></tr></thead><tr class="record" ><td>Do</td></tr><tr class="record" ><td>Sm</td></tr></table>', $result);
// _id: 1, name: Doe ('width':3)
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name AS "Name|width=3" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>Nam</th></tr><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smi</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>Nam</th></tr></thead><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smi</td></tr></table>', $result);
// _id: 1, name: Doe (width:3, title:PERSON)
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name AS "3|title=PERSON" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>PER</th></tr><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smi</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>PER</th></tr></thead><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smi</td></tr></table>', $result);
// _id: 1, name: <b>Doe</b>
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", CONCAT("<b>", name, "</b>") AS "Name" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>Name</th></tr><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>Name</th></tr></thead><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></table>', $result);
// _id: 1, name: <b>Doe</b>, width=2
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", CONCAT("<b>", name, "</b>") AS "Name|2" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>Na</th></tr><tr class="record" ><td>Do</td></tr><tr class="record" ><td>Sm</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>Na</th></tr></thead><tr class="record" ><td>Do</td></tr><tr class="record" ><td>Sm</td></tr></table>', $result);
// _id: 1, name: <b>Doe</b> , nostrip
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", CONCAT("<b>", name, "</b>") AS "Name|nostrip" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>Name</th></tr><tr class="record" ><td><b>Doe</b></td></tr><tr class="record" ><td><b>Smith</b></td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>Name</th></tr></thead><tr class="record" ><td><b>Doe</b></td></tr><tr class="record" ><td><b>Smith</b></td></tr></table>', $result);
// _id: 1, icon: bullet-green.gif
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", "bullet-green.gif" AS "Status|icon" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>Status</th></tr><tr class="record" ><td><image src=\'typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif\'></td></tr><tr class="record" ><td><image src=\'typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif\'></td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>Status</th></tr></thead><tr class="record" ><td><image src=\'typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif\'></td></tr><tr class="record" ><td><image src=\'typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif\'></td></tr></table>', $result);
// _id: 1, mailto: john@doe.com
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", "john@doe.com" AS "EMail|mailto" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>EMail</th></tr><tr class="record" ><td><a href="mailto:john@doe.com" >john@doe.com</a></td></tr><tr class="record" ><td><a href="mailto:john@doe.com" >john@doe.com</a></td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>EMail</th></tr></thead><tr class="record" ><td><a href="mailto:john@doe.com" >john@doe.com</a></td></tr><tr class="record" ><td><a href="mailto:john@doe.com" >john@doe.com</a></td></tr></table>', $result);
// _id: 1, url: www.uzh.ch
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", "www.uzh.ch" AS "URL|url" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>URL</th></tr><tr class="record" ><td><a href="www.uzh.ch" >www.uzh.ch</a></td></tr><tr class="record" ><td><a href="www.uzh.ch" >www.uzh.ch</a></td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>URL</th></tr></thead><tr class="record" ><td><a href="www.uzh.ch" >www.uzh.ch</a></td></tr><tr class="record" ><td><a href="www.uzh.ch" >www.uzh.ch</a></td></tr></table>', $result);
// _id: 1, name: Doe, _rowclass (text)
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name, IF(id=1,"text-warning", "text-danger") AS _rowClass FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>name</th></tr><tr class="record text-warning" ><td>Doe</td></tr><tr class="record text-danger" ><td>Smith</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>name</th></tr></thead><tr class="record text-warning" ><td>Doe</td></tr><tr class="record text-danger" ><td>Smith</td></tr></table>', $result);
// _id: 1, name: Doe, _rowClass (text & background)
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name, IF(id=1,"text-warning active", "text-danger success") AS _rowClass FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>name</th></tr><tr class="record text-warning active" ><td>Doe</td></tr><tr class="record text-danger success" ><td>Smith</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>name</th></tr></thead><tr class="record text-warning active" ><td>Doe</td></tr><tr class="record text-danger success" ><td>Smith</td></tr></table>', $result);
// _id: 1, name: Doe, _rowTitle
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name, firstName AS _rowTitle FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>name</th></tr><tr class="record" title="John" ><td>Doe</td></tr><tr class="record" title="Jane" ><td>Smith</td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>name</th></tr></thead><tr class="record" title="John" ><td>Doe</td></tr><tr class="record" title="Jane" ><td>Smith</td></tr></table>', $result);
// _id: 1, name: Doe, title, width, nostrip
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name, "<b>This again is a very long text</b>" AS "title=Important|width=10|nostrip" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>name</th><th>Important</th></tr><tr class="record" ><td>Doe</td><td><b>This again is a very long text</b></td></tr><tr class="record" ><td>Smith</td><td><b>This again is a very long text</b></td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>name</th><th>Important</th></tr></thead><tr class="record" ><td>Doe</td><td><b>This again is a very long text</b></td></tr><tr class="record" ><td>Smith</td><td><b>This again is a very long text</b></td></tr></table>', $result);
// _id: 1, name: Doe, link
$formElement['sql1'] = $this->db->sql('SELECT id AS "_id", name, CONCAT("s:1|p:form&form=person&r=" , id , "|t:", name) AS "link" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover"><tr><th>name</th><th></th></tr><tr class="record" ><td>Doe</td><td><a href="index.php?id=form&s=badcaffee1234" class="internal" >Doe</a></td></tr><tr class="record" ><td>Smith</td><td><a href="index.php?id=form&s=badcaffee1234" class="internal" >Smith</a></td></tr></table>', $result);
$this->assertEquals('<table class=\'table table-hover\'><thead><tr><th>name</th><th></th></tr></thead><tr class="record" ><td>Doe</td><td><a href="index.php?id=form&s=badcaffee1234" class="internal" >Doe</a></td></tr><tr class="record" ><td>Smith</td><td><a href="index.php?id=form&s=badcaffee1234" class="internal" >Smith</a></td></tr></table>', $result);
}
/**
......
DELETE FROM Dirty;
DELETE FROM Form WHERE name LIKE 'lock%';
DELETE FROM Form
WHERE name LIKE 'lock%';
# FormEditor: Small
INSERT INTO Form ( name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter, dirtyMode) VALUES
( 'lockNone', 'Text None', 'note internal', 'Person', 'always', 'always', 'bootstrap', '', '', 'none'),
( 'lockAdvisory', 'Text Advisory', 'note internal', 'Person', 'always', 'always', 'bootstrap', '', '', 'advisory'),
( 'lockExclusive', 'Text Exclusive', 'note internal', 'Person', 'always', 'always', 'bootstrap', '', '', 'exclusive'),
( 'lockAdvisory2', 'Text Advisory', 'note internal', 'Person', 'always', 'always', 'bootstrap', '', '', 'advisory'),
( 'lockExclusive2', 'Text Exclusive', 'note internal', 'Person', 'always', 'always', 'bootstrap', '', '', 'exclusive');
INSERT INTO Form (name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter, dirtyMode)
VALUES
('lockNone', 'Text None', 'note internal', 'Person', 'always', 'always', 'bootstrap', '', '', 'none'),
('lockAdvisory', 'Text Advisory', 'note internal', 'Person', 'always', 'always', 'bootstrap', '', '', 'advisory'),
('lockExclusive', 'Text Exclusive', 'note internal', 'Person', 'always', 'always', 'bootstrap', '', '', 'exclusive'),
('lockAdvisory2', 'Text Advisory', 'note internal', 'Person', 'always', 'always', 'bootstrap', '', '', 'advisory'),
('lockExclusive2', 'Text Exclusive', 'note internal', 'Person', 'always', 'always', 'bootstrap', '', '', 'exclusive');
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment