/** * This method contains the interface to add an additional element to a * content object. (For example, a new string in a Langstring) * It is called when getNewContentUI has only a single possible object type. * It may also be called by the object getAdminUI to avoid code duplication. * * @param string $contentId The id of the (possibly not yet created) content object. * * @param string $userData=null Array of contextual data optionally sent by displayAdminUI(), * and only understood by the class (or subclasses) where getNewUI() is defined. * The function must still function if none of it is present. * * @return HTML markup or false. False means that this object does not support this interface. */ public static function getNewUI($contentId, $userData = null) { $html = ''; !empty($userData['excludeArray']) ? $excludeArray = $userData['excludeArray'] : ($excludeArray = null); !empty($userData['typeInterface']) ? $typeInterface = $userData['typeInterface'] : ($typeInterface = 'LARGE'); $html .= "<div class='admin_element_data'>\n"; $locale = LocaleList::GetDefault(); $html .= _("Language") . ": " . LocaleList::GenererFormSelect($locale, "langstrings_" . $contentId . "_substring_new_language", null, TRUE, $excludeArray); $new_substring_name = "langstrings_" . $contentId . "_substring_new_string"; if ($typeInterface == 'LARGE') { $html .= "<textarea name='{$new_substring_name}' class='textarea' cols='60' rows='3'></textarea>\n"; } else { $html .= "<input type='text' name='{$new_substring_name}' class='input_text' size='80' value=''>\n"; } $html .= "</div>\n"; $html .= "<div class='admin_element_tools'>\n"; $new_substring_submit_name = "langstrings_" . $contentId . "_add_new_entry"; $html .= "<input type='submit' class='submit' name='{$new_substring_submit_name}' value='" . _("Add new string") . "'>"; $html .= "</div>\n"; return $html; }
/** * This method contains the interface to add an additional element to a * content object. (For example, a new string in a Langstring) * It is called when getNewContentUI has only a single possible object type. * It may also be called by the object getAdminUI to avoid code duplication. * * @param string $contentId The id of the (possibly not yet created) content object. * * @param string $userData=null Array of contextual data optionally sent by displayAdminUI(), * and only understood by the class (or subclasses) where getNewUI() is defined. * The function must still function if none of it is present. * * @return HTML markup or false. False means that this object does not support this interface. */ public static function getNewUI($contentId, $userData = null) { $html = ''; $locale = LocaleList::GetDefault(); !empty($userData['typeInterface']) ? $typeInterface = $userData['typeInterface'] : ($typeInterface = null); $html .= "<div class='admin_element_data'>\n"; $html .= _("Language") . ": " . LocaleList::GenererFormSelect($locale, "langstrings_" . $contentId . "_substring_new_language", null, TRUE); if (Dependency::check("FCKeditor")) { // Load FCKeditor class require_once 'lib/FCKeditor/fckeditor.php'; $_FCKeditor = new FCKeditor('langstrings_' . $contentId . '_substring_new_string'); $_FCKeditor->BasePath = SYSTEM_PATH . "lib/FCKeditor/"; $_FCKeditor->Config["CustomConfigurationsPath"] = BASE_URL_PATH . "js/HTMLeditor.js"; $_FCKeditor->Config["AutoDetectLanguage"] = false; $_FCKeditor->Config["DefaultLanguage"] = substr(Locale::getCurrentLocale()->getId(), 0, 2); $_FCKeditor->Config["StylesXmlPath"] = BASE_URL_PATH . "templates/HTMLeditor/css/" . substr(Locale::getCurrentLocale()->getId(), 0, 2) . ".xml"; $_FCKeditor->Config["TemplatesXmlPath"] = BASE_URL_PATH . "templates/HTMLeditor/templates/" . substr(Locale::getCurrentLocale()->getId(), 0, 2) . ".xml"; $_FCKeditor->ToolbarSet = "WiFiDOG"; $_FCKeditor->Value = ""; if ($typeInterface == 'LARGE') { $_FCKeditor->Height = 400; } else { $_FCKeditor->Height = 200; } $_FCKeditor->Width = 386; $html .= $_FCKeditor->CreateHtml(); } else { $html .= "<textarea name='langstrings_{$contentId}_substring_new_string' class='textarea' cols='60' rows='3'></textarea>"; } $html .= "</div>\n"; $html .= "<div class='admin_element_tools'>\n"; $html .= "<input type='submit' class='submit' name='langstrings_" . $contentId . "_add_new_entry' value='" . _("Add new string") . "'>"; $html .= "</div>\n"; return $html; }