function render()
 {
     // get a list with all the templates so that users can choose
     $sets = new TemplateSets();
     $templates = $sets->getGlobalTemplateSets();
     $this->setValue("templates", $templates);
     // and render the rest of the contents of the view
     parent::render();
 }
 function render()
 {
     // get a list with all the global template sets
     $ts = new TemplateSets();
     $globalTemplates = $ts->getGlobalTemplateSets();
     $this->setValue("templates", $globalTemplates);
     $defaultTs = $ts->getDefaultTemplateSet();
     $this->setValue("defaultTemplate", $defaultTs->getName());
     parent::render();
 }
 function render()
 {
     $ts = new TemplateSets();
     // get a list with all the site template sets
     $globalTemplateSets = $ts->getGlobalTemplateSets();
     // get a list with all the blog template sets
     $blogTemplateSets = $ts->getBlogTemplateSets($this->_blogInfo->getId(), false);
     $this->setValue("globalTemplateSets", $globalTemplateSets);
     $this->setValue("blogTemplateSets", $blogTemplateSets);
     parent::render();
 }
 function render()
 {
     // get a list with all the global template sets
     $ts = new TemplateSets();
     $globalTemplates = $ts->getGlobalTemplateSets();
     // Add rss & summary templateset to beginning of templatesets
     $rssTemplate =& new TemplateSet("rss", TEMPLATE_SET_GLOBAL, 0);
     $summaryTemplate =& new TemplateSet("summary", TEMPLATE_SET_GLOBAL, 0);
     array_unshift($globalTemplates, $rssTemplate, $summaryTemplate);
     $this->setValue("templates", $globalTemplates);
     parent::render();
 }
 function render()
 {
     // get a list with all the global template sets
     $ts = new TemplateSets();
     $globalTemplates = $ts->getGlobalTemplateSets();
     // Add rss & summary templateset to beginning of templatesets
     $rssTemplate =& new TemplateSet("rss", TEMPLATE_SET_GLOBAL, 0);
     $summaryTemplate =& new TemplateSet("summary", TEMPLATE_SET_GLOBAL, 0);
     array_unshift($globalTemplates, $rssTemplate, $summaryTemplate);
     // get a list with all the specific template files
     $ts = new TemplateSetStorage();
     $blogId = $this->_blogInfo->getId();
     $templateFolder = $ts->getTemplateFolder($this->_templateId);
     $templateFolder = $templateFolder . $this->_subFolderId;
     // Get template files according extension
     $templateFiles = $this->getTemplateFiles($templateFolder);
     $this->setValue("currentTemplate", $this->_templateId);
     $this->setValue("currentSubFolder", $this->_subFolderId);
     $this->setValue("templateSets", $globalTemplates);
     $this->setValue("templateFiles", $templateFiles);
     parent::render();
 }
 function perform()
 {
     // get a list with all the global template sets
     $ts = new TemplateSets();
     $globalTemplates = $ts->getGlobalTemplateSets();
     foreach ($globalTemplates as $template) {
         if ($template->getName() == $this->_newTemplateId) {
             $this->_view = new PluginSiteTemplateSetsListView($this->_blogInfo);
             $this->_view->setErrorMessage($this->_locale->tr("error_duplicate_templateset_name"));
             $this->setCommonData();
             return false;
         }
     }
     $ts = new TemplateSetStorage();
     $blogId = $this->_blogInfo->getId();
     $sourceTemplateFolder = $ts->getTemplateFolder($this->_templateId);
     $newTemplateFolder = $ts->getBaseTemplateFolder() . "/" . $this->_newTemplateId;
     if (MyFile::copyDir($sourceTemplateFolder, $newTemplateFolder)) {
         $ts->addTemplate($this->_newTemplateId);
     } else {
         File::deleteDir($newTemplateFolder);
         $this->_view = new PluginSiteTemplateSetsListView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("error_copying_templateset"));
         $this->setCommonData();
         return false;
     }
     // if everything went ok...
     $this->_session->setValue("blogInfo", $this->_blogInfo);
     $this->saveSession();
     $this->_view = new PluginSiteTemplateSetsListView($this->_blogInfo);
     $this->_view->setSuccessMessage($this->_locale->tr("templateeditor_templateset_copyed_ok"));
     $this->setCommonData();
     // clear the cache
     CacheControl::resetBlogCache($this->_blogInfo->getId());
     return true;
 }
예제 #7
0
 function perform()
 {
     // retrieve the values from the view
     $this->_blogName = $this->_request->getValue("blogName");
     $this->_ownerId = $this->_request->getValue("ownerid");
     $this->_blogProperties = $this->_request->getValue("properties");
     $this->_blogTemplate = $this->_request->getValue("blogTemplate");
     $this->_blogLocale = $this->_request->getValue("blogLocale");
     // configure the blog
     $blogs = new Blogs();
     $blog = new BlogInfo($this->_blogName, $this->_ownerId, "", "");
     $blog->setProperties($this->_blogProperties);
     $blog->setStatus(BLOG_STATUS_ACTIVE);
     $blogSettings = $blog->getSettings();
     $blogSettings->setValue("locale", $this->_blogLocale);
     $blogSettings->setValue("template", $this->_blogTemplate);
     $blog->setSettings($blogSettings);
     // and now save it to the database
     $newblogId = $blogs->addBlog($blog);
     if (!$newblogId) {
         $this->_view = new WizardView("step4");
         $this->_view->setValue("siteLocales", Locales::getLocales());
         $ts = new TemplateSets();
         $this->_view->setValue("siteTemplates", $ts->getGlobalTemplateSets());
         $this->_view->setErrorMessage("There was an error creating the new blog");
         $this->setCommonData(true);
         return false;
     }
     // if the blog was created, we can add some basic information
     // add a category
     $articleCategories = new ArticleCategories();
     $articleCategory = new ArticleCategory("General", "", $newblogId, true);
     $catId = $articleCategories->addArticleCategory($articleCategory);
     // load the right locale
     $locale =& Locales::getLocale($this->_blogLocale);
     // and load the right text
     $articleTopic = $locale->tr("register_default_article_topic");
     $articleText = $locale->tr("register_default_article_text");
     $article = new Article($articleTopic, $articleText, array($catId), $this->_ownerId, $newblogId, POST_STATUS_PUBLISHED, 0, array(), "welcome");
     $t = new Timestamp();
     $article->setDateObject($t);
     $articles = new Articles();
     $articles->addArticle($article);
     // save a few things in the default configuration
     $config =& Config::getConfig();
     // default blog id
     $config->saveValue("default_blog_id", (int) $newblogId);
     // default locale
     $config->saveValue("default_locale", $this->_blogLocale);
     // and finally, the default template
     $config->saveValue("default_template", $this->_blogTemplate);
     //
     // detect wether we have GD available and set the blog to use it
     //
     if (GdDetector::detectGd()) {
         $config->saveValue("thumbnail_method", "gd");
         $message = "GD has been detected and set as the backend for dealing with images.";
     } else {
         $pathToConvert = $config->getValue("path_to_convert");
         if ($pathToConvert) {
             $config->saveValue("thumbnail_method", "imagemagick");
             $message = "ImageMagick has been detected and set as the backend for dealing with images.";
         } else {
             // nothing was found, so we'll have to do away with the 'null' resizer...
             $config->saveValue("thumbnail_method", "null");
             $message = "Neither GD nor ImageMagick have been detected in this host so it will not be possible to generate thumbnails from images.";
         }
     }
     $this->_view = new WizardView("step5");
     $this->_view->setValue("message", $message);
     return true;
 }