Hooking Calendar

Form Controls

Group list

Example Calendar Group Dropdowm

<?php //Check if calendar is enabled, if it is we list groups. Otherwise make this an empty array so we don't break the foreach loop $groups = (FreePBX::Modules()->checkStatus('calendar'))?FreePBX::Calendar()->listGroups():array(); ?> <!--Calendar Group--> <div class="element-container">   <div class="row">     <div class="row">       <div class="form-group">         <div class="col-md-3">           <label class="control-label" for="calendargroup"><?php echo _("Calendar Group") ?></label>           <i class="fa fa-question-circle fpbx-help-icon" data-for="calendargroup"></i>         </div>         <div class="col-md-9">           <select class="form-control" name="calendargroup" id="calendargroup">             <option value = ''><?php echo _("--Not Calendar Controlled--")?></option>             <?php foreach($groups as $id => $group) { ?>               <option value="<?php echo $id?>" <?php echo ($calendargroup == $id) ? "selected" : ""?>><?php echo $group['name']?></option>             <?php } ?>           </select>         </div>       </div>     </div>   </div>   <div class="row">     <div class="col-md-12">       <span id="calendargroup-help" class="help-block fpbx-help-block"><?php echo _("Calendar Group to schedule pages for.")?></span>     </div>   </div> </div> <!--END Calendar Group-->

 

Calendar list

Timezone selects

Example Timezone select form element

<!--Timezone--> <div class="element-container">   <div class="row">     <div class="row">       <div class="form-group">         <div class="col-sm-3">           <label class="control-label" for="timezone"><?php echo _("Timezone") ?></label>           <i class="fa fa-question-circle fpbx-help-icon" data-for="timezone"></i>         </div>         <div class="col-sm-9">           <div class="input-group">             <?php echo FreePBX::View()->timezoneDrawSelect('timezone',$timezone); ?>           </div>         </div>       </div>     </div>   </div>   <div class="row">     <div class="col-sm-12">       <span id="timezone-help" class="help-block fpbx-help-block"><?php echo _("Timezone for this user")?></span>     </div>   </div> </div> <!--END Timezone-->

 

Dialplan controls

FreePBX::Calendar()->ext_calendar_group_variable($groupid,$timezone,$integer);

FreePBX::Calendar()->ext_calendar_group_goto($groupid,$timezone,$true_dest,$false_dest);

FreePBX::Calendar()->ext_calendar_group_execif($groupid,$timezone,$true,$false);

Calendar Event Methods

 

/**

  • Gets the next event in a Calendar.

  • @param str $groupid groupid id

  • @return array the Found event or empty

*/
FreePBX::Calendar()->getNextEventByGroup($groupid,$timezone);

/**

  • Gets the next event in a Calendar.

  • @param str $calendar calendar id

  • @return array the Found event or empty

*/
FreePBX::Calendar()->getNextEvent($calendar,$timezone);

Calendar Validation Method Calls

Return to Documentation Home I Return to Sangoma Support