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

Documentation generated on Fri, 01 Apr 2011 09:30:35 +0200 by phpDocumentor 1.4.1