Repository navigation
Expand file tree
/
Copy pathsdk.php
More file actions
678 lines (602 loc) · 24.7 KB
/
Copy pathsdk.php
File metadata and controls
678 lines (602 loc) · 24.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
<?php
namespace {
if (false) {
class JobRouterException extends \Exception
{
}
class NoInstanceFoundException extends \JobRouterException
{
}
class IllegalFilesystemAccessException extends \JobRouterException
{
}
}
}
namespace Doctrine\DBAL {
if (false) {
class Exception extends \Exception
{
}
}
}
namespace JobRouter\Component\Security\Authentication {
if (false) {
abstract class AuthenticationException extends \JobRouterException
{
}
}
}
namespace JobRouter\Authentication {
if (false) {
class NoActiveAuthenticationException extends \JobRouter\Component\Security\Authentication\AuthenticationException
{
}
}
}
namespace JobRouter\Sdk {
if (false) {
interface ConnectionManagerInterface
{
/**
* Return the default JobRouter Database Connection.
*
* @return \JobRouter\Sdk\JobDBInterface JobDB Interface
*/
public function getJobDB(): \JobRouter\Sdk\JobDBInterface;
/**
* Return a JobRouter Database Connection by its name.
*
* @param string $connectionName Connection name
*
* @return \JobRouter\Sdk\JobDBInterface JobDB Interface
*
* @throws \Doctrine\DBAL\Exception
* @throws \JobRouterException
*/
public function getDBConnection(string $connectionName): \JobRouter\Sdk\JobDBInterface;
}
interface DateFormatterInterface
{
/**
* Date format id for d.m.Y
*/
public const FORMAT_WITH_POINT = 1;
/**
* Date format id for d/m/Y
*/
public const FORMAT_WITH_SLASHES = 2;
/**
* Date format id for m/d/Y
*/
public const FORMAT_WITH_SLASHES_MONTH_FIRST = 3;
/**
* Date format id for Y-m-d
*/
public const FORMAT_WITH_HYPHENS = 4;
/**
* Returns a formatted date according to a date $id (DateFormatterInterface::FORMAT_WITH_*). If an invalid ID
* is specified, the method returns the date in the standard format.
*
* @param string|int|bool $date Date string or date timestamp; if the value is false, the current timestamp is used
* @param bool $fullDateTime Flag whether the time should also be returned
* @param bool $isTimestamp Flag whether $date is a timestamp
* @param string $timeZone TimeZone
* @phpstan-param \JobRouter\Sdk\DateFormatterInterface::FORMAT_WITH_* $id ID of the date format
*
* @return string formatted date
*/
public function getFormattedDate(
int $id,
string|int|bool $date = false,
bool $fullDateTime = false,
bool $isTimestamp = false,
string $timeZone = '',
): string;
/**
* Returns a date in the standard format YYYY-MM-DD.
*
* @param string $date Date string
* @param bool $fullDateTime Flag whether the time should also be returned
* @param string $sourceTimeZone Source time zone
* @param string $targetTimeZone Target time zone
* @phpstan-param \JobRouter\Sdk\DateFormatterInterface::FORMAT_WITH_* $id ID of the date format
*
* @return string Date in the standard format YYY-MM-DD
*
* @throws \JobRouterException
*/
public function getUnformattedDate(
int $id,
string $date,
bool $fullDateTime = false,
string $sourceTimeZone = '',
string $targetTimeZone = '',
): string;
}
interface ResultInterface
{
/** Data indexed by column names (associative array). */
public const MODE_ASSOC = 2;
/** Default fetch mode if none specified. */
public const MODE_DEFAULT = 0;
/** Column names as top-level keys; rows as second-level keys. */
public const MODE_FLIPPED = 4;
/** Data as objects with properties corresponding to column names. */
public const MODE_OBJECT = 3;
/** Data indexed numerically by column order. */
public const MODE_ORDERED = 1;
/**
* Fetches all rows from the query.
*
* @param int $fetchMode The fetch mode to use (default: MODE_DEFAULT).
* @param bool $rekey if set to true, return array will have the first column as
* its first dimension
* @param bool $force_array used only when the query returns exactly two
* columns. If true, the values of the returned array will be one-element
* arrays instead of scalars.
* @param bool $group if true, the values of the returned array is wrapped in another array. If the same
* key value (in the first column) repeats itself, the values will be appended to this array instead of
* overwriting the existing values.
*
* @return array<mixed> data array on success, a error on failure.
*/
public function fetchAll(
int $fetchMode = self::MODE_DEFAULT,
$rekey = false,
$force_array = false,
$group = false,
);
/**
* Fetches a single column of data from the result.
*
* @param int $colNum The column number to fetch (default: 0).
*
* @return array<mixed> The values of the specified column.
*/
public function fetchCol(int $colNum = 0);
/**
* Fetches a single value from the result.
*
* @param int $colNum The column number to fetch (default: 0).
* @param int|null $rowNum The row number to fetch (default: first row).
*
* @return mixed The fetched value.
*/
public function fetchOne(int $colNum = 0, ?int $rowNum = null);
/**
* Fetches a single row from the result.
*
* @param int $fetchMode The fetch mode to use (default: MODE_DEFAULT).
* @param int|null $rowNum The row number to fetch (default: first row).
*
* @return array<mixed> data array on success, a error on failure.
*/
public function fetchRow(int $fetchMode = self::MODE_DEFAULT, ?int $rowNum = null);
}
interface JobDBInterface
{
/**
* Quotes a literal string. This method is NOT meant to fix SQL injections! It is only meant to escape this
* platform's string literal quote character inside the given literal string.
*
* @param mixed $value A literal string to quote
* @param string|null $type Type to which the value should be converted to
*
* @return mixed according to value; otherwise null in case of error.
*
* @throws \JobRouterException
*/
public function quote($value, ?string $type = null): mixed;
/**
* Executes an SQL statement and return the number of affected rows.
*
* @param string $sql SQL query
*
* @return mixed according to sql.
*
* @throws \JobRouterException
*/
public function exec(string $sql): mixed;
/**
* Executes an SQL statement, returning a result set as a Statement object.
*
* @param string $sql SQL query
*
* @return \JobRouter\Sdk\ResultInterface|false SQL result set; otherwise false in case of error.
*
* @throws \JobRouterException
*/
public function query(string $sql): \JobRouter\Sdk\ResultInterface|false;
/**
* Return a dataset from the result as an associative array.
* If there are no more datasets, a null will be returned, false will be returned on error.
*
* @param \JobRouter\Sdk\ResultInterface $result Object returned by query()
*
* @return mixed data set as array, null or false in case of error.
*
* @throws \JobRouterException
*/
public function fetchRow(\JobRouter\Sdk\ResultInterface $result): mixed;
/**
* Method returns all rows of the query result.
* If an error occurs, the method returns false.
*
* @param \JobRouter\Sdk\ResultInterface $result result object returned by query()
*
* @return mixed array or false in case of error
*/
public function fetchAll(\JobRouter\Sdk\ResultInterface $result): mixed;
/**
* Returns the first column of the first data set.
* If an error occurs, the method returns false.
*
* @param \JobRouter\Sdk\ResultInterface $result result object returned by query
*
* @return mixed prepared statement; otherwise false.
*/
public function fetchOne(\JobRouter\Sdk\ResultInterface $result): mixed;
/**
* Prepare an optionally parametrized SQL selection.
*
* @param string $sql SQL Query to prepare
* @param array $params Optional sql query parameter
* @param array|null $types Optional sql query parameter types
*
* @return \JobRouter\Sdk\ResultInterface|int|false Prepared result set; otherwise an integer based on sql
* select statement or false.
*/
public function preparedSelect(
string $sql,
array $params,
?array $types = [],
): \JobRouter\Sdk\ResultInterface|int|false;
/**
* Executes an optionally parametrized SQL selection.
*
* @param string $sql SQL Query to prepare
* @param array $params Optional sql query parameter
* @param array|null $types Optional sql query parameter types
*
* @return \JobRouter\Sdk\ResultInterface|int Prepared result set; otherwise an integer based on sql select
* statement or false in case of error. The error message can then be retrieved via getErrorMessage.
*/
public function preparedExecute(
string $sql,
array $params,
?array $types = [],
): \JobRouter\Sdk\ResultInterface|int;
/**
* Get additional user-supplied error information.
*
* @return string user-supplied error information; otherwise an empty if no error message exist
*/
public function getErrorMessage(): string;
}
interface PathsInterface
{
/**
* Return the JobRouter data path.
*
* @param string|null $relativePath Optional relative path inside the data path
* @param string|null $processName Optional process name
* @param int|null $processVersion Optional process version
*
* @return string the data path with the optional relative path, optional process name and there optional process version.
*
* @throws \IllegalFilesystemAccessException
*/
public function getDataPath(?string $relativePath = '', ?string $processName = '', ?int $processVersion = null): string;
/**
* Return the JobRouter functions path.
*
* @param string|null $relativePath Optional relative path inside the functions path
* @param string|null $processName Optional process name
* @param int|null $processVersion Optional process version
*
* @return string the data path with the optional relative path, optional process name and there optional process version.
*
* @throws \IllegalFilesystemAccessException
*/
public function getFunctionsPath(?string $relativePath = '', ?string $processName = '', ?int $processVersion = null): string;
/**
* Return the JobRouter URL with corresponding slash (/) at the end.
*
* @return string the JobRouter URL
*
* @throws \JobRouterException
*/
public function getJobRouterUrl(): string;
/**
* Return the JobRouter output path.
*
* @param string $relativePath Optional relative path inside the output path
*
* @throws \IllegalFilesystemAccessException
*/
public function getOutputPath(string $relativePath = ''): string;
/**
* Return the JobRouter temp path.
*
* @param string $relativePath Optional relative path inside the temp path
*
* @throws \IllegalFilesystemAccessException
*/
public function getTempPath(string $relativePath = ''): string;
/**
* Return the JobRouter upload path.
*
* @param string $relativePath Optional relative path inside the upload path
* @param bool|null $skipAssert Optional to skip assertion
*
* @throws \IllegalFilesystemAccessException
*/
public function getUploadPath(string $relativePath = '', ?bool $skipAssert = false): string;
}
interface UserInterface
{
/**
* Returns the user's language.
*
* @return string user's language
*/
public function getLanguage(): string;
/**
* Returns the user's avatar image url.
*
* @return string Avatar image url or the avatar fallback image path
*/
public function getAvatarUrl(): string;
/**
* Returns the login name for the user.
*
* @return string Login name of the user.
*/
public function getUsername(): string;
/**
* Returns the user's first name (pre-name).
*
* @return string First name of the user.
*/
public function getPrename(): string;
/**
* Returns the last name of the user.
*
* @return string Last name of the user.
*/
public function getLastName(): string;
/**
* Returns the complete name of the user in the form of "pre-name lastname".
*
* Is equivalent to:
*
* <?php
* echo $user->getPrename() . ' ' . $user->getLastName();
*
* @return string Complete name of the user.
*/
public function getFullName(): string;
/**
* Returns the user's e-mail address
*
* @return string user's e-mail address.
*/
public function getEmail(): string;
/**
* Returns the first user-defined settings of the user.
*
* @return string First user-defined settings of the user; otherwise an empty string.
*/
public function getUserDefined1(): string;
/**
* Returns the second user-defined settings of the user.
*
* @return string Second user-defined settings of the user; otherwise an empty string.
*/
public function getUserDefined2(): string;
/**
* Returns the third user-defined settings of the user.
*
* @return string Third user-defined settings of the user; otherwise an empty string.
*/
public function getUserDefined3(): string;
/**
* Returns the fourth user-defined settings of the user.
*
* @return string Fourth user-defined settings of the user; otherwise an empty string.
*/
public function getUserDefined4(): string;
/**
* Returns the fifth user-defined settings of the user.
*
* @return string Fifth user-defined settings of the user; otherwise an empty string.
*/
public function getUserDefined5(): string;
/**
* Returns the supervisor of the user.
*
* @return string Supervisor of the user; otherwise an empty string.
*/
public function getSupervisor(): string;
/**
* Returns the user's department.
*
* @return string Department of the user; otherwise an empty string.
*/
public function getDepartment(): string;
/**
* Returns the user's phone number.
*
* @return string Phone number of the user; otherwise an empty string
*/
public function getPhone(): string;
/**
* Returns the user's fax number.
*
* @return string Fax number of the user; otherwise an empty string
*/
public function getFax(): string;
/**
* Returns the user's date format id.
*
* @return int Date format id from the user
*/
public function getDateFormatId(): int;
/**
* Returns the user's date format as specified in their settings. If an invalid date format is configured,
* a default value of YYYY-MM-DD HH:mm:ss is returned.
*
* @return string Date format from the user
*/
public function getDateFormat(): string;
/**
* Returns the user's decimal separator.
*
* @return string User's decimal separator.
*/
public function getDecimalSeparator(): string;
/**
* Returns the user's thousands separator.
*
* @return string User's thousands separator.
*/
public function getThousandsSeparator(): string;
/**
* Returns the user's time zone.
*
* @return string Time Zone of the user
*/
public function getTimezone(): string;
/**
* Returns the user's job functions.
*
* @return string[] user job functions
*
* @throws \JobRouterException
*/
public function getJobFunctions(): array;
/**
* Returns the selected user's profile.
*
* @return int Selected user profile.
*/
public function getUserProfile(): int;
/**
* Checks whether the user has administration rights.
*
* @return bool true has the user administrator rights; otherwise false
*/
public function hasAdminRights(): bool;
/**
* Checks whether the user is the owner of any processes.
*
* @return bool true is the user owner of any processes; otherwise false
*
* @throws \JobRouterException If an error occurs during the database query to fetch the processes
* a JobRouterException containing the DB error message is thrown.
*/
public function hasOwnProcesses(): bool;
/**
* Checks whether the user is in the specified role.
*
* @param string $jobFunction Specified JobFunction name
*
* @return bool true a user in the given JobFunction; otherwise false
*/
public function isInJobFunction(string $jobFunction): bool;
/**
* Checks whether the user is blocked or not.
*
* @return bool true if a user is blocked or not
*/
public function isBlocked(): bool;
}
interface UserManagerInterface
{
/**
* Returns the SDK UserInterface for the specified user name.
*
* @param string $userName Name of the user to be returned
*
* @return \JobRouter\Sdk\UserInterface the SDK UserInterface for the specified user name.
*
* @throws \JobRouterException
* @throws \JobRouter\Authentication\NoActiveAuthenticationException
* @throws \NoInstanceFoundException
*/
public function getUserByUsername(string $userName): \JobRouter\Sdk\UserInterface;
/**
* Returns the currently logged-in JobRouter user as SDK UserInterface.
*
* @return \JobRouter\Sdk\UserInterface the currently logged in JobRouter user as SDK user.
*
* @throws \JobRouterException
* @throws \JobRouter\Authentication\NoActiveAuthenticationException
* @throws \NoInstanceFoundException
*/
public function getCurrentUser(): \JobRouter\Sdk\UserInterface;
}
}
}
namespace JobRouter\Sdk\Template {
if (false) {
interface TwigRendererInterface
{
/**
* Disables the auto_reload option.
*/
public function disableAutoReload(): void;
/**
* Enables the auto_reload option.
*
* <b>Important:</b>
* This method allows you to make changes to the Twig template during development without clearing the
* cache. Using this method will cause Twig to regenerate the template again.
*
* So be careful!
*/
public function enableAutoReload(): void;
/**
* Enables the strict_variables option.
*/
public function enableStrictVariables(): void;
/**
* Disables the strict_variables option.
*/
public function disableStrictVariables(): void;
/**
* Set the absolute template cache path.
*
* <b>Important:</b>
* It is important that this method is executed after calling enableAutoReload(), otherwise the
* revalidation / recompilation of the template will not take effect.
*
* This is only necessary if you want to separate the cache folder from JobRouter. By default, the template
* cache path is located under \<jobrouter-path\>/cache/symfony/prod/twig
*
* @param string $path The absolute path to the compiled templates
*/
public function setTemplateCachePath(string $path): void;
/**
* Set paths where to look for templates
*
* @param string|array $paths A path or an array of paths where to look for templates
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
*
* @throws \Twig\Error\LoaderError When the template path cannot be found
*/
public function setTemplatePath(string|array $paths = [], ?string $rootPath = null): void;
/**
* Renders a template.
*
* @param string $fileName The template file name
* @param array $context The optional template variables
*
* @throws \Twig\Error\LoaderError When the template cannot be found
* @throws \Twig\Error\SyntaxError When an error occurred during compilation
* @throws \Twig\Error\RuntimeError When an error occurred during rendering
*/
public function render(string $fileName, array $context = []): string;
}
}
}