class.tx_nG6_pi5.php 5.69 KB
Newer Older
Jerome Mariette's avatar
Jerome Mariette committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/***************************************************************
*  Copyright notice
*
*  (c) 2009 PF bioinformatique de Toulouse <>
*  All rights reserved
*
*  This script is part of the TYPO3 project. The TYPO3 project is
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*
*  This script 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.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
 * Plugin 'nG6' for the 'nG6' extension.
 *
 * @author	PF bioinformatique de Toulouse <>
 */

require_once(PATH_tslib.'class.tslib_pibase.php');
31
32
require_once(t3lib_extMgm::extPath('nG6').'/lib/class.tx_nG6_utils.php');
require_once(t3lib_extMgm::extPath('nG6').'/lib/class.tx_nG6_db.php');
33
require_once(t3lib_extMgm::extPath('nG6').'/res/smarty/libs/Smarty.class.php'); 
Jerome Mariette's avatar
Jerome Mariette committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

class tx_nG6_pi5 extends tslib_pibase {
	var $prefixId = 'tx_nG6_pi5';		// Same as class name
	var $scriptRelPath = 'pi5/class.tx_nG6_pi5.php';	// Path to this script relative to the extension dir.
	var $extKey = 'nG6';	// The extension key.
	
	//var $pi_checkCHash = TRUE;
	
	/**
	 * Main method of your PlugIn
	 *
	 * @param	string		$content: The content of the PlugIn
	 * @param	array		$conf: The PlugIn Configuration
	 * @return	The content that should be displayed on the website
	 */
49
50
	function main($content,$conf)	{
			
Jerome Mariette's avatar
Jerome Mariette committed
51
52
53
54
55
56
57
		if (strstr($this->cObj->currentRecord,'tt_content'))	{
			$conf['pidList'] = $this->cObj->data['pages'];
			$conf['recursive'] = $this->cObj->data['recursive'];
		}
		$this->pi_loadLL();
		$this->conf=$conf;
		$this->pi_setPiVarDefaults();
58
		$this->pi_USER_INT_obj=1;
Jerome Mariette's avatar
Jerome Mariette committed
59

60
		// Add the jquery libs + the tree plugins and its css
Jerome Mariette's avatar
Jerome Mariette committed
61
62
63
64
65
66
67
68
69
70
71
		$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId] = '
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/jquery.js"></script> 
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/jquery.cookie.js"></script>
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/jquery.hotkeys.js"></script>
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/jquery.jstree.min.js"></script>
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/jquery.ui.core.min.js"></script>
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/jquery.ui.dialog.min.js"></script>
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/jquery.ui.draggable.min.js"></script>
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/jquery.ui.resizable.min.js"></script> 
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/jquery.bgiframe.min.js"></script>
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/jquery.url.packed.js"></script>
72
73
			<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/js/tx_nG6_pi5.js"></script>
			<link type="text/css" rel="stylesheet" media="screen" href="'.t3lib_extMgm::siteRelPath($this->extKey).'res/css/tx_nG6.css"/>
Jerome Mariette's avatar
Jerome Mariette committed
74
75
76
77
			<link type="text/css" rel="stylesheet" media="screen" href="'.t3lib_extMgm::siteRelPath($this->extKey).'res/css/jquery.ui.core.css"/>
			<link type="text/css" rel="stylesheet" media="screen" href="'.t3lib_extMgm::siteRelPath($this->extKey).'res/css/jquery.ui.theme.css"/>
			<link type="text/css" rel="stylesheet" media="screen" href="'.t3lib_extMgm::siteRelPath($this->extKey).'res/css/jquery.ui.dialog.css"/>';

78
79
80
81
82
83
84
		$smarty = new Smarty();
		$smarty->setTemplateDir(t3lib_extMgm::extPath('nG6').'/pi5');
		$smarty->setCompileDir(t3lib_extMgm::extPath('nG6').'/res/smarty/templates_c');
		$smarty->setCacheDir(t3lib_extMgm::extPath('nG6').'/res/smarty/cache');
		$smarty->setConfigDir(t3lib_extMgm::extPath('nG6').'/res/smarty/configs');
		$smarty->security = true;
		$smarty->security_settings['MODIFIER_FUNCS'] = array('count');
85

86
87
88
89
90
		if (isset($this->LOCAL_LANG[$this->LLkey]) && count($this->LOCAL_LANG[$this->LLkey]) > 0) {
			$smarty->assign('llang', $this->LOCAL_LANG[$this->LLkey]);
		} else {
			$smarty->assign('llang', $this->LOCAL_LANG['default']);
		}
91
		
92
93
94
		$smarty->assign('server_name', $this->conf["server_name"]);
		$smarty->assign('data_folder', $this->conf["data"]);
		$smarty->assign('temp_folder', $this->conf["temp"]);
95
		if ($this->conf["directory_prefix"]) {
96
			$smarty->assign('directory_prefix', $this->conf["directory_prefix"]);
Jerome Mariette's avatar
Jerome Mariette committed
97
		} else {
98
			$smarty->assign('directory_prefix', "");
Jerome Mariette's avatar
Jerome Mariette committed
99
		}
100
		$smarty->assign('user_id', $GLOBALS['TSFE']->fe_user->user['uid']);
101
102
		$smarty->assign('tmp_url', substr($this->conf["temp"], strpos($this->conf["temp"], "fileadmin")));

103
		// Build the lists of all elements
Jerome Mariette's avatar
Jerome Mariette committed
104
105
106
		if (!$GLOBALS['TSFE']->loginUser) { $user_id = null; }
		else { $user_id = $GLOBALS['TSFE']->fe_user->user['uid']; }
		$projects = tx_nG6_db::select_all_user_projects($user_id, 'tx_nG6_project.name');
107
		$smarty->assign('projects', $projects);
108
		
109
		return $smarty->fetch('download_view.tpl');
Jerome Mariette's avatar
Jerome Mariette committed
110
111

	}
112
		
Jerome Mariette's avatar
Jerome Mariette committed
113
114
115
116
117
118
}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nG6/pi5/class.tx_nG6_pi5.php'])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nG6/pi5/class.tx_nG6_pi5.php']);
}

119
?>