Ejemplo n.º 1
0
 private function getSettings($tree_id, $tag)
 {
     $key = $tree_id . $tag;
     if (array_key_exists($key, $this->settings)) {
         return $this->settings[$key];
     }
     $settingsObj = $this->plugin->getObject(Gallery::TYPE_SETTINGS);
     $this->settings[$key] = array_merge($this->plugin->getSettings(), $settingsObj->getSettings($tree_id, $tag));
     return $this->settings[$key];
 }
Ejemplo n.º 2
0
    /**
     * handle tree edit
     */
    private function handleConfigGet($retrieveFields = true)
    {
        $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
        $request = Request::getInstance();
        $view = ViewManager::getInstance();
        $view->setType(Gallery::VIEW_CONFIG);
        $key = $this->getKey();
        $fields = array();
        if ($retrieveFields) {
            if ($this->exists($key)) {
                $fields = $this->getDetail($key);
            } else {
                $fields = array_merge($this->getFields(SqlParser::MOD_INSERT), $this->plugin->getSettings());
            }
        } else {
            $fields = $this->getFields(SqlParser::MOD_UPDATE);
        }
        $template->setVariable('cbo_display', Utils::getHtmlCombo(Gallery::getDisplayTypeList(), $fields['display']));
        $template->setVariable('cbo_display_overview', Utils::getHtmlCombo(Gallery::getDisplayOverviewList(), $fields['display_overview']));
        $template->setVariable('cbo_comment_display', Utils::getHtmlCombo(GalleryComment::getDisplayTypeList(), $fields['comment_display']));
        $this->setFields($fields);
        $template->setVariable($fields);
        $template->setVariable($key);
        // add source code editor
        $theme = $this->director->theme;
        $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/editarea/edit_area/edit_area_full.js"></script>');
        $theme->addJavascript('
editAreaLoader.init({ 	id: "area1", 
							start_highlight: true, 
							allow_toggle: true, 
							allow_resize: true,
							language: "en", 
							syntax: "php", 
							syntax_selection_allow: "css,html,js,php", 
					});
');
        // add breadcrumb item
        $this->director->theme->handleAdminLinks($template);
        $this->template[$this->director->theme->getConfig()->main_tag] = $template;
    }