I would like to keep the event_bar_text display in the first week of a multiple week event, but not on the other weeks of the event. Notice how the events in the attached image display event_bar_text on each week of the event.
Can someone help me with this?
The only way - code modification. You can locate next lines
var copy=this._copy_event(ev);
copy._length=cols-ev._sday;
and replace them as
var copy=this._copy_event(ev);
copy.text = “”;
copy._length=cols-ev._sday;
I found this code in the dhtmlxscheduler.js file:
var B=this._copy_event(L);
B._length=M-L._sday;
And replaced them as:
var B=this._copy_event(L);
B.text="";
B._length=M-L._sday;
But, the change did not help me. I am defining scheduler.templates.event_bar_text with custom text:
//initialize variables
var thiseventtourid = event.tourid;
var returntext = '';
var ttext = '';
var stext = '';
var wtext = '';
var ftext = '';
var etext = '';
var itext = '';
var ttextlen = '';
var stextlen = '';
var wtextlen = '';
var ftextlen = '';
var etextlen = '';
var itextlen = '';
<?php
//build the string of items
//task
mysql_data_seek($Cconstinfo, 0);
while($Rconstinfo = mysql_fetch_array($Cconstinfo)){
if($Rconstinfo['itemtype'] == 'Task'){
$tourid = $Rconstinfo['tourid'];
?>
var thisqtourid = "<?php echo $tourid;?>";
if(thiseventtourid == thisqtourid){
ttext = ttext + '<?php echo $Rconstinfo['itemname'];?>, ';
}
<?php
}
}
//supervisor
mysql_data_seek($Cconstinfo, 0);
while($Rconstinfo = mysql_fetch_array($Cconstinfo)){
if($Rconstinfo['itemtype'] == 'Supervisor'){
$tourid = $Rconstinfo['tourid'];
?>
var thisqtourid = "<?php echo $tourid;?>";
if(thiseventtourid == thisqtourid){
stext = stext + '<?php echo $Rconstinfo['itemname'];?>, ';
}
<?php
}
}
//welder
mysql_data_seek($Cconstinfo, 0);
while($Rconstinfo = mysql_fetch_array($Cconstinfo)){
if($Rconstinfo['itemtype'] == 'Welder'){
$tourid = $Rconstinfo['tourid'];
?>
var thisqtourid = "<?php echo $tourid;?>";
if(thiseventtourid == thisqtourid){
wtext = wtext + '<?php echo $Rconstinfo['itemname'];?>, ';
}
<?php
}
}
//fitter
mysql_data_seek($Cconstinfo, 0);
while($Rconstinfo = mysql_fetch_array($Cconstinfo)){
if($Rconstinfo['itemtype'] == 'Fitter'){
$tourid = $Rconstinfo['tourid'];
?>
var thisqtourid = "<?php echo $tourid;?>";
if(thiseventtourid == thisqtourid){
ftext = ftext + '<?php echo $Rconstinfo['itemname'];?>, ';
}
<?php
}
}
//electrician
mysql_data_seek($Cconstinfo, 0);
while($Rconstinfo = mysql_fetch_array($Cconstinfo)){
if($Rconstinfo['itemtype'] == 'Electrician'){
$tourid = $Rconstinfo['tourid'];
?>
var thisqtourid = "<?php echo $tourid;?>";
if(thiseventtourid == thisqtourid){
etext = etext + '<?php echo $Rconstinfo['itemname'];?>, ';
}
<?php
}
}
//insulator
mysql_data_seek($Cconstinfo, 0);
while($Rconstinfo = mysql_fetch_array($Cconstinfo)){
if($Rconstinfo['itemtype'] == 'Insulator'){
$tourid = $Rconstinfo['tourid'];
?>
var thisqtourid = "<?php echo $tourid;?>";
if(thiseventtourid == thisqtourid){
itext = itext + '<?php echo $Rconstinfo['itemname'];?>, ';
}
<?php
}
}
?>
//concatenate the strings
//task
if(ttext != ''){
//get the length of the string of insulators
ttextlen = ttext.length;
//remove the last two characters - the comma and the space
ttextlen = ttextlen - 2;
ttext = ttext.slice(0, ttextlen);
var ttextlong = ttext;
ttext = ttext.substr(0,85);
ttext = ttext +'...';
//build the jobname string
returntext = returntext + '<span title="Tasks: '+ttextlong+'" style="cursor:default;"><strong>Job: </strong>' + event.jobname +'
';
returntext = returntext + '<strong>Tasks:</strong> ';
returntext = returntext + ttext;
if(stext != '' || wtext != '' || ftext != '' || etext != '' || itext != ''){
returntext = returntext + '
';
}else if(stext == '' && wtext == '' && ftext == '' && etext == '' && itext == ''){
returntext = returntext;
}
}else{
//build the jobname string
returntext = returntext + '<span style="cursor:default;"><strong>Job: </strong>' + event.jobname +'
';
}
//supervisor
if(stext != ''){
//get the length of the string of insulators
stextlen = stext.length;
//remove the last two characters - the comma and the space
stextlen = stextlen - 2;
stext = stext.slice(0, stextlen);
returntext = returntext + '<strong>Supervisor:</strong> ';
returntext = returntext + stext;
if(wtext != '' || ftext != '' || etext != '' || itext != ''){
returntext = returntext + '
';
}else if(wtext == '' && ftext == '' && etext == '' && itext == ''){
returntext = returntext;
}
}
//welder
if(wtext != ''){
//get the length of the string of insulators
wtextlen = wtext.length;
//remove the last two characters - the comma and the space
wtextlen = wtextlen - 2;
wtext = wtext.slice(0, wtextlen);
returntext = returntext + '<strong>Welders:</strong> ';
returntext = returntext + wtext;
if(ftext != '' || etext != '' || itext != ''){
returntext = returntext + '
';
}else if(ftext == '' && etext == '' && itext == ''){
returntext = returntext;
}
}
//fitter
if(ftext != ''){
//get the length of the string of insulators
ftextlen = ftext.length;
//remove the last two characters - the comma and the space
ftextlen = ftextlen - 2;
ftext = ftext.slice(0, ftextlen);
returntext = returntext + '<strong>Fitters:</strong> ';
returntext = returntext + ftext;
if(etext != '' || itext != ''){
returntext = returntext + '
';
}else if(etext == '' && itext == ''){
returntext = returntext;
}
}
//electrician
if(etext != ''){
//get the length of the string of insulators
etextlen = etext.length;
//remove the last two characters - the comma and the space
etextlen = etextlen - 2;
etext = etext.slice(0, etextlen);
returntext = returntext + '<strong>Electricians:</strong> ';
returntext = returntext + etext;
if(itext != ''){
returntext = returntext + '
';
}else if(itext == ''){
returntext = returntext;
}
}
//insulator
if(itext != ''){
//get the length of the string of insulators
itextlen = itext.length;
//remove the last two characters - the comma and the space
itextlen = itextlen - 2;
itext = itext.slice(0, itextlen);
returntext = returntext + '<strong>Insulators:</strong> ';
returntext = returntext + itext;
}
//close the span tag
returntext = returntext + "</span>";
//return the text
return returntext;
In such case you can use
var B=this._copy_event(L);
B.copy=true;
B._length=M-L._sday;
and in your custom template
if (ev.copy) return "";