Jump to content

Suggestion - Calendar hook


svit

Recommended Posts

Posted

After using the calendar hook for some time I would suggest it gives the admins option to choose how many upcoming events is to be shown in it. At present you can choose how many days it is monitoring and showing, this however has uncontrollable impact on the main page layout. If I set for example 30 days, it may be that there is no event in such case the block stays empty, but next day someone enters 15 events which completely breaks the mainpage layout, in such case I have to change the setting of the hook to say 10 days so I shrink it back. I we have set to have ti displaying 5 events I would know my main page looks as it should be.

Posted

ACP > IP.Calendar > Calendar Settings
Show forthcoming calendar events = Yes
Show forthcoming events from today to [x] days ahead = 30

ACP > IP.Calendar > "Name of your calendar"
Event Limit = 2

Doesn't that limit the displayed events for each day to only 2? That's still 60 entries if there is at least 2 per day, every single day for next month.

  • 3 weeks later...
Posted

Thanks Freeborne, but my issue was that I needed the hook to show only say 5 events of all that users submit i don's see how this advise would make this happen?

Posted

ACP > Look & Feel > Edit your chosen skin(s) > Templates > Calendar > boardIndexCalEvents.

Pretty sure that's the code used to display the 'hook' block on the side of your forums.

You would need to change the "foreach loop" so it only loops 5 times. I don't know PHP to do this, so a search on forums should give you an idea or expert help.

For example you could put the contents between the "foreach" tags inside an IF statement that says something like


    <ul class='ipsList_withminiphoto'>

	 <foreach loop="upcomingevents:$events as $event">

      <if 'eventscount' < '6'>

	  <li class='clearfix'>

	   <a href='{$event['url']}' title='{$event['date']}'>{$event['title']}</a>

	   <br /> <span class='date ipsType_small desc'>{$this->lang->words['next_occurrence']} {$event['date']}</span>

	  </li>

      <'eventscount' = 'eventscounts'+'1'>

	 </foreach>

      </if>

    </ul>



LOL that's obviously wrong code, but hopefully gives you an idea what I mean. It should only generate a calendar event and add to the block as long as the count is 0-5. When it gets to 6 it would exit the loop. That's the theory anyway, don't know the code to make it happen or even if you need to declare the 'eventscount' variable before the condition, etc :(

Posted

Thank you, the code looks like this

<if test="calendarEventsOuter:|:$events OR !$this->settings['autohide_calendar']">

<div class='ipsSideBlock clearfix'>

  <h3>{$this->lang->words['upcoming_events']}</h3>

  <div class='_sbcollapsable'>

   <if test="calendarEventsInner:|:is_array( $events )">

    <ul class='ipsList_withminiphoto'>

	 <foreach loop="upcomingevents:$events as $event">

	  <li class='clearfix'>

	   <a href='{$event['url']}' title='{$event['date']}'>{$event['title']}</a>

	   <br /> <span class='date ipsType_small desc'>{$this->lang->words['next_occurrence']} {$event['date']}</span>

	  </li>

	 </foreach>

    </ul>

   <else />

    <span class='desc'>{$events}</span>

   </if>

  </div>

</div>

</if>



and I wasn't able to identify where to change the count 0-5 :)

Posted

Thank you, the code looks like this



<if test="calendarEventsOuter:|:$events OR !$this->settings['autohide_calendar']">

<div class='ipsSideBlock clearfix'>

  <h3>{$this->lang->words['upcoming_events']}</h3>

  <div class='_sbcollapsable'>

   <if test="calendarEventsInner:|:is_array( $events )">

	<ul class='ipsList_withminiphoto'>

	 <foreach loop="upcomingevents:$events as $e => $event">

<if test="$e<4">

	  <li class='clearfix'>

	   <a href='{$event['url']}' title='{$event['date']}'>{$event['title']}</a>

	   <br /> <span class='date ipsType_small desc'>{$this->lang->words['next_occurrence']} {$event['date']}</span>

	  </li>

</if>

	 </foreach>

	</ul>

   <else />

	<span class='desc'>{$events}</span>

   </if>

  </div>

</div>

</if>



and I wasn't able to identify where to change the count 0-5 :smile:


maybe? not solid on that at all tbh.
Posted

yest, that's why i have started the topics, as the hook is growing and growing, it seems i should rather contact the support team..

Posted

adminapplications_addonipscalendarsourceshooks.php
line 337~
find:


foreach( $events as $event )

  {

   //-----------------------------------------

   // Recurring?

   //-----------------------------------------

   $c_time = gmstrftime( '%x', $event['_start_time'] );

   $url = $this->registry->output->buildSEOUrl( "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}", 'public', $event['event_title_seo'], 'cal_event' );


   $show_events[] = array( 'url' => $url, 'date' => $c_time, 'title' => $event['event_title'] );

  }

change it for:


  $countme = 0;

  foreach( $events as $event )

  {

  if($countme<=4)

  {

  //-----------------------------------------

   // Recurring?

   //-----------------------------------------

   $c_time = gmstrftime( '%x', $event['_start_time'] );

   $url = $this->registry->output->buildSEOUrl( "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}", 'public', $event['event_title_seo'], 'cal_event' );


   $show_events[] = array( 'url' => $url, 'date' => $c_time, 'title' => $event['event_title'] );

  $countme++;

  }

  }


tested and working.... the $e => $event wasnt flying, very likely because $e(array key) is either the cal_id or event_id.

  • 3 months later...
Posted

Hi Marcher for some reason this edit doesnt work in IPB 3.3.1 and my hooks are 1km long again.. would u have any idea how to fix it? I havent received help from the helpdesk stating they would have to change to code.

Posted

Find in {skin}->Calendar->boardIndexCalEvents:


<foreach loop="upcomingevents:$events as $event">

Make it:


<if test="$this->_count=0"></if>

<foreach loop="upcomingevents:$events as $event">

<if test="$this->_count++"></if>

<if test="$this->_count<=5">

Find:


</foreach>

Make that:


</if>

</foreach>


?? stab in the dark it works locally.... course Im still not quite at all sure what triggers the else here in this template.

Posted

ahh ok i see... so it's about the count vs. time range stuff... i thought it's also about a counter (like 5 upcoming events => "5" somewhere)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...