[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/view/admin/ -> adminblogsettingsview.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
   6      lt_include( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );
   7      lt_include( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
   8      
   9      /**
  10       * \ingroup View
  11       * @private
  12       *
  13       * displays the blog settings
  14       */
  15      class AdminBlogSettingsView extends AdminTemplatedView
  16      {
  17      
  18  		function AdminBlogSettingsView( $blogInfo )
  19          {
  20              $this->AdminTemplatedView( $blogInfo, "blogsettings" );
  21              
  22              $config =& Config::getConfig();            
  23              
  24              $blogSettings = $blogInfo->getSettings();
  25              $this->setValue( "blogAbout", $this->_blogInfo->getAbout( false ));
  26              $this->setValue( "blogName", $this->_blogInfo->getBlog());
  27              $this->setValue( "blogLocale", $blogSettings->getValue( "locale" ));
  28              $this->setValue( "blogMaxRecentItems", $blogSettings->getValue( "recent_posts_max" ));
  29              $this->setValue( "blogMaxMainPageItems", $blogSettings->getValue( "show_posts_max" ));
  30              $this->setValue( "blogTemplate", $blogSettings->getValue( "template" ));
  31              $this->setValue( "blogTimeOffset", $blogSettings->getValue( "time_offset" ));
  32              $this->setValue( "blogCategoriesOrder", $blogSettings->getValue( "categories_order" ));
  33              $this->setValue( "blogLinkCategoriesOrder", $blogSettings->getValue( "link_categories_order" ));
  34              $this->setValue( "blogShowMoreEnabled", $blogSettings->getValue( "show_more_enabled" ));
  35              $this->setValue( "blogEnableHtmlarea", $blogSettings->getValue( "htmlarea_enabled" ));
  36              $this->setValue( "blogEnablePullDownMenu", $blogSettings->getValue( "pull_down_menu_enabled" ));
  37              $this->setValue( "blogCommentsEnabled", $blogSettings->getValue( "comments_enabled" ));
  38              $this->setValue( "blogShowFuturePosts", $blogSettings->getValue( "show_future_posts_in_calendar" ));
  39              $locale =& Locales::getLocale( $blogSettings->getValue( "locale" ) );
  40              $this->setValue( "blogFirstDayOfWeek", $blogSettings->getValue( "first_day_of_week", $locale->firstDayOfWeek() ));
  41              $this->setValue( "blogEnableAutosaveDrafts", $blogSettings->getValue( "new_drafts_autosave_enabled" ));
  42              $this->setValue( "blogCommentsOrder", $blogSettings->getValue( "comments_order" ));
  43              $this->setValue( "blogArticlesOrder", $blogSettings->getValue( "articles_order" ));
  44              $this->setValue( "blogCategory", $this->_blogInfo->getBlogCategoryId());
  45              $this->setValue( "blogShowInSummary", $this->_blogInfo->getShowInSummary());
  46              $this->setValue( "blogSendNotification", $blogSettings->getValue( "default_send_notification" ));
  47              $this->setValue( "blogCommentOnlyRegisteredUsers", $blogSettings->getValue( "comment_only_auth_users" ));
  48              $this->setValue( "blogNumCommentsPerPage", $blogSettings->getValue( "show_comments_max", $config->getValue( "show_comments_max" )));
  49              
  50              // only do blog_domain stuff if subdomains are enabled
  51              // Don't waste time here, as well as be less confusing by
  52              // not showing the option to users who can't use it
  53              if( Subdomains::getSubdomainsEnabled()) {
  54                  $domain = $this->_blogInfo->getCustomDomain();
  55  
  56                  $available_domains = Subdomains::getAvailableDomains();
  57                  
  58                  // default to any domain, this will be overwritten
  59                  // if the domain is found in the available_domains array
  60                  $subdomain = $domain;
  61                  $maindomain = "?";
  62                  
  63                  foreach($available_domains as $avdomain){
  64                      // search to see if domain suffix is on
  65                      // the available_domain list.
  66                      $found = strpos($domain, $avdomain);
  67                      if($found !== FALSE && $found == (strlen($domain) - strlen($avdomain))){
  68                      $subdomain = substr($domain, 0, $found-1);
  69                      $maindomain = $avdomain;
  70                      break;
  71                      }
  72                  }
  73  
  74                  // pass the domain information to the view
  75                  $this->setValue( "blogSubDomain", $subdomain );
  76                  $this->setValue( "blogMainDomain", $maindomain );
  77                  $this->setValue( "blogAvailableDomains", $available_domains );
  78                  $this->setValue( "blogDomainsEnabled", 1 );
  79              }            
  80          }
  81          
  82  		function render()
  83          {
  84              $this->setValue( "blogsettings", $this->_blogInfo->getSettings());
  85  
  86              $ts = new TemplateSets();
  87              $templates = $ts->getBlogTemplateSets( $this->_blogInfo->getId(), true );
  88              $this->setValue( "templates", $templates);
  89              // loading all the locales from disk is a pretty heavy task but doing so, we'll get
  90              // nice Locale object with things like the encoding, the description, etc... which looks
  91              // waaaay nicer than just showing the locale code
  92              $this->setValue( "locales", Locales::getLocales());
  93              
  94              // set the blog categories
  95              $categories = new BlogCategories();
  96              $this->setValue( "categories", $categories->getBlogCategories());            
  97              
  98              parent::render();
  99          }
 100      }
 101  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics