Author Topic: Procalendar Droplet time help  (Read 3277 times)

Offline Roych

  • Betatester
  • **
  • Posts: 573
  • Gender: Male
Procalendar Droplet time help
« on: November 06, 2015, 11:12:31 AM »
Hello


I'm having this problem with my droplet for procalendar for some time now, but can't figure it out, and would realy like to get ridd of it. I hope someone knows what is wrong here.


Problem is that the dropletit self is working fine, but if there are two events which have the same hour it only shows the first one and not both.
So if I create multiple events and they all start at 12:00 it only shows the first one created and then I have to make others like 12:01, 12:02, etc....


Any ideas what could be wrong here?


My droplet:
Code: [Select]
if (PAGE_ID != 3) {




//:Show next #N events
//:
// Get_Concerts
global $database, $wb;


setlocale (LC_ALL, 'sl_SI.UTF-8'); //za vse kategorije
setlocale (LC_TIME, 'sl_SI.UTF-8'); //za datumske funkcije


// Show how many items, defaults to 10?
if ( !isset($max) ){ $max = 10; };


// year and month and section defaults
if(!isset($year)) {$year = date('Y', time()); }
if(!isset($month)) {$month = date('n', time()); }
if(!isset($section_id)) {$section_id = 0 ; }




// Set dateformat to suit your needs, add timeformat if needed
$dateformat = 'd'; // Standard php date formats
$datemonth = 'M'; // Standard php date formats
$dateyear = 'Y'; // Standard php date formats


// Fetch base page link, if event_id = set
$extrasql = '';
$page_id = 0;
$page_link ='';


if ($section_id<>0) {
$extrasql = " section_id = '".$section_id."' AND ";
$sql = "SELECT page_id FROM ".TABLE_PREFIX."sections WHERE section_id = '".$section_id."'";
$result = $database->query($sql);
if ( $result->numRows() > 0 ) {
while( $row = $result->fetchRow() ) {
$page_id = $row['page_id'];
}
}
if ($page_id <> 0) {
$sql = "SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".$page_id."'";
$result = $database->query($sql);
if ( $result->numRows() > 0 ) {
while( $row = $result->fetchRow() ) {
$page_link = page_link($row['link']);
}
}
}
}


// Set start- and end date for query
// $datestart = "$year-$month-1"; ORIGINAL = show all events in this month
$datestart = date("Y-m-d"); // ALTERNATIVE = show all events in this month, starting today
$dateend = "$year-$month-".cal_days_in_month(CAL_GREGORIAN, $month,$year);
$mod_list = "";
$mod_list.= '<h4>Prihajajoči dogodki</h4><hr>';
// Fetch the items
$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_actions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 0, ".$max." ";
$mod_query = $database->query($sql);
while ( $row =& $mod_query->fetchRow()){
// Build url like : pages/kalendar.php?id=2&detail=1
$page_url = $page_link.'?id='.$row['id'].'&amp;detail=1';
$ds = $row['date_start']." ".substr($row['time_start'],0,5);
$de = $row['date_end']." ".substr($row['time_end'],0,5);
$datetime_start = mktime(substr($ds,11,2),substr($ds,14,2),0,substr($ds,5,2),substr($ds,8,2),substr($ds,0,4));
$datetime_end = mktime(substr($de,11,2),substr($de,14,2),0,substr($de,5,2),substr($de,8,2),substr($de,0,4));
if ($row['time_start'] !== $printTime) {
    $printTime = $row['time_start'];
 

$mod_list.= '<ul class="upcoming-events"><li>
<div class="date"><span><span class="day">'.date($dateformat,$datetime_start).'</span><span><span class="month">'.date($datemonth,$datetime_start).'</span><span><span class="year">'.date($dateyear,$datetime_start).'</span><>';






 if(date('Y-m-d',$datetime_start)==date('Y-m-d')){
    $mod_list.= '<div class="event-content"><h6><a href="'.$page_url.'">'.$row["name"].'</a></h6>
<ul class="event-meta"><li><i class="fa fa-clock-o">&nbsp;&nbsp;</i>'.substr($printTime,0,5).'<sup>h</sup>&nbsp;&nbsp;




<div class="Danes-text">Danes!<>


</li>


<!-- <li><i class="fa fa-info-circle">&nbsp;&nbsp;</i>'.$row["custom1"].'</li> -->


</ul><></li></ul>';
 }
 
 else{
    $mod_list.= '<div class="event-content"><h6><a href="'.$page_url.'">'.$row["name"].'</a></h6>
<ul class="event-meta" style="float:left;"><li><i class="fa fa-clock-o">&nbsp;&nbsp;</i>'.substr($printTime,0,5).'<sup>h</sup></li>
<!-- <li><i class="fa fa-info-circle">&nbsp;&nbsp;</i>'.$row["custom1"].'</li> --></ul><></li></ul>';
 }


   }
$mod_list .= "<hr>";
 
}
$mod_list .= '<a href="[wblink13]#izobrazevanja" class="button transparent button-arrow" style="margin-top:-10px;">Napovednik</a><br></br>';
 
 return $mod_list;


 }


Here is the site and image: (right sidebar)
http://www.bi-center.eu/si/izobrazevanja/





I hope someone finds what is wrong, would really appreciate some help on this one.  ;) [size=78%] [/size]


Thank you very much


R

Offline Roych

  • Betatester
  • **
  • Posts: 573
  • Gender: Male
Re: Procalendar Droplet time help
« Reply #1 on: November 08, 2015, 10:44:49 AM »
Anyone?  :|

Offline jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Procalendar Droplet time help
« Reply #2 on: November 08, 2015, 11:10:02 AM »
hi,

is it possible to send me a sql-export from the 3 procalendar-tables via email?
- mod_procalendar_act ions
- mod_procalendar_set tings
- mod_procalendar_eve ntgroups
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Procalendar Droplet time help
« Reply #3 on: November 08, 2015, 11:29:41 AM »
my first look...

you need a (intern) counter in the last select, startet in line 68 of your code
if the select found some entry, it goes into a loop, but every new loop overwrite the results from the last loop and because of that you have only one entry for this special day

i'll search for the other droplets, so that we use the same way or we have to rewrite the loop output here
give me some minutes...  :wink:
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Procalendar Droplet time help
« Reply #4 on: November 08, 2015, 12:55:55 PM »
search for this lines in your postet code

Code: [Select]
while ( $row =& $mod_query->fetchRow()){
// Build url like : pages/kalendar.php?id=2&detail=1


add this line to count the events from the select in the line before the while started

Code: [Select]
$allEntrys = $mod_query->numRows();
and this for-loop after the line with the while

Code: [Select]
for($i = 0; $i < sizeof($allEntrys); $i++){
now you need a closed } before the line with the else (nearly at the end)

Code: [Select]
</ul><></li></ul>';
         }
}
 else{

P.S. Looks for me that you also have to fix the html-output for the div's in the event-list (missing closed div's etc)
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline Roych

  • Betatester
  • **
  • Posts: 573
  • Gender: Male
Re: Procalendar Droplet time help
« Reply #5 on: November 08, 2015, 10:21:25 PM »
Hello.


Thank you for helping me on this. I tried your suggestions but cant get it to work it doesn't make any difference or am I doing something wrong. Im not a coder so Im posting my edited code below.
I tried all kinds of posibillities that I would think off, but couldn't make it work.


Code: [Select]
if (PAGE_ID != 3) {






//:Show next #N events
//:
// Get_Concerts
global $database, $wb;


setlocale (LC_ALL, 'sl_SI.UTF-8'); //za vse kategorije
setlocale (LC_TIME, 'sl_SI.UTF-8'); //za datumske funkcije


// Show how many items, defaults to 10?
if ( !isset($max) ){ $max = 10; };


// year and month and section defaults
if(!isset($year)) {$year = date('Y', time()); }
if(!isset($month)) {$month = date('n', time()); }
if(!isset($section_id)) {$section_id = 0 ; }




// Set dateformat to suit your needs, add timeformat if needed
$dateformat = 'd'; // Standard php date formats
$datemonth = 'M'; // Standard php date formats
$dateyear = 'Y'; // Standard php date formats


// Fetch base page link, if event_id = set
$extrasql = '';
$page_id = 0;
$page_link ='';


if ($section_id<>0) {
$extrasql = " section_id = '".$section_id."' AND ";
$sql = "SELECT page_id FROM ".TABLE_PREFIX."sections WHERE section_id = '".$section_id."'";
$result = $database->query($sql);
if ( $result->numRows() > 0 ) {
while( $row = $result->fetchRow() ) {
$page_id = $row['page_id'];
}
}
if ($page_id <> 0) {
$sql = "SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".$page_id."'";
$result = $database->query($sql);
if ( $result->numRows() > 0 ) {
while( $row = $result->fetchRow() ) {
$page_link = page_link($row['link']);
}
}
}
}


// Set start- and end date for query
// $datestart = "$year-$month-1"; ORIGINAL = show all events in this month
$datestart = date("Y-m-d"); // ALTERNATIVE = show all events in this month, starting today
$dateend = "$year-$month-".cal_days_in_month(CAL_GREGORIAN, $month,$year);
$mod_list = "";
$mod_list.= '<h4>Prihajajoči dogodki</h4><hr>';
// Fetch the items
$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_actions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 0, ".$max." ";
$mod_query = $database->query($sql);


while ( $row =& $mod_query->fetchRow())
{
$allEntrys = $mod_query->numRows();// Build url like : pages/kalendar.php?id=2&detail=1
$page_url = $page_link.'?id='.$row['id'].'&amp;detail=1';
$ds = $row['date_start']." ".substr($row['time_start'],0,5);
$de = $row['date_end']." ".substr($row['time_end'],0,5);
$datetime_start = mktime(substr($ds,11,2),substr($ds,14,2),0,substr($ds,5,2),substr($ds,8,2),substr($ds,0,4));
$datetime_end = mktime(substr($de,11,2),substr($de,14,2),0,substr($de,5,2),substr($de,8,2),substr($de,0,4));
if ($row['time_start'] !== $printTime) {
    $printTime = $row['time_start'];
 

$mod_list.= '<ul class="upcoming-events"><li>
<div class="date"><span><span class="day">'.date($dateformat,$datetime_start).'</span><span><span class="month">'.date($datemonth,$datetime_start).'</span><span><span class="year">'.date($dateyear,$datetime_start).'</span><>';






 if(date('Y-m-d',$datetime_start)==date('Y-m-d')) {
 for($i = 0; $i < sizeof($allEntrys); $i++){
    $mod_list.= '<div class="event-content"><h6><a href="'.$page_url.'">'.$row["name"].'</a></h6>
<ul class="event-meta"><li><i class="fa fa-clock-o">&nbsp;&nbsp;</i>'.substr($printTime,0,5).'<sup>h</sup>&nbsp;&nbsp;






<div class="Danes-text">Danes!<>








</li>


<!-- <li><i class="fa fa-info-circle">&nbsp;&nbsp;</i>'.$row["custom1"].'</li> -->






</ul><></li></ul>';
 }}
 
 else{
    $mod_list.= '<div class="event-content"><h6><a href="'.$page_url.'">'.$row["name"].'</a></h6>
<ul class="event-meta" style="float:left;"><li><i class="fa fa-clock-o">&nbsp;&nbsp;</i>'.substr($printTime,0,5).'<sup>h</sup></li>
<!-- <li><i class="fa fa-info-circle">&nbsp;&nbsp;</i>'.$row["custom1"].'</li> --></ul><></li></ul>';
 }


















   }
$mod_list .= "<hr>";
 
}
$mod_list .= '<a href="[wblink13]#izobrazevanja" class="button transparent button-arrow" style="margin-top:-10px;">Napovednik</a><br></br>';
 
 return $mod_list;


 }

I also sent you mysql exports via email.

I hope I pasted your codes in the right place.


again Thank you very very much


R
« Last Edit: November 08, 2015, 10:30:57 PM by Roych »

Offline jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Procalendar Droplet time help
« Reply #6 on: November 09, 2015, 12:33:56 AM »
this must be work, but not testet

Code: [Select]
if (PAGE_ID != 3) {






//:Show next #N events
//:
// Get_Concerts
global $database, $wb;


setlocale (LC_ALL, 'sl_SI.UTF-8'); //za vse kategorije
setlocale (LC_TIME, 'sl_SI.UTF-8'); //za datumske funkcije


// Show how many items, defaults to 10?
if ( !isset($max) ){ $max = 10; };


// year and month and section defaults
if(!isset($year)) {$year = date('Y', time()); }
if(!isset($month)) {$month = date('n', time()); }
if(!isset($section_id)) {$section_id = 0 ; }




// Set dateformat to suit your needs, add timeformat if needed
$dateformat = 'd'; // Standard php date formats
$datemonth = 'M'; // Standard php date formats
$dateyear = 'Y'; // Standard php date formats


// Fetch base page link, if event_id = set
$extrasql = '';
$page_id = 0;
$page_link ='';


if ($section_id<>0) {
$extrasql = " section_id = '".$section_id."' AND ";
$sql = "SELECT page_id FROM ".TABLE_PREFIX."sections WHERE section_id = '".$section_id."'";
$result = $database->query($sql);
if ( $result->numRows() > 0 ) {
while( $row = $result->fetchRow() ) {
$page_id = $row['page_id'];
}
}
if ($page_id <> 0) {
$sql = "SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".$page_id."'";
$result = $database->query($sql);
if ( $result->numRows() > 0 ) {
while( $row = $result->fetchRow() ) {
$page_link = page_link($row['link']);
}
}
}
}


// Set start- and end date for query
// $datestart = "$year-$month-1"; ORIGINAL = show all events in this month
$datestart = date("Y-m-d"); // ALTERNATIVE = show all events in this month, starting today
$dateend = "$year-$month-".cal_days_in_month(CAL_GREGORIAN, $month,$year);
$mod_list = "";
$mod_list.= '<h4>Prihajajoci dogodki</h4><hr>';
// Fetch the items
$sql = "SELECT DAY(date_start) AS day, id, custom1, date_start, time_start, date_end, time_end, name FROM ".TABLE_PREFIX."mod_procalendar_actions WHERE ".$extrasql." date_start >='$datestart' AND public_stat = 0 ORDER BY date_start,time_start LIMIT 0, ".$max." ";
$mod_query = $database->query($sql);
$allEntrys = $mod_query->numRows();

while ( $row =& $mod_query->fetchRow())
{
for($i = 0; $i < sizeof($allEntrys); $i++){
// Build url like : pages/kalendar.php?id=2&detail=1
$page_url = $page_link.'?id='.$row['id'].'&amp;detail=1';
$ds = $row['date_start']." ".substr($row['time_start'],0,5);
$de = $row['date_end']." ".substr($row['time_end'],0,5);
$datetime_start = mktime(substr($ds,11,2),substr($ds,14,2),0,substr($ds,5,2),substr($ds,8,2),substr($ds,0,4));
$datetime_end = mktime(substr($de,11,2),substr($de,14,2),0,substr($de,5,2),substr($de,8,2),substr($de,0,4));
if ($row['time_start'] !== $printTime) {
       $printTime = $row['time_start'];


$mod_list.= '<ul class="upcoming-events"><li>
<div class="date"><span><span class="day">'.date($dateformat,$datetime_start).'</span><span><span class="month">'.date($datemonth,$datetime_start).'</span><span><span class="year">'.date($dateyear,$datetime_start).'</span><>';

if(date('Y-m-d',$datetime_start)==date('Y-m-d')) {

    $mod_list.= '<div class="event-content"><h6><a href="'.$page_url.'">'.$row["name"].'</a></h6>
<ul class="event-meta"><li><i class="fa fa-clock-o">&nbsp;&nbsp;</i>'.substr($printTime,0,5).'<sup>h</sup>&nbsp;&nbsp;


<div class="Danes-text">Danes!<>

</li>


<!-- <li><i class="fa fa-info-circle">&nbsp;&nbsp;</i>'.$row["custom1"].'</li> -->

</ul><></li></ul>';
    }
}

 else{
    $mod_list.= '<div class="event-content"><h6><a href="'.$page_url.'">'.$row["name"].'</a></h6>
<ul class="event-meta" style="float:left;"><li><i class="fa fa-clock-o">&nbsp;&nbsp;</i>'.substr($printTime,0,5).'<sup>h</sup></li>
<!-- <li><i class="fa fa-info-circle">&nbsp;&nbsp;</i>'.$row["custom1"].'</li> --></ul><></li></ul>';
 }
}
$mod_list .= "<hr>";

}
$mod_list .= '<a href="[wblink13]#izobrazevanja" class="button transparent button-arrow" style="margin-top:-10px;">Napovednik</a><br></br>';

 return $mod_list;


 }
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline Roych

  • Betatester
  • **
  • Posts: 573
  • Gender: Male
Re: Procalendar Droplet time help
« Reply #7 on: November 09, 2015, 10:33:32 AM »
I tried your code but it messes all up (html & css I guess), but deletes the event text it only shows the date but no other text. The 24th and 02 are different events.
The 12th and 18th are the the one that should work.






Any ideas?


R

Offline jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Procalendar Droplet time help
« Reply #8 on: November 09, 2015, 01:50:23 PM »
i tried with your datas from the mail  in the afternoon - it looks good for me in my private test yesterday with my datas's, but i think, there are a lot of differents between ours datas ;-)
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline Roych

  • Betatester
  • **
  • Posts: 573
  • Gender: Male
Re: Procalendar Droplet time help
« Reply #9 on: November 09, 2015, 03:31:20 PM »
Oh, so any ideas what could be wrong? It just looks weird when on site. Or any suggestion what should I do to fix this?


R

Offline Roych

  • Betatester
  • **
  • Posts: 573
  • Gender: Male
Re: Procalendar Droplet time help
« Reply #10 on: November 09, 2015, 04:15:54 PM »
I found out that if I add seconds when adding a time like 17:00:00 and the next event 17:00:01 it's good but this could be just temporary solution, I need to find the right one.


Thank you


R.

Offline marmot

  • Posts: 1103
Re: Procalendar Droplet time help
« Reply #11 on: November 09, 2015, 05:20:51 PM »
Hi,

Oh, so any ideas what could be wrong? It just looks weird when on site. Or any suggestion what should I do to fix this?
in your code from posting 1 find
Code: [Select]
if ($row['time_start'] !== $printTime) { <--------- delete
    $printTime = $row['time_start'];
...... lots of code here
} <----------- delete
$mod_list .= "<hr>";
an delete the two lines marked.
For what ever the reason was, these two lines mean:
remember the starttime and if the next starttime is the same, do not show the event.

regards

Offline Roych

  • Betatester
  • **
  • Posts: 573
  • Gender: Male
Re: Procalendar Droplet time help
« Reply #12 on: November 09, 2015, 05:33:42 PM »
Hi,

Oh, so any ideas what could be wrong? It just looks weird when on site. Or any suggestion what should I do to fix this?
in your code from posting 1 find
Code: [Select]
if ($row['time_start'] !== $printTime) { <--------- delete
      $printTime = $row['time_start'];
...... lots of code here
} <----------- delete
$mod_list .= "<hr>";
an delete the two lines marked.
For what ever the reason was, these two lines mean:
remember the starttime and if the next starttime is the same, do not show the event.

regards




Yeeey, that did the trick, thank you so much for help, it was so anoying.  (Y)


Thank you both for help


R