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

Source for file display.php

Documentation is available at display.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage project
  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(override('../project/' . SQL . '.inc.php'));
  12.  
  13.  
  14. /**
  15.  * DisplayListProjectByThemes()
  16.  * Affichage de la liste des projets publics par themes
  17.  *
  18.  * @param string $statut 
  19.  * @param integer $filter 
  20.  * @param string $id_filter 
  21.  * @param integer $debut 
  22.  * @return string $content
  23.  */
  24. if(!function_exists('DisplayListProjectByThemes')) {
  25.  
  26.     function DisplayListProjectByThemes($statut, $filter, $id_filter, $debut)
  27.     {
  28.         if ($statut == 'public') {
  29.             $pas = 100;
  30.             $suffix = '';
  31.         } else $pas = SELECT_LIMIT;
  32.         if ($statut == 'archives_p') $suffix = ' "'.strtolower(_t('statut','PA')).'"';
  33.         
  34.         // we retrieve main themes
  35.         if($filter != 'THEME') {
  36.             $themes = $GLOBALS['sql_object']->DBSelect(SQL_getSDThemes());
  37.         } else {
  38.             $themes = $GLOBALS['sql_object']->DBSelect(SQL_getOneSDTheme($id_filter));
  39.         }
  40.         
  41.         $content = '';
  42.         
  43.         // we loop on main themes
  44.         for($j = 0; $j < count($themes); $j++) {
  45.             
  46. //             print_r($themes[$j]);
  47. //              echo "<br />";
  48.             // we pass the theme ID to the SQL query
  49.             $data = $GLOBALS['sql_object']->DBSelect(SQL_getProjectsList($debut, $pas, $statut, 'THEME', $themes[$j]['sdtheme_id']));
  50.             
  51. //             // we sort values on theme names
  52. //             // Obtain a list of columns
  53. //             foreach ($data as $key => $row) {
  54. //                 $theme[$key]  = $row['theme_name'];
  55. //             }
  56.             
  57. //             // Sort the data with theme descending
  58. //             // Add $data as the last parameter, to sort by the common key
  59. //             array_multisort($theme, SORT_DESC, $data);
  60.             
  61.             $theme_name = formatText($themes[$j]['sdtheme_name'], '2HTML');
  62.             $link_theme = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'filter' => $GLOBALS['filters'][U_L]['theme']['linkvalue'], 'id' => $themes[$j]['sdtheme_id'], 'name' => $theme_name);
  63.                 
  64.             
  65.             // print_r($data);
  66.             $content .= '<h2>' . END_LINE;
  67.             $content .= '<a href="' . HrefMaker($link_theme) . '" title="' . formatText($theme_name, '2ATT') . '">' . $theme_name . '</a>' . END_LINE;
  68.             $content .= '</h2>' . END_LINE;
  69.             $content .= '<p class="desc">' . formatText($themes[$j]['sdtheme_description'], '2HTML') . '</p>' . END_LINE;
  70.             
  71.             if ($data != 0) {
  72.             
  73.                 $content .= '<div class="bythemes">' . END_LINE;
  74.                 $current_link = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue']);
  75.                 $current_theme = '';
  76.             
  77.                 for($i = 0; $i < count($data); $i++) {
  78.                         
  79.                     if($current_theme != $data[$i]['project_theme_id']) {
  80.                         $content .= '<h3>' . formatText($data[$i]['theme_name'], '2HTML') . '</h3>' . END_LINE;
  81.                         $current_theme = $data[$i]['project_theme_id'];
  82.                     }
  83.                         
  84.                     $link_detail = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'id' => $data[$i]['project_id'], 'name' => $data[$i]['project_name']);
  85.                     $link_scale = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'filter' => $GLOBALS['filters'][U_L]['scale']['linkvalue'], 'id' => $data[$i]['project_scale_id'], 'name' => $data[$i]['scale_denomination']);
  86.                     $link_priority = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'filter' => $GLOBALS['filters'][U_L]['priority']['linkvalue'], 'id' => $data[$i]['priority_id'] , 'name' => $data[$i]['priority_name']);
  87.                     $link_user = array('rub' => $GLOBALS['links'][U_L]['user-profile']['linkvalue'], 'id' => $data[$i]['project_posted_by'], 'name' => $data[$i]['user_login']);
  88.                     $project_name = formatText($data[$i]['complete_project_name'], '2HTML');
  89.                     $project_description = formatText($data[$i]['project_description'], '2HTML');
  90.                     $scale_denomination = formatText($data[$i]['scale_denomination'], '2HTML');
  91.                     $project_posted_on = formatText($data[$i]['project_published_date_display'], '2HTML');
  92.                     $project_posted_by = formatText($data[$i]['user_login'], '2HTML');
  93.                     $project_priority = formatText($data[$i]['priority_name'], '2HTML');
  94.                     $project_theme_id = $data[$i]['project_theme_id'];
  95.                         
  96.                     $project_theme = formatText($data[$i]['sdtheme_name'], '2HTML');
  97.                     $link_theme = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'filter' => $GLOBALS['filters'][U_L]['theme']['linkvalue'], 'id' => $data[$i]['theme_sd_theme'], 'name' => $project_theme);
  98.             
  99.                         
  100.                     $content .= '<p>' . END_LINE;
  101.                     $content .= '<a href="' . HrefMaker($link_detail) . '" title="' . formatText($project_name, '2ATT') . '">' . $project_name . '</a>' . END_LINE;
  102.                     $content .= '</p>' . END_LINE;
  103.             
  104.                 }
  105.                 $content .= '</div>' . END_LINE;
  106.             
  107.             }  else {
  108.                 $content .= '<p class="info">' . _t('divers','nodata') . '</p>';
  109.             }
  110.             
  111.         }
  112.         
  113.  
  114.         echo $content;
  115.     }
  116. }
  117.  
  118.  
  119. /**
  120.  * DisplayListProject()
  121.  * Affichage de la liste des projets publics
  122.  *
  123.  * @param string $statut 
  124.  * @param integer $filter 
  125.  * @param string $id_filter 
  126.  * @param integer $debut 
  127.  * @return string $content
  128.  */
  129. if(!function_exists('DisplayListProject')) {
  130.  
  131.   function DisplayListProject($statut, $filter, $id_filter, $debut)
  132.   {
  133.     if ($statut == 'public') {
  134.       $pas = 100;
  135.       $suffix = '';
  136.     } else $pas = SELECT_LIMIT;
  137.     if ($statut == 'archives_p') $suffix = ' "'.strtolower(_t('statut','PA')).'"';
  138.     $data = $GLOBALS['sql_object']->DBSelect(SQL_getProjectsList($debut, $pas, $statut, $filter, $id_filter));
  139.     $datacount = $GLOBALS['sql_object']->DBSelect(SQL_getCountProjectsList($statut, $filter, $id_filter));
  140.     $bdd_nb_com = $datacount[0]['num_rows'];
  141.     $bdd_nb_com_display = '<p>' . $bdd_nb_com . ' ' . _t('project','name') . $suffix . '</p>' . END_LINE;
  142.     $content = '';
  143.     if ($data != 0) {
  144.       // echo $bdd_nb_com_display;    // affichage du nombre d'enregistrements
  145.       $current_link = array('rub' => $GLOBALS['links'][U_L][ActiveItemKey($GLOBALS['activeitem'])]['linkvalue']);
  146.       $content .= get_linkin_page($current_link, $bdd_nb_com, $debut, $pas);
  147.       
  148.       for($i = 0; $i < count($data); $i++) {
  149.         $link_detail = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'id' => $data[$i]['project_id'], 'name' => $data[$i]['project_name']);
  150.         $link_scale = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'filter' => $GLOBALS['filters'][U_L]['scale']['linkvalue'], 'id' => $data[$i]['project_scale_id'], 'name' => $data[$i]['scale_denomination']);
  151.         $link_priority = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'filter' => $GLOBALS['filters'][U_L]['priority']['linkvalue'], 'id' => $data[$i]['priority_id'] , 'name' => $data[$i]['priority_name']);
  152.         $link_user = array('rub' => $GLOBALS['links'][U_L]['user-profile']['linkvalue'], 'id' => $data[$i]['project_posted_by'], 'name' => $data[$i]['user_login']);
  153.         $project_name = formatText($data[$i]['complete_project_name'], '2HTML');
  154.         $project_description = formatText($data[$i]['project_description'], '2HTML');
  155.         $scale_denomination = formatText($data[$i]['scale_denomination'], '2HTML');
  156.         $project_posted_on = formatText($data[$i]['project_published_date_display'], '2HTML');
  157.         $project_posted_by = formatText($data[$i]['user_login'], '2HTML');
  158.         $project_priority = formatText($data[$i]['priority_name'], '2HTML');
  159.         $project_theme_id = $data[$i]['project_theme_id'];
  160.         if($project_theme_id != 0) {
  161.           $project_theme = formatText($data[$i]['sdtheme_name'], '2HTML');
  162.           $link_theme = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'filter' => $GLOBALS['filters'][U_L]['theme']['linkvalue'], 'id' => $data[$i]['theme_sd_theme'], 'name' => $project_theme);
  163.         }
  164.  
  165.         $content .= '<h2>' . END_LINE;
  166.         $content .= '<a href="' . HrefMaker($link_detail) . '" title="' . formatText($project_name, '2ATT') . '">' . $project_name . '</a>' . END_LINE;
  167.         $content .= '</h2>' . END_LINE;
  168.         $content .= '<p class="published_by">' . END_LINE;
  169.         $content .= '<span class="published-on">'._t('statut','published_on') . '</span> <span class="date">' . $project_posted_on . '</span> ';
  170.         $content .= _t('divers','by').' <a href="' . HrefMaker($link_user) . '" title="' . $GLOBALS['links'][U_L]['user-profile']['desc'] . ' (' . $project_posted_by . ')">' . $project_posted_by . '</a>';
  171.         $content .= '</p>' . END_LINE;
  172.          
  173.         $content .= '<div class="chapo">' . $project_description . '</div>' . END_LINE;
  174.         $content .= '<a class="readmore" href="'.HrefMaker($link_detail).'">'._t('btn', 'read_more').'</a>';
  175.         $content .= '<p class="filter_info">';
  176.         $content .= _t('project','priority') . ' : ';
  177.         $content .= ' <a href="' . HrefMaker($link_priority) . '" title="' . $GLOBALS['filters'][U_L]['priority']['desc'] . ' : ' . formatText($project_priority, '2ATT') . '" class="filter_info_priority">' . $project_priority . '</a> ' . END_LINE;
  178.         $content .= _t('divers','scale') . ' : ';
  179.         $content .= ' <a href="' . HrefMaker($link_scale) . '" title="' . $GLOBALS['filters'][U_L]['scale']['desc'] . ' : ' . formatText($scale_denomination, '2ATT') . '" class="filter_info_scale">' . $scale_denomination . '</a>' . END_LINE;
  180.         if($project_theme_id != 0) {
  181.           $content .= ' ' . _t('divers','themeref') . ' : ';
  182.           $content .= '<a href="' . HrefMaker($link_theme) . '" title="' . $GLOBALS['filters'][U_L]['theme']['desc'] . ' : ' . formatText($project_theme, '2ATT') . '" class="filter_info_scale">' . $project_theme . '</a>' . END_LINE;
  183.         }
  184.         $content .= '</p>'.END_LINE;
  185.         if($i<count($data)-1) $content .= '<hr />' . END_LINE;
  186.       }
  187.     } else {
  188.       $content .= '<p class="info">' . _t('divers','nodata') . '</p>';
  189.     }
  190.     $content .= get_linkin_page($current_link, $bdd_nb_com, $debut, $pas);
  191.  
  192.     echo $content;
  193.   }
  194. }
  195.  
  196. /**
  197.  * DisplayOneProject()
  198.  * Affichage d'un projet en détail
  199.  *
  200.  * @param integer $project_id 
  201.  * @return string $stat status name
  202.  */
  203. if(!function_exists('DisplayOneProject')) {
  204.  
  205.   function DisplayOneProject($project_id)
  206.   {
  207.       
  208.     $data = $GLOBALS['sql_object']->DBSelect(SQL_getoneCompleteProject($project_id, array('P', 'PA')));
  209.     $content = '';
  210.     
  211.     if($data == 0) error_redirect();
  212.     
  213.     if (count($data) != 1) exit;
  214.     else {
  215.       $link_scale = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'filter' => $GLOBALS['filters'][U_L]['scale']['linkvalue'], 'id' => $data[0]['project_scale_id'], 'name' => $data[0]['scale_denomination']);
  216.       $link_priority = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'filter' => $GLOBALS['filters'][U_L]['priority']['linkvalue'], 'id' => $data[0]['project_priority_id'], 'name' => $data[0]['project_priority']);
  217.       $link_user = array('rub' => $GLOBALS['links'][U_L]['user-profile']['linkvalue'], 'id' => $data[0]['project_posted_by'], 'name' => $data[0]['user_login']);
  218.       $link_parent = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'id' => $data[0]['project_parent_id'], 'name' => $data[0]['parent_name']);
  219.       $link_self = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'id' => $project_id);
  220.       
  221.       $project_coordinator = empty_nc(getAssociatedActors($project_id, 'coordinator'));
  222.       $project_partners = empty_nc(getAssociatedActors($project_id, 'partner'));
  223.       
  224.       $project_name = formatText($data[0]['project_name'], '2HTML');
  225.       $project_description = linkin_content(formatText($data[0]['project_description'], '2HTML'));
  226.       $project_body = linkin_content(formatText($data[0]['project_body'], '2HTML'));
  227.       $project_budget = formatText(empty_nc(fnumber_format($data[0]['project_budget'], 0, false)), '2HTML');
  228.       $project_parent = formatText($data[0]['parent_name'], '2HTML');
  229.       $project_scale = formatText($data[0]['scale_denomination'], '2HTML');
  230.       $project_priority = formatText($data[0]['project_priority'], '2HTML');
  231.       $project_begin_date = formatText(empty_nc($data[0]['project_begin_date_display']), '2HTML');
  232.       $project_estimated_date = formatText(empty_nc($data[0]['project_estimated_date_display']), '2HTML');
  233.       $project_end_date = formatText(empty_nc($data[0]['project_end_date_display']), '2HTML');
  234.       $project_progression = $data[0]['project_completed'];
  235.       $workshop_id = formatText(empty_nc($data[0]['project_workshop_id']), '2HTML');
  236.       $workshop_name = formatText(empty_nc($data[0]['workshop_denomination']), '2HTML');
  237.       $scale_id = $data[0]['project_scale_id'];
  238.       $project_theme_id = $data[0]['project_theme_id'];
  239.       if($project_theme_id != 0) {
  240.         $project_theme = formatText($data[0]['sdtheme_name'], '2HTML');
  241.         $link_theme = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'filter' => $GLOBALS['filters'][U_L]['theme']['linkvalue'], 'id' => $data[0]['theme_sd_theme'], 'name' => $project_theme);
  242.       }
  243.  
  244.       $schedule_table = getScheduleTable($data[0]['project_begin_date_display'], $data[0]['project_estimated_date_display'], $data[0]['project_end_date_display']);
  245.  
  246.       $project_posted_on = formatText($data[0]['project_published_date_display'], '2HTML');
  247.       $project_modify_on = formatText($data[0]['project_last_modify_display'], '2HTML');
  248.       $project_posted_by = formatText($data[0]['user_login'], '2HTML');
  249.       $project_status = $data[0]['project_statut'];
  250.  
  251.       if(commentEnabled('project')) {
  252.         postCommentAction(array('module'=> ActiveItemKey($GLOBALS['activeitem']), 'module_id'=> $project_id));
  253.         $content .= '<div id="anchor-comments">'.END_LINE;
  254.         $content .= getCommentsAnchor(array('module'=> ActiveItemKey($GLOBALS['activeitem']), 'module_id'=> $project_id));
  255.         if($project_status == 'P') $content .= getPostCommentAnchor();
  256.         $content .= '</div>'.END_LINE;
  257.       }
  258.       $content .= '<h1>' . $project_name . '</h1>' . END_LINE;
  259.       $content .= '<p class="published_by">' . END_LINE;
  260.       $content .= '<span class="published-on">'._t('statut','published_on') . '</span> <span class="date">' . $project_posted_on . '</span> ';
  261.       $content .= _t('divers','by').' <a href="' . HrefMaker($link_user) . '" title="' . $GLOBALS['links'][U_L]['user-profile']['desc'] . ' (' . $project_posted_by . ')">' . $project_posted_by . '</a>';
  262.       if ($project_status == 'PA') {
  263.         $content .= ' (' . _t('statut','archived_on') . ' ' . $project_modify_on . ')';
  264.       }
  265.       $content .= formatted_permalink($link_self, ' - ');
  266.       $content .= '</p>' . END_LINE;
  267.       if($data[0]['project_parent_id'] != 0) {
  268.         $content .= '<div id="parent_project">' . END_LINE;
  269.         $content .= mb_ucfirst(_t('project','parent')) . ' : ';
  270.         $content .= '<a href="' . HrefMaker($link_parent) . '" title="' . _t('project','parent') . ' : ' . formatText($project_parent, '2ATT') . '" class="filter_info_parent">' . $project_parent . '</a> ';
  271.         $content .= '</div>' . END_LINE;
  272.       }
  273.       $content .= '<div class="chapo">' . $project_description . '</div>' . END_LINE;
  274.       
  275.       $content .= '<div class="schedule">' . $schedule_table . '</div>' . END_LINE;
  276.       $content .= '<div class="progression">'.mb_ucfirst( _t('project','progression')). ' : ' .getProgressbar($project_progression, 100, '%'). '</div>' . END_LINE;
  277.       
  278.       $content .= '<div class="body">' . $project_body . '</div>' . END_LINE;
  279.             $content .= '<div class="management">' . _t('project','budget'). ' : <span>' . $project_budget . '</span> | ' . _t('project','coordinator') . ' : <span>' . $project_coordinator . '</span> | ' . _t('project','partners') . ' : <span>' . $project_partners .'</span></div>' . END_LINE;
  280.             
  281.       $content .= getProjectChildren($project_id);
  282.       //$content .= getAssociatedIndicators($project_id, $scale_id);
  283.       $content .= getAssociatedIndicatorsValues($project_id, $scale_id);
  284.       $content .= getAssociatedWorkshop($workshop_id, $workshop_name);
  285.       $content .= '<p class="filter_info">' . END_LINE;
  286.       $content .= _t('project','priority') . ' : ';
  287.       $content .= '<a href="' . HrefMaker($link_priority) . '" title="' . $GLOBALS['filters'][U_L]['priority']['desc'] . ' : ' . formatText($project_priority, '2ATT') . '" class="filter_info_priority">' . $project_priority . '</a> ' . END_LINE;
  288.       $content .= ' ' . _t('divers','scale') . ' : ';
  289.       $content .= '<a href="' . HrefMaker($link_scale) . '" title="' . $GLOBALS['filters'][U_L]['scale']['desc'] . ' : ' . formatText($project_scale, '2ATT') . '" class="filter_info_scale">' . $project_scale . '</a>' . END_LINE;
  290.       if($project_theme_id != 0) {
  291.         $content .= ' ' . _t('divers','themeref') . ' : ';
  292.         $content .= '<a href="' . HrefMaker($link_theme) . '" title="' . $GLOBALS['filters'][U_L]['theme']['desc'] . ' : ' . formatText($project_theme, '2ATT') . '" class="filter_info_scale">' . $project_theme . '</a>' . END_LINE;
  293.       }
  294.       $content .= '</p>' . END_LINE;
  295.     }
  296.     
  297.     // including sparkline code
  298.     footerAddJS('../lib/js/jquery.sparkline.min.js');
  299.     footerAddInlineJS("$('.inlinebar').sparkline('html', {type: 'bar', barColor: '#8DA8CB'} );");
  300.     
  301.     echo $content;
  302.     return GetStatusName($project_status);
  303.   }
  304. }
  305.  
  306. /**
  307.  * GetProjectChildren()
  308.  *
  309.  * @param  $id 
  310.  * @return string 
  311.  */
  312. if(!function_exists('getProjectChildren')) {
  313.  
  314.   function getProjectChildren($id)
  315.   {
  316.     $data = $GLOBALS['sql_object']->DBSelect(SQL_getProjectChildren($id));
  317.  
  318.     $content = '';
  319.     if (count($data) != 0 && $data[0]!=0) {
  320.  
  321.       $content .= '<div id="project_children">'.END_LINE;
  322.       $content .= '<p>'.mb_ucfirst(_t('project','sub-projects')).' : </p><ul>'.END_LINE;
  323.       for($i = 0; $i < count($data); $i++) {
  324.         $link = array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue'], 'id' => $data[$i]['project_id'], 'name' => $data[$i]['project_name']);
  325.         $name = formatText($data[$i]['project_name'], '2HTML');
  326.  
  327.         $content .= '<li><a href="' . HrefMaker($link) . '" title="' . _t('project','parent') . ' : ' . formatText($name, '2ATT') . '" class="filter_info_parent">' . $name . '</a></li>' .END_LINE;
  328.       }
  329.       $content .= '</ul></div>'.END_LINE;
  330.     }
  331.  
  332.     return $content;
  333.   }
  334. }
  335.  
  336. /**
  337.  * GetStatusName()
  338.  *
  339.  * @param  $status 
  340.  * @return $stat Status name
  341.  */
  342. if(!function_exists('GetStatusName')) {
  343.  
  344.   function GetStatusName($status)
  345.   {
  346.     switch ($status) {
  347.       case 'P':
  348.         $stat = 'public';
  349.         break;
  350.       case 'PA':
  351.         $stat = 'archives_p';
  352.         break;
  353.       case 'AA':
  354.         $stat = 'archives_a';
  355.         break;
  356.       default:
  357.         $stat = 'public';
  358.     }
  359.     return $stat;
  360.   }
  361. }
  362.  
  363. /**
  364.  * getScheduleTable()
  365.  *
  366.  * @param string $s_date 
  367.  * @param string $es_date 
  368.  * @param string $e_date 
  369.  * @return string $content
  370.  */
  371. if(!function_exists('getScheduleTable')) {
  372.  
  373.   function getScheduleTable($s_date, $es_date, $e_date) {
  374.  
  375.     $es_date_class = 'nothing';
  376.     $e_date_class = 'nothing';
  377.  
  378.     if(!isNullDate($es_date)) {
  379.       if(!isNullDate($e_date)) $es_date_class = date_compare($e_date, $es_date, '>') ? 'warn' : 'good';
  380.       else $es_date_class = date_compare(date("Y-m-d"), $es_date, '>') ? 'bad' : 'good';
  381.     }
  382.     if(!isNullDate($e_date)) {
  383.       if(!isNullDate($es_date)) $e_date_class = date_compare($e_date, $es_date, '>') ? 'bad' : 'good';
  384.       else $e_date_class = 'good';
  385.     } else {
  386.       if(!isNullDate($es_date)) {
  387.         $e_date_class = date_compare(date("Y-m-d"), $es_date, '>') ? 'warn' : 'nothing';
  388.       }
  389.     }
  390.  
  391.     $content  = '<table class="project" summary="">'.END_LINE;
  392.     $content .= '<thead>'.END_LINE;
  393.     $content .= '<tr>'.END_LINE;
  394.     $content .= '<td>'._t('project','begin_date').'</td>'.END_LINE;
  395.     $content .= '<td>'._t('project','estimated_date').'</td>'.END_LINE;
  396.     $content .= '<td>'._t('project','end_date').'</td>'.END_LINE;
  397.     $content .= '</tr>'.END_LINE;
  398.     $content .= '</thead>'.END_LINE;
  399.     $content .= '<tbody>'.END_LINE;
  400.     $content .= '<tr>'.END_LINE;
  401.     $content .= '<td>'.formatText(empty_nc($s_date)).'</td>'.END_LINE;
  402.     $content .= '<td class="'.$es_date_class.'">'.formatText(empty_nc($es_date)).'</td>'.END_LINE;
  403.     $content .= '<td class="'.$e_date_class.'">'.formatText(empty_nc($e_date)).'</td>'.END_LINE;
  404.     $content .= '</tr>'.END_LINE;
  405.     $content .= '</tbody>'.END_LINE;
  406.     $content .= '</table>'.END_LINE;
  407.     return $content;
  408.   }
  409. }
  410.  
  411. /**
  412.  * getAssociatedWorkshop()
  413.  *
  414.  * @param  $id 
  415.  * @return string 
  416.  */
  417. if(!function_exists('getAssociatedWorkshop')) {
  418.  
  419.   function getAssociatedWorkshop($wid, $wname)
  420.   {
  421.     $content = '';
  422.     if($wid != 0) {
  423.       $link = array('rub' => $GLOBALS['links'][U_L]['workgroup']['linkvalue'], 'id' => $wid, 'name' => $wname);
  424.       $content .= '<div id="project_workshop">'.END_LINE;
  425.       $content .= '<h3>'.ucfirst(_t('project','workshop')).'</h3>'.END_LINE;
  426.       $content .= '<p><a href="' . HrefMaker($link) . '" title="' . _t('project','workshop') . ' : ' . formatText($wname, '2ATT') . '">' . $wname . '</a></p>' .END_LINE;
  427.       $content .= '</div>'.END_LINE;
  428.     }
  429.  
  430.     return $content;
  431.   }
  432. }
  433.  
  434. /**
  435.  * getAssociatedActors()
  436.  *
  437.  * @param  $id 
  438.  * @param  $type 
  439.  * @return string 
  440.  */
  441. if(!function_exists('getAssociatedActors')) {
  442.  
  443.     function getAssociatedActors($id, $type)
  444.     {
  445.         $data = $GLOBALS['sql_object']->DBSelect(SQL_getAssociatedActors($id, $type));
  446.  
  447.         $content = '';
  448.         $sep = '';
  449.         
  450.         if (count($data) != 0 && $data[0]!= 0) {
  451.  
  452.             for($i = 0; $i < count($data); $i++) {
  453.                 $name = formatText($data[$i]['actor_name'], '2HTML');
  454.  
  455.                 $content .= $sep.$name;
  456.                 $sep =', ';
  457.             }
  458.  
  459.         }
  460.  
  461.         return $content;
  462.     }
  463. }
  464.  
  465. /**
  466.  * getAssociatedWorkshop()
  467.  *
  468.  * @param  $id 
  469.  * @return string 
  470.  */
  471. if(!function_exists('getAssociatedIndicators')) {
  472.  
  473.   function getAssociatedIndicators($id, $scale_id, $linkto = true)
  474.   {
  475.     $data = $GLOBALS['sql_object']->DBSelect(SQL_getProjectSdi($id));
  476.  
  477.     $content = '';
  478.     if (count($data) != 0 && $data[0]!=0) {
  479.  
  480.       $content .= '<div id="project_indicators" class="listed">'.END_LINE;
  481.       $content .= '<h3>'.ucfirst(_t('project','sdi')).'</h3>'.END_LINE;
  482.       $content .= '<ul>'.END_LINE;
  483.       for($i = 0; $i < count($data); $i++) {
  484.         $link = array('rub' => $GLOBALS['links'][U_L]['dashboard']['linkvalue'], 'id' => $data[$i]['sdii_id'], 'parentid' => $scale_id, 'name' => $data[$i]['sdii_name']);
  485.         $name = formatText($data[$i]['sdii_name'], '2HTML');
  486.                 if($linkto) {
  487.             $content .= '<li><a href="' . HrefMaker($link) . '" title="' . _t('project','sdi') . ' : ' . formatText($name, '2ATT') . '">' . $name . '</a></li>' .END_LINE;
  488.                 } else {
  489.                     $content .= '<li>' . $name . '</li>' .END_LINE;
  490.                 }
  491.       }
  492.       $content .= '</ul></div>'.END_LINE;
  493.     }
  494.  
  495.     return $content;
  496.   }
  497. }
  498.  
  499. /**
  500.  * getAssociatedWorkshop()
  501.  *
  502.  * @param  $id 
  503.  * @return string 
  504.  */
  505. if(!function_exists('getAssociatedIndicatorsValues')) {
  506.  
  507.     function getAssociatedIndicatorsValues($id, $cursorcssposition = 0)
  508.     {
  509.         
  510.         include_once('../dashboard/display.php');
  511.         include_once('../dashboard/mysql.inc.php');
  512.                 
  513.         $result_sdi = $GLOBALS['sql_object']->DBSelect(SQL_getProjectSdiValues($id));
  514.  
  515.         $content = '';
  516.         $id_filter= 1; // scale id value 
  517.         
  518.         if (count($result_sdi) != 0 && $result_sdi[0]!=0) {
  519.  
  520.             $content .= '<div id="project_indicators">'.END_LINE;
  521.             $content .= '<h3>'.ucfirst(_t('project','sdi')).'</h3>'.END_LINE;
  522.             
  523.             // table header
  524.             $content .= '<table cellspacing="0" cellpadding="5" class="table_dashboard">' . END_LINE;
  525.             $content .= '<thead>' . END_LINE;
  526.             $content .= '<tr>' . END_LINE;
  527.             $content .= '<td style="width:150px">'.mb_ucfirst(_t('dashboard','graphic_value')).'</td>' . END_LINE;
  528.             //$content .= '<td>'.mb_ucfirst(_t('dashboard','numeric_value')).'</td>' . END_LINE;
  529.             $content .= '<td>'.mb_ucfirst(_t('dashboard','label_value')).'</td>' . END_LINE;
  530.             $content .= '</tr>' . END_LINE;
  531.             $content .= '</thead>' . END_LINE;
  532.             $content .= '<tbody>' . END_LINE;
  533.             
  534.             for ($j = 0;$j < count($result_sdi);$j++) {
  535.             
  536.                 // setting $threshold_value
  537.                 // By default initial value
  538.                 $threshold_value = $result_sdi[$j]['sdii_threshold_value'];
  539.                 // if set, we get the latest for the given scale
  540.                 $r = $GLOBALS['sql_object'] -> DBSelect(SQL_getlastInsertByPublicationDate($result_sdi[$j]['sdii_id'], 1));
  541.                 if(isset($r[0]['sdiv_value']) && !is_null($r[0]['sdiv_threshold'])) {
  542.                     $threshold_value = $r[0]['sdiv_threshold'];
  543.                 }
  544.                 
  545.                 if(CURRENT_APP == 'admin') {
  546.                     $link_det_sdi = './index.php?rub=dashboard&todo=det&id='.$result_sdi[$j]['sdii_id'].'&scale_id='.$id_filter;
  547.                         
  548.                 } else {
  549.                     $link_det_sdi= HrefMaker(array('rub'=> $GLOBALS['links'][U_L]['dashboard']['linkvalue'],'id'=>$result_sdi[$j]['sdii_id'], 'parentid'=> $id_filter, 'name' => $result_sdi[$j]['sdii_name']));
  550.                         
  551.                 }
  552.                 $content .= "<tr>" . END_LINE;
  553.                 $content .= "<td style=\"width:150px\">";
  554.                 $content .= getViz($GLOBALS['sql_object'], $id_filter, $result_sdi[$j], $threshold_value, null, $cursorcssposition);
  555.                 $content .= "</td>";
  556.                 $content .= "<td><a href=\"" . $link_det_sdi . "\" title=\"" . formatText($result_sdi[$j]['sdii_name'], '2ATT') . "\">" . formatText(cutText($result_sdi[$j]['sdii_name'], 53), '2HTML') . "</a></td>" . END_LINE;
  557.                 $content .= "</tr>" . END_LINE;
  558.             
  559.             }
  560.             
  561.             $content .= "</tbody>" . END_LINE;
  562.             $content .= "</table>" . END_LINE;
  563.             $content .= "</div>" . END_LINE;
  564.         }
  565.         
  566.             $js = '<script type="text/javascript">
  567.                             $(document).ready(function() {
  568.                                 $(".dashboard-indicator-gauge .cursor").removeAttr("title");
  569.                                 $(".infobox").hover(
  570.                                     function() {
  571.                                         $(this).next().fadeIn("fast");
  572.                                     },
  573.                                     function() {
  574.                                         $(this).next().hide();
  575.                                     }
  576.                                 );
  577.                                 });
  578.                         </script>';
  579.         footerAddInlineJS($js, 'default', false);
  580.         
  581.         // including sparkline code
  582.         footerAddJS('../lib/js/jquery.sparkline.min.js');
  583.         footerAddInlineJS("$('.inlinebar').sparkline('html', {type: 'bar', barColor: '#8DA8CB'} );");
  584.         
  585.  
  586.         return $content;
  587.  
  588.     }
  589. }
  590.  
  591.  
  592. ?>

Documentation generated on Thu, 20 Mar 2014 16:47:36 +0100 by phpDocumentor 1.4.1