public function getTemplate($templateId)
 {
     global $dRep;
     if (isset($this->templates[$templateId])) {
         return $this->templates[$templateId];
     }
     $sql = "SELECT * FROM ink_templates A WHERE templateId = '{$templateId}'";
     $row = $this->runSingleQuery($sql);
     if (empty($row['templateId'])) {
         return false;
     }
     $properties = array('id' => $row['templateId'], 'name' => $row['name'], 'filename' => $row['filename'], 'spots' => $dRep->getSpotCollection(array('template' => $templateId)), 'folder' => $row['resourceFolder'], 'site' => $row['siteId']);
     $template = new Template();
     $template->setProperties($properties);
     $this->templates[$row['templateId']] = $template;
     return $template;
 }
 public function maketpl()
 {
     global $varChecker;
     $templateMaker = new TemplateMaker();
     if ($varChecker->getValue('id') != 'new') {
         $template = $this->getTpl();
     } else {
         $template = new Template();
         $properties = array('id' => 'new', 'name' => '');
         $template->setProperties($properties);
     }
     $template = $templateMaker->createTemplate($varChecker->getValue('path'), $varChecker->getValue('name'), $template);
     $this->dRep->saveTemplate($template, false);
     $spots = $template->getSpots();
     $newSpots = array();
     foreach ($spots as $key => $spot) {
         //loop trhough and check if the spot exists, if it does return the id, else return what user is trying to get
         if (is_object($spot)) {
             $newSpots[] = array('id' => $spot->getId(), 'tplSpotId' => $spot->getTplSpotId());
         } else {
             $newSpots[] = array('id' => 0, 'tplSpotId' => $key);
         }
     }
     $templateData = array('name' => $template->getName(), 'spots' => $newSpots);
     print json_encode($templateData);
 }
Example #3
0
 /**
  * Show Page.
  * Running this method initiates rendering of templates and sending of HTML
  * data.
  *
  * @param Page $page
  * @param Blockmanager $blockManager
  */
 public function showPage(Page $page, Blockmanager $blockManager)
 {
     header('Content-Type: text/html; charset=utf-8');
     $template = new Template();
     $template->disableCache();
     $template->setProperties(array('development' => $this->_appConfig->get('development'), 'page' => $page, 'path' => $page->getThemePath(), 'templatesRoot' => Application::getTemplatesPath(), 'blockManager' => $blockManager, 'resource' => Resource::getInstance(), 'pagesTree' => Model::factory('Page')->getTree()));
     Response::put($template->render($page->getTemplatePath('layout.php')));
 }
Example #4
0
					 <div class="content-wrap">
						 <div id="content" class="content">
							<?php 
echo $page->text;
?>
							<div class="content-col-2">
							<?php 
echo $blockManager->getBlocksHtml('centerleft');
?>
							</div>
							<div class="content-col-2">
								<?php 
echo $blockManager->getBlocksHtml('centerright');
?>
							</div>
						 </div>		
						 <div class="sep"></div>			
					 </div>	
					 <div id="sidebar"><?php 
echo $blockManager->getBlocksHtml('rightblocks');
?>
</div>
				 </div>	
			 </div>
		 </div>
	</div><!--end:fullwidth-->
</div><!--end:container-->
<?php 
$template = new Template();
$template->setProperties(array('page' => $page, 'resource' => Resource::getInstance(), 'bottomBlocks' => $blockManager->getBlocksHtml('bottomblocks'), 'footerBlocks' => $blockManager->getBlocksHtml('footerblocks')));
echo $template->render($this->get('path') . '/footer.php');
Example #5
0
 /**
  * Run backend application
  */
 protected function _runBackend()
 {
     if ($this->_cache) {
         Blockmanager::setDefaultCache($this->_cache);
     }
     /*
      * Prepare objects
      */
     Db_Object_Builder::useForeignKeys($this->_config->get('foreign_keys'));
     /*
      * Inject Externals exper ino Objects Manager
      */
     if ($this->_config->get('allow_externals')) {
         Db_Object_Manager::setExternalsExpert($this->_getExternalsExpert());
     }
     $cfgBackend = Config::factory(Config::File_Array, $this->_config->get('configs') . 'backend.php');
     Registry::set('backend', $cfgBackend, 'config');
     self::$_templates = $this->_config->get('templates') . 'system/' . $cfgBackend->get('theme') . '/';
     $page = Page::getInstance();
     $page->setTemplatesPath(self::$_templates);
     $user = User::getInstance();
     /*
      * Update "Users Online" statistics
      */
     if ($this->_config->get('usersOnline') && $user->isAuthorized()) {
         Model::factory('Online')->addOnline(session_id(), $user->id);
     }
     /*
      * Start routing
      */
     $router = new Backend_Router();
     $router->route();
     $controller = Request::getInstance()->getPart(1);
     /*
      * Define frontent JS variables
      */
     $res = Resource::getInstance();
     $res->addInlineJs('
         app.wwwRoot = "' . $this->_config->get('wwwroot') . '";
     	app.admin = "' . $this->_config->get('wwwroot') . $this->_config->get('adminPath') . '";
     	app.delimiter = "' . $this->_config->get('urlDelimiter') . '";
     	app.root = "' . $this->_config->get('wwwroot') . $this->_config->get('adminPath') . $this->_config->get('urlDelimiter') . $controller . $this->_config->get('urlDelimiter') . '";
     ');
     /*
      * Load template
      */
     $template = new Template();
     $template->disableCache();
     $template->setProperties(array('wwwRoot' => $this->_config->get('wwwroot'), 'page' => $page, 'urlPath' => $controller, 'resource' => $res, 'path' => self::$_templates, 'adminPath' => $this->_config->get('adminPath'), 'development' => $this->_config->get('development'), 'version' => Config::factory(Config::File_Array, $this->_config->get('configs') . 'versions.php')->get('core'), 'lang' => $this->_config->get('language'), 'modules' => Config::factory(Config::File_Array, $this->_config->get('backend_modules')), 'userModules' => $user->getAvailableModules(), 'useCSRFToken' => $cfgBackend->get('use_csrf_token')));
     Response::put($template->render(self::$_templates . 'layout.php'));
 }