Exemplo n.º 1
0
 /**
  * Retreives the admin interface of this object. Anything that overrides
  * this method should call the parent method with it's output at the END of
  * processing.
  * @param string $subclass_admin_interface HTML content of the interface
  * element of a children.
  * @param string $type_interface SIMPLE pour éditer un seul champ, COMPLETE
  *                               pour voir toutes les chaînes, LARGE pour
  *                               avoir un textarea.
  * @return string The HTML fragment for this interface.
  */
 public function getAdminUI($subclass_admin_interface = null, $title = null, $type_interface = "LARGE")
 {
     // Init values.
     $html = '';
     $html .= $subclass_admin_interface;
     $result = "";
     //$variantsCounter = 0;
     //$_hideNewContent = false;
     if (!empty($this->allowed_html_tags)) {
         $html .= "<div class='admin_section_hint'>" . _("Only these HTML tags are allowed : ") . htmlentities($this->allowed_html_tags) . "</div>";
     }
     $html .= "<ul class='admin_element_list'>\n";
     $sql = "SELECT * FROM content_langstring_entries WHERE content_langstring_entries.langstrings_id = '{$this->id}' ORDER BY locales_id";
     $this->mBd->execSql($sql, $result, false);
     //echo "type_interface: $type_interface\n";
     $exclude_array = array();
     if ($result != null) {
         while (list($key, $value) = each($result)) {
             $exclude_array[$value['locales_id']] = $value['locales_id'];
             //                The next lines are a preview of a new suggested input mode
             //                ==========================================================
             //
             //                // Increase variants counter
             //                $variantsCounter++;
             //
             //                // Hide new content input
             //                $_hideNewContent = true;
             //
             //                $html .= "<li class='admin_element_item_container'>\n";
             //                $html .= "<div class='admin_element_data'>\n";
             //
             //                if ($type_interface == 'LARGE') {
             //                    $html .= "<textarea name='langstrings_".$this->id."_substring_$value[langstring_entries_id]_string' cols='60' rows='3'>".htmlspecialchars($value['value'], ENT_QUOTES, 'UTF-8')."</textarea>\n";
             //                } else {
             //                    $html .= "<input type='text' name='langstrings_".$this->id."_substring_$value[langstring_entries_id]_string' size='44' value='".htmlspecialchars($value['value'], ENT_QUOTES, 'UTF-8')."'>\n";
             //                }
             //
             //                $html .= "<div class='admin_element_data' id='langstrings_".$this->id."_substring_$value[langstring_entries_id]_language_section' style='display: none;'>\n";
             //                $html .= LocaleList::GenererFormSelect("$value[locales_id]", "langstrings_".$this->id."_substring_$value[langstring_entries_id]_language", null, TRUE);
             //                $html .= "</div>\n";
             //
             //                $html .= "</div>\n";
             //                $html .= "<div class='admin_element_tools'>\n";
             //                $name = "langstrings_".$this->id."_substring_$value[langstring_entries_id]_erase";
             //
             //                // Choose language button
             //                $html .= "<a href='javascript:showHideView(\"langstrings_".$this->id."_substring_$value[langstring_entries_id]_language_section\", \"langstrings_".$this->id."_substring_$value[langstring_entries_id]_language_section_image\");'><img src='" . BASE_SSL_PATH . "images/icons/language.gif' id='langstrings_".$this->id."_substring_$value[langstring_entries_id]_language_section_image' class='admin_section_button' alt='"._("Choose language")."' title='"._("Choose language")."'></a>";
             //
             //                // Add string button
             //                if (count($result) == $variantsCounter) {
             //                    // This is the last string variant - show "add string" button.
             //                    $html .= "<a href='javascript:showHideView(\"langstrings_".$this->id."_add_new_entry_view\", \"langstrings_".$this->id."_add_new_entry_image\");'><img src='" . BASE_SSL_PATH . "images/icons/add.gif' id='langstrings_".$this->id."_add_new_entry_image' class='admin_section_button' alt='"._("Add new string")."' title='"._("Add new string")."'></a>";
             //                } else {
             //                    $html .= "<img src='" . BASE_SSL_PATH . "images/icons/add.gif' id='langstrings_".$this->id."_add_new_entry_image' class='admin_section_button_disabled' alt='"._("Add new string")."' title='"._("Add new string")."'>";
             //                }
             //
             //                // Delete string button
             //                $html .= "<input type='image' name='$name' class='admin_section_button' src='" . BASE_SSL_PATH . "images/icons/delete.gif' alt='"._("Delete string")."' title='"._("Delete string")."'>";
             //
             //                $html .= "</div>\n";
             //                $html .= "</li>\n";
             $html .= "<li class='admin_element_item_container'>\n";
             $html .= "<div class='admin_element_data'>\n";
             $html .= _("Language") . ": " . LocaleList::GenererFormSelect("{$value['locales_id']}", "langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_language", null, TRUE);
             if ($type_interface == 'LARGE') {
                 $html .= "<textarea name='langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_string' class='textarea' cols='60' rows='3'>" . htmlspecialchars($value['value'], ENT_QUOTES, 'UTF-8') . "</textarea>\n";
             } else {
                 $html .= "<input type='text' size='80' class='input_text' name='langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_string' value='" . htmlspecialchars($value['value'], ENT_QUOTES, 'UTF-8') . "'>\n";
             }
             $html .= "</div>\n";
             $html .= "<div class='admin_element_tools'>\n";
             $name = "langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_erase";
             $html .= "<input type='submit' class='submit' name='{$name}' value='" . _("Delete string") . "'>";
             $html .= "</div>\n";
             $html .= "</li>\n";
         }
     }
     //        The next lines are a preview of a new suggested input mode
     //        ==========================================================
     //
     //        //Nouvelles chaîne
     //        $locale = LocaleList :: GetDefault();
     //
     //        $html .= "<li class='admin_element_item_container' id='langstrings_".$this->id."_add_new_entry_view'" . ($_hideNewContent ? " style='display: none;'" : "") . ">\n";
     //        $html .= "<div class='admin_element_data'>\n";
     //
     //        $new_substring_name = "langstrings_".$this->id."_substring_new_string";
     //
     //        if ($type_interface == 'LARGE') {
     //            $html .= "<textarea name='$new_substring_name' cols='60' rows='3'></textarea>\n";
     //        } else {
     //            $html .= "<input type='text' name='$new_substring_name' size='44' value=''>\n";
     //        }
     //
     //        $html .= "<div class='admin_element_data' id='langstrings_".$this->id."_substring_new_language_section'>\n";
     //        $html .= "<img src='" . BASE_SSL_PATH . "images/icons/language.gif' id='langstrings_".$this->id."_substring_new_language_section_image' class='admin_section_button' alt='"._("Choose language")."' title='"._("Choose language")."'>";
     //        $html .= LocaleList::GenererFormSelect($locale, "langstrings_".$this->id."_substring_new_language", null, TRUE);
     //        $html .= "</div>\n";
     //
     //        $html .= "</div>\n";
     //        $html .= "<div class='admin_element_tools'>\n";
     //
     //        $new_substring_submit_name = "langstrings_".$this->id."_add_new_entry";
     //
     //        // Add string button
     //        $html .= "<input type='image' name='$new_substring_submit_name' class='admin_section_button' src='" . BASE_SSL_PATH . "images/icons/add.gif' alt='"._("Add new string")."' title='"._("Add new string")."'>";
     //
     //        $html .= "</div>\n";
     //        $html .= "</li>\n";
     //
     //        $html .= "</ul>\n";
     //        $html .= "</div>\n";
     //Nouvelles chaîne
     $html .= "<li class='admin_element_item_container'>\n";
     $userData['excludeArray'] = $exclude_array;
     $userData['typeInterface'] = $type_interface;
     $html .= self::getNewUI($this->id, $userData);
     $html .= "</li>\n";
     $html .= "</ul>\n";
     return parent::getAdminUI($html, $title);
 }
Exemplo n.º 2
0
 /**
  * Retreives the admin interface of this object. Anything that overrides
  * this method should call the parent method with it's output at the END of
  * processing.
  * @param string $subclass_admin_interface HTML content of the interface
  * element of a children.
  * @param string $type_interface SIMPLE pour éditer un seul champ, COMPLETE
  *                               pour voir toutes les chaînes, LARGE pour
  *                               avoir un textarea.
  * @return string The HTML fragment for this interface.
  */
 public function getAdminUI($subclass_admin_interface = null, $title = null, $type_interface = "LARGE")
 {
     if ($this->_FCKeditorAvailable) {
         // Init values
         $_result = null;
         $html = '';
         $html .= $subclass_admin_interface;
         $html .= "<ul class='admin_element_list'>\n";
         $html .= "<li class='admin_element_item_container content_html_editor'>\n";
         $html .= "<ul class='admin_element_list'>\n";
         $sql = "SELECT * FROM content_langstring_entries WHERE content_langstring_entries.langstrings_id = '{$this->id}' ORDER BY locales_id";
         $this->mBd->execSql($sql, $_result, FALSE);
         // Show existing content
         if ($_result != null) {
             while (list($_key, $_value) = each($_result)) {
                 $html .= "<li class='admin_element_item_container'>\n";
                 $html .= "<div class='admin_element_data'>\n";
                 $html .= _("Language") . ": " . LocaleList::GenererFormSelect($_value["locales_id"], "langstrings_" . $this->id . "_substring_" . $_value["langstring_entries_id"] . "_language", null, TRUE);
                 $_FCKeditor = new FCKeditor('langstrings_' . $this->id . '_substring_' . $_value["langstring_entries_id"] . '_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 = $_value['value'];
                 if ($type_interface == 'LARGE') {
                     $_FCKeditor->Height = 400;
                 } else {
                     $_FCKeditor->Height = 200;
                 }
                 $_FCKeditor->Width = 386;
                 $html .= $_FCKeditor->CreateHtml();
                 $html .= "</div>\n";
                 $html .= "<div class='admin_element_tools'>\n";
                 $_name = "langstrings_" . $this->id . "_substring_" . $_value["langstring_entries_id"] . "_erase";
                 $html .= "<input type='submit' class='submit' name='{$_name}' value='" . _("Delete string") . "'>";
                 $html .= "</div>\n";
                 $html .= "</li>\n";
             }
         }
         // Editor for new content
         $html .= "<li class='admin_element_item_container'>\n";
         $userData['typeInterface'] = $type_interface;
         $html .= self::getNewUI($this->id, $userData);
         $html .= "</li>\n";
         $html .= "</ul>\n";
         $html .= "</li>\n";
         $html .= "</ul>\n";
     } else {
         $html = '';
         $html .= _("FCKeditor is not installed");
     }
     return Content::getAdminUI($html, $title);
 }