mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-10 20:28:44 +02:00
Compare commits
397 Commits
feature/25
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83a67dff96 | ||
|
|
79270950ee | ||
|
|
18b91df58d | ||
|
|
4afe06d370 | ||
|
|
9dc3c56689 | ||
|
|
effd35c3e6 | ||
|
|
587d7fcf72 | ||
|
|
f1735767c3 | ||
|
|
bfdc8a68e6 | ||
|
|
00735f0c54 | ||
|
|
882390e8d6 | ||
|
|
5d0da47f21 | ||
|
|
684eaac278 | ||
|
|
4eadff7f3b | ||
|
|
4ce8f70382 | ||
|
|
f66ce1c956 | ||
|
|
868eea9b43 | ||
|
|
802f9f3e08 | ||
|
|
70a8bdf427 | ||
|
|
38cda442e3 | ||
|
|
20c8b7c0ce | ||
|
|
b58a848cc9 | ||
|
|
5c5d98bb78 | ||
|
|
a08a9b43f3 | ||
|
|
d9433fead5 | ||
|
|
abd85ff4db | ||
|
|
81f328b26e | ||
|
|
9a2c8f10bf | ||
|
|
1a9e4bd5ad | ||
|
|
3cdadf3c6e | ||
|
|
36891e441b | ||
|
|
a6295f1b14 | ||
|
|
ba6b3da238 | ||
|
|
2674e9c47f | ||
|
|
e467ca83cf | ||
|
|
f7b73717b4 | ||
|
|
0d9b34a879 | ||
|
|
7791585387 | ||
|
|
a4a0b3c18c | ||
|
|
3406ca79de | ||
|
|
91ad01055e | ||
|
|
443fa60459 | ||
|
|
804cdffe42 | ||
|
|
63e40fc0a2 | ||
|
|
176bd51afb | ||
|
|
e8a1f8c3b6 | ||
|
|
5f4affc896 | ||
|
|
042fee2360 | ||
|
|
447e7d01d5 | ||
|
|
d4a9d1e831 | ||
|
|
be3726623f | ||
|
|
aae6d324f9 | ||
|
|
398b47d5d1 | ||
|
|
b85f4a5161 | ||
|
|
3c17b1bdea | ||
|
|
7f8ec25977 | ||
|
|
41f8437c23 | ||
|
|
df8b25d4b4 | ||
|
|
9cc80a8946 | ||
|
|
11afd23087 | ||
|
|
511dabe2b0 | ||
|
|
0c517f254c | ||
|
|
347663f8f7 | ||
|
|
c56c7a1f9d | ||
|
|
3d21ff1cd7 | ||
|
|
fb2f0f1447 | ||
|
|
4847bb563a | ||
|
|
8b664ff644 | ||
|
|
902a05cc84 | ||
|
|
b3223eb9b6 | ||
|
|
19d6052460 | ||
|
|
70eaa30e10 | ||
|
|
458a996c29 | ||
|
|
a6de103b4a | ||
|
|
9328f6d916 | ||
|
|
c61b21559c | ||
|
|
0d18572fbe | ||
|
|
9db21ab860 | ||
|
|
ed33238750 | ||
|
|
272678b8cd | ||
|
|
3a435eba7d | ||
|
|
170014e8f0 | ||
|
|
df05a4688e | ||
|
|
006f666089 | ||
|
|
960990d47d | ||
|
|
99d39732a5 | ||
|
|
5e916510fb | ||
|
|
2a16143e53 | ||
|
|
0be4f52b04 | ||
|
|
f7d41d3650 | ||
|
|
eabbe2f00b | ||
|
|
52e303cb37 | ||
|
|
58790bc352 | ||
|
|
0b19333cd7 | ||
|
|
da09c701cc | ||
|
|
7c8670b57c | ||
|
|
1c1f01aed5 | ||
|
|
5d6e2cc9f7 | ||
|
|
28db230697 | ||
|
|
4fe61cbdc7 | ||
|
|
3c5bf8a134 | ||
|
|
e2994b645b | ||
|
|
32ddf1c980 | ||
|
|
0f7540dec8 | ||
|
|
a36a7cc832 | ||
|
|
3dd1c11d3b | ||
|
|
9fca81cc32 | ||
|
|
9792358aea | ||
|
|
7bfa14a874 | ||
|
|
9236449b21 | ||
|
|
b3613b6c4b | ||
|
|
ab8e7bd15e | ||
|
|
307c308eb0 | ||
|
|
61e5536b50 | ||
|
|
104dd1970f | ||
|
|
884d64a42a | ||
|
|
44c0a025a8 | ||
|
|
929b8b9eca | ||
|
|
3b8e079cf1 | ||
|
|
36247ba0ee | ||
|
|
091d99b08f | ||
|
|
3c60a80f9b | ||
|
|
ae633111c0 | ||
|
|
52a1d8d626 | ||
|
|
3a64e3bb9e | ||
|
|
fc967c06ce | ||
|
|
d4821b7edc | ||
|
|
94a36c0066 | ||
|
|
62e09f1224 | ||
|
|
57a0b5691f | ||
|
|
f82389d156 | ||
|
|
9e21976424 | ||
|
|
f558093f5d | ||
|
|
5201a1ed3b | ||
|
|
dad39c3ebe | ||
|
|
29920bfeb7 | ||
|
|
2313ee2bbd | ||
|
|
22b0c431a0 | ||
|
|
499b3bca88 | ||
|
|
aede5ea7b8 | ||
|
|
da6c443a35 | ||
|
|
9c39efd9af | ||
|
|
d5f2303ed2 | ||
|
|
48e584503e | ||
|
|
454a1b26eb | ||
|
|
4853ca444e | ||
|
|
330539abd2 | ||
|
|
5357a0c060 | ||
|
|
fc22cce037 | ||
|
|
34c8a57814 | ||
|
|
b91e6c384a | ||
|
|
2247691e58 | ||
|
|
f014b43761 | ||
|
|
076d49abc2 | ||
|
|
9fd0ffd84e | ||
|
|
0f11fd9919 | ||
|
|
2b828f8a22 | ||
|
|
d2f67dcb3c | ||
|
|
d5706fcbef | ||
|
|
807f2a88bc | ||
|
|
9d3311e623 | ||
|
|
9bf2cb7e1d | ||
|
|
0134ead5dd | ||
|
|
54909520e9 | ||
|
|
d124f8ee58 | ||
|
|
3fdbcbc0fb | ||
|
|
a5296e11e1 | ||
|
|
3b62597092 | ||
|
|
b085147f23 | ||
|
|
38fccf85e3 | ||
|
|
c0a2771d4e | ||
|
|
6bd5a7b634 | ||
|
|
82b7ef86c7 | ||
|
|
f8cf14cbad | ||
|
|
a5dededfb4 | ||
|
|
4f878536a8 | ||
|
|
d937ec0350 | ||
|
|
1cdcaac3d0 | ||
|
|
985db46960 | ||
|
|
01adaadfad | ||
|
|
3f807a64bb | ||
|
|
1d4a155e8f | ||
|
|
643752f8e7 | ||
|
|
0e0c09c420 | ||
|
|
2b6fa8b381 | ||
|
|
7d2dc5e36a | ||
|
|
f87df8f28b | ||
|
|
cc9e64616f | ||
|
|
f34373be6d | ||
|
|
a39234f438 | ||
|
|
ac8937105d | ||
|
|
fb6f892244 | ||
|
|
0a04c83c7b | ||
|
|
cc8252bebf | ||
|
|
3e879c64a7 | ||
|
|
5c6369b9b8 | ||
|
|
154fb5c737 | ||
|
|
efb1bd765b | ||
|
|
b39af74d07 | ||
|
|
904cd0b518 | ||
|
|
4c1ad0f4f2 | ||
|
|
3955b4eb22 | ||
|
|
3d46fe6ef1 | ||
|
|
4dba47798c | ||
|
|
9480c4053d | ||
|
|
9ea197148c | ||
|
|
49a7f3118d | ||
|
|
bf80b5dca2 | ||
|
|
09afcb229c | ||
|
|
92f843f676 | ||
|
|
3df4ddc696 | ||
|
|
d552727c55 | ||
|
|
1fe401c102 | ||
|
|
a4b0b6e855 | ||
|
|
545028d68a | ||
|
|
6cb08ba361 | ||
|
|
b3cd79605d | ||
|
|
f9db405343 | ||
|
|
4f1f144c51 | ||
|
|
ef8ade5d20 | ||
|
|
cef4a52081 | ||
|
|
dc9fb2d693 | ||
|
|
e9ffbe5b09 | ||
|
|
9c792a601f | ||
|
|
cda6c1dfa8 | ||
|
|
0b242d872a | ||
|
|
c144c80663 | ||
|
|
d9261b8342 | ||
|
|
df567fb9fe | ||
|
|
028767768c | ||
|
|
11ec80830e | ||
|
|
edf992ef2b | ||
|
|
7c8fb1a51d | ||
|
|
aa27b3601b | ||
|
|
73f868ac83 | ||
|
|
5a2157ba21 | ||
|
|
03e25a226e | ||
|
|
24048d2b9c | ||
|
|
d8121b563a | ||
|
|
f266f5ff36 | ||
|
|
4a6b129eb8 | ||
|
|
4187f552a9 | ||
|
|
7f7ce0837e | ||
|
|
bc4d50dd0b | ||
|
|
e21a541b70 | ||
|
|
ed360edb83 | ||
|
|
53de040934 | ||
|
|
b8345de553 | ||
|
|
fd10887849 | ||
|
|
7df09541ac | ||
|
|
e09987e442 | ||
|
|
6d5660ca67 | ||
|
|
0013b8cfee | ||
|
|
7fb0ae48f9 | ||
|
|
e89a8edae0 | ||
|
|
262cc3c206 | ||
|
|
b5fe12ca3c | ||
|
|
6d279647f1 | ||
|
|
299c468eaa | ||
|
|
7bbcc388ea | ||
|
|
5b7a5e14a3 | ||
|
|
2b1ecf15b4 | ||
|
|
f6366057c9 | ||
|
|
41a90b5033 | ||
|
|
67018b9b17 | ||
|
|
fa8ecb956e | ||
|
|
58eae4dde3 | ||
|
|
d098a5eb87 | ||
|
|
8597dea398 | ||
|
|
a6972af266 | ||
|
|
066b27c982 | ||
|
|
283de1ef7c | ||
|
|
8b00016115 | ||
|
|
b5c79e1d75 | ||
|
|
dd82950eee | ||
|
|
2e8b48ce47 | ||
|
|
80d4e65a81 | ||
|
|
b0a792afab | ||
|
|
7681c157ec | ||
|
|
4a9a85458d | ||
|
|
890a2568c8 | ||
|
|
12f23113f5 | ||
|
|
6cf6e7dd8d | ||
|
|
d4183acfde | ||
|
|
26f21ee6eb | ||
|
|
c5fb116052 | ||
|
|
bdc8fdd02f | ||
|
|
adfa800063 | ||
|
|
5df936c587 | ||
|
|
8056a63e82 | ||
|
|
775ac3df77 | ||
|
|
83927af8ed | ||
|
|
f1609168b7 | ||
|
|
4f845c63cf | ||
|
|
d029039d22 | ||
|
|
10a7fafe59 | ||
|
|
700b95e8c6 | ||
|
|
600a6185a3 | ||
|
|
354a7cabab | ||
|
|
0802e5abb5 | ||
|
|
8ade0a6e85 | ||
|
|
6226ac8746 | ||
|
|
e661e0bdbb | ||
|
|
1d52665012 | ||
|
|
4aa0c19183 | ||
|
|
809d4cd665 | ||
|
|
0c3bc7f35b | ||
|
|
bfc583e6b5 | ||
|
|
5bc453bca6 | ||
|
|
5dd450e9bf | ||
|
|
82395727bf | ||
|
|
318b792b31 | ||
|
|
0fe2183369 | ||
|
|
8f038d2f95 | ||
|
|
fbf3dd8cf7 | ||
|
|
01c9e73020 | ||
|
|
0736045b90 | ||
|
|
778c16da86 | ||
|
|
86776edfb3 | ||
|
|
5045ec4afa | ||
|
|
d78805d8ae | ||
|
|
03e1d46586 | ||
|
|
f3deb8be11 | ||
|
|
981d5c6263 | ||
|
|
e000befc0f | ||
|
|
2eba58998b | ||
|
|
4ed21dc21a | ||
|
|
fa5cad0fdb | ||
|
|
5d28de1636 | ||
|
|
6be9255ca0 | ||
|
|
1f4a2f0f56 | ||
|
|
edbe4974ac | ||
|
|
7e515e7216 | ||
|
|
bf7a756714 | ||
|
|
428d2c6356 | ||
|
|
d589d9d05a | ||
|
|
c0c9ea9287 | ||
|
|
fae2bcc6e9 | ||
|
|
53047d35fe | ||
|
|
8982f7e0e3 | ||
|
|
909469ce97 | ||
|
|
dacb54285c | ||
|
|
5af93ca92a | ||
|
|
3fa500c9c1 | ||
|
|
f0adbbba29 | ||
|
|
bbdb30f421 | ||
|
|
897b5d452e | ||
|
|
fdd1479c8e | ||
|
|
7851109794 | ||
|
|
810e6c1bda | ||
|
|
d164f48cfe | ||
|
|
506def4340 | ||
|
|
08b8e919b7 | ||
|
|
696e2c9565 | ||
|
|
d728be119c | ||
|
|
463869b89d | ||
|
|
1d4c0b8e7f | ||
|
|
bf1b2a5104 | ||
|
|
15103dc49f | ||
|
|
bb8a09d8e2 | ||
|
|
901f8f2a7b | ||
|
|
ba6fff801b | ||
|
|
50098bad73 | ||
|
|
2ee68ff819 | ||
|
|
44972f34e5 | ||
|
|
65c9145b10 | ||
|
|
a104310379 | ||
|
|
f5cce23bb4 | ||
|
|
0f39106b56 | ||
|
|
ee993ef80a | ||
|
|
0a4180f7fc | ||
|
|
b56113aada | ||
|
|
c82c150411 | ||
|
|
00818f411f | ||
|
|
a6a459967e | ||
|
|
88e0f17164 | ||
|
|
437296eab9 | ||
|
|
7cf6f65265 | ||
|
|
491f55c7bd | ||
|
|
7b44ec23a1 | ||
|
|
f00b8d529c | ||
|
|
af44ffd0ad | ||
|
|
de54676b9f | ||
|
|
e5129c9618 | ||
|
|
d0f816109b | ||
|
|
05642cdf84 | ||
|
|
031305cfbf | ||
|
|
471422b274 | ||
|
|
5573a222c8 | ||
|
|
83eb2b81e3 | ||
|
|
86d2a3424d | ||
|
|
cd1c6f5ec5 | ||
|
|
2ee30692ff | ||
|
|
9aa13f57d8 | ||
|
|
f9d9fcc440 | ||
|
|
a4a05a2579 | ||
|
|
f44468b7a1 |
101
.doc/README.md
101
.doc/README.md
@@ -1,101 +0,0 @@
|
|||||||
# Phpdoc dokuwiki template
|
|
||||||
This directory contains a template for rendering iTop phpdoc as dokuwiki pages.
|
|
||||||
|
|
||||||
|
|
||||||
Conventional tags that you should use:
|
|
||||||
* `@internal` : exclude from the documentation.
|
|
||||||
* `@api` : it means that a method is an api, thus it may be interacted with.
|
|
||||||
* `@see` : it points to another documented method
|
|
||||||
* `@link` : external url
|
|
||||||
* if you point to another page of the wiki, please use relative links.
|
|
||||||
* `@example` : let you provide example of code
|
|
||||||
* `@param`, `@return`, `@throws`, ...
|
|
||||||
|
|
||||||
|
|
||||||
## Special instructions
|
|
||||||
|
|
||||||
Some iTop specific tags were added :
|
|
||||||
* `@api-advanced`: it means that a method is an `@api` but mark it also as "complex" to use
|
|
||||||
* `@overwritable-hook`: used to mark a method as "designed to be extended"
|
|
||||||
* `@extension-hook`: not used for now
|
|
||||||
* `@phpdoc-tuning-exclude-inherited`: once this tag is present on a class, it's inherited methods won't be showed.
|
|
||||||
|
|
||||||
|
|
||||||
### known limitations:
|
|
||||||
#### `@see` tags must be very specific:
|
|
||||||
* always prefix class members (attributes or methods) with `ClassName::` (do not use self)
|
|
||||||
* for methods always suffix them with `()`,
|
|
||||||
* do not reference variables since they are not documented. If you have to, always prefix them with `$`
|
|
||||||
|
|
||||||
examples:
|
|
||||||
```
|
|
||||||
/**
|
|
||||||
* @see DBObject
|
|
||||||
* @see DBObject::Get()
|
|
||||||
* @see DBObject::$foo
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Do not use inline tags, they do not work properly, example:
|
|
||||||
```
|
|
||||||
/**
|
|
||||||
* This is a texts with an inline tag {@see [FQSEN] [<description>]} it must never be used
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### The `@example` tag must respect this very precise syntax
|
|
||||||
* the sentence in the first line (next to the tag) is the title, it must be enclosed by double quotes
|
|
||||||
* the following lines are the sample code.
|
|
||||||
* 💔 since we simply hack the official tag, this syntax must be respected carefully 💔
|
|
||||||
example:
|
|
||||||
```
|
|
||||||
/**
|
|
||||||
* @example "This is the title of the multiline example"
|
|
||||||
* $foo = DBObject::Get('foo');
|
|
||||||
* DBObject::Set('foo', ++$foo);
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
|
|
||||||
## How content is included into the documentation
|
|
||||||
|
|
||||||
**For a class** those requirements have to be respected:
|
|
||||||
- the file containing the class must be listed in `/phpdoc/files/file[]` of `.doc/phpdoc-objects-manipulation.dist.xml`
|
|
||||||
- the class **must not** have the tag `@internal`
|
|
||||||
- the class **must** have at least one of: `@api`, `@api-advanced`, `@overwritable-hook`, `@extension-hook`
|
|
||||||
|
|
||||||
Then, **for a method** of an eligible class:
|
|
||||||
- **public** methods **must** have at least one of: `@api`, `@api-advanced`, `@overwritable-hook`, `@extension-hook`
|
|
||||||
- **protected** methods **must** have at least one of: `@overwritable-hook`, `@extension-hook`
|
|
||||||
- **private** methods are **always excluded**
|
|
||||||
|
|
||||||
**Class properties** and **constants** are never documented (this is subject to change).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## A note about the rendering engine
|
|
||||||
|
|
||||||
:notebook: as spaces are used to mark code, the templates (`.doc/phpdoc-templates/combodo-wiki/*`) have very few indentation, thus they are awful to read (sorry).
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Note : PHP7 is required. Migrating to PHP8 requires some additional work which is questionable as an alternative way to generate a documentation is being considered.
|
|
||||||
|
|
||||||
```
|
|
||||||
cd .doc
|
|
||||||
composer require phpdocumentor/phpdocumentor:~2 --dev
|
|
||||||
```
|
|
||||||
|
|
||||||
## Generation
|
|
||||||
|
|
||||||
1. Switch to this directory : `cd /path/to/itop/.doc`
|
|
||||||
2. `composer install`
|
|
||||||
3. `./bin/build-doc-object-manipulation`
|
|
||||||
3. `./bin/build-doc-extensions`
|
|
||||||
4. Get the generated files from `/path/to/itop/data/phpdocumentor/output`
|
|
||||||
|
|
||||||
## Dokuwiki requirements
|
|
||||||
* the template uses the [wrap plugin](https://www.dokuwiki.org/plugin:wrap).
|
|
||||||
* the generated files have to be placed under an arbitrary directory of `[/path/to/dokuwiki]/data/pages`.
|
|
||||||
* the html has to be activated [config:htmlok](https://www.dokuwiki.org/config:htmlok)
|
|
||||||
* the generated files have to be in lowercase
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/sh -x
|
|
||||||
|
|
||||||
rm -rf /tmp/phpdoc-twig-cache/ && rm -rf data/phpdocumentor/output/extensions/ && rm -rf data/phpdocumentor/temp/extensions/ && ./vendor/bin/phpdoc -c ./phpdoc-extensions.dist.xml -vvv
|
|
||||||
|
|
||||||
# now wee need to lowercase every generated file because dokuwiki can't handle uppercase
|
|
||||||
cd ../data/phpdocumentor/output/extensions/ && for i in $(ls | grep [A-Z]); do mv -i $i $(echo $i | tr 'A-Z' 'a-z'); done
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh -x
|
|
||||||
|
|
||||||
rm -rf /tmp/phpdoc-twig-cache/ && rm -rf ../data/phpdocumentor/output/objects-manipulation/ && rm -rf ../data/phpdocumentor/temp/objects-manipulation/ && ./vendor/bin/phpdoc -c ./phpdoc-objects-manipulation.dist.xml -vvv
|
|
||||||
|
|
||||||
|
|
||||||
# now wee need to lowercase every generated file because dokuwiki can't handle uppercase
|
|
||||||
cd ../data/phpdocumentor/output/objects-manipulation/ && for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"require-dev": {
|
|
||||||
"phpdocumentor/phpdocumentor": "~2",
|
|
||||||
"jms/serializer": "1.7.*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
3015
.doc/composer.lock
generated
3015
.doc/composer.lock
generated
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 983 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
9
.doc/developers.md
Normal file
9
.doc/developers.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Developers
|
||||||
|
|
||||||
|
## PHP Code Styles
|
||||||
|
We use `PHP CS Fixer` to ensure code formating consistency across PHP codebase.
|
||||||
|
You can find the configuration and instructions to run it [here](../tests/php-code-style/README.md).
|
||||||
|
|
||||||
|
## PHP Static Analysis
|
||||||
|
We use `PHPStan` to ensure code quality and to detect potential bugs in our PHP codebase.
|
||||||
|
You can find the configuration and instructions to run it [here](../tests/php-static-analysis/README.md).
|
||||||
@@ -86,19 +86,24 @@ gitGraph
|
|||||||
commit id: "2024-01-17a" tag: "2.7.10"
|
commit id: "2024-01-17a" tag: "2.7.10"
|
||||||
checkout support/3.0
|
checkout support/3.0
|
||||||
commit id: "2024-01-17b" tag: "3.0.4"
|
commit id: "2024-01-17b" tag: "3.0.4"
|
||||||
checkout support/2.7
|
|
||||||
commit id: "2024-09-28" tag: "2.7.11"
|
|
||||||
checkout support/3.1
|
|
||||||
commit id: "2024-09-27" tag: "3.1.2"
|
|
||||||
checkout support/3.2
|
checkout support/3.2
|
||||||
commit id: "2024-06-25" tag: "3.2.0-beta1" type: REVERSE
|
commit id: "2024-06-25" tag: "3.2.0-beta1" type: REVERSE
|
||||||
commit id: "2024-08-07" tag: "3.2.0"
|
commit id: "2024-08-07" tag: "3.2.0"
|
||||||
|
commit id: "2024-09-13" tag: "3.2.0-2"
|
||||||
|
checkout support/3.1
|
||||||
|
commit id: "2024-09-27" tag: "3.1.2"
|
||||||
|
checkout support/2.7
|
||||||
|
commit id: "2024-09-28" tag: "2.7.11"
|
||||||
checkout support/2.7
|
checkout support/2.7
|
||||||
commit id: "2025-02-25" tag: "2.7.12"
|
commit id: "2025-02-25" tag: "2.7.12"
|
||||||
checkout support/3.1
|
checkout support/3.1
|
||||||
commit id: "2025-02-25 " tag: "3.1.3"
|
commit id: "2025-02-25 " tag: "3.1.3"
|
||||||
checkout support/3.2
|
checkout support/3.2
|
||||||
commit id: "2025-02-25 " tag: "3.2.1"
|
commit id: "2025-02-25 " tag: "3.2.1"
|
||||||
|
commit id: "2025-04-08" tag: "3.2.1-1"
|
||||||
|
commit id: "2025-08-19" tag: "3.2.2-1"
|
||||||
|
checkout support/2.7
|
||||||
|
commit id: "2025-10-07" tag: "2.7.13"
|
||||||
```
|
```
|
||||||
|
|
||||||
To learn more, check the [iTop community versions history on the official wiki](https://www.itophub.io/wiki/page?id=latest:release:start).
|
To learn more, check the [iTop community versions history on the official wiki](https://www.itophub.io/wiki/page?id=latest:release:start).
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<phpdoc>
|
|
||||||
<title><![CDATA[iTop extensions]]></title>
|
|
||||||
|
|
||||||
<parser>
|
|
||||||
<target>../data/phpdocumentor/temp/extensions</target>
|
|
||||||
</parser>
|
|
||||||
|
|
||||||
<transformer>
|
|
||||||
<target>../data/phpdocumentor/output/extensions</target>
|
|
||||||
</transformer>
|
|
||||||
|
|
||||||
<transformations>
|
|
||||||
<template name="phpdoc-templates/combodo-wiki"/>
|
|
||||||
</transformations>
|
|
||||||
|
|
||||||
<files>
|
|
||||||
<file>../application/applicationextension.inc.php</file>
|
|
||||||
</files>
|
|
||||||
</phpdoc>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<phpdoc>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
/**
|
|
||||||
The documentation of this file can be found here : https://docs.phpdoc.org/references/configuration.html
|
|
||||||
it has to be completed by the CLI parameters documentation which is more comprehensive: https://docs.phpdoc.org/references/commands/project_run.html#usage
|
|
||||||
|
|
||||||
usage:
|
|
||||||
vendor/bin/phpdoc -c phpdoc-objects-manipulation.dist.xml
|
|
||||||
|
|
||||||
*/
|
|
||||||
-->
|
|
||||||
|
|
||||||
<title><![CDATA[iTop's objects manipulation API]]></title>
|
|
||||||
|
|
||||||
<parser>
|
|
||||||
<default-package-name>iTopORM</default-package-name>
|
|
||||||
<target>../data/phpdocumentor/temp/objects-manipulation</target>
|
|
||||||
<visibility>public,protected</visibility>
|
|
||||||
<markers>
|
|
||||||
<!--<item>TODO</item>-->
|
|
||||||
<!--<item>FIXME</item>-->
|
|
||||||
</markers>
|
|
||||||
<extensions>
|
|
||||||
<extension>php</extension>
|
|
||||||
</extensions>
|
|
||||||
</parser>
|
|
||||||
|
|
||||||
<transformer>
|
|
||||||
<target>../data/phpdocumentor/output/objects-manipulation</target>
|
|
||||||
</transformer>
|
|
||||||
|
|
||||||
<transformations>
|
|
||||||
<template name="phpdoc-templates/combodo-wiki"/>
|
|
||||||
</transformations>
|
|
||||||
|
|
||||||
<!--<logging>-->
|
|
||||||
<!--<level>warn</level>-->
|
|
||||||
<!--<paths>-->
|
|
||||||
<!--<!–<default>data/phpdocumentor/log/objects-manipulation/{DATE}.log</default>–>-->
|
|
||||||
<!--<!–<errors>data/phpdocumentor/log/objects-manipulation/{DATE}.errors.log</errors>–>-->
|
|
||||||
|
|
||||||
<!--<default>{APP_ROOT}/data/log/{DATE}.log</default>-->
|
|
||||||
<!--<errors>{APP_ROOT}/data/log/{DATE}.errors.log</errors>-->
|
|
||||||
<!--</paths>-->
|
|
||||||
<!--</logging>-->
|
|
||||||
|
|
||||||
<files>
|
|
||||||
<file>../core/dbobject.class.php</file>
|
|
||||||
<file>../core/dbobjectsearch.class.php</file>
|
|
||||||
<file>../core/metamodel.class.php</file>
|
|
||||||
<file>../core/dbobjectset.class.php</file>
|
|
||||||
<file>../core/dbsearch.class.php</file>
|
|
||||||
<file>../core/dbunionsearch.class.php</file>
|
|
||||||
</files>
|
|
||||||
|
|
||||||
</phpdoc>
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
{% extends 'layout.txt.twig' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<wrap button>[[start|🔙 Back]]</wrap>
|
|
||||||
|
|
||||||
{% if node.tags['internal'] is defined %}
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
<WRAP alert>This class is "internal", and thus is not documented!</WRAP>
|
|
||||||
{% elseif node.tags['api'] is not defined and node.tags['api-advanced'] is not defined and node.tags['overwritable-hook'] is not defined and node.tags['extension-hook'] is not defined %}
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
<WRAP alert>This class is neither "api", "api-advanced", "overwritable-hook" or "extension-hook", and thus is not documented!</WRAP>
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
|
|
||||||
{% if node.deprecated %}<wrap danger>deprecated</wrap>{% endif %}
|
|
||||||
{% if node.abstract %}<wrap warning>abstract</wrap>{% endif %}
|
|
||||||
{% if node.final %}<wrap notice>final</wrap>{% endif %}
|
|
||||||
{% include 'includes/wrap-tags.txt.twig' with {structure:node, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% if node.deprecated %}
|
|
||||||
=== **<del>Deprecated</del>**===
|
|
||||||
//{{ node.tags.deprecated[0].description }}//
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
== {{ node.summary|replace({"\n":""})|raw }} ==
|
|
||||||
<html>{{ node.description|markdown|raw }}</html>
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/code-examples.txt.twig' with {structure:node, title_level: '====='} %}
|
|
||||||
|
|
||||||
|
|
||||||
{% set class = node.parent %}
|
|
||||||
{% block hierarchy_element %}
|
|
||||||
|
|
||||||
{% if class and class.name is defined and class.name|trim != '' %}
|
|
||||||
==== parent ====
|
|
||||||
{% set child = class %}
|
|
||||||
{% set class = class.parent %}
|
|
||||||
{{ block('hierarchy_element') }}
|
|
||||||
[[{{ child.name }}|{{ child.name }}]]
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% for interface in node.interfaces|sort_asc %}
|
|
||||||
{% if loop.first %}
|
|
||||||
==== Implements ====
|
|
||||||
{% endif %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ interface.fullyQualifiedStructuralElementName ?: interface }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
{% for trait in node.usedTraits|sort_asc %}
|
|
||||||
{% if loop.first %}
|
|
||||||
==== Uses traits ====
|
|
||||||
{% endif %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ trait.fullyQualifiedStructuralElementName ?: trait }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/see-also.txt.twig' with {structure:node, title_level: '==='} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags.txt.twig' with {structure:node, title_level: '=====', blacklist: ['link', 'see', 'abstract', 'example', 'method', 'property', 'property-read', 'property-write', 'package', 'subpackage', 'phpdoc-tuning-exclude-inherited', 'api', 'api-advanced', 'overwritable-hook', 'extension-hook', 'copyright', 'license', 'code-example']} %}
|
|
||||||
|
|
||||||
{% set methods = node.inheritedMethods.merge(node.methods.merge(node.magicMethods)) %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api-advanced'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'overwritable-hook'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'extension-hook'} %}
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/code-examples.txt.twig' with {structure:node, title_level: '=====', sub_title_level: '=='} %}
|
|
||||||
|
|
||||||
<WRAP clear />
|
|
||||||
|
|
||||||
{% for method in methods|sort_asc
|
|
||||||
if method.visibility == 'public'
|
|
||||||
and (
|
|
||||||
method.tags['api'] is defined
|
|
||||||
or method.tags['api-advanced'] is defined
|
|
||||||
or method.tags['overwritable-hook'] is defined
|
|
||||||
or method.tags['extension-hook'] is defined
|
|
||||||
)
|
|
||||||
and (
|
|
||||||
node.tags['phpdoc-tuning-exclude-inherited'] is not defined
|
|
||||||
or method.parent.name == node.name
|
|
||||||
)
|
|
||||||
%}
|
|
||||||
{%- if loop.first %}
|
|
||||||
===== Public methods =====
|
|
||||||
{% endif %}
|
|
||||||
{{ block('method') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% for method in methods|sort_asc if method.visibility == 'protected' and (method.tags['overwritable-hook'] is defined or method.tags['extension-hook'] is defined) %}
|
|
||||||
{%- if loop.first %}
|
|
||||||
===== Protected methods =====
|
|
||||||
{% endif %}
|
|
||||||
{{ block('method') }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% set constants = node.inheritedConstants.merge(node.constants) %}
|
|
||||||
{% if constants|length > 0 %}
|
|
||||||
===== Constants =====
|
|
||||||
{% for constant in constants|sort_asc %}
|
|
||||||
{{ block('constant') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{#{% set properties = node.inheritedProperties.merge(node.properties.merge(node.magicProperties)) %}#}
|
|
||||||
{#{% for property in properties|sort_asc if property.visibility == 'public' %}#}
|
|
||||||
{#{%- if loop.first %}#}
|
|
||||||
{#===== Public properties =====#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{{ block('property') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% for property in properties|sort_asc if property.visibility == 'protected' %}#}
|
|
||||||
{#{%- if loop.first %}#}
|
|
||||||
{#===== Protected properties =====#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{{ block('property') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
|
|
||||||
|
|
||||||
{%- endif %} {#{% elseif node.tags['xxx'] is not defined and ... #}
|
|
||||||
|
|
||||||
<wrap button>[[start|🔙 Back]]</wrap>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
{% block constant %}
|
|
||||||
|
|
||||||
<WRAP group box >
|
|
||||||
<WRAP twothirds column >
|
|
||||||
==== {{ constant.name }} ====
|
|
||||||
</WRAP>{# twothirds column#}
|
|
||||||
|
|
||||||
<WRAP third column>
|
|
||||||
{% if constant.deprecated %}<wrap danger>deprecated</wrap> {% endif %}
|
|
||||||
{% if (node.parent is not null and constant.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
== {{ constant.summary|replace({"\n":""})|raw }} ==
|
|
||||||
<html>{{ constant.description|markdown|raw }}</html>
|
|
||||||
|
|
||||||
{% if constant.deprecated %}
|
|
||||||
=== Deprecated ===
|
|
||||||
{{ constant.tags.deprecated[0].description|raw }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% include 'includes/inherited-from.txt.twig' with {structure:constant} %}
|
|
||||||
|
|
||||||
{% include 'includes/see-also.txt.twig' with {structure:constant, title_level: '=='} %}
|
|
||||||
|
|
||||||
{% include 'includes/uses.txt.twig' with {structure:constant, title_level: '=='} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags.txt.twig' with {structure:constant, title_level: '==', blacklist: ['link', 'see', 'var', 'deprecated', 'uses', 'package', 'subpackage', 'todo', 'code-example']} %}
|
|
||||||
|
|
||||||
</WRAP>{# group #}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
{% block method %}
|
|
||||||
|
|
||||||
|
|
||||||
<WRAP group box >
|
|
||||||
<WRAP twothirds column >
|
|
||||||
==== {{ method.name }} ====
|
|
||||||
</WRAP>{# twothirds column#}
|
|
||||||
<WRAP third column >
|
|
||||||
{% include 'includes/wrap-tags.txt.twig' with {structure:method, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
|
||||||
{% if method.deprecated %}<wrap danger>deprecated</wrap> {% endif %}
|
|
||||||
{% if (node.parent is not null and method.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
|
||||||
{% if method.abstract %}<wrap warning>abstract</wrap> {% endif %}
|
|
||||||
{% if method.final %}<wrap notice>final</wrap> {% endif %}
|
|
||||||
<wrap notice>{{ method.visibility }}</wrap>
|
|
||||||
{% if method.static %}<wrap warning>static</wrap> {% endif %}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
|
|
||||||
== {{ method.summary|replace({"\n":""})|raw }} ==
|
|
||||||
<html>{{ method.description|markdown|raw }}</html>
|
|
||||||
|
|
||||||
<code php>{% if method.abstract %}abstract {% endif %}{% if method.final %}final {% endif %}{{ method.visibility }} {% if method.static %}static {% endif %}{{ method.name }}({% for argument in method.arguments %}{{ argument.isVariadic ? '...' }}{{ argument.name }}{{ argument.default ? (' = '~argument.default)|raw }}{% if not loop.last %}, {% endif %}{% endfor %})</code>
|
|
||||||
|
|
||||||
<WRAP twothirds column >
|
|
||||||
|
|
||||||
|
|
||||||
=== Parameters ===
|
|
||||||
{% if method.arguments|length > 0 -%}
|
|
||||||
^ types ^ name ^ default ^ description ^
|
|
||||||
{% for argument in method.arguments -%}
|
|
||||||
| **<nowiki>{{ argument.types|join('|')|raw }}</nowiki>** | {{ argument.name }} {{ argument.isVariadic ? '<small style="color: gray">variadic</small>' }} | <nowiki>{{ argument.default|raw }}</nowiki> | {{ argument.description|trim|replace("\n", ' ')|raw }} |{{ "\r\n" }}
|
|
||||||
{%- endfor %}
|
|
||||||
{% else %}
|
|
||||||
//none//
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{#=== Parameters ===#}
|
|
||||||
{#{% if method.arguments|length > 0 -%}#}
|
|
||||||
{#{% for argument in method.arguments -%}#}
|
|
||||||
{#== {{ argument.name }} ==#}
|
|
||||||
|
|
||||||
|
|
||||||
{#{% set varDesc %}#}
|
|
||||||
{#<span style="margin:0 10px; 0 20px; font-weight: bold;">{{ argument.types|join('|') }}</span>#}
|
|
||||||
{#{{ argument.isVariadic ? '<small style="color: gray">variadic</small>' }}#}
|
|
||||||
{#{{ argument.description|raw }}#}
|
|
||||||
{#{% endset %}#}
|
|
||||||
{#<html>{{ varDesc|markdown|raw }}</html>#}
|
|
||||||
{#{%- endfor %}#}
|
|
||||||
{#{% else %}#}
|
|
||||||
{#<wrap tip>This method has no parameter</wrap>#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
|
|
||||||
|
|
||||||
{% if method.response and method.response.types|join() != 'void' %}
|
|
||||||
=== Returns ===
|
|
||||||
<html>{{ ('**' ~ method.response.types|join('|')|trim ~ '** ' ~ method.response.description)|markdown|raw }}</html>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</WRAP>{# twothirds column#}
|
|
||||||
|
|
||||||
<WRAP third column >
|
|
||||||
|
|
||||||
{% if method.tags.throws|length > 0 or method.tags.throw|length > 0 %}
|
|
||||||
=== Throws ===
|
|
||||||
{% for exception in method.tags.throws -%}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}''{{ exception.types|join('|')|raw }}'' <nowiki>{{ exception.description|raw }}</nowiki>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% include 'includes/inherited-from.txt.twig' with {structure:method} %}
|
|
||||||
|
|
||||||
{% include 'includes/see-also.txt.twig' with {structure:method, title_level: '==='} %}
|
|
||||||
|
|
||||||
{% include 'includes/uses.txt.twig' with {structure:method, title_level: '==='} %}
|
|
||||||
|
|
||||||
{% include 'includes/used-by.txt.twig' with {structure:method, title_level: '==='} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags-with-description.txt.twig' with {structure:method, title_level: '===', WRAP: 'info', tagsWithDescription: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags.txt.twig' with {structure:method, title_level: '===', blacklist: ['todo', 'link', 'see', 'abstract', 'example', 'param', 'return', 'access', 'deprecated', 'throws', 'throw', 'uses', 'api', 'api-advanced', 'overwritable-hook', 'extension-hook', 'used-by', 'inheritdoc', 'code-example']} %}
|
|
||||||
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/code-examples.txt.twig' with {structure:method, title_level: '==='} %}
|
|
||||||
|
|
||||||
</WRAP>{# group #}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
{% block property %}
|
|
||||||
|
|
||||||
<WRAP group box>
|
|
||||||
<WRAP twothirds column >
|
|
||||||
==== ${{ property.name }} ====
|
|
||||||
</WRAP>{# twothirds column#}
|
|
||||||
|
|
||||||
<WRAP third column>
|
|
||||||
{% if property.deprecated %}<wrap danger>deprecated</wrap> {% endif %}
|
|
||||||
{% if (node.parent is not null and property.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
== {{ property.summary|replace({"\n":""})|raw }} ==
|
|
||||||
<html>{{ property.description|markdown|raw }}</html>
|
|
||||||
{% if property.var.0.description %}<html>{{ property.var.0.description|markdown|raw }}</html>{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{#{% if property.types %}#}
|
|
||||||
{#== Type ==#}
|
|
||||||
{#{% for type in property.types %}#}
|
|
||||||
{#{% if loop.length > 1 %} * {% endif %}{{ type|raw }} : {{ type.description|raw }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{{ property.types|join('|')|raw }}#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
|
|
||||||
|
|
||||||
{% if property.deprecated %}
|
|
||||||
== Deprecated ==
|
|
||||||
{{ property.tags.deprecated[0].description }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% include 'includes/inherited-from.txt.twig' with {structure:property} %}
|
|
||||||
|
|
||||||
{% include 'includes/see-also.txt.twig' with {structure:property, title_level: '=='} %}
|
|
||||||
|
|
||||||
{% include 'includes/uses.txt.twig' with {structure:property, title_level: ''} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags.txt.twig' with {structure:property, title_level: '==', blacklist: ['link', 'see', 'access', 'var', 'deprecated', 'uses', 'todo', 'code-example']} %}
|
|
||||||
|
|
||||||
|
|
||||||
<code php>{{ property.visibility }} ${{ property.name }}{% if property.types %} : {{ property.types|join('|')|raw }}{% endif %}</code>
|
|
||||||
|
|
||||||
</WRAP>{# group #}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{{ node.source|raw }}
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
{% extends 'layout.txt.twig' %}
|
|
||||||
|
|
||||||
{% block javascripts %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{#<section class="row-fluid">#}
|
|
||||||
{#<div class="span2 sidebar">#}
|
|
||||||
{#{% set namespace = project.namespace %}#}
|
|
||||||
{#{{ block('sidebarNamespaces') }}#}
|
|
||||||
{#</div>#}
|
|
||||||
{#</section>#}
|
|
||||||
{#<section class="row-fluid">#}
|
|
||||||
====== {{ node.path|split('/')|slice(0,-1)|join('/') }}{{ node.name }} ======
|
|
||||||
{{ node.summary }}
|
|
||||||
<html>{{ node.description|markdown|raw }}</html>
|
|
||||||
|
|
||||||
{% if node.traits|length > 0 %}
|
|
||||||
|
|
||||||
===== Traits =====
|
|
||||||
{% for trait in node.traits %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ trait|raw }}</td>
|
|
||||||
<td><em>{{ trait.summary }}</em></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{% if node.interfaces|length > 0 %}
|
|
||||||
===== Interfaces =====
|
|
||||||
{% for interface in node.interfaces %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ interface|raw }}</td>
|
|
||||||
<td><em>{{ interface.summary }}</em></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.classes|length > 0 %}
|
|
||||||
===== Classes =====
|
|
||||||
{% for class in node.classes %}
|
|
||||||
{{ class|raw }}
|
|
||||||
<em>{{ class.summary }}</em>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.package is not empty and node.package != '\\' %}
|
|
||||||
===== Package =====
|
|
||||||
{{ node.subpackage ? (node.package ~ '\\' ~ node.subpackage) : node.package }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% for tagName,tags in node.tags if tagName in ['link', 'see'] %}
|
|
||||||
{% if loop.first %}
|
|
||||||
===== See also =====
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
<dd><a href="{{ tag.reference ?: tag.link }}"><div class="namespace-wrapper">{{ tag.description ?: tag.reference }}</div></a></dd>
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<h2>Tags</h2>
|
|
||||||
<table class="table table-condensed">
|
|
||||||
{% for tagName,tags in node.tags if tagName not in ['link', 'see', 'package', 'subpackage'] %}
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
{{ tagName }}
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
{% for tag in tags %}
|
|
||||||
{{ tag.description|markdown|raw }}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
<tr><td colspan="2"><em>None found</em></td></tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</aside>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if node.constants|length > 0 %}
|
|
||||||
<div class="row-fluid">
|
|
||||||
<section class="span8 content file">
|
|
||||||
<h2>Constants</h2>
|
|
||||||
</section>
|
|
||||||
<aside class="span4 detailsbar"></aside>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% for constant in node.constants %}
|
|
||||||
{{ block('constant') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.functions|length > 0 %}
|
|
||||||
<div class="row-fluid">
|
|
||||||
<section class="span8 content file">
|
|
||||||
<h2>Functions</h2>
|
|
||||||
</section>
|
|
||||||
<aside class="span4 detailsbar"></aside>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% for method in node.functions %}
|
|
||||||
{{ block('method') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h3 id="source-view-label">{{ node.file.name }}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<pre data-src="{{ path('files/' ~ node.path ~ '.txt')|raw }}" class="language-php line-numbers"></pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
{% extends 'layout.html.twig' %}
|
|
||||||
|
|
||||||
{% block stylesheets %}
|
|
||||||
<link href="{{ path('css/jquery.iviewer.css') }}" rel="stylesheet" media="all"/>
|
|
||||||
<style>
|
|
||||||
#viewer {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.wrapper {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block javascripts %}
|
|
||||||
<script src="{{ path('js/jquery.mousewheel.js') }}" type="text/javascript"></script>
|
|
||||||
<script src="{{ path('js/jquery.iviewer.js') }}" type="text/javascript"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).resize(function(){
|
|
||||||
$("#viewer").height($(window).height() - 100);
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
$("#viewer").iviewer({src: '{{ path('graphs/classes.svg') }}', zoom_animation: false});
|
|
||||||
$('#viewer img').on('dragstart', function(event){
|
|
||||||
event.preventDefault();
|
|
||||||
});
|
|
||||||
$(window).resize();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="row-fluid">
|
|
||||||
<div class="span12">
|
|
||||||
<div class="wrapper">
|
|
||||||
<div id="viewer" class="viewer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Fixes a vulnerability in CentOS: http://stackoverflow.com/questions/20533279/prevent-php-from-parsing-non-php-files-such-as-somefile-php-txt
|
|
||||||
<FilesMatch \.php\.txt$>
|
|
||||||
RemoveHandler .php
|
|
||||||
ForceType text/plain
|
|
||||||
</FilesMatch>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{%- set title_level = '==' -%}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if sub_title_level is not defined %}
|
|
||||||
{%- set sub_title_level = title_level|slice(1) -%}
|
|
||||||
{% endif %}
|
|
||||||
{% if sub_title_level == '=' %}
|
|
||||||
{%- set sub_title_level = '' -%}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{#{% for tagName,tags in structure.tags if tagName in ['code-example'] %}#}
|
|
||||||
{#{% if loop.first %}#}
|
|
||||||
{#{{title_level}} Examples {{title_level}}#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{% for tag in tags %}#}
|
|
||||||
{#{%- set descToken = tag.description|split("\n", 2) -%}#}
|
|
||||||
{#{%- set title = descToken[0] -%}#}
|
|
||||||
{#{%- set code = descToken[1] -%}#}
|
|
||||||
{#{{sub_title_level}} {{ title }} {{sub_title_level}}#}
|
|
||||||
{#<code php>{{ code|raw }}</code>#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
|
|
||||||
|
|
||||||
{% for tagName,tags in structure.tags if tagName in ['example'] %}
|
|
||||||
{% if loop.first %}
|
|
||||||
{{title_level}} Examples {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
{{ sub_title_level }} {{ tag.filePath|escape }}{{ sub_title_level }}
|
|
||||||
<code php>{{ tag.description|raw }}</code>
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{% set title_level='' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if (node.parent is null) %}
|
|
||||||
{{title_level}} File {{ structure.path }} {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if (node.parent is not null and structure.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}
|
|
||||||
{{title_level}} Inherited from {{title_level}}
|
|
||||||
[[{{structure.parent}}|{{structure.parent}}]]
|
|
||||||
{% endif %}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
{% for structure in structures|sort_asc if structure.tags['internal'] is not defined and (structure.tags['api'] is defined or structure.tags['api-advanced'] is defined or structure.tags['overwritable-hook'] is defined or structure.tags['extension-hook'] is defined ) %}
|
|
||||||
{#{{ structure|raw }}#}
|
|
||||||
|
|
||||||
{% set structureName = structure|trim('\\', 'left') %}
|
|
||||||
|
|
||||||
<WRAP group box>
|
|
||||||
<WRAP twothirds column >
|
|
||||||
==== {{ structureName }} ====
|
|
||||||
</WRAP>{# twothirds column#}
|
|
||||||
|
|
||||||
<WRAP third column>
|
|
||||||
{% if structure.deprecated %}<wrap danger>deprecated</wrap>{% endif %}
|
|
||||||
{% if structure.abstract %}<wrap warning>abstract</wrap>{% endif %}
|
|
||||||
{% if structure.final %}<wrap notice>final</wrap>{% endif %}
|
|
||||||
{% if (node.parent is not null and structure.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
|
||||||
{% include 'includes/wrap-tags.txt.twig' with {structure:structure, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
|
|
||||||
{{ structure.summary|raw }}
|
|
||||||
[[{{structureName}}|More information]]
|
|
||||||
|
|
||||||
</WRAP>{# group #}
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{%- set title_level='==' -%}
|
|
||||||
{% endif %}
|
|
||||||
{% for tagName,tags in structure.tags if tagName in ['link', 'see'] %}
|
|
||||||
{% if loop.first %}
|
|
||||||
{{title_level}} See also {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
{%- set linkTag = tag.reference|trim('\\', 'left') -%}
|
|
||||||
{% if not('()' in linkTag or '$' in linkTag or node.name in linkTag or '::' in linkTag ) %}
|
|
||||||
{%- set linkTag = linkTag|lower -%}
|
|
||||||
{% elseif node.name~'::' in linkTag %}
|
|
||||||
{%- set linkTag = linkTag|replace({(node.name~'::'): '#'})|lower -%}
|
|
||||||
{% elseif '::' in linkTag -%}
|
|
||||||
{%- set linkTag = linkTag|replace({'::': '#'})|lower -%}
|
|
||||||
{% else %}
|
|
||||||
{%- set linkTag = '#' ~ linkTag|lower -%}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{% if tag.reference is not empty -%}
|
|
||||||
[[{{linkTag}}|{{ (tag.reference)|trim('\\', 'left') }}]] {% if tag.description|trim is not empty %}: {{ tag.description|trim('\\', 'left') }} {% endif %}
|
|
||||||
{%- else -%}
|
|
||||||
{#{{ tag.description|trim('\\', 'left') }}#}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
{% if tag is not defined -%}
|
|
||||||
{# Do not display @api if @api-advanced is also present #}
|
|
||||||
{%- set tag = "api" -%}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{% if hidden_by is not defined -%}
|
|
||||||
{# Do not display @api if @api-advanced is also present #}
|
|
||||||
{%- set hidden_by = {"api" : "api-advanced"} -%}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% for method in methods|sort_asc
|
|
||||||
if (method.visibility == 'public')
|
|
||||||
and (
|
|
||||||
method.tags[tag] is defined
|
|
||||||
and (
|
|
||||||
hidden_by[tag] is not defined or method.tags[hidden_by[tag]] is not defined
|
|
||||||
)
|
|
||||||
)
|
|
||||||
%}
|
|
||||||
{%- if loop.first %}
|
|
||||||
{% if tag == 'api' %}
|
|
||||||
===== API synthesis =====
|
|
||||||
<WRAP>
|
|
||||||
List of the public API methods.
|
|
||||||
When manipulating {{ node.name }}, You can call those methods:
|
|
||||||
</WRAP>
|
|
||||||
{% elseif tag == 'api-advanced' %}
|
|
||||||
===== Advanced API synthesis =====
|
|
||||||
<WRAP>
|
|
||||||
List of advanced API methods
|
|
||||||
Beware they usage is recommended to advanced users only.
|
|
||||||
</WRAP>
|
|
||||||
{% elseif tag == 'overwritable-hook' %}
|
|
||||||
===== overwritable-hook synthesis =====
|
|
||||||
<WRAP >When inheriting from {{ node.name }},
|
|
||||||
you can overwrite those methods in order to add custom logic:
|
|
||||||
</WRAP>
|
|
||||||
{% elseif tag == 'extension-hook' %}
|
|
||||||
===== extension-hook synthesis =====
|
|
||||||
<WRAP >
|
|
||||||
When inheriting from {{ node.name }},
|
|
||||||
you can extend the behaviour of iTop by implementing:
|
|
||||||
</WRAP>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% set sanitizedMethod = method|trim('\\', 'left')|replace({(node.name~'::'): ''}) %}
|
|
||||||
{% if '::' in sanitizedMethod -%}
|
|
||||||
{%- if node.tags['phpdoc-tuning-exclude-inherited'] is not defined %}
|
|
||||||
* [[{{sanitizedMethod|replace({'::': '#'})|lower}}|↪{{sanitizedMethod}}]] — {{ method.summary|replace({"\n":""})|raw }}
|
|
||||||
{% endif %}
|
|
||||||
{%- else %}
|
|
||||||
* [[#{{sanitizedMethod}}|{{sanitizedMethod}}]] — {{ method.summary|replace({"\n":""})|raw }}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{% set title_level = '==' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{%- for tagName,tags in structure.tags if tagName in tagsWithDescription -%}
|
|
||||||
{%- for tag in tags -%}
|
|
||||||
{%- if tag.description is not empty -%}
|
|
||||||
{%- if WRAP is defined -%}
|
|
||||||
<WRAP {{WRAP}}>
|
|
||||||
{%- endif -%}
|
|
||||||
{{title_level}} {{ tagName }} {{title_level}}
|
|
||||||
{{ tag.description|escape }}
|
|
||||||
{%- if WRAP is defined -%}
|
|
||||||
</WRAP>
|
|
||||||
{%- endif -%}
|
|
||||||
{%- endif -%}
|
|
||||||
{%- endfor -%}
|
|
||||||
{%- endfor -%}
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{% set title_level='=====' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if blacklist is not defined %}
|
|
||||||
{% set blacklist =['link', 'see', 'abstract', 'example', 'method', 'property', 'property-read', 'property-write', 'package', 'subpackage', 'api', 'api-advanced', 'todo', 'code-example'] %}
|
|
||||||
{% endif %}
|
|
||||||
{% if hidden_by is not defined -%}
|
|
||||||
{# Do not display @api if @api-advanced is also present #}
|
|
||||||
{%- set hidden_by = {"api" : "api-advanced"} -%}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{#^ {% for tagName,tags in structure.tags if tagName not in blacklist -%}#}
|
|
||||||
{#{{ tagName }} ^#}
|
|
||||||
{#{%- endfor %}#}
|
|
||||||
|
|
||||||
{% for tagName,tags in structure.tags if tagName not in blacklist and (hidden_by[tagName] is not defined or structure.tags[hidden_by[tagName]] is not defined) %}
|
|
||||||
{%- if loop.first %}
|
|
||||||
{{title_level}} Tags {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
^ {{ tagName }} | {% for tag in tags %}{{ tag.version ? tag.version ~ ' ' : '' }}{{ tag.description}}{% endfor %} |
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{% set title_level='' %}
|
|
||||||
{% endif %}
|
|
||||||
{% for tagName,tags in structure.tags if tagName in ['used-by'] %}
|
|
||||||
{% if loop.first %}
|
|
||||||
{{title_level}} Used by {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ tag.reference ?: tag.link }} : {{ tag.description ?: tag.reference }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{#{% for tagName,tags in method.tags if tagName in ['uses'] %}#}
|
|
||||||
{#{% if loop.first %}#}
|
|
||||||
{#<dt>Uses</dt>#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{% for tag in tags %}#}
|
|
||||||
{#<dd>{{ tag.reference|raw }}</dd>#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{% set title_level='' %}
|
|
||||||
{% endif %}
|
|
||||||
{% for tagName,tags in structure.tags if tagName in ['uses'] %}
|
|
||||||
{% if loop.first %}
|
|
||||||
{{title_level}} Uses {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ tag.reference ?: tag.link }} : {{ tag.description ?: tag.reference }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{#{% for tagName,tags in method.tags if tagName in ['uses'] %}#}
|
|
||||||
{#{% if loop.first %}#}
|
|
||||||
{#<dt>Uses</dt>#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{% for tag in tags %}#}
|
|
||||||
{#<dd>{{ tag.reference|raw }}</dd>#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{% if wrap is not defined -%}
|
|
||||||
{% set wrap = 'notice' %}
|
|
||||||
{%- endif -%}
|
|
||||||
{% if hidden_by is not defined -%}
|
|
||||||
{# Do not display @api if @api-advanced is also present #}
|
|
||||||
{%- set hidden_by = {"api" : "api-advanced"} -%}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- for tagName,tags in structure.tags if tagName in wrapTags and (hidden_by[tagName] is not defined or structure.tags[hidden_by[tagName]] is not defined) %}
|
|
||||||
<wrap {{wrap}}>{{tagName}}</wrap>
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
{% extends 'layout.txt.twig' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<wrap button>[[start|🔙 Back]]</wrap>
|
|
||||||
|
|
||||||
{% if node.tags['internal'] is defined %}
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
<WRAP alert>This interface is "internal", and thus is not documented!</WRAP>
|
|
||||||
{% elseif node.tags['api'] is not defined and node.tags['api-advanced'] is not defined and node.tags['overwritable-hook'] is not defined and node.tags['extension-hook'] is not defined %}
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
<WRAP alert>This interface is neither "api", "overwritable-hook" or "extension-hook", and thus is not documented!</WRAP>
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
|
|
||||||
{% if node.deprecated %}<wrap danger>deprecated</wrap>{% endif %}
|
|
||||||
{% if node.abstract %}<wrap warning>abstract</wrap>{% endif %}
|
|
||||||
{% if node.final %}<wrap notice>final</wrap>{% endif %}
|
|
||||||
{% include 'includes/wrap-tags.txt.twig' with {structure:node, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% if node.deprecated %}
|
|
||||||
=== **<del>Deprecated</del>**===
|
|
||||||
//{{ node.tags.deprecated[0].description }}//
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
== {{ node.summary|replace({"\n":""})|raw }} ==
|
|
||||||
<html>{{ node.description|markdown|raw }}</html>
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/code-examples.txt.twig' with {structure:node, title_level: '====='} %}
|
|
||||||
|
|
||||||
|
|
||||||
{% set class = node.parent %}
|
|
||||||
{% block hierarchy_element %}
|
|
||||||
|
|
||||||
{% if class and class.name is defined and class.name|trim != '' %}
|
|
||||||
==== parent ====
|
|
||||||
{% set child = class %}
|
|
||||||
{% set class = class.parent %}
|
|
||||||
{{ block('hierarchy_element') }}
|
|
||||||
[[{{ child.name }}|{{ child.name }}]]
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% for interface in node.interfaces|sort_asc %}
|
|
||||||
{% if loop.first %}
|
|
||||||
==== Implements ====
|
|
||||||
{% endif %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ interface.fullyQualifiedStructuralElementName ?: interface }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
{% for trait in node.usedTraits|sort_asc %}
|
|
||||||
{% if loop.first %}
|
|
||||||
==== Uses traits ====
|
|
||||||
{% endif %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ trait.fullyQualifiedStructuralElementName ?: trait }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/see-also.txt.twig' with {structure:node, title_level: '==='} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags.txt.twig' with {structure:node, title_level: '=====', blacklist: ['link', 'see', 'abstract', 'example', 'method', 'property', 'property-read', 'property-write', 'package', 'subpackage', 'phpdoc-tuning-exclude-inherited', 'api', 'api-advanced', 'overwritable-hook', 'extension-hook', 'copyright', 'license', 'code-example']} %}
|
|
||||||
|
|
||||||
|
|
||||||
{% set methods = node.inheritedMethods.merge(node.methods) %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api-advanced'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'overwritable-hook'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'extension-hook'} %}
|
|
||||||
|
|
||||||
<WRAP clear />
|
|
||||||
|
|
||||||
|
|
||||||
{% for method in methods|sort_asc if method.visibility == 'public' %}
|
|
||||||
{%- if loop.first %}
|
|
||||||
===== Public methods =====
|
|
||||||
{% endif %}
|
|
||||||
{{ block('method') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% for method in methods|sort_asc if method.visibility == 'protected' %}
|
|
||||||
{%- if loop.first %}
|
|
||||||
===== Protected methods =====
|
|
||||||
{% endif %}
|
|
||||||
{{ block('method') }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% set constants = node.inheritedConstants.merge(node.constants) %}
|
|
||||||
{% if constants|length > 0 %}
|
|
||||||
===== Constants =====
|
|
||||||
{% for constant in constants|sort_asc %}
|
|
||||||
{{ block('constant') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{#{% set properties = node.inheritedProperties.merge(node.properties) %}#}
|
|
||||||
{#{% for property in properties|sort_asc if property.visibility == 'public' %}#}
|
|
||||||
{#{%- if loop.first %}#}
|
|
||||||
{#===== Public properties =====#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{{ block('property') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% for property in properties|sort_asc if property.visibility == 'protected' %}#}
|
|
||||||
{#{%- if loop.first %}#}
|
|
||||||
{#===== Protected properties =====#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{{ block('property') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
|
|
||||||
|
|
||||||
{%- endif %} {#{% elseif node.tags['xxx'] is not defined and ... #}
|
|
||||||
|
|
||||||
<wrap button>[[start|🔙 Back]]</wrap>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{% use 'elements/constant.txt.twig' %}
|
|
||||||
{% use 'elements/property.txt.twig' %}
|
|
||||||
{% use 'elements/method.txt.twig' %}
|
|
||||||
|
|
||||||
{% block content %}{% endblock %}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
{% extends 'layout.txt.twig' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% set namespace = project.namespace %}
|
|
||||||
{{ block('sidebarNamespaces') }}
|
|
||||||
|
|
||||||
{#{{ node.parent|raw }}#}
|
|
||||||
{#====== {{ node.parent.fullyQualifiedStructuralElementName }}{{ node.name }} ======#}
|
|
||||||
|
|
||||||
{% if node.children|length > 0 %}
|
|
||||||
=====Namespaces=====
|
|
||||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.children} %}
|
|
||||||
----
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.traits|length > 0 %}
|
|
||||||
===== Traits =====
|
|
||||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.traits} %}
|
|
||||||
----
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{% if node.interfaces|length > 0 %}
|
|
||||||
===== Interfaces =====
|
|
||||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.interfaces} %}
|
|
||||||
----
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.classes|length > 0 %}
|
|
||||||
===== Classes =====
|
|
||||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.classes} %}
|
|
||||||
----
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{#{% if node.constants|length > 0 %}#}
|
|
||||||
{#===== Constants =====#}
|
|
||||||
{#{% for constant in node.constants|sort_asc %}#}
|
|
||||||
{# {{ block('constant') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
|
|
||||||
{#{% if node.functions|length > 0 %}#}
|
|
||||||
{#===== Functions =====#}
|
|
||||||
|
|
||||||
{#{% for method in node.functions|sort_asc %}#}
|
|
||||||
{# {{ block('method') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
|
|
||||||
====== Deprecated elements ======
|
|
||||||
|
|
||||||
{#{% for element in project.indexes.elements if element.deprecated %}#}
|
|
||||||
{#{% if element.file.path != previousPath %}#}
|
|
||||||
{#<li><a href="#{{ element.file.path }}"><i class="icon-file"></i> {{ element.file.path }}</a></li>#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{% set previousPath = element.file.path %}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
|
|
||||||
{% for element in project.indexes.elements if element.deprecated %}
|
|
||||||
{% if element.file.path != previousPath %}
|
|
||||||
{% if previousPath %}
|
|
||||||
</WRAP>{# group #}
|
|
||||||
{% endif %}
|
|
||||||
{#<a name="{{ element.file.path }}" id="{{ element.file.path }}"></a>#}
|
|
||||||
===== {{ element.file.path }} ({{ element.tags.deprecated.count }} found)=====
|
|
||||||
|
|
||||||
<WRAP group >
|
|
||||||
<WRAP third column >
|
|
||||||
Element
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
<WRAP third column >
|
|
||||||
Line
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
<WRAP third column >
|
|
||||||
Description
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in element.tags.deprecated %}
|
|
||||||
<WRAP group >
|
|
||||||
<WRAP third column >
|
|
||||||
{{ element.fullyQualifiedStructuralElementName }}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
<WRAP third column >
|
|
||||||
{{ element.line }}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
<WRAP third column >
|
|
||||||
{{ tag.description }}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
</WRAP>{# group #}
|
|
||||||
{% set previousPath = element.file.path %}
|
|
||||||
{% else %}
|
|
||||||
<WRAP info>No deprecated elements have been found in this project.</WRAP>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<template>
|
|
||||||
<author>Bruno DA SILVA</author>
|
|
||||||
<email>contact [at] combodo.com</email>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<copyright>Combodo 2018</copyright>
|
|
||||||
<description><![CDATA[
|
|
||||||
|
|
||||||
Forked from the clean theme of https://github.com/phpDocumentor/phpDocumentor2 provided under the MIT licence.
|
|
||||||
The original work is copyright "Mike van Riel".
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
To improve performance you can add the following to your .htaccess:
|
|
||||||
|
|
||||||
<ifModule mod_deflate.c>
|
|
||||||
<filesMatch "\.(js|css|html)$">
|
|
||||||
SetOutputFilter DEFLATE
|
|
||||||
</filesMatch>
|
|
||||||
</ifModule>
|
|
||||||
]]></description>
|
|
||||||
<transformations>
|
|
||||||
<transformation writer="twig" query="namespace" source="templates/combodo-wiki/namespace.txt.twig" artifact="start.txt"/>
|
|
||||||
<transformation writer="twig" query="indexes.classes" source="templates/combodo-wiki/class.txt.twig" artifact="{{name}}.txt"/>
|
|
||||||
<transformation writer="twig" query="indexes.interfaces" source="templates/combodo-wiki/interface.txt.twig" artifact="{{name}}.txt" />
|
|
||||||
</transformations>
|
|
||||||
</template>
|
|
||||||
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
@@ -9,7 +9,7 @@ Any PRs not following the guidelines or with missing information will not be con
|
|||||||
## Base information
|
## Base information
|
||||||
| Question | Answer
|
| Question | Answer
|
||||||
|---------------------------------------------------------------|--------
|
|---------------------------------------------------------------|--------
|
||||||
| Related to a SourceForge thead / Another PR / Combodo ticket? | <!-- Put the URL -->
|
| Related to a SourceForge thread / Another PR / Combodo ticket? | <!-- Put the URL -->
|
||||||
| Type of change? | Bug fix / Enhancement / Translations
|
| Type of change? | Bug fix / Enhancement / Translations
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
12
.github/workflows/action.yml
vendored
12
.github/workflows/action.yml
vendored
@@ -26,13 +26,23 @@ jobs:
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Add internal tag if member
|
- name: Add internal tag if member of the organization
|
||||||
if: env.is_member == 'true'
|
if: env.is_member == 'true'
|
||||||
run: |
|
run: |
|
||||||
curl -X POST -H "Authorization: token ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}" \
|
curl -X POST -H "Authorization: token ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}" \
|
||||||
-H "Accept: application/vnd.github.v3+json" \
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
https://api.github.com/repos/Combodo/iTop/issues/${{ github.event.pull_request.number }}/labels \
|
https://api.github.com/repos/Combodo/iTop/issues/${{ github.event.pull_request.number }}/labels \
|
||||||
-d '{"labels":["internal"]}'
|
-d '{"labels":["internal"]}'
|
||||||
|
|
||||||
|
- name: Set PR author as assignee if member of the organization
|
||||||
|
if: env.is_member == 'true'
|
||||||
|
run: |
|
||||||
|
curl -L \
|
||||||
|
-X POST \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}" \
|
||||||
|
https://api.github.com/repos/Combodo/iTop/issues/${{ github.event.pull_request.number }}/assignees \
|
||||||
|
-d '{"assignees":["${{ github.event.pull_request.user.login }}"]}'
|
||||||
env:
|
env:
|
||||||
is_member: ${{ env.is_member }}
|
is_member: ${{ env.is_member }}
|
||||||
|
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -58,6 +58,9 @@ tests/*/vendor/*
|
|||||||
/tests/php-unit-tests/phpunit.xml
|
/tests/php-unit-tests/phpunit.xml
|
||||||
/tests/php-unit-tests/postbuild_integration.xml
|
/tests/php-unit-tests/postbuild_integration.xml
|
||||||
|
|
||||||
|
# PHP CS Fixer: Cache file
|
||||||
|
/.php-cs-fixer.cache
|
||||||
|
|
||||||
|
|
||||||
# Jetbrains
|
# Jetbrains
|
||||||
/.idea/**
|
/.idea/**
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ class DatamodelsXmlFiles extends AbstractGlobFileVersionUpdater
|
|||||||
libxml_clear_errors();
|
libxml_clear_errors();
|
||||||
$oFileXml->formatOutput = true;
|
$oFileXml->formatOutput = true;
|
||||||
$oFileXml->preserveWhiteSpace = false;
|
$oFileXml->preserveWhiteSpace = false;
|
||||||
$oFileXml->loadXML($sFileContent);
|
$oFileXml->loadXML($sFileContent, LIBXML_BIGLINES);
|
||||||
|
|
||||||
$oFileItopFormat = new iTopDesignFormat($oFileXml);
|
$oFileItopFormat = new iTopDesignFormat($oFileXml);
|
||||||
|
|
||||||
|
|||||||
16
.phpstorm.meta.php
Normal file
16
.phpstorm.meta.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @copyright Copyright (C) 2010-2025 Combodo SAS
|
||||||
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PHPSTORM_META
|
||||||
|
{
|
||||||
|
override(\MetaModel::NewObject(0), map([
|
||||||
|
'' => '@',
|
||||||
|
]));
|
||||||
|
override(\MetaModel::GetObject(0), map([
|
||||||
|
'' => '@',
|
||||||
|
]));
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ You want to contribute to iTop? Many thanks to you! 🎉 👍
|
|||||||
Here are some guidelines that will help us integrate your work!
|
Here are some guidelines that will help us integrate your work!
|
||||||
|
|
||||||
|
|
||||||
## Contributions
|
|
||||||
|
|
||||||
### Subjects
|
### Subjects
|
||||||
You are welcome to create pull requests on any of those subjects:
|
You are welcome to create pull requests on any of those subjects:
|
||||||
@@ -161,4 +161,4 @@ We have one sticker per contribution type. You might get multiple stickers with
|
|||||||
|
|
||||||
Here is the design of each stickers for year 2024:
|
Here is the design of each stickers for year 2024:
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -53,7 +53,7 @@ iTop also offers mass import tools to help you become even more efficient.
|
|||||||
[4]: https://www.itophub.io/wiki/page?id=latest:install:requirements
|
[4]: https://www.itophub.io/wiki/page?id=latest:install:requirements
|
||||||
[5]: https://www.itophub.io/wiki
|
[5]: https://www.itophub.io/wiki
|
||||||
[6]: https://store.itophub.io/en_US/
|
[6]: https://store.itophub.io/en_US/
|
||||||
[7]: .doc/itop-version-history.md
|
[7]: itop-version-history.md
|
||||||
|
|
||||||
[10]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#configuration_management_cmdb
|
[10]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#configuration_management_cmdb
|
||||||
[11]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#ticketing
|
[11]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#ticketing
|
||||||
@@ -73,6 +73,9 @@ iTop development is sponsored, led, and supported by [Combodo][0].
|
|||||||
|
|
||||||
[0]: https://www.combodo.com
|
[0]: https://www.combodo.com
|
||||||
|
|
||||||
|
## Developers
|
||||||
|
|
||||||
|
You can find information and instructions about our quality tools and how to run them [here](.doc/developers.md).
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
@@ -99,6 +102,7 @@ We would like to give a special thank you 🤗 to the people from the community
|
|||||||
- Goethals, Stefan
|
- Goethals, Stefan
|
||||||
- Giuva, Vincenzo Katriel (a.k.a [@DarkNight97boss](https://github.com/DarkNight97boss))
|
- Giuva, Vincenzo Katriel (a.k.a [@DarkNight97boss](https://github.com/DarkNight97boss))
|
||||||
- Gumble, David
|
- Gumble, David
|
||||||
|
- Håkon, Harnes (a.k.a [@hakonharnes](https://github.com/hakonharnes))
|
||||||
- Heloir, Arthur
|
- Heloir, Arthur
|
||||||
- Janssens, Jelle (a.k.a [@janssensjelle](https://github.com/janssensjelle))
|
- Janssens, Jelle (a.k.a [@janssensjelle](https://github.com/janssensjelle))
|
||||||
- Ji, Leeb (冀利斌) (a.k.a [@chileeb](https://github.com/chileeb))
|
- Ji, Leeb (冀利斌) (a.k.a [@chileeb](https://github.com/chileeb))
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
@@ -29,56 +30,52 @@ class UserRightsBaseClassGUI extends cmdbAbstractObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class URP_Profiles extends UserRightsBaseClassGUI
|
class URP_Profiles extends UserRightsBaseClassGUI
|
||||||
{
|
{
|
||||||
public static function Init()
|
public static function Init()
|
||||||
{
|
{
|
||||||
$aParams = array
|
$aParams =
|
||||||
(
|
[
|
||||||
"category" => "addon/userrights,grant_by_profile,filter",
|
"category" => "addon/userrights,grant_by_profile,filter",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => "name",
|
"name_attcode" => "name",
|
||||||
"complementary_name_attcode" => array('description'),
|
"complementary_name_attcode" => ['description'],
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array(),
|
"reconc_keys" => [],
|
||||||
"db_table" => "priv_urp_profiles",
|
"db_table" => "priv_urp_profiles",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
);
|
];
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => false, "depends_on" => []]));
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("user_list", array("linked_class"=>"URP_UserProfile", "ext_key_to_me"=>"profileid", "ext_key_to_remote"=>"userid", "allowed_values"=>null, "count_min"=>1, "count_max"=>0, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("user_list", ["linked_class" => "URP_UserProfile", "ext_key_to_me" => "profileid", "ext_key_to_remote" => "userid", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => []]));
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'user_list')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', ['name', 'description', 'user_list']); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', ['description']); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('name','description')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', ['name','description']); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('default_search', array ('name','description'));
|
MetaModel::Init_SetZListItems('default_search', ['name','description']);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static $m_aCacheProfiles = null;
|
protected static $m_aCacheProfiles = null;
|
||||||
|
|
||||||
public static function DoCreateProfile($sName, $sDescription)
|
public static function DoCreateProfile($sName, $sDescription)
|
||||||
{
|
{
|
||||||
if (is_null(self::$m_aCacheProfiles))
|
if (is_null(self::$m_aCacheProfiles)) {
|
||||||
{
|
self::$m_aCacheProfiles = [];
|
||||||
self::$m_aCacheProfiles = array();
|
|
||||||
$oFilterAll = new DBObjectSearch('URP_Profiles');
|
$oFilterAll = new DBObjectSearch('URP_Profiles');
|
||||||
$oSet = new DBObjectSet($oFilterAll);
|
$oSet = new DBObjectSet($oFilterAll);
|
||||||
while ($oProfile = $oSet->Fetch())
|
while ($oProfile = $oSet->Fetch()) {
|
||||||
{
|
|
||||||
self::$m_aCacheProfiles[$oProfile->Get('name')] = $oProfile->GetKey();
|
self::$m_aCacheProfiles[$oProfile->Get('name')] = $oProfile->GetKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sCacheKey = $sName;
|
$sCacheKey = $sName;
|
||||||
if (isset(self::$m_aCacheProfiles[$sCacheKey]))
|
if (isset(self::$m_aCacheProfiles[$sCacheKey])) {
|
||||||
{
|
|
||||||
return self::$m_aCacheProfiles[$sCacheKey];
|
return self::$m_aCacheProfiles[$sCacheKey];
|
||||||
}
|
}
|
||||||
$oNewObj = MetaModel::NewObject("URP_Profiles");
|
$oNewObj = MetaModel::NewObject("URP_Profiles");
|
||||||
@@ -89,27 +86,21 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
return $iId;
|
return $iId;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetGrantAsHtml($oUserRights, $sClass, $sAction)
|
public function GetGrantAsHtml($oUserRights, $sClass, $sAction)
|
||||||
{
|
{
|
||||||
$bGrant = $oUserRights->GetProfileActionGrant($this->GetKey(), $sClass, $sAction);
|
$bGrant = $oUserRights->GetProfileActionGrant($this->GetKey(), $sClass, $sAction);
|
||||||
if (is_null($bGrant))
|
if (is_null($bGrant)) {
|
||||||
{
|
return '<span class="ibo-user-rights ibo-is-failure">'.Dict::S('UI:UserManagement:ActionAllowed:No').'</span>';
|
||||||
return '<span style="background-color: #ffdddd;">'.Dict::S('UI:UserManagement:ActionAllowed:No').'</span>';
|
} elseif ($bGrant) {
|
||||||
}
|
return '<span class="ibo-user-rights ibo-is-success">'.Dict::S('UI:UserManagement:ActionAllowed:Yes').'</span>';
|
||||||
elseif ($bGrant)
|
} else {
|
||||||
{
|
return '<span class="ibo-user-rights ibo-is-failure">'.Dict::S('UI:UserManagement:ActionAllowed:No').'</span>';
|
||||||
return '<span style="background-color: #ddffdd;">'.Dict::S('UI:UserManagement:ActionAllowed:Yes').'</span>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return '<span style="background-color: #ffdddd;">'.Dict::S('UI:UserManagement:ActionAllowed:No').'</span>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoShowGrantSumary($oPage)
|
public function DoShowGrantSumary($oPage)
|
||||||
{
|
|
||||||
if ($this->GetRawName() == "Administrator")
|
|
||||||
{
|
{
|
||||||
|
if ($this->GetRawName() == "Administrator") {
|
||||||
// Looks dirty, but ok that's THE ONE
|
// Looks dirty, but ok that's THE ONE
|
||||||
$oPage->p(Dict::S('UI:UserManagement:AdminProfile+'));
|
$oPage->p(Dict::S('UI:UserManagement:AdminProfile+'));
|
||||||
return;
|
return;
|
||||||
@@ -118,21 +109,18 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
// Note: for sure, we assume that the instance is derived from UserRightsProfile
|
// Note: for sure, we assume that the instance is derived from UserRightsProfile
|
||||||
$oUserRights = UserRights::GetModuleInstance();
|
$oUserRights = UserRights::GetModuleInstance();
|
||||||
|
|
||||||
$aDisplayData = array();
|
$aDisplayData = [];
|
||||||
foreach (MetaModel::GetClasses('bizmodel,grant_by_profile') as $sClass)
|
foreach (MetaModel::GetClasses('bizmodel,grant_by_profile') as $sClass) {
|
||||||
{
|
$aStimuli = [];
|
||||||
$aStimuli = array();
|
foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) {
|
||||||
foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus)
|
|
||||||
{
|
|
||||||
$bGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode);
|
$bGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode);
|
||||||
if ($bGrant === true)
|
if ($bGrant === true) {
|
||||||
{
|
|
||||||
$aStimuli[] = '<span title="'.$sStimulusCode.': '.utils::EscapeHtml($oStimulus->GetDescription()).'">'.utils::EscapeHtml($oStimulus->GetLabel()).'</span>';
|
$aStimuli[] = '<span title="'.$sStimulusCode.': '.utils::EscapeHtml($oStimulus->GetDescription()).'">'.utils::EscapeHtml($oStimulus->GetLabel()).'</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sStimuli = implode(', ', $aStimuli);
|
$sStimuli = implode(', ', $aStimuli);
|
||||||
|
|
||||||
$aDisplayData[] = array(
|
$aDisplayData[] = [
|
||||||
'class' => MetaModel::GetName($sClass),
|
'class' => MetaModel::GetName($sClass),
|
||||||
'read' => $this->GetGrantAsHtml($oUserRights, $sClass, 'r'),
|
'read' => $this->GetGrantAsHtml($oUserRights, $sClass, 'r'),
|
||||||
'bulkread' => $this->GetGrantAsHtml($oUserRights, $sClass, 'br'),
|
'bulkread' => $this->GetGrantAsHtml($oUserRights, $sClass, 'br'),
|
||||||
@@ -141,22 +129,22 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
'delete' => $this->GetGrantAsHtml($oUserRights, $sClass, 'd'),
|
'delete' => $this->GetGrantAsHtml($oUserRights, $sClass, 'd'),
|
||||||
'bulkdelete' => $this->GetGrantAsHtml($oUserRights, $sClass, 'bd'),
|
'bulkdelete' => $this->GetGrantAsHtml($oUserRights, $sClass, 'bd'),
|
||||||
'stimuli' => $sStimuli,
|
'stimuli' => $sStimuli,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$aDisplayConfig = array();
|
$aDisplayConfig = [];
|
||||||
$aDisplayConfig['class'] = array('label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+'));
|
$aDisplayConfig['class'] = ['label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+')];
|
||||||
$aDisplayConfig['read'] = array('label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+'));
|
$aDisplayConfig['read'] = ['label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+')];
|
||||||
$aDisplayConfig['bulkread'] = array('label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+'));
|
$aDisplayConfig['bulkread'] = ['label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+')];
|
||||||
$aDisplayConfig['write'] = array('label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+'));
|
$aDisplayConfig['write'] = ['label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+')];
|
||||||
$aDisplayConfig['bulkwrite'] = array('label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+'));
|
$aDisplayConfig['bulkwrite'] = ['label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+')];
|
||||||
$aDisplayConfig['delete'] = array('label' => Dict::S('UI:UserManagement:Action:Delete'), 'description' => Dict::S('UI:UserManagement:Action:Delete+'));
|
$aDisplayConfig['delete'] = ['label' => Dict::S('UI:UserManagement:Action:Delete'), 'description' => Dict::S('UI:UserManagement:Action:Delete+')];
|
||||||
$aDisplayConfig['bulkdelete'] = array('label' => Dict::S('UI:UserManagement:Action:BulkDelete'), 'description' => Dict::S('UI:UserManagement:Action:BulkDelete+'));
|
$aDisplayConfig['bulkdelete'] = ['label' => Dict::S('UI:UserManagement:Action:BulkDelete'), 'description' => Dict::S('UI:UserManagement:Action:BulkDelete+')];
|
||||||
$aDisplayConfig['stimuli'] = array('label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+'));
|
$aDisplayConfig['stimuli'] = ['label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+')];
|
||||||
$oPage->table($aDisplayConfig, $aDisplayData);
|
$oPage->table($aDisplayConfig, $aDisplayData);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
|
public function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
|
||||||
{
|
{
|
||||||
parent::DisplayBareRelations($oPage, $bEditMode);
|
parent::DisplayBareRelations($oPage, $bEditMode);
|
||||||
|
|
||||||
@@ -166,10 +154,9 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
|
|
||||||
public static function GetReadOnlyAttributes()
|
public static function GetReadOnlyAttributes()
|
||||||
{
|
{
|
||||||
return array('name', 'description');
|
return ['name', 'description'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// returns an array of id => array of column => php value(so-called "real value")
|
// returns an array of id => array of column => php value(so-called "real value")
|
||||||
public static function GetPredefinedObjects()
|
public static function GetPredefinedObjects()
|
||||||
{
|
{
|
||||||
@@ -181,15 +168,13 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
protected function OnDelete()
|
protected function OnDelete()
|
||||||
{
|
{
|
||||||
// Don't remove admin profile
|
// Don't remove admin profile
|
||||||
if ($this->Get('name') === ADMIN_PROFILE_NAME)
|
if ($this->Get('name') === ADMIN_PROFILE_NAME) {
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('UI:Login:Error:AccessAdmin'));
|
throw new SecurityException(Dict::Format('UI:Login:Error:AccessAdmin'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: this may break the rule that says: "a user must have at least ONE profile" !
|
// Note: this may break the rule that says: "a user must have at least ONE profile" !
|
||||||
$oLnkSet = $this->Get('user_list');
|
$oLnkSet = $this->Get('user_list');
|
||||||
while($oLnk = $oLnkSet->Fetch())
|
while ($oLnk = $oLnkSet->Fetch()) {
|
||||||
{
|
|
||||||
$oLnk->DBDelete();
|
$oLnk->DBDelete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,11 +187,10 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
* @param $sTargetState string The target state in which to evalutate the flags, if empty the current state will be used
|
* @param $sTargetState string The target state in which to evalutate the flags, if empty the current state will be used
|
||||||
* @return integer Flags: the binary combination of the flags applicable to this attribute
|
* @return integer Flags: the binary combination of the flags applicable to this attribute
|
||||||
*/
|
*/
|
||||||
public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '')
|
public function GetAttributeFlags($sAttCode, &$aReasons = [], $sTargetState = '')
|
||||||
{
|
{
|
||||||
$iFlags = parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState);
|
$iFlags = parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState);
|
||||||
if (MetaModel::GetConfig()->Get('demo_mode'))
|
if (MetaModel::GetConfig()->Get('demo_mode')) {
|
||||||
{
|
|
||||||
$aReasons[] = 'Sorry, profiles are read-only in the demonstration mode!';
|
$aReasons[] = 'Sorry, profiles are read-only in the demonstration mode!';
|
||||||
$iFlags |= OPT_ATT_READONLY;
|
$iFlags |= OPT_ATT_READONLY;
|
||||||
}
|
}
|
||||||
@@ -214,52 +198,52 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class URP_UserProfile extends UserRightsBaseClassGUI
|
class URP_UserProfile extends UserRightsBaseClassGUI
|
||||||
{
|
{
|
||||||
public static function Init()
|
public static function Init()
|
||||||
{
|
{
|
||||||
$aParams = array
|
$aParams =
|
||||||
(
|
[
|
||||||
"category" => "addon/userrights,grant_by_profile,filter",
|
"category" => "addon/userrights,grant_by_profile,filter",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => array("userlogin", "profile"),
|
"name_attcode" => ["userlogin", "profile"],
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array(),
|
"reconc_keys" => [],
|
||||||
"db_table" => "priv_urp_userprofile",
|
"db_table" => "priv_urp_userprofile",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
"is_link" => true, /** @since 3.1.0 N°6482 */
|
"is_link" => true, /** @since 3.1.0 N°6482 */
|
||||||
'uniqueness_rules' => array(
|
'uniqueness_rules' => [
|
||||||
'no_duplicate' => array(
|
'no_duplicate' => [
|
||||||
'attributes' => array(
|
'attributes' => [
|
||||||
0 => 'userid',
|
0 => 'userid',
|
||||||
1 => 'profileid',
|
1 => 'profileid',
|
||||||
),
|
],
|
||||||
'filter' => '',
|
'filter' => '',
|
||||||
'disabled' => false,
|
'disabled' => false,
|
||||||
'is_blocking' => true,
|
'is_blocking' => true,
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login")));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"]));
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid",
|
MetaModel::Init_AddAttribute(new AttributeExternalKey(
|
||||||
array("targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array(), "allow_target_creation" => false)));
|
"profileid",
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name")));
|
["targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => [], "allow_target_creation" => false]
|
||||||
|
));
|
||||||
|
MetaModel::Init_AddAttribute(new AttributeExternalField("profile", ["allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"]));
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeString("reason", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => []]));
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('userid', 'profileid', 'reason')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', ['userid', 'profileid', 'reason']); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('userid', 'profileid', 'reason')); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', ['userid', 'profileid', 'reason']); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('userid', 'profileid')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', ['userid', 'profileid']); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'profileid')); // Criteria of the advanced search form
|
MetaModel::Init_SetZListItems('advanced_search', ['userid', 'profileid']); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CheckToDelete(&$oDeletionPlan)
|
public function CheckToDelete(&$oDeletionPlan)
|
||||||
@@ -267,15 +251,14 @@ class URP_UserProfile extends UserRightsBaseClassGUI
|
|||||||
if (MetaModel::GetConfig()->Get('demo_mode')) {
|
if (MetaModel::GetConfig()->Get('demo_mode')) {
|
||||||
// Users deletion is NOT allowed in demo mode
|
// Users deletion is NOT allowed in demo mode
|
||||||
$oDeletionPlan->AddToDelete($this, null);
|
$oDeletionPlan->AddToDelete($this, null);
|
||||||
$oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true);
|
$oDeletionPlan->SetDeletionIssues($this, ['deletion not allowed in demo mode.'], true);
|
||||||
$oDeletionPlan->ComputeResults();
|
$oDeletionPlan->ComputeResults();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$this->CheckIfProfileIsAllowed(UR_ACTION_DELETE);
|
$this->CheckIfProfileIsAllowed(UR_ACTION_DELETE);
|
||||||
}
|
} catch (SecurityException $e) {
|
||||||
catch (SecurityException $e) {
|
|
||||||
// Users deletion is NOT allowed
|
// Users deletion is NOT allowed
|
||||||
$oDeletionPlan->AddToDelete($this, null);
|
$oDeletionPlan->AddToDelete($this, null);
|
||||||
$oDeletionPlan->SetDeletionIssues($this, [$e->getMessage()], true);
|
$oDeletionPlan->SetDeletionIssues($this, [$e->getMessage()], true);
|
||||||
@@ -292,15 +275,14 @@ class URP_UserProfile extends UserRightsBaseClassGUI
|
|||||||
if (MetaModel::GetConfig()->Get('demo_mode')) {
|
if (MetaModel::GetConfig()->Get('demo_mode')) {
|
||||||
// Users deletion is NOT allowed in demo mode
|
// Users deletion is NOT allowed in demo mode
|
||||||
$oDeletionPlan->AddToDelete($this, null);
|
$oDeletionPlan->AddToDelete($this, null);
|
||||||
$oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true);
|
$oDeletionPlan->SetDeletionIssues($this, ['deletion not allowed in demo mode.'], true);
|
||||||
$oDeletionPlan->ComputeResults();
|
$oDeletionPlan->ComputeResults();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$this->CheckIfProfileIsAllowed(UR_ACTION_DELETE);
|
$this->CheckIfProfileIsAllowed(UR_ACTION_DELETE);
|
||||||
}
|
} catch (SecurityException $e) {
|
||||||
catch (SecurityException $e) {
|
|
||||||
// Users deletion is NOT allowed
|
// Users deletion is NOT allowed
|
||||||
$oDeletionPlan->AddToDelete($this, null);
|
$oDeletionPlan->AddToDelete($this, null);
|
||||||
$oDeletionPlan->SetDeletionIssues($this, [$e->getMessage()], true);
|
$oDeletionPlan->SetDeletionIssues($this, [$e->getMessage()], true);
|
||||||
@@ -336,29 +318,30 @@ class URP_UserProfile extends UserRightsBaseClassGUI
|
|||||||
protected function CheckIfProfileIsAllowed($iActionCode)
|
protected function CheckIfProfileIsAllowed($iActionCode)
|
||||||
{
|
{
|
||||||
// When initializing or admin, we need to let everything pass trough
|
// When initializing or admin, we need to let everything pass trough
|
||||||
if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) { return; }
|
if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Only administrators can manage administrators
|
// Only administrators can manage administrators
|
||||||
$iOrigUserId = $this->GetOriginal('userid');
|
$iOrigUserId = $this->GetOriginal('userid');
|
||||||
if (!empty($iOrigUserId))
|
if (!empty($iOrigUserId)) {
|
||||||
{
|
|
||||||
$oUser = MetaModel::GetObject('User', $iOrigUserId, true, true);
|
$oUser = MetaModel::GetObject('User', $iOrigUserId, true, true);
|
||||||
if (UserRights::IsAdministrator($oUser) && !UserRights::IsAdministrator())
|
if (UserRights::IsAdministrator($oUser) && !UserRights::IsAdministrator()) {
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('UI:Login:Error:AccessRestricted'));
|
throw new SecurityException(Dict::Format('UI:Login:Error:AccessRestricted'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$oUser = MetaModel::GetObject('User', $this->Get('userid'), true, true);
|
$oUser = MetaModel::GetObject('User', $this->Get('userid'), true, true);
|
||||||
if (UserRights::IsAdministrator($oUser) && !UserRights::IsAdministrator())
|
if (UserRights::IsAdministrator($oUser) && !UserRights::IsAdministrator()) {
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('UI:Login:Error:AccessRestricted'));
|
throw new SecurityException(Dict::Format('UI:Login:Error:AccessRestricted'));
|
||||||
}
|
}
|
||||||
if (!UserRights::IsActionAllowed(get_class($this), $iActionCode, DBObjectSet::FromObject($this)))
|
|
||||||
{
|
$oSet = new \ormLinkSet(get_class($oUser), 'profile_list', \DBObjectSet::FromScratch(\URP_UserProfile::class));
|
||||||
|
$oSet->AddItem(MetaModel::NewObject('URP_UserProfile', ['profileid' => $this->GetKey(), 'reason' => 'CheckIfProfileIsAllowed']));
|
||||||
|
|
||||||
|
if (!UserRights::IsActionAllowed(get_class($this), $iActionCode, $oSet)) {
|
||||||
throw new SecurityException(Dict::Format('UI:Error:ObjectCannotBeUpdated'));
|
throw new SecurityException(Dict::Format('UI:Error:ObjectCannotBeUpdated'));
|
||||||
}
|
}
|
||||||
if (!UserRights::IsAdministrator() && ($this->Get('profile') === ADMIN_PROFILE_NAME))
|
if (!UserRights::IsAdministrator() && ($this->Get('profile') === ADMIN_PROFILE_NAME)) {
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('UI:Login:Error:AccessAdmin'));
|
throw new SecurityException(Dict::Format('UI:Login:Error:AccessAdmin'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -369,33 +352,33 @@ class URP_UserOrg extends UserRightsBaseClassGUI
|
|||||||
{
|
{
|
||||||
public static function Init()
|
public static function Init()
|
||||||
{
|
{
|
||||||
$aParams = array
|
$aParams =
|
||||||
(
|
[
|
||||||
"category" => "addon/userrights,grant_by_profile",
|
"category" => "addon/userrights,grant_by_profile",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => array("userlogin", "allowed_org_name"),
|
"name_attcode" => ["userlogin", "allowed_org_name"],
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array(),
|
"reconc_keys" => [],
|
||||||
"db_table" => "priv_urp_userorg",
|
"db_table" => "priv_urp_userorg",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
);
|
];
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"userid", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values"=>null, "extkey_attcode"=> 'userid', "target_attcode"=>"login")));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"]));
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("allowed_org_id", array("targetclass"=>"Organization", "jointype"=> "", "allowed_values"=>null, "sql"=>"allowed_org_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("allowed_org_id", ["targetclass" => "Organization", "jointype" => "", "allowed_values" => null, "sql" => "allowed_org_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("allowed_org_name", array("allowed_values"=>null, "extkey_attcode"=> 'allowed_org_id', "target_attcode"=>"name")));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("allowed_org_name", ["allowed_values" => null, "extkey_attcode" => 'allowed_org_id', "target_attcode" => "name"]));
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values"=>null, "sql"=>"reason", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeString("reason", ["allowed_values" => null, "sql" => "reason", "default_value" => null, "is_null_allowed" => true, "depends_on" => []]));
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('userid', 'allowed_org_id', 'reason')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', ['userid', 'allowed_org_id', 'reason']); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('allowed_org_id', 'reason')); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', ['allowed_org_id', 'reason']); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('userid', 'allowed_org_id')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', ['userid', 'allowed_org_id']); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'allowed_org_id')); // Criteria of the advanced search form
|
MetaModel::Init_SetZListItems('advanced_search', ['userid', 'allowed_org_id']); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function OnInsert()
|
protected function OnInsert()
|
||||||
@@ -418,35 +401,32 @@ class URP_UserOrg extends UserRightsBaseClassGUI
|
|||||||
*/
|
*/
|
||||||
protected function CheckIfOrgIsAllowed()
|
protected function CheckIfOrgIsAllowed()
|
||||||
{
|
{
|
||||||
if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) { return; }
|
if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$oUser = UserRights::GetUserObject();
|
$oUser = UserRights::GetUserObject();
|
||||||
$oAddon = UserRights::GetModuleInstance();
|
$oAddon = UserRights::GetModuleInstance();
|
||||||
$aOrgs = $oAddon->GetUserOrgs($oUser, '');
|
$aOrgs = $oAddon->GetUserOrgs($oUser, '');
|
||||||
if (count($aOrgs) > 0)
|
if (count($aOrgs) > 0) {
|
||||||
{
|
|
||||||
$iOrigOrgId = $this->GetOriginal('allowed_org_id');
|
$iOrigOrgId = $this->GetOriginal('allowed_org_id');
|
||||||
if ((!empty($iOrigOrgId) && !in_array($iOrigOrgId, $aOrgs)) || !in_array($this->Get('allowed_org_id'), $aOrgs))
|
if ((!empty($iOrigOrgId) && !in_array($iOrigOrgId, $aOrgs)) || !in_array($this->Get('allowed_org_id'), $aOrgs)) {
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('Class:User/Error:OrganizationNotAllowed'));
|
throw new SecurityException(Dict::Format('Class:User/Error:OrganizationNotAllowed'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UserRightsProfile extends UserRightsAddOnAPI
|
class UserRightsProfile extends UserRightsAddOnAPI
|
||||||
{
|
{
|
||||||
static public $m_aActionCodes = array(
|
public static $m_aActionCodes = [
|
||||||
UR_ACTION_READ => 'r',
|
UR_ACTION_READ => 'r',
|
||||||
UR_ACTION_MODIFY => 'w',
|
UR_ACTION_MODIFY => 'w',
|
||||||
UR_ACTION_DELETE => 'd',
|
UR_ACTION_DELETE => 'd',
|
||||||
UR_ACTION_BULK_READ => 'br',
|
UR_ACTION_BULK_READ => 'br',
|
||||||
UR_ACTION_BULK_MODIFY => 'bw',
|
UR_ACTION_BULK_MODIFY => 'bw',
|
||||||
UR_ACTION_BULK_DELETE => 'bd',
|
UR_ACTION_BULK_DELETE => 'bd',
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array $aUsersProfilesList Cache of users' profiles. Hash array of user ID => [profile ID => profile friendlyname, profile ID => profile friendlyname, ...]
|
* @var array $aUsersProfilesList Cache of users' profiles. Hash array of user ID => [profile ID => profile friendlyname, profile ID => profile friendlyname, ...]
|
||||||
@@ -472,8 +452,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
$oContact = MetaModel::NewObject('Person');
|
$oContact = MetaModel::NewObject('Person');
|
||||||
$oContact->Set('name', 'My last name');
|
$oContact->Set('name', 'My last name');
|
||||||
$oContact->Set('first_name', 'My first name');
|
$oContact->Set('first_name', 'My first name');
|
||||||
if (MetaModel::IsValidAttCode('Person', 'org_id'))
|
if (MetaModel::IsValidAttCode('Person', 'org_id')) {
|
||||||
{
|
|
||||||
$oContact->Set('org_id', $iOrgId);
|
$oContact->Set('org_id', $iOrgId);
|
||||||
}
|
}
|
||||||
$oContact->Set('email', 'my.email@foo.org');
|
$oContact->Set('email', 'my.email@foo.org');
|
||||||
@@ -481,24 +460,19 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$oUser = new UserLocal();
|
$oUser = new UserLocal();
|
||||||
$oUser->Set('login', $sAdminUser);
|
$oUser->Set('login', $sAdminUser);
|
||||||
$oUser->Set('password', $sAdminPwd);
|
$oUser->Set('password', $sAdminPwd);
|
||||||
if (MetaModel::IsValidAttCode('UserLocal', 'contactid') && ($iContactId != 0))
|
if (MetaModel::IsValidAttCode('UserLocal', 'contactid') && ($iContactId != 0)) {
|
||||||
{
|
|
||||||
$oUser->Set('contactid', $iContactId);
|
$oUser->Set('contactid', $iContactId);
|
||||||
}
|
}
|
||||||
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
|
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
|
||||||
|
|
||||||
// Add this user to the very specific 'admin' profile
|
// Add this user to the very specific 'admin' profile
|
||||||
$oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => ADMIN_PROFILE_NAME), true /*all data*/);
|
$oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => ADMIN_PROFILE_NAME], true /*all data*/);
|
||||||
if (is_object($oAdminProfile))
|
if (is_object($oAdminProfile)) {
|
||||||
{
|
$oSet = new \ormLinkSet(UserLocal::class, 'profile_list', \DBObjectSet::FromScratch(\URP_UserProfile::class));
|
||||||
$oUserProfile = new URP_UserProfile();
|
$oSet->AddItem(MetaModel::NewObject('URP_UserProfile', ['profileid' => $oAdminProfile->GetKey(), 'reason' => 'CreateAdministrator']));
|
||||||
$oUserProfile->Set('profileid', $oAdminProfile->GetKey());
|
|
||||||
$oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
|
|
||||||
$oSet = DBObjectSet::FromObject($oUserProfile);
|
|
||||||
$oUser->Set('profile_list', $oSet);
|
$oUser->Set('profile_list', $oSet);
|
||||||
}
|
}
|
||||||
$iUserId = $oUser->DBInsertNoReload();
|
$iUserId = $oUser->DBInsertNoReload();
|
||||||
@@ -509,11 +483,11 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected $m_aUserOrgs = array(); // userid -> array of orgid
|
protected $m_aUserOrgs = []; // userid -> array of orgid
|
||||||
protected $m_aAdministrators = null; // [user id]
|
protected $m_aAdministrators = null; // [user id]
|
||||||
|
|
||||||
// Built on demand, could be optimized if necessary (doing a query for each attribute that needs to be read)
|
// Built on demand, could be optimized if necessary (doing a query for each attribute that needs to be read)
|
||||||
protected $m_aObjectActionGrants = array();
|
protected $m_aObjectActionGrants = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read and cache organizations allowed to the given user
|
* Read and cache organizations allowed to the given user
|
||||||
@@ -528,31 +502,25 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
public function GetUserOrgs($oUser, $sClass)
|
public function GetUserOrgs($oUser, $sClass)
|
||||||
{
|
{
|
||||||
$iUser = $oUser->GetKey();
|
$iUser = $oUser->GetKey();
|
||||||
if (!array_key_exists($iUser, $this->m_aUserOrgs))
|
if (!array_key_exists($iUser, $this->m_aUserOrgs)) {
|
||||||
{
|
$this->m_aUserOrgs[$iUser] = [];
|
||||||
$this->m_aUserOrgs[$iUser] = array();
|
|
||||||
|
|
||||||
$sHierarchicalKeyCode = MetaModel::IsHierarchicalClass('Organization');
|
$sHierarchicalKeyCode = MetaModel::IsHierarchicalClass('Organization');
|
||||||
if ($sHierarchicalKeyCode !== false)
|
if ($sHierarchicalKeyCode !== false) {
|
||||||
{
|
|
||||||
$sUserOrgQuery = 'SELECT UserOrg, Org FROM Organization AS Org JOIN Organization AS Root ON Org.'.$sHierarchicalKeyCode.' BELOW Root.id JOIN URP_UserOrg AS UserOrg ON UserOrg.allowed_org_id = Root.id WHERE UserOrg.userid = :userid';
|
$sUserOrgQuery = 'SELECT UserOrg, Org FROM Organization AS Org JOIN Organization AS Root ON Org.'.$sHierarchicalKeyCode.' BELOW Root.id JOIN URP_UserOrg AS UserOrg ON UserOrg.allowed_org_id = Root.id WHERE UserOrg.userid = :userid';
|
||||||
$oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery), array(), array('userid' => $iUser));
|
$oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery), [], ['userid' => $iUser]);
|
||||||
while ($aRow = $oUserOrgSet->FetchAssoc())
|
while ($aRow = $oUserOrgSet->FetchAssoc()) {
|
||||||
{
|
|
||||||
$oOrg = $aRow['Org'];
|
$oOrg = $aRow['Org'];
|
||||||
$this->m_aUserOrgs[$iUser][] = $oOrg->GetKey();
|
$this->m_aUserOrgs[$iUser][] = $oOrg->GetKey();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$oSearch = new DBObjectSearch('URP_UserOrg');
|
$oSearch = new DBObjectSearch('URP_UserOrg');
|
||||||
$oSearch->AllowAllData();
|
$oSearch->AllowAllData();
|
||||||
$oCondition = new BinaryExpression(new FieldExpression('userid'), '=', new VariableExpression('userid'));
|
$oCondition = new BinaryExpression(new FieldExpression('userid'), '=', new VariableExpression('userid'));
|
||||||
$oSearch->AddConditionExpression($oCondition);
|
$oSearch->AddConditionExpression($oCondition);
|
||||||
|
|
||||||
$oUserOrgSet = new DBObjectSet($oSearch, array(), array('userid' => $iUser));
|
$oUserOrgSet = new DBObjectSet($oSearch, [], ['userid' => $iUser]);
|
||||||
while ($oUserOrg = $oUserOrgSet->Fetch())
|
while ($oUserOrg = $oUserOrgSet->Fetch()) {
|
||||||
{
|
|
||||||
$this->m_aUserOrgs[$iUser][] = $oUserOrg->Get('allowed_org_id');
|
$this->m_aUserOrgs[$iUser][] = $oUserOrg->Get('allowed_org_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -563,21 +531,20 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
public function ResetCache()
|
public function ResetCache()
|
||||||
{
|
{
|
||||||
// Loaded by Load cache
|
// Loaded by Load cache
|
||||||
$this->m_aUserOrgs = array();
|
$this->m_aUserOrgs = [];
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
$this->m_aObjectActionGrants = array();
|
$this->m_aObjectActionGrants = [];
|
||||||
$this->m_aAdministrators = null;
|
$this->m_aAdministrators = null;
|
||||||
|
$this->aUsersProfilesList = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function LoadCache()
|
public function LoadCache()
|
||||||
{
|
{
|
||||||
static $bSharedObjectInitialized = false;
|
static $bSharedObjectInitialized = false;
|
||||||
if (!$bSharedObjectInitialized)
|
if (!$bSharedObjectInitialized) {
|
||||||
{
|
|
||||||
$bSharedObjectInitialized = true;
|
$bSharedObjectInitialized = true;
|
||||||
if (self::HasSharing())
|
if (self::HasSharing()) {
|
||||||
{
|
|
||||||
SharedObject::InitSharedClassProperties();
|
SharedObject::InitSharedClassProperties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -615,45 +582,40 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
*/
|
*/
|
||||||
public function ListProfiles($oUser)
|
public function ListProfiles($oUser)
|
||||||
{
|
{
|
||||||
$aRet = array();
|
$aRet = [];
|
||||||
$oSearch = new DBObjectSearch('URP_UserProfile');
|
$oSearch = new DBObjectSearch('URP_UserProfile');
|
||||||
$oSearch->AllowAllData();
|
$oSearch->AllowAllData();
|
||||||
$oSearch->NoContextParameters();
|
$oSearch->NoContextParameters();
|
||||||
$oSearch->Addcondition('userid', $oUser->GetKey(), '=');
|
$oSearch->Addcondition('userid', $oUser->GetKey(), '=');
|
||||||
$oProfiles = new DBObjectSet($oSearch);
|
$oProfiles = new DBObjectSet($oSearch);
|
||||||
while ($oUserProfile = $oProfiles->Fetch())
|
while ($oUserProfile = $oProfiles->Fetch()) {
|
||||||
{
|
|
||||||
$aRet[$oUserProfile->Get('profileid')] = $oUserProfile->Get('profileid_friendlyname');
|
$aRet[$oUserProfile->Get('profileid')] = $oUserProfile->Get('profileid_friendlyname');
|
||||||
}
|
}
|
||||||
return $aRet;
|
return $aRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetSelectFilter($oUser, $sClass, $aSettings = array())
|
public function GetSelectFilter($oUser, $sClass, $aSettings = [])
|
||||||
{
|
{
|
||||||
$this->LoadCache();
|
$this->LoadCache();
|
||||||
|
|
||||||
// Let us pass an administrator for bypassing the grant matrix check in order to test this method without the need to set up a complex profile
|
// Let us pass an administrator for bypassing the grant matrix check in order to test this method without the need to set up a complex profile
|
||||||
// In the nominal case Administrators never end up here (since they completely bypass GetSelectFilter)
|
// In the nominal case Administrators never end up here (since they completely bypass GetSelectFilter)
|
||||||
if (!static::IsAdministrator($oUser) && (MetaModel::HasCategory($sClass, 'silo') || MetaModel::HasCategory($sClass, 'bizmodel')))
|
if (!static::IsAdministrator($oUser) && (MetaModel::HasCategory($sClass, 'silo') || MetaModel::HasCategory($sClass, 'bizmodel'))) {
|
||||||
{
|
|
||||||
// N°4354 - Categories 'silo' and 'bizmodel' do check the grant matrix. Whereas 'filter' always allows to read (but the result can be filtered)
|
// N°4354 - Categories 'silo' and 'bizmodel' do check the grant matrix. Whereas 'filter' always allows to read (but the result can be filtered)
|
||||||
$aObjectPermissions = $this->GetUserActionGrant($oUser, $sClass, UR_ACTION_READ);
|
$aObjectPermissions = $this->GetUserActionGrant($oUser, $sClass, UR_ACTION_READ);
|
||||||
if ($aObjectPermissions['permission'] == UR_ALLOWED_NO)
|
if ($aObjectPermissions['permission'] == UR_ALLOWED_NO) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oFilter = true;
|
$oFilter = true;
|
||||||
$aConditions = array();
|
$aConditions = [];
|
||||||
|
|
||||||
// Determine if this class is part of a silo and build the filter for it
|
// Determine if this class is part of a silo and build the filter for it
|
||||||
$sAttCode = self::GetOwnerOrganizationAttCode($sClass);
|
$sAttCode = self::GetOwnerOrganizationAttCode($sClass);
|
||||||
if (!is_null($sAttCode))
|
if (!is_null($sAttCode)) {
|
||||||
{
|
|
||||||
$aUserOrgs = $this->GetUserOrgs($oUser, $sClass);
|
$aUserOrgs = $this->GetUserOrgs($oUser, $sClass);
|
||||||
if (count($aUserOrgs) > 0)
|
if (count($aUserOrgs) > 0) {
|
||||||
{
|
|
||||||
$oFilter = $this->MakeSelectFilter($sClass, $aUserOrgs, $aSettings, $sAttCode);
|
$oFilter = $this->MakeSelectFilter($sClass, $aUserOrgs, $aSettings, $sAttCode);
|
||||||
}
|
}
|
||||||
// else: No org means 'any org'
|
// else: No org means 'any org'
|
||||||
@@ -662,20 +624,15 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
|
|
||||||
// Specific conditions to hide, for non-administrators, the Administrator Users, the Administrator Profile and related links
|
// Specific conditions to hide, for non-administrators, the Administrator Users, the Administrator Profile and related links
|
||||||
// Note: when logged as an administrator, GetSelectFilter is completely bypassed.
|
// Note: when logged as an administrator, GetSelectFilter is completely bypassed.
|
||||||
if ($this->AdministratorsAreHidden())
|
if ($this->AdministratorsAreHidden()) {
|
||||||
{
|
if ($sClass == 'URP_Profiles') {
|
||||||
if ($sClass == 'URP_Profiles')
|
|
||||||
{
|
|
||||||
$oExpression = new FieldExpression('id', $sClass);
|
$oExpression = new FieldExpression('id', $sClass);
|
||||||
$oScalarExpr = new ScalarExpression(1);
|
$oScalarExpr = new ScalarExpression(1);
|
||||||
|
|
||||||
$aConditions[] = new BinaryExpression($oExpression, '!=', $oScalarExpr);
|
$aConditions[] = new BinaryExpression($oExpression, '!=', $oScalarExpr);
|
||||||
}
|
} elseif (($sClass == 'URP_UserProfile') || ($sClass == 'User') || (is_subclass_of($sClass, 'User'))) {
|
||||||
else if (($sClass == 'URP_UserProfile') || ($sClass == 'User') || (is_subclass_of($sClass, 'User')))
|
|
||||||
{
|
|
||||||
$aAdministrators = $this->GetAdministrators();
|
$aAdministrators = $this->GetAdministrators();
|
||||||
if (count($aAdministrators) > 0)
|
if (count($aAdministrators) > 0) {
|
||||||
{
|
|
||||||
$sAttCode = ($sClass == 'URP_UserProfile') ? 'userid' : 'id';
|
$sAttCode = ($sClass == 'URP_UserProfile') ? 'userid' : 'id';
|
||||||
$oExpression = new FieldExpression($sAttCode, $sClass);
|
$oExpression = new FieldExpression($sAttCode, $sClass);
|
||||||
$oListExpr = ListExpression::FromScalars($aAdministrators);
|
$oListExpr = ListExpression::FromScalars($aAdministrators);
|
||||||
@@ -685,17 +642,14 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handling of the added conditions
|
// Handling of the added conditions
|
||||||
if (count($aConditions) > 0)
|
if (count($aConditions) > 0) {
|
||||||
{
|
if ($oFilter === true) {
|
||||||
if($oFilter === true)
|
|
||||||
{
|
|
||||||
// No 'silo' filter, let's build a clean one
|
// No 'silo' filter, let's build a clean one
|
||||||
$oFilter = new DBObjectSearch($sClass);
|
$oFilter = new DBObjectSearch($sClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the conditions to the filter
|
// Add the conditions to the filter
|
||||||
foreach($aConditions as $oCondition)
|
foreach ($aConditions as $oCondition) {
|
||||||
{
|
|
||||||
$oFilter->AddConditionExpression($oCondition);
|
$oFilter->AddConditionExpression($oCondition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -710,10 +664,9 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
*/
|
*/
|
||||||
private function GetAdministrators()
|
private function GetAdministrators()
|
||||||
{
|
{
|
||||||
if ($this->m_aAdministrators === null)
|
if ($this->m_aAdministrators === null) {
|
||||||
{
|
|
||||||
// Find all administrators
|
// Find all administrators
|
||||||
$this->m_aAdministrators = array();
|
$this->m_aAdministrators = [];
|
||||||
$oAdministratorsFilter = new DBObjectSearch('User');
|
$oAdministratorsFilter = new DBObjectSearch('User');
|
||||||
$oLnkFilter = new DBObjectSearch('URP_UserProfile');
|
$oLnkFilter = new DBObjectSearch('URP_UserProfile');
|
||||||
$oExpression = new FieldExpression('profileid', 'URP_UserProfile');
|
$oExpression = new FieldExpression('profileid', 'URP_UserProfile');
|
||||||
@@ -723,9 +676,8 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
$oAdministratorsFilter->AddCondition_ReferencedBy($oLnkFilter, 'userid');
|
$oAdministratorsFilter->AddCondition_ReferencedBy($oLnkFilter, 'userid');
|
||||||
$oAdministratorsFilter->AllowAllData(true); // Mandatory to prevent infinite recursion !!
|
$oAdministratorsFilter->AllowAllData(true); // Mandatory to prevent infinite recursion !!
|
||||||
$oSet = new DBObjectSet($oAdministratorsFilter);
|
$oSet = new DBObjectSet($oAdministratorsFilter);
|
||||||
$oSet->OptimizeColumnLoad(array('User' => array('login')));
|
$oSet->OptimizeColumnLoad(['User' => ['login']]);
|
||||||
while($oUser = $oSet->Fetch())
|
while ($oUser = $oSet->Fetch()) {
|
||||||
{
|
|
||||||
$this->m_aAdministrators[] = $oUser->GetKey();
|
$this->m_aAdministrators[] = $oUser->GetKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -741,7 +693,6 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
return ((bool)MetaModel::GetConfig()->Get('security.hide_administrators'));
|
return ((bool)MetaModel::GetConfig()->Get('security.hide_administrators'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This verb has been made public to allow the development of an accurate feedback for the current configuration
|
// This verb has been made public to allow the development of an accurate feedback for the current configuration
|
||||||
public function GetProfileActionGrant($iProfile, $sClass, $sAction)
|
public function GetProfileActionGrant($iProfile, $sClass, $sAction)
|
||||||
{
|
{
|
||||||
@@ -760,7 +711,9 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
$iUser = $oUser->GetKey();
|
$iUser = $oUser->GetKey();
|
||||||
if (isset($this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode])) {
|
if (isset($this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode])) {
|
||||||
$aTest = $this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode];
|
$aTest = $this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode];
|
||||||
if (is_array($aTest)) return $aTest;
|
if (is_array($aTest)) {
|
||||||
|
return $aTest;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sAction = self::$m_aActionCodes[$iActionCode];
|
$sAction = self::$m_aActionCodes[$iActionCode];
|
||||||
@@ -771,20 +724,14 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
$this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser);
|
$this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser);
|
||||||
}
|
}
|
||||||
// Call the API of UserRights because it caches the list for us
|
// Call the API of UserRights because it caches the list for us
|
||||||
foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile)
|
foreach ($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile) {
|
||||||
{
|
|
||||||
$bGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction);
|
$bGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction);
|
||||||
if (!is_null($bGrant))
|
if (!is_null($bGrant)) {
|
||||||
{
|
if ($bGrant) {
|
||||||
if ($bGrant)
|
if (is_null($bStatus)) {
|
||||||
{
|
|
||||||
if (is_null($bStatus))
|
|
||||||
{
|
|
||||||
$bStatus = true;
|
$bStatus = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$bStatus = false;
|
$bStatus = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -792,9 +739,9 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
|
|
||||||
$iPermission = $bStatus ? UR_ALLOWED_YES : UR_ALLOWED_NO;
|
$iPermission = $bStatus ? UR_ALLOWED_YES : UR_ALLOWED_NO;
|
||||||
|
|
||||||
$aRes = array(
|
$aRes = [
|
||||||
'permission' => $iPermission,
|
'permission' => $iPermission,
|
||||||
);
|
];
|
||||||
$this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode] = $aRes;
|
$this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode] = $aRes;
|
||||||
return $aRes;
|
return $aRes;
|
||||||
}
|
}
|
||||||
@@ -809,20 +756,13 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
// Note: In most cases the object set is ignored because it was interesting to optimize for huge data sets
|
// Note: In most cases the object set is ignored because it was interesting to optimize for huge data sets
|
||||||
// and acceptable to consider only the root class of the object set
|
// and acceptable to consider only the root class of the object set
|
||||||
|
|
||||||
if ($iPermission != UR_ALLOWED_YES)
|
if ($iPermission != UR_ALLOWED_YES) {
|
||||||
{
|
|
||||||
// It is already NO for everyone... that's the final word!
|
// It is already NO for everyone... that's the final word!
|
||||||
}
|
} elseif ($iActionCode == UR_ACTION_READ) {
|
||||||
elseif ($iActionCode == UR_ACTION_READ)
|
|
||||||
{
|
|
||||||
// We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading
|
// We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading
|
||||||
}
|
} elseif ($iActionCode == UR_ACTION_BULK_READ) {
|
||||||
elseif ($iActionCode == UR_ACTION_BULK_READ)
|
|
||||||
{
|
|
||||||
// We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading
|
// We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading
|
||||||
}
|
} elseif ($oInstanceSet) {
|
||||||
elseif ($oInstanceSet)
|
|
||||||
{
|
|
||||||
// We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading
|
// We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading
|
||||||
// We have to answer NO for objects shared for reading purposes
|
// We have to answer NO for objects shared for reading purposes
|
||||||
if (self::HasSharing() && SharedObject::GetSharedClassProperties($sClass)) {
|
if (self::HasSharing() && SharedObject::GetSharedClassProperties($sClass)) {
|
||||||
@@ -895,20 +835,14 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
// and acceptable to consider only the root class of the object set
|
// and acceptable to consider only the root class of the object set
|
||||||
$bStatus = null;
|
$bStatus = null;
|
||||||
// Call the API of UserRights because it caches the list for us
|
// Call the API of UserRights because it caches the list for us
|
||||||
foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile)
|
foreach ($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile) {
|
||||||
{
|
|
||||||
$bGrant = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode);
|
$bGrant = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode);
|
||||||
if (!is_null($bGrant))
|
if (!is_null($bGrant)) {
|
||||||
{
|
if ($bGrant) {
|
||||||
if ($bGrant)
|
if (is_null($bStatus)) {
|
||||||
{
|
|
||||||
if (is_null($bStatus))
|
|
||||||
{
|
|
||||||
$bStatus = true;
|
$bStatus = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$bStatus = false;
|
$bStatus = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -932,22 +866,16 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
{
|
{
|
||||||
$sAttCode = null;
|
$sAttCode = null;
|
||||||
|
|
||||||
$aCallSpec = array($sClass, 'MapContextParam');
|
$aCallSpec = [$sClass, 'MapContextParam'];
|
||||||
if (($sClass == 'Organization') || is_subclass_of($sClass, 'Organization'))
|
if (($sClass == 'Organization') || is_subclass_of($sClass, 'Organization')) {
|
||||||
{
|
|
||||||
$sAttCode = 'id';
|
$sAttCode = 'id';
|
||||||
}
|
} elseif (is_callable($aCallSpec)) {
|
||||||
elseif (is_callable($aCallSpec))
|
|
||||||
{
|
|
||||||
$sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter
|
$sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter
|
||||||
if (!MetaModel::IsValidAttCode($sClass, $sAttCode))
|
if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) {
|
||||||
{
|
|
||||||
// Skip silently. The data model checker will tell you something about this...
|
// Skip silently. The data model checker will tell you something about this...
|
||||||
$sAttCode = null;
|
$sAttCode = null;
|
||||||
}
|
}
|
||||||
}
|
} elseif (MetaModel::IsValidAttCode($sClass, 'org_id')) {
|
||||||
elseif(MetaModel::IsValidAttCode($sClass, 'org_id'))
|
|
||||||
{
|
|
||||||
$sAttCode = 'org_id';
|
$sAttCode = 'org_id';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -960,14 +888,11 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
protected static function HasSharing()
|
protected static function HasSharing()
|
||||||
{
|
{
|
||||||
static $bHasSharing;
|
static $bHasSharing;
|
||||||
if (!isset($bHasSharing))
|
if (!isset($bHasSharing)) {
|
||||||
{
|
|
||||||
$bHasSharing = class_exists('SharedObject');
|
$bHasSharing = class_exists('SharedObject');
|
||||||
}
|
}
|
||||||
return $bHasSharing;
|
return $bHasSharing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UserRights::SelectModule('UserRightsProfile');
|
UserRights::SelectModule('UserRightsProfile');
|
||||||
|
|
||||||
|
|||||||
29
app.php
29
app.php
@@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Copyright (C) 2013-2024 Combodo SAS
|
|
||||||
*
|
|
||||||
* This file is part of iTop.
|
|
||||||
*
|
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* iTop is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Combodo\iTop\Kernel;
|
|
||||||
|
|
||||||
require_once __DIR__.'/lib/autoload_runtime.php';
|
|
||||||
|
|
||||||
require_once('approot.inc.php');
|
|
||||||
require_once('application/startup.inc.php');
|
|
||||||
|
|
||||||
return function (array $context) {
|
|
||||||
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
|
|
||||||
};
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
@@ -48,8 +49,7 @@ class DBSearchHelper
|
|||||||
$oHKFilter->AddCondition_PointingTo($oFilter, $sHierarchicalKeyCode, TREE_OPERATOR_BELOW);
|
$oHKFilter->AddCondition_PointingTo($oFilter, $sHierarchicalKeyCode, TREE_OPERATOR_BELOW);
|
||||||
$oSearch->AddCondition_PointingTo($oHKFilter, $sAttCode);
|
$oSearch->AddCondition_PointingTo($oHKFilter, $sAttCode);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
// If filtering fails just ignore it
|
// If filtering fails just ignore it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2024 Combodo SAS
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
@@ -16,7 +17,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ApplicationContext
|
* Class ApplicationContext
|
||||||
*
|
*
|
||||||
@@ -86,7 +86,6 @@ class PortalURLMaker implements iDBObjectURLMaker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to store and manipulate the parameters that make the application's context
|
* Helper class to store and manipulate the parameters that make the application's context
|
||||||
*
|
*
|
||||||
@@ -115,11 +114,10 @@ class ApplicationContext
|
|||||||
*/
|
*/
|
||||||
public function __construct($bReadContext = true)
|
public function __construct($bReadContext = true)
|
||||||
{
|
{
|
||||||
$this->aNames = array(
|
$this->aNames = [
|
||||||
'org_id', 'menu'
|
'org_id', 'menu',
|
||||||
);
|
];
|
||||||
if ($bReadContext)
|
if ($bReadContext) {
|
||||||
{
|
|
||||||
$this->ReadContext();
|
$this->ReadContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,36 +131,29 @@ class ApplicationContext
|
|||||||
*/
|
*/
|
||||||
protected function ReadContext()
|
protected function ReadContext()
|
||||||
{
|
{
|
||||||
if (!isset(self::$aDefaultValues))
|
if (!isset(self::$aDefaultValues)) {
|
||||||
{
|
self::$aDefaultValues = [];
|
||||||
self::$aDefaultValues = array();
|
$aContext = utils::ReadParam('c', [], false, 'context_param');
|
||||||
$aContext = utils::ReadParam('c', array(), false, 'context_param');
|
foreach ($this->aNames as $sName) {
|
||||||
foreach($this->aNames as $sName)
|
|
||||||
{
|
|
||||||
$sValue = isset($aContext[$sName]) ? $aContext[$sName] : '';
|
$sValue = isset($aContext[$sName]) ? $aContext[$sName] : '';
|
||||||
// TO DO: check if some of the context parameters are mandatory (or have default values)
|
// TO DO: check if some of the context parameters are mandatory (or have default values)
|
||||||
if (!empty($sValue))
|
if (!empty($sValue)) {
|
||||||
{
|
|
||||||
self::$aDefaultValues[$sName] = $sValue;
|
self::$aDefaultValues[$sName] = $sValue;
|
||||||
}
|
}
|
||||||
// Hmm, there must be a better (more generic) way to handle the case below:
|
// Hmm, there must be a better (more generic) way to handle the case below:
|
||||||
// When there is only one possible (allowed) organization, the context must be
|
// When there is only one possible (allowed) organization, the context must be
|
||||||
// fixed to this org unless there is only one organization in the system then
|
// fixed to this org unless there is only one organization in the system then
|
||||||
// no filter is applied
|
// no filter is applied
|
||||||
if ($sName == 'org_id')
|
if ($sName == 'org_id') {
|
||||||
{
|
if (MetaModel::IsValidClass('Organization')) {
|
||||||
if (MetaModel::IsValidClass('Organization'))
|
|
||||||
{
|
|
||||||
$oSearchFilter = new DBObjectSearch('Organization');
|
$oSearchFilter = new DBObjectSearch('Organization');
|
||||||
$oSet = new CMDBObjectSet($oSearchFilter);
|
$oSet = new CMDBObjectSet($oSearchFilter);
|
||||||
$iCount = $oSet->CountWithLimit(2);
|
$iCount = $oSet->CountWithLimit(2);
|
||||||
if ($iCount > 1)
|
if ($iCount > 1) {
|
||||||
{
|
|
||||||
$oSearchFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', true);
|
$oSearchFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', true);
|
||||||
$oSet = new CMDBObjectSet($oSearchFilter);
|
$oSet = new CMDBObjectSet($oSearchFilter);
|
||||||
$iCount = $oSet->CountWithLimit(2);
|
$iCount = $oSet->CountWithLimit(2);
|
||||||
if ($iCount == 1)
|
if ($iCount == 1) {
|
||||||
{
|
|
||||||
// Only one possible value for org_id, set it in the context
|
// Only one possible value for org_id, set it in the context
|
||||||
$oOrg = $oSet->Fetch();
|
$oOrg = $oSet->Fetch();
|
||||||
self::$aDefaultValues[$sName] = $oOrg->GetKey();
|
self::$aDefaultValues[$sName] = $oOrg->GetKey();
|
||||||
@@ -185,8 +176,7 @@ class ApplicationContext
|
|||||||
*/
|
*/
|
||||||
public function GetCurrentValue($sParamName, $defaultValue = '')
|
public function GetCurrentValue($sParamName, $defaultValue = '')
|
||||||
{
|
{
|
||||||
if (isset($this->aValues[$sParamName]))
|
if (isset($this->aValues[$sParamName])) {
|
||||||
{
|
|
||||||
return $this->aValues[$sParamName];
|
return $this->aValues[$sParamName];
|
||||||
}
|
}
|
||||||
return $defaultValue;
|
return $defaultValue;
|
||||||
@@ -205,9 +195,8 @@ class ApplicationContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build the query string with ampersand separated parameters
|
// Build the query string with ampersand separated parameters
|
||||||
$aParams = array();
|
$aParams = [];
|
||||||
foreach($this->aValues as $sName => $sValue)
|
foreach ($this->aValues as $sName => $sValue) {
|
||||||
{
|
|
||||||
$aParams[] = "c[$sName]".'='.urlencode($sValue);
|
$aParams[] = "c[$sName]".'='.urlencode($sValue);
|
||||||
}
|
}
|
||||||
$sReturnValue = implode('&', $aParams);
|
$sReturnValue = implode('&', $aParams);
|
||||||
@@ -278,9 +267,8 @@ class ApplicationContext
|
|||||||
*/
|
*/
|
||||||
public function GetAsHash()
|
public function GetAsHash()
|
||||||
{
|
{
|
||||||
$aReturn = array();
|
$aReturn = [];
|
||||||
foreach($this->aValues as $sName => $sValue)
|
foreach ($this->aValues as $sName => $sValue) {
|
||||||
{
|
|
||||||
$aReturn["c[$sName]"] = $sValue;
|
$aReturn["c[$sName]"] = $sValue;
|
||||||
}
|
}
|
||||||
return $aReturn;
|
return $aReturn;
|
||||||
@@ -301,8 +289,7 @@ class ApplicationContext
|
|||||||
*/
|
*/
|
||||||
public function Reset($sParamName)
|
public function Reset($sParamName)
|
||||||
{
|
{
|
||||||
if (isset($this->aValues[$sParamName]))
|
if (isset($this->aValues[$sParamName])) {
|
||||||
{
|
|
||||||
unset($this->aValues[$sParamName]);
|
unset($this->aValues[$sParamName]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,21 +305,16 @@ class ApplicationContext
|
|||||||
public function InitObjectFromContext(DBObject &$oObj)
|
public function InitObjectFromContext(DBObject &$oObj)
|
||||||
{
|
{
|
||||||
$sClass = get_class($oObj);
|
$sClass = get_class($oObj);
|
||||||
foreach($this->GetNames() as $key)
|
foreach ($this->GetNames() as $key) {
|
||||||
{
|
$aCallSpec = [$sClass, 'MapContextParam'];
|
||||||
$aCallSpec = array($sClass, 'MapContextParam');
|
if (is_callable($aCallSpec)) {
|
||||||
if (is_callable($aCallSpec))
|
|
||||||
{
|
|
||||||
$sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter
|
$sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter
|
||||||
|
|
||||||
if (MetaModel::IsValidAttCode($sClass, $sAttCode))
|
if (MetaModel::IsValidAttCode($sClass, $sAttCode)) {
|
||||||
{
|
|
||||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||||
if ($oAttDef->IsWritable())
|
if ($oAttDef->IsWritable()) {
|
||||||
{
|
|
||||||
$value = $this->GetCurrentValue($key, null);
|
$value = $this->GetCurrentValue($key, null);
|
||||||
if (!is_null($value))
|
if (!is_null($value)) {
|
||||||
{
|
|
||||||
$oObj->Set($sAttCode, $value);
|
$oObj->Set($sAttCode, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -362,14 +344,10 @@ class ApplicationContext
|
|||||||
*/
|
*/
|
||||||
public static function GetUrlMakerClass()
|
public static function GetUrlMakerClass()
|
||||||
{
|
{
|
||||||
if (is_null(self::$m_sUrlMakerClass))
|
if (is_null(self::$m_sUrlMakerClass)) {
|
||||||
{
|
if (Session::IsSet('UrlMakerClass')) {
|
||||||
if (Session::IsSet('UrlMakerClass'))
|
|
||||||
{
|
|
||||||
self::$m_sUrlMakerClass = Session::Get('UrlMakerClass');
|
self::$m_sUrlMakerClass = Session::Get('UrlMakerClass');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
self::$m_sUrlMakerClass = 'iTopStandardURLMaker';
|
self::$m_sUrlMakerClass = 'iTopStandardURLMaker';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,7 +372,7 @@ class ApplicationContext
|
|||||||
if (is_null($sUrlMakerClass)) {
|
if (is_null($sUrlMakerClass)) {
|
||||||
$sUrlMakerClass = self::GetUrlMakerClass();
|
$sUrlMakerClass = self::GetUrlMakerClass();
|
||||||
}
|
}
|
||||||
$sUrl = call_user_func(array($sUrlMakerClass, 'MakeObjectUrl'), $sObjClass, $sObjKey);
|
$sUrl = call_user_func([$sUrlMakerClass, 'MakeObjectUrl'], $sObjClass, $sObjKey);
|
||||||
if (utils::StrLen($sUrl) > 0) {
|
if (utils::StrLen($sUrl) > 0) {
|
||||||
if ($bWithNavigationContext) {
|
if ($bWithNavigationContext) {
|
||||||
return $sUrl.$oAppContext->GetForLink(true);
|
return $sUrl.$oAppContext->GetForLink(true);
|
||||||
@@ -412,13 +390,10 @@ class ApplicationContext
|
|||||||
*/
|
*/
|
||||||
protected static function LoadPluginProperties()
|
protected static function LoadPluginProperties()
|
||||||
{
|
{
|
||||||
if (Session::IsSet('PluginProperties'))
|
if (Session::IsSet('PluginProperties')) {
|
||||||
{
|
|
||||||
self::$m_aPluginProperties = Session::Get('PluginProperties');
|
self::$m_aPluginProperties = Session::Get('PluginProperties');
|
||||||
}
|
} else {
|
||||||
else
|
self::$m_aPluginProperties = [];
|
||||||
{
|
|
||||||
self::$m_aPluginProperties = array();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,7 +406,9 @@ class ApplicationContext
|
|||||||
*/
|
*/
|
||||||
public static function SetPluginProperty($sPluginClass, $sProperty, $value)
|
public static function SetPluginProperty($sPluginClass, $sProperty, $value)
|
||||||
{
|
{
|
||||||
if (is_null(self::$m_aPluginProperties)) self::LoadPluginProperties();
|
if (is_null(self::$m_aPluginProperties)) {
|
||||||
|
self::LoadPluginProperties();
|
||||||
|
}
|
||||||
|
|
||||||
self::$m_aPluginProperties[$sPluginClass][$sProperty] = $value;
|
self::$m_aPluginProperties[$sPluginClass][$sProperty] = $value;
|
||||||
Session::Set(['PluginProperties', $sPluginClass, $sProperty], $value);
|
Session::Set(['PluginProperties', $sPluginClass, $sProperty], $value);
|
||||||
@@ -444,15 +421,14 @@ class ApplicationContext
|
|||||||
*/
|
*/
|
||||||
public static function GetPluginProperties($sPluginClass)
|
public static function GetPluginProperties($sPluginClass)
|
||||||
{
|
{
|
||||||
if (is_null(self::$m_aPluginProperties)) self::LoadPluginProperties();
|
if (is_null(self::$m_aPluginProperties)) {
|
||||||
|
self::LoadPluginProperties();
|
||||||
|
}
|
||||||
|
|
||||||
if (array_key_exists($sPluginClass, self::$m_aPluginProperties))
|
if (array_key_exists($sPluginClass, self::$m_aPluginProperties)) {
|
||||||
{
|
|
||||||
return self::$m_aPluginProperties[$sPluginClass];
|
return self::$m_aPluginProperties[$sPluginClass];
|
||||||
}
|
} else {
|
||||||
else
|
return [];
|
||||||
{
|
|
||||||
return array();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,12 +57,6 @@ require_once(APPROOT.'application/applicationextension/backoffice/SeparatorPopup
|
|||||||
require_once(APPROOT.'application/applicationextension/backoffice/URLButtonItem.php');
|
require_once(APPROOT.'application/applicationextension/backoffice/URLButtonItem.php');
|
||||||
require_once(APPROOT.'application/applicationextension/backoffice/URLPopupMenuItem.php');
|
require_once(APPROOT.'application/applicationextension/backoffice/URLPopupMenuItem.php');
|
||||||
|
|
||||||
//deprecated class and interface
|
|
||||||
require_once(APPROOT.'application/applicationextension/backoffice/iApplicationObjectExtension.php');
|
|
||||||
require_once(APPROOT.'application/applicationextension/backoffice/AbstractApplicationObjectExtension.php');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once(APPROOT.'application/applicationextension/iBackupExtraFilesExtension.php');
|
require_once(APPROOT.'application/applicationextension/iBackupExtraFilesExtension.php');
|
||||||
require_once(APPROOT.'application/applicationextension/iKPILoggerExtension.php');
|
require_once(APPROOT.'application/applicationextension/iKPILoggerExtension.php');
|
||||||
require_once(APPROOT.'application/applicationextension/iModuleExtension.php');
|
require_once(APPROOT.'application/applicationextension/iModuleExtension.php');
|
||||||
@@ -80,7 +74,3 @@ require_once(APPROOT.'application/applicationextension/rest/iRestInputSanitizer.
|
|||||||
require_once(APPROOT.'application/applicationextension/rest/iRestServiceProvider.php');
|
require_once(APPROOT.'application/applicationextension/rest/iRestServiceProvider.php');
|
||||||
require_once(APPROOT.'application/applicationextension/rest/RestResult.php');
|
require_once(APPROOT.'application/applicationextension/rest/RestResult.php');
|
||||||
require_once(APPROOT.'application/applicationextension/rest/RestUtils.php');
|
require_once(APPROOT.'application/applicationextension/rest/RestUtils.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extend this class instead of iApplicationObjectExtension if you don't need to overload all methods
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
* @deprecated 3.1.0 N°4756 use the new event service instead, see {@see DBObject::FireEvent()} method
|
|
||||||
* @package ORMExtensibilityAPI
|
|
||||||
* @since 2.7.0
|
|
||||||
*/
|
|
||||||
abstract class AbstractApplicationObjectExtension implements iApplicationObjectExtension
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function OnIsModified($oObject)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function OnCheckToWrite($oObject)
|
|
||||||
{
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function OnCheckToDelete($oObject)
|
|
||||||
{
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function OnDBUpdate($oObject, $oChange = null)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function OnDBInsert($oObject, $oChange = null)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function OnDBDelete($oObject, $oChange = null)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -42,7 +42,7 @@ abstract class AbstractApplicationUIExtension implements iApplicationUIExtension
|
|||||||
*/
|
*/
|
||||||
public function EnumUsedAttributes($oObject)
|
public function EnumUsedAttributes($oObject)
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,7 +66,7 @@ abstract class AbstractApplicationUIExtension implements iApplicationUIExtension
|
|||||||
*/
|
*/
|
||||||
public function EnumAllowedActions(DBObjectSet $oSet)
|
public function EnumAllowedActions(DBObjectSet $oSet)
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ abstract class ApplicationPopupMenuItem
|
|||||||
$this->sLabel = $sLabel;
|
$this->sLabel = $sLabel;
|
||||||
$this->sTooltip = '';
|
$this->sTooltip = '';
|
||||||
$this->sIconClass = '';
|
$this->sIconClass = '';
|
||||||
$this->aCssClasses = array();
|
$this->aCssClasses = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,7 +89,6 @@ abstract class ApplicationPopupMenuItem
|
|||||||
$this->aCssClasses[] = $sCssClass;
|
$this->aCssClasses[] = $sCssClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $sTooltip
|
* @param $sTooltip
|
||||||
*
|
*
|
||||||
@@ -145,6 +144,6 @@ abstract class ApplicationPopupMenuItem
|
|||||||
/** @ignore */
|
/** @ignore */
|
||||||
public function GetLinkedScripts()
|
public function GetLinkedScripts()
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,5 +9,4 @@
|
|||||||
*/
|
*/
|
||||||
class JSButtonItem extends JSPopupMenuItem
|
class JSButtonItem extends JSPopupMenuItem
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ class JSPopupMenuItem extends ApplicationPopupMenuItem
|
|||||||
* @param array $aIncludeJSFiles An array of file URLs to be included (once) to provide some JS libraries for the page.
|
* @param array $aIncludeJSFiles An array of file URLs to be included (once) to provide some JS libraries for the page.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function __construct($sUID, $sLabel, $sJSCode, $aIncludeJSFiles = array())
|
public function __construct($sUID, $sLabel, $sJSCode, $aIncludeJSFiles = [])
|
||||||
{
|
{
|
||||||
parent::__construct($sUID, $sLabel);
|
parent::__construct($sUID, $sLabel);
|
||||||
$this->sJsCode = $sJSCode;
|
$this->sJsCode = $sJSCode;
|
||||||
@@ -40,14 +40,14 @@ class JSPopupMenuItem extends ApplicationPopupMenuItem
|
|||||||
public function GetMenuItem()
|
public function GetMenuItem()
|
||||||
{
|
{
|
||||||
// Note: the semicolumn is a must here!
|
// Note: the semicolumn is a must here!
|
||||||
return array(
|
return [
|
||||||
'label' => $this->GetLabel(),
|
'label' => $this->GetLabel(),
|
||||||
'onclick' => $this->GetJsCode().'; return false;',
|
'onclick' => $this->GetJsCode().'; return false;',
|
||||||
'url' => $this->GetUrl(),
|
'url' => $this->GetUrl(),
|
||||||
'css_classes' => $this->GetCssClasses(),
|
'css_classes' => $this->GetCssClasses(),
|
||||||
'icon_class' => $this->sIconClass,
|
'icon_class' => $this->sIconClass,
|
||||||
'tooltip' => $this->sTooltip
|
'tooltip' => $this->sTooltip,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @ignore */
|
/** @ignore */
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
class SeparatorPopupMenuItem extends ApplicationPopupMenuItem
|
class SeparatorPopupMenuItem extends ApplicationPopupMenuItem
|
||||||
{
|
{
|
||||||
static $idx = 0;
|
public static $idx = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@@ -24,6 +24,6 @@ class SeparatorPopupMenuItem extends ApplicationPopupMenuItem
|
|||||||
/** @ignore */
|
/** @ignore */
|
||||||
public function GetMenuItem()
|
public function GetMenuItem()
|
||||||
{
|
{
|
||||||
return array('label' => '<hr class="menu-separator">', 'url' => '', 'css_classes' => $this->aCssClasses);
|
return ['label' => '<hr class="menu-separator">', 'url' => '', 'css_classes' => $this->aCssClasses];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,5 +9,4 @@
|
|||||||
*/
|
*/
|
||||||
class URLButtonItem extends URLPopupMenuItem
|
class URLButtonItem extends URLPopupMenuItem
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -35,13 +35,13 @@ class URLPopupMenuItem extends ApplicationPopupMenuItem
|
|||||||
/** @ignore */
|
/** @ignore */
|
||||||
public function GetMenuItem()
|
public function GetMenuItem()
|
||||||
{
|
{
|
||||||
return array('label' => $this->GetLabel(),
|
return ['label' => $this->GetLabel(),
|
||||||
'url' => $this->GetUrl(),
|
'url' => $this->GetUrl(),
|
||||||
'target' => $this->GetTarget(),
|
'target' => $this->GetTarget(),
|
||||||
'css_classes' => $this->aCssClasses,
|
'css_classes' => $this->aCssClasses,
|
||||||
'icon_class' => $this->sIconClass,
|
'icon_class' => $this->sIconClass,
|
||||||
'tooltip' => $this->sTooltip
|
'tooltip' => $this->sTooltip,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @ignore */
|
/** @ignore */
|
||||||
|
|||||||
@@ -1,111 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implement this interface to perform specific operations when objects are manipulated
|
|
||||||
*
|
|
||||||
* Note that those methods will be called when objects are manipulated, either in a programmatic way
|
|
||||||
* or through the GUI.
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
* @deprecated 3.1.0 N°4756 use the new event service instead, see {@see DBObject::FireEvent()} method. More details on each method PHPDoc.
|
|
||||||
* @package ORMExtensibilityAPI
|
|
||||||
*/
|
|
||||||
interface iApplicationObjectExtension
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Invoked to determine whether an object has been modified in memory
|
|
||||||
*
|
|
||||||
* The GUI calls this verb to determine the message that will be displayed to the end-user.
|
|
||||||
* Anyhow, this API can be called in other contexts such as the CSV import tool.
|
|
||||||
*
|
|
||||||
* If the extension returns false, then the framework will perform the usual evaluation.
|
|
||||||
* Otherwise, the answer is definitively "yes, the object has changed".
|
|
||||||
*
|
|
||||||
* @param /cmdbAbstractObject $oObject The target object
|
|
||||||
*
|
|
||||||
* @return boolean True if something has changed for the target object
|
|
||||||
* @api
|
|
||||||
* @deprecated 3.1.0 N°4756 No alternative available, this API was unstable and is abandoned
|
|
||||||
*/
|
|
||||||
public function OnIsModified($oObject);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked to determine whether an object can be written to the database
|
|
||||||
*
|
|
||||||
* The GUI calls this verb and reports any issue.
|
|
||||||
* Anyhow, this API can be called in other contexts such as the CSV import tool.
|
|
||||||
*
|
|
||||||
* @param \cmdbAbstractObject $oObject The target object
|
|
||||||
*
|
|
||||||
* @return string[] A list of errors message. An error message is made of one line and it can be displayed to the end-user.
|
|
||||||
* @api
|
|
||||||
* @deprecated 3.1.0 N°4756 Use EVENT_DB_CHECK_TO_WRITE event instead
|
|
||||||
*/
|
|
||||||
public function OnCheckToWrite($oObject);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked to determine wether an object can be deleted from the database
|
|
||||||
*
|
|
||||||
* The GUI calls this verb and stops the deletion process if any issue is reported.
|
|
||||||
*
|
|
||||||
* Please not that it is not possible to cascade deletion by this mean: only stopper issues can be handled.
|
|
||||||
*
|
|
||||||
* @param \cmdbAbstractObject $oObject The target object
|
|
||||||
*
|
|
||||||
* @return string[] A list of errors message. An error message is made of one line and it can be displayed to the end-user.
|
|
||||||
* @api
|
|
||||||
* @deprecated 3.1.0 N°4756 Use EVENT_DB_CHECK_TO_DELETE event instead
|
|
||||||
*/
|
|
||||||
public function OnCheckToDelete($oObject);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked when an object is updated into the database. The method is called right <b>after</b> the object has been written to the
|
|
||||||
* database.
|
|
||||||
*
|
|
||||||
* Useful methods you can call on $oObject :
|
|
||||||
*
|
|
||||||
* * {@see DBObject::ListPreviousValuesForUpdatedAttributes()} : list of changed attributes and their values before the change
|
|
||||||
* * {@see DBObject::Get()} : for a given attribute the new value that was persisted
|
|
||||||
*
|
|
||||||
* @param \cmdbAbstractObject $oObject The target object
|
|
||||||
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information
|
|
||||||
* once for all the changes made within the current page
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @deprecated 3.1.0 N°4756 Use EVENT_DB_AFTER_WRITE event instead
|
|
||||||
* @api
|
|
||||||
* @since 2.7.0 N°2293 can access object changes by calling {@see DBObject::ListPreviousValuesForUpdatedAttributes()} on $oObject
|
|
||||||
*/
|
|
||||||
public function OnDBUpdate($oObject, $oChange = null);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked when an object is created into the database
|
|
||||||
*
|
|
||||||
* The method is called right <b>after</b> the object has been written to the database.
|
|
||||||
*
|
|
||||||
* @param \cmdbAbstractObject $oObject The target object
|
|
||||||
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information
|
|
||||||
* once for all the changes made within the current page
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @deprecated 3.1.0 N°4756 Use EVENT_DB_AFTER_WRITE event instead
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
public function OnDBInsert($oObject, $oChange = null);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked when an object is deleted from the database
|
|
||||||
*
|
|
||||||
* The method is called right <b>before</b> the object will be deleted from the database.
|
|
||||||
*
|
|
||||||
* @param \cmdbAbstractObject $oObject The target object
|
|
||||||
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information
|
|
||||||
* once for all the changes made within the current page
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @deprecated 3.1.0 N°4756 Use EVENT_DB_AFTER_DELETE event instead
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
public function OnDBDelete($oObject, $oChange = null);
|
|
||||||
}
|
|
||||||
@@ -19,21 +19,21 @@ interface iPopupMenuExtension
|
|||||||
* $param is a DBObjectSet containing the list of objects
|
* $param is a DBObjectSet containing the list of objects
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const MENU_OBJLIST_ACTIONS = 1;
|
public const MENU_OBJLIST_ACTIONS = 1;
|
||||||
/**
|
/**
|
||||||
* Insert an item into the Toolkit menu of a list
|
* Insert an item into the Toolkit menu of a list
|
||||||
*
|
*
|
||||||
* $param is a DBObjectSet containing the list of objects
|
* $param is a DBObjectSet containing the list of objects
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const MENU_OBJLIST_TOOLKIT = 2;
|
public const MENU_OBJLIST_TOOLKIT = 2;
|
||||||
/**
|
/**
|
||||||
* Insert an item into the Actions menu on an object details page
|
* Insert an item into the Actions menu on an object details page
|
||||||
*
|
*
|
||||||
* $param is a DBObject instance: the object currently displayed
|
* $param is a DBObject instance: the object currently displayed
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const MENU_OBJDETAILS_ACTIONS = 3;
|
public const MENU_OBJDETAILS_ACTIONS = 3;
|
||||||
/**
|
/**
|
||||||
* Insert an item into the Dashboard menu
|
* Insert an item into the Dashboard menu
|
||||||
*
|
*
|
||||||
@@ -43,14 +43,14 @@ interface iPopupMenuExtension
|
|||||||
* $param is a Dashboard instance: the dashboard currently displayed
|
* $param is a Dashboard instance: the dashboard currently displayed
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const MENU_DASHBOARD_ACTIONS = 4;
|
public const MENU_DASHBOARD_ACTIONS = 4;
|
||||||
/**
|
/**
|
||||||
* Insert an item into the User menu (upper right corner)
|
* Insert an item into the User menu (upper right corner)
|
||||||
*
|
*
|
||||||
* $param is null
|
* $param is null
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const MENU_USER_ACTIONS = 5;
|
public const MENU_USER_ACTIONS = 5;
|
||||||
/**
|
/**
|
||||||
* Insert an item into the Action menu on an object item in an objects list in the portal
|
* Insert an item into the Action menu on an object item in an objects list in the portal
|
||||||
*
|
*
|
||||||
@@ -58,7 +58,7 @@ interface iPopupMenuExtension
|
|||||||
* the current line)
|
* the current line)
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const PORTAL_OBJLISTITEM_ACTIONS = 7;
|
public const PORTAL_OBJLISTITEM_ACTIONS = 7;
|
||||||
/**
|
/**
|
||||||
* Insert an item into the Action menu on an object details page in the portal
|
* Insert an item into the Action menu on an object details page in the portal
|
||||||
*
|
*
|
||||||
@@ -66,7 +66,7 @@ interface iPopupMenuExtension
|
|||||||
* currently displayed)
|
* currently displayed)
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const PORTAL_OBJDETAILS_ACTIONS = 8;
|
public const PORTAL_OBJDETAILS_ACTIONS = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert an item into the Actions menu of a list in the portal
|
* Insert an item into the Actions menu of a list in the portal
|
||||||
@@ -76,7 +76,7 @@ interface iPopupMenuExtension
|
|||||||
*
|
*
|
||||||
* @todo
|
* @todo
|
||||||
*/
|
*/
|
||||||
const PORTAL_OBJLIST_ACTIONS = 6;
|
public const PORTAL_OBJLIST_ACTIONS = 6;
|
||||||
/**
|
/**
|
||||||
* Insert an item into the user menu of the portal
|
* Insert an item into the user menu of the portal
|
||||||
* Note: This is not implemented yet !
|
* Note: This is not implemented yet !
|
||||||
@@ -85,7 +85,7 @@ interface iPopupMenuExtension
|
|||||||
*
|
*
|
||||||
* @todo
|
* @todo
|
||||||
*/
|
*/
|
||||||
const PORTAL_USER_ACTIONS = 9;
|
public const PORTAL_USER_ACTIONS = 9;
|
||||||
/**
|
/**
|
||||||
* Insert an item into the navigation menu of the portal
|
* Insert an item into the navigation menu of the portal
|
||||||
* Note: This is not implemented yet !
|
* Note: This is not implemented yet !
|
||||||
@@ -94,7 +94,7 @@ interface iPopupMenuExtension
|
|||||||
*
|
*
|
||||||
* @todo
|
* @todo
|
||||||
*/
|
*/
|
||||||
const PORTAL_MENU_ACTIONS = 10;
|
public const PORTAL_MENU_ACTIONS = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of items to be added to a menu.
|
* Get the list of items to be added to a menu.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ abstract class AbstractPortalUIExtension implements iPortalUIExtension
|
|||||||
*/
|
*/
|
||||||
public function GetCSSFiles(\Symfony\Component\DependencyInjection\Container $oContainer)
|
public function GetCSSFiles(\Symfony\Component\DependencyInjection\Container $oContainer)
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@ abstract class AbstractPortalUIExtension implements iPortalUIExtension
|
|||||||
*/
|
*/
|
||||||
public function GetJSFiles(\Symfony\Component\DependencyInjection\Container $oContainer)
|
public function GetJSFiles(\Symfony\Component\DependencyInjection\Container $oContainer)
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
*/
|
*/
|
||||||
interface iPortalUIExtension
|
interface iPortalUIExtension
|
||||||
{
|
{
|
||||||
const ENUM_PORTAL_EXT_UI_BODY = 'Body';
|
public const ENUM_PORTAL_EXT_UI_BODY = 'Body';
|
||||||
const ENUM_PORTAL_EXT_UI_NAVIGATION_MENU = 'NavigationMenu';
|
public const ENUM_PORTAL_EXT_UI_NAVIGATION_MENU = 'NavigationMenu';
|
||||||
const ENUM_PORTAL_EXT_UI_MAIN_CONTENT = 'MainContent';
|
public const ENUM_PORTAL_EXT_UI_MAIN_CONTENT = 'MainContent';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of CSS file urls
|
* Returns an array of CSS file urls
|
||||||
|
|||||||
@@ -13,62 +13,62 @@ class RestResult
|
|||||||
* Result: no issue has been encountered
|
* Result: no issue has been encountered
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const OK = 0;
|
public const OK = 0;
|
||||||
/**
|
/**
|
||||||
* Result: missing/wrong credentials or the user does not have enough rights to perform the requested operation
|
* Result: missing/wrong credentials or the user does not have enough rights to perform the requested operation
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const UNAUTHORIZED = 1;
|
public const UNAUTHORIZED = 1;
|
||||||
/**
|
/**
|
||||||
* Result: the parameter 'version' is missing
|
* Result: the parameter 'version' is missing
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const MISSING_VERSION = 2;
|
public const MISSING_VERSION = 2;
|
||||||
/**
|
/**
|
||||||
* Result: the parameter 'json_data' is missing
|
* Result: the parameter 'json_data' is missing
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const MISSING_JSON = 3;
|
public const MISSING_JSON = 3;
|
||||||
/**
|
/**
|
||||||
* Result: the input structure is not a valid JSON string
|
* Result: the input structure is not a valid JSON string
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const INVALID_JSON = 4;
|
public const INVALID_JSON = 4;
|
||||||
/**
|
/**
|
||||||
* Result: the parameter 'auth_user' is missing, authentication aborted
|
* Result: the parameter 'auth_user' is missing, authentication aborted
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const MISSING_AUTH_USER = 5;
|
public const MISSING_AUTH_USER = 5;
|
||||||
/**
|
/**
|
||||||
* Result: the parameter 'auth_pwd' is missing, authentication aborted
|
* Result: the parameter 'auth_pwd' is missing, authentication aborted
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const MISSING_AUTH_PWD = 6;
|
public const MISSING_AUTH_PWD = 6;
|
||||||
/**
|
/**
|
||||||
* Result: no operation is available for the specified version
|
* Result: no operation is available for the specified version
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const UNSUPPORTED_VERSION = 10;
|
public const UNSUPPORTED_VERSION = 10;
|
||||||
/**
|
/**
|
||||||
* Result: the requested operation is not valid for the specified version
|
* Result: the requested operation is not valid for the specified version
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const UNKNOWN_OPERATION = 11;
|
public const UNKNOWN_OPERATION = 11;
|
||||||
/**
|
/**
|
||||||
* Result: the requested operation cannot be performed because it can cause data (integrity) loss
|
* Result: the requested operation cannot be performed because it can cause data (integrity) loss
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const UNSAFE = 12;
|
public const UNSAFE = 12;
|
||||||
/**
|
/**
|
||||||
* Result: the request page number is not valid. It must be an integer greater than 0
|
* Result: the request page number is not valid. It must be an integer greater than 0
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const INVALID_PAGE = 13;
|
public const INVALID_PAGE = 13;
|
||||||
/**
|
/**
|
||||||
* Result: the operation could not be performed, see the message for troubleshooting
|
* Result: the operation could not be performed, see the message for troubleshooting
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const INTERNAL_ERROR = 100;
|
public const INTERNAL_ERROR = 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor - ok!
|
* Default constructor - ok!
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ class RestUtils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read an optional parameter from a Rest/Json structure.
|
* Read an optional parameter from a Rest/Json structure.
|
||||||
*
|
*
|
||||||
@@ -66,7 +65,6 @@ class RestUtils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a class from a Rest/Json structure.
|
* Read a class from a Rest/Json structure.
|
||||||
*
|
*
|
||||||
@@ -87,7 +85,6 @@ class RestUtils
|
|||||||
return $sClass;
|
return $sClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a list of attribute codes from a Rest/Json structure.
|
* Read a list of attribute codes from a Rest/Json structure.
|
||||||
*
|
*
|
||||||
@@ -103,7 +100,7 @@ class RestUtils
|
|||||||
public static function GetFieldList($sClass, $oData, $sParamName)
|
public static function GetFieldList($sClass, $oData, $sParamName)
|
||||||
{
|
{
|
||||||
$sFields = self::GetOptionalParam($oData, $sParamName, '*');
|
$sFields = self::GetOptionalParam($oData, $sParamName, '*');
|
||||||
$aShowFields = array();
|
$aShowFields = [];
|
||||||
if ($sFields == '*') {
|
if ($sFields == '*') {
|
||||||
foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) {
|
foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) {
|
||||||
$aShowFields[$sClass][] = $sAttCode;
|
$aShowFields[$sClass][] = $sAttCode;
|
||||||
@@ -140,7 +137,7 @@ class RestUtils
|
|||||||
*/
|
*/
|
||||||
protected static function FindObjectFromCriteria($sClass, $oCriteria)
|
protected static function FindObjectFromCriteria($sClass, $oCriteria)
|
||||||
{
|
{
|
||||||
$aCriteriaReport = array();
|
$aCriteriaReport = [];
|
||||||
if (isset($oCriteria->finalclass)) {
|
if (isset($oCriteria->finalclass)) {
|
||||||
if (!MetaModel::IsValidClass($oCriteria->finalclass)) {
|
if (!MetaModel::IsValidClass($oCriteria->finalclass)) {
|
||||||
throw new Exception("finalclass: Unknown class '".$oCriteria->finalclass."'");
|
throw new Exception("finalclass: Unknown class '".$oCriteria->finalclass."'");
|
||||||
@@ -171,7 +168,6 @@ class RestUtils
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find an object from a polymorph search specification (Rest/Json)
|
* Find an object from a polymorph search specification (Rest/Json)
|
||||||
*
|
*
|
||||||
@@ -260,7 +256,7 @@ class RestUtils
|
|||||||
} else {
|
} else {
|
||||||
throw new Exception("Wrong format for key");
|
throw new Exception("Wrong format for key");
|
||||||
}
|
}
|
||||||
$oObjectSet = new DBObjectSet($oSearch, array(), array(), null, $iLimit, $iOffset);
|
$oObjectSet = new DBObjectSet($oSearch, [], [], null, $iLimit, $iOffset);
|
||||||
|
|
||||||
return $oObjectSet;
|
return $oObjectSet;
|
||||||
}
|
}
|
||||||
@@ -291,7 +287,7 @@ class RestUtils
|
|||||||
throw new Exception("A link set must be defined by an array of objects");
|
throw new Exception("A link set must be defined by an array of objects");
|
||||||
}
|
}
|
||||||
$sLnkClass = $oAttDef->GetLinkedClass();
|
$sLnkClass = $oAttDef->GetLinkedClass();
|
||||||
$aLinks = array();
|
$aLinks = [];
|
||||||
foreach ($value as $oValues) {
|
foreach ($value as $oValues) {
|
||||||
$oLnk = static::MakeObjectFromFields($sLnkClass, $oValues);
|
$oLnk = static::MakeObjectFromFields($sLnkClass, $oValues);
|
||||||
// Fix for N°1939
|
// Fix for N°1939
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2024 Combodo SAS
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
@@ -16,7 +17,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class manages the audit "categories". Each category defines a set of objects
|
* This class manages the audit "categories". Each category defines a set of objects
|
||||||
* to check and is linked to a set of rules that determine the valid or invalid objects
|
* to check and is linked to a set of rules that determine the valid or invalid objects
|
||||||
@@ -32,34 +32,36 @@ class AuditCategory extends cmdbAbstractObject
|
|||||||
{
|
{
|
||||||
public static function Init()
|
public static function Init()
|
||||||
{
|
{
|
||||||
$aParams = array
|
$aParams =
|
||||||
(
|
[
|
||||||
"category" => "application,grant_by_profile",
|
"category" => "application,grant_by_profile",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => "name",
|
"name_attcode" => "name",
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array('name'),
|
"reconc_keys" => ['name'],
|
||||||
"db_table" => "priv_auditcategory",
|
"db_table" => "priv_auditcategory",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit-folder.svg'),
|
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit-folder.svg'),
|
||||||
);
|
];
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("description"=>"Short name for this category", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeString("name", ["description" => "Short name for this category", "allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeOQL("definition_set", array("allowed_values"=>null, "sql"=>"definition_set", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeOQL("definition_set", ["allowed_values" => null, "sql" => "definition_set", "default_value" => "", "is_null_allowed" => false, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeLinkedSet("rules_list", array("linked_class"=>"AuditRule", "ext_key_to_me"=>"category_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array(), "edit_mode" => LINKSET_EDITMODE_INPLACE, "tracking_level" => LINKSET_TRACKING_ALL)));
|
MetaModel::Init_AddAttribute(new AttributeLinkedSet("rules_list", ["linked_class" => "AuditRule", "ext_key_to_me" => "category_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => [], "edit_mode" => LINKSET_EDITMODE_INPLACE, "edit_when" => LINKSET_EDITWHEN_ALWAYS, "tracking_level" => LINKSET_TRACKING_ALL]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeInteger("ok_error_tolerance", array("allowed_values"=>null, "sql"=>"ok_error_tolerance", "default_value"=>5, "is_null_allowed"=>true, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeInteger("ok_error_tolerance", ["allowed_values" => null, "sql" => "ok_error_tolerance", "default_value" => 5, "is_null_allowed" => true, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeInteger("warning_error_tolerance", array("allowed_values" => null, "sql" => "warning_error_tolerance", "default_value" => 25, "is_null_allowed" => true, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeInteger("warning_error_tolerance", ["allowed_values" => null, "sql" => "warning_error_tolerance", "default_value" => 25, "is_null_allowed" => true, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("domains_list",
|
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect(
|
||||||
array("linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "category_id", "ext_key_to_remote" => "domain_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array(), "display_style" => 'property')));
|
"domains_list",
|
||||||
|
["linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "category_id", "ext_key_to_remote" => "domain_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => [], "display_style" => 'property']
|
||||||
|
));
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'definition_set', 'ok_error_tolerance', 'warning_error_tolerance', 'rules_list', 'domains_list')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', ['name', 'description', 'definition_set', 'ok_error_tolerance', 'warning_error_tolerance', 'rules_list', 'domains_list']); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('description', )); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', ['description', ]); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('description', 'definition_set')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', ['description', 'definition_set']); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('default_search', array('name', 'description')); // Criteria of the default search form
|
MetaModel::Init_SetZListItems('default_search', ['name', 'description']); // Criteria of the default search form
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,4 +95,3 @@ class AuditCategory extends cmdbAbstractObject
|
|||||||
return $aShortcutActions;
|
return $aShortcutActions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2024 Combodo SAS
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
@@ -16,7 +17,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class manages the audit "categories". Each category defines a set of objects
|
* This class manages the audit "categories". Each category defines a set of objects
|
||||||
* to check and is linked to a set of rules that determine the valid or invalid objects
|
* to check and is linked to a set of rules that determine the valid or invalid objects
|
||||||
@@ -33,32 +33,34 @@ class AuditDomain extends cmdbAbstractObject
|
|||||||
{
|
{
|
||||||
public static function Init()
|
public static function Init()
|
||||||
{
|
{
|
||||||
$aParams = array
|
$aParams =
|
||||||
(
|
[
|
||||||
"category" => "application,grant_by_profile",
|
"category" => "application,grant_by_profile",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => "name",
|
"name_attcode" => "name",
|
||||||
"complementary_name_attcode" => array('description'),
|
"complementary_name_attcode" => ['description'],
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array('name'),
|
"reconc_keys" => ['name'],
|
||||||
"db_table" => "priv_auditdomain",
|
"db_table" => "priv_auditdomain",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit-album.svg'),
|
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit-album.svg'),
|
||||||
);
|
];
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("description" => "Short name for this category", "allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeString("name", ["description" => "Short name for this category", "allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeImage("icon", array("is_null_allowed" => true, "depends_on" => array(), "display_max_width" => 96, "display_max_height" => 96, "storage_max_width" => 256, "storage_max_height" => 256, "default_image" => null, "always_load_in_tables" => false)));
|
MetaModel::Init_AddAttribute(new AttributeImage("icon", ["is_null_allowed" => true, "depends_on" => [], "display_max_width" => 96, "display_max_height" => 96, "storage_max_width" => 256, "storage_max_height" => 256, "default_image" => null, "always_load_in_tables" => false]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("categories_list",
|
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect(
|
||||||
array("linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "domain_id", "ext_key_to_remote" => "category_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array())));
|
"categories_list",
|
||||||
|
["linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "domain_id", "ext_key_to_remote" => "category_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => []]
|
||||||
|
));
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'icon', 'categories_list')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', ['name', 'description', 'icon', 'categories_list']); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('description',)); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', ['description',]); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('description')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', ['description']); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('default_search', array('name', 'description')); // Criteria of the default search form
|
MetaModel::Init_SetZListItems('default_search', ['name', 'description']); // Criteria of the default search form
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetShortcutActions($sFinalClass)
|
public static function GetShortcutActions($sFinalClass)
|
||||||
@@ -84,40 +86,39 @@ class lnkAuditCategoryToAuditDomain extends cmdbAbstractObject
|
|||||||
*/
|
*/
|
||||||
public static function Init()
|
public static function Init()
|
||||||
{
|
{
|
||||||
$aParams = array
|
$aParams =
|
||||||
(
|
[
|
||||||
"category" => "application,grant_by_profile",
|
"category" => "application,grant_by_profile",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => "",
|
"name_attcode" => "",
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array('category_id', 'domain_id'),
|
"reconc_keys" => ['category_id', 'domain_id'],
|
||||||
"db_table" => "priv_link_audit_category_domain",
|
"db_table" => "priv_link_audit_category_domain",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
"is_link" => true,
|
"is_link" => true,
|
||||||
'uniqueness_rules' => array(
|
'uniqueness_rules' => [
|
||||||
'no_duplicate' => array(
|
'no_duplicate' => [
|
||||||
'attributes' => array(
|
'attributes' => [
|
||||||
0 => 'category_id',
|
0 => 'category_id',
|
||||||
1 => 'domain_id',
|
1 => 'domain_id',
|
||||||
),
|
],
|
||||||
'filter' => '',
|
'filter' => '',
|
||||||
'disabled' => false,
|
'disabled' => false,
|
||||||
'is_blocking' => true,
|
'is_blocking' => true,
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", array("targetclass" => "AuditCategory", "jointype" => '', "allowed_values" => null, "sql" => "category_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", ["targetclass" => "AuditCategory", "jointype" => '', "allowed_values" => null, "sql" => "category_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", array("allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name")));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", ["allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name"]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("domain_id", array("targetclass" => "AuditDomain", "jointype" => '', "allowed_values" => null, "sql" => "domain_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("domain_id", ["targetclass" => "AuditDomain", "jointype" => '', "allowed_values" => null, "sql" => "domain_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("domain_name", array("allowed_values" => null, "extkey_attcode" => 'domain_id', "target_attcode" => "name")));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("domain_name", ["allowed_values" => null, "extkey_attcode" => 'domain_id', "target_attcode" => "name"]));
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('category_id', 'domain_id'));
|
MetaModel::Init_SetZListItems('details', ['category_id', 'domain_id']);
|
||||||
MetaModel::Init_SetZListItems('list', array('category_id', 'domain_id'));
|
MetaModel::Init_SetZListItems('list', ['category_id', 'domain_id']);
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('category_id', 'domain_id'));
|
MetaModel::Init_SetZListItems('standard_search', ['category_id', 'domain_id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2024 Combodo SAS
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
@@ -16,7 +17,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class manages the audit "rule" linked to a given audit category.
|
* This class manages the audit "rule" linked to a given audit category.
|
||||||
* Each rule is based on an OQL expression that returns either the "good" objects
|
* Each rule is based on an OQL expression that returns either the "good" objects
|
||||||
@@ -33,35 +33,35 @@ class AuditRule extends cmdbAbstractObject
|
|||||||
{
|
{
|
||||||
public static function Init()
|
public static function Init()
|
||||||
{
|
{
|
||||||
$aParams = array
|
$aParams =
|
||||||
(
|
[
|
||||||
"category" => "application,grant_by_profile",
|
"category" => "application,grant_by_profile",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => "name",
|
"name_attcode" => "name",
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array('name'),
|
"reconc_keys" => ['name'],
|
||||||
"db_table" => "priv_auditrule",
|
"db_table" => "priv_auditrule",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit.svg'),
|
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit.svg'),
|
||||||
);
|
];
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeOQL("query", array("allowed_values" => null, "sql" => "query", "default_value" => "", "is_null_allowed" => false, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeOQL("query", ["allowed_values" => null, "sql" => "query", "default_value" => "", "is_null_allowed" => false, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeEnum("valid_flag", array("allowed_values" => new ValueSetEnum('true,false'), "sql" => "valid_flag", "default_value" => "true", "is_null_allowed" => false, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeEnum("valid_flag", ["allowed_values" => new ValueSetEnum('true,false'), "sql" => "valid_flag", "default_value" => "true", "is_null_allowed" => false, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", array("allowed_values" => null, "sql" => "category_id", "targetclass" => "AuditCategory", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", ["allowed_values" => null, "sql" => "category_id", "targetclass" => "AuditCategory", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []]));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", array("allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name")));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", ["allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name"]));
|
||||||
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("contact_id", ["allowed_values" => null, "sql" => "contact_id", "targetclass" => "Contact", "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => []]));
|
||||||
|
MetaModel::Init_AddAttribute(new AttributeHTML("process", ["allowed_values" => null, "sql" => "process", "default_value" => "", "is_null_allowed" => true, "depends_on" => []]));
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('category_id', 'name', 'description', 'query', 'valid_flag')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', ['category_id', 'name', 'description', 'query', 'valid_flag', 'process', 'contact_id']); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('category_id', 'description', 'valid_flag')); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', ['category_id', 'description', 'query']); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('category_id', 'name', 'description', 'valid_flag', 'query')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', ['category_id', 'name', 'description', 'valid_flag', 'query']); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('default_search', array('name', 'description', 'category_id')); // Criteria of the advanced search form
|
MetaModel::Init_SetZListItems('default_search', ['name', 'description', 'category_id', 'contact_id', 'query']); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function GetShortcutActions($sFinalClass)
|
public static function GetShortcutActions($sFinalClass)
|
||||||
{
|
{
|
||||||
$aShortcutActions = parent::GetShortcutActions($sFinalClass);
|
$aShortcutActions = parent::GetShortcutActions($sFinalClass);
|
||||||
@@ -72,4 +72,3 @@ class AuditRule extends cmdbAbstractObject
|
|||||||
return $aShortcutActions;
|
return $aShortcutActions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2013-2024 Combodo SAS
|
* Copyright (C) 2013-2024 Combodo SAS
|
||||||
*
|
*
|
||||||
@@ -32,7 +33,8 @@ class CompileCSSService
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CompileCSSFromSASS($sSassContent, $aImportPaths = [], $aVariables = []){
|
public function CompileCSSFromSASS($sSassContent, $aImportPaths = [], $aVariables = [])
|
||||||
|
{
|
||||||
return utils::CompileCSSFromSASS($sSassContent, $aImportPaths, $aVariables);
|
return utils::CompileCSSFromSASS($sSassContent, $aImportPaths, $aVariables);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
@@ -53,7 +54,7 @@ abstract class Dashboard
|
|||||||
$this->sLayoutClass = 'DashboardLayoutOneCol';
|
$this->sLayoutClass = 'DashboardLayoutOneCol';
|
||||||
$this->bAutoReload = false;
|
$this->bAutoReload = false;
|
||||||
$this->iAutoReloadSec = MetaModel::GetConfig()->GetStandardReloadInterval();
|
$this->iAutoReloadSec = MetaModel::GetConfig()->GetStandardReloadInterval();
|
||||||
$this->aCells = array();
|
$this->aCells = [];
|
||||||
$this->oDOMNode = null;
|
$this->oDOMNode = null;
|
||||||
$this->sId = $sId;
|
$this->sId = $sId;
|
||||||
}
|
}
|
||||||
@@ -65,8 +66,8 @@ abstract class Dashboard
|
|||||||
*/
|
*/
|
||||||
public function FromXml($sXml)
|
public function FromXml($sXml)
|
||||||
{
|
{
|
||||||
$this->aCells = array(); // reset the content of the dashboard
|
$this->aCells = []; // reset the content of the dashboard
|
||||||
set_error_handler(array('Dashboard', 'ErrorHandler'));
|
set_error_handler(['Dashboard', 'ErrorHandler']);
|
||||||
$oDoc = new DOMDocument();
|
$oDoc = new DOMDocument();
|
||||||
$oDoc->loadXML($sXml);
|
$oDoc->loadXML($sXml);
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
@@ -80,86 +81,68 @@ abstract class Dashboard
|
|||||||
{
|
{
|
||||||
$this->oDOMNode = $oDoc->getElementsByTagName('dashboard')->item(0);
|
$this->oDOMNode = $oDoc->getElementsByTagName('dashboard')->item(0);
|
||||||
|
|
||||||
if ($oLayoutNode = $this->oDOMNode->getElementsByTagName('layout')->item(0))
|
if ($oLayoutNode = $this->oDOMNode->getElementsByTagName('layout')->item(0)) {
|
||||||
{
|
|
||||||
$this->sLayoutClass = $oLayoutNode->textContent;
|
$this->sLayoutClass = $oLayoutNode->textContent;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->sLayoutClass = 'DashboardLayoutOneCol';
|
$this->sLayoutClass = 'DashboardLayoutOneCol';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oTitleNode = $this->oDOMNode->getElementsByTagName('title')->item(0))
|
if ($oTitleNode = $this->oDOMNode->getElementsByTagName('title')->item(0)) {
|
||||||
{
|
|
||||||
$this->sTitle = $oTitleNode->textContent;
|
$this->sTitle = $oTitleNode->textContent;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->sTitle = '';
|
$this->sTitle = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->bAutoReload = false;
|
$this->bAutoReload = false;
|
||||||
$this->iAutoReloadSec = MetaModel::GetConfig()->GetStandardReloadInterval();
|
$this->iAutoReloadSec = MetaModel::GetConfig()->GetStandardReloadInterval();
|
||||||
if ($oAutoReloadNode = $this->oDOMNode->getElementsByTagName('auto_reload')->item(0))
|
if ($oAutoReloadNode = $this->oDOMNode->getElementsByTagName('auto_reload')->item(0)) {
|
||||||
{
|
if ($oAutoReloadEnabled = $oAutoReloadNode->getElementsByTagName('enabled')->item(0)) {
|
||||||
if ($oAutoReloadEnabled = $oAutoReloadNode->getElementsByTagName('enabled')->item(0))
|
|
||||||
{
|
|
||||||
$this->bAutoReload = ($oAutoReloadEnabled->textContent == 'true');
|
$this->bAutoReload = ($oAutoReloadEnabled->textContent == 'true');
|
||||||
}
|
}
|
||||||
if ($oAutoReloadInterval = $oAutoReloadNode->getElementsByTagName('interval')->item(0))
|
if ($oAutoReloadInterval = $oAutoReloadNode->getElementsByTagName('interval')->item(0)) {
|
||||||
{
|
|
||||||
$this->iAutoReloadSec = max(MetaModel::GetConfig()->Get('min_reload_interval'), (int)$oAutoReloadInterval->textContent);
|
$this->iAutoReloadSec = max(MetaModel::GetConfig()->Get('min_reload_interval'), (int)$oAutoReloadInterval->textContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oCellsNode = $this->oDOMNode->getElementsByTagName('cells')->item(0))
|
if ($oCellsNode = $this->oDOMNode->getElementsByTagName('cells')->item(0)) {
|
||||||
{
|
|
||||||
$oCellsList = $oCellsNode->getElementsByTagName('cell');
|
$oCellsList = $oCellsNode->getElementsByTagName('cell');
|
||||||
$aCellOrder = array();
|
$aCellOrder = [];
|
||||||
$iCellRank = 0;
|
$iCellRank = 0;
|
||||||
/** @var \DOMElement $oCellNode */
|
/** @var \DOMElement $oCellNode */
|
||||||
foreach($oCellsList as $oCellNode)
|
foreach ($oCellsList as $oCellNode) {
|
||||||
{
|
|
||||||
$oCellRank = $oCellNode->getElementsByTagName('rank')->item(0);
|
$oCellRank = $oCellNode->getElementsByTagName('rank')->item(0);
|
||||||
if ($oCellRank)
|
if ($oCellRank) {
|
||||||
{
|
|
||||||
$iCellRank = (float)$oCellRank->textContent;
|
$iCellRank = (float)$oCellRank->textContent;
|
||||||
}
|
}
|
||||||
$oDashletsNode = $oCellNode->getElementsByTagName('dashlets')->item(0);
|
$oDashletsNode = $oCellNode->getElementsByTagName('dashlets')->item(0);
|
||||||
{
|
{
|
||||||
$oDashletList = $oDashletsNode->getElementsByTagName('dashlet');
|
$oDashletList = $oDashletsNode->getElementsByTagName('dashlet');
|
||||||
$iRank = 0;
|
$iRank = 0;
|
||||||
$aDashletOrder = array();
|
$aDashletOrder = [];
|
||||||
/** @var \DOMElement $oDomNode */
|
/** @var \DOMElement $oDomNode */
|
||||||
foreach($oDashletList as $oDomNode)
|
foreach ($oDashletList as $oDomNode) {
|
||||||
{
|
|
||||||
$oRank = $oDomNode->getElementsByTagName('rank')->item(0);
|
$oRank = $oDomNode->getElementsByTagName('rank')->item(0);
|
||||||
if ($oRank)
|
if ($oRank) {
|
||||||
{
|
|
||||||
$iRank = (float)$oRank->textContent;
|
$iRank = (float)$oRank->textContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oNewDashlet = $this->InitDashletFromDOMNode($oDomNode);
|
$oNewDashlet = $this->InitDashletFromDOMNode($oDomNode);
|
||||||
$aDashletOrder[] = array('rank' => $iRank, 'dashlet' => $oNewDashlet);
|
$aDashletOrder[] = ['rank' => $iRank, 'dashlet' => $oNewDashlet];
|
||||||
}
|
}
|
||||||
usort($aDashletOrder, array(get_class($this), 'SortOnRank'));
|
usort($aDashletOrder, [get_class($this), 'SortOnRank']);
|
||||||
$aDashletList = array();
|
$aDashletList = [];
|
||||||
foreach($aDashletOrder as $aItem)
|
foreach ($aDashletOrder as $aItem) {
|
||||||
{
|
|
||||||
$aDashletList[] = $aItem['dashlet'];
|
$aDashletList[] = $aItem['dashlet'];
|
||||||
}
|
}
|
||||||
$aCellOrder[] = array('rank' => $iCellRank, 'dashlets' => $aDashletList);
|
$aCellOrder[] = ['rank' => $iCellRank, 'dashlets' => $aDashletList];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
usort($aCellOrder, array(get_class($this), 'SortOnRank'));
|
usort($aCellOrder, [get_class($this), 'SortOnRank']);
|
||||||
foreach($aCellOrder as $aItem)
|
foreach ($aCellOrder as $aItem) {
|
||||||
{
|
|
||||||
$this->aCells[] = $aItem['dashlets'];
|
$this->aCells[] = $aItem['dashlets'];
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
$this->aCells = [];
|
||||||
{
|
|
||||||
$this->aCells = array();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,12 +191,9 @@ abstract class Dashboard
|
|||||||
*/
|
*/
|
||||||
public static function ErrorHandler($errno, $errstr, $errfile, $errline)
|
public static function ErrorHandler($errno, $errstr, $errfile, $errline)
|
||||||
{
|
{
|
||||||
if ($errno == E_WARNING && (substr_count($errstr,"DOMDocument::loadXML()")>0))
|
if ($errno == E_WARNING && (substr_count($errstr, "DOMDocument::loadXML()") > 0)) {
|
||||||
{
|
|
||||||
throw new DOMException($errstr);
|
throw new DOMException($errstr);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,8 +243,7 @@ abstract class Dashboard
|
|||||||
$oDefinition->appendChild($oCellsNode);
|
$oDefinition->appendChild($oCellsNode);
|
||||||
|
|
||||||
$iCellRank = 0;
|
$iCellRank = 0;
|
||||||
foreach ($this->aCells as $aCell)
|
foreach ($this->aCells as $aCell) {
|
||||||
{
|
|
||||||
$oCellNode = $oDoc->createElement('cell');
|
$oCellNode = $oDoc->createElement('cell');
|
||||||
$oCellNode->setAttribute('id', $iCellRank);
|
$oCellNode->setAttribute('id', $iCellRank);
|
||||||
$oCellsNode->appendChild($oCellNode);
|
$oCellsNode->appendChild($oCellNode);
|
||||||
@@ -276,8 +255,7 @@ abstract class Dashboard
|
|||||||
$oDashletsNode = $oDoc->createElement('dashlets');
|
$oDashletsNode = $oDoc->createElement('dashlets');
|
||||||
$oCellNode->appendChild($oDashletsNode);
|
$oCellNode->appendChild($oDashletsNode);
|
||||||
/** @var \Dashlet $oDashlet */
|
/** @var \Dashlet $oDashlet */
|
||||||
foreach ($aCell as $oDashlet)
|
foreach ($aCell as $oDashlet) {
|
||||||
{
|
|
||||||
$oNode = $oDoc->createElement('dashlet');
|
$oNode = $oDoc->createElement('dashlet');
|
||||||
$oDashletsNode->appendChild($oNode);
|
$oDashletsNode->appendChild($oNode);
|
||||||
$oNode->setAttribute('id', $oDashlet->GetID());
|
$oNode->setAttribute('id', $oDashlet->GetID());
|
||||||
@@ -304,7 +282,7 @@ abstract class Dashboard
|
|||||||
$this->iAutoReloadSec = max(MetaModel::GetConfig()->Get('min_reload_interval'), (int) $aParams['auto_reload_sec']);
|
$this->iAutoReloadSec = max(MetaModel::GetConfig()->Get('min_reload_interval'), (int) $aParams['auto_reload_sec']);
|
||||||
|
|
||||||
foreach ($aParams['cells'] as $aCell) {
|
foreach ($aParams['cells'] as $aCell) {
|
||||||
$aCellDashlets = array();
|
$aCellDashlets = [];
|
||||||
foreach ($aCell as $aDashletParams) {
|
foreach ($aCell as $aDashletParams) {
|
||||||
$sDashletClass = $aDashletParams['dashlet_class'];
|
$sDashletClass = $aDashletParams['dashlet_class'];
|
||||||
$sId = $aDashletParams['dashlet_id'];
|
$sId = $aDashletParams['dashlet_id'];
|
||||||
@@ -420,7 +398,7 @@ abstract class Dashboard
|
|||||||
{
|
{
|
||||||
$sId = $this->GetNewDashletId();
|
$sId = $this->GetNewDashletId();
|
||||||
$oDashlet->SetId($sId);
|
$oDashlet->SetId($sId);
|
||||||
$this->aCells[] = array($oDashlet);
|
$this->aCells[] = [$oDashlet];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -430,7 +408,7 @@ abstract class Dashboard
|
|||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function RenderProperties($oPage, $aExtraParams = array())
|
public function RenderProperties($oPage, $aExtraParams = [])
|
||||||
{
|
{
|
||||||
// menu to pick a layout and edit other properties of the dashboard
|
// menu to pick a layout and edit other properties of the dashboard
|
||||||
$oPage->add('<div class="ui-widget-content ui-corner-all ibo-dashboard-editor--properties"><div class="ui-widget-header ui-corner-all ibo-dashboard-editor--properties-title">'.Dict::S('UI:DashboardEdit:Properties').'</div>');
|
$oPage->add('<div class="ui-widget-content ui-corner-all ibo-dashboard-editor--properties"><div class="ui-widget-header ui-corner-all ibo-dashboard-editor--properties-title">'.Dict::S('UI:DashboardEdit:Properties').'</div>');
|
||||||
@@ -442,7 +420,7 @@ abstract class Dashboard
|
|||||||
if (is_subclass_of($sLayoutClass, 'DashboardLayout')) {
|
if (is_subclass_of($sLayoutClass, 'DashboardLayout')) {
|
||||||
$oReflection = new ReflectionClass($sLayoutClass);
|
$oReflection = new ReflectionClass($sLayoutClass);
|
||||||
if (!$oReflection->isAbstract()) {
|
if (!$oReflection->isAbstract()) {
|
||||||
$aCallSpec = array($sLayoutClass, 'GetInfo');
|
$aCallSpec = [$sLayoutClass, 'GetInfo'];
|
||||||
$aInfo = call_user_func($aCallSpec);
|
$aInfo = call_user_func($aCallSpec);
|
||||||
$sChecked = ($this->sLayoutClass == $sLayoutClass) ? 'checked' : '';
|
$sChecked = ($this->sLayoutClass == $sLayoutClass) ? 'checked' : '';
|
||||||
$oPage->add('<input type="radio" name="layout_class" '.$sChecked.' value="'.$sLayoutClass.'" id="layout_'.$sLayoutClass.'"><label for="layout_'.$sLayoutClass.'"><img src="'.$sUrl.$aInfo['icon'].'" class="ibo-dashboard--properties--icon" data-role="ibo-dashboard--properties--icon"/></label>'); // title="" on either the img or the label does nothing !
|
$oPage->add('<input type="radio" name="layout_class" '.$sChecked.' value="'.$sLayoutClass.'" id="layout_'.$sLayoutClass.'"><label for="layout_'.$sLayoutClass.'"><img src="'.$sUrl.$aInfo['icon'].'" class="ibo-dashboard--properties--icon" data-role="ibo-dashboard--properties--icon"/></label>'); // title="" on either the img or the label does nothing !
|
||||||
@@ -466,7 +444,6 @@ abstract class Dashboard
|
|||||||
$oField->SetBoundaries(MetaModel::GetConfig()->Get('min_reload_interval'), null); // no upper limit
|
$oField->SetBoundaries(MetaModel::GetConfig()->Get('min_reload_interval'), null); // no upper limit
|
||||||
$oForm->AddField($oField);
|
$oForm->AddField($oField);
|
||||||
|
|
||||||
|
|
||||||
$this->SetFormParams($oForm, $aExtraParams);
|
$this->SetFormParams($oForm, $aExtraParams);
|
||||||
$oForm->RenderAsPropertySheet($oPage, false, '.itop-dashboard');
|
$oForm->RenderAsPropertySheet($oPage, false, '.itop-dashboard');
|
||||||
|
|
||||||
@@ -522,7 +499,7 @@ EOF
|
|||||||
*
|
*
|
||||||
* @return \Combodo\iTop\Application\UI\Base\Layout\Dashboard\DashboardLayout
|
* @return \Combodo\iTop\Application\UI\Base\Layout\Dashboard\DashboardLayout
|
||||||
*/
|
*/
|
||||||
public function Render($oPage, $bEditMode = false, $aExtraParams = array(), $bCanEdit = true)
|
public function Render($oPage, $bEditMode = false, $aExtraParams = [], $bCanEdit = true)
|
||||||
{
|
{
|
||||||
$aExtraParams['dashboard_div_id'] = utils::Sanitize($aExtraParams['dashboard_div_id'] ?? null, $this->GetId(), utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER);
|
$aExtraParams['dashboard_div_id'] = utils::Sanitize($aExtraParams['dashboard_div_id'] ?? null, $this->GetId(), utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER);
|
||||||
|
|
||||||
@@ -551,7 +528,8 @@ EOF
|
|||||||
|
|
||||||
$oToolbar->AddHtml($sHtml);
|
$oToolbar->AddHtml($sHtml);
|
||||||
} else {
|
} else {
|
||||||
$oPage->add_script(<<<JS
|
$oPage->add_script(
|
||||||
|
<<<JS
|
||||||
$(".ibo-top-bar--toolbar-dashboard-title").html("$sTitleForHTML").attr("title", $('<div>').html("$sTitleForHTML").text());
|
$(".ibo-top-bar--toolbar-dashboard-title").html("$sTitleForHTML").attr("title", $('<div>').html("$sTitleForHTML").text());
|
||||||
JS
|
JS
|
||||||
);
|
);
|
||||||
@@ -595,7 +573,7 @@ JS
|
|||||||
* @param WebPage $oPage
|
* @param WebPage $oPage
|
||||||
* @param array $aExtraParams
|
* @param array $aExtraParams
|
||||||
*/
|
*/
|
||||||
public function RenderDashletsProperties(WebPage $oPage, $aExtraParams = array())
|
public function RenderDashletsProperties(WebPage $oPage, $aExtraParams = [])
|
||||||
{
|
{
|
||||||
// Toolbox/palette to edit the properties of each dashlet
|
// Toolbox/palette to edit the properties of each dashlet
|
||||||
$oPage->add('<div class="ui-widget-content ui-corner-all ibo-dashlet--properties"><div class="ui-widget-header ui-corner-all ibo-dashlet--properties--title">'.Dict::S('UI:DashboardEdit:DashletProperties').'</div>');
|
$oPage->add('<div class="ui-widget-content ui-corner-all ibo-dashlet--properties"><div class="ui-widget-header ui-corner-all ibo-dashlet--properties--title">'.Dict::S('UI:DashboardEdit:DashletProperties').'</div>');
|
||||||
@@ -604,13 +582,10 @@ JS
|
|||||||
$oLayout = new $this->sLayoutClass();
|
$oLayout = new $this->sLayoutClass();
|
||||||
|
|
||||||
$oPage->add('<div id="dashlet_properties">');
|
$oPage->add('<div id="dashlet_properties">');
|
||||||
foreach($this->aCells as $iCellIdx => $aCell)
|
foreach ($this->aCells as $iCellIdx => $aCell) {
|
||||||
{
|
|
||||||
/** @var \Dashlet $oDashlet */
|
/** @var \Dashlet $oDashlet */
|
||||||
foreach($aCell as $oDashlet)
|
foreach ($aCell as $oDashlet) {
|
||||||
{
|
if ($oDashlet->IsVisible()) {
|
||||||
if ($oDashlet->IsVisible())
|
|
||||||
{
|
|
||||||
$oPage->add('<div class="dashlet_properties" id="dashlet_properties_'.$oDashlet->GetID().'" style="display:none">');
|
$oPage->add('<div class="dashlet_properties" id="dashlet_properties_'.$oDashlet->GetID().'" style="display:none">');
|
||||||
$oForm = $oDashlet->GetForm();
|
$oForm = $oDashlet->GetForm();
|
||||||
$this->SetFormParams($oForm, $aExtraParams);
|
$this->SetFormParams($oForm, $aExtraParams);
|
||||||
@@ -632,18 +607,17 @@ JS
|
|||||||
*/
|
*/
|
||||||
protected function GetAvailableDashlets()
|
protected function GetAvailableDashlets()
|
||||||
{
|
{
|
||||||
$aDashlets = array();
|
$aDashlets = [];
|
||||||
|
|
||||||
foreach( get_declared_classes() as $sDashletClass)
|
foreach (get_declared_classes() as $sDashletClass) {
|
||||||
{
|
|
||||||
// DashletUnknown is not among the selection as it is just a fallback for dashlets that can't instantiated.
|
// DashletUnknown is not among the selection as it is just a fallback for dashlets that can't instantiated.
|
||||||
if (is_subclass_of($sDashletClass, 'Dashlet') && !in_array($sDashletClass, array('DashletUnknown', 'DashletProxy'))) {
|
if (is_subclass_of($sDashletClass, 'Dashlet') && !in_array($sDashletClass, ['DashletUnknown', 'DashletProxy'])) {
|
||||||
$oReflection = new ReflectionClass($sDashletClass);
|
$oReflection = new ReflectionClass($sDashletClass);
|
||||||
if (!$oReflection->isAbstract()) {
|
if (!$oReflection->isAbstract()) {
|
||||||
$aCallSpec = array($sDashletClass, 'IsVisible');
|
$aCallSpec = [$sDashletClass, 'IsVisible'];
|
||||||
$bVisible = call_user_func($aCallSpec);
|
$bVisible = call_user_func($aCallSpec);
|
||||||
if ($bVisible) {
|
if ($bVisible) {
|
||||||
$aCallSpec = array($sDashletClass, 'GetInfo');
|
$aCallSpec = [$sDashletClass, 'GetInfo'];
|
||||||
$aInfo = call_user_func($aCallSpec);
|
$aInfo = call_user_func($aCallSpec);
|
||||||
$aDashlets[$sDashletClass] = $aInfo;
|
$aDashlets[$sDashletClass] = $aInfo;
|
||||||
}
|
}
|
||||||
@@ -660,11 +634,9 @@ JS
|
|||||||
protected function GetNewDashletId()
|
protected function GetNewDashletId()
|
||||||
{
|
{
|
||||||
$iNewId = 0;
|
$iNewId = 0;
|
||||||
foreach($this->aCells as $aDashlets)
|
foreach ($this->aCells as $aDashlets) {
|
||||||
{
|
|
||||||
/** @var \Dashlet $oDashlet */
|
/** @var \Dashlet $oDashlet */
|
||||||
foreach($aDashlets as $oDashlet)
|
foreach ($aDashlets as $oDashlet) {
|
||||||
{
|
|
||||||
$iNewId = max($iNewId, (int)$oDashlet->GetID());
|
$iNewId = max($iNewId, (int)$oDashlet->GetID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -681,7 +653,7 @@ JS
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
abstract protected function PrepareDashletForRendering(Dashlet $oDashlet, $aCoordinates, $aExtraParams = array());
|
abstract protected function PrepareDashletForRendering(Dashlet $oDashlet, $aCoordinates, $aExtraParams = []);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \DesignerForm $oForm
|
* @param \DesignerForm $oForm
|
||||||
@@ -689,7 +661,7 @@ JS
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
abstract protected function SetFormParams($oForm, $aExtraParams = array());
|
abstract protected function SetFormParams($oForm, $aExtraParams = []);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sType
|
* @param string $sType
|
||||||
@@ -699,8 +671,7 @@ JS
|
|||||||
*/
|
*/
|
||||||
public static function GetDashletClassFromType($sType, $oFactory = null)
|
public static function GetDashletClassFromType($sType, $oFactory = null)
|
||||||
{
|
{
|
||||||
if (is_subclass_of($sType, 'Dashlet'))
|
if (is_subclass_of($sType, 'Dashlet')) {
|
||||||
{
|
|
||||||
return $sType;
|
return $sType;
|
||||||
}
|
}
|
||||||
return 'DashletUnknown';
|
return 'DashletUnknown';
|
||||||
@@ -723,14 +694,12 @@ JS
|
|||||||
*/
|
*/
|
||||||
public static function GetDashletUniqueId($bIsCustomized, $sDashboardDivId, $iRow, $iCol, $sDashletOrigId)
|
public static function GetDashletUniqueId($bIsCustomized, $sDashboardDivId, $iRow, $iCol, $sDashletOrigId)
|
||||||
{
|
{
|
||||||
if(strpos($sDashletOrigId, '_ID_row') !== false)
|
if (strpos($sDashletOrigId, '_ID_row') !== false) {
|
||||||
{
|
|
||||||
return $sDashletOrigId;
|
return $sDashletOrigId;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sDashletId = $sDashboardDivId."_ID_row".$iRow."_col".$iCol."_".$sDashletOrigId;
|
$sDashletId = $sDashboardDivId."_ID_row".$iRow."_col".$iCol."_".$sDashletOrigId;
|
||||||
if ($bIsCustomized)
|
if ($bIsCustomized) {
|
||||||
{
|
|
||||||
$sDashletId = 'CUSTOM_'.$sDashletId;
|
$sDashletId = 'CUSTOM_'.$sDashletId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -782,9 +751,9 @@ class RuntimeDashboard extends Dashboard
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
protected function SetFormParams($oForm, $aExtraParams = array())
|
protected function SetFormParams($oForm, $aExtraParams = [])
|
||||||
{
|
{
|
||||||
$oForm->SetSubmitParams(utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php', array('operation' => 'update_dashlet_property', 'extra_params' => $aExtraParams));
|
$oForm->SetSubmitParams(utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php', ['operation' => 'update_dashlet_property', 'extra_params' => $aExtraParams]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -800,14 +769,11 @@ class RuntimeDashboard extends Dashboard
|
|||||||
$oUDSearch->AddCondition('menu_code', $this->sId, '=');
|
$oUDSearch->AddCondition('menu_code', $this->sId, '=');
|
||||||
$oUDSet = new DBObjectSet($oUDSearch);
|
$oUDSet = new DBObjectSet($oUDSearch);
|
||||||
$bIsNew = false;
|
$bIsNew = false;
|
||||||
if ($oUDSet->Count() > 0)
|
if ($oUDSet->Count() > 0) {
|
||||||
{
|
|
||||||
// Assuming there is at most one couple {user, menu}!
|
// Assuming there is at most one couple {user, menu}!
|
||||||
$oUserDashboard = $oUDSet->Fetch();
|
$oUserDashboard = $oUDSet->Fetch();
|
||||||
$oUserDashboard->Set('contents', $sXml);
|
$oUserDashboard->Set('contents', $sXml);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// No such customized dashboard for the current user, let's create a new record
|
// No such customized dashboard for the current user, let's create a new record
|
||||||
$oUserDashboard = new UserDashboard();
|
$oUserDashboard = new UserDashboard();
|
||||||
$oUserDashboard->Set('user_id', UserRights::GetUserId());
|
$oUserDashboard->Set('user_id', UserRights::GetUserId());
|
||||||
@@ -838,8 +804,7 @@ class RuntimeDashboard extends Dashboard
|
|||||||
$oUDSearch->AddCondition('user_id', UserRights::GetUserId(), '=');
|
$oUDSearch->AddCondition('user_id', UserRights::GetUserId(), '=');
|
||||||
$oUDSearch->AddCondition('menu_code', $this->sId, '=');
|
$oUDSearch->AddCondition('menu_code', $this->sId, '=');
|
||||||
$oUDSet = new DBObjectSet($oUDSearch);
|
$oUDSet = new DBObjectSet($oUDSearch);
|
||||||
if ($oUDSet->Count() > 0)
|
if ($oUDSet->Count() > 0) {
|
||||||
{
|
|
||||||
// Assuming there is at most one couple {user, menu}!
|
// Assuming there is at most one couple {user, menu}!
|
||||||
$oUserDashboard = $oUDSet->Fetch();
|
$oUserDashboard = $oUDSet->Fetch();
|
||||||
utils::PushArchiveMode(false);
|
utils::PushArchiveMode(false);
|
||||||
@@ -883,14 +848,11 @@ class RuntimeDashboard extends Dashboard
|
|||||||
} else {
|
} else {
|
||||||
$sDashboardDefinition = @file_get_contents($sDashboardFileSanitized);
|
$sDashboardDefinition = @file_get_contents($sDashboardFileSanitized);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$sDashboardDefinition = @file_get_contents($sDashboardFileSanitized);
|
$sDashboardDefinition = @file_get_contents($sDashboardFileSanitized);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sDashboardDefinition !== false)
|
if ($sDashboardDefinition !== false) {
|
||||||
{
|
|
||||||
$oDashboard = new RuntimeDashboard($sDashBoardId);
|
$oDashboard = new RuntimeDashboard($sDashBoardId);
|
||||||
$oDashboard->FromXml($sDashboardDefinition);
|
$oDashboard->FromXml($sDashboardDefinition);
|
||||||
$oDashboard->SetCustomFlag($bCustomized);
|
$oDashboard->SetCustomFlag($bCustomized);
|
||||||
@@ -937,7 +899,6 @@ class RuntimeDashboard extends Dashboard
|
|||||||
$sDashboardDefinition = @file_get_contents($sDashboardFileSanitized);
|
$sDashboardDefinition = @file_get_contents($sDashboardFileSanitized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($sDashboardDefinition !== false) {
|
if ($sDashboardDefinition !== false) {
|
||||||
$oDashboard = new RuntimeDashboard($sDashBoardId);
|
$oDashboard = new RuntimeDashboard($sDashBoardId);
|
||||||
$oDashboard->FromXml($sDashboardDefinition);
|
$oDashboard->FromXml($sDashboardDefinition);
|
||||||
@@ -954,11 +915,11 @@ class RuntimeDashboard extends Dashboard
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function Render($oPage, $bEditMode = false, $aExtraParams = array(), $bCanEdit = true)
|
public function Render($oPage, $bEditMode = false, $aExtraParams = [], $bCanEdit = true)
|
||||||
{
|
{
|
||||||
if (!isset($aExtraParams['query_params']) && isset($aExtraParams['this->class'])) {
|
if (!isset($aExtraParams['query_params']) && isset($aExtraParams['this->class'])) {
|
||||||
$oObj = MetaModel::GetObject($aExtraParams['this->class'], $aExtraParams['this->id']);
|
$oObj = MetaModel::GetObject($aExtraParams['this->class'], $aExtraParams['this->id']);
|
||||||
$aRenderParams = array('query_params' => $oObj->ToArgsForQuery());
|
$aRenderParams = ['query_params' => $oObj->ToArgsForQuery()];
|
||||||
} else {
|
} else {
|
||||||
$aRenderParams = $aExtraParams;
|
$aRenderParams = $aExtraParams;
|
||||||
}
|
}
|
||||||
@@ -968,7 +929,7 @@ class RuntimeDashboard extends Dashboard
|
|||||||
if (isset($aExtraParams['query_params']['this->object()'])) {
|
if (isset($aExtraParams['query_params']['this->object()'])) {
|
||||||
/** @var \DBObject $oObj */
|
/** @var \DBObject $oObj */
|
||||||
$oObj = $aExtraParams['query_params']['this->object()'];
|
$oObj = $aExtraParams['query_params']['this->object()'];
|
||||||
$aAjaxParams = array('this->class' => get_class($oObj), 'this->id' => $oObj->GetKey());
|
$aAjaxParams = ['this->class' => get_class($oObj), 'this->id' => $oObj->GetKey()];
|
||||||
if (isset($aExtraParams['from_dashboard_page'])) {
|
if (isset($aExtraParams['from_dashboard_page'])) {
|
||||||
$aAjaxParams['from_dashboard_page'] = $aExtraParams['from_dashboard_page'];
|
$aAjaxParams['from_dashboard_page'] = $aExtraParams['from_dashboard_page'];
|
||||||
}
|
}
|
||||||
@@ -1001,9 +962,7 @@ class RuntimeDashboard extends Dashboard
|
|||||||
}
|
}
|
||||||
JS
|
JS
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$oPage->add_script(
|
$oPage->add_script(
|
||||||
<<<EOF
|
<<<EOF
|
||||||
if (typeof(AutoReloadDashboardId$sDivId) !== 'undefined')
|
if (typeof(AutoReloadDashboardId$sDivId) !== 'undefined')
|
||||||
@@ -1032,7 +991,7 @@ EOF
|
|||||||
* @throws \CoreUnexpectedValue
|
* @throws \CoreUnexpectedValue
|
||||||
* @throws \MySQLException
|
* @throws \MySQLException
|
||||||
*/
|
*/
|
||||||
protected function RenderSelector(WebPage $oPage, DashboardLayoutUIBlock $oDashboard, $aAjaxParams = array())
|
protected function RenderSelector(WebPage $oPage, DashboardLayoutUIBlock $oDashboard, $aAjaxParams = [])
|
||||||
{
|
{
|
||||||
if (!$this->HasCustomDashboard()) {
|
if (!$this->HasCustomDashboard()) {
|
||||||
return;
|
return;
|
||||||
@@ -1070,7 +1029,7 @@ EOF
|
|||||||
var dashboard = $('.ibo-dashboard#$sDivId')
|
var dashboard = $('.ibo-dashboard#$sDivId')
|
||||||
dashboard.block();
|
dashboard.block();
|
||||||
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php',
|
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php',
|
||||||
{ operation: 'toggle_dashboard', dashboard_id: '$sId', file: '$sFile', extra_params: $sExtraParams, reload_url: '$sReloadURL' },
|
{ operation: 'toggle_dashboard', dashboard_id: '$sId', file: '$sFile', extra_params: $sExtraParams, reload_url: $sReloadURL },
|
||||||
function(data) {
|
function(data) {
|
||||||
dashboard.html(data);
|
dashboard.html(data);
|
||||||
dashboard.unblock();
|
dashboard.unblock();
|
||||||
@@ -1092,8 +1051,7 @@ JS
|
|||||||
*/
|
*/
|
||||||
protected function HasCustomDashboard()
|
protected function HasCustomDashboard()
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// Search for an eventual user defined dashboard
|
// Search for an eventual user defined dashboard
|
||||||
$oUDSearch = new DBObjectSearch('UserDashboard');
|
$oUDSearch = new DBObjectSearch('UserDashboard');
|
||||||
$oUDSearch->AddCondition('user_id', UserRights::GetUserId(), '=');
|
$oUDSearch->AddCondition('user_id', UserRights::GetUserId(), '=');
|
||||||
@@ -1101,9 +1059,7 @@ JS
|
|||||||
$oUDSet = new DBObjectSet($oUDSearch);
|
$oUDSet = new DBObjectSet($oUDSearch);
|
||||||
|
|
||||||
return ($oUDSet->Count() > 0);
|
return ($oUDSet->Count() > 0);
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1139,21 +1095,23 @@ JS
|
|||||||
->AddCSSClass('ibo-action-button');
|
->AddCSSClass('ibo-action-button');
|
||||||
|
|
||||||
$oToolbar->AddSubBlock($oActionButton);
|
$oToolbar->AddSubBlock($oActionButton);
|
||||||
$aActions = array();
|
$aActions = [];
|
||||||
$sFile = addslashes(utils::LocalPath($this->sDefinitionFile));
|
$sFile = addslashes(utils::LocalPath($this->sDefinitionFile));
|
||||||
$sJSExtraParams = json_encode($aExtraParams);
|
$sJSExtraParams = json_encode($aExtraParams);
|
||||||
if ($this->HasCustomDashboard()) {
|
if ($this->HasCustomDashboard()) {
|
||||||
$oEdit = new JSPopupMenuItem('UI:Dashboard:Edit', Dict::S('UI:Dashboard:EditCustom'), "return EditDashboard('{$this->sId}', '$sFile', $sJSExtraParams)");
|
$oEdit = new JSPopupMenuItem('UI:Dashboard:Edit', Dict::S('UI:Dashboard:EditCustom'), "return EditDashboard('{$this->sId}', '$sFile', $sJSExtraParams)");
|
||||||
$aActions[$oEdit->GetUID()] = $oEdit->GetMenuItem();
|
$aActions[$oEdit->GetUID()] = $oEdit->GetMenuItem();
|
||||||
$oRevert = new JSPopupMenuItem('UI:Dashboard:RevertConfirm', Dict::S('UI:Dashboard:DeleteCustom'),
|
$oRevert = new JSPopupMenuItem(
|
||||||
"if (confirm('".addslashes(Dict::S('UI:Dashboard:RevertConfirm'))."')) return RevertDashboard('{$this->sId}', $sJSExtraParams); else return false");
|
'UI:Dashboard:RevertConfirm',
|
||||||
|
Dict::S('UI:Dashboard:DeleteCustom'),
|
||||||
|
"if (confirm('".addslashes(Dict::S('UI:Dashboard:RevertConfirm'))."')) return RevertDashboard('{$this->sId}', $sJSExtraParams); else return false"
|
||||||
|
);
|
||||||
$aActions[$oRevert->GetUID()] = $oRevert->GetMenuItem();
|
$aActions[$oRevert->GetUID()] = $oRevert->GetMenuItem();
|
||||||
} else {
|
} else {
|
||||||
$oEdit = new JSPopupMenuItem('UI:Dashboard:Edit', Dict::S('UI:Dashboard:CreateCustom'), "return EditDashboard('{$this->sId}', '$sFile', $sJSExtraParams)");
|
$oEdit = new JSPopupMenuItem('UI:Dashboard:Edit', Dict::S('UI:Dashboard:CreateCustom'), "return EditDashboard('{$this->sId}', '$sFile', $sJSExtraParams)");
|
||||||
$aActions[$oEdit->GetUID()] = $oEdit->GetMenuItem();
|
$aActions[$oEdit->GetUID()] = $oEdit->GetMenuItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
utils::GetPopupMenuItems($oPage, iPopupMenuExtension::MENU_DASHBOARD_ACTIONS, $this, $aActions);
|
utils::GetPopupMenuItems($oPage, iPopupMenuExtension::MENU_DASHBOARD_ACTIONS, $this, $aActions);
|
||||||
|
|
||||||
$oActionsMenu = $oPage->GetPopoverMenu($sPopoverMenuId, $aActions)
|
$oActionsMenu = $oPage->GetPopoverMenu($sPopoverMenuId, $aActions)
|
||||||
@@ -1193,7 +1151,7 @@ EOF
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function RenderProperties($oPage, $aExtraParams = array())
|
public function RenderProperties($oPage, $aExtraParams = [])
|
||||||
{
|
{
|
||||||
parent::RenderProperties($oPage, $aExtraParams);
|
parent::RenderProperties($oPage, $aExtraParams);
|
||||||
|
|
||||||
@@ -1225,7 +1183,6 @@ EOF
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param WebPage $oPage
|
* @param WebPage $oPage
|
||||||
*
|
*
|
||||||
@@ -1236,11 +1193,11 @@ EOF
|
|||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function RenderEditor($oPage, $aExtraParams = array())
|
public function RenderEditor($oPage, $aExtraParams = [])
|
||||||
{
|
{
|
||||||
if (isset($aExtraParams['this->class'])) {
|
if (isset($aExtraParams['this->class'])) {
|
||||||
$oObj = MetaModel::GetObject($aExtraParams['this->class'], $aExtraParams['this->id']);
|
$oObj = MetaModel::GetObject($aExtraParams['this->class'], $aExtraParams['this->id']);
|
||||||
$aRenderParams = array('query_params' => $oObj->ToArgsForQuery());
|
$aRenderParams = ['query_params' => $oObj->ToArgsForQuery()];
|
||||||
} else {
|
} else {
|
||||||
$aRenderParams = $aExtraParams;
|
$aRenderParams = $aExtraParams;
|
||||||
}
|
}
|
||||||
@@ -1389,51 +1346,41 @@ JS
|
|||||||
// Get the list of all 'dashboard' menus in which we can insert a dashlet
|
// Get the list of all 'dashboard' menus in which we can insert a dashlet
|
||||||
$aAllMenus = ApplicationMenu::ReflectionMenuNodes();
|
$aAllMenus = ApplicationMenu::ReflectionMenuNodes();
|
||||||
$sRootMenuId = ApplicationMenu::GetRootMenuId($sContextMenuId);
|
$sRootMenuId = ApplicationMenu::GetRootMenuId($sContextMenuId);
|
||||||
$aAllowedDashboards = array();
|
$aAllowedDashboards = [];
|
||||||
$sDefaultDashboard = null;
|
$sDefaultDashboard = null;
|
||||||
|
|
||||||
// Store the parent menus for acces check
|
// Store the parent menus for acces check
|
||||||
$aParentMenus = array();
|
$aParentMenus = [];
|
||||||
foreach($aAllMenus as $idx => $aMenu)
|
foreach ($aAllMenus as $idx => $aMenu) {
|
||||||
{
|
|
||||||
/** @var MenuNode $oMenu */
|
/** @var MenuNode $oMenu */
|
||||||
$oMenu = $aMenu['node'];
|
$oMenu = $aMenu['node'];
|
||||||
if (count(ApplicationMenu::GetChildren($oMenu->GetIndex())) > 0)
|
if (count(ApplicationMenu::GetChildren($oMenu->GetIndex())) > 0) {
|
||||||
{
|
|
||||||
$aParentMenus[$oMenu->GetMenuId()] = $aMenu;
|
$aParentMenus[$oMenu->GetMenuId()] = $aMenu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($aAllMenus as $idx => $aMenu)
|
foreach ($aAllMenus as $idx => $aMenu) {
|
||||||
{
|
|
||||||
$oMenu = $aMenu['node'];
|
$oMenu = $aMenu['node'];
|
||||||
if ($oMenu instanceof DashboardMenuNode)
|
if ($oMenu instanceof DashboardMenuNode) {
|
||||||
{
|
|
||||||
// Get the root parent for access check
|
// Get the root parent for access check
|
||||||
$sParentId = $aMenu['parent'];
|
$sParentId = $aMenu['parent'];
|
||||||
$aParentMenu = $aParentMenus[$sParentId];
|
$aParentMenu = $aParentMenus[$sParentId];
|
||||||
while (isset($aParentMenus[$aParentMenu['parent']]))
|
while (isset($aParentMenus[$aParentMenu['parent']])) {
|
||||||
{
|
|
||||||
// grand parent exists
|
// grand parent exists
|
||||||
$sParentId = $aParentMenu['parent'];
|
$sParentId = $aParentMenu['parent'];
|
||||||
$aParentMenu = $aParentMenus[$sParentId];
|
$aParentMenu = $aParentMenus[$sParentId];
|
||||||
}
|
}
|
||||||
/** @var \MenuNode $oParentMenu */
|
/** @var \MenuNode $oParentMenu */
|
||||||
$oParentMenu = $aParentMenu['node'];
|
$oParentMenu = $aParentMenu['node'];
|
||||||
if ($oMenu->IsEnabled() && $oParentMenu->IsEnabled())
|
if ($oMenu->IsEnabled() && $oParentMenu->IsEnabled()) {
|
||||||
{
|
|
||||||
$sMenuLabel = $oMenu->GetTitle();
|
$sMenuLabel = $oMenu->GetTitle();
|
||||||
$sParentLabel = Dict::S('Menu:'.$sParentId);
|
$sParentLabel = Dict::S('Menu:'.$sParentId);
|
||||||
if ($sParentLabel != $sMenuLabel)
|
if ($sParentLabel != $sMenuLabel) {
|
||||||
{
|
|
||||||
$aAllowedDashboards[$oMenu->GetMenuId()] = $sParentLabel.' - '.$sMenuLabel;
|
$aAllowedDashboards[$oMenu->GetMenuId()] = $sParentLabel.' - '.$sMenuLabel;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$aAllowedDashboards[$oMenu->GetMenuId()] = $sMenuLabel;
|
$aAllowedDashboards[$oMenu->GetMenuId()] = $sMenuLabel;
|
||||||
}
|
}
|
||||||
if (empty($sDefaultDashboard) && ($sRootMenuId == ApplicationMenu::GetRootMenuId($oMenu->GetMenuId())))
|
if (empty($sDefaultDashboard) && ($sRootMenuId == ApplicationMenu::GetRootMenuId($oMenu->GetMenuId()))) {
|
||||||
{
|
|
||||||
$sDefaultDashboard = $oMenu->GetMenuId();
|
$sDefaultDashboard = $oMenu->GetMenuId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1448,21 +1395,17 @@ JS
|
|||||||
|
|
||||||
// Get the list of possible dashlets that support a creation from
|
// Get the list of possible dashlets that support a creation from
|
||||||
// an OQL
|
// an OQL
|
||||||
$aDashlets = array();
|
$aDashlets = [];
|
||||||
foreach(get_declared_classes() as $sDashletClass)
|
foreach (get_declared_classes() as $sDashletClass) {
|
||||||
{
|
if (is_subclass_of($sDashletClass, 'Dashlet')) {
|
||||||
if (is_subclass_of($sDashletClass, 'Dashlet'))
|
|
||||||
{
|
|
||||||
$oReflection = new ReflectionClass($sDashletClass);
|
$oReflection = new ReflectionClass($sDashletClass);
|
||||||
if (!$oReflection->isAbstract())
|
if (!$oReflection->isAbstract()) {
|
||||||
{
|
$aCallSpec = [$sDashletClass, 'CanCreateFromOQL'];
|
||||||
$aCallSpec = array($sDashletClass, 'CanCreateFromOQL');
|
|
||||||
$bShorcutMode = call_user_func($aCallSpec);
|
$bShorcutMode = call_user_func($aCallSpec);
|
||||||
if ($bShorcutMode)
|
if ($bShorcutMode) {
|
||||||
{
|
$aCallSpec = [$sDashletClass, 'GetInfo'];
|
||||||
$aCallSpec = array($sDashletClass, 'GetInfo');
|
|
||||||
$aInfo = call_user_func($aCallSpec);
|
$aInfo = call_user_func($aCallSpec);
|
||||||
$aDashlets[$sDashletClass] = array('label' => $aInfo['label'], 'class' => $sDashletClass, 'icon' => $aInfo['icon']);
|
$aDashlets[$sDashletClass] = ['label' => $aInfo['label'], 'class' => $sDashletClass, 'icon' => $aInfo['icon']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1470,8 +1413,7 @@ JS
|
|||||||
|
|
||||||
$oSelectorField = new DesignerFormSelectorField('dashlet_class', Dict::S('UI:DashletCreation:DashletType'), '');
|
$oSelectorField = new DesignerFormSelectorField('dashlet_class', Dict::S('UI:DashletCreation:DashletType'), '');
|
||||||
$oForm->AddField($oSelectorField);
|
$oForm->AddField($oSelectorField);
|
||||||
foreach($aDashlets as $sDashletClass => $aDashletInfo)
|
foreach ($aDashlets as $sDashletClass => $aDashletInfo) {
|
||||||
{
|
|
||||||
$oSubForm = new DesignerForm();
|
$oSubForm = new DesignerForm();
|
||||||
$oMetaModel = new ModelReflectionRuntime();
|
$oMetaModel = new ModelReflectionRuntime();
|
||||||
/** @var \Dashlet $oDashlet */
|
/** @var \Dashlet $oDashlet */
|
||||||
@@ -1603,7 +1545,7 @@ JS
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function PrepareDashletForRendering(Dashlet $oDashlet, $aCoordinates, $aExtraParams = array())
|
protected function PrepareDashletForRendering(Dashlet $oDashlet, $aCoordinates, $aExtraParams = [])
|
||||||
{
|
{
|
||||||
$sDashletIdOrig = $oDashlet->GetID();
|
$sDashletIdOrig = $oDashlet->GetID();
|
||||||
$sDashboardSanitizedId = $this->GetSanitizedId();
|
$sDashboardSanitizedId = $this->GetSanitizedId();
|
||||||
@@ -1630,31 +1572,27 @@ JS
|
|||||||
private function UpdateDashletUserPrefs(Dashlet $oDashlet, $sDashletIdOrig, array $aExtraParams)
|
private function UpdateDashletUserPrefs(Dashlet $oDashlet, $sDashletIdOrig, array $aExtraParams)
|
||||||
{
|
{
|
||||||
$bIsDashletWithListPref = ($oDashlet instanceof DashletObjectList);
|
$bIsDashletWithListPref = ($oDashlet instanceof DashletObjectList);
|
||||||
if (!$bIsDashletWithListPref)
|
if (!$bIsDashletWithListPref) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/** @var \DashletObjectList $oDashlet */
|
/** @var \DashletObjectList $oDashlet */
|
||||||
|
|
||||||
$bDashletIdInNewFormat = ($sDashletIdOrig === $oDashlet->GetID());
|
$bDashletIdInNewFormat = ($sDashletIdOrig === $oDashlet->GetID());
|
||||||
if ($bDashletIdInNewFormat)
|
if ($bDashletIdInNewFormat) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sNewPrefKey = $this->GetDashletObjectListAppUserPreferencesPrefix($oDashlet, $aExtraParams, $oDashlet->GetID());
|
$sNewPrefKey = $this->GetDashletObjectListAppUserPreferencesPrefix($oDashlet, $aExtraParams, $oDashlet->GetID());
|
||||||
$sPrefValueForNewKey = appUserPreferences::GetPref($sNewPrefKey, null);
|
$sPrefValueForNewKey = appUserPreferences::GetPref($sNewPrefKey, null);
|
||||||
$bHasPrefInNewFormat = ($sPrefValueForNewKey !== null);
|
$bHasPrefInNewFormat = ($sPrefValueForNewKey !== null);
|
||||||
if ($bHasPrefInNewFormat)
|
if ($bHasPrefInNewFormat) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sOldPrefKey = $this->GetDashletObjectListAppUserPreferencesPrefix($oDashlet, $aExtraParams, $sDashletIdOrig);
|
$sOldPrefKey = $this->GetDashletObjectListAppUserPreferencesPrefix($oDashlet, $aExtraParams, $sDashletIdOrig);
|
||||||
$sPrefValueForOldKey = appUserPreferences::GetPref($sOldPrefKey, null);
|
$sPrefValueForOldKey = appUserPreferences::GetPref($sOldPrefKey, null);
|
||||||
$bHasPrefInOldFormat = ($sPrefValueForOldKey !== null);
|
$bHasPrefInOldFormat = ($sPrefValueForOldKey !== null);
|
||||||
if (!$bHasPrefInOldFormat)
|
if (!$bHasPrefInOldFormat) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1673,7 +1611,7 @@ JS
|
|||||||
private function GetDashletObjectListAppUserPreferencesPrefix(DashletObjectList $oDashlet, $aExtraParams, $sDashletId)
|
private function GetDashletObjectListAppUserPreferencesPrefix(DashletObjectList $oDashlet, $aExtraParams, $sDashletId)
|
||||||
{
|
{
|
||||||
$sDataTableId = Dashlet::APPUSERPREFERENCES_PREFIX.$sDashletId;
|
$sDataTableId = Dashlet::APPUSERPREFERENCES_PREFIX.$sDashletId;
|
||||||
$aClassAliases = array();
|
$aClassAliases = [];
|
||||||
try {
|
try {
|
||||||
$oFilter = $oDashlet->GetDBSearch($aExtraParams);
|
$oFilter = $oDashlet->GetDBSearch($aExtraParams);
|
||||||
$aClassAliases = $oFilter->GetSelectedClasses();
|
$aClassAliases = $oFilter->GetSelectedClasses();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2024 Combodo SAS
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
@@ -41,11 +42,11 @@ abstract class DashboardLayout
|
|||||||
|
|
||||||
public static function GetInfo()
|
public static function GetInfo()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'icon' => '',
|
'icon' => '',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,16 +64,12 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
|
|||||||
$aKeys = array_reverse(array_keys($aDashlets));
|
$aKeys = array_reverse(array_keys($aDashlets));
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
$bNoVisibleFound = true;
|
$bNoVisibleFound = true;
|
||||||
while($idx < count($aKeys) && $bNoVisibleFound)
|
while ($idx < count($aKeys) && $bNoVisibleFound) {
|
||||||
{
|
|
||||||
/** @var \Dashlet $oDashlet */
|
/** @var \Dashlet $oDashlet */
|
||||||
$oDashlet = $aDashlets[$aKeys[$idx]];
|
$oDashlet = $aDashlets[$aKeys[$idx]];
|
||||||
if ($oDashlet::IsVisible())
|
if ($oDashlet::IsVisible()) {
|
||||||
{
|
|
||||||
$bNoVisibleFound = false;
|
$bNoVisibleFound = false;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
unset($aDashlets[$aKeys[$idx]]);
|
unset($aDashlets[$aKeys[$idx]]);
|
||||||
}
|
}
|
||||||
$idx++;
|
$idx++;
|
||||||
@@ -82,22 +79,17 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
|
|||||||
|
|
||||||
protected function TrimCellsArray($aCells)
|
protected function TrimCellsArray($aCells)
|
||||||
{
|
{
|
||||||
foreach($aCells as $key => $aDashlets)
|
foreach ($aCells as $key => $aDashlets) {
|
||||||
{
|
|
||||||
$aCells[$key] = $this->TrimCell($aDashlets);
|
$aCells[$key] = $this->TrimCell($aDashlets);
|
||||||
}
|
}
|
||||||
$aKeys = array_reverse(array_keys($aCells));
|
$aKeys = array_reverse(array_keys($aCells));
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
$bNoVisibleFound = true;
|
$bNoVisibleFound = true;
|
||||||
while($idx < count($aKeys) && $bNoVisibleFound)
|
while ($idx < count($aKeys) && $bNoVisibleFound) {
|
||||||
{
|
|
||||||
$aDashlets = $aCells[$aKeys[$idx]];
|
$aDashlets = $aCells[$aKeys[$idx]];
|
||||||
if (count($aDashlets) > 0)
|
if (count($aDashlets) > 0) {
|
||||||
{
|
|
||||||
$bNoVisibleFound = false;
|
$bNoVisibleFound = false;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
unset($aCells[$aKeys[$idx]]);
|
unset($aCells[$aKeys[$idx]]);
|
||||||
}
|
}
|
||||||
$idx++;
|
$idx++;
|
||||||
@@ -112,7 +104,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
|
|||||||
* @param bool $bEditMode
|
* @param bool $bEditMode
|
||||||
* @param array $aExtraParams
|
* @param array $aExtraParams
|
||||||
*/
|
*/
|
||||||
public function Render($oPage, $aCells, $bEditMode = false, $aExtraParams = array())
|
public function Render($oPage, $aCells, $bEditMode = false, $aExtraParams = [])
|
||||||
{
|
{
|
||||||
// Trim the list of cells to remove the invisible/empty ones at the end of the array
|
// Trim the list of cells to remove the invisible/empty ones at the end of the array
|
||||||
$aCells = $this->TrimCellsArray($aCells);
|
$aCells = $this->TrimCellsArray($aCells);
|
||||||
@@ -157,8 +149,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
|
|||||||
|
|
||||||
$oPage->add_script("function updateDashboard".$aExtraParams['dashboard_div_id']."(){".$sJSReload."}");
|
$oPage->add_script("function updateDashboard".$aExtraParams['dashboard_div_id']."(){".$sJSReload."}");
|
||||||
|
|
||||||
if ($bEditMode) // Add one row for extensibility
|
if ($bEditMode) { // Add one row for extensibility
|
||||||
{
|
|
||||||
$oDashboardRow = new DashboardRow();
|
$oDashboardRow = new DashboardRow();
|
||||||
$oDashboardLayout->AddDashboardRow($oDashboardRow);
|
$oDashboardLayout->AddDashboardRow($oDashboardRow);
|
||||||
|
|
||||||
@@ -180,7 +171,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
|
|||||||
$iColNumber = (int) $iCellIdx % $this->iNbCols;
|
$iColNumber = (int) $iCellIdx % $this->iNbCols;
|
||||||
$iRowNumber = (int) floor($iCellIdx / $this->iNbCols);
|
$iRowNumber = (int) floor($iCellIdx / $this->iNbCols);
|
||||||
|
|
||||||
return array($iColNumber, $iRowNumber);
|
return [$iColNumber, $iRowNumber];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,13 +182,13 @@ class DashboardLayoutOneCol extends DashboardLayoutMultiCol
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->iNbCols = 1;
|
$this->iNbCols = 1;
|
||||||
}
|
}
|
||||||
static public function GetInfo()
|
public static function GetInfo()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'label' => 'One Column',
|
'label' => 'One Column',
|
||||||
'icon' => 'images/layout_1col.png',
|
'icon' => 'images/layout_1col.png',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,13 +199,13 @@ class DashboardLayoutTwoCols extends DashboardLayoutMultiCol
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->iNbCols = 2;
|
$this->iNbCols = 2;
|
||||||
}
|
}
|
||||||
static public function GetInfo()
|
public static function GetInfo()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'label' => 'Two Columns',
|
'label' => 'Two Columns',
|
||||||
'icon' => 'images/layout_2col.png',
|
'icon' => 'images/layout_2col.png',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,12 +216,12 @@ class DashboardLayoutThreeCols extends DashboardLayoutMultiCol
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->iNbCols = 3;
|
$this->iNbCols = 3;
|
||||||
}
|
}
|
||||||
static public function GetInfo()
|
public static function GetInfo()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'label' => 'Two Columns',
|
'label' => 'Two Columns',
|
||||||
'icon' => 'images/layout_3col.png',
|
'icon' => 'images/layout_3col.png',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.3">
|
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="https://www.combodo.com/itop-schema/3.3"
|
||||||
|
version="3.3">
|
||||||
<classes>
|
<classes>
|
||||||
<class id="AbstractResource" _delta="define">
|
<class id="AbstractResource" _delta="define">
|
||||||
<parent>cmdbAbstractObject</parent>
|
<parent>cmdbAbstractObject</parent>
|
||||||
<properties>
|
<properties>
|
||||||
<comment>/* Resource access control abstraction. Can be herited by abstract resource access control classes. Generaly controlled using UR_ACTION_MODIFY access right. */</comment>
|
<comment>/* Resource access control abstraction. Can be herited by abstract resource access control classes. Generally controlled using UR_ACTION_MODIFY access right. */</comment>
|
||||||
<abstract>true</abstract>
|
<abstract>true</abstract>
|
||||||
</properties>
|
</properties>
|
||||||
<presentation/>
|
<presentation/>
|
||||||
@@ -849,5 +851,168 @@ Call $this->AddInitialAttributeFlags($sAttCode, $iFlags) for all the initial att
|
|||||||
</methods>
|
</methods>
|
||||||
</class>
|
</class>
|
||||||
</classes>
|
</classes>
|
||||||
|
<property_types _delta="define">
|
||||||
|
<property_type id="Dashlet" xsi:type="Combodo-AbstractPropertyType"/>
|
||||||
|
<property_type id="DashletGroupBy" xsi:type="Combodo-PropertyType">
|
||||||
|
<extends>Dashlet</extends>
|
||||||
|
<definition xsi:type="Combodo-ValueType-PropertyTree">
|
||||||
|
<label>UI:DashletGroupBy:Title</label>
|
||||||
|
<nodes>
|
||||||
|
<node id="title" xsi:type="Combodo-ValueType-Label">
|
||||||
|
<label>UI:DashletGroupBy:Prop-Title</label>
|
||||||
|
</node>
|
||||||
|
<node id="query" xsi:type="Combodo-ValueType-OQL">
|
||||||
|
<label>UI:DashletGroupBy:Prop-Query</label>
|
||||||
|
</node>
|
||||||
|
<node id="group_by" xsi:type="Combodo-ValueType-ClassAttributeGroupBy">
|
||||||
|
<label>UI:DashletGroupBy:Prop-GroupBy</label>
|
||||||
|
<class>{{query.selected_class}}</class>
|
||||||
|
</node>
|
||||||
|
<node id="style" xsi:type="Combodo-ValueType-Choice"> <!-- Possible de le cacher, etc celui-ci nous met dedans -->
|
||||||
|
<label>UI:DashletGroupBy:Prop-Style</label>
|
||||||
|
<values>
|
||||||
|
<value id="bars">
|
||||||
|
<label>UI:DashletGroupByBars:Label</label>
|
||||||
|
</value>
|
||||||
|
<value id="pie">
|
||||||
|
<label>UI:DashletGroupByPie:Label</label>
|
||||||
|
</value>
|
||||||
|
<value id="table">
|
||||||
|
<label>UI:DashletGroupByTable:Label</label>
|
||||||
|
</value>
|
||||||
|
</values>
|
||||||
|
</node>
|
||||||
|
<node id="aggregation_function" xsi:type="Combodo-ValueType-AggregateFunction">
|
||||||
|
<label>UI:DashletGroupBy:Prop-Function</label>
|
||||||
|
<class>{{query.selected_class}}</class> <!-- pour savoir si il y a des attributs additionnables -->
|
||||||
|
</node>
|
||||||
|
<node id="aggregation_attribute" xsi:type="Combodo-ValueType-ClassAttribute">
|
||||||
|
<label>UI:DashletGroupBy:Prop-FunctionAttribute</label>
|
||||||
|
<relevance-condition>{{aggregation_function.value != 'count'}}</relevance-condition>
|
||||||
|
<class>{{query.selected_class}}</class>
|
||||||
|
<category>numeric</category>
|
||||||
|
</node>
|
||||||
|
<node id="order_by" xsi:type="Combodo-ValueType-ChoiceFromInput">
|
||||||
|
<label>UI:DashletGroupBy:Prop-OrderField</label>
|
||||||
|
<values>
|
||||||
|
<value id="attribute">
|
||||||
|
<label>{{aggregation_attribute.label}}</label>
|
||||||
|
</value>
|
||||||
|
<value id="function">
|
||||||
|
<label>{{aggregation_function.label}}</label>
|
||||||
|
</value>
|
||||||
|
</values>
|
||||||
|
</node>
|
||||||
|
<node id="limit" xsi:type="Combodo-ValueType-Integer">
|
||||||
|
<label>UI:DashletGroupBy:Prop-Limit</label>
|
||||||
|
<relevance-condition>{{order_by.value = 'function'}}</relevance-condition>
|
||||||
|
</node>
|
||||||
|
<node id="order_direction" xsi:type="Combodo-ValueType-Choice">
|
||||||
|
<label>UI:DashletGroupBy:Prop-OrderDirection</label>
|
||||||
|
<values>
|
||||||
|
<value id="asc">
|
||||||
|
<label>UI:DashletGroupBy:Order:asc</label>
|
||||||
|
</value>
|
||||||
|
<value id="desc">
|
||||||
|
<label>UI:DashletGroupBy:Order:desc</label>
|
||||||
|
</value>
|
||||||
|
</values>
|
||||||
|
</node>
|
||||||
|
</nodes>
|
||||||
|
</definition>
|
||||||
|
</property_type>
|
||||||
|
<property_type id="DashletBadge" xsi:type="Combodo-PropertyType">
|
||||||
|
<extends>Dashlet</extends>
|
||||||
|
<definition xsi:type="Combodo-ValueType-PropertyTree">
|
||||||
|
<nodes>
|
||||||
|
<node id="class" xsi:type="Combodo-ValueType-Class">
|
||||||
|
<label>UI:DashletBadge:Prop-Class</label>
|
||||||
|
<categories-csv>bizmodel</categories-csv>
|
||||||
|
</node>
|
||||||
|
</nodes>
|
||||||
|
</definition>
|
||||||
|
</property_type>
|
||||||
|
<property_type id="DashletHeaderDynamic" xsi:type="Combodo-PropertyType">
|
||||||
|
<extends>Dashlet</extends>
|
||||||
|
<definition xsi:type="Combodo-ValueType-PropertyTree">
|
||||||
|
<label>UI:DashletHeaderDynamic:Title</label>
|
||||||
|
<nodes>
|
||||||
|
<node id="title" xsi:type="Combodo-ValueType-Label">
|
||||||
|
<label>UI:DashletHeaderDynamic:Prop-Title</label>
|
||||||
|
</node>
|
||||||
|
<node id="icon" xsi:type="Combodo-ValueType-Icon">
|
||||||
|
<label>UI:DashletHeaderDynamic:Prop-Icon</label>
|
||||||
|
</node>
|
||||||
|
<node id="subtitle" xsi:type="Combodo-ValueType-Label">
|
||||||
|
<label>UI:DashletHeaderDynamic:Prop-Subtitle</label>
|
||||||
|
</node>
|
||||||
|
<node id="query" xsi:type="Combodo-ValueType-OQL">
|
||||||
|
<label>UI:DashletHeaderDynamic:Prop-Query</label>
|
||||||
|
</node>
|
||||||
|
<node id="group_by" xsi:type="Combodo-ValueType-ClassAttribute">
|
||||||
|
<label>UI:DashletHeaderDynamic:Prop-GroupBy</label>
|
||||||
|
<class>{{query.selected_class}}</class>
|
||||||
|
<category>enum</category>
|
||||||
|
</node>
|
||||||
|
<node id="values" xsi:type="Combodo-ValueType-CollectionOfValues">
|
||||||
|
<label>UI:DashletHeaderDynamic:Prop-Values</label>
|
||||||
|
<xml-format xsi:type="Combodo-XMLFormat-CSV"/>
|
||||||
|
<value-type xsi:type="Combodo-ValueType-ClassAttributeValue">
|
||||||
|
<class>{{query.selected_class}}</class>
|
||||||
|
<attribute>{{group_by.attribute}}</attribute>
|
||||||
|
</value-type>
|
||||||
|
</node>
|
||||||
|
</nodes>
|
||||||
|
</definition>
|
||||||
|
</property_type>
|
||||||
|
<property_type id="DashletHeaderStatic" xsi:type="Combodo-PropertyType">
|
||||||
|
<extends>Dashlet</extends>
|
||||||
|
<definition xsi:type="Combodo-ValueType-PropertyTree">
|
||||||
|
<nodes>
|
||||||
|
<node id="title" xsi:type="Combodo-ValueType-Label">
|
||||||
|
<label>UI:DashletHeaderStatic:Prop-Title</label>
|
||||||
|
</node>
|
||||||
|
<node id="icon" xsi:type="Combodo-ValueType-Icon">
|
||||||
|
<label>UI:DashletHeaderStatic:Prop-Icon</label>
|
||||||
|
</node>
|
||||||
|
</nodes>
|
||||||
|
</definition>
|
||||||
|
</property_type>
|
||||||
|
<property_type id="DashletObjectList" xsi:type="Combodo-PropertyType">
|
||||||
|
<extends>Dashlet</extends>
|
||||||
|
<definition xsi:type="Combodo-ValueType-PropertyTree">
|
||||||
|
<nodes>
|
||||||
|
<node id="title" xsi:type="Combodo-ValueType-Label">
|
||||||
|
<label>UI:DashletObjectList:Prop-Title</label>
|
||||||
|
</node>
|
||||||
|
<node id="query" xsi:type="Combodo-ValueType-OQL">
|
||||||
|
<label>UI:DashletObjectList:Prop-Query</label>
|
||||||
|
</node>
|
||||||
|
<node id="menu" xsi:type="Combodo-ValueType-Boolean">
|
||||||
|
<label>UI:DashletObjectList:Prop-Menu</label>
|
||||||
|
<on>
|
||||||
|
<!-- not so cute, but matches exactly 3.2 implementation of boolean fields -->
|
||||||
|
<label>UI:UserManagement:ActionAllowed:Yes</label>
|
||||||
|
<value>true</value>
|
||||||
|
</on>
|
||||||
|
<off>
|
||||||
|
<label>UI:UserManagement:ActionAllowed:No</label>
|
||||||
|
<value>false</value>
|
||||||
|
</off>
|
||||||
|
</node>
|
||||||
|
</nodes>
|
||||||
|
</definition>
|
||||||
|
</property_type>
|
||||||
|
<property_type id="DashletPlainText" xsi:type="Combodo-PropertyType">
|
||||||
|
<extends>Dashlet</extends>
|
||||||
|
<definition xsi:type="Combodo-ValueType-PropertyTree">
|
||||||
|
<nodes>
|
||||||
|
<node id="text" xsi:type="Combodo-ValueType-Text">
|
||||||
|
<label>UI:DashletPlainText:Prop-Text</label>
|
||||||
|
</node>
|
||||||
|
</nodes>
|
||||||
|
</definition>
|
||||||
|
</property_type>
|
||||||
|
</property_types>
|
||||||
</meta>
|
</meta>
|
||||||
</itop_design>
|
</itop_design>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
@@ -104,7 +105,7 @@ class DisplayBlock
|
|||||||
*/
|
*/
|
||||||
public const ENUM_STYLE_CHART_AJAX = 'chart_ajax';
|
public const ENUM_STYLE_CHART_AJAX = 'chart_ajax';
|
||||||
|
|
||||||
const TAG_BLOCK = 'itopblock';
|
public const TAG_BLOCK = 'itopblock';
|
||||||
/** @var \DBSearch */
|
/** @var \DBSearch */
|
||||||
protected $m_oFilter;
|
protected $m_oFilter;
|
||||||
protected $m_aConditions; // Conditions added to the filter -> avoid duplicate conditions
|
protected $m_aConditions; // Conditions added to the filter -> avoid duplicate conditions
|
||||||
@@ -137,20 +138,18 @@ class DisplayBlock
|
|||||||
*
|
*
|
||||||
* @throws \ApplicationException
|
* @throws \ApplicationException
|
||||||
*/
|
*/
|
||||||
public function __construct(DBSearch $oFilter, $sStyle = self::ENUM_STYLE_LIST, $bAsynchronous = false, $aParams = array(), $oSet = null)
|
public function __construct(DBSearch $oFilter, $sStyle = self::ENUM_STYLE_LIST, $bAsynchronous = false, $aParams = [], $oSet = null)
|
||||||
{
|
{
|
||||||
$this->m_oFilter = $oFilter->DeepClone();
|
$this->m_oFilter = $oFilter->DeepClone();
|
||||||
$this->m_aConditions = array();
|
$this->m_aConditions = [];
|
||||||
$this->m_sStyle = $sStyle;
|
$this->m_sStyle = $sStyle;
|
||||||
$this->m_bAsynchronous = $bAsynchronous;
|
$this->m_bAsynchronous = $bAsynchronous;
|
||||||
$this->m_aParams = $aParams;
|
$this->m_aParams = $aParams;
|
||||||
$this->m_oSet = $oSet;
|
$this->m_oSet = $oSet;
|
||||||
if (array_key_exists('show_obsolete_data', $aParams))
|
if (array_key_exists('show_obsolete_data', $aParams)) {
|
||||||
{
|
|
||||||
$this->m_bShowObsoleteData = $aParams['show_obsolete_data'];
|
$this->m_bShowObsoleteData = $aParams['show_obsolete_data'];
|
||||||
}
|
}
|
||||||
if ($this->m_bShowObsoleteData === null)
|
if ($this->m_bShowObsoleteData === null) {
|
||||||
{
|
|
||||||
// User defined
|
// User defined
|
||||||
$this->m_bShowObsoleteData = utils::ShowObsoleteData();
|
$this->m_bShowObsoleteData = utils::ShowObsoleteData();
|
||||||
}
|
}
|
||||||
@@ -412,22 +411,18 @@ class DisplayBlock
|
|||||||
* @throws \CoreException
|
* @throws \CoreException
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function FromObjectSet(DBObjectSet $oSet, $sStyle, $aParams = array())
|
public static function FromObjectSet(DBObjectSet $oSet, $sStyle, $aParams = [])
|
||||||
{
|
{
|
||||||
$oDummyFilter = new DBObjectSearch($oSet->GetClass());
|
$oDummyFilter = new DBObjectSearch($oSet->GetClass());
|
||||||
$aKeys = array();
|
$aKeys = [];
|
||||||
$oSet->OptimizeColumnLoad(array($oSet->GetClassAlias() => array())); // No need to load all the columns just to get the id
|
$oSet->OptimizeColumnLoad([$oSet->GetClassAlias() => []]); // No need to load all the columns just to get the id
|
||||||
while($oObject = $oSet->Fetch())
|
while ($oObject = $oSet->Fetch()) {
|
||||||
{
|
|
||||||
$aKeys[] = $oObject->GetKey();
|
$aKeys[] = $oObject->GetKey();
|
||||||
}
|
}
|
||||||
$oSet->Rewind();
|
$oSet->Rewind();
|
||||||
if (count($aKeys) > 0)
|
if (count($aKeys) > 0) {
|
||||||
{
|
|
||||||
$oDummyFilter->AddCondition('id', $aKeys, 'IN');
|
$oDummyFilter->AddCondition('id', $aKeys, 'IN');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$oDummyFilter->AddCondition('id', 0, '=');
|
$oDummyFilter->AddCondition('id', 0, '=');
|
||||||
}
|
}
|
||||||
$oBlock = new DisplayBlock($oDummyFilter, $sStyle, false, $aParams); // DisplayBlocks built this way are synchronous
|
$oBlock = new DisplayBlock($oDummyFilter, $sStyle, false, $aParams); // DisplayBlocks built this way are synchronous
|
||||||
@@ -448,7 +443,7 @@ class DisplayBlock
|
|||||||
$iStartPos = stripos($sTemplate, '<'.self::TAG_BLOCK.' ', 0);
|
$iStartPos = stripos($sTemplate, '<'.self::TAG_BLOCK.' ', 0);
|
||||||
$iEndPos = stripos($sTemplate, '</'.self::TAG_BLOCK.'>', $iStartPos);
|
$iEndPos = stripos($sTemplate, '</'.self::TAG_BLOCK.'>', $iStartPos);
|
||||||
$iEndTag = stripos($sTemplate, '>', $iStartPos);
|
$iEndTag = stripos($sTemplate, '>', $iStartPos);
|
||||||
$aParams = array();
|
$aParams = [];
|
||||||
|
|
||||||
if (($iStartPos === false) || ($iEndPos === false)) {
|
if (($iStartPos === false) || ($iEndPos === false)) {
|
||||||
return null;
|
return null;
|
||||||
@@ -456,7 +451,7 @@ class DisplayBlock
|
|||||||
$sITopData = substr($sTemplate, 1 + $iEndTag, $iEndPos - $iEndTag - 1);
|
$sITopData = substr($sTemplate, 1 + $iEndTag, $iEndPos - $iEndTag - 1);
|
||||||
$sITopTag = substr($sTemplate, $iStartPos + strlen('<'.self::TAG_BLOCK), $iEndTag - $iStartPos - strlen('<'.self::TAG_BLOCK));
|
$sITopTag = substr($sTemplate, $iStartPos + strlen('<'.self::TAG_BLOCK), $iEndTag - $iStartPos - strlen('<'.self::TAG_BLOCK));
|
||||||
|
|
||||||
$aMatches = array();
|
$aMatches = [];
|
||||||
$sBlockClass = "DisplayBlock";
|
$sBlockClass = "DisplayBlock";
|
||||||
$bAsynchronous = false;
|
$bAsynchronous = false;
|
||||||
$sBlockType = 'list';
|
$sBlockType = 'list';
|
||||||
@@ -522,25 +517,28 @@ class DisplayBlock
|
|||||||
return new $sBlockClass($oFilter, $sBlockType, $bAsynchronous, $aParams);
|
return new $sBlockClass($oFilter, $sBlockType, $bAsynchronous, $aParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DisplayIntoContentBlock(UIContentBlock $oContentBlock, WebPage $oPage, $sId, $aExtraParams = array())
|
public function DisplayIntoContentBlock(UIContentBlock $oContentBlock, WebPage $oPage, $sId, $aExtraParams = [])
|
||||||
{
|
{
|
||||||
$oContentBlock->AddSubBlock($this->GetDisplay($oPage, $sId, $aExtraParams));
|
$oContentBlock->AddSubBlock($this->GetDisplay($oPage, $sId, $aExtraParams));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Display(WebPage $oPage, $sId, $aExtraParams = array())
|
public function Display(WebPage $oPage, $sId, $aExtraParams = [])
|
||||||
{
|
{
|
||||||
$oPage->AddUiBlock($this->GetDisplay($oPage, $sId, $aExtraParams));
|
$oPage->AddUiBlock($this->GetDisplay($oPage, $sId, $aExtraParams));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetDisplay(WebPage $oPage, $sId, $aExtraParams = array()): UIContentBlock
|
public function GetDisplay(WebPage $oPage, $sId, $aExtraParams = []): UIContentBlock
|
||||||
{
|
{
|
||||||
$oHtml = new UIContentBlock($sId);
|
$oHtml = new UIContentBlock($sId);
|
||||||
|
|
||||||
$oHtml->AddCSSClass("display_block");
|
$oHtml->AddCSSClass("display_block");
|
||||||
$aExtraParams = array_merge($aExtraParams, $this->m_aParams);
|
$aExtraParams = array_merge($aExtraParams, $this->m_aParams);
|
||||||
$aExtraParams['currentId'] = $sId;
|
$aExtraParams['currentId'] = $sId;
|
||||||
$sExtraParams = addslashes(str_replace('"', "'",
|
$sExtraParams = addslashes(str_replace(
|
||||||
json_encode($aExtraParams))); // JSON encode, change the style of the quotes and escape them
|
'"',
|
||||||
|
"'",
|
||||||
|
json_encode($aExtraParams)
|
||||||
|
)); // JSON encode, change the style of the quotes and escape them
|
||||||
|
|
||||||
if (isset($aExtraParams['query_params'])) {
|
if (isset($aExtraParams['query_params'])) {
|
||||||
$aQueryParams = $aExtraParams['query_params'];
|
$aQueryParams = $aExtraParams['query_params'];
|
||||||
@@ -549,9 +547,9 @@ class DisplayBlock
|
|||||||
$sClass = $aExtraParams['this->class'];
|
$sClass = $aExtraParams['this->class'];
|
||||||
$iKey = $aExtraParams['this->id'];
|
$iKey = $aExtraParams['this->id'];
|
||||||
$oObj = MetaModel::GetObject($sClass, $iKey);
|
$oObj = MetaModel::GetObject($sClass, $iKey);
|
||||||
$aQueryParams = array('this->object()' => $oObj);
|
$aQueryParams = ['this->object()' => $oObj];
|
||||||
} else {
|
} else {
|
||||||
$aQueryParams = array();
|
$aQueryParams = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,8 +585,7 @@ class DisplayBlock
|
|||||||
');
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->m_sStyle == static::ENUM_STYLE_LIST) // Search form need to extract result list extra data, the simplest way is to expose this configuration
|
if ($this->m_sStyle == static::ENUM_STYLE_LIST) { // Search form need to extract result list extra data, the simplest way is to expose this configuration
|
||||||
{
|
|
||||||
$listJsonExtraParams = json_encode(json_encode($aExtraParams));
|
$listJsonExtraParams = json_encode(json_encode($aExtraParams));
|
||||||
$oPage->add_ready_script("
|
$oPage->add_ready_script("
|
||||||
$('#$sId').data('sExtraParams', ".$listJsonExtraParams.");
|
$('#$sId').data('sExtraParams', ".$listJsonExtraParams.");
|
||||||
@@ -608,7 +605,7 @@ class DisplayBlock
|
|||||||
* @throws \DictExceptionMissingString
|
* @throws \DictExceptionMissingString
|
||||||
* @throws \MySQLException
|
* @throws \MySQLException
|
||||||
*/
|
*/
|
||||||
public function RenderContent(WebPage $oPage, $aExtraParams = array())
|
public function RenderContent(WebPage $oPage, $aExtraParams = [])
|
||||||
{
|
{
|
||||||
if (!isset($aExtraParams['currentId'])) {
|
if (!isset($aExtraParams['currentId'])) {
|
||||||
$sId = utils::GetUniqueId(); // Works only if the page is not an Ajax one !
|
$sId = utils::GetUniqueId(); // Works only if the page is not an Ajax one !
|
||||||
@@ -640,7 +637,7 @@ class DisplayBlock
|
|||||||
$this->CheckParams($this->m_sStyle, $aExtraParams);
|
$this->CheckParams($this->m_sStyle, $aExtraParams);
|
||||||
// Add the extra params into the filter if they make sense for such a filter
|
// Add the extra params into the filter if they make sense for such a filter
|
||||||
$bDoSearch = utils::ReadParam('dosearch', false);
|
$bDoSearch = utils::ReadParam('dosearch', false);
|
||||||
$aQueryParams = array();
|
$aQueryParams = [];
|
||||||
if (isset($aExtraParams['query_params'])) {
|
if (isset($aExtraParams['query_params'])) {
|
||||||
$aQueryParams = $aExtraParams['query_params'];
|
$aQueryParams = $aExtraParams['query_params'];
|
||||||
} else {
|
} else {
|
||||||
@@ -648,7 +645,7 @@ class DisplayBlock
|
|||||||
$sClass = $aExtraParams['this->class'];
|
$sClass = $aExtraParams['this->class'];
|
||||||
$iKey = $aExtraParams['this->id'];
|
$iKey = $aExtraParams['this->id'];
|
||||||
$oObj = MetaModel::GetObject($sClass, $iKey);
|
$oObj = MetaModel::GetObject($sClass, $iKey);
|
||||||
$aQueryParams = array('this->object()' => $oObj);
|
$aQueryParams = ['this->object()' => $oObj];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->m_oSet == null) {
|
if ($this->m_oSet == null) {
|
||||||
@@ -658,7 +655,7 @@ class DisplayBlock
|
|||||||
$oAppContext = new ApplicationContext();
|
$oAppContext = new ApplicationContext();
|
||||||
$sClass = $this->m_oFilter->GetClass();
|
$sClass = $this->m_oFilter->GetClass();
|
||||||
$aFilterCodes = MetaModel::GetFiltersList($sClass);
|
$aFilterCodes = MetaModel::GetFiltersList($sClass);
|
||||||
$aCallSpec = array($sClass, 'MapContextParam');
|
$aCallSpec = [$sClass, 'MapContextParam'];
|
||||||
if (is_callable($aCallSpec)) {
|
if (is_callable($aCallSpec)) {
|
||||||
foreach ($oAppContext->GetNames() as $sContextParam) {
|
foreach ($oAppContext->GetNames() as $sContextParam) {
|
||||||
$sParamCode = call_user_func($aCallSpec, $sContextParam); //Map context parameter to the value/filter code depending on the class
|
$sParamCode = call_user_func($aCallSpec, $sContextParam); //Map context parameter to the value/filter code depending on the class
|
||||||
@@ -693,11 +690,9 @@ class DisplayBlock
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($condition))
|
if (!is_null($condition)) {
|
||||||
{
|
|
||||||
$sOpCode = null; // default operator
|
$sOpCode = null; // default operator
|
||||||
if (is_array($condition))
|
if (is_array($condition)) {
|
||||||
{
|
|
||||||
// Multiple values, add them as AND X IN (v1, v2, v3...)
|
// Multiple values, add them as AND X IN (v1, v2, v3...)
|
||||||
$sOpCode = 'IN';
|
$sOpCode = 'IN';
|
||||||
}
|
}
|
||||||
@@ -705,26 +700,22 @@ class DisplayBlock
|
|||||||
$this->AddCondition($sFilterCode, $condition, $sOpCode, $bParseSearchString);
|
$this->AddCondition($sFilterCode, $condition, $sOpCode, $bParseSearchString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($bDoSearch)
|
if ($bDoSearch) {
|
||||||
{
|
|
||||||
// Keep the table_id identifying this table if we're performing a search
|
// Keep the table_id identifying this table if we're performing a search
|
||||||
$sTableId = utils::ReadParam('_table_id_', null, false, utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER);
|
$sTableId = utils::ReadParam('_table_id_', null, false, utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER);
|
||||||
if ($sTableId != null)
|
if ($sTableId != null) {
|
||||||
{
|
|
||||||
$aExtraParams['table_id'] = $sTableId;
|
$aExtraParams['table_id'] = $sTableId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$aOrderBy = array();
|
$aOrderBy = [];
|
||||||
if (isset($aExtraParams['order_by']))
|
if (isset($aExtraParams['order_by'])) {
|
||||||
{
|
|
||||||
// Convert the string describing the order_by parameter into an array
|
// Convert the string describing the order_by parameter into an array
|
||||||
// The syntax is +attCode1,-attCode2
|
// The syntax is +attCode1,-attCode2
|
||||||
// attCode1 => ascending, attCode2 => descending
|
// attCode1 => ascending, attCode2 => descending
|
||||||
$aTemp = explode(',', $aExtraParams['order_by']);
|
$aTemp = explode(',', $aExtraParams['order_by']);
|
||||||
foreach($aTemp as $sTemp)
|
foreach ($aTemp as $sTemp) {
|
||||||
{
|
$aMatches = [];
|
||||||
$aMatches = array();
|
|
||||||
if (preg_match('/^([+-])?(.+)$/', $sTemp, $aMatches)) {
|
if (preg_match('/^([+-])?(.+)$/', $sTemp, $aMatches)) {
|
||||||
$bAscending = true;
|
$bAscending = true;
|
||||||
if ($aMatches[1] == '-') {
|
if ($aMatches[1] == '-') {
|
||||||
@@ -735,6 +726,10 @@ class DisplayBlock
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->m_oFilter->IsAllDataAllowed() && ($aExtraParams['display_unauthorized_objects'] ?? false) === true) {
|
||||||
|
$this->m_oFilter->AllowAllData();
|
||||||
|
}
|
||||||
|
|
||||||
$aExtraParams['query_params'] = $this->m_oFilter->GetInternalParams();
|
$aExtraParams['query_params'] = $this->m_oFilter->GetInternalParams();
|
||||||
$this->m_oSet = new CMDBObjectSet($this->m_oFilter, $aOrderBy, $aQueryParams);
|
$this->m_oSet = new CMDBObjectSet($this->m_oFilter, $aOrderBy, $aQueryParams);
|
||||||
}
|
}
|
||||||
@@ -772,10 +767,6 @@ class DisplayBlock
|
|||||||
$oBlock = $this->RenderList($aExtraParams, $oPage);
|
$oBlock = $this->RenderList($aExtraParams, $oPage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'links':
|
|
||||||
$oBlock = $this->RenderLinks($oPage, $aExtraParams);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case static::ENUM_STYLE_ACTIONS:
|
case static::ENUM_STYLE_ACTIONS:
|
||||||
$oBlock = $this->RenderActions($aExtraParams);
|
$oBlock = $this->RenderActions($aExtraParams);
|
||||||
break;
|
break;
|
||||||
@@ -805,17 +796,13 @@ class DisplayBlock
|
|||||||
$sHtml .= Dict::format('UI:Error:UnsupportedStyleOfBlock', $this->m_sStyle);
|
$sHtml .= Dict::format('UI:Error:UnsupportedStyleOfBlock', $this->m_sStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$bAutoReload = false;
|
$bAutoReload = false;
|
||||||
if (isset($aExtraParams['auto_reload']))
|
if (isset($aExtraParams['auto_reload'])) {
|
||||||
{
|
if ($aExtraParams['auto_reload'] === true) {
|
||||||
if ($aExtraParams['auto_reload'] === true)
|
|
||||||
{
|
|
||||||
// Note: does not work in the switch (case true) because a positive number evaluates to true!!!
|
// Note: does not work in the switch (case true) because a positive number evaluates to true!!!
|
||||||
$aExtraParams['auto_reload'] = 'standard';
|
$aExtraParams['auto_reload'] = 'standard';
|
||||||
}
|
}
|
||||||
switch($aExtraParams['auto_reload'])
|
switch ($aExtraParams['auto_reload']) {
|
||||||
{
|
|
||||||
case 'fast':
|
case 'fast':
|
||||||
$bAutoReload = true;
|
$bAutoReload = true;
|
||||||
$iReloadInterval = MetaModel::GetConfig()->GetFastReloadInterval() * 1000;
|
$iReloadInterval = MetaModel::GetConfig()->GetFastReloadInterval() * 1000;
|
||||||
@@ -828,20 +815,16 @@ class DisplayBlock
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (is_numeric($aExtraParams['auto_reload']) && ($aExtraParams['auto_reload'] > 0))
|
if (is_numeric($aExtraParams['auto_reload']) && ($aExtraParams['auto_reload'] > 0)) {
|
||||||
{
|
|
||||||
$bAutoReload = true;
|
$bAutoReload = true;
|
||||||
$iReloadInterval = max(MetaModel::GetConfig()->Get('min_reload_interval'), $aExtraParams['auto_reload']) * 1000;
|
$iReloadInterval = max(MetaModel::GetConfig()->Get('min_reload_interval'), $aExtraParams['auto_reload']) * 1000;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// incorrect config, ignore it
|
// incorrect config, ignore it
|
||||||
$bAutoReload = false;
|
$bAutoReload = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($bAutoReload) && ($this->m_sStyle != static::ENUM_STYLE_SEARCH)) // Search form do NOT auto-reload
|
if (($bAutoReload) && ($this->m_sStyle != static::ENUM_STYLE_SEARCH)) { // Search form do NOT auto-reload
|
||||||
{
|
|
||||||
// Used either for asynchronous or auto_reload
|
// Used either for asynchronous or auto_reload
|
||||||
// does a json_encode twice to get a string usable as function parameter
|
// does a json_encode twice to get a string usable as function parameter
|
||||||
$sFilterBefore = $this->m_oFilter->serialize();
|
$sFilterBefore = $this->m_oFilter->serialize();
|
||||||
@@ -888,8 +871,7 @@ JS
|
|||||||
{
|
{
|
||||||
// Workaround to an issue revealed whenever a condition on org_id is applied twice (with a hierarchy of organizations)
|
// Workaround to an issue revealed whenever a condition on org_id is applied twice (with a hierarchy of organizations)
|
||||||
// Moreover, it keeps the query as simple as possible
|
// Moreover, it keeps the query as simple as possible
|
||||||
if (isset($this->m_aConditions[$sFilterCode]) && $condition == $this->m_aConditions[$sFilterCode])
|
if (isset($this->m_aConditions[$sFilterCode]) && $condition == $this->m_aConditions[$sFilterCode]) {
|
||||||
{
|
|
||||||
// Skip
|
// Skip
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -899,51 +881,40 @@ JS
|
|||||||
$bConditionAdded = false;
|
$bConditionAdded = false;
|
||||||
|
|
||||||
// If the condition is an external key with a class having a hierarchy, use a "below" criteria
|
// If the condition is an external key with a class having a hierarchy, use a "below" criteria
|
||||||
if (MetaModel::IsValidAttCode($sClass, $sFilterCode))
|
if (MetaModel::IsValidAttCode($sClass, $sFilterCode)) {
|
||||||
{
|
|
||||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sFilterCode);
|
$oAttDef = MetaModel::GetAttributeDef($sClass, $sFilterCode);
|
||||||
|
|
||||||
if ($oAttDef->IsExternalKey())
|
if ($oAttDef->IsExternalKey()) {
|
||||||
{
|
|
||||||
$sHierarchicalKeyCode = MetaModel::IsHierarchicalClass($oAttDef->GetTargetClass());
|
$sHierarchicalKeyCode = MetaModel::IsHierarchicalClass($oAttDef->GetTargetClass());
|
||||||
|
|
||||||
if ($sHierarchicalKeyCode !== false)
|
if ($sHierarchicalKeyCode !== false) {
|
||||||
{
|
|
||||||
$oFilter = new DBObjectSearch($oAttDef->GetTargetClass());
|
$oFilter = new DBObjectSearch($oAttDef->GetTargetClass());
|
||||||
if (($sOpCode == 'IN') && is_array($condition))
|
if (($sOpCode == 'IN') && is_array($condition)) {
|
||||||
{
|
|
||||||
$oFilter->AddConditionExpression(self::GetConditionIN($oFilter, 'id', $condition));
|
$oFilter->AddConditionExpression(self::GetConditionIN($oFilter, 'id', $condition));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$oFilter->AddCondition('id', $condition);
|
$oFilter->AddCondition('id', $condition);
|
||||||
}
|
}
|
||||||
$oHKFilter = new DBObjectSearch($oAttDef->GetTargetClass());
|
$oHKFilter = new DBObjectSearch($oAttDef->GetTargetClass());
|
||||||
$oHKFilter->AddCondition_PointingTo($oFilter, $sHierarchicalKeyCode, TREE_OPERATOR_BELOW); // Use the 'below' operator by default
|
$oHKFilter->AddCondition_PointingTo($oFilter, $sHierarchicalKeyCode, TREE_OPERATOR_BELOW); // Use the 'below' operator by default
|
||||||
$this->m_oFilter->AddCondition_PointingTo($oHKFilter, $sFilterCode);
|
$this->m_oFilter->AddCondition_PointingTo($oHKFilter, $sFilterCode);
|
||||||
$bConditionAdded = true;
|
$bConditionAdded = true;
|
||||||
}
|
} elseif (($sOpCode == 'IN') && is_array($condition)) {
|
||||||
else if (($sOpCode == 'IN') && is_array($condition))
|
|
||||||
{
|
|
||||||
$this->m_oFilter->AddConditionExpression(self::GetConditionIN($this->m_oFilter, $sFilterCode, $condition));
|
$this->m_oFilter->AddConditionExpression(self::GetConditionIN($this->m_oFilter, $sFilterCode, $condition));
|
||||||
$bConditionAdded = true;
|
$bConditionAdded = true;
|
||||||
}
|
}
|
||||||
}
|
} elseif (($sOpCode == 'IN') && is_array($condition)) {
|
||||||
else if (($sOpCode == 'IN') && is_array($condition))
|
|
||||||
{
|
|
||||||
$this->m_oFilter->AddConditionExpression(self::GetConditionIN($this->m_oFilter, $sFilterCode, $condition));
|
$this->m_oFilter->AddConditionExpression(self::GetConditionIN($this->m_oFilter, $sFilterCode, $condition));
|
||||||
$bConditionAdded = true;
|
$bConditionAdded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// In all other cases, just add the condition directly
|
// In all other cases, just add the condition directly
|
||||||
if (!$bConditionAdded)
|
if (!$bConditionAdded) {
|
||||||
{
|
|
||||||
$this->m_oFilter->AddCondition($sFilterCode, $condition, null); // Use the default 'loose' operator
|
$this->m_oFilter->AddCondition($sFilterCode, $condition, null); // Use the default 'loose' operator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected function GetConditionIN($oFilter, $sFilterCode, $condition)
|
protected static function GetConditionIN($oFilter, $sFilterCode, $condition)
|
||||||
{
|
{
|
||||||
$oField = new FieldExpression($sFilterCode, $oFilter->GetClassAlias());
|
$oField = new FieldExpression($sFilterCode, $oFilter->GetClassAlias());
|
||||||
$sListExpr = '('.implode(', ', CMDBSource::Quote($condition)).')';
|
$sListExpr = '('.implode(', ', CMDBSource::Quote($condition)).')';
|
||||||
@@ -976,13 +947,10 @@ JS
|
|||||||
protected function MakeGroupByQuery(&$aExtraParams, &$oGroupByExp, &$sGroupByLabel, &$aGroupBy, &$sAggregationFunction, &$sFctVar, &$sAggregationAttr, &$sSql)
|
protected function MakeGroupByQuery(&$aExtraParams, &$oGroupByExp, &$sGroupByLabel, &$aGroupBy, &$sAggregationFunction, &$sFctVar, &$sAggregationAttr, &$sSql)
|
||||||
{
|
{
|
||||||
$sAlias = $this->m_oFilter->GetClassAlias();
|
$sAlias = $this->m_oFilter->GetClassAlias();
|
||||||
if (isset($aExtraParams['group_by_label']))
|
if (isset($aExtraParams['group_by_label'])) {
|
||||||
{
|
|
||||||
$oGroupByExp = Expression::FromOQL($aExtraParams['group_by']);
|
$oGroupByExp = Expression::FromOQL($aExtraParams['group_by']);
|
||||||
$sGroupByLabel = $aExtraParams['group_by_label'];
|
$sGroupByLabel = $aExtraParams['group_by_label'];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Backward compatibility: group_by is simply a field id
|
// Backward compatibility: group_by is simply a field id
|
||||||
$oGroupByExp = new FieldExpression($aExtraParams['group_by'], $sAlias);
|
$oGroupByExp = new FieldExpression($aExtraParams['group_by'], $sAlias);
|
||||||
$sGroupByLabel = MetaModel::GetLabel($this->m_oFilter->GetClass(), $aExtraParams['group_by']);
|
$sGroupByLabel = MetaModel::GetLabel($this->m_oFilter->GetClass(), $aExtraParams['group_by']);
|
||||||
@@ -990,61 +958,52 @@ JS
|
|||||||
|
|
||||||
// Security filtering
|
// Security filtering
|
||||||
$aFields = $oGroupByExp->ListRequiredFields();
|
$aFields = $oGroupByExp->ListRequiredFields();
|
||||||
foreach($aFields as $sFieldAlias)
|
foreach ($aFields as $sFieldAlias) {
|
||||||
{
|
$aMatches = [];
|
||||||
$aMatches = array();
|
if (preg_match('/^([^.]+)\\.([^.]+)$/', $sFieldAlias, $aMatches)) {
|
||||||
if (preg_match('/^([^.]+)\\.([^.]+)$/', $sFieldAlias, $aMatches))
|
|
||||||
{
|
|
||||||
$sFieldClass = $this->m_oFilter->GetClassName($aMatches[1]);
|
$sFieldClass = $this->m_oFilter->GetClassName($aMatches[1]);
|
||||||
$oAttDef = MetaModel::GetAttributeDef($sFieldClass, $aMatches[2]);
|
$oAttDef = MetaModel::GetAttributeDef($sFieldClass, $aMatches[2]);
|
||||||
if ($oAttDef instanceof AttributeOneWayPassword)
|
if ($oAttDef instanceof AttributeOneWayPassword) {
|
||||||
{
|
|
||||||
throw new Exception('Grouping on password fields is not supported.');
|
throw new Exception('Grouping on password fields is not supported.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$aGroupBy = array();
|
$aGroupBy = [];
|
||||||
$aGroupBy['grouped_by_1'] = $oGroupByExp;
|
$aGroupBy['grouped_by_1'] = $oGroupByExp;
|
||||||
$aQueryParams = array();
|
$aQueryParams = [];
|
||||||
if (isset($aExtraParams['query_params']))
|
if (isset($aExtraParams['query_params'])) {
|
||||||
{
|
|
||||||
$aQueryParams = $aExtraParams['query_params'];
|
$aQueryParams = $aExtraParams['query_params'];
|
||||||
}
|
}
|
||||||
$aFunctions = array();
|
$aFunctions = [];
|
||||||
$sAggregationFunction = 'count';
|
$sAggregationFunction = 'count';
|
||||||
$sFctVar = '_itop_count_';
|
$sFctVar = '_itop_count_';
|
||||||
$sAggregationAttr = '';
|
$sAggregationAttr = '';
|
||||||
if (isset($aExtraParams['aggregation_function']) && !empty($aExtraParams['aggregation_attribute']))
|
if (isset($aExtraParams['aggregation_function']) && !empty($aExtraParams['aggregation_attribute'])) {
|
||||||
{
|
|
||||||
$sAggregationFunction = $aExtraParams['aggregation_function'];
|
$sAggregationFunction = $aExtraParams['aggregation_function'];
|
||||||
$sAggregationAttr = $aExtraParams['aggregation_attribute'];
|
$sAggregationAttr = $aExtraParams['aggregation_attribute'];
|
||||||
$oAttrExpr = Expression::FromOQL('`'.$sAlias.'`.`'.$sAggregationAttr.'`');
|
$oAttrExpr = Expression::FromOQL('`'.$sAlias.'`.`'.$sAggregationAttr.'`');
|
||||||
$oFctExpr = new FunctionExpression(strtoupper($sAggregationFunction), array($oAttrExpr));
|
$oFctExpr = new FunctionExpression(strtoupper($sAggregationFunction), [$oAttrExpr]);
|
||||||
$sFctVar = '_itop_'.$sAggregationFunction.'_';
|
$sFctVar = '_itop_'.$sAggregationFunction.'_';
|
||||||
$aFunctions = array($sFctVar => $oFctExpr);
|
$aFunctions = [$sFctVar => $oFctExpr];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($sAggregationAttr))
|
if (!empty($sAggregationAttr)) {
|
||||||
{
|
|
||||||
$sClass = $this->m_oFilter->GetClass();
|
$sClass = $this->m_oFilter->GetClass();
|
||||||
$sAggregationAttr = MetaModel::GetLabel($sClass, $sAggregationAttr);
|
$sAggregationAttr = MetaModel::GetLabel($sClass, $sAggregationAttr);
|
||||||
}
|
}
|
||||||
$iLimit = 0;
|
$iLimit = 0;
|
||||||
if (isset($aExtraParams['limit']))
|
if (isset($aExtraParams['limit'])) {
|
||||||
{
|
|
||||||
$iLimit = intval($aExtraParams['limit']);
|
$iLimit = intval($aExtraParams['limit']);
|
||||||
}
|
}
|
||||||
$aOrderBy = array();
|
$aOrderBy = [];
|
||||||
if (isset($aExtraParams['order_direction']) && isset($aExtraParams['order_by']))
|
if (isset($aExtraParams['order_direction']) && isset($aExtraParams['order_by'])) {
|
||||||
{
|
switch ($aExtraParams['order_by']) {
|
||||||
switch ($aExtraParams['order_by'])
|
|
||||||
{
|
|
||||||
case 'attribute':
|
case 'attribute':
|
||||||
$aOrderBy = array('grouped_by_1' => ($aExtraParams['order_direction'] === 'asc'));
|
$aOrderBy = ['grouped_by_1' => ($aExtraParams['order_direction'] === 'asc')];
|
||||||
break;
|
break;
|
||||||
case 'function':
|
case 'function':
|
||||||
$aOrderBy = array($sFctVar => ($aExtraParams['order_direction'] === 'asc'));
|
$aOrderBy = [$sFctVar => ($aExtraParams['order_direction'] === 'asc')];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1080,31 +1039,31 @@ JS
|
|||||||
$this->AddCondition($sFilterCode, $sContextParamValue);
|
$this->AddCondition($sFilterCode, $sContextParamValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$aQueryParams = array();
|
$aQueryParams = [];
|
||||||
if (isset($aExtraParams['query_params'])) {
|
if (isset($aExtraParams['query_params'])) {
|
||||||
$aQueryParams = $aExtraParams['query_params'];
|
$aQueryParams = $aExtraParams['query_params'];
|
||||||
}
|
}
|
||||||
$this->m_oSet = new CMDBObjectSet($this->m_oFilter, array(), $aQueryParams);
|
$this->m_oSet = new CMDBObjectSet($this->m_oFilter, [], $aQueryParams);
|
||||||
$this->m_oSet->SetShowObsoleteData($this->m_bShowObsoleteData);
|
$this->m_oSet->SetShowObsoleteData($this->m_bShowObsoleteData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Summary details
|
// Summary details
|
||||||
$aCounts = array();
|
$aCounts = [];
|
||||||
$aStateLabels = array();
|
$aStateLabels = [];
|
||||||
if (!empty($sStateAttrCode) && !empty($sStatesList)) {
|
if (!empty($sStateAttrCode) && !empty($sStatesList)) {
|
||||||
$aStates = explode(',', $sStatesList);
|
$aStates = explode(',', $sStatesList);
|
||||||
|
|
||||||
// Generate one count + group by query [#1330]
|
// Generate one count + group by query [#1330]
|
||||||
$sClassAlias = $this->m_oFilter->GetClassAlias();
|
$sClassAlias = $this->m_oFilter->GetClassAlias();
|
||||||
$oGroupByExpr = Expression::FromOQL($sClassAlias.'.'.$sStateAttrCode);
|
$oGroupByExpr = Expression::FromOQL($sClassAlias.'.'.$sStateAttrCode);
|
||||||
$aGroupBy = array('group1' => $oGroupByExpr);
|
$aGroupBy = ['group1' => $oGroupByExpr];
|
||||||
$oGroupBySearch = $this->m_oFilter->DeepClone();
|
$oGroupBySearch = $this->m_oFilter->DeepClone();
|
||||||
if (isset($this->m_bShowObsoleteData)) {
|
if (isset($this->m_bShowObsoleteData)) {
|
||||||
$oGroupBySearch->SetShowObsoleteData($this->m_bShowObsoleteData);
|
$oGroupBySearch->SetShowObsoleteData($this->m_bShowObsoleteData);
|
||||||
}
|
}
|
||||||
$sCountGroupByQuery = $oGroupBySearch->MakeGroupByQuery($aQueryParams, $aGroupBy, false);
|
$sCountGroupByQuery = $oGroupBySearch->MakeGroupByQuery($aQueryParams, $aGroupBy, false);
|
||||||
$aCountGroupByResults = CMDBSource::QueryToArray($sCountGroupByQuery);
|
$aCountGroupByResults = CMDBSource::QueryToArray($sCountGroupByQuery);
|
||||||
$aCountsQueryResults = array();
|
$aCountsQueryResults = [];
|
||||||
foreach ($aCountGroupByResults as $aCountGroupBySingleResult) {
|
foreach ($aCountGroupByResults as $aCountGroupBySingleResult) {
|
||||||
$aCountsQueryResults[$aCountGroupBySingleResult[0]] = $aCountGroupBySingleResult[1];
|
$aCountsQueryResults[$aCountGroupBySingleResult[0]] = $aCountGroupBySingleResult[1];
|
||||||
}
|
}
|
||||||
@@ -1118,7 +1077,8 @@ JS
|
|||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
if ($aCounts[$sStateValue] == 0) {
|
if ($aCounts[$sStateValue] == 0) {
|
||||||
$aCounts[$sStateValue] = ['link' => '-', 'label' => $aCounts[$sStateValue]];;
|
$aCounts[$sStateValue] = ['link' => '-', 'label' => $aCounts[$sStateValue]];
|
||||||
|
;
|
||||||
} else {
|
} else {
|
||||||
$oSingleGroupByValueFilter = $this->m_oFilter->DeepClone();
|
$oSingleGroupByValueFilter = $this->m_oFilter->DeepClone();
|
||||||
$oSingleGroupByValueFilter->AddCondition($sStateAttrCode, $sStateValue, '=');
|
$oSingleGroupByValueFilter->AddCondition($sStateAttrCode, $sStateValue, '=');
|
||||||
@@ -1182,7 +1142,8 @@ JS
|
|||||||
$('#".$oBlock->GetId()."').html(data);
|
$('#".$oBlock->GetId()."').html(data);
|
||||||
$('#".$oBlock->GetId()."').unblock();
|
$('#".$oBlock->GetId()."').unblock();
|
||||||
});
|
});
|
||||||
$('#".$oBlock->GetId()."').unblock();");
|
$('#".$oBlock->GetId()."').unblock();"
|
||||||
|
);
|
||||||
|
|
||||||
return $oBlock;
|
return $oBlock;
|
||||||
}
|
}
|
||||||
@@ -1224,11 +1185,11 @@ JS
|
|||||||
$this->AddCondition($sFilterCode, $sContextParamValue);
|
$this->AddCondition($sFilterCode, $sContextParamValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$aQueryParams = array();
|
$aQueryParams = [];
|
||||||
if (isset($aExtraParams['query_params'])) {
|
if (isset($aExtraParams['query_params'])) {
|
||||||
$aQueryParams = $aExtraParams['query_params'];
|
$aQueryParams = $aExtraParams['query_params'];
|
||||||
}
|
}
|
||||||
$this->m_oSet = new CMDBObjectSet($this->m_oFilter, array(), $aQueryParams);
|
$this->m_oSet = new CMDBObjectSet($this->m_oFilter, [], $aQueryParams);
|
||||||
$this->m_oSet->SetShowObsoleteData($this->m_bShowObsoleteData);
|
$this->m_oSet->SetShowObsoleteData($this->m_bShowObsoleteData);
|
||||||
}
|
}
|
||||||
$iCount = $this->m_oSet->Count();
|
$iCount = $this->m_oSet->Count();
|
||||||
@@ -1245,8 +1206,15 @@ JS
|
|||||||
if (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY)) {
|
if (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY)) {
|
||||||
$sCreateActionUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=new&class='.$sClass.$oAppContext->GetForLink(true);
|
$sCreateActionUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=new&class='.$sClass.$oAppContext->GetForLink(true);
|
||||||
$sCreateActionLabel = Dict::Format('UI:Button:Create');
|
$sCreateActionLabel = Dict::Format('UI:Button:Create');
|
||||||
$oBlock = DashletFactory::MakeForDashletBadge($sClassIconUrl, $sHyperlink, $iCount, $sClassLabel, $sCreateActionUrl,
|
$oBlock = DashletFactory::MakeForDashletBadge(
|
||||||
$sCreateActionLabel, $aRefreshParams);
|
$sClassIconUrl,
|
||||||
|
$sHyperlink,
|
||||||
|
$iCount,
|
||||||
|
$sClassLabel,
|
||||||
|
$sCreateActionUrl,
|
||||||
|
$sCreateActionLabel,
|
||||||
|
$aRefreshParams
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$oBlock = DashletFactory::MakeForDashletBadge($sClassIconUrl, $sHyperlink, $iCount, $sClassLabel, null, null, $aRefreshParams);
|
$oBlock = DashletFactory::MakeForDashletBadge($sClassIconUrl, $sHyperlink, $iCount, $sClassLabel, null, null, $aRefreshParams);
|
||||||
}
|
}
|
||||||
@@ -1276,9 +1244,9 @@ JS
|
|||||||
|
|
||||||
$aRes = CMDBSource::QueryToArray($sSql);
|
$aRes = CMDBSource::QueryToArray($sSql);
|
||||||
|
|
||||||
$aGroupBy = array();
|
$aGroupBy = [];
|
||||||
$aLabels = array();
|
$aLabels = [];
|
||||||
$aValues = array();
|
$aValues = [];
|
||||||
$iTotalCount = 0;
|
$iTotalCount = 0;
|
||||||
foreach ($aRes as $iRow => $aRow) {
|
foreach ($aRes as $iRow => $aRow) {
|
||||||
$sValue = $aRow['grouped_by_1'];
|
$sValue = $aRow['grouped_by_1'];
|
||||||
@@ -1289,7 +1257,7 @@ JS
|
|||||||
$iTotalCount += $aRow['_itop_count_'];
|
$iTotalCount += $aRow['_itop_count_'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$aData = array();
|
$aData = [];
|
||||||
$oAppContext = new ApplicationContext();
|
$oAppContext = new ApplicationContext();
|
||||||
$sParams = $oAppContext->GetForLink(true);
|
$sParams = $oAppContext->GetForLink(true);
|
||||||
foreach ($aGroupBy as $iRow => $iCount) {
|
foreach ($aGroupBy as $iRow => $iCount) {
|
||||||
@@ -1300,22 +1268,22 @@ JS
|
|||||||
if (isset($aExtraParams['query_params'])) {
|
if (isset($aExtraParams['query_params'])) {
|
||||||
$aQueryParams = $aExtraParams['query_params'];
|
$aQueryParams = $aExtraParams['query_params'];
|
||||||
} else {
|
} else {
|
||||||
$aQueryParams = array();
|
$aQueryParams = [];
|
||||||
}
|
}
|
||||||
$sFilter = rawurlencode($oSubsetSearch->serialize(false, $aQueryParams));
|
$sFilter = rawurlencode($oSubsetSearch->serialize(false, $aQueryParams));
|
||||||
|
|
||||||
$aData[] = array(
|
$aData[] = [
|
||||||
'group' => $aLabels[$iRow],
|
'group' => $aLabels[$iRow],
|
||||||
'value' => "<a href=\"".utils::GetAbsoluteUrlAppRoot()."pages/UI.php?operation=search&dosearch=1$sParams&filter=$sFilter\">$iCount</a>"
|
'value' => "<a href=\"".utils::GetAbsoluteUrlAppRoot()."pages/UI.php?operation=search&dosearch=1$sParams&filter=$sFilter\">$iCount</a>",
|
||||||
); // TO DO: add the context information
|
]; // TO DO: add the context information
|
||||||
}
|
}
|
||||||
$aAttribs = array(
|
$aAttribs = [
|
||||||
'group' => array('label' => $sGroupByLabel, 'description' => ''),
|
'group' => ['label' => $sGroupByLabel, 'description' => ''],
|
||||||
'value' => array(
|
'value' => [
|
||||||
'label' => Dict::S('UI:GroupBy:'.$sAggregationFunction),
|
'label' => Dict::S('UI:GroupBy:'.$sAggregationFunction),
|
||||||
'description' => Dict::Format('UI:GroupBy:'.$sAggregationFunction.'+', $sAggregationAttr),
|
'description' => Dict::Format('UI:GroupBy:'.$sAggregationFunction.'+', $sAggregationAttr),
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
$sFormat = isset($aExtraParams['format']) ? $aExtraParams['format'] : 'UI:Pagination:HeaderNoSelection';
|
$sFormat = isset($aExtraParams['format']) ? $aExtraParams['format'] : 'UI:Pagination:HeaderNoSelection';
|
||||||
|
|
||||||
$aExtraParams['query_params'] = $this->m_oFilter->GetInternalParams();
|
$aExtraParams['query_params'] = $this->m_oFilter->GetInternalParams();
|
||||||
@@ -1413,10 +1381,12 @@ JS
|
|||||||
$oBlock->aExtraParams = $aExtraParams;
|
$oBlock->aExtraParams = $aExtraParams;
|
||||||
$oBlock->sFilter = $this->m_oFilter->ToOQL();
|
$oBlock->sFilter = $this->m_oFilter->ToOQL();
|
||||||
|
|
||||||
|
|
||||||
// Check the classes that can be read (i.e authorized) by this user...
|
// Check the classes that can be read (i.e authorized) by this user...
|
||||||
foreach ($aClasses as $sAlias => $sClassName) {
|
foreach ($aClasses as $sAlias => $sClassName) {
|
||||||
if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $this->m_oSet) != UR_ALLOWED_NO) {
|
if (
|
||||||
|
(UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $this->m_oSet) !== UR_ALLOWED_NO)
|
||||||
|
|| ($aExtraParams['display_unauthorized_objects'] ?? false) === true
|
||||||
|
) {
|
||||||
$aAuthorizedClasses[$sAlias] = $sClassName;
|
$aAuthorizedClasses[$sAlias] = $sClassName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1435,7 +1405,7 @@ JS
|
|||||||
$sSearchFilter = $this->m_oSet->GetFilter()->serialize();
|
$sSearchFilter = $this->m_oSet->GetFilter()->serialize();
|
||||||
// Limit the size of the URL (N°1585 - request uri too long)
|
// Limit the size of the URL (N°1585 - request uri too long)
|
||||||
if (strlen($sSearchFilter) < SERVER_MAX_URL_LENGTH) {
|
if (strlen($sSearchFilter) < SERVER_MAX_URL_LENGTH) {
|
||||||
$oBlock->sEventAttachedData = json_encode(array(
|
$oBlock->sEventAttachedData = json_encode([
|
||||||
'filter' => $sSearchFilter,
|
'filter' => $sSearchFilter,
|
||||||
'breadcrumb_id' => "ui-search-".$this->m_oSet->GetClass(),
|
'breadcrumb_id' => "ui-search-".$this->m_oSet->GetClass(),
|
||||||
'breadcrumb_label' => MetaModel::GetName($this->m_oSet->GetClass()),
|
'breadcrumb_label' => MetaModel::GetName($this->m_oSet->GetClass()),
|
||||||
@@ -1443,7 +1413,7 @@ JS
|
|||||||
'breadcrumb_instance_id' => MetaModel::GetConfig()->GetItopInstanceid(),
|
'breadcrumb_instance_id' => MetaModel::GetConfig()->GetItopInstanceid(),
|
||||||
'breadcrumb_icon' => 'fas fa-search',
|
'breadcrumb_icon' => 'fas fa-search',
|
||||||
'breadcrumb_icon_type' => iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES,
|
'breadcrumb_icon_type' => iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES,
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1476,25 +1446,25 @@ JS
|
|||||||
$oContentBlock = new UIContentBlock();
|
$oContentBlock = new UIContentBlock();
|
||||||
$oHtml = new Html();
|
$oHtml = new Html();
|
||||||
$oContentBlock->AddSubBlock($oHtml);
|
$oContentBlock->AddSubBlock($oHtml);
|
||||||
$aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode(',', $aExtraParams['display_aliases']) : array();
|
$aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode(',', $aExtraParams['display_aliases']) : [];
|
||||||
if (!isset($aExtraParams['group_by'])) {
|
if (!isset($aExtraParams['group_by'])) {
|
||||||
$oHtml->AddHtml('<p>'.Dict::S('UI:Error:MandatoryTemplateParameter_group_by').'</p>');
|
$oHtml->AddHtml('<p>'.Dict::S('UI:Error:MandatoryTemplateParameter_group_by').'</p>');
|
||||||
} else {
|
} else {
|
||||||
$aGroupByFields = array();
|
$aGroupByFields = [];
|
||||||
$aGroupBy = explode(',', $aExtraParams['group_by']);
|
$aGroupBy = explode(',', $aExtraParams['group_by']);
|
||||||
foreach ($aGroupBy as $sGroupBy) {
|
foreach ($aGroupBy as $sGroupBy) {
|
||||||
$aMatches = array();
|
$aMatches = [];
|
||||||
if (preg_match('/^(.+)\.(.+)$/', $sGroupBy, $aMatches) > 0) {
|
if (preg_match('/^(.+)\.(.+)$/', $sGroupBy, $aMatches) > 0) {
|
||||||
$aGroupByFields[] = array('alias' => $aMatches[1], 'att_code' => $aMatches[2]);
|
$aGroupByFields[] = ['alias' => $aMatches[1], 'att_code' => $aMatches[2]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($aGroupByFields) == 0) {
|
if (count($aGroupByFields) == 0) {
|
||||||
$oHtml->AddHtml('<p>'.Dict::Format('UI:Error:InvalidGroupByFields', $aExtraParams['group_by']).'</p>');
|
$oHtml->AddHtml('<p>'.Dict::Format('UI:Error:InvalidGroupByFields', $aExtraParams['group_by']).'</p>');
|
||||||
} else {
|
} else {
|
||||||
$aResults = array();
|
$aResults = [];
|
||||||
$aCriteria = array();
|
$aCriteria = [];
|
||||||
while ($aObjects = $this->m_oSet->FetchAssoc()) {
|
while ($aObjects = $this->m_oSet->FetchAssoc()) {
|
||||||
$aKeys = array();
|
$aKeys = [];
|
||||||
foreach ($aGroupByFields as $aField) {
|
foreach ($aGroupByFields as $aField) {
|
||||||
$sAlias = $aField['alias'];
|
$sAlias = $aField['alias'];
|
||||||
if (is_null($aObjects[$sAlias])) {
|
if (is_null($aObjects[$sAlias])) {
|
||||||
@@ -1511,7 +1481,7 @@ JS
|
|||||||
$oHtml->AddHtml("<table>\n");
|
$oHtml->AddHtml("<table>\n");
|
||||||
// Construct a new (parametric) query that will return the content of this block
|
// Construct a new (parametric) query that will return the content of this block
|
||||||
$oBlockFilter = $this->m_oFilter->DeepClone();
|
$oBlockFilter = $this->m_oFilter->DeepClone();
|
||||||
$aExpressions = array();
|
$aExpressions = [];
|
||||||
$index = 0;
|
$index = 0;
|
||||||
foreach ($aGroupByFields as $aField) {
|
foreach ($aGroupByFields as $aField) {
|
||||||
$aExpressions[] = '`'.$aField['alias'].'`.`'.$aField['att_code'].'` = :param'.$index++;
|
$aExpressions[] = '`'.$aField['alias'].'`.`'.$aField['att_code'].'` = :param'.$index++;
|
||||||
@@ -1523,7 +1493,7 @@ JS
|
|||||||
foreach ($aResults as $sCategory => $aObjects) {
|
foreach ($aResults as $sCategory => $aObjects) {
|
||||||
$oHtml->AddHtml("<tr><td><h1>$sCategory</h1></td></tr>\n");
|
$oHtml->AddHtml("<tr><td><h1>$sCategory</h1></td></tr>\n");
|
||||||
if (count($aDisplayAliases) == 1) {
|
if (count($aDisplayAliases) == 1) {
|
||||||
$aSimpleArray = array();
|
$aSimpleArray = [];
|
||||||
foreach ($aObjects as $aRow) {
|
foreach ($aObjects as $aRow) {
|
||||||
$oObj = $aRow[$aDisplayAliases[0]];
|
$oObj = $aRow[$aDisplayAliases[0]];
|
||||||
if (!is_null($oObj)) {
|
if (!is_null($oObj)) {
|
||||||
@@ -1539,12 +1509,12 @@ JS
|
|||||||
$oHtml->AddHtml("</td></tr>\n");
|
$oHtml->AddHtml("</td></tr>\n");
|
||||||
} else {
|
} else {
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$aArgs = array();
|
$aArgs = [];
|
||||||
foreach ($aGroupByFields as $aField) {
|
foreach ($aGroupByFields as $aField) {
|
||||||
$aArgs['param'.$index] = $aCriteria[$sCategory][$aField['alias'].'.'.$aField['att_code']];
|
$aArgs['param'.$index] = $aCriteria[$sCategory][$aField['alias'].'.'.$aField['att_code']];
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
$oSet = new CMDBObjectSet($oBlockFilter, array(), $aArgs);
|
$oSet = new CMDBObjectSet($oBlockFilter, [], $aArgs);
|
||||||
if (empty($aExtraParams['currentId'])) {
|
if (empty($aExtraParams['currentId'])) {
|
||||||
$iListId = utils::GetUniqueId(); // Works only if not in an Ajax page !!
|
$iListId = utils::GetUniqueId(); // Works only if not in an Ajax page !!
|
||||||
} else {
|
} else {
|
||||||
@@ -1565,54 +1535,6 @@ JS
|
|||||||
return $oContentBlock;
|
return $oContentBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated 3.1.0 N°5957
|
|
||||||
*
|
|
||||||
* @param WebPage $oPage
|
|
||||||
* @param array $aExtraParams
|
|
||||||
*
|
|
||||||
* @return \Combodo\iTop\Application\UI\Base\Component\Html\Html|\Combodo\iTop\Application\UI\Base\Layout\UIContentBlock|string
|
|
||||||
* @throws \ApplicationException
|
|
||||||
* @throws \ArchivedObjectException
|
|
||||||
* @throws \CoreException
|
|
||||||
* @throws \CoreUnexpectedValue
|
|
||||||
* @throws \DictExceptionMissingString
|
|
||||||
* @throws \MissingQueryArgument
|
|
||||||
* @throws \MySQLException
|
|
||||||
* @throws \MySQLHasGoneAwayException
|
|
||||||
* @throws \OQLException
|
|
||||||
* @throws \ReflectionException
|
|
||||||
*/
|
|
||||||
protected function RenderLinks(WebPage $oPage, array $aExtraParams)
|
|
||||||
{
|
|
||||||
// Note: No deprecation ticket yet as we want to wait and see if people / code actually use this method, in which case we might keep it.
|
|
||||||
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('This method is most likely not used throughout the application and will be removed soon. If you ever see this message, please inform us.');
|
|
||||||
|
|
||||||
$oBlock = null;
|
|
||||||
if (($this->m_oSet->CountWithLimit(1) > 0) && (UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_READ, $this->m_oSet) == UR_ALLOWED_YES)) {
|
|
||||||
$oBlock = cmdbAbstractObject::GetDisplaySetBlock($oPage, $this->m_oSet, $aExtraParams);
|
|
||||||
} else {
|
|
||||||
$sClass = $this->m_oFilter->GetClass();
|
|
||||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $this->m_aParams['target_attr']);
|
|
||||||
$sTargetClass = $oAttDef->GetTargetClass();
|
|
||||||
$oBlock = new Html('<p>'.Dict::Format('UI:NoObject_Class_ToDisplay', MetaModel::GetName($sTargetClass)).'</p>');
|
|
||||||
$bDisplayMenu = isset($this->m_aParams['menu']) ? $this->m_aParams['menu'] == true : true;
|
|
||||||
if ($bDisplayMenu) {
|
|
||||||
if ((UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) {
|
|
||||||
$sDefaults = '';
|
|
||||||
if (isset($this->m_aParams['default'])) {
|
|
||||||
foreach ($this->m_aParams['default'] as $sName => $sValue) {
|
|
||||||
$sDefaults .= '&'.urlencode($sName).'='.urlencode($sValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$oBlock->AddHtml("<p><a href=\"".utils::GetAbsoluteUrlAppRoot()."pages/UI.php?operation=modify_links&class=$sClass&sParams&link_attr=".$aExtraParams['link_attr']."&id=".$aExtraParams['object_id']."&target_class=$sTargetClass&addObjects=true$sDefaults\">".Dict::Format('UI:ClickToCreateNew',
|
|
||||||
Metamodel::GetName($sClass))."</a></p>\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $oBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|null $sChartId
|
* @param string|null $sChartId
|
||||||
* @param array $aQueryParams
|
* @param array $aQueryParams
|
||||||
@@ -1679,7 +1601,7 @@ JS
|
|||||||
{
|
{
|
||||||
$sChartType = isset($aExtraParams['chart_type']) ? $aExtraParams['chart_type'] : 'pie';
|
$sChartType = isset($aExtraParams['chart_type']) ? $aExtraParams['chart_type'] : 'pie';
|
||||||
$sId = utils::ReadParam('id', '');
|
$sId = utils::ReadParam('id', '');
|
||||||
$aValues = array();
|
$aValues = [];
|
||||||
$oBlock = null;
|
$oBlock = null;
|
||||||
$sJSURLs = '';
|
$sJSURLs = '';
|
||||||
|
|
||||||
@@ -1690,21 +1612,18 @@ JS
|
|||||||
$this->MakeGroupByQuery($aExtraParams, $oGroupByExp, $sGroupByLabel, $aGroupBy, $sAggregationFunction, $sFctVar, $sAggregationAttr, $sSql);
|
$this->MakeGroupByQuery($aExtraParams, $oGroupByExp, $sGroupByLabel, $aGroupBy, $sAggregationFunction, $sFctVar, $sAggregationAttr, $sSql);
|
||||||
$aRes = CMDBSource::QueryToArray($sSql);
|
$aRes = CMDBSource::QueryToArray($sSql);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$iTotalCount = 0;
|
$iTotalCount = 0;
|
||||||
$aURLs = array();
|
$aURLs = [];
|
||||||
|
|
||||||
foreach ($aRes as $iRow => $aRow) {
|
foreach ($aRes as $iRow => $aRow) {
|
||||||
$sValue = $aRow['grouped_by_1'];
|
$sValue = $aRow['grouped_by_1'];
|
||||||
$sHtmlValue = $oGroupByExp->MakeValueLabel($this->m_oFilter, $sValue, $sValue);
|
$sHtmlValue = $oGroupByExp->MakeValueLabel($this->m_oFilter, $sValue, $sValue);
|
||||||
$iTotalCount += $aRow['_itop_count_'];
|
$iTotalCount += $aRow['_itop_count_'];
|
||||||
$aValues[] = array(
|
$aValues[] = [
|
||||||
'label' => html_entity_decode(strip_tags($sHtmlValue), ENT_QUOTES, 'UTF-8'),
|
'label' => html_entity_decode(strip_tags($sHtmlValue), ENT_QUOTES, 'UTF-8'),
|
||||||
'label_html' => $sHtmlValue,
|
'label_html' => $sHtmlValue,
|
||||||
'value' => (float)$aRow[$sFctVar],
|
'value' => (float)$aRow[$sFctVar],
|
||||||
);
|
];
|
||||||
|
|
||||||
|
|
||||||
// Build the search for this subset
|
// Build the search for this subset
|
||||||
$oSubsetSearch = $this->m_oFilter->DeepClone();
|
$oSubsetSearch = $this->m_oFilter->DeepClone();
|
||||||
@@ -1743,7 +1662,7 @@ JS
|
|||||||
$aColumns = [];
|
$aColumns = [];
|
||||||
$aNames = [];
|
$aNames = [];
|
||||||
foreach ($aValues as $idx => $aValue) {
|
foreach ($aValues as $idx => $aValue) {
|
||||||
$aColumns[] = array('series_'.$idx, (float)$aValue['value']);
|
$aColumns[] = ['series_'.$idx, (float)$aValue['value']];
|
||||||
$aNames['series_'.$idx] = $aValue['label'];
|
$aNames['series_'.$idx] = $aValue['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1792,12 +1711,12 @@ JS
|
|||||||
$oBlock->sDownloadLink = utils::GetAbsoluteUrlAppRoot().'webservices/export.php?expression='.urlencode($this->m_oFilter->ToOQL(true)).'&format=csv&filename='.urlencode($oBlock->sCsvFile);
|
$oBlock->sDownloadLink = utils::GetAbsoluteUrlAppRoot().'webservices/export.php?expression='.urlencode($this->m_oFilter->ToOQL(true)).'&format=csv&filename='.urlencode($oBlock->sCsvFile);
|
||||||
$oBlock->sLinkToToggle = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=search'.$oAppContext->GetForLink(true).'&filter='.rawurlencode($this->m_oFilter->serialize()).'&format=csv';
|
$oBlock->sLinkToToggle = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=search'.$oAppContext->GetForLink(true).'&filter='.rawurlencode($this->m_oFilter->serialize()).'&format=csv';
|
||||||
// Pass the parameters via POST, since expression may be very long
|
// Pass the parameters via POST, since expression may be very long
|
||||||
$aParamsToPost = array(
|
$aParamsToPost = [
|
||||||
'expression' => $this->m_oFilter->ToOQL(true),
|
'expression' => $this->m_oFilter->ToOQL(true),
|
||||||
'format' => 'csv',
|
'format' => 'csv',
|
||||||
'filename' => $oBlock->sCsvFile,
|
'filename' => $oBlock->sCsvFile,
|
||||||
'charset' => 'UTF-8',
|
'charset' => 'UTF-8',
|
||||||
);
|
];
|
||||||
if ($oBlock->bAdvancedMode) {
|
if ($oBlock->bAdvancedMode) {
|
||||||
$oBlock->sDownloadLink .= '&fields_advanced=1';
|
$oBlock->sDownloadLink .= '&fields_advanced=1';
|
||||||
$aParamsToPost['fields_advanced'] = 1;
|
$aParamsToPost['fields_advanced'] = 1;
|
||||||
@@ -1856,8 +1775,7 @@ class MenuBlock extends DisplayBlock
|
|||||||
$oRouter = Router::GetInstance();
|
$oRouter = Router::GetInstance();
|
||||||
$oRenderBlock = new UIContentBlock();
|
$oRenderBlock = new UIContentBlock();
|
||||||
|
|
||||||
if ($this->m_sStyle == 'popup') // popup is a synonym of 'list' for backward compatibility
|
if ($this->m_sStyle == 'popup') { // popup is a synonym of 'list' for backward compatibility
|
||||||
{
|
|
||||||
$this->m_sStyle = static::ENUM_STYLE_LIST;
|
$this->m_sStyle = static::ENUM_STYLE_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1896,7 +1814,6 @@ class MenuBlock extends DisplayBlock
|
|||||||
$oAppContext = new ApplicationContext();
|
$oAppContext = new ApplicationContext();
|
||||||
$sContext = $oAppContext->GetForLink(true);
|
$sContext = $oAppContext->GetForLink(true);
|
||||||
|
|
||||||
|
|
||||||
$sFilter = $this->GetFilter()->serialize();
|
$sFilter = $this->GetFilter()->serialize();
|
||||||
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($sClass);
|
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($sClass);
|
||||||
$sRootUrl = utils::GetAbsoluteUrlAppRoot();
|
$sRootUrl = utils::GetAbsoluteUrlAppRoot();
|
||||||
@@ -1974,8 +1891,8 @@ class MenuBlock extends DisplayBlock
|
|||||||
// Life cycle actions may be available... if all objects are in the same state
|
// Life cycle actions may be available... if all objects are in the same state
|
||||||
// Group by <state>
|
// Group by <state>
|
||||||
$oGroupByExp = new FieldExpression(MetaModel::GetStateAttributeCode($sClass), $this->m_oFilter->GetClassAlias());
|
$oGroupByExp = new FieldExpression(MetaModel::GetStateAttributeCode($sClass), $this->m_oFilter->GetClassAlias());
|
||||||
$aGroupBy = array('__state__' => $oGroupByExp);
|
$aGroupBy = ['__state__' => $oGroupByExp];
|
||||||
$aQueryParams = array();
|
$aQueryParams = [];
|
||||||
if (isset($aExtraParams['query_params'])) {
|
if (isset($aExtraParams['query_params'])) {
|
||||||
$aQueryParams = $aExtraParams['query_params'];
|
$aQueryParams = $aExtraParams['query_params'];
|
||||||
}
|
}
|
||||||
@@ -2007,10 +1924,10 @@ class MenuBlock extends DisplayBlock
|
|||||||
switch ($iActionAllowed) {
|
switch ($iActionAllowed) {
|
||||||
case UR_ALLOWED_YES:
|
case UR_ALLOWED_YES:
|
||||||
case UR_ALLOWED_DEPENDS:
|
case UR_ALLOWED_DEPENDS:
|
||||||
$aTransitionActions[$sStimulusCode] = array(
|
$aTransitionActions[$sStimulusCode] = [
|
||||||
'label' => $aStimuli[$sStimulusCode]->GetLabel(),
|
'label' => $aStimuli[$sStimulusCode]->GetLabel(),
|
||||||
'url' => "{$sRootUrl}pages/UI.php?stimulus=$sStimulusCode&class=$sLifecycleClass&{$sUrlQueryString}",
|
'url' => "{$sRootUrl}pages/UI.php?stimulus=$sStimulusCode&class=$sLifecycleClass&{$sUrlQueryString}",
|
||||||
) + $aActionParams;
|
] + $aActionParams;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -2072,16 +1989,16 @@ class MenuBlock extends DisplayBlock
|
|||||||
// Just one object in the set, possible actions are "new / clone / modify and delete"
|
// Just one object in the set, possible actions are "new / clone / modify and delete"
|
||||||
if (!isset($aExtraParams['link_attr'])) {
|
if (!isset($aExtraParams['link_attr'])) {
|
||||||
if ($bIsModifyAllowed) {
|
if ($bIsModifyAllowed) {
|
||||||
$aRegularActions['UI:Menu:Modify'] = array(
|
$aRegularActions['UI:Menu:Modify'] = [
|
||||||
'label' => Dict::S('UI:Menu:Modify'),
|
'label' => Dict::S('UI:Menu:Modify'),
|
||||||
'url' => $oRouter->GenerateUrl('object.modify', ['class' => $sClass, 'id' => $id])."{$sContext}#",
|
'url' => $oRouter->GenerateUrl('object.modify', ['class' => $sClass, 'id' => $id])."{$sContext}#",
|
||||||
) + $aActionParams;
|
] + $aActionParams;
|
||||||
}
|
}
|
||||||
if ($bIsDeleteAllowed) {
|
if ($bIsDeleteAllowed) {
|
||||||
$aRegularActions['UI:Menu:Delete'] = array(
|
$aRegularActions['UI:Menu:Delete'] = [
|
||||||
'label' => Dict::S('UI:Menu:Delete'),
|
'label' => Dict::S('UI:Menu:Delete'),
|
||||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=delete&class=$sClass&id=$id{$sContext}",
|
'url' => "{$sRootUrl}pages/$sUIPage?operation=delete&class=$sClass&id=$id{$sContext}",
|
||||||
) + $aActionParams;
|
] + $aActionParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Relations...
|
// Relations...
|
||||||
@@ -2090,16 +2007,16 @@ class MenuBlock extends DisplayBlock
|
|||||||
$this->AddMenuSeparator($aRegularActions);
|
$this->AddMenuSeparator($aRegularActions);
|
||||||
foreach ($aRelations as $sRelationCode => $aRelationInfo) {
|
foreach ($aRelations as $sRelationCode => $aRelationInfo) {
|
||||||
if (array_key_exists('down', $aRelationInfo)) {
|
if (array_key_exists('down', $aRelationInfo)) {
|
||||||
$aRegularActions[$sRelationCode.'_down'] = array(
|
$aRegularActions['UI:Menu:'.$sRelationCode.'_down'] = [
|
||||||
'label' => $aRelationInfo['down'],
|
'label' => $aRelationInfo['down'],
|
||||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=down&class=$sClass&id=$id{$sContext}",
|
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=down&class=$sClass&id=$id{$sContext}",
|
||||||
) + $aActionParams;
|
] + $aActionParams;
|
||||||
}
|
}
|
||||||
if (array_key_exists('up', $aRelationInfo)) {
|
if (array_key_exists('up', $aRelationInfo)) {
|
||||||
$aRegularActions[$sRelationCode.'_up'] = array(
|
$aRegularActions['UI:Menu:'.$sRelationCode.'_up'] = [
|
||||||
'label' => $aRelationInfo['up'],
|
'label' => $aRelationInfo['up'],
|
||||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=up&class=$sClass&id=$id{$sContext}",
|
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=up&class=$sClass&id=$id{$sContext}",
|
||||||
) + $aActionParams;
|
] + $aActionParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2111,7 +2028,7 @@ class MenuBlock extends DisplayBlock
|
|||||||
$bCanKill = false;
|
$bCanKill = false;
|
||||||
|
|
||||||
$oUser = UserRights::GetUserObject();
|
$oUser = UserRights::GetUserObject();
|
||||||
$aUserProfiles = array();
|
$aUserProfiles = [];
|
||||||
if (!is_null($oUser)) {
|
if (!is_null($oUser)) {
|
||||||
$oProfileSet = $oUser->Get('profile_list');
|
$oProfileSet = $oUser->Get('profile_list');
|
||||||
while ($oProfile = $oProfileSet->Fetch()) {
|
while ($oProfile = $oProfileSet->Fetch()) {
|
||||||
@@ -2133,10 +2050,10 @@ class MenuBlock extends DisplayBlock
|
|||||||
|
|
||||||
if ($bCanKill) {
|
if ($bCanKill) {
|
||||||
$this->AddMenuSeparator($aRegularActions);
|
$this->AddMenuSeparator($aRegularActions);
|
||||||
$aRegularActions['concurrent_lock_unlock'] = array(
|
$aRegularActions['concurrent_lock_unlock'] = [
|
||||||
'label' => Dict::S('UI:Menu:KillConcurrentLock'),
|
'label' => Dict::S('UI:Menu:KillConcurrentLock'),
|
||||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=kill_lock&class=$sClass&id=$id{$sContext}",
|
'url' => "{$sRootUrl}pages/$sUIPage?operation=kill_lock&class=$sClass&id=$id{$sContext}",
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2144,7 +2061,7 @@ class MenuBlock extends DisplayBlock
|
|||||||
$this->AddMenuSeparator($aRegularActions);
|
$this->AddMenuSeparator($aRegularActions);
|
||||||
|
|
||||||
$this->GetEnumAllowedActions($oSet, function ($sLabel, $data) use (&$aRegularActions, $aActionParams) {
|
$this->GetEnumAllowedActions($oSet, function ($sLabel, $data) use (&$aRegularActions, $aActionParams) {
|
||||||
$aRegularActions[$sLabel] = array('label' => $sLabel, 'url' => $data) + $aActionParams;
|
$aRegularActions[$sLabel] = ['label' => $sLabel, 'url' => $data] + $aActionParams;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2341,6 +2258,16 @@ class MenuBlock extends DisplayBlock
|
|||||||
$sIconClass = 'fas fa-file-pdf fa-lg';
|
$sIconClass = 'fas fa-file-pdf fa-lg';
|
||||||
$sLabel = '';
|
$sLabel = '';
|
||||||
break;
|
break;
|
||||||
|
case 'UI:Menu:impacts_up':
|
||||||
|
$sIconClass = 'fas fa-sitemap fa-rotate-180';
|
||||||
|
$sLabel = '';
|
||||||
|
$aAction['tooltip'] = Dict::S('Relation:impacts/UpStream');
|
||||||
|
break;
|
||||||
|
case 'UI:Menu:impacts_down':
|
||||||
|
$sIconClass = 'fas fa-sitemap';
|
||||||
|
$sLabel = '';
|
||||||
|
$aAction['tooltip'] = Dict::S('Relation:impacts/DownStream');
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (isset($aAction['icon_class']) && (strlen($aAction['icon_class']) > 0)) {
|
if (isset($aAction['icon_class']) && (strlen($aAction['icon_class']) > 0)) {
|
||||||
@@ -2510,13 +2437,11 @@ class MenuBlock extends DisplayBlock
|
|||||||
protected function AddMenuSeparator(&$aActions)
|
protected function AddMenuSeparator(&$aActions)
|
||||||
{
|
{
|
||||||
$sSeparator = '<hr class="menu-separator"/>';
|
$sSeparator = '<hr class="menu-separator"/>';
|
||||||
if (count($aActions) > 0) // Make sure that the separator is not the first item in the menu
|
if (count($aActions) > 0) { // Make sure that the separator is not the first item in the menu
|
||||||
{
|
|
||||||
$aKeys = array_keys($aActions);
|
$aKeys = array_keys($aActions);
|
||||||
$sLastKey = array_pop($aKeys);
|
$sLastKey = array_pop($aKeys);
|
||||||
if ($aActions[$sLastKey]['label'] != $sSeparator) // Make sure there are no 2 consecutive separators
|
if ($aActions[$sLastKey]['label'] != $sSeparator) { // Make sure there are no 2 consecutive separators
|
||||||
{
|
$aActions['sep_'.(count($aActions) - 1)] = ['label' => $sSeparator, 'url' => ''];
|
||||||
$aActions['sep_'.(count($aActions)-1)] = array('label' => $sSeparator, 'url' => '');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2576,10 +2501,10 @@ class MenuBlock extends DisplayBlock
|
|||||||
*/
|
*/
|
||||||
protected function AddBulkDeleteObjectsMenuAction(array &$aActions, string $sClass, string $sFilter, string $sActionIdentifier = 'UI:Menu:BulkDelete', $sActionLabel = 'UI:Menu:BulkDelete')
|
protected function AddBulkDeleteObjectsMenuAction(array &$aActions, string $sClass, string $sFilter, string $sActionIdentifier = 'UI:Menu:BulkDelete', $sActionLabel = 'UI:Menu:BulkDelete')
|
||||||
{
|
{
|
||||||
$aActions[$sActionIdentifier] = array(
|
$aActions[$sActionIdentifier] = [
|
||||||
'label' => Dict::S($sActionLabel),
|
'label' => Dict::S($sActionLabel),
|
||||||
'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=select_for_deletion&filter=".urlencode($sFilter)),
|
'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=select_for_deletion&filter=".urlencode($sFilter)),
|
||||||
) + $this->GetDefaultParamsForMenuAction();
|
] + $this->GetDefaultParamsForMenuAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,31 +22,28 @@ class ExcelExporter
|
|||||||
|
|
||||||
public function __construct($sToken = null)
|
public function __construct($sToken = null)
|
||||||
{
|
{
|
||||||
$this->aStatistics = array(
|
$this->aStatistics = [
|
||||||
'objects_count' => 0,
|
'objects_count' => 0,
|
||||||
'total_duration' => 0,
|
'total_duration' => 0,
|
||||||
'data_retrieval_duration' => 0,
|
'data_retrieval_duration' => 0,
|
||||||
'excel_build_duration' => 0,
|
'excel_build_duration' => 0,
|
||||||
'excel_write_duration' => 0,
|
'excel_write_duration' => 0,
|
||||||
'peak_memory_usage' => 0,
|
'peak_memory_usage' => 0,
|
||||||
);
|
];
|
||||||
$this->fStartTime = microtime(true);
|
$this->fStartTime = microtime(true);
|
||||||
$this->oSearch = null;
|
$this->oSearch = null;
|
||||||
|
|
||||||
$this->sState = 'new';
|
$this->sState = 'new';
|
||||||
$this->aObjectsIDs = array();
|
$this->aObjectsIDs = [];
|
||||||
$this->iPosition = 0;
|
$this->iPosition = 0;
|
||||||
$this->aAuthorizedClasses = null;
|
$this->aAuthorizedClasses = null;
|
||||||
$this->aTableHeaders = null;
|
$this->aTableHeaders = null;
|
||||||
$this->sOutputFilePath = null;
|
$this->sOutputFilePath = null;
|
||||||
$this->bAdvancedMode = false;
|
$this->bAdvancedMode = false;
|
||||||
$this->CheckDataDir();
|
$this->CheckDataDir();
|
||||||
if ($sToken == null)
|
if ($sToken == null) {
|
||||||
{
|
|
||||||
$this->sToken = $this->GetNewToken();
|
$this->sToken = $this->GetNewToken();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->sToken = $sToken;
|
$this->sToken = $sToken;
|
||||||
$this->ReloadState();
|
$this->ReloadState();
|
||||||
}
|
}
|
||||||
@@ -54,13 +51,10 @@ class ExcelExporter
|
|||||||
|
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
if (($this->sState != 'done') && ($this->sState != 'error') && ($this->sToken != null))
|
if (($this->sState != 'done') && ($this->sState != 'error') && ($this->sToken != null)) {
|
||||||
{
|
|
||||||
// Operation in progress, save the state
|
// Operation in progress, save the state
|
||||||
$this->SaveState();
|
$this->SaveState();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Operation completed, cleanup the temp files
|
// Operation completed, cleanup the temp files
|
||||||
@unlink($this->GetStateFile());
|
@unlink($this->GetStateFile());
|
||||||
@unlink($this->GetDataFile());
|
@unlink($this->GetDataFile());
|
||||||
@@ -85,7 +79,7 @@ class ExcelExporter
|
|||||||
|
|
||||||
public function SaveState()
|
public function SaveState()
|
||||||
{
|
{
|
||||||
$aState = array(
|
$aState = [
|
||||||
'state' => $this->sState,
|
'state' => $this->sState,
|
||||||
'statistics' => $this->aStatistics,
|
'statistics' => $this->aStatistics,
|
||||||
'filter' => $this->oSearch->serialize(),
|
'filter' => $this->oSearch->serialize(),
|
||||||
@@ -94,7 +88,7 @@ class ExcelExporter
|
|||||||
'object_ids' => $this->aObjectsIDs,
|
'object_ids' => $this->aObjectsIDs,
|
||||||
'output_file_path' => $this->sOutputFilePath,
|
'output_file_path' => $this->sOutputFilePath,
|
||||||
'advanced_mode' => $this->bAdvancedMode,
|
'advanced_mode' => $this->bAdvancedMode,
|
||||||
);
|
];
|
||||||
|
|
||||||
file_put_contents($this->GetStateFile(), json_encode($aState));
|
file_put_contents($this->GetStateFile(), json_encode($aState));
|
||||||
|
|
||||||
@@ -103,19 +97,16 @@ class ExcelExporter
|
|||||||
|
|
||||||
public function ReloadState()
|
public function ReloadState()
|
||||||
{
|
{
|
||||||
if ($this->sToken == null)
|
if ($this->sToken == null) {
|
||||||
{
|
|
||||||
throw new Exception('ExcelExporter not initialized with a token, cannot reload state');
|
throw new Exception('ExcelExporter not initialized with a token, cannot reload state');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($this->GetStateFile()))
|
if (!file_exists($this->GetStateFile())) {
|
||||||
{
|
|
||||||
throw new Exception("ExcelExporter: missing status file '".$this->GetStateFile()."', cannot reload state.");
|
throw new Exception("ExcelExporter: missing status file '".$this->GetStateFile()."', cannot reload state.");
|
||||||
}
|
}
|
||||||
$sJson = file_get_contents($this->GetStateFile());
|
$sJson = file_get_contents($this->GetStateFile());
|
||||||
$aState = json_decode($sJson, true);
|
$aState = json_decode($sJson, true);
|
||||||
if ($aState === null)
|
if ($aState === null) {
|
||||||
{
|
|
||||||
throw new Exception("ExcelExporter:corrupted status file '".$this->GetStateFile()."', not a JSON, cannot reload state.");
|
throw new Exception("ExcelExporter:corrupted status file '".$this->GetStateFile()."', not a JSON, cannot reload state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,16 +132,13 @@ class ExcelExporter
|
|||||||
$sMessage = Dict::Format('ExcelExporter:ErrorUnexpected_State', $this->sState);
|
$sMessage = Dict::Format('ExcelExporter:ErrorUnexpected_State', $this->sState);
|
||||||
$fTime = microtime(true);
|
$fTime = microtime(true);
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
switch ($this->sState) {
|
||||||
switch($this->sState)
|
|
||||||
{
|
|
||||||
case 'new':
|
case 'new':
|
||||||
$oIDSet = new DBObjectSet($this->oSearch);
|
$oIDSet = new DBObjectSet($this->oSearch);
|
||||||
$oIDSet->OptimizeColumnLoad(array('id'));
|
$oIDSet->OptimizeColumnLoad(['id']);
|
||||||
$this->aObjectsIDs = array();
|
$this->aObjectsIDs = [];
|
||||||
while($oObj = $oIDSet->Fetch())
|
while ($oObj = $oIDSet->Fetch()) {
|
||||||
{
|
|
||||||
$this->aObjectsIDs[] = $oObj->GetKey();
|
$this->aObjectsIDs[] = $oObj->GetKey();
|
||||||
}
|
}
|
||||||
$sCode = 'retrieving-data';
|
$sCode = 'retrieving-data';
|
||||||
@@ -164,8 +152,7 @@ class ExcelExporter
|
|||||||
$this->GetFieldsList($oIDSet, $this->bAdvancedMode);
|
$this->GetFieldsList($oIDSet, $this->bAdvancedMode);
|
||||||
$sRow = json_encode($this->aTableHeaders);
|
$sRow = json_encode($this->aTableHeaders);
|
||||||
$hFile = @fopen($this->GetDataFile(), 'ab');
|
$hFile = @fopen($this->GetDataFile(), 'ab');
|
||||||
if ($hFile === false)
|
if ($hFile === false) {
|
||||||
{
|
|
||||||
throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for writing.');
|
throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for writing.');
|
||||||
}
|
}
|
||||||
fwrite($hFile, $sRow."\n");
|
fwrite($hFile, $sRow."\n");
|
||||||
@@ -181,32 +168,24 @@ class ExcelExporter
|
|||||||
|
|
||||||
$oCurrentSearch->AddCondition('id', $aIDs, 'IN');
|
$oCurrentSearch->AddCondition('id', $aIDs, 'IN');
|
||||||
$hFile = @fopen($this->GetDataFile(), 'ab');
|
$hFile = @fopen($this->GetDataFile(), 'ab');
|
||||||
if ($hFile === false)
|
if ($hFile === false) {
|
||||||
{
|
|
||||||
throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for writing.');
|
throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for writing.');
|
||||||
}
|
}
|
||||||
$oSet = new DBObjectSet($oCurrentSearch);
|
$oSet = new DBObjectSet($oCurrentSearch);
|
||||||
$this->GetFieldsList($oSet, $this->bAdvancedMode);
|
$this->GetFieldsList($oSet, $this->bAdvancedMode);
|
||||||
while($aObjects = $oSet->FetchAssoc())
|
while ($aObjects = $oSet->FetchAssoc()) {
|
||||||
{
|
$aRow = [];
|
||||||
$aRow = array();
|
foreach ($this->aAuthorizedClasses as $sAlias => $sClassName) {
|
||||||
foreach($this->aAuthorizedClasses as $sAlias => $sClassName)
|
|
||||||
{
|
|
||||||
$oObj = $aObjects[$sAlias];
|
$oObj = $aObjects[$sAlias];
|
||||||
if ($this->bAdvancedMode)
|
if ($this->bAdvancedMode) {
|
||||||
{
|
|
||||||
$aRow[] = $oObj->GetKey();
|
$aRow[] = $oObj->GetKey();
|
||||||
}
|
}
|
||||||
foreach($this->aFieldsList[$sAlias] as $sAttCodeEx => $oAttDef)
|
foreach ($this->aFieldsList[$sAlias] as $sAttCodeEx => $oAttDef) {
|
||||||
{
|
|
||||||
$value = $oObj->Get($sAttCodeEx);
|
$value = $oObj->Get($sAttCodeEx);
|
||||||
if ($value instanceOf ormCaseLog)
|
if ($value instanceof ormCaseLog) {
|
||||||
{
|
|
||||||
// Extract the case log as text and remove the "===" which make Excel think that the cell contains a formula the next time you edit it!
|
// Extract the case log as text and remove the "===" which make Excel think that the cell contains a formula the next time you edit it!
|
||||||
$sExcelVal = trim(preg_replace('/========== ([^=]+) ============/', '********** $1 ************', $value->GetText()));
|
$sExcelVal = trim(preg_replace('/========== ([^=]+) ============/', '********** $1 ************', $value->GetText()));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$sExcelVal = $oAttDef->GetEditValue($value, $oObj);
|
$sExcelVal = $oAttDef->GetEditValue($value, $oObj);
|
||||||
}
|
}
|
||||||
$aRow[] = $sExcelVal;
|
$aRow[] = $sExcelVal;
|
||||||
@@ -217,16 +196,13 @@ class ExcelExporter
|
|||||||
}
|
}
|
||||||
fclose($hFile);
|
fclose($hFile);
|
||||||
|
|
||||||
if (($this->iPosition + $this->iChunkSize) > count($this->aObjectsIDs))
|
if (($this->iPosition + $this->iChunkSize) > count($this->aObjectsIDs)) {
|
||||||
{
|
|
||||||
// Next state
|
// Next state
|
||||||
$this->sState = 'building-excel';
|
$this->sState = 'building-excel';
|
||||||
$sCode = 'building-excel';
|
$sCode = 'building-excel';
|
||||||
$iPercentage = 80;
|
$iPercentage = 80;
|
||||||
$sMessage = Dict::S('ExcelExporter:BuildingExcelFile');
|
$sMessage = Dict::S('ExcelExporter:BuildingExcelFile');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$sCode = 'retrieving-data';
|
$sCode = 'retrieving-data';
|
||||||
$this->iPosition += $this->iChunkSize;
|
$this->iPosition += $this->iChunkSize;
|
||||||
$iPercentage = 5 + round(75 * ($this->iPosition / count($this->aObjectsIDs)));
|
$iPercentage = 5 + round(75 * ($this->iPosition / count($this->aObjectsIDs)));
|
||||||
@@ -236,16 +212,14 @@ class ExcelExporter
|
|||||||
|
|
||||||
case 'building-excel':
|
case 'building-excel':
|
||||||
$hFile = @fopen($this->GetDataFile(), 'rb');
|
$hFile = @fopen($this->GetDataFile(), 'rb');
|
||||||
if ($hFile === false)
|
if ($hFile === false) {
|
||||||
{
|
|
||||||
throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for reading.');
|
throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for reading.');
|
||||||
}
|
}
|
||||||
$sHeaders = fgets($hFile);
|
$sHeaders = fgets($hFile);
|
||||||
$aHeaders = json_decode($sHeaders, true);
|
$aHeaders = json_decode($sHeaders, true);
|
||||||
|
|
||||||
$aData = array();
|
$aData = [];
|
||||||
while($sLine = fgets($hFile))
|
while ($sLine = fgets($hFile)) {
|
||||||
{
|
|
||||||
$aRow = json_decode($sLine);
|
$aRow = json_decode($sLine);
|
||||||
$aData[] = $aRow;
|
$aData[] = $aRow;
|
||||||
}
|
}
|
||||||
@@ -278,35 +252,29 @@ class ExcelExporter
|
|||||||
$sMessage = Dict::S('ExcelExporter:Done');
|
$sMessage = Dict::S('ExcelExporter:Done');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$sCode = 'error';
|
$sCode = 'error';
|
||||||
$sMessage = $e->getMessage();
|
$sMessage = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->aStatistics['total_duration'] += microtime(true) - $fTime;
|
$this->aStatistics['total_duration'] += microtime(true) - $fTime;
|
||||||
$peak_memory = memory_get_peak_usage(true);
|
$peak_memory = memory_get_peak_usage(true);
|
||||||
if ($peak_memory > $this->aStatistics['peak_memory_usage'])
|
if ($peak_memory > $this->aStatistics['peak_memory_usage']) {
|
||||||
{
|
|
||||||
$this->aStatistics['peak_memory_usage'] = $peak_memory;
|
$this->aStatistics['peak_memory_usage'] = $peak_memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
'code' => $sCode,
|
'code' => $sCode,
|
||||||
'message' => $sMessage,
|
'message' => $sMessage,
|
||||||
'percentage' => $iPercentage,
|
'percentage' => $iPercentage,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetExcelFilePath()
|
public function GetExcelFilePath()
|
||||||
{
|
{
|
||||||
if ($this->sOutputFilePath == null)
|
if ($this->sOutputFilePath == null) {
|
||||||
{
|
|
||||||
return utils::GetDataPath().'bulk_export/'.$this->sToken.'.xlsx';
|
return utils::GetDataPath().'bulk_export/'.$this->sToken.'.xlsx';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return $this->sOutputFilePath;
|
return $this->sOutputFilePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -337,14 +305,11 @@ class ExcelExporter
|
|||||||
$aFiles = glob(utils::GetDataPath().'bulk_export/*.*');
|
$aFiles = glob(utils::GetDataPath().'bulk_export/*.*');
|
||||||
$iDelay = MetaModel::GetConfig()->Get('xlsx_exporter_cleanup_old_files_delay');
|
$iDelay = MetaModel::GetConfig()->Get('xlsx_exporter_cleanup_old_files_delay');
|
||||||
|
|
||||||
if($iDelay > 0)
|
if ($iDelay > 0) {
|
||||||
{
|
foreach ($aFiles as $sFile) {
|
||||||
foreach($aFiles as $sFile)
|
|
||||||
{
|
|
||||||
$iModificationTime = filemtime($sFile);
|
$iModificationTime = filemtime($sFile);
|
||||||
|
|
||||||
if($iModificationTime < (time() - $iDelay))
|
if ($iModificationTime < (time() - $iDelay)) {
|
||||||
{
|
|
||||||
// Temporary files older than one day are deleted
|
// Temporary files older than one day are deleted
|
||||||
//echo "Supposed to delete: '".$sFile." (Unix Modification Time: $iModificationTime)'\n";
|
//echo "Supposed to delete: '".$sFile." (Unix Modification Time: $iModificationTime)'\n";
|
||||||
@unlink($sFile);
|
@unlink($sFile);
|
||||||
@@ -355,21 +320,18 @@ class ExcelExporter
|
|||||||
|
|
||||||
public function DisplayStatistics(Page $oPage)
|
public function DisplayStatistics(Page $oPage)
|
||||||
{
|
{
|
||||||
$aStats = array(
|
$aStats = [
|
||||||
'Number of objects exported' => $this->aStatistics['objects_count'],
|
'Number of objects exported' => $this->aStatistics['objects_count'],
|
||||||
'Total export duration' => sprintf('%.3f s', $this->aStatistics['total_duration']),
|
'Total export duration' => sprintf('%.3f s', $this->aStatistics['total_duration']),
|
||||||
'Data retrieval duration' => sprintf('%.3f s', $this->aStatistics['data_retrieval_duration']),
|
'Data retrieval duration' => sprintf('%.3f s', $this->aStatistics['data_retrieval_duration']),
|
||||||
'Excel build duration' => sprintf('%.3f s', $this->aStatistics['excel_build_duration']),
|
'Excel build duration' => sprintf('%.3f s', $this->aStatistics['excel_build_duration']),
|
||||||
'Excel write duration' => sprintf('%.3f s', $this->aStatistics['excel_write_duration']),
|
'Excel write duration' => sprintf('%.3f s', $this->aStatistics['excel_write_duration']),
|
||||||
'Peak memory usage' => self::HumanDisplay($this->aStatistics['peak_memory_usage']),
|
'Peak memory usage' => self::HumanDisplay($this->aStatistics['peak_memory_usage']),
|
||||||
);
|
];
|
||||||
|
|
||||||
if ($oPage instanceof CLIPage)
|
if ($oPage instanceof CLIPage) {
|
||||||
{
|
|
||||||
$oPage->add($this->GetStatistics('text'));
|
$oPage->add($this->GetStatistics('text'));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$oPage->add($this->GetStatistics('html'));
|
$oPage->add($this->GetStatistics('html'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -377,29 +339,24 @@ class ExcelExporter
|
|||||||
public function GetStatistics($sFormat = 'html')
|
public function GetStatistics($sFormat = 'html')
|
||||||
{
|
{
|
||||||
$sStats = '';
|
$sStats = '';
|
||||||
$aStats = array(
|
$aStats = [
|
||||||
'Number of objects exported' => $this->aStatistics['objects_count'],
|
'Number of objects exported' => $this->aStatistics['objects_count'],
|
||||||
'Total export duration' => sprintf('%.3f s', $this->aStatistics['total_duration']),
|
'Total export duration' => sprintf('%.3f s', $this->aStatistics['total_duration']),
|
||||||
'Data retrieval duration' => sprintf('%.3f s', $this->aStatistics['data_retrieval_duration']),
|
'Data retrieval duration' => sprintf('%.3f s', $this->aStatistics['data_retrieval_duration']),
|
||||||
'Excel build duration' => sprintf('%.3f s', $this->aStatistics['excel_build_duration']),
|
'Excel build duration' => sprintf('%.3f s', $this->aStatistics['excel_build_duration']),
|
||||||
'Excel write duration' => sprintf('%.3f s', $this->aStatistics['excel_write_duration']),
|
'Excel write duration' => sprintf('%.3f s', $this->aStatistics['excel_write_duration']),
|
||||||
'Peak memory usage' => self::HumanDisplay($this->aStatistics['peak_memory_usage']),
|
'Peak memory usage' => self::HumanDisplay($this->aStatistics['peak_memory_usage']),
|
||||||
);
|
];
|
||||||
|
|
||||||
if ($sFormat == 'text')
|
if ($sFormat == 'text') {
|
||||||
{
|
foreach ($aStats as $sLabel => $sValue) {
|
||||||
foreach($aStats as $sLabel => $sValue)
|
|
||||||
{
|
|
||||||
$sStats .= "+------------------------------+----------+\n";
|
$sStats .= "+------------------------------+----------+\n";
|
||||||
$sStats .= sprintf("|%-30s|%10s|\n", $sLabel, $sValue);
|
$sStats .= sprintf("|%-30s|%10s|\n", $sLabel, $sValue);
|
||||||
}
|
}
|
||||||
$sStats .= "+------------------------------+----------+";
|
$sStats .= "+------------------------------+----------+";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$sStats .= '<table><tbody>';
|
$sStats .= '<table><tbody>';
|
||||||
foreach($aStats as $sLabel => $sValue)
|
foreach ($aStats as $sLabel => $sValue) {
|
||||||
{
|
|
||||||
$sStats .= "<tr><td>$sLabel</td><td>$sValue</td></tr>";
|
$sStats .= "<tr><td>$sLabel</td><td>$sValue</td></tr>";
|
||||||
}
|
}
|
||||||
$sStats .= '</tbody></table>';
|
$sStats .= '</tbody></table>';
|
||||||
@@ -410,27 +367,24 @@ class ExcelExporter
|
|||||||
|
|
||||||
public static function HumanDisplay($iSize)
|
public static function HumanDisplay($iSize)
|
||||||
{
|
{
|
||||||
$aUnits = array('B','KB','MB','GB','TB','PB');
|
$aUnits = ['B','KB','MB','GB','TB','PB'];
|
||||||
return @round($iSize / pow(1024, ($i = floor(log($iSize, 1024)))), 2).' '.$aUnits[$i];
|
return @round($iSize / pow(1024, ($i = floor(log($iSize, 1024)))), 2).' '.$aUnits[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function CheckDataDir()
|
protected function CheckDataDir()
|
||||||
{
|
{
|
||||||
if(!is_dir(utils::GetDataPath()."bulk_export"))
|
if (!is_dir(utils::GetDataPath()."bulk_export")) {
|
||||||
{
|
|
||||||
@mkdir(utils::GetDataPath()."bulk_export", 0777, true /* recursive */);
|
@mkdir(utils::GetDataPath()."bulk_export", 0777, true /* recursive */);
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
}
|
}
|
||||||
if (!is_writable(utils::GetDataPath()."bulk_export"))
|
if (!is_writable(utils::GetDataPath()."bulk_export")) {
|
||||||
{
|
|
||||||
throw new Exception('Data directory "'.utils::GetDataPath().'bulk_export" could not be written.');
|
throw new Exception('Data directory "'.utils::GetDataPath().'bulk_export" could not be written.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function GetStateFile($sToken = null)
|
protected function GetStateFile($sToken = null)
|
||||||
{
|
{
|
||||||
if ($sToken == null)
|
if ($sToken == null) {
|
||||||
{
|
|
||||||
$sToken = $this->sToken;
|
$sToken = $this->sToken;
|
||||||
}
|
}
|
||||||
return utils::GetDataPath()."bulk_export/$sToken.status";
|
return utils::GetDataPath()."bulk_export/$sToken.status";
|
||||||
@@ -444,14 +398,12 @@ class ExcelExporter
|
|||||||
protected function GetNewToken()
|
protected function GetNewToken()
|
||||||
{
|
{
|
||||||
$iNum = rand();
|
$iNum = rand();
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
$iNum++;
|
$iNum++;
|
||||||
$sToken = sprintf("%08x", $iNum);
|
$sToken = sprintf("%08x", $iNum);
|
||||||
$sFileName = $this->GetStateFile($sToken);
|
$sFileName = $this->GetStateFile($sToken);
|
||||||
$hFile = @fopen($sFileName, 'x');
|
$hFile = @fopen($sFileName, 'x');
|
||||||
}
|
} while ($hFile === false);
|
||||||
while($hFile === false);
|
|
||||||
|
|
||||||
fclose($hFile);
|
fclose($hFile);
|
||||||
return $sToken;
|
return $sToken;
|
||||||
@@ -459,82 +411,61 @@ class ExcelExporter
|
|||||||
|
|
||||||
protected function GetFieldsList($oSet, $bFieldsAdvanced = false, $bLocalize = true, $aFields = null)
|
protected function GetFieldsList($oSet, $bFieldsAdvanced = false, $bLocalize = true, $aFields = null)
|
||||||
{
|
{
|
||||||
$this->aFieldsList = array();
|
$this->aFieldsList = [];
|
||||||
|
|
||||||
$oAppContext = new ApplicationContext();
|
$oAppContext = new ApplicationContext();
|
||||||
$aClasses = $oSet->GetFilter()->GetSelectedClasses();
|
$aClasses = $oSet->GetFilter()->GetSelectedClasses();
|
||||||
$this->aAuthorizedClasses = array();
|
$this->aAuthorizedClasses = [];
|
||||||
foreach($aClasses as $sAlias => $sClassName)
|
foreach ($aClasses as $sAlias => $sClassName) {
|
||||||
{
|
if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) {
|
||||||
if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO)
|
|
||||||
{
|
|
||||||
$this->aAuthorizedClasses[$sAlias] = $sClassName;
|
$this->aAuthorizedClasses[$sAlias] = $sClassName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$aAttribs = array();
|
$aAttribs = [];
|
||||||
$this->aTableHeaders = array();
|
$this->aTableHeaders = [];
|
||||||
foreach($this->aAuthorizedClasses as $sAlias => $sClassName)
|
foreach ($this->aAuthorizedClasses as $sAlias => $sClassName) {
|
||||||
{
|
$aList[$sAlias] = [];
|
||||||
$aList[$sAlias] = array();
|
|
||||||
|
|
||||||
foreach(MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef)
|
foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) {
|
||||||
{
|
if (is_null($aFields) || (count($aFields) == 0)) {
|
||||||
if (is_null($aFields) || (count($aFields) == 0))
|
|
||||||
{
|
|
||||||
// Standard list of attributes (no link sets)
|
// Standard list of attributes (no link sets)
|
||||||
if ($oAttDef->IsScalar() && ($oAttDef->IsWritable() || $oAttDef->IsExternalField()))
|
if ($oAttDef->IsScalar() && ($oAttDef->IsWritable() || $oAttDef->IsExternalField())) {
|
||||||
{
|
|
||||||
$sAttCodeEx = $oAttDef->IsExternalField() ? $oAttDef->GetKeyAttCode().'->'.$oAttDef->GetExtAttCode() : $sAttCode;
|
$sAttCodeEx = $oAttDef->IsExternalField() ? $oAttDef->GetKeyAttCode().'->'.$oAttDef->GetExtAttCode() : $sAttCode;
|
||||||
|
|
||||||
if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE))
|
if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) {
|
||||||
{
|
if ($bFieldsAdvanced) {
|
||||||
if ($bFieldsAdvanced)
|
|
||||||
{
|
|
||||||
$aList[$sAlias][$sAttCodeEx] = $oAttDef;
|
$aList[$sAlias][$sAttCodeEx] = $oAttDef;
|
||||||
|
|
||||||
if ($oAttDef->IsExternalKey(EXTKEY_RELATIVE))
|
if ($oAttDef->IsExternalKey(EXTKEY_RELATIVE)) {
|
||||||
{
|
|
||||||
$sRemoteClass = $oAttDef->GetTargetClass();
|
$sRemoteClass = $oAttDef->GetTargetClass();
|
||||||
foreach(MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode)
|
foreach (MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) {
|
||||||
{
|
|
||||||
$this->aFieldsList[$sAlias][$sAttCode.'->'.$sRemoteAttCode] = MetaModel::GetAttributeDef($sRemoteClass, $sRemoteAttCode);
|
$this->aFieldsList[$sAlias][$sAttCode.'->'.$sRemoteAttCode] = MetaModel::GetAttributeDef($sRemoteClass, $sRemoteAttCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Any other attribute
|
// Any other attribute
|
||||||
$this->aFieldsList[$sAlias][$sAttCodeEx] = $oAttDef;
|
$this->aFieldsList[$sAlias][$sAttCodeEx] = $oAttDef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// User defined list of attributes
|
// User defined list of attributes
|
||||||
if (in_array($sAttCode, $aFields) || in_array($sAlias.'.'.$sAttCode, $aFields))
|
if (in_array($sAttCode, $aFields) || in_array($sAlias.'.'.$sAttCode, $aFields)) {
|
||||||
{
|
|
||||||
$this->aFieldsList[$sAlias][$sAttCode] = $oAttDef;
|
$this->aFieldsList[$sAlias][$sAttCode] = $oAttDef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($bFieldsAdvanced)
|
if ($bFieldsAdvanced) {
|
||||||
{
|
|
||||||
$this->aTableHeaders['id'] = '0';
|
$this->aTableHeaders['id'] = '0';
|
||||||
}
|
}
|
||||||
foreach($this->aFieldsList[$sAlias] as $sAttCodeEx => $oAttDef)
|
foreach ($this->aFieldsList[$sAlias] as $sAttCodeEx => $oAttDef) {
|
||||||
{
|
|
||||||
$sLabel = $bLocalize ? MetaModel::GetLabel($sClassName, $sAttCodeEx, isset($aParams['showMandatoryFields'])) : $sAttCodeEx;
|
$sLabel = $bLocalize ? MetaModel::GetLabel($sClassName, $sAttCodeEx, isset($aParams['showMandatoryFields'])) : $sAttCodeEx;
|
||||||
if($oAttDef instanceof AttributeDateTime)
|
if ($oAttDef instanceof AttributeDateTime) {
|
||||||
{
|
|
||||||
$this->aTableHeaders[$sLabel] = 'datetime';
|
$this->aTableHeaders[$sLabel] = 'datetime';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->aTableHeaders[$sLabel] = 'string';
|
$this->aTableHeaders[$sLabel] = 'string';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
@@ -77,7 +78,6 @@ class CoreCannotSaveObjectException extends CoreException
|
|||||||
return $sContent;
|
return $sContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getIssues()
|
public function getIssues()
|
||||||
{
|
{
|
||||||
return $this->aIssues;
|
return $this->aIssues;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
@@ -35,10 +36,10 @@ class CoreException extends Exception
|
|||||||
}
|
}
|
||||||
if (count($this->m_aContextData) > 0) {
|
if (count($this->m_aContextData) > 0) {
|
||||||
$sMessage .= ": ";
|
$sMessage .= ": ";
|
||||||
$aContextItems = array();
|
$aContextItems = [];
|
||||||
foreach ($this->m_aContextData as $sKey => $value) {
|
foreach ($this->m_aContextData as $sKey => $value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
$aPairs = array();
|
$aPairs = [];
|
||||||
foreach ($value as $key => $val) {
|
foreach ($value as $key => $val) {
|
||||||
if (is_array($val)) {
|
if (is_array($val)) {
|
||||||
$aPairs[] = $key.'=>('.implode(', ', $val).')';
|
$aPairs[] = $key.'=>('.implode(', ', $val).')';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
@@ -9,5 +10,4 @@
|
|||||||
*/
|
*/
|
||||||
class CorePortalInvalidActionRuleException extends CoreException
|
class CorePortalInvalidActionRuleException extends CoreException
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2010-2026 Combodo SAS
|
||||||
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ForgotPasswordApplicationException extends Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
10
application/exceptions/ForgotPasswordUserInputException.php
Normal file
10
application/exceptions/ForgotPasswordUserInputException.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2010-2026 Combodo SAS
|
||||||
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ForgotPasswordUserInputException extends Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
@@ -8,7 +9,7 @@ class DictExceptionMissingString extends DictException
|
|||||||
{
|
{
|
||||||
public function __construct($sLanguageCode, $sStringCode)
|
public function __construct($sLanguageCode, $sStringCode)
|
||||||
{
|
{
|
||||||
$aContext = array();
|
$aContext = [];
|
||||||
$aContext['language_code'] = $sLanguageCode;
|
$aContext['language_code'] = $sLanguageCode;
|
||||||
$aContext['string_code'] = $sStringCode;
|
$aContext['string_code'] = $sStringCode;
|
||||||
parent::__construct('Missing localized string', $aContext);
|
parent::__construct('Missing localized string', $aContext);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
@@ -8,7 +9,7 @@ class DictExceptionUnknownLanguage extends DictException
|
|||||||
{
|
{
|
||||||
public function __construct($sLanguageCode)
|
public function __construct($sLanguageCode)
|
||||||
{
|
{
|
||||||
$aContext = array();
|
$aContext = [];
|
||||||
$aContext['language_code'] = $sLanguageCode;
|
$aContext['language_code'] = $sLanguageCode;
|
||||||
parent::__construct('Unknown localization language', $aContext);
|
parent::__construct('Unknown localization language', $aContext);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
@@ -6,5 +7,4 @@
|
|||||||
|
|
||||||
class iTopXmlException extends CoreException
|
class iTopXmlException extends CoreException
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user