PluginProbe
ShiftController Employee Shift Scheduling / 4.9.26
ShiftController Employee Shift Scheduling v4.9.26
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
← All changes | sh4/api/html/view.html.php +21 -499 trunk4.9.26 View file →
@@ -91,25 +91,14 @@
91 91 <strong>to</strong> (__To Date__, YYYYMMDD / __To Date Time__, YYYYMMDDHHMM)<br>
92 92 <strong>status_id</strong> (publish, draft)<br>
93 93 </p>
94 94
95 +<?php if( class_exists('SH4_CFields_Model') ) : ?>
95 96 <?php
96 -$cfields = array();
97 +$f = ShiftController4::$instance->root();
98 +$cfieldsQuery = $f->make('SH4_CFields_Query');
99 +$cfields = $cfieldsQuery->read();
97 100 ?>
98 -<?php if( class_exists('SH4_CFields_Model') or class_exists('SH4_CFields2_Model') ) : ?>
99 -<?php
100 -$cfields = array();
101 -$f = null;
102 -if (class_exists('ShiftController4Legacy_Pro')) {
103 - $f = ShiftController4Legacy_Pro::$instance->root();
104 -} elseif (class_exists('ShiftController4')) {
105 - $f = ShiftController4::$instance->root();
106 -}
107 -if (null !== $f) {
108 - $cfieldsQuery = $f->make('SH4_CFields_Query');
109 - $cfields = $cfieldsQuery->read();
110 -}
111 -?>
112 101 <?php if( $cfields ) : ?>
113 102 <p>
114 103 <strong>__Optional Arguments__</strong>
115 104 </p>
@@ -121,12 +110,8 @@
121 110 </p>
122 111 <?php endif; ?>
123 112 <?php endif; ?>
124 113
125 -<?php
126 -$today = date( 'Ymd' );
127 -?>
128 -
129 114 <p>
130 115 <strong>__Examples__</strong>
131 116 </p>
132 117
@@ -134,15 +119,16 @@
134 119 GET <?php echo $fullUrl; ?>
135 120 </pre>
136 121
137 122 <pre class="sh4-code">
138 -GET <?php echo $fullUrl; ?>?calendar_id=11&from=<?php echo $today; ?>
123 +GET <?php echo $fullUrl; ?>?calendar_id=11&from=20210224
139 124 </pre>
140 125
141 126 <pre class="sh4-code">
142 -GET <?php echo $fullUrl; ?>?from=<?php echo $today; ?>0900&to=<?php echo $today; ?>1430&status_id=draft
127 +GET <?php echo $fullUrl; ?>?from=202102240900&to=202102241430&status_id=draft
143 128 </pre>
144 129
130 +
145 131 <h3 class="hc-underline">__Get Shift__</h3>
146 132 <?php
147 133 $url = $startUrl . 'shifts/&lt;id&gt;';
148 134 $fullUrl = get_rest_url( NULL, $url );
@@ -233,16 +219,13 @@
233 219 <strong>employee_id</strong> (__Employee Id__)<br>
234 220 <strong>start</strong> (__Start Date Time__, YYYYMMDDHHMM)<br>
235 221 <strong>end</strong> (__End Date Time__, YYYYMMDDHHMM)<br>
236 222 <strong>status_id</strong> (publish, draft)<br>
237 -<strong>conflict</strong> (__Set to 1 to allow creation of shifts with conflicts__) <em>__optional__</em><br>
238 -<?php foreach( $cfields as $cfield ) : ?>
239 -<strong><?php echo $cfield->getName(); ?></strong> (<?php echo $cfield->getLabel(); ?>)<br>
240 -<?php endforeach; ?>
223 +<strong>conflict</strong> (__Set to 1 to allow creation of shifts with conflicts__) <em>optional</em><br>
241 224 </p>
242 225
243 226 <p>
244 -<strong>__Examples__</strong>
227 +<strong>Examples</strong>
245 228 </p>
246 229
247 230 <pre class="sh4-code">
248 231 POST <?php echo $fullUrl; ?>
@@ -248,10 +231,10 @@
248 231 POST <?php echo $fullUrl; ?>
249 232
250 233 calendar_id: 11
251 234 employee_id: 22
252 -start: <?php echo $today; ?>0800
253 -end: <?php echo $today; ?>1430
235 +start: 202102240800
236 +end: 202102241430
254 237 status_id: publish
255 238 </pre>
256 239
257 240 <p>
@@ -257,8 +240,9 @@
257 240 <p>
258 241 __If success, it returns the id of the new shift. Otherwise error messages will be given.__
259 242 </p>
260 243
244 +
261 245 <h3 class="hc-underline">__Update Shift__</h3>
262 246 <?php
263 247 $url = $startUrl . 'shifts/&lt;id&gt;';
264 248 $fullUrl = get_rest_url( NULL, $url );
@@ -264,11 +248,8 @@
264 248 $fullUrl = get_rest_url( NULL, $url );
265 249
266 250 $url2 = $startUrl . 'shifts/';
267 251 $fullUrl2 = get_rest_url( NULL, $url2 );
268 -if( '/' == substr($fullUrl2, -1) ){
269 - $fullUrl2 = substr( $fullUrl2, 0, -1 );
270 -}
271 252 ?>
272 253
273 254 <p>
274 255 <strong>
@@ -288,27 +269,24 @@
288 269 <strong>__Arguments__</strong>
289 270 </p>
290 271
291 272 <p>
292 -<strong>calendar_id</strong> (__Calendar Id__) <em>__optional__</em><br>
293 -<strong>employee_id</strong> (__Employee Id__) <em>__optional__</em><br>
294 -<strong>start</strong> (__Start Date Time__, YYYYMMDDHHMM) <em>__optional__</em><br>
295 -<strong>end</strong> (__End Date Time__, YYYYMMDDHHMM) <em>__optional__</em><br>
296 -<strong>status_id</strong> (publish, draft) <em>__optional__</em><br>
297 -<strong>conflict</strong> (__Set to 1 to allow creation of shifts with conflicts__) <em>__optional__</em><br>
298 -<?php foreach( $cfields as $cfield ) : ?>
299 -<strong><?php echo $cfield->getName(); ?></strong> (<?php echo $cfield->getLabel(); ?>)<br>
300 -<?php endforeach; ?>
273 +<strong>calendar_id</strong> (__Calendar Id__) <em>optional</em><br>
274 +<strong>employee_id</strong> (__Employee Id__) <em>optional</em><br>
275 +<strong>start</strong> (__Start Date Time__, YYYYMMDDHHMM) <em>optional</em><br>
276 +<strong>end</strong> (__End Date Time__, YYYYMMDDHHMM) <em>optional</em><br>
277 +<strong>status_id</strong> (publish, draft) <em>optional</em><br>
278 +<strong>conflict</strong> (__Set to 1 to allow creation of shifts with conflicts__) <em>optional</em><br>
301 279 </p>
302 280
303 281 <p>
304 -<strong>__Examples__</strong>
282 +<strong>Examples</strong>
305 283 </p>
306 284
307 285 <pre class="sh4-code">
308 286 PUT <?php echo $fullUrl2; ?>/123
309 -start: <?php echo $today; ?>0900
310 -end: <?php echo $today; ?>1530
287 +start: 202102240900
288 +end: 202102241530
311 289 </pre>
312 290
313 291 <pre class="sh4-code">
314 292 PUT <?php echo $fullUrl2; ?>/123
@@ -318,460 +296,4 @@
318 296 <pre class="sh4-code">
319 297 PUT <?php echo $fullUrl2; ?>/123
320 298 status_id: publish
321 299 </pre>
322 -
323 -<h3 class="hc-underline">__Get Available Employees__</h3>
324 -<?php
325 -$url = $startUrl . 'available-employees';
326 -$fullUrl = get_rest_url( NULL, $url );
327 -?>
328 -
329 -<p>
330 -<strong>
331 -GET <?php echo $url; ?>
332 -</strong>
333 -</p>
334 -
335 -<p>
336 -<strong>__Headers__</strong>
337 -</p>
338 -
339 -<p>
340 -X-WP-ShiftController-AuthCode: <?php echo $current['auth_code']; ?>
341 -</p>
342 -
343 -<p>
344 -<strong>__Arguments__</strong>
345 -</p>
346 -
347 -<p>
348 -<strong>calendar_id</strong> (__Calendar Id__) <em>__optional__</em><br>
349 -<em>__default value__</em>: __all shift-type calendars__<br>
350 -
351 -<strong>from</strong> (__Start Date Time__, YYYYMMDDHHMM) <em>__optional__</em><br>
352 -<em>__default value__</em>: __beginning of today__<br>
353 -
354 -<strong>to</strong> (__End Date Time__, YYYYMMDDHHMM) <em>__optional__</em><br>
355 -<em>__default value__</em>: __one day from the start__<br>
356 -
357 -</p>
358 -
359 -<p>
360 -<strong>__Examples__</strong>
361 -</p>
362 -
363 -<pre class="sh4-code">
364 -GET <?php echo $fullUrl; ?>
365 -</pre>
366 -
367 -<pre class="sh4-code">
368 -GET <?php echo $fullUrl; ?>?from=<?php echo $today; ?>0900&to=<?php echo $today; ?>1430
369 -</pre>
370 -
371 -<pre class="sh4-code">
372 -GET <?php echo $fullUrl; ?>?from=<?php echo $today; ?>&calendar_id=123
373 -</pre>
374 -
375 -<pre class="sh4-code">
376 -GET <?php echo $fullUrl; ?>?calendar_id[]=123&calendar_id[]=456
377 -</pre>
378 -
379 -<p>
380 -<strong>__Example return__</strong>
381 -</p>
382 -
383 -<pre class="sh4-code">
384 -{
385 - "from": "<?php echo $today; ?>0900",
386 - "to": "<?php echo $today; ?>1430",
387 - "employees": [
388 - {
389 - "id": "523",
390 - "title": "Alice",
391 - "email": "alice@host.local",
392 - "username": "alice"
393 - },
394 - {
395 - "id": "527",
396 - "title": "Eve",
397 - "email": "eve@host.local",
398 - "username": "eve"
399 - }
400 - ]
401 -}
402 -</pre>
403 -
404 -<h3 class="hc-underline">__Get All Calendars__</h3>
405 -<?php
406 -$url = $startUrl . 'calendars';
407 -$fullUrl = get_rest_url( NULL, $url );
408 -?>
409 -
410 -<p>
411 -<strong>
412 -GET <?php echo $url; ?>
413 -</strong>
414 -</p>
415 -
416 -<p>
417 -<strong>__Headers__</strong>
418 -</p>
419 -
420 -<p>
421 -X-WP-ShiftController-AuthCode: <?php echo $current['auth_code']; ?>
422 -</p>
423 -
424 -<p>
425 -<strong>__Examples__</strong>
426 -</p>
427 -
428 -<pre class="sh4-code">
429 -GET <?php echo $fullUrl; ?>
430 -</pre>
431 -
432 -<p>
433 -<strong>__Example return__</strong>
434 -</p>
435 -
436 -<pre class="sh4-code">
437 -[
438 - {
439 - "id": "12",
440 - "title": "Barista",
441 - "type": "shift",
442 - "active": "1"
443 - },
444 - {
445 - "id": "13",
446 - "title": "Server",
447 - "type": "shift",
448 - "active": "0"
449 - },
450 - {
451 - "id": "14",
452 - "title": "Holidays",
453 - "type": "timeoff",
454 - "active": "0"
455 - }
456 -]
457 -</pre>
458 -
459 -<h3 class="hc-underline">__Get All Employees__</h3>
460 -<?php
461 -$url = $startUrl . 'employees';
462 -$fullUrl = get_rest_url( NULL, $url );
463 -?>
464 -
465 -<p>
466 -<strong>
467 -GET <?php echo $url; ?>
468 -</strong>
469 -</p>
470 -
471 -<p>
472 -<strong>__Headers__</strong>
473 -</p>
474 -
475 -<p>
476 -X-WP-ShiftController-AuthCode: <?php echo $current['auth_code']; ?>
477 -</p>
478 -
479 -<p>
480 -<strong>__Examples__</strong>
481 -</p>
482 -
483 -<pre class="sh4-code">
484 -GET <?php echo $fullUrl; ?>
485 -</pre>
486 -
487 -<p>
488 -<strong>__Example return__</strong>
489 -</p>
490 -
491 -<pre class="sh4-code">
492 -[
493 - {
494 - "id": "523",
495 - "title": "Alice",
496 - "email": "alice@host.local",
497 - "username": "alice"
498 - },
499 - {
500 - "id": "527",
501 - "title": "Eve",
502 - "email": "eve@host.local",
503 - "username": "eve"
504 - }
505 -]
506 -</pre>
507 -
508 -<h3 class="hc-underline">__Get Calendars For Employee__</h3>
509 -<?php
510 -$url = $startUrl . 'employees/&lt;id&gt;/calendars';
511 -$fullUrl = get_rest_url( null, $url );
512 -
513 -$url2 = $startUrl . 'employees';
514 -$fullUrl2 = get_rest_url( null, $url2 );
515 -?>
516 -
517 -<p>
518 -<strong>
519 -GET <?php echo $url; ?>
520 -</strong>
521 -</p>
522 -
523 -<p>
524 -<strong>__Headers__</strong>
525 -</p>
526 -
527 -<p>
528 -X-WP-ShiftController-AuthCode: <?php echo $current['auth_code']; ?>
529 -</p>
530 -
531 -<p>
532 -<strong>__Examples__</strong>
533 -</p>
534 -
535 -<pre class="sh4-code">
536 -GET <?php echo $fullUrl2; ?>/123/calendars
537 -</pre>
538 -
539 -<h3 class="hc-underline">__Get Employees Eligible For Calendar__</h3>
540 -<?php
541 -$url = $startUrl . 'calendars/&lt;id&gt;/employees';
542 -$fullUrl = get_rest_url( null, $url );
543 -
544 -$url2 = $startUrl . 'calendars';
545 -$fullUrl2 = get_rest_url( null, $url2 );
546 -?>
547 -
548 -<p>
549 -<strong>
550 -GET <?php echo $url; ?>
551 -</strong>
552 -</p>
553 -
554 -<p>
555 -<strong>__Headers__</strong>
556 -</p>
557 -
558 -<p>
559 -X-WP-ShiftController-AuthCode: <?php echo $current['auth_code']; ?>
560 -</p>
561 -
562 -<p>
563 -<strong>__Examples__</strong>
564 -</p>
565 -
566 -<pre class="sh4-code">
567 -GET <?php echo $fullUrl2; ?>/654/employees
568 -</pre>
569 -
570 -<h3 class="hc-underline">__Add Employee To Calendar__</h3>
571 -<?php
572 -$url = $startUrl . 'calendars/&lt;cid&gt;/employees/&lt;eid&gt;';
573 -$fullUrl = get_rest_url( null, $url );
574 -
575 -$url2 = $startUrl . 'calendars';
576 -$fullUrl2 = get_rest_url( null, $url2 );
577 -?>
578 -
579 -<p>
580 -<strong>
581 -POST <?php echo $url; ?>
582 -</strong>
583 -</p>
584 -
585 -<?php
586 -$url = $startUrl . 'employees/&lt;eid&gt;/calendars/&lt;cid&gt;';
587 -$fullUrl = get_rest_url( null, $url );
588 -
589 -$url3 = $startUrl . 'employees';
590 -$fullUrl3 = get_rest_url( null, $url3 );
591 -?>
592 -
593 -<p>
594 -<strong>
595 -POST <?php echo $url; ?>
596 -</strong>
597 -</p>
598 -
599 -<p>
600 -<strong>__Headers__</strong>
601 -</p>
602 -
603 -<p>
604 -X-WP-ShiftController-AuthCode: <?php echo $current['auth_code']; ?>
605 -</p>
606 -
607 -<p>
608 -<strong>__Examples__</strong>
609 -</p>
610 -
611 -<pre class="sh4-code">
612 -POST <?php echo $fullUrl2; ?>/654/employees/123
613 -</pre>
614 -
615 -<pre class="sh4-code">
616 -POST <?php echo $fullUrl3; ?>/123/calendars/654
617 -</pre>
618 -
619 -<h3 class="hc-underline">__Remove Employee From Calendar__</h3>
620 -<?php
621 -$url = $startUrl . 'calendars/&lt;cid&gt;/employees/&lt;eid&gt;';
622 -$fullUrl = get_rest_url( null, $url );
623 -
624 -$url2 = $startUrl . 'calendars';
625 -$fullUrl2 = get_rest_url( null, $url2 );
626 -?>
627 -
628 -<p>
629 -<strong>
630 -DELETE <?php echo $url; ?>
631 -</strong>
632 -</p>
633 -
634 -<?php
635 -$url = $startUrl . 'employees/&lt;eid&gt;/calendars/&lt;cid&gt;';
636 -$fullUrl = get_rest_url( null, $url );
637 -
638 -$url3 = $startUrl . 'employees';
639 -$fullUrl3 = get_rest_url( null, $url3 );
640 -?>
641 -
642 -<p>
643 -<strong>
644 -DELETE <?php echo $url; ?>
645 -</strong>
646 -</p>
647 -
648 -<p>
649 -<strong>__Headers__</strong>
650 -</p>
651 -
652 -<p>
653 -X-WP-ShiftController-AuthCode: <?php echo $current['auth_code']; ?>
654 -</p>
655 -
656 -<p>
657 -<strong>__Examples__</strong>
658 -</p>
659 -
660 -<pre class="sh4-code">
661 -DELETE <?php echo $fullUrl2; ?>/654/employees/123
662 -</pre>
663 -
664 -<pre class="sh4-code">
665 -DELETE <?php echo $fullUrl3; ?>/123/calendars/654
666 -</pre>
667 -
668 -<h3 class="hc-underline">__Get Employee__</h3>
669 -<?php
670 -$url = $startUrl . 'employees/&lt;id&gt;';
671 -$fullUrl = get_rest_url( null, $url );
672 -
673 -$url2 = $startUrl . 'employees';
674 -$fullUrl2 = get_rest_url( null, $url2 );
675 -?>
676 -
677 -<p>
678 -<strong>
679 -GET <?php echo $url; ?>
680 -</strong>
681 -</p>
682 -
683 -<p>
684 -<strong>__Headers__</strong>
685 -</p>
686 -
687 -<p>
688 -X-WP-ShiftController-AuthCode: <?php echo $current['auth_code']; ?>
689 -</p>
690 -
691 -<p>
692 -<strong>__Examples__</strong>
693 -</p>
694 -
695 -<pre class="sh4-code">
696 -GET <?php echo $fullUrl2; ?>/123
697 -</pre>
698 -
699 -<h3 class="hc-underline">__Get Employee By User Id__</h3>
700 -<?php
701 -$url = $startUrl . 'users/&lt;id&gt;/employee';
702 -$fullUrl = get_rest_url( null, $url );
703 -
704 -$url2 = $startUrl . 'users';
705 -$fullUrl2 = get_rest_url( null, $url2 );
706 -?>
707 -
708 -<p>
709 -<strong>
710 -GET <?php echo $url; ?>
711 -</strong>
712 -</p>
713 -
714 -<p>
715 -<strong>__Headers__</strong>
716 -</p>
717 -
718 -<p>
719 -X-WP-ShiftController-AuthCode: <?php echo $current['auth_code']; ?>
720 -</p>
721 -
722 -<p>
723 -<strong>__Examples__</strong>
724 -</p>
725 -
726 -<pre class="sh4-code">
727 -GET <?php echo $fullUrl2; ?>/321/employee
728 -</pre>
729 -
730 -<h3 class="hc-underline">__Create Employee__</h3>
731 -<?php
732 -$url = $startUrl . 'employees';
733 -$fullUrl = get_rest_url( NULL, $url );
734 -?>
735 -
736 -<p>
737 -<strong>
738 -POST <?php echo $url; ?>
739 -</strong>
740 -</p>
741 -
742 -<p>
743 -<strong>__Headers__</strong>
744 -</p>
745 -
746 -<p>
747 -X-WP-ShiftController-AuthCode: <?php echo $current['auth_code']; ?>
748 -</p>
749 -
750 -<p>
751 -<strong>__Arguments__</strong>
752 -</p>
753 -
754 -<p>
755 -<strong>title</strong><br>
756 -<strong>user_id</strong> <em>__optional__</em><br>
757 -<strong>description</strong> <em>__optional__</em><br>
758 -</p>
759 -
760 -<p>
761 -__Either title or user_id required.__ __If user_id is given, it will link the new employee to this WordPress user.__
762 -__If user_id is given without the title, it will create a new employee with this WordPress user's full name as employee's title and link this employee to this user.__
763 -</p>
764 -
765 -<p>
766 -<strong>__Examples__</strong>
767 -</p>
768 -
769 -<pre class="sh4-code">
770 -POST <?php echo $fullUrl; ?>
771 -
772 -title: James
773 -</pre>
774 -
775 -<p>
776 -__If success, it returns the id of the new employee. Otherwise error messages will be given.__
777 -</p>