[TYPO3-UG Italy] visualizzare estensioni

Leucio typo3news at tiscali.it
Fri Oct 13 08:44:38 CEST 2006


salve,
oggi provero a fare i debug come indicato da Mauro e vediamo d capirci qualcosa in+,nel frattempo questo è l'intero codice nel file.
vi terrò aggiornati sulla situazione.
saluti




require_once(PATH_tslib.'class.tslib_pibase.php');

class tx_projectresearch_pi2 extends tslib_pibase {
  var $prefixId = 'tx_projectresearch_pi2';    // Same as class name
  var $scriptRelPath = 'pi2/class.tx_projectresearch_pi2.php';  // Path to this script relative to the extension dir.
  var $extKey = 'projectresearch';  // The extension key.
  var $pi_checkCHash = TRUE;
  
  /**
   * [Put your description here]
   */
  function main($content,$conf)  {
    switch((string)$conf['CMD'])  {
      case 'singleView':
        list($t) = explode(':',$this->cObj->currentRecord);
        $this->internal['currentTable']=$t;
        $this->internal['currentRow']=$this->cObj->data;
        return $this->pi_wrapInBaseClass($this->singleView($content,$conf));
      break;
      default:
        if (strstr($this->cObj->currentRecord,'tt_content'))  {
          $conf['pidList'] = $this->cObj->data['pages'];
          $conf['recursive'] = $this->cObj->data['recursive'];
        }
        return $this->pi_wrapInBaseClass($this->listView($content,$conf));
      break;
    }
  }
  
  /**
   * [Put your description here]
   */
  function listView($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
    
    $lConf = $this->conf['listView.'];  // Local settings for the listView function
  
    if ($this->piVars['showUid'])  {  // If a single element should be displayed:
      $this->internal['currentTable'] = 'tx_projectresearch_project';
      $this->internal['currentRow'] = $this->pi_getRecord('tx_projectresearch_project',$this->piVars['showUid']);
  
      $content = $this->singleView($content,$conf);
      return $content;
    } else {
      $items=array(
        '1'=> $this->pi_getLL('list_mode_1','Mode 1'),
        '2'=> $this->pi_getLL('list_mode_2','Mode 2'),
        '3'=> $this->pi_getLL('list_mode_3','Mode 3'),
      );
      if (!isset($this->piVars['pointer']))  $this->piVars['pointer']=0;
      if (!isset($this->piVars['mode']))  $this->piVars['mode']=1;
  
        // Initializing the query parameters:
      list($this->internal['orderBy'],$this->internal['cresFlag']) = explode(':',"uid");
      $this->internal['results_at_a_time']=t3lib_div::intInRange($lConf['results_at_a_time'],0,1000,10);    // Number of results to show in a listing.
      $this->internal['maxPages']=t3lib_div::intInRange($lConf['maxPages'],0,1000,2);;    // The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc.
      $this->internal['searchFieldList']='titolo,descrizione';
      $this->internal['orderByList']='uid,titolo';
  
        // Get number of records:
      $res = $this->pi_exec_query('tx_projectresearch_project',1);
      list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
  
        // Make listing query, pass query to SQL database:
      $res = $this->pi_exec_query('tx_projectresearch_project');
      $this->internal['currentTable'] = 'tx_projectresearch_project';
  
        // Put the whole list together:
      $fullTable='';  // Clear var;
    #  $fullTable.=t3lib_div::view_array($this->piVars);  // DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line!
  

        // Adds the whole list table
      $fullTable.=$this->pi_list_makelist($res);
  
        // Returns the content from the plugin.
      return $fullTable;
    }
  }
  /**
   * [Put your description here]
   */
  function singleView($content,$conf)  {
    $this->conf=$conf;
    $this->pi_setPiVarDefaults();
    $this->pi_loadLL();
    
  
      // 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'];
  
    $content='<div'.$this->pi_classParam('singleView').'>
      <table>
        <tr>
          <td nowrap valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('titolo').'</p></td>
          <td valign="top"><p>'.$this->getFieldContent('titolo').'</p></td>
        </tr>
        <tr>
          <td nowrap valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('descrizione').'</p></td>
          <td valign="top"><p>'.$this->getFieldContent('descrizione').'</p></td>
        </tr>
        <tr>
          <td nowrap valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('partecipanti').'</p></td>
          <td valign="top"><p>'.$this->getFieldContent('partecipanti').'</p></td>
        </tr>
        <tr>
          <td nowrap valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('documenti').'</p></td>
          <td valign="top"><p>'.$this->getFieldContent('documenti').'</p></td>
        </tr>
        <tr>
          <td nowrap valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('eventi').'</p></td>
          <td valign="top"><p>'.$this->getFieldContent('eventi').'</p></td>
        </tr>
        <tr>
          <td nowrap valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('tesi').'</p></td>
          <td valign="top"><p>'.$this->getFieldContent('tesi').'</p></td>
        </tr>
      </table>
    <p>'.$this->pi_list_linkSingle($this->pi_getLL('back','Indietro'),0).'</p></div>'.
    $this->pi_getEditPanel();
  
    return $content;
  }
  /**
   * [Put your description here]
   */
  function pi_list_row($c)  {
    $editPanel = $this->pi_getEditPanel();
    if ($editPanel)  $editPanel='<TD>'.$editPanel.'</TD>';
  
    return '<tr'.($c%2 ? $this->pi_classParam('listrow-odd') : '').'>
        <td valign="top"><p>'.$this->getFieldContent('titolo').'</p></td>
      </tr>';
  }
  /**
   * [Put your description here]
   */
  function pi_list_header()  {
    return '<tr'.$this->pi_classParam('listrow-header').'>
        <td><h1><p>'.$this->getFieldHeader_sortLink('titolo').'</p></h1></td></tr>';
  }
  /**
   * [Put your description here]
   */
  function getFieldContent($fN)  {
    switch($fN) {
      case 'titolo':
        return $this->pi_list_linkSingle($this->internal['currentRow'][$fN],$this->internal['currentRow']['uid'],1);  // The "1" means that the display of single items is CACHED! Set to zero to disable caching.
      break;
      case 'partecipanti':
        return $this->getPartecipanti($this->internal['currentRow']['uid']);
        break;
      default:
        return $this->internal['currentRow'][$fN];
      break;
    }
  }
  /**
   * [Put your description here]
   */
  function getFieldHeader($fN)  {
    switch($fN) {
      
      default:
        return $this->pi_getLL('listFieldHeader_'.$fN,'['.$fN.']');
      break;
    }
  }
  
  /**
   * [Put your description here]
   */
  function getFieldHeader_sortLink($fN)  {
    return $this->pi_linkTP_keepPIvars($this->getFieldHeader($fN),array('sort'=>$fN.':'.($this->internal['descFlag']?0:1)));
  }
}



/*
function di selezione dei partecipanti a un progetto
*/

  function getPartecipanti($fN){

  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
    '*',
    'tx_projectresearch_project_partecipanti_mm',
    'uid_local="'.$fN );
while($row = mysql_fetch_array($res))    {
    $rows[] = $row;
}
$t=count($rows);
mysql_free_result($res);
if (count($rows))    echo $row['uid_foreign'];
return $t;
  }

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/projectresearch/pi2/class.tx_projectresearch_pi2.php'])  {
  include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/projectresearch/pi2/class.tx_projectresearch_pi2.php']);
}

?>
"Federico Bernardin" <federico.bernardin at immaginario.com> ha scritto nel messaggio news:mailman.15862.1160654915.20124.typo3-ug-italy at lists.netfielders.de...


Ciao Leuccio,
prova a postare od inviarmi l'intero file, perché ci sono alcune cose non
troppo chiare.

Ciao
Federico


-----Messaggio originale-----
Da: typo3-ug-italy-bounces at lists.netfielders.de
[mailto:typo3-ug-italy-bounces at lists.netfielders.de] Per conto di Leucio
Inviato: giovedì 12 ottobre 2006 13.08
A: typo3-ug-italy at lists.netfielders.de
Oggetto: Re: [TYPO3-UG Italy] visualizzare estensioni

ciao ragazzi,
in questi giorni d frenetico studio e sperimentazione dei manuali suggeriti
da Mauro credevo d esser giunto a una conclusione, in realtà non funziona
nulla!

il compito è:"visualizzare un elenco d utenti che partecipano ad un
progetto"

tra utenti e progetti ho relazioni N-N mantenute in una tabella del db
tx_progettiricerca_progetti_utenti_mm

ho provato ad visualizzare gli utenti in questo modo:
nel class.tx_projectresearch_pi1.php ho inserito nello switch del
getFieldContent un case 'partecipanti'

case 'partecipanti':
        return $this->getPartecipanti($this->internal['currentRow']['uid']);
break;


nel file ho messo la funzione getPartecipanti cosi definita:

function getPartecipanti($fN){

  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
    '*',
    'tx_progettiricerca_progetti_utenti_mm',
    'uid_local="'.$fN );
while($row = $GLOBALS['TYPO3_DB']->mysql_fetch_array($res))    {
    $rows[] = $row;
}
return $rows;
  }

ho omesso la parte di selezione utenti per non appesantire il codice,
praticamente ho messo solo la parte che seleziona gli uid degli utenti del
progetto da visualizzare e anche nello switch non ho messo il link.

non mi da errori ma nemmeno mi fa vedere qualcosa!mi da spazio bianco!

credo che a livello di sql non ci siano problemi, e sono praticamente certo
che l'errore è nel php.

magari se qualcuno d voi saprebbe darmi un suggerimento/esempio.

so che la cosa è un po pesante da soddisfare, ma spero lo stesso nella buona
volontà di qualcuno d voi!

un saluto

Leucio


  "Leucio" <typo3news at tiscali.it> ha scritto nel messaggio
news:mailman.1.1160070945.7211.typo3-ug-italy at lists.netfielders.de...
  grazie jan,
  ora mi è un po + chiaro,e infatti sto capendo un po di+ d come funzionano
le estensioni.

  ora sto mettendo mano al codice,xo sto incontrando un po di difficolta non
tanto nel modificare o nel cancellare parti di codice che non mi servono, ma
soprattutto quando devo creare.

  il problema è che il mio php è a livelli beginner!

  nel caso in questione ho la funzione getFieldContent che in base al campo
mi visualizza il contenuto attraverso uno switch.
  per i tipi semplici non incontro particolari problemi, xo nel caso in cui
ho relazioni M-M nel DB non so come fare,
  ho la tabella che mantiene chiavi esterne e chiavi primarie e con lo
script riuscivo attraverso una query a visualizzare un elenco degli oggetti
contenuti.
  in questo modo non saprei.

  sapreste spiegarmi come posso impostare una query generica?poi ovviamente
la aggiusto io

  vi ringrazio anticipatamente.

  Ricci Leuciantonio
_______________________________________________
TYPO3-UG-italy mailing list
TYPO3-UG-italy at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-ug-italy

----------------------------------------
Io utilizzo la versione gratuita di SPAMfighter per utenti privati. Sino ad
ora
 ha rimosso 4803 mail spam. 
 Gli utenti paganti non hanno questo messaggio nelle loro email .
 Prova gratuitamente SPAMfighter qui:http://www.spamfighter.com/lit


More information about the TYPO3-UG-italy mailing list