$type = 'none'; if (isset($_REQUEST['type'])) { if ($_REQUEST['type'] == 'theme') { $themes = ThemesAndViewsUtils::getListThemesAndViews(true, false, false); // Print combo box with all themes $selStr = '<form id="selThemesBoxForm" action=""><div>'; if (count($themes) > 0) { $selStr .= _p('Apply theme') . ' '; $selStr .= ThemesAndViewsUtils::getComboThemesAndViews($themes, 'PM.Plugin.ThemesAndViews.submitSelThemeBox()'); } $selStr .= '</div></form>'; $type = 'theme'; } else { if ($_REQUEST['type'] == 'view') { $views = ThemesAndViewsUtils::getListThemesAndViews(false, true, false); // Print combo box with all views $selStr = '<form id="selViewsBoxForm" action=""><div>'; if (count($views) > 0) { $selStr .= _p('Apply view') . ' '; $selStr .= ThemesAndViewsUtils::getComboThemesAndViews($views, 'PM.Plugin.ThemesAndViews.submitSelViewBox()'); } $selStr .= '</div></form>'; $type = 'view'; } } $selStr = addcslashes($selStr, "'"); $selStr = addcslashes($selStr, "\""); } // return JS object literals '{}' for XMLHTTP request header("Content-Type: text/plain; charset={$defCharset}"); echo "{\"selStr\":\"{$selStr}\",\"type\":\"{$type}\"}";
/** * Generates HTML form with boxes * * @param object $namePartial "Theme" or "View" * @param object $array * @return */ public static function getFormComboForWin($namePartial, $array) { $cboxStr = ''; $cboxStr .= '<form id="show' . $namePartial . 'sBoxForm" class="tavShowBoxForm" action="">\\n<div>\\n'; $cboxStrTmp = ThemesAndViewsUtils::getComboThemesAndViews($array, 'submitShow' . $namePartial . 'Box()'); $cboxStr .= strlen($cboxStrTmp) > 0 ? _p('Show ' . strtolower($namePartial)) . ' ' . $cboxStrTmp : '\\n'; $cboxStr .= '</div>\\n</form>\\n'; return $cboxStr; }