public static function dropZone($name = 'dropZone', $label = 'Drop applet here') { $link = AppletInstance::getDropZoneValue($name); $applet_id = null; $type = ''; $icon_url = ''; if (!empty($link) && is_string($link)) { $applet_id = explode('/', $link); $applet_id = $applet_id[count($applet_id) - 1]; } if (!empty($applet_id) && isset(Applet::$flow_data[$applet_id])) { $applet = Applet::$flow_data[$applet_id]; $type = $applet->type; $icon_url = ''; $label = $applet->name; $type_parts = explode("---", $type); $plugin_name = $type_parts[0]; $applet_name = $type_parts[1]; $icon_url = real_site_url('plugins/' . $plugin_name . '/applets/' . $applet_name . '/icon.png'); } else { if (!isset(Applet::$flow_data[$applet_id]) && !empty($applet_id)) { /* handling this gracefully in case of bad programmer */ $applet_id = null; $link = null; } } $widget = new DropZoneWidget($name, $label, $type, $icon_url, $link); return $widget->render(); }
<?php $response = new Response(); /* Fetch all the data to operate the menu */ $digits = isset($_REQUEST['Digits']) ? $_REQUEST['Digits'] : false; $prompt = AppletInstance::getAudioSpeechPickerValue('prompt'); $invalid_option = AppletInstance::getAudioSpeechPickerValue('invalid-option'); $repeat_count = AppletInstance::getValue('repeat-count', 3); $next = AppletInstance::getDropZoneUrl('next'); $selected_item = false; /* Build Menu Items */ $choices = AppletInstance::getDropZoneUrl('choices[]'); $keys = AppletInstance::getDropZoneValue('keys[]'); $menu_items = AppletInstance::assocKeyValueCombine($keys, $choices); $numDigits = 1; foreach ($keys as $key) { if (strlen($key) > $numDigits) { $numDigits = strlen($key); } } if ($digits !== false) { if (!empty($menu_items[$digits])) { $selected_item = $menu_items[$digits]; } else { if ($invalid_option) { $verb = AudioSpeechPickerWidget::getVerbForValue($invalid_option, null); $response->append($verb); $response->addRedirect(); } else { $response->addSay('You selected an incorrect option.'); $response->addRedirect();
<?php $response = new Response(); /* Fetch all the data to operate the menu */ $digits = isset($_REQUEST['Digits']) ? $_REQUEST['Digits'] : false; $prompt = AppletInstance::getAudioSpeechPickerValue('prompt'); $invalid_option = AppletInstance::getAudioSpeechPickerValue('invalid-option'); $repeat_count = AppletInstance::getValue('repeat-count', 3); $next = AppletInstance::getDropZoneUrl('next'); $selected_item = false; /* Build Menu Items */ $choices = (array) AppletInstance::getDropZoneUrl('choices[]'); $keys = (array) AppletInstance::getDropZoneValue('keys[]'); $menu_items = AppletInstance::assocKeyValueCombine($keys, $choices); $numDigits = 1; foreach ($keys as $key) { if (strlen($key) > $numDigits) { $numDigits = strlen($key); } } if ($digits !== false) { if (!empty($menu_items[$digits])) { $selected_item = $menu_items[$digits]; } else { if ($invalid_option) { $verb = AudioSpeechPickerWidget::getVerbForValue($invalid_option, null); $response->append($verb); $response->addRedirect(); } else { $response->addSay('You selected an incorrect option.'); $response->addRedirect();
<?php $defaultNumberOfChoices = 1; $timestart = AppletInstance::getValue('timestart[]', array('--')); $timefinish = AppletInstance::getValue('timefinish[]', array('--')); $sunday = AppletInstance::getValue('sunday[]'); $monday = AppletInstance::getValue('monday[]'); $tuesday = AppletInstance::getValue('tuesday[]'); $wednesday = AppletInstance::getValue('wednesday[]'); $thursday = AppletInstance::getValue('thursday[]'); $friday = AppletInstance::getValue('friday[]'); $saturday = AppletInstance::getValue('saturday[]'); $ci_timezone = AppletInstance::getValue('timezones'); $choices = AppletInstance::getDropZoneValue('choices[]'); $days = AppletInstance::getValue('days'); function day_check($day, $key) { $value = AppletInstance::getValue($day); if (count($value) > 1) { if ($value[$key] == "true") { return "selected"; } } elseif (count($value) == "true") { if ($value == 1) { return "selected"; } } else { return "failed"; } } $ci =& get_instance();