linea21-core
[ class tree: linea21-core ] [ index: linea21-core ] [ all elements ]

Source for file display.php

Documentation is available at display.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage search
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. themeInclude('../search/' SQL '.inc.php');
  12.  
  13. /**
  14.  * LogKeywordsSearch()
  15.  * 
  16.  * @param string $keywords 
  17.  * @param string $type 
  18.  * @param string $rub =-1 (option)
  19.  * @return void 
  20.  */
  21. function LogKeywordsSearch($keywords$type$searchtype$rub = -1)
  22. {
  23.     $sep '##';
  24.     $fp @fopen(LOG_KEYWORDS'a');
  25.     @fwrite($fp$keywords $sep)// mots clefs
  26.     @fwrite($fp$type $sep)// type ADMIN ou PUBLIC
  27.     @fwrite($fp$searchtype $sep)// type de recherche
  28.     if ($rub != -1@fwrite($fp$rub $sep)// rubrique matchées
  29.     @fwrite($fpi2c_realip($sep)// adresse
  30.     @fwrite($fpdate('[d-m-y H:i:s]' $sep))// date
  31.     @fwrite($fpdate("\n"));
  32.     @fclose($fp);
  33.  
  34. /**
  35.  * MatchDataFormat()
  36.  * 
  37.  * @param string $keywords 
  38.  * @param string $searchtype 
  39.  * @return string $formatted_keywords
  40.  */
  41. function MatchDataFormat($keywords$searchtype)
  42. {
  43.     $keywords trim(addslashes($keywords));
  44.     switch ($searchtype{
  45.         case 'one':
  46.         if(strtolower(SQL)=='pgsql'{
  47.         $words explode(' '$keywords);
  48.         $formatted_keywords '';
  49.         $op='';
  50.         foreach($words as $value{
  51.             $formatted_keywords .= $op $value;
  52.             $op=' | ';
  53.             }
  54.         trim($formatted_keywords);
  55.         }
  56.         if(strtolower(SQL)=='mysql'{
  57.         $formatted_keywords $keywords;
  58.         }
  59.             break;
  60.         case 'all':
  61.             $words explode(' '$keywords);
  62.             $formatted_keywords '';
  63.         $op='';
  64.             foreach($words as $value{
  65.             $formatted_keywords .= $op $value;
  66.             if(strtolower(SQL)=='pgsql'$op=' & ';
  67.             if(strtolower(SQL)=='mysql'$op=' + ';
  68.         }
  69.             trim($formatted_keywords);
  70.             break;
  71.         case 'exp':
  72.         if(strtolower(SQL)=='pgsql'{
  73.         $words explode(' '$keywords);
  74.         $formatted_keywords '';
  75.         $op='';
  76.         foreach($words as $value{
  77.             $formatted_keywords .= $op $value;
  78.             $op=' & ';
  79.             }
  80.         trim($formatted_keywords);
  81.         }
  82.         if(strtolower(SQL)=='mysql'{
  83.         $formatted_keywords '"' $keywords '"';
  84.         }
  85.             break;
  86.         default:
  87.             if(strtolower(SQL)=='pgsql'{
  88.         $words explode(' '$keywords);
  89.         $formatted_keywords '';
  90.         $op='';
  91.         foreach($words as $value{
  92.             $formatted_keywords .= $op $value;
  93.             $op=' | ';
  94.             }
  95.         trim($formatted_keywords);
  96.         }
  97.         if(strtolower(SQL)=='mysql'{
  98.         $formatted_keywords $keywords;
  99.         }
  100.             break;
  101.     
  102.     return $formatted_keywords;
  103.  
  104. function GetStatus($short_status)
  105. {
  106.     $write ' - ';
  107.     switch ($short_status{
  108.         case 'PA':
  109.             $write .= _t('statut','PA');
  110.             break;
  111.         case 'AA':
  112.             $write .= _t('statut','AA');
  113.             break;
  114.         case 'P':
  115.             $write '';
  116.             break;
  117.         case 'Y':
  118.             $write '';
  119.             break;
  120.         case 'D':
  121.             $write .= _t('statut','draft');
  122.             break;
  123.         default:
  124.             $write '';
  125.     
  126.     return $write;
  127.  
  128. /**
  129.  * DisplayPublicResults()
  130.  * 
  131.  * @param string $keywords 
  132.  * @param string $searchtype 
  133.  * @return void (echo)
  134.  ***/
  135. function DisplayPublicResults($keywords$searchtype)
  136. {
  137.     $type 'PUBLIC';
  138.     if(defined('MOD_PROJECT'&& MOD_PROJECT == trueDisplaySearchProject($keywords$type$searchtype);
  139.     if(defined('MOD_NEWS'&& MOD_NEWS == trueDisplaySearchNews($keywords$type$searchtype);
  140.     //echo '<hr />';
  141.     if(defined('MOD_PUBLICATION'&& MOD_PUBLICATION == trueDisplaySearchPublication($keywords$type$searchtype)
  142.     // echo '<hr />';
  143.     if(defined('MOD_PUBLICATION'&& MOD_PUBLICATION == trueDisplaySearchPubliContents($keywords$type$searchtype);
  144.     //echo '<hr />';
  145.     if(defined('MOD_WORKSHOP'&& MOD_WORKSHOP == trueDisplaySearchWorkshop($keywords$type$searchtype)
  146.     // echo '<hr />';
  147.     if(defined('MOD_WORKSHOP'&& MOD_WORKSHOP == trueDisplaySearchWorkshopRep($keywords$type$searchtype)
  148.     // echo '<hr />';
  149.     if(defined('MOD_WORKSHOP'&& MOD_WORKSHOP == trueDisplaySearchWorkshopRepContents($keywords$type$searchtype)
  150.     // echo '<hr />';
  151.     if(defined('MOD_WORKSHOP'&& MOD_WORKSHOP == trueDisplaySearchWorkshopCalendar($keywords$type$searchtype)
  152.     // echo '<hr />';
  153.     if(defined('MOD_WORKSHOP'&& MOD_WORKSHOP == trueDisplaySearchWorkshopCom($keywords$type$searchtype);
  154.     //echo '<hr />';
  155.     if(defined('MOD_SDI'&& MOD_SDI == trueDisplaySearchSdi($keywords$type$searchtype);
  156.     //echo '<hr />';
  157. }
  158.  
  159. /**
  160.  * DisplaySearchProject()
  161.  * Affiche les projets répondant à la requête sur $keywords
  162.  * 
  163.  * @param string $keywords 
  164.  * @return string $content
  165.  */
  166. function DisplaySearchProject($keywords$type$searchtype)
  167. {
  168.     $data $GLOBALS['sql_object']->DBSelect(SQL_project_search(MatchDataFormat($keywords$searchtype)$type));
  169.  
  170.     $content '<div id="MatchProject">';
  171.     $content .= '<h3>' _t('search','project_module''</h3>' END_LINE;
  172.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  173.     else {
  174.         $content .= '<ul>' END_LINE;
  175.         for($i 0$i count($data)$i++{
  176.             if ($type == 'PUBLIC'{
  177.                 $link_news HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['project']['linkvalue']'id' => $data[$i]['project_id']'name' => $data[$i]['project_name']));
  178.                 $published_display _t('statut','published_on'' ' $data[$i]['date_display'];
  179.             
  180.             if ($type == 'ADMIN'{
  181.                 $link_news 'index.php?rub=project&amp;todo=det&amp;id=' $data[$i]['project_id'];
  182.                 $published_display _t('divers','date_crea'' ' $data[$i]['date_display'];
  183.             
  184.  
  185.             $news_title formatText($data[$i]['project_name']'2HTML');
  186.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  187.  
  188.             $content .= '<li class="matches">' END_LINE;
  189.             $content .= '<a href="' $link_news '" title="' formatText($GLOBALS['links'][LANGUAGE]['news']['desc'' : ' $news_title'2ATT''" >' $news_title '</a>';
  190.             $content .= '<br />';
  191.             $content .= '<span class="infocomp">' $published_display GetStatus($data[$i]['statut']'</span>';
  192.             $content .= $pertinence;
  193.             $content .= '</li>' END_LINE;
  194.         
  195.         $content .= '</ul>' END_LINE;
  196.     
  197.     $content .= '</div>' END_LINE;
  198.     echo $content;
  199. }
  200.  
  201. /**
  202.  * DisplaySearchNews()
  203.  * Affiche les news répondant à la requête sur $keywords
  204.  * 
  205.  * @param string $keywords 
  206.  * @return string $content
  207.  */
  208. function DisplaySearchNews($keywords$type$searchtype)
  209. {
  210.     $data $GLOBALS['sql_object']->DBSelect(SQL_news_search(MatchDataFormat($keywords$searchtype)$type));
  211.  
  212.     $content '<div id="MatchNews">';
  213.     $content .= '<h3>' _t('search','news_module''</h3>' END_LINE;
  214.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  215.     else {
  216.         $content .= '<ul>' END_LINE;
  217.         for($i 0$i count($data)$i++{
  218.             if ($type == 'PUBLIC'{
  219.                 $link_news HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['news']['linkvalue']'id' => $data[$i]['news_id']'name' => $data[$i]['news_title']));
  220.                 $published_display _t('statut','published_on'' ' $data[$i]['date_display'];
  221.             
  222.             if ($type == 'ADMIN'{
  223.                 $link_news 'index.php?rub=news&amp;todo=det&amp;id=' $data[$i]['news_id'];
  224.                 $published_display _t('divers','date_crea'' ' $data[$i]['date_display'];
  225.             
  226.  
  227.             $news_title formatText($data[$i]['news_title']'2HTML');
  228.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  229.  
  230.             $content .= '<li class="matches">' END_LINE;
  231.             $content .= '<a href="' $link_news '" title="' formatText($GLOBALS['links'][LANGUAGE]['news']['desc'' : ' $news_title'2ATT''" >' $news_title '</a>';
  232.             $content .= '<br />';
  233.             $content .= '<span class="infocomp">' $published_display GetStatus($data[$i]['statut']'</span>';
  234.             $content .= $pertinence;
  235.             $content .= '</li>' END_LINE;
  236.         
  237.         $content .= '</ul>' END_LINE;
  238.     
  239.     $content .= '</div>' END_LINE;
  240.     echo $content;
  241.  
  242. /**
  243.  * DisplaySearchNews()
  244.  * Affiche les news répondant à la requête sur $keywords
  245.  * 
  246.  * @param string $keywords 
  247.  * @return string $content
  248.  */
  249. function DisplaySearchNewsletter($keywords$type$searchtype)
  250. {
  251.     $data $GLOBALS['sql_object']->DBSelect(SQL_newsletter_search(MatchDataFormat($keywords$searchtype)$type));
  252.  
  253.     $content '<div id="MatchNewsletter">';
  254.     $content .= '<h3>' _t('search','newsletter_module''</h3>' END_LINE;
  255.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  256.     else {
  257.         $content .= '<ol>' END_LINE;
  258.         for($i 0$i count($data)$i++{
  259.             /**
  260.              * * NON IMPLEMENTE 
  261.              * if ($type == 'PUBLIC') {
  262.              * $link_news = HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['news']['linkvalue'], 'id' => $data[$i]['news_id']));
  263.              * $published_display = _t('statut','published_on') . ' ' . $data[$i]['date_display'];
  264.              * }
  265.              */
  266.  
  267.             if ($type == 'ADMIN'{
  268.                 $link_newsletter 'index.php?rub=newsletter&amp;todo=det&amp;id=' $data[$i]['newsletter_id'];
  269.                 $published_display _t('divers','date_crea'' ' $data[$i]['date_display'];
  270.             }
  271.             $newsletter_title formatText($data[$i]['newsletter_title']'2HTML');
  272.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  273.  
  274.             $content .= '<li class="matches">' END_LINE;
  275.             $content .= '<a href="' $link_newsletter '" title="' formatText($newsletter_title'2ATT''" >' $newsletter_title '</a>';
  276.             $content .= '<br />';
  277.             $content .= '<span class="infocomp">' $published_display GetStatus($data[$i]['statut']'</span>';
  278.             $content .= $pertinence;
  279.             $content .= '</li>' END_LINE;
  280.         
  281.         $content .= '</ol>' END_LINE;
  282.     
  283.     $content .= '</div>' END_LINE;
  284.     echo $content;
  285.  
  286. /**
  287.  * DisplaySearchPublication()
  288.  * Affiche les publications répondant à la requête sur $keywords
  289.  * Requête éffectuée sur le titre et le résumé des publications
  290.  * 
  291.  * @param string $keywords 
  292.  * @return string $content
  293.  */
  294. function DisplaySearchPublication($keywords$type$searchtype)
  295. {
  296.     $data $GLOBALS['sql_object']->DBSelect(SQL_publication_search(MatchDataFormat($keywords$searchtype)$type));
  297.  
  298.     $content '<div id="MatchPubli">';
  299.     $content .= '<h3>' _t('search','publication_module''</h3>' END_LINE;
  300.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  301.     else {
  302.         $content .= '<ul>' END_LINE;
  303.         for($i 0$i count($data)$i++{
  304.             if ($type == 'PUBLIC'{
  305.                 $link_publi HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['publication']['linkvalue']'id' => $data[$i]['publi_id']'name' => $data[$i]['publi_title']));
  306.                 $published_display _t('statut','published_on'' ' $data[$i]['date_display'];
  307.             
  308.             if ($type == 'ADMIN'{
  309.                 $link_publi 'index.php?rub=publication&amp;todo=det&amp;id=' $data[$i]['publi_id'];
  310.                 $published_display _t('divers','date_crea'' ' $data[$i]['date_display'];
  311.             
  312.  
  313.             $publi_title formatText($data[$i]['publi_title']'2HTML');
  314.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  315.  
  316.             $content .= '<li class="matches">' END_LINE;
  317.             $content .= '<a href="' $link_publi '" title="' formatText($GLOBALS['links'][LANGUAGE]['publication']['desc'' : ' $publi_title'2ATT''" >' $publi_title '</a>';
  318.             $content .= '<br />';
  319.             $content .= '<span class="infocomp">' $published_display GetStatus($data[$i]['statut']'</span>';
  320.             $content .= $pertinence;
  321.             $content .= '</li>' END_LINE;
  322.         
  323.         $content .= '</ul>' END_LINE;
  324.     
  325.     $content .= '</div>' END_LINE;
  326.     echo $content;
  327.  
  328. /**
  329.  * DisplaySearchPubliContents()
  330.  * Affiche les publications répondant à la requête sur $keywords
  331.  * Requête éffectuée sur le contenu des publications ( titre & body )
  332.  * 
  333.  * @param string $keywords 
  334.  * @return string $content
  335.  */
  336. function DisplaySearchPubliContents($keywords$type$searchtype)
  337. {
  338.     $data $GLOBALS['sql_object']->DBSelect(SQL_publication_content_search(MatchDataFormat($keywords$searchtype)$type));
  339.  
  340.     $content '<div id="MatchPubliContents">';
  341.     $content .= '<h4>' _t('search','det_publication_module''</h4>' END_LINE;
  342.     //if (count($data) == 1 && $data == 0) $content .= '<p>' . _t('search','no_result') . '</p>' . END_LINE;
  343.     if (count($data== && $data == 0return true;
  344.     else {
  345.         $content .= '<ul>' END_LINE;
  346.         for($i 0$i count($data)$i++{
  347.             if ($type == 'PUBLIC'{
  348.                 $link_publi_det HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['publication-part']['linkvalue']'id' => $data[$i]['publicon_id']'parentid' => $data[$i]['publi_id']'name' => $data[$i]['publicon_title']));
  349.                 $link_publi HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['publication']['linkvalue']'id' => $data[$i]['publi_id']'name' => $data[$i]['publi_title']));
  350.                 $published_display _t('statut','published_on'' ' $data[$i]['date_display'];
  351.             
  352.             if ($type == 'ADMIN'{
  353.                 $link_publi_det 'index.php?rub=contents&amp;todo=det&amp;parent=' $data[$i]['publi_id''&amp;type=P&amp;id=' $data[$i]['publicon_id'];
  354.                 $link_publi 'index.php?rub=publication&amp;todo=det&amp;id=' $data[$i]['publi_id'];
  355.                 $published_display _t('divers','date_crea'' ' $data[$i]['date_display'];
  356.             
  357.  
  358.             $publicon_title formatText($data[$i]['publicon_title']'2HTML');
  359.             $publi_title formatText($data[$i]['publi_title']'2HTML');
  360.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  361.  
  362.             $content .= '<li class="matches">' END_LINE;
  363.             $content .= '<a href="' $link_publi_det '" title="' formatText($GLOBALS['links'][LANGUAGE]['publication-part']['desc'' : ' $publicon_title'2ATT''" >' $publicon_title '</a>';
  364.             $content .= '<br />';
  365.             $content .= '<span class="infocomp">' _t('name','publication_module'' : ';
  366.             $content .= '<a href="' $link_publi '" title="' formatText($GLOBALS['links'][LANGUAGE]['publication']['desc'' : ' $publi_title'2ATT''" >' $publi_title '</a>';
  367.             $content .= ' - ' $published_display GetStatus($data[$i]['statut']);
  368.             $content .= '</span>';
  369.             $content .= $pertinence;
  370.             $content .= '</li>' END_LINE;
  371.         
  372.         $content .= '</ul>' END_LINE;
  373.     
  374.     $content .= '</div>' END_LINE;
  375.     echo $content;
  376.  
  377. /**
  378.  * DisplaySearchWorkshop()
  379.  * Affiche les groupes de travail répondant à la requête sur $keywords
  380.  * Requête éffectuée sur le libellé et le résumé des groupes de travail
  381.  * 
  382.  * @param string $keywords 
  383.  * @return string $content
  384.  */
  385. function DisplaySearchWorkshop($keywords$type$searchtype)
  386. {
  387.     $data $GLOBALS['sql_object']->DBSelect(SQL_workshop_search(MatchDataFormat($keywords$searchtype)$type));
  388.  
  389.     $content '<div id="MatchWorkshop">';
  390.     $content .= '<h3>' _t('search','workshop_module''</h3>' END_LINE;
  391.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  392.     else {
  393.         $content .= '<ul>' END_LINE;
  394.         for($i 0$i count($data)$i++{
  395.             if ($type == 'PUBLIC'{
  396.                 $link_workshop HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['workgroup']['linkvalue']'id' => $data[$i]['workshop_id']'name' => $data[$i]['workshop_denomination']));
  397.             
  398.             if ($type == 'ADMIN'{
  399.                 $link_workshop 'index.php?rub=workshop&amp;todo=det&amp;id=' $data[$i]['workshop_id'];
  400.             
  401.  
  402.             $workshop_title formatText($data[$i]['workshop_denomination']'2HTML');
  403.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  404.  
  405.             $content .= '<li class="matches">' END_LINE;
  406.             $content .= '<a href="' $link_workshop '" title="' formatText($GLOBALS['links'][LANGUAGE]['workgroup']['desc'' : ' $workshop_title'2ATT''" >' $workshop_title '</a>';
  407.             $statut GetStatus($data[$i]['statut']);
  408.             if (!empty($statut)) $content .= '<span class="infocomp">(' $statut ')</span>';
  409.          $content .= $pertinence;
  410.             $content .= '</li>' END_LINE;
  411.         
  412.         $content .= '</ul>' END_LINE;
  413.     
  414.     $content .= '</div>' END_LINE;
  415.     echo $content;
  416.  
  417. /**
  418.  * DisplaySearchWorkshopRep()
  419.  * Affiche les groupes de travail répondant à la requête sur $keywords
  420.  * Requête éffectuée sur le contenu des rapports de groupes de travail ( titre & body )
  421.  * 
  422.  * @param string $keywords 
  423.  * @return string $content
  424.  */
  425. function DisplaySearchWorkshopRep($keywords$type$searchtype)
  426. {
  427.     $data $GLOBALS['sql_object']->DBSelect(SQL_workrep_search(MatchDataFormat($keywords$searchtype)$type));
  428.  
  429.     $content '<div id="MatchWorkshopRep">';
  430.     $content .= '<h4>' _t('search','workshoprep_module''</h4>' END_LINE;
  431.     //if (count($data) == 1 && $data == 0) $content .= '<p>' . _t('search','no_result') . '</p>' . END_LINE;
  432.     if (count($data== && $data == 0return true;
  433.     else {
  434.         $content .= '<ul>' END_LINE;
  435.         for($i 0$i count($data)$i++{
  436.             if ($type == 'PUBLIC'{
  437.                 $link_workrep HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['report']['linkvalue']'id' => $data[$i]['workrep_id']'name' => $data[$i]['workrep_title']));
  438.                 $link_workshop HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['workgroup']['linkvalue']'id' => $data[$i]['workshop_id']'name' => $data[$i]['workshop_denomination']));
  439.                 $published_display _t('statut','published_on'' ' $data[$i]['date_display'];
  440.             
  441.             if ($type == 'ADMIN'{
  442.                 $link_workrep 'index.php?rub=workshoprep&amp;todo=det&amp;id=' $data[$i]['workrep_id'];
  443.                 $link_workshop 'index.php?rub=workshop&amp;todo=det&amp;id=' $data[$i]['workshop_id'];
  444.                 $published_display _t('divers','date_crea'' ' $data[$i]['date_display'];
  445.             
  446.  
  447.             $workrep_title formatText($data[$i]['workrep_title']'2HTML');
  448.             $workshop_title formatText($data[$i]['workshop_denomination']'2HTML');
  449.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  450.             $published_display $data[$i]['date_display'];
  451.  
  452.             $content .= '<li class="matches">' END_LINE;
  453.             $content .= '<a href="' $link_workrep '" title="' formatText($GLOBALS['links'][LANGUAGE]['report']['desc'' : ' $workrep_title'2ATT''" >' $workrep_title '</a>';
  454.             $content .= '<br />';
  455.             $content .= '<span class="infocomp">(' _t('name','workshop_module'' : ';
  456.             $content .= '<a href="' $link_workshop '" title="' formatText($GLOBALS['links'][LANGUAGE]['workgroup']['desc'' : ' $workshop_title'2ATT''" >' $workshop_title '</a>';
  457.             $content .= ' - ' $published_display GetStatus($data[$i]['statut']')';
  458.             $content .= '</span>';
  459.             $content .= $pertinence;
  460.             $content .= '</li>' END_LINE;
  461.         
  462.         $content .= '</ul>' END_LINE;
  463.     
  464.     $content .= '</div>' END_LINE;
  465.     echo $content;
  466.  
  467. /**
  468.  * DisplaySearchWorkshopRepContents()
  469.  * Affiche les groupes de travail répondant à la requête sur $keywords
  470.  * Requête éffectuée sur le contenu des rapports de groupes de travail ( titre & body )
  471.  * 
  472.  * @param string $keywords 
  473.  * @return string $content
  474.  */
  475. function DisplaySearchWorkshopRepContents($keywords$type$searchtype)
  476. {
  477.     $data $GLOBALS['sql_object']->DBSelect(SQL_workrep_content_search(MatchDataFormat($keywords$searchtype)$type));
  478.  
  479.     $content '<div id="MatchWorkshopContents">';
  480.     $content .= '<h5>' _t('search','workshoprepcon_module''</h5>' END_LINE;
  481.     //if (count($data) == 1 && $data == 0) $content .= '<p>' . _t('search','no_result') . '</p>' . END_LINE;
  482.     if (count($data== && $data == 0return true;
  483.     else {
  484.         $content .= '<ul>' END_LINE;
  485.         for($i 0$i count($data)$i++{
  486.             if ($type == 'PUBLIC'{
  487.                 $link_workrep_det HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['report-part']['linkvalue']'id' => $data[$i]['workrepcon_id']'parentid' => $data[$i]['workrep_id']'name' => $data[$i]['workrepcon_title']));
  488.                 $link_workrep HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['report']['linkvalue']'id' => $data[$i]['workrep_id']'name' => $data[$i]['workrep_title']));
  489.                 $published_display _t('statut','published_on'' ' $data[$i]['date_display'];
  490.             
  491.             if ($type == 'ADMIN'{
  492.                 $link_workrep_det 'index.php?rub=contents&amp;todo=det&amp;parent=' $data[$i]['workrep_id''&amp;type=W&amp;id=' $data[$i]['workrepcon_id'];
  493.                 $link_workrep 'index.php?rub=workshoprep&amp;todo=det&amp;id=' $data[$i]['workrep_id'];
  494.                 $published_display _t('divers','date_crea'' ' $data[$i]['date_display'];
  495.             
  496.  
  497.             $workrepcon_title formatText($data[$i]['workrepcon_title']'2HTML');
  498.             $workrep_title formatText($data[$i]['workrep_title']'2HTML');
  499.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  500.  
  501.             $content .= '<li class="matches">' END_LINE;
  502.             $content .= '<a href="' $link_workrep_det '" title="' formatText($GLOBALS['links'][LANGUAGE]['publication-part']['desc'' : ' $workrepcon_title'2ATT''" >' $workrepcon_title '</a>';
  503.             $content .= '<br />';
  504.             $content .= '<span class="infocomp">(' _t('name','workshoprep_module'' : ';
  505.             $content .= '<a href="' $link_workrep '" title="' formatText($GLOBALS['links'][LANGUAGE]['report']['desc'' : ' $workrep_title'2ATT''" >' $workrep_title '</a>';
  506.             $content .= ' - ' $published_display GetStatus($data[$i]['statut']')';
  507.             $content .= '</span>';
  508.             $content .= $pertinence;
  509.             $content .= '</li>' END_LINE;
  510.         
  511.         $content .= '</ul>' END_LINE;
  512.     
  513.     $content .= '</div>' END_LINE;
  514.     echo $content;
  515.  
  516. /**
  517.  * DisplaySearchWorkshopCalendar()
  518.  * Affiche les groupes de travail répondant à la requête sur $keywords
  519.  * Requête éffectuée sur les tâches du calendrier de groupes de travail ( libellé & contenu des tâches )
  520.  * 
  521.  * @param string $keywords 
  522.  * @return string $content
  523.  */
  524. function DisplaySearchWorkshopCalendar($keywords$type$searchtype)
  525. {
  526.     $data $GLOBALS['sql_object']->DBSelect(SQL_workshop_calendar_search(MatchDataFormat($keywords$searchtype)$type));
  527.  
  528.     $content '<div id="MatchWorkshopCal">';
  529.     $content .= '<h4>' _t('search','workshopcal_module''</h4>' END_LINE;
  530.     //if (count($data) == 1 && $data == 0) $content .= '<p>' . _t('search','no_result') . '</p>' . END_LINE;
  531.     if (count($data== && $data == 0return true;
  532.     else {
  533.         $content .= '<ul>' END_LINE;
  534.         for($i 0$i count($data)$i++{
  535.             if ($type == 'PUBLIC'{
  536.                 $link_workcal HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['calendar']['linkvalue']'id' => $data[$i]['workcal_workshop_id']'name' => $data[$i]['workcal_task']));
  537.                 $link_workshop HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['workgroup']['linkvalue']'id' => $data[$i]['workcal_workshop_id']'name' => $data[$i]['workshop_denomination']));
  538.             
  539.             if ($type == 'ADMIN'{
  540.                 $link_workcal 'index.php?rub=workshop&amp;todo=list_cal&amp;id=' $data[$i]['workcal_workshop_id'];
  541.                 $link_workshop 'index.php?rub=workshop&amp;todo=det&amp;id=' $data[$i]['workcal_workshop_id'];
  542.             
  543.  
  544.             $workcal_title formatText($data[$i]['workcal_task']'2HTML');
  545.             $workshop_title formatText($data[$i]['workshop_denomination']'2HTML');
  546.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  547.  
  548.             $content .= '<li class="matches">' END_LINE;
  549.             $content .= '<a href="' $link_workcal '" title="' formatText($GLOBALS['links'][LANGUAGE]['calendar']['desc'' : ' $workcal_title'2ATT''" >' $workcal_title '</a>';
  550.             $content .= '<br />';
  551.             $content .= '<span class="infocomp">(' _t('name','workshop_module'' : ';
  552.             $content .= '<a href="' $link_workshop '" title="' formatText($GLOBALS['links'][LANGUAGE]['workgroup']['desc'' : ' $workshop_title'2ATT''" >' $workshop_title '</a>';
  553.             if (!empty($statut)) $content .= $statut;
  554.             $content .= ')';
  555.             $content .= '</span>';
  556.             $content .= $pertinence;
  557.             $content .= '</li>' END_LINE;
  558.         
  559.         $content .= '</ul>' END_LINE;
  560.     
  561.     $content .= '</div>' END_LINE;
  562.     echo $content;
  563.  
  564. /**
  565.  * DisplaySearchWorkshopCom()
  566.  * Affiche les groupes de travail répondant à la requête sur $keywords
  567.  * Requête éffectuée sur les discussions du calendrier de groupes de travail ( titre & contenu )
  568.  * 
  569.  * @param string $keywords 
  570.  * @return string $content
  571.  */
  572. function DisplaySearchWorkshopCom($keywords$type$searchtype)
  573. {
  574.     $data $GLOBALS['sql_object']->DBSelect(SQL_workshop_com_search(MatchDataFormat($keywords$searchtype)$type));
  575.  
  576.     $content '<div id="MatchWorkshopCom">';
  577.     $content .= '<h4>' _t('search','workshopcom_module''</h4>' END_LINE;
  578.     //if (count($data) == 1 && $data == 0) $content .= '<p>' . _t('search','no_result') . '</p>' . END_LINE;
  579.     if (count($data== && $data == 0return true;
  580.     else {
  581.         $content .= '<ul>' END_LINE;
  582.         for($i 0$i count($data)$i++{
  583.             if ($data[$i]['workcom_parent'!= 0$id_com $data[$i]['workcom_parent'];
  584.             else $id_com $data[$i]['workcom_id';
  585.             if ($type == 'PUBLIC'{
  586.                 $link_workcom HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['subject']['linkvalue']'id' => $id_com'parentid' => $data[$i]['workcom_workshop_id']'name' => $data[$i]['workcom_subject']));
  587.                 $link_workshop HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['workgroup']['linkvalue']'id' => $data[$i]['workcom_workshop_id']'name' => $data[$i]['workshop_denomination']));
  588.             
  589.             if ($type == 'ADMIN'{
  590.                 $link_workcom 'index.php?rub=workshop&amp;todo=det_com&amp;id=' $data[$i]['workcom_workshop_id''&amp;com_id=' $id_com;
  591.                 $link_workshop 'index.php?rub=workshop&amp;todo=det&amp;id=' $data[$i]['workcom_workshop_id'];
  592.             
  593.  
  594.             $workcom_title formatText($data[$i]['workcom_subject']'2HTML');
  595.             $workshop_title formatText($data[$i]['workshop_denomination']'2HTML');
  596.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  597.  
  598.             if ($type == 'ADMIN' || ($type == 'PUBLIC' && CookieWorkshopid($data[$i]['workcom_workshop_id']))) {
  599.                 $content .= '<li class="matches">' END_LINE;
  600.                 $content .= '<a href="' $link_workcom '" title="' formatText($GLOBALS['links'][LANGUAGE]['subject']['desc'' : ' $workcom_title'2ATT''" >' $workcom_title '</a>';
  601.                 $content .= '<br />';
  602.                 $content .= '<span class="infocomp">(' _t('name','workshop_module'' : ';
  603.                 $content .= '<a href="' $link_workshop '" title="' formatText($GLOBALS['links'][LANGUAGE]['workgroup']['desc'' : ' $workshop_title'2ATT''" >' $workshop_title '</a>';
  604.                 if (!empty($statut)) $content .= $statut;
  605.                 $content .= ')';
  606.                 $content .= '</span>';
  607.                 $content .= $pertinence;
  608.                 $content .= '</li>' END_LINE;
  609.             else $content .= '';
  610.         
  611.         $content .= '</ul>' END_LINE;
  612.  
  613.         if ($content == '<ul></ul>'return '';
  614.     
  615.     $content .= '</div>' END_LINE;
  616.  
  617.     echo $content;
  618.  
  619. /**
  620.  * DisplaySearchSdi()
  621.  * Affiche les indicateurs répondant à la requête sur $keywords
  622.  * Requête éffectuée sur les informations générales des indicateurs
  623.  * 
  624.  * @param string $keywords 
  625.  * @return string $content
  626.  */
  627. function DisplaySearchSdi($keywords$type$searchtype)
  628. {
  629.     $data $GLOBALS['sql_object']->DBSelect(SQL_sdi_search(MatchDataFormat($keywords$searchtype)$type));
  630.  
  631.     $content '<div id="MatchSdi">';
  632.     $content .= '<h3>' _t('search','sdi_module''</h3>' END_LINE;
  633.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  634.     else {
  635.         $content .= '<ul>' END_LINE;
  636.         for($i 0$i count($data)$i++{
  637.             if ($type == 'PUBLIC'$link_sdi HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['dashboard']['linkvalue']'id' => $data[$i]['sdii_id']'parentid' => 1'name' => $data[$i]['sdii_name']));
  638.             if ($type == 'ADMIN'$link_sdi 'index.php?rub=sdi&amp;todo=det&amp;id=' $data[$i]['sdii_id'];
  639.  
  640.             $news_title formatText($data[$i]['sdii_name']'2HTML');
  641.             $pertinence FormatPertinenceIndice($data[$i]['pertinence']);
  642.             $published_display $data[$i]['date_display'];
  643.  
  644.             $content .= '<li class="matches">' END_LINE;
  645.             $content .= '<a href="' $link_sdi '" title="' formatText($GLOBALS['links'][LANGUAGE]['dashboard']['desc'' : ' $news_title'2ATT''" >' $news_title '</a>';
  646.             $content .= '<br />';
  647.             $content .= '<span class="infocomp">( ' _t('statut','published_on'' ' $published_display GetStatus($data[$i]['statut']')</span>';
  648.             $content .= $pertinence;
  649.             $content .= '</li>' END_LINE;
  650.         
  651.         $content .= '</ul>' END_LINE;
  652.     
  653.     $content .= '</div>' END_LINE;
  654.     echo $content;
  655.  
  656. /**
  657.  * DisplaySearchYellowpages()
  658.  * Affiche les organisations de l'annuaire répondant à la requête sur $keywords
  659.  * 
  660.  * @param string $keywords 
  661.  * @return string $content
  662.  */
  663. function DisplaySearchYellowpages($keywords$type$searchtype)
  664. {
  665.     $data $GLOBALS['sql_object']->DBSelect(SQL_yellowpages_search($keywords$type$searchtype));
  666.  
  667.     $content '<div id="MatchYellowpages">';
  668.     $content .= '<h3>' _t('search','yellowpages_module''</h3>' END_LINE;
  669.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  670.     else {
  671.         $content .= '<ul>' END_LINE;
  672.         for($i 0$i count($data)$i++{
  673.             if ($type == 'PUBLIC'$link_yp HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['directory-detail']['linkvalue']'id' => $data[$i]['yellowp_id']'name' => $data[$i]['yellowp_name']));
  674.             if ($type == 'ADMIN'$link_yp 'index.php?rub=yellowpages&amp;todo=det&amp;id=' $data[$i]['yellowp_id'];
  675.  
  676.             $yp_title formatText($data[$i]['yellowp_name']'2HTML');
  677.             $pertinence _t('divers','none');
  678.             $published_display $data[$i]['date_display'];
  679.  
  680.             $content .= '<li class="matches">' END_LINE;
  681.             $content .= '<a href="' $link_yp '" title="' formatText($GLOBALS['links'][LANGUAGE]['directory-detail']['desc'' : ' $yp_title'2ATT''" >' $yp_title '</a>';
  682.             $content .= '<span class="infocomp">(' _t('divers','date_crea'' : ' $published_display GetStatus($data[$i]['statut']')</span>';
  683.             $content .= '</li>' END_LINE;
  684.         
  685.         $content .= '</ul>' END_LINE;
  686.     
  687.     $content .= '</div>' END_LINE;
  688.     echo $content;
  689.  
  690. /**
  691.  * DisplaySearchUser()
  692.  * Affiche les utilisateurs répondant à la requête sur $keywords
  693.  * 
  694.  * @param string $keywords 
  695.  * @return string $content
  696.  */
  697. function DisplaySearchUser($keywords$type$searchtype)
  698. {
  699.     $data $GLOBALS['sql_object']->DBSelect(SQL_user_search($keywords$type$searchtype));
  700.  
  701.     $content '<div id="MatchUser">';
  702.     $content .= '<h3>' _t('search','user_module''</h3>' END_LINE;
  703.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  704.     else {
  705.         $content .= '<ul>' END_LINE;
  706.         for($i 0$i count($data)$i++{
  707.             if ($type == 'PUBLIC'$link_user HrefMaker(array('rub' => $GLOBALS['links'][LANGUAGE]['user-profile']['linkvalue']'id' => $data[$i]['user_id']'name' => $data[$i]['user_login']));
  708.             if ($type == 'ADMIN'$link_user 'index.php?rub=user&amp;todo=det&amp;id=' $data[$i]['user_id'];
  709.  
  710.             $user_title formatText($data[$i]['user_login']);
  711.             $pertinence _t('divers','none');
  712.             $published_display $data[$i]['date_display'];
  713.  
  714.             $content .= '<li class="matches">' END_LINE;
  715.             $content .= '<a href="' $link_user '" title="' formatText($GLOBALS['links'][LANGUAGE]['user-profile']['desc'' : ' $user_title'2ATT''" >' $user_title '</a>';
  716.             $content .= '<span class="infocomp">(' _t('divers','date_crea'' : ' $published_display GetStatus($data[$i]['statut']')</span>';
  717.             $content .= '</li>' END_LINE;
  718.         
  719.         $content .= '</ul>' END_LINE;
  720.     
  721.     $content .= '</div>' END_LINE;
  722.     echo $content;
  723.  
  724. /**
  725.  * DisplaySearchTheme()
  726.  * Affiche les theme répondant à la requête sur $keywords
  727.  * 
  728.  * @param string $keywords 
  729.  * @return string $content
  730.  */
  731. function DisplaySearchTheme($keywords$type$searchtype)
  732. {
  733.     $data $GLOBALS['sql_object']->DBSelect(SQL_theme_search($keywords$type$searchtype));
  734.  
  735.     $content '<div id="MatchTheme">';
  736.     $content .= '<h3>' _t('search','theme_module''</h3>' END_LINE;
  737.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  738.     else {
  739.         $content .= '<ul>' END_LINE;
  740.         for($i 0$i count($data)$i++{
  741.             if ($type == 'ADMIN'$link_theme 'index.php?rub=theme&amp;todo=det&amp;id=' $data[$i]['theme_id'];
  742.  
  743.             $theme_title formatText($data[$i]['theme_name']);
  744.             $pertinence _t('divers','none');
  745.             $published_display $data[$i]['date_display'];
  746.  
  747.             $content .= '<li class="matches">' END_LINE;
  748.             $content .= '<a href="' $link_theme '">' $theme_title '</a>';
  749.             $content .= '<span class="infocomp">(' _t('divers','date_crea'' : ' $published_display GetStatus($data[$i]['statut']')</span>';
  750.             $content .= '</li>' END_LINE;
  751.         
  752.         $content .= '</ul>' END_LINE;
  753.     
  754.     $content .= '</div>' END_LINE;
  755.     echo $content;
  756.  
  757. /**
  758.  * DisplaySearchScale()
  759.  * Affiche les échelles répondant à la requête sur $keywords
  760.  * 
  761.  * @param string $keywords 
  762.  * @return string $content
  763.  */
  764. function DisplaySearchScale($keywords$type$searchtype)
  765. {
  766.     $data $GLOBALS['sql_object']->DBSelect(SQL_scale_search($keywords$type$searchtype));
  767.  
  768.     $content '<div id="MatchScale">';
  769.     $content .= '<h3>' _t('search','scale_module''</h3>' END_LINE;
  770.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  771.     else {
  772.         $content .= '<ul>' END_LINE;
  773.         for($i 0$i count($data)$i++{
  774.             if ($type == 'ADMIN'$link_scale 'index.php?rub=scale&amp;todo=det&amp;id=' $data[$i]['scale_id'];
  775.  
  776.             $scale_title formatText($data[$i]['scale_denomination']);
  777.             $pertinence _t('divers','none');
  778.             $published_display $data[$i]['date_display'];
  779.  
  780.             $content .= '<li class="matches">' END_LINE;
  781.             $content .= '<a href="' $link_scale '" title="' formatText($scale_title'2ATT''">' $scale_title '</a>';
  782.             $content .= '<span class="infocomp">(' _t('divers','date_crea'' : ' $published_display GetStatus($data[$i]['statut']')</span>';
  783.             $content .= '</li>' END_LINE;
  784.         
  785.         $content .= '</ul>' END_LINE;
  786.     
  787.     $content .= '</div>' END_LINE;
  788.     echo $content;
  789.  
  790. /**
  791.  * DisplaySearchLevel()
  792.  * Affiche les niveaux répondant à la requête sur $keywords
  793.  * 
  794.  * @param string $keywords 
  795.  * @return string $content
  796.  */
  797. function DisplaySearchLevel($keywords$type$searchtype)
  798. {
  799.     $data $GLOBALS['sql_object']->DBSelect(SQL_level_search($keywords$type$searchtype));
  800.  
  801.     $content '<div id="MatchScale">';
  802.     $content .= '<h3>' _t('search','level_module''</h3>' END_LINE;
  803.     if (count($data== && $data == 0$content .= '<p>' _t('search','no_result''</p>' END_LINE;
  804.     else {
  805.         $content .= '<ul>' END_LINE;
  806.         for($i 0$i count($data)$i++{
  807.             if ($type == 'ADMIN'$link_level 'index.php?rub=level&amp;todo=det&amp;id=' $data[$i]['level_id'];
  808.  
  809.             $level_title formatText($data[$i]['level_name']);
  810.             $pertinence _t('divers','none');
  811.             $published_display $data[$i]['date_display'];
  812.  
  813.             $content .= '<li class="matches">' END_LINE;
  814.             $content .= '<a href="' $link_level '" title="' formatText($level_title'2ATT''">' $level_title '</a>';
  815.             $content .= '<span class="infocomp">(' _t('divers','date_crea'' : ' $published_display GetStatus($data[$i]['statut']')</span>';
  816.             $content .= '</li>' END_LINE;
  817.         
  818.         $content .= '</ul>' END_LINE;
  819.     
  820.     $content .= '</div>' END_LINE;
  821.     echo $content;
  822.  
  823. /**
  824.  * DisplayQueryTime()
  825.  * Affiche le temps d'execution des requêtes
  826.  * 
  827.  * @param float $start_time 
  828.  * @param float $end_time 
  829.  * @return string $content (echo)
  830.  */
  831. function DisplayQueryTime($start_time$end_time)
  832. {
  833.     $content '<div id="QueryTime">' END_LINE;
  834.     $content .= _t('search','query_time'' ' (substr($end_time $start_time05)) ' ' _t('search','query_seconds');
  835.     $content .= '</div>' END_LINE;
  836.     echo $content;
  837.  
  838. {
  839.     $action $GLOBALS['links'][LANGUAGE]['search-result']['linkvalue'];
  840.     $content '<form action="index.php" method="get">';
  841.     $content .= '<div id="searchcontent">';
  842.     $content .= '<label for="advsearch">' _t('search','keywords''</label>';
  843.     $content .= '<input type="text" maxlength="150"  class="textfield" name="search" id="advsearch" style="margin-right:30px" />';
  844.     $content.= '<input id="rub_search" name="rub" type="hidden" value="'.$action.'">';
  845.     $content .= '<br class="brendstep" />';
  846.     $content .= '<div style="margin:1em 2.3em 0 0">';
  847.     $content .= '<input type="radio" name="searchtype" id="searchtype_1" value="one" checked="checked "/><span class="radio">' _t('search','one_of_them''</span>';
  848.     $content .= '<input type="radio" name="searchtype" id="searchtype_2" value="all" /><span class="radio">' _t('search','all_of_them''</span>';
  849.     $content .= '<input type="radio" name="searchtype" id="searchtype_3" value="exp" /><span class="radio">' _t('search','expression''</span>';
  850.     $content .= '</div>';
  851.     $content .= '<br class="brendstep" />';
  852.     $content.='<input type="submit" value="ok" size="15" name="valid" id="validadvsearch" style="margin-left:35em" />'.END_LINE;    
  853.     $content .= '</div>';
  854.     $content .= '</form>';
  855.  
  856.     echo $content;
  857. }
  858.  
  859. function FormatPertinenceIndice($float{
  860.     $pertinence_i ($float != 0number_format(round($float3)3','' '_t('search','score_not_good');
  861.     $pertinence'<span class="pertinence">- <abbr title="'.formatText(_t('search','score')'2ATT').'">' _t('search','score_abbr''</abbr> : ' $pertinence_i '</span>';
  862.     
  863.     
  864.     return $pertinence;
  865. }
  866. ?>

Documentation generated on Fri, 16 Oct 2009 09:32:04 +0200 by phpDocumentor 1.4.1