PluginProbe
ShiftController Employee Shift Scheduling / 4.9.66
ShiftController Employee Shift Scheduling v4.9.66
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 +5 -396 trunk4.9.66 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>
@@ -141,8 +130,9 @@
141 130 <pre class="sh4-code">
142 131 GET <?php echo $fullUrl; ?>?from=<?php echo $today; ?>0900&to=<?php echo $today; ?>1430&status_id=draft
143 132 </pre>
144 133
134 +
145 135 <h3 class="hc-underline">__Get Shift__</h3>
146 136 <?php
147 137 $url = $startUrl . 'shifts/&lt;id&gt;';
148 138 $fullUrl = get_rest_url( NULL, $url );
@@ -234,11 +224,8 @@
234 224 <strong>start</strong> (__Start Date Time__, YYYYMMDDHHMM)<br>
235 225 <strong>end</strong> (__End Date Time__, YYYYMMDDHHMM)<br>
236 226 <strong>status_id</strong> (publish, draft)<br>
237 227 <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; ?>
241 228 </p>
242 229
243 230 <p>
244 231 <strong>__Examples__</strong>
@@ -294,11 +281,8 @@
294 281 <strong>start</strong> (__Start Date Time__, YYYYMMDDHHMM) <em>__optional__</em><br>
295 282 <strong>end</strong> (__End Date Time__, YYYYMMDDHHMM) <em>__optional__</em><br>
296 283 <strong>status_id</strong> (publish, draft) <em>__optional__</em><br>
297 284 <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; ?>
301 285 </p>
302 286
303 287 <p>
304 288 <strong>__Examples__</strong>
@@ -399,379 +383,4 @@
399 383 }
400 384 ]
401 385 }
402 386 </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>