示例#1
0
 public function __construct()
 {
     $this->html = new \stdClass();
     $this->html->config = \Pinom\Models\SiteConfig::get();
     $this->html->config->version = '2016.01.07α';
     //Some hacks to prevent errors, setting default values
     if (!isset($this->html->config->calendar)) {
         $this->html->config->calendar = 0;
     }
     if (!isset($this->html->config->site_title)) {
         $this->html->config->site_title = 'PiNom';
     }
     if (!isset($this->html->config->site_description)) {
         $this->html->config->site_description = trans('public.default-description');
     }
     // Folowing lines exctracted from lib/accesslib.phplib/accesslib.php
     define('CONTEXT_SYSTEM', 10);
     // System context level - only one instance in every system
     define('CONTEXT_USER', 30);
     // User context level -  one instance for each user describing what others can do to user
     define('CONTEXT_COURSECAT', 40);
     // Course category context level - one instance for each category
     define('CONTEXT_COURSE', 50);
     // Course context level - one instances for each course
     define('CONTEXT_MODULE', 70);
     // Course module context level - one instance for each course module
     $this->html->user = \Sentinel::check();
 }
示例#2
0
 public static function get()
 {
     $config = SiteConfig::all();
     $tmp = new \stdClass();
     foreach ($config as $cfg) {
         $tmp->{$cfg->name} = $cfg->val;
     }
     return $tmp;
 }