public function setUp()
 {
     parent::setUp();
     $this->service = PlatformThemingService::singleton();
     // Save current Theming config...
     $this->tempConfig = $this->service->retrieveThemingConfig();
     // Set up all tests with an empty Theming Configuration.
     $this->service->syncThemingConfig(new PlatformThemingConfig());
     // Deal with data storage.
     $testFile = rtrim(sys_get_temp_dir(), "\\/") . '/tmp-platformthemingtest.txt';
     file_put_contents($testFile, 'data');
 }
 * of the License (non-upgradable).
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 * Copyright (c) 2015 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
 *               
 */
use oat\taoThemingPlatform\model\PlatformThemingService;
/*
 * This post-installation script creates a data storage directory
 * for the taoThemingPlatform extension.
 */
$dataPath = FILES_PATH . 'taoThemingPlatform' . DIRECTORY_SEPARATOR;
if (file_exists($dataPath)) {
    helpers_File::emptyDirectory($dataPath);
}
// Create extension datasource.
$source = tao_models_classes_FileSourceService::singleton()->addLocalSource('Platform Theming datasource', $dataPath);
// Create the assets directory which will contain theming assets.
mkdir($dataPath . 'assets');
$directory = new core_kernel_file_File($source->createFile('', 'assets'));
// Assets storage is now set to '/data/taoThemingPlatform/assets'.
PlatformThemingService::singleton()->setDataDirectory($directory);
Exemplo n.º 3
0
 public static function getCopyrightNotice()
 {
     $copyrightNotice = '';
     if (self::isThemingEnabled() === true) {
         $themingService = PlatformThemingService::singleton();
         $themingConfig = $themingService->retrieveThemingConfig();
         if (empty($themingConfig['copyright_notice']) === false) {
             $copyrightNotice = $themingConfig['copyright_notice'];
         }
     }
     return $copyrightNotice;
 }
 /**
  * Get a file from the data directory as the HTTP response with the appropriate
  * content-type header set.
  */
 public function getFile()
 {
     $file = $this->getRequestParameter('file');
     $service = PlatformThemingService::singleton();
     $dataDirectory = $service->getDataDirectory();
     $finalPath = rtrim($dataDirectory->getAbsolutePath(), "\\/") . DIRECTORY_SEPARATOR . $file;
     if (tao_helpers_File::securityCheck($finalPath, true) === false) {
         die;
     }
     $mime = tao_helpers_File::getMimeType($finalPath, true);
     if ($this->hasRequestParameter('download')) {
         header('Content-disposition: attachment; filename=theme.css');
     }
     header('Content-Type: ' . $mime);
     echo file_get_contents($finalPath);
 }