Voeg de inhoud van de ZIP toe aan assets/js (download)
Voeg de style toe
div.gantt {
font-family: inherit;
font-size: 15px;
color: #656565;
}
.gantt table {
border-collapse: collapse;
}
.gantt td {
padding: 0px;
}
/* cell defaults */
.headweekends div {
font-size: 8px;
width: 100% !important;
margin: 0;
}
.gmajorheading,
.gminorheading,
.gminorheadingwkend,
.gtaskcell,
.gtaskcellwkend {
height: 29px;
font-size: 12px;
border: none;
text-align: center;
cursor: default;
}
.gmajorheading {
border: none;
border-left: @color_links 2px solid;
height: 20px;
font-size: 16px!important;
color: @color_links;
}
.gcharttable .gminorheading {
border-left: fade(@color_links,20%) 2px solid;
border-bottom: none;
}
.gitemmonth .gtaskcell:last-child, .gcharttable .gminorheading:last-child {
border-right: fade(@color_links,20%) 2px solid;
}
.gTIn .gTaskLabel {
display: none;
}
.gminorheading {
border: none;
border-left: @color_links 2px solid;
border-bottom: @color_links 2px solid;
height: 10px!important;
& > div {
display: none;
}
&:beforee {
content: '';
display: block;
height: 20px;
width: 2px;
box-shadow: 1px 1px 1px 0 @color_links;
left: -2.5px;
bottom: -20px;
position: relative;
}
}
.gtaskcell {
padding-right: 8px;
width: 36px;
border: none;
border-left: fade(@color_links,20%) 2px solid;
}
.gtasklist {
height: 29px;
min-width: 5px;
max-width: 5px;
width: 5px;
border: none;
border-right: none;
}
/* all three width values set just to make sure - helps resizing code */
/* Additional values for some cell elements */
.gtaskheading,
.gmajorheading,
.gminorheading {
background-color: #ffffff;
font-weight: bold;
font-size: 9px;
white-space: nowrap;
}
.gtaskcellwkend,
.gminorheadingwkend {
background-color: #f7f7f7;
font-weight: bold;
font-size: 9px;
white-space: nowrap;
}
td.gtaskcell {
text-align: left
}
td.gspanning {
border-left: none;
border-right: none;
}
.gtaskcelldiv {
position: relative;
}
/* Task list defaults */
.gtaskheading,
.gname,
.gtaskname,
.gresource,
.gduration,
.gpccomplete,
.gstartdate,
.gplanstartdate,
.gplanenddate,
.gcost,
.genddate {
height: 18px;
white-space: nowrap;
border: #efefef 1px solid;
}
.gtaskheading div,
.gname div,
.gtaskname div,
.gresource div,
.gduration div,
.gpccomplete div,
.gstartdate div,
.gplanstartdate div,
.gplanenddate div,
.gcost div,
.genddate div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.gtaskbarcontainer.gplan {
position: absolute !important;
top: 0px;
opacity: 0.3;
background: white;
z-index: 10000;
border: 1px solid black;
}
/* Additional values for some task list elements */
/* needed for IE8 */
.gstartdate div,
.gplanstartdate,
.gplanenddate,
.gstartdate,
.genddate {
text-align: center;
min-width: 105px;
width: 105px;
max-width: 105px;
font-size: 10px;
}
.gtaskheading {
text-align: center;
}
.gtaskname div,
/* needed for IE8 */
.gtaskname {
min-width: 170px;
max-width: 170px;
width: 170px;
font-size: 9px;
border-left: none;
}
.gtaskheading,
.gtaskname {
text-overflow: ellipsis;
overflow: hidden;
}
.gtaskname.gtaskeditable div,
.gtaskname.gtaskeditable {
overflow: unset;
}
.gselector {
text-align: left;
white-space: nowrap;
min-width: 170px;
max-width: 170px;
width: 170px;
}
.gformlabel {
position: relative;
top: 0px;
cursor: pointer;
border: #ffffff 1px solid;
margin-left: 2px;
padding-left: 2px;
padding-right: 2px;
}
span.gformlabel:hover,
span.gselected {
background-color: #dbecff;
border: #cccccc 1px solid;
}
span.gfoldercollapse {
color: #000000;
cursor: pointer;
font-weight: bold;
font-size: 12px;
}
.gtasktableh,
.gtasktable {
border-right: #efefef 1px solid;
width: 100%;
}
.gcharttableh,
.gtasktableh,
.gtasktable,
.gcharttable {
border-collapse: collapse;
}
.gcharttable,
.gcharttableh {
table-layout: fixed;
}
.gcharttable {
border: none;
}
/* for some reason firefox needs this */
/* Differentiate Group, Milestone and Ordinary task items (applied to row) */
.ggroupitem {
background-color: #fbfbfb;
font-weight: bold;
}
.gmileitem,
.glineitem {
background-color: #ffffff;
}
/* highlight row (applied to row) */
.gitemhighlight td {
background-image: none;
background-color: transparent;
}
/* task bar caption text styles */
.gmilecaption,
.ggroupcaption,
.gcaption {
font-weight: normal;
font-size: 9px;
text-align: left;
white-space: nowrap;
top: 1px;
position: absolute;
top: 2px;
}
.ggroupcaption,
.gcaption {
right: -126px;
}
/* Task complete %age bar shared attributes */
.gtaskcomplete {
float: left;
overflow: hidden;
}
/* Task complete %age bar */
.gtaskcomplete {
height: 5px;
background-color: #000000;
margin-top: 4px;
opacity: 0.4;
filter: alpha(opacity=40);
}
/* Milestones */
.gmilestone {
font-size: 14px;
position: absolute;
top: -2px;
}
.gmdtop {
top: 2px;
overflow: hidden;
width: 0px;
height: 0px;
border-bottom: 5px solid black;
border-left: 5px solid transparent;
border-top: 5px solid transparent;
border-right: 5px solid transparent;
}
.gmdbottom {
top: 2px;
overflow: hidden;
width: 0px;
height: 0px;
border-top: 5px solid black;
border-left: 5px solid transparent;
border-bottom: 5px solid transparent;
border-right: 5px solid transparent;
}
/* Task bar shared attributes */
.ggroupblack,
.gtaskblue,
.gtaskred,
.gtaskgreen,
.gtaskyellow,
.gtaskpurple,
.gtaskpink {
height: 23px;
filter: alpha(opacity=90);
opacity: 0.9;
margin-top: 1px;
}
/* Task bars - ggroupblack is set as the default class on the task if it is undefined */
.ggroupblack {
height: 7px;
background: #000000;
margin-top: 2px;
}
.ggroupblackendpointleft {
overflow: hidden;
width: 0px;
height: 0px;
top: 2px;
border-top: 4px solid transparent;
border-left: 4px solid transparent;
border-bottom: 4px solid transparent;
border-right: 4px solid transparent;
float: left;
}
.ggroupblackendpointright {
overflow: hidden;
width: 0px;
height: 0px;
top: 2px;
border-top: 4px solid transparent;
border-left: 4px solid transparent;
border-bottom: 4px solid transparent;
border-right: 4px solid transparent;
float: right;
}
.ggroupblackcomplete {
float: left;
overflow: hidden;
height: 3px;
filter: alpha(opacity=80);
opacity: 0.8;
background-color: transparent;
margin-top: 2px;
margin-bottom: 2px;
}
.gtaskred {
background: @color_alt;
color: #fff;
font-size: 15px;
font-weight: bold;
padding: 3.75px 15px;
&:after {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(0, 178, 178, 0);
border-left-color: @color_alt;
border-width: 11.5px;
margin-top: -11.5px;
}
&:hover {
background: @color_links;
&:after {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(0, 178, 178, 0);
border-left-color: @color_links;
border-width: 11.5px;
margin-top: -11.5px;
}
}
}
.gitemhighlight {
.gtaskred {
background: @color_links;
&:after {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(0, 178, 178, 0);
border-left-color: @color_links;
border-width: 11.5px;
margin-top: -11.5px;
}
}
}
.gtaskbluecomplete,
.gtaskredcomplete,
.gtaskgreencomplete,
.gtaskyellowcomplete,
.gtaskpurplecomplete,
.gtaskpinkcomplete {
float: left;
overflow: hidden;
height: 5px;
filter: alpha(opacity=40);
opacity: 0.4;
background-color: #000000;
margin-top: 4px;
}
/* END Task bar styles */
.glinev {
border-left: 1px solid @color_links;
width: 0px;
}
.glineh {
border-top: 1px solid @color_links;
height: 0px;
}
.gDepFS,
.gDepSS,
.gDepSF,
.gDepFF {
border-color: @color_alt;
}
.gDepFSArw,
.gDepSSArw {
overflow: hidden;
width: 0px;
height: 0px;
border-bottom: 4px solid transparent;
border-left: 4px solid @color_alt;
border-top: 4px solid transparent;
border-right: 4px solid transparent;
}
.gDepFFArw,
.gDepSFArw {
overflow: hidden;
width: 0px;
height: 0px;
border-bottom: 4px solid transparent;
border-left: 4px solid transparent;
border-top: 4px solid transparent;
border-right: 4px solid #ff0000;
}
.gCurDate {
border-color: #656565;
border-width: 2px;
}
div.gtaskbarcontainer {
z-index: 1;
position: absolute;
top: 0px
}
.textbar {
word-break: break-all;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 80%;
display: inline-block;
}
.JSGanttToolTip {
position: absolute;
display: block;
z-index: 2;
}
.JSGanttToolTipcont {
font-family: inherit;
font-size: inherit;
display: block;
background: #ffffff;
color: #000
}
.gTaskInfo {
background: #e9e4e2;
width: 500px;
border: #e9e4e2 1px solid;
border-radius: 10px;
padding: 4px 6px 4px 6px;
float: left;
@media @md {
width: 300px;
}
}
.gTtTitle {
display: block;
font-size: 15px;
font-weight: bold;
color: #404040;
margin-left: 4px;
margin-bottom: 1em;
}
.gTaskLabel {
font-size: 15px;
font-weight: bold;
color: #656565;
margin-left: 4px;
}
.gTaskText {
position: absolute;
left: 110px;
padding-top: 1px;
font-size: 15px;
font-weight: normal;
color: #656565;
}
.gTaskNotes {
font-size: 15px;
font-weight: normal;
color: #323232;
padding: 0 0px;
display: block;
}
.gTIn {
padding-top: 10px;
}
.gantt {
min-width: 632px;
/* 2x LC width */
}
.gchartcontainer {
/* padding-left: 532px; LC width */
line-height: 1;
/* Overrides inherited CSS (e.g. from Bootstrap) */
display: flex;
margin-bottom: 80px;
}
.gcontainercol {
position: relative;
}
/* Add a max-height value here if wanted */
.glistgrid {
min-width: 132px;
/* LC width */
float: left;
/* LC width */
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
padding-top: 0px;
background-color: #ffffff;
overflow: hidden;
}
.glistlbl {
min-width: 132px;
/* LC width */
float: left;
/* LC width */
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
padding-top: 0px;
background-color: #ffffff;
overflow: hidden;
flex: none;
}
.glistlbl,
.gchartgrid {
display: flex;
flex-direction: column;
}
.glabelfooter {
clear: both;
}
.ggridfooter {
clear: both;
}
.rhscrpad {
width: 150px;
position: absolute;
top: 0px;
height: 1px;
}
.gchartgrid {
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
padding-top: 0px;
background-color: #ffffff;
position: relative;
/* overflow: auto; */
overflow: unset;
overflow-y: auto;
min-height: 0%;
}
.gchartlbl {
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
padding-top: 0px;
background-color: #ffffff;
position: relative;
overflow: hidden;
flex: none;
}
/* Old Internet Explorer version hacks */
.gantt {
_height: 100%
}
/* otherwise the chart disappears! */
div .gantt {
/* _width: 1064px; ie6 fixed width */
}
div.gchartlbl,
div.gchartgrid {
/* _width: 532px; */
}
/* ie6 fixed width */
div.glistlbl,
div.glistgrid {
*right: 0px;
/* ie7 pulls the content too far left with the negative margin */
_right: 532px;
/* but ie6 fixed width needs this */
_margin-left: -532px;
/* ie6 fixed width */
float: left;
}
div.gchartgrid {
*padding-bottom: 20px;
*overflow-y: hidden;
}
/* variable height design, no need for vertical scroll */
td.gmajorheading div {
*overflow: hidden;
}
/* stops resizing fixed width columns if the text is too wide */
td.gspanning div {
*overflow: hidden;
}
/* stops resizing fixed width columns if the text is too wide */
/* border transparency tricks */
.ggroupblackendpointleft {
_border-top: 4px solid black;
_border-left: 4px solid pink;
_border-bottom: 4px solid pink;
_border-right: 4px solid pink;
_filter: chroma(color=pink);
}
.ggroupblackendpointright {
_border-top: 4px solid black;
_border-left: 4px solid pink;
_border-bottom: 4px solid pink;
_border-right: 4px solid pink;
_filter: chroma(color=pink);
}
.gmdtop {
_border-left: 5px solid pink;
_border-top: 5px solid pink;
_border-right: 5px solid pink;
_filter: chroma(color=pink);
}
.gmdbottom {
_border-left: 5px solid pink;
_border-bottom: 5px solid pink;
_border-right: 5px solid pink;
_filter: chroma(color=pink);
}
.gDepFSArw,
.gDepSSArw {
_border-bottom: 4px solid pink;
_border-top: 4px solid pink;
_border-right: 4px solid pink;
_filter: chroma(color=pink);
}
.gDepFFArw,
.gDepSFArw {
_border-bottom: 4px solid pink;
_border-left: 4px solid pink;
_border-top: 4px solid pink;
_filter: chroma(color=pink);
}
/* Workaround for odd bug in old versions of Opera - no other browser needs this */
.glinediv {
position: absolute;
top: 0px;
left: 0px;
z-index: 1px;
}
.gantt-inputtable {
max-width: 100%;
max-height: 16px;
}
.gadditional {
border: #efefef 1px solid;
}
.gadditional,
.gresource,
.gduration,
.gpccomplete,
.gcost {
text-align: center;
width: 70px;
max-width: 70px;
min-width: 70px;
font-size: 10px;
}
@media print {
/* All your print styles go here */
html,
.gchartgrid {
overflow: unset !important;
}
.glistgrid {
float: none !important;
}
}
/* if using setUseSingleCell(1) the following is a suggested set of CSS3 styles to recreate the table grid - won't work on old browsers
.ggrouphour td,
.gmilehour td,
.gitemhour td { background-size: 19px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 18px); width: 100%; height: 19px; }
.ggroupday td,
.gmileday td,
.gitemday td { background-size: 19px 1px, 133px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 18px), linear-gradient(to left, #f7f7f7 39px, transparent 1px, transparent 92px); width: 100%; height: 19px; }
.ggroupweek td,
.gmileweek td,
.gitemweek td { background-size: 37px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 36px); width: 100%; height: 19px; }
.ggroupmonth td,
.gmilemonth td,
.gitemmonth td { background-size: 37px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 36px); width: 100%; height: 19px; }
.ggroupquarter td,
.gmilequarter td,
.gitemquarter td { background-size: 19px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 18px); width: 100%; height: 19px; }
*/
.gmain {
height: 100%;
display: flex;
flex-direction: column;
}
.gmainright {
overflow: hidden;
flex: 0 0 100%;
}
.gmainleft {
overflow: hidden;
flex: 0 0 0%;
}
.gtasktableh tr,
.gcharttable tr,
.gcharttableh,
.gtasktable tr {
height: 35px !important;
}
.gtasktableouterwrapper {
overflow: hidden;
}
.gtasktablewrapper {
overflow-y: scroll;
flex: auto;
height: 100%;
}
.chartgrid {
overflow: auto;
flex: auto;
}
/* .gtasktable {
margin-bottom: 14px;
} */
/* Printer friendly styles - we could use these all the time but they are not as pretty! */
/* note that "@media print" is not supported in IE6 or 7. Fully patched IE8 should be OK */
@media print {
.ggroupblack {
height: 0px;
border-top: 7px solid;
border-color: #000000;
}
.gtaskred {
height: 0px;
border-top: 23px solid;
border-color: @color_alt;
}
.gtaskbluecomplete,
.gtaskredcomplete,
.gtaskgreencomplete,
.gtaskyellowcomplete,
.gtaskpurplecomplete,
.gtaskpinkcomplete {
height: 0px;
filter: alpha(opacity=40);
opacity: 0.4;
margin-top: -9px;
border-top: 5px solid;
border-color: #000000;
}
.ggroupblackcomplete {
height: 0px;
filter: alpha(opacity=80);
opacity: 0.8;
margin-top: -5px;
border-top: 3px solid;
border-color: #777777;
}
.gmainright,
.gmainleft {
overflow: hidden;
width: auto;
}
table {
page-break-after: auto
}
tr {
page-break-inside: avoid;
page-break-after: auto
}
td {
page-break-inside: avoid;
page-break-after: auto
}
thead {
display: table-header-group
}
tfoot {
display: table-footer-group
}
}
/* Fix for OSx trackpad hiding the scroll bars*/
.frame::-webkit-scrollbar {
-webkit-appearance: none;
}
.frame::-webkit-scrollbar:vertical {
width: 11px;
}
.frame::-webkit-scrollbar:horizontal {
height: 11px;
}
.frame::-webkit-scrollbar-thumb {
border-radius: 8px;
border: 2px solid white;
/* should match background, can't be transparent */
background-color: rgba(0, 0, 0, .5);
}
.frame::-webkit-scrollbar-track {
background-color: #fff;
border-radius: 8px;
}
.gscrollbar-calculation-container {
visibility: hidden;
overflow: scroll;
-ms-overflow-style: scrollbar;
display: block;
}
Voeg de scripts toe
wp_register_script('gantt', get_template_directory_uri() . '/assets/js/jsgantt.js', array(), '1.5.7');
wp_enqueue_script('gantt'); // Enqueue it!
Voeg de ACF veldgroep toe
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_5ec4f1390ad38',
'title' => 'Planning',
'fields' => array(
array(
'key' => 'field_5ec4f13f9e0fc',
'label' => 'Planning',
'name' => 'planning',
'type' => 'repeater',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'collapsed' => 'field_5ec4f1639e0ff',
'min' => 0,
'max' => 0,
'layout' => 'row',
'button_label' => 'Nieuwe regel',
'sub_fields' => array(
array(
'key' => 'field_5ec4f1479e0fd',
'label' => 'Startdatum',
'name' => 'startdatum',
'type' => 'date_picker',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'display_format' => 'd/m/Y',
'return_format' => 'Y-m-d',
'first_day' => 1,
),
array(
'key' => 'field_5ec4f15d9e0fe',
'label' => 'Einddatum',
'name' => 'einddatum',
'type' => 'date_picker',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'display_format' => 'd/m/Y',
'return_format' => 'Y-m-d',
'first_day' => 1,
),
array(
'key' => 'field_5ec4f1639e0ff',
'label' => 'Titel',
'name' => 'titel',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array(
'key' => 'field_5ec4f1679e100',
'label' => 'Tekst',
'name' => 'tekst',
'type' => 'textarea',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'maxlength' => '',
'rows' => '',
'new_lines' => '',
),
),
),
),
'location' => array(
array(
array(
'param' => 'page_template',
'operator' => '==',
'value' => 'page-planning.php',
),
),
),
'menu_order' => -1,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
));
endif;
Voeg de code toe aan de template
<?php if( have_rows('planning') ): ?>
<div style="position:relative" class="gantt" id="GanttChartDIV"></div>
<script type="text/javascript">
var g = new JSGantt.GanttChart(document.getElementById('GanttChartDIV'), 'month');
g.setOptions({
vCaptionType: 'None', // Set to Show Caption : None,Caption,Resource,Duration,Complete,
vQuarterColWidth: 36,
vDateTaskDisplayFormat: 'month yyyy', // Shown in tool tip box
vDayMajorDateDisplayFormat: 'mon yyyy',// Set format to display dates in the "Major" header of the "Day" view
vWeekMinorDateDisplayFormat: 'dd mon', // Set format to display dates in the "Minor" header of the "Week" view
vLang: 'nl',
vShowRes: 0,
vShowDur: 0,
vShowComp: 0,
vShowStartDate: 0,
vShowEndDate: 0,
vShowCost: 0,
vShowTaskInfoRes: 0,
vShowTaskInfoDur: 0,
vShowTaskInfoComp: 0,
vShowDeps: 0,
//vTotalHeight: '500px',
vShowTaskInfoLink: 0, // Show link in tool tip (0/1)
vShowEndWeekDate: 0, // Show/Hide the date for the last day of the week in header for daily view (1/0)
vUseSingleCell: 5000, // Set the threshold at which we will only use one cell per table row (0 disables). Helps with rendering performance for large charts.
vFormatArr: ['Month', 'Quarter'], // Even with setUseSingleCell using Hour format on such a large chart can cause issues in some browsers
//vScrollTo: dateString,
//vEventClickRow: console.log
});
<?php while ( have_rows('planning') ) : the_row();
$nummer = get_row_index();
$titel = get_sub_field('titel');
$tekst = get_sub_field('tekst');
$start = get_sub_field('startdatum');
$eind = get_sub_field('einddatum');
?>
g.AddTaskItemObject({
pID: <?php echo $nummer; ?>,
pName: "<?php echo $titel; ?>",
pStart: "<?php echo $start; ?>",
pEnd: "<?php echo $eind; ?>",
pPlanStart: "<?php echo $start; ?>",
pPlanEnd: "<?php echo $eind; ?>",
pClass: "gtaskred",
pLink: "",
pMile: 0,
pRes: "",
pComp: 0,
pGroup: 0,
pParent: 0,
pOpen: 1,
pDepend: "",
pCaption: "",
pCost: 1000,
pNotes: "<?php echo $tekst; ?>",
pBarText: "<?php echo $titel; ?>",
category: "",
sector: ""
});
//g.AddTaskItem(new JSGantt.TaskItem(<?php echo $nummer; ?>, '<?php echo $titel; ?>', '<?php echo $start; ?>', '<?php echo $eind; ?>', 'gtaskred', '', 0, '', 1, 0, 12, 1, '', '', '<?php echo $tekst; ?>', g));
<?php endwhile; ?>
g.Draw();
</script>
<?php else : endif; ?>
#acf #functions #gantt #planning