Пример #1
0
 public function createOwnCSSForRoomContext(cs_context_item $room_item, array $schema)
 {
     $bg_image = $room_item->getBGImageFilename();
     $bg_repeat = $room_item->issetBGImageRepeat() == true ? 'repeat' : 'no-repeat';
     $bg_fixed = $room_item->issetBGImageFixed() == true ? 'fixed' : 'scroll';
     // set complete path for background image
     global $c_commsy_domain;
     $host = $c_commsy_domain;
     global $c_commsy_url_path;
     global $c_single_entry_point;
     $bg_image = $host . $c_commsy_url_path . '/' . $c_single_entry_point . '?cid=' . $this->_environment->getCurrentContextID() . '&mod=picture&fct=getfile&picture=' . $bg_image;
     // In commsy/var abspeichern (für Loadbalacing)
     // 			$master = 'htdocs/templates/themes/individual/styles_cid.css';
     // 			$path = 'htdocs/templates/themes/individual/styles_' . $room_item->getItemID() . '.css';
     if (!file_exists('var/templates/')) {
         mkdir('var/templates/');
     }
     if (!file_exists('var/templates/individual/')) {
         mkdir('var/templates/individual/');
     }
     if (!file_exists('var/templates/individual/img/')) {
         mkdir('var/templates/individual/img/');
     }
     if (!file_exists('var/templates/individual/styles_cid.css')) {
         $file_old = 'htdocs/templates/themes/individual/styles_cid.css';
         $file_new = 'var/templates/individual/styles_cid.css';
         if (!copy($file_old, $file_new)) {
             $content = file_get_contents($file_old);
             if (!empty($content)) {
                 $openfile = fopen($file_new, 'w');
                 fwrite($openfile, $content);
                 fclose($openfile);
             }
         }
     }
     $master = 'var/templates/individual/styles_cid.css';
     $path = 'var/templates/individual/styles_' . $room_item->getItemID() . '.css';
     // load master file
     $css_file = file_get_contents($master);
     // replace placeholder
     preg_match_all("/\\{\\\$(\\S*?)\\}/", $css_file, $matches);
     if (isset($matches[0])) {
         for ($i = 0; $i < sizeof($matches[0]); $i++) {
             $match = $matches[0][$i];
             $var_name = $matches[1][$i];
             $val = ${$var_name};
             if (!isset($val)) {
                 $val = $schema[$var_name];
             }
             // replace - only if not surrounded by /* ... */
             //preg_match_all("=(?<!\\/\\*).*?\\{\\$(.*?)\\}.*?(?!\\*\\/)=s", $css_file, $matches);
             $css_file = str_replace($match, $val, $css_file);
         }
     }
     // store new css file
     file_put_contents($path, $css_file);
 }
Пример #2
0
 /** close a room
  * this method sets the status of the room to closed
  */
 function close()
 {
     include_once 'functions/date_functions.php';
     $this->setClosureDate(getCurrentDateTimeInMySQL());
     parent::close();
 }