function render()
 {
     $ts = new TemplateSets();
     // get all the template sets, without including the global ones
     $blogTemplateSets = $ts->getBlogTemplateSets($this->_blogInfo->getId(), false);
     $this->setValue("templates", $blogTemplateSets);
     parent::render();
 }
 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()
 {
     $this->setValue("blogsettings", $this->_blogInfo->getSettings());
     $ts = new TemplateSets();
     $templates = $ts->getBlogTemplateSets($this->_blogInfo->getId(), true);
     $this->setValue("templates", $templates);
     // loading all the locales from disk is a pretty heavy task but doing so, we'll get
     // nice Locale object with things like the encoding, the description, etc... which looks
     // waaaay nicer than just showing the locale code
     $this->setValue("locales", Locales::getLocales());
     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 AdminEditSiteBlogView($blogInfo, $editBlogInfo = null)
 {
     // fetch information about the blog we're editing
     if ($editBlogInfo == null) {
         $this->_editBlogInfo = $this->getSessionValue('editBlogInfo');
     } else {
         $this->_editBlogInfo = $editBlogInfo;
     }
     // this stuff is a bit weird but I couldn't find a better way to do it!
     if ($this->_editBlogInfo) {
         $this->AdminTemplatedView($blogInfo, 'editblog');
         $this->_error = false;
         $this->setSessionValue('editBlogInfo', $this->_editBlogInfo);
         // ...
         // export data to the view
         $this->setValue('editblog', $this->_editBlogInfo);
         $this->setValue('editblogsettings', $this->_editBlogInfo->getSettings());
         // blog settings...
         $blogTemplateSet = $this->_editBlogInfo->getTemplateSet();
         $this->setValue('blogTemplate', $blogTemplateSet->getName());
         $ts = new TemplateSets();
         // get the blog template sets
         $this->setValue('templates', $ts->getBlogTemplateSets($this->_editBlogInfo->getId(), true));
         // and the list of locale availables
         $this->setValue('locales', Locales::getLocales());
         $this->setValue('blogStatus', $this->_editBlogInfo->getStatus());
         $this->setValue('blogStatusList', BlogStatus::getStatusList());
         $blogSettings = $this->_editBlogInfo->getSettings();
         $this->setValue('blogTimeOffset', $blogSettings->getValue('time_offset'));
         $this->setValue('blogOwner', $this->_editBlogInfo->getOwner());
         $this->setValue('blogName', $this->_editBlogInfo->getBlog());
         $this->setValue('blogLocale', $blogSettings->getValue("locale"));
         $this->setValue('blogResourcesQuota', $this->_editBlogInfo->getResourcesQuota());
         // get all the users
         $users = new Users();
         $siteUsers = $users->getAllUsers();
         $this->notifyEvent(EVENT_USERS_LOADED, array('users' => &$siteUsers));
         // set the blog users and the available users
         $blogUsers = $users->getBlogUsers($this->_editBlogInfo->getId(), false);
         $this->setValue('availableusers', $this->filterAvailableUsers($siteUsers, $blogUsers));
         $this->setValue('blogusers', $blogUsers);
         $this->setValue('siteusers', $siteUsers);
     } else {
         $this->AdminTemplatedView($blogInfo, 'error');
         $this->setValue('message', 'Unexpected error loading blog!');
         $this->_error = true;
     }
 }
 /**
  * Renders the view. It simply gets all the parameters we've been adding to it
  * and puts them in the context of the template renderer so that they can be accessed
  * as normal parameters from within the template
  *
  * @return Returns a rendered template
  */
 function render()
 {
     // assign all the values
     $blogSettings = $this->_blogInfo->getSettings();
     $templateSet = $blogSettings->getValue("template");
     $this->_template->assign($this->_params->getAsArray());
     $ts = new TemplateSets();
     $storage = new TemplateSetStorage();
     if ($ts->isBlogTemplate($templateSet, $this->_blogInfo->getId())) {
         $blogTemplate = $storage->getTemplateFolder($templateSet, $this->_blogInfo->getId());
     } else {
         $blogTemplate = $storage->getTemplateFolder($templateSet);
     }
     $this->_template->assign("blogtemplate", $blogTemplate);
     parent::render();
 }
 function render()
 {
     // get a list with all the global template sets
     $ts = new TemplateSets();
     $blogTemplateSets = $ts->getBlogTemplateSets($this->_blogInfo->getId(), false);
     // get a list with all the specific template files
     $ts = new TemplateSetStorage();
     $blogId = $this->_blogInfo->getId();
     $templateFolder = $ts->getTemplateFolder($this->_templateId, $blogId);
     $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", $blogTemplateSets);
     $this->setValue("templateFiles", $templateFiles);
     parent::render();
 }
 /**
  * @see FileFinder::find()
  * @return An array with the ids of the new template sets
  */
 function find($currentTemplates = null)
 {
     // if no parameter, then use the list of default global templates
     if ($currentTemplates == null) {
         $currentTemplates = TemplateSets::getGlobalTemplates();
     }
     // call the parent method after the preparations
     parent::find($currentTemplates);
     // and return any new templates
     return $this->getNew();
 }
 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;
 }
示例#13
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;
 }
 /**
  * returns a TemplateSet object with the information about the template used
  * by the blog
  *
  * @return a TemplateSet object
  */
 function getTemplateSet()
 {
     // since including these files is quite a costly operation, let's do it only
     // whenever we have to instead of always and always always... :)
     if ($this->_templateSet == null) {
         include_once PLOG_CLASS_PATH . "class/template/templatesets/templatesets.class.php";
         $ts = new TemplateSets();
         $this->_templateSet = $ts->getTemplateSet($this->getTemplate(), $this->getId());
         if ($this->_templateSet == null) {
             // what if the admin removes the current template set used by this blog???
             $this->_templateSet = $ts->getDefaultTemplateSet();
         }
     }
     return $this->_templateSet;
 }
 /**
  * Adds a global template to the site.
  *
  * @param templateName Name of the template we'd like to add
  * @return Returns true if successful or false otherwise.
  */
 function addGlobalTemplate($templateName)
 {
     $config =& Config::getConfig();
     // check if the value is there and if so, do nothing
     $templateSets = new TemplateSets();
     if ($templateSets->isTemplate($templateName)) {
         return true;
     }
     // let's make sure that we actually got an array... if not, then
     // let's recreate the array to avoid further problems down the road!
     $templates = $templateSets->getGlobalTemplates();
     if (!is_array($templates)) {
         print "recreating the array!";
         $templates = array();
     }
     // if not there, we can add it
     array_push($templates, $templateName);
     // and store the values
     $config->saveValue("templates", $templates);
     return true;
 }
 /**
  * scans the templates folder looking for new files
  *
  * @private
  */
 function _performScanTemplateFolder()
 {
     $this->_errorMessage = "";
     $this->_successMessage = "";
     // set up the view
     $this->_view = new AdminBlogTemplateSetsListView($this->_blogInfo);
     // and tell the template finder to find any new template file...
     $tf = new TemplateFinder(TemplateSetStorage::getBlogBaseTemplateFolder($this->_blogInfo->getId()));
     $newTemplates = $tf->find(TemplateSets::getBlogTemplates($this->_blogInfo->getId()));
     $this->_errorMessage = "";
     $this->_successMessage = "";
     if (count($newTemplates) == 0) {
         // no new templates found
         $this->_errorMessage = $this->_locale->tr('error_no_new_templates_found');
     } else {
         // now add each one of the new ones
         foreach ($newTemplates as $newTemplate) {
             $this->_addTemplateCode($newTemplate);
         }
     }
     // set the success and error messages, if any
     if ($this->_errorMessage != '') {
         $this->_view->setErrorMessage($this->_errorMessage);
     }
     if ($this->_successMessage != '') {
         $this->_view->setSuccessMessage($this->_successMessage);
     }
     $this->setCommonData();
     return true;
 }