/**
  * Answer the theme
  * 
  * @return object Segue_Templates_Template
  * @access protected
  * @since 5/13/08
  */
 protected function getTemplate()
 {
     if (!isset($this->template)) {
         $templateMgr = Segue_Templates_TemplateManager::instance();
         $this->template = $templateMgr->getTemplate(RequestContext::value('template'));
     }
     return $this->template;
 }
Esempio n. 2
0
 /**
  * This class implements the Singleton pattern. There is only ever
  * one instance of the this class and it is accessed only via the 
  * ClassName::instance() method.
  * 
  * @return object 
  * @access public
  * @since 5/26/05
  * @static
  */
 public static function instance()
 {
     if (!isset(self::$instance)) {
         $class = __CLASS__;
         self::$instance = new $class();
     }
     return self::$instance;
 }
Esempio n. 3
0
 /**
  * Save our results. Tearing down and unsetting the Wizard is handled by
  * in {@link runWizard()} and does not need to be implemented here.
  * 
  * @param string $cacheName
  * @return boolean TRUE if save was successful and tear-down/cleanup of the
  *		Wizard should ensue.
  * @access public
  * @since 4/28/05
  */
 function saveWizard($cacheName)
 {
     $wizard = $this->getWizard($cacheName);
     if (!$wizard->validate()) {
         return false;
     }
     $idManager = Services::getService("Id");
     $properties = $wizard->getAllValues();
     /*********************************************************
      * Create the site from the template
      *********************************************************/
     $templateMgr = Segue_Templates_TemplateManager::instance();
     $template = $templateMgr->getTemplate($properties['template_step']['template']);
     $site = $template->createSite($this->getSlot(), $properties['namedescstep']['display_name'], $properties['namedescstep']['description']);
     $this->_siteId = $site->getId();
     $siteId = $idManager->getId($site->getId());
     /*********************************************************
      * // Check the Role of the creator and make sure it is 'admin'
      *********************************************************/
     $roleMgr = SegueRoleManager::instance();
     $role = $roleMgr->getUsersRole($site->getQualifierId(), true);
     $admin = $roleMgr->getRole('admin');
     if ($role->isLessThan($admin)) {
         $admin->applyToUser($site->getQualifierId(), true);
     }
     /*********************************************************
      * Set site-wide roles for other users
      *********************************************************/
     foreach ($properties['roles']['roles'] as $agentIdString => $roleId) {
         if ($agentIdString == 'edu.middlebury.site-members.temp') {
             $agentId = $site->getMembersGroup()->getId();
         } else {
             $agentId = $idManager->getId($agentIdString);
         }
         $role = $roleMgr->getRole($roleId);
         $role->apply($agentId, $site->getQualifierId());
     }
     /*********************************************************
      * // Check the Role again of the creator and make sure it is 'admin'
      *********************************************************/
     $roleMgr = SegueRoleManager::instance();
     $role = $roleMgr->getUsersRole($site->getQualifierId(), true);
     $admin = $roleMgr->getRole('admin');
     if ($role->isLessThan($admin)) {
         $admin->applyToUser($site->getQualifierId(), true);
     }
     /*********************************************************
      * Add any specified users to the site-members group.
      *********************************************************/
     $members = $properties['roles']['site_members'];
     $membersGroup = $site->getMembersGroup();
     $agentMgr = Services::getService('Agent');
     foreach ($members as $idString => $name) {
         $membersGroup->add($agentMgr->getAgentOrGroup($idManager->getId($idString)));
     }
     /*********************************************************
      * Theme
      *********************************************************/
     $this->saveThemeStep($properties['theme'], $site);
     /*********************************************************
      * Log the success or failure
      *********************************************************/
     $slot = $this->getSlot();
     if (Services::serviceRunning("Logging")) {
         $loggingManager = Services::getService("Logging");
         $log = $loggingManager->getLogForWriting("Segue");
         $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
         $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
         $item = new AgentNodeEntryItem("Create Site", "Site added for placeholder, '" . $slot->getShortname() . "'.");
         $item->addNodeId($siteId);
         $log->appendLogWithTypes($item, $formatType, $priorityType);
     }
     return TRUE;
 }
 * Custom templates with the same folder name as distributed templates will replace
 * the distributed template.
 *
 *
 * USAGE: Copy this file to templates.conf.php to set custom values.
 * 
 *
 * @since 6/12/08
 * @package segue.config
 * 
 * @copyright Copyright © 2007, Middlebury College
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
 *
 * @version $Id$
 */
$templateMgr = Segue_Templates_TemplateManager::instance();
/*********************************************************
 * Define an ordered list of template ids (directory names).
 * 
 * If no order is specified, Alphabetical order will be used.
 * 
 * Any templates not listed here will be appended alphabetically to the end of 
 * the list.
 *********************************************************/
$templateMgr->setOrder(array("Basic", "Blog", "Community", "Course-Basic", "Course-Standard"));
/*********************************************************
 * Define a list of disabled templates. Use this to disable
 * any distributed templates that you do not wish to be
 * available to your users.
 *
 * Each template can define (in its info.xml) a list of