function daynight_hook_timeconditions($viewing_itemid, $target_menuid)
{
    global $tabindex;
    global $amp_conf;
    switch ($target_menuid) {
        // only provide display for timeconditions
        case 'timeconditions':
            $current = daynight_get_timecondition($viewing_itemid);
            if (!$amp_conf['DAYNIGHTTCHOOK'] && $current['ext'] == '') {
                break;
            }
            $daynightcodes = daynight_list();
            $dnopts = sprintf('<option value="" %s>%s</option>', $current['ext'] == '' ? 'selected' : '', _("No Association"));
            foreach ($daynightcodes as $dn_item) {
                $dnopts .= sprintf('<option value="%d,timeday" %s>%s</option>', $dn_item['ext'], $current['ext'] . ',' . $current['dmode'] == $dn_item['ext'] . ',timeday' ? 'selected' : '', $dn_item['dest'] . _(" - Force Time Condition True Destination"));
                $dnopts .= "\n";
                $dnopts .= sprintf('<option value="%d,timenight" %s>%s</option>', $dn_item['ext'], $current['ext'] . ',' . $current['dmode'] == $dn_item['ext'] . ',timenight' ? 'selected' : '', $dn_item['dest'] . _(" - Force Time Condition False Destination"));
                $dnopts .= "\n";
            }
            $html = '
				<!--Call Flow Toggle Mode Association-->
				<div class="element-container">
					<div class="row">
						<div class="col-md-12">
							<div class="row">
								<div class="form-group">
									<div class="col-md-3">
										<label class="control-label" for="daynight_ref">' . _("Call Flow Toggle Associate with") . '</label>
										<i class="fa fa-question-circle fpbx-help-icon" data-for="daynight_ref"></i>
									</div>
									<div class="col-md-9">
										<select class="form-control" id="daynight_ref" name="daynight_ref">
											' . $dnopts . '
										</select>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-md-12">
							<span id="daynight_ref-help" class="help-block fpbx-help-block">' . _("If a selection is made, this timecondition will be associated with the specified call flow toggle  featurecode. This means that if the Call Flow Feature code is set to override (Red/BLF on) then this time condition will always go to its True destination if the chosen association is to 'Force Time Condition True Destination' and it will always go to its False destination if the association is with the 'Force Time Condition False Destination'. When the associated Call Flow Control Feature code is in its Normal mode (Green/BLF off), then then this Time Condition will operate as normal based on the current time. The Destinations that are part of any Associated Call Flow Control Feature Code will have no affect on where a call will go if passing through this time condition. The only thing that is done when making an association is allowing the override state of a Call Flow Toggle to force this time condition to always follow one of its two destinations when that associated Call Flow Toggle is in its override (Red/BLF on) state.") . '</span>
						</div>
					</div>
				</div>
				<!--END Call Flow Toggle Mode Association-->
			';
            return $html;
            break;
        default:
            return false;
            break;
    }
}
Example #2
0
function daynight_hook_timeconditions($viewing_itemid, $target_menuid)
{
    global $tabindex;
    switch ($target_menuid) {
        // only provide display for timeconditions
        case 'timeconditions':
            $html = '';
            $html = '<tr><td colspan="2"><h5>';
            $html .= _("Day/Night Mode Association");
            $html .= '<hr></h5></td></tr>';
            $html .= '<tr>';
            $html .= '<td><a href="#" class="info">';
            $html .= _("Associate with") . '<span>' . _("If a selection is made, this timecondition will be associated with that featurecode and will allow this timecondition to be direct overridden by that daynight mode featurecode") . '.</span></a>:</td>';
            $html .= '<td><select tabindex="' . ++$tabindex . '" name="daynight_ref">';
            $daynightcodes = daynight_list();
            $current = daynight_get_timecondition($viewing_itemid);
            $html .= "\n";
            $html .= sprintf('<option value="" %s>%s</option>', $current['ext'] == '' ? 'selected' : '', _("No Association"));
            $html .= "\n";
            foreach ($daynightcodes as $dn_item) {
                $html .= sprintf('<option value="%d,timeday" %s>%s</option>', $dn_item['ext'], $current['ext'] . ',' . $current['dmode'] == $dn_item['ext'] . ',timeday' ? 'selected' : '', $dn_item['dest'] . _(" - Force Day"));
                $html .= "\n";
                $html .= sprintf('<option value="%d,timenight" %s>%s</option>', $dn_item['ext'], $current['ext'] . ',' . $current['dmode'] == $dn_item['ext'] . ',timenight' ? 'selected' : '', $dn_item['dest'] . _(" - Force Night"));
                $html .= "\n";
            }
            $html .= '</select></td></tr>';
            return $html;
            break;
        default:
            return false;
            break;
    }
}