Commit 447f741e authored by Jerome Mariette's avatar Jerome Mariette
Browse files

sql ok

parent 4505abaa
......@@ -27,14 +27,13 @@
* @author PF bioinformatique de Toulouse <>
*/
require_once(PATH_tslib.'class.tslib_pibase.php');
class tx_nG6_pi1 extends tslib_pibase {
var $prefixId = 'tx_nG6_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.tx_nG6_pi1.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
......@@ -44,36 +43,38 @@ class tx_nG6_pi1 extends tslib_pibase {
* @return The content that should be displayed on the website
*/
function main($content,$conf) {
if (strstr($this->cObj->currentRecord,'tt_content')) {
$conf['pidList'] = $this->cObj->data['pages'];
$conf['recursive'] = $this->cObj->data['recursive'];
}
$this->internal['results_at_a_time'] = $conf["results_at_a_time"];
$this->pi_loadLL();
$this->conf=$conf; // Setting the TypoScript passed to this function in $this->conf
$this->pi_setPiVarDefaults();
$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
$this->pi_loadLL(); // Loading the LOCAL_LANG values
if ($this->userIsAuthorized()) {
switch((string)$conf['view']) {
switch((string)$this->conf['view']) {
case 'project':
if ($this->piVars['analyze_id']) {
return $this->pi_wrapInBaseClass($this->pi_analyze_single_view($content,$conf));
return $this->pi_wrapInBaseClass($this->pi_analyze_single_view());
} elseif ($this->piVars['project_id'] && $this->piVars['run_id']) {
return $this->pi_wrapInBaseClass($this->pi_run_view($content,$conf));
return $this->pi_wrapInBaseClass($this->pi_run_view());
} else {
return $this->pi_wrapInBaseClass($this->pi_project_view($content,$conf));
return $this->pi_wrapInBaseClass($this->pi_project_view());
}
break;
case 'run':
if ($this->piVars['analyze_id']) {
return $this->pi_wrapInBaseClass($this->pi_analyze_single_view($content,$conf));
return $this->pi_wrapInBaseClass($this->pi_analyze_single_view());
} else {
return $this->pi_wrapInBaseClass($this->pi_run_view($content,$conf));
return $this->pi_wrapInBaseClass($this->pi_run_view());
}
break;
case 'analyze':
return $this->pi_wrapInBaseClass($this->pi_analyze_view($content,$conf));
return $this->pi_wrapInBaseClass($this->pi_analyze_view());
break;
default:
return $this->pi_wrapInBaseClass($this->pi_project_view($content,$conf));
return $this->pi_wrapInBaseClass($this->pi_project_view());
break;
}
} else {
......@@ -84,37 +85,40 @@ class tx_nG6_pi1 extends tslib_pibase {
/**
* Shows a list of database entries
*
* @param string $content: content of the PlugIn
* @param array $conf: PlugIn Configuration
* @return HTML list of table entries
*/
function pi_project_view($content,$conf) {
$this->conf=$conf; // Setting the TypoScript passed to this function in $this->conf
$this->pi_setPiVarDefaults();
$this->pi_loadLL(); // Loading the LOCAL_LANG values
$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
if ($this->piVars['project_id']) { // If a single element should be displayed:
$this->internal['currentTable'] = 'tx_nG6_project';
function pi_project_view() {
if ($this->piVars['project_id']) { // If a single element should be displayed
$this->internal['currentRow'] = $this->pi_getRecord('tx_nG6_project',$this->piVars['project_id']);
return $this->pi_project_single_view($content,$conf);
return $this->pi_project_single_view();
} else {
if (!$GLOBALS['TSFE']->loginUser) { // If the user is not logged on
// Make listing query, pass query to SQL database:
$res = $this->pi_exec_query('tx_nG6_project',0,'AND fe_group=0');
$this->internal['currentTable'] = 'tx_nG6_project';
$resc = $this->pi_exec_query('tx_nG6_project',1,'AND fe_group=0');
list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($resc);
} else {
// Make listing query, pass query to SQL database:
$res = $this->pi_exec_query('tx_nG6_project',0,'AND fe_group IN('.$this->getCurrentUserGroups().')');
$this->internal['currentTable'] = 'tx_nG6_project';
$resc = $this->pi_exec_query('tx_nG6_project',1,'AND fe_group IN('.$this->getCurrentUserGroups().')');
list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($resc);
// If the user is not logged on display demonstration project
if (!$GLOBALS['TSFE']->loginUser) {
$queryParts = array(
'SELECT' => '*',
'FROM' => 'tx_nG6_project',
'WHERE' => 'fe_group=0',
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
} else {
$queryParts = array(
'SELECT' => '*',
'FROM' => 'tx_nG6_project',
'WHERE' => 'fe_group IN ('.$this->getCurrentUserGroups().')',
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
}
if ($this->internal['res_count'] > 0) {
// If there is at least one result
if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) {
return $this->pi_project_list_view($res);
} else {
} else { // If no results
return $this->getFieldHeader('no_raw');
}
}
......@@ -122,7 +126,7 @@ class tx_nG6_pi1 extends tslib_pibase {
/**
* Creates a list from a database query
*
*
* @param ressource $res: A database result ressource
* @return A HTML list if result items
*/
......@@ -143,102 +147,76 @@ class tx_nG6_pi1 extends tslib_pibase {
/**
* Display a single item from the database
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @return HTML of a single database entry
*/
function pi_project_single_view($content, $conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
// This sets the title of the page for use in indexed search results:
if ($this->internal['currentRow']['title']) $GLOBALS['TSFE']->indexedDocTitle=$this->internal['currentRow']['title'];
function pi_project_single_view() {
$content = '<div'.$this->pi_classParam('singleView').'>
<h2>Projet '.$this->internal['currentRow']['name'].' :</h2>
<p><strong>'.$this->getFieldContent('description').'</strong></p>
</div>'.$this->pi_getEditPanel().$this->pi_run_view($content, $conf, $this->internal['currentRow']['uid']);
$content .= $this->pi_analyze_view($content, $conf, 'project');
</div>'.$this->pi_getEditPanel().$this->pi_run_view($content, $this->conf, $this->internal['currentRow']['uid']);
$content .= $this->pi_analyze_view('project');
return $content;
}
/**
* Shows a list of database entries
*
* @param string $content: content of the PlugIn
* @param array $conf: PlugIn Configuration
* @return HTML list of table entries
*/
function pi_run_view($content, $conf) {
$this->conf=$conf; // Setting the TypoScript passed to this function in $this->conf
$this->pi_setPiVarDefaults();
$this->pi_loadLL(); // Loading the LOCAL_LANG values
$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
$lConf = $this->conf['listView.']; // Local settings for the listView function
if ($this->piVars['run_id']) { // If a single element should be displayed:
$this->internal['currentTable'] = 'tx_nG6_run';
$this->internal['currentRow'] = $this->pi_getRecord('tx_nG6_run',$this->piVars['run_id']);
$content = $this->pi_run_single_view($content,$conf);
return $content;
} else {
function pi_run_view() {
if ($this->piVars['run_id']) { // If a single element should be displayed:
$queryParts = array(
'SELECT' => 'tx_nG6_run.uid AS run_id, tx_nG6_run.name AS name, tx_nG6_project.name AS project_name,' .
'tx_nG6_run.date AS run_date, tx_nG6_run.species AS run_species, tx_nG6_run.data_nature AS run_data_nature,' .
'tx_nG6_run.type AS run_type, tx_nG6_run.nb_sequences AS run_nb_sequences, tx_nG6_run.full_seq_size AS run_full_seq_size,' .
'tx_nG6_run.description AS run_description, tx_nG6_run.sequencer AS run_sequencer,' .
'tx_nG6_run.directory AS run_directory, tx_nG6_project.name AS project_name',
'FROM' => 'tx_nG6_run INNER JOIN (tx_nG6_project_run INNER JOIN tx_nG6_project ON tx_nG6_project_run.project_id=tx_nG6_project.uid)' .
'ON tx_nG6_run.uid=tx_nG6_project_run.run_id',
'WHERE' => 'tx_nG6_run.uid='.$this->piVars['run_id'],
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$this->internal['currentRow'] = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
return $this->pi_run_single_view();
} else {
// First off, build the rigth sql request
if ($this->piVars['project_id']) {
$where = 'tx_nG6_project_run.project_id = '.$this->piVars['project_id'];
$this->internal['res_count'] = 1;
$where = 'tx_nG6_project_run.project_id='.$this->piVars['project_id'];
} else {
if (!$GLOBALS['TSFE']->loginUser) { // If the user is not logged on
$res = $this->pi_exec_query('tx_nG6_project',0,'AND fe_group=0');
$this->internal['currentTable'] = 'tx_nG6_project';
$resc = $this->pi_exec_query('tx_nG6_project',1,'AND fe_group=0');
list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($resc);
$where = 'tx_nG6_project_run.project_id IN (';
while($this->internal['currentRow'] = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$where .= $this->internal['currentRow']['uid'] . ",";
}
$where = substr($where, 0, -1) . ")";
} else {
$res = $this->pi_exec_query('tx_nG6_project',0,'AND fe_group IN ('.$this->getCurrentUserGroups().')');
$this->internal['currentTable'] = 'tx_nG6_project';
$resc = $this->pi_exec_query('tx_nG6_project',1,'AND fe_group IN ('.$this->getCurrentUserGroups().')');
list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($resc);
$where = 'tx_nG6_project_run.project_id IN (';
while($this->internal['currentRow'] = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$where .= $this->internal['currentRow']['uid'] . ",";
}
$where = substr($where, 0, -1) . ")";
}
}
if ($this->internal['res_count'] > 0) {
$queryParts = array(
'SELECT' => 'run_id',
'FROM' => 'tx_nG6_project_run',
'WHERE' => $where,
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$where = 'AND tx_nG6_run.uid IN (';
while($this->internal['currentRow'] = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$where .= $this->internal['currentRow']['run_id'] . ",";
}
$where = substr($where, 0, -1) . ")";
$where .= " ORDER BY date DESC";
$res = $this->pi_exec_query('tx_nG6_run', 0, $where);
$this->internal['currentTable'] = 'tx_nG6_run';
// Returns the content from the plugin.
return $this->pi_run_list_view($res);
} else {
return $this->getFieldHeader('no_raw');
}
}
}
$where = 'project_id IN ('.$GLOBALS['TYPO3_DB']->SELECTquery('uid', 'tx_nG6_project', 'fe_group=0').')';
} else {
$where = 'project_id IN ('.$GLOBALS['TYPO3_DB']->SELECTquery('uid', 'tx_nG6_project', 'fe_group IN('.$this->getCurrentUserGroups().')').')';
}
}
// Then execute it
$queryParts = array(
'SELECT' => 'tx_nG6_run.uid AS run_id, tx_nG6_run.name AS name, tx_nG6_project.name AS project_name,' .
'tx_nG6_run.date AS run_date, tx_nG6_run.species AS run_species, tx_nG6_run.data_nature AS run_data_nature,' .
'tx_nG6_run.type AS run_type, tx_nG6_run.nb_sequences AS run_nb_sequences, tx_nG6_run.full_seq_size AS run_full_seq_size,' .
'tx_nG6_run.description AS run_description, tx_nG6_run.sequencer AS run_sequencer, tx_nG6_project.name AS project_name',
'FROM' => 'tx_nG6_run INNER JOIN (tx_nG6_project_run INNER JOIN tx_nG6_project ON tx_nG6_project_run.project_id=tx_nG6_project.uid)' .
'ON tx_nG6_run.uid=tx_nG6_project_run.run_id',
'WHERE' => $where,
'GROUPBY' => '',
'ORDERBY' => 'date DESC',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) { // There is some results to display
return $this->pi_run_list_view($res);
} else { // no results
return $this->getFieldHeader('no_raw');
}
}
}
/**
* Creates a list from a database query
*
......@@ -264,43 +242,18 @@ class tx_nG6_pi1 extends tslib_pibase {
<th>'.$this->getFieldHeader('sequencer').'</td>
</tr>';
while($this->internal['currentRow'] = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// First let's get the run's project name
$queryParts = array(
'SELECT' => 'project_id',
'FROM' => 'tx_nG6_project_run',
'WHERE' => 'run_id='.$this->internal['currentRow']['uid'],
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res1 = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$val = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1);
$queryParts = array(
'SELECT' => 'name',
'FROM' => 'tx_nG6_project',
'WHERE' => 'uid='.$val['project_id'],
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res2 = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$val = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2);
$project_name = $val['name'];
$content .= '<tr>
<td>'.$this->getFieldContent('name', array('run_id'=>$this->internal['currentRow']['uid'], 'project_id'=>$this->piVars['project_id'])).'</td>
<td>'.$project_name.'</td>
<td>'.$this->getFieldContent('date').'</td>
<td>'.$this->getFieldContent('species').'</td>
<td>'.$this->getFieldContent('data_nature').'</td>
<td>'.$this->getFieldContent('type').'</td>
<td>'.$this->getFieldContent('nb_sequences').'</td>
<td>'.$this->getFieldContent('full_seq_size').'</td>
<td>'.$this->getFieldContent('description').'</td>
<td>'.$this->getFieldContent('sequencer').'</td>
<td>'.$this->getFieldContent('name', array('run_id'=>$this->internal['currentRow']['run_id'], 'project_id'=>$this->piVars['project_id'])).'</td>
<td>'.$this->getFieldContent('project_name').'</td>
<td>'.$this->getFieldContent('run_date').'</td>
<td>'.$this->getFieldContent('run_species').'</td>
<td>'.$this->getFieldContent('run_data_nature').'</td>
<td>'.$this->getFieldContent('run_type').'</td>
<td>'.$this->getFieldContent('run_nb_sequences').'</td>
<td>'.$this->getFieldContent('run_full_seq_size').'</td>
<td>'.$this->getFieldContent('run_description').'</td>
<td>'.$this->getFieldContent('run_sequencer').'</td>
</tr>';
$i+=1;
}
$content .= '</table>';
return $content;
......@@ -308,148 +261,96 @@ class tx_nG6_pi1 extends tslib_pibase {
/**
* Display a single item from the database
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @param ressource $res: A database result ressource
* @return HTML of a single database entry
*/
function pi_run_single_view($content,$conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
// This sets the title of the page for use in indexed search results:
if ($this->internal['currentRow']['title']) $GLOBALS['TSFE']->indexedDocTitle=$this->internal['currentRow']['title'];
// First let's get the run's project name
$queryParts = array(
'SELECT' => 'project_id',
'FROM' => 'tx_nG6_project_run',
'WHERE' => 'run_id='.$this->piVars['run_id'],
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$val = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$queryParts = array(
'SELECT' => 'name',
'FROM' => 'tx_nG6_project',
'WHERE' => 'uid='.$val['project_id'],
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$val = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$project_name = $val['name'];
function pi_run_single_view() {
$content = '<div'.$this->pi_classParam('singleView').'><h2>Run '.$this->internal['currentRow']['name'].' :</h2>';
$content .= '<p><strong>'.$this->getFieldContent('description').'</strong></p> </div>
$content .= '<p><strong>'.$this->getFieldContent('run_description').'</strong></p> </div>
<table'.$this->pi_classParam('listrow').'>
<tr>
<th align="left">'.$this->getFieldHeader('project_name').' :</th>
<td align="left">'.$project_name.'</td>
<td align="left">'.$this->getFieldContent('project_name').'</td>
</tr>
<tr>
<th align="left">'.$this->getFieldHeader('date').' :</th>
<td align="left">'.$this->getFieldContent('date').'</td>
<td align="left">'.$this->getFieldContent('run_date').'</td>
</tr>
<tr>
<th align="left">'.$this->getFieldHeader('species').' :</th>
<td align="left">'.$this->getFieldContent('species').'</td>
<td align="left">'.$this->getFieldContent('run_species').'</td>
</tr>
<tr>
<th align="left">'.$this->getFieldHeader('type').' :</th>
<td align="left">'.$this->getFieldContent('type').'</td>
<td align="left">'.$this->getFieldContent('run_type').'</td>
</tr>
<tr>
<th align="left">'.$this->getFieldHeader('data_nature').' :</th>
<td align="left">'.$this->getFieldContent('data_nature').'</td>
<td align="left">'.$this->getFieldContent('run_data_nature').'</td>
</tr>
<tr>
<th align="left">'.$this->getFieldHeader('nb_sequences').' :</th>
<td align="left">'.$this->getFieldContent('nb_sequences').'</td>
<td align="left">'.$this->getFieldContent('run_nb_sequences').'</td>
</tr>
<tr>
<th align="left">'.$this->getFieldHeader('full_seq_size').' :</th>
<td align="left">'.$this->getFieldContent('full_seq_size').'</td>
<td align="left">'.$this->getFieldContent('run_full_seq_size').'</td>
</tr>
<tr>
<th align="left">'.$this->getFieldHeader('sequencer').' :</th>
<td align="left">'.$this->getFieldContent('sequencer').'</td>
<td align="left">'.$this->getFieldContent('run_sequencer').'</td>
</tr>
<tr>
<th align="left">'.$this->getFieldHeader('downloads').' :</th>
<td align="left">'.$this->get_downloads_list($conf).'</td>
<td align="left">'.$this->get_downloads_list().'</td>
</tr>
</table>';
$content .= $this->pi_analyze_view($content, $conf, 'run');
$content .= $this->pi_analyze_view('run');
return $content.$this->pi_getEditPanel();
}
/**
* Shows a list of database entries
*
* @param string $content: content of the PlugIn
* @param array $conf: PlugIn Configuration
* @param string $type: What kind of analyze is it : run or project
* * @return HTML list of table entries
*/
function pi_analyze_view($content,$conf, $type) {
$this->conf=$conf; // Setting the TypoScript passed to this function in $this->conf
$this->pi_setPiVarDefaults();
$this->pi_loadLL(); // Loading the LOCAL_LANG values
$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
function pi_analyze_view($type) {
if ($this->piVars['analyze_id']) { // If a single element should be displayed:
$this->internal['currentTable'] = 'tx_nG6_analyze';
$this->internal['currentRow'] = $this->pi_getRecord('tx_nG6_analyze',$this->piVars['analyze_id']);
return $this->pi_analyze_single_view($content,$conf);
return $this->pi_analyze_single_view();
} else {
if ($type == 'run') {
// Selects Analyzis done on this run
$queryParts = array(
'SELECT' => 'analyze_id',
'FROM' => 'tx_nG6_run_analyze',
'SELECT' => 'tx_nG6_analyze.uid AS uid, tx_nG6_analyze.name AS name, tx_nG6_analyze.description AS description,' .
'tx_nG6_analyze.software AS software, tx_nG6_analyze.version AS version',
'FROM' => 'tx_nG6_analyze INNER JOIN tx_nG6_run_analyze ON tx_nG6_analyze.uid=tx_nG6_run_analyze.analyze_id',
'WHERE' => 'tx_nG6_run_analyze.run_id = '.$this->piVars['run_id'],
'GROUPBY' => '',
'ORDERBY' => '',
'ORDERBY' => 'name',
'LIMIT' => ''
);
} elseif ($type == 'project') {
// Selects Analyzis done on this project
$queryParts = array(
'SELECT' => 'analyze_id',
'FROM' => 'tx_nG6_project_analyze',
'SELECT' => 'tx_nG6_analyze.uid AS uid, tx_nG6_analyze.name AS name, tx_nG6_analyze.description AS description,' .
'tx_nG6_analyze.software AS software, tx_nG6_analyze.version AS version',
'FROM' => 'tx_nG6_analyze INNER JOIN tx_nG6_project_analyze ON tx_nG6_analyze.uid=tx_nG6_project_analyze.analyze_id',
'WHERE' => 'tx_nG6_project_analyze.project_id = '.$this->piVars['project_id'],
'GROUPBY' => '',
'ORDERBY' => '',
'ORDERBY' => 'name',
'LIMIT' => ''
);
}
}
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
// Put the whole list together:
$fullTable=''; // Clear var;
$content='';
if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) {
$where = 'AND tx_nG6_analyze.uid IN (';
while($this->internal['currentRow'] = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$where .= $this->internal['currentRow']['analyze_id'] . ",";
}
$where = substr($where, 0, -1) . ")";
$where .= 'ORDER BY name';
$res = $this->pi_exec_query('tx_nG6_analyze', 0, $where);
$this->internal['currentTable'] = 'tx_ng6_analyze';
// Adds the whole list table
$fullTable.=$this->pi_analyze_list_view($res);
$content.=$this->pi_analyze_list_view($res);
}
// Returns the content from the plugin.
return $fullTable;
return $content;
}
}
......@@ -480,35 +381,25 @@ class tx_nG6_pi1 extends tslib_pibase {
return $content;
}
/**
* Display a single item from the database
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
* @return HTML of a single database entry
*/
function pi_analyze_single_view($content, $conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
// This sets the title of the page for use in indexed search results:
if ($this->internal['currentRow']['title']) $GLOBALS['TSFE']->indexedDocTitle=$this->internal['currentRow']['title'];
$this->internal['currentTable'] = 'tx_nG6_analyze';
function pi_analyze_single_view() {
$this->internal['currentRow'] = $this->pi_getRecord('tx_nG6_analyze',$this->piVars['analyze_id']);
$content = '<div'.$this->pi_classParam('singleView').'><h2>Analyse '.$this->internal['currentRow']['name'].' : <span>'.$this->getFieldContent('description').'</span></h2></div>';
if (file_exists($conf['data'].$this->internal['currentRow']['directory'].'/index.html' ))
if (file_exists($this->conf['data'].$this->internal['currentRow']['directory'].'/index.html' ))
{
$fp = fopen((string)$conf['data'].$this->internal['currentRow']['directory'].'/index.html',"r"); //lecture du fichier
$fp = fopen((string)$this->conf['data'].$this->internal['currentRow']['directory'].'/index.html',"r"); //lecture du fichier
while (!feof($fp)) { //on parcourt toutes les lignes
$content .= fgets($fp, 4096); // lecture du contenu de la ligne
}
}
else
{
else {
$content .= $this->getFieldHeader('not_synchro');
}
return $content;
......@@ -523,10 +414,10 @@ class tx_nG6_pi1 extends tslib_pibase {
function getFieldContent($fN, $mergeArr=array()) {
switch($fN) {
case 'uid':
return $this->pi_list_linkSingle($this->internal['currentRow'][$fN],$this->internal['currentRow']['uid'],1, $mergeArr); // The "1" means that the display of single items is CACHED! Set to zero to disable caching.
return $this->pi_list_linkSingle($this->internal['currentRow'][$fN],$this->internal['currentRow']['uid'],1, $mergeArr);
break;
case 'name':
return $this->pi_list_linkSingle($this->internal['currentRow'][$fN],$this->internal['currentRow']['uid'],1, $mergeArr); // The "1" means that the display of single items is CACHED! Set to zero to disable caching.
return $this->pi_list_linkSingle($this->internal['currentRow'][$fN],$this->internal['currentRow']['uid'],1, $mergeArr);
break;
case 'date':
// %A %e. %B %Y
......@@ -596,11 +487,10 @@ class tx_nG6_pi1 extends tslib_pibase {
/**
* Display a list of downloadable file
*
* @param array $conf: The PlugIn configuration
* @return HTML of a list of downlabale links
*/
function get_downloads_list($conf) {
$directory = (string)$conf['data'].$this->internal['currentRow']['directory'];
function get_downloads_list() {
$directory = (string)$this->conf['data'].$this->internal['currentRow']['run_directory'];