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.  * DisplayListProject()
  15.  * Affichage de la liste des projets publics
  16.  *
  17.  * @param string $statut 
  18.  * @param integer $filter 
  19.  * @param string $id_filter 
  20.  * @param integer $debut 
  21.  * @return string $content
  22.  */
  23. if(!function_exists('DisplayListProject')) {
  24.  
  25.   function DisplayListProject($statut$filter$id_filter$debut)
  26.   {
  27.     if ($statut == 'public'{
  28.       $pas 100;
  29.       $suffix '';
  30.     else $pas SELECT_LIMIT;
  31.     if ($statut == 'archives_p'$suffix ' "'.strtolower(_t('statut','PA')).'"';
  32.     $data $GLOBALS['sql_object']->DBSelect(SQL_getProjectsList($debut$pas$statut$filter$id_filter));
  33.     $datacount $GLOBALS['sql_object']->DBSelect(SQL_getCountProjectsList($statut$filter$id_filter));
  34.     $bdd_nb_com $datacount[0]['num_rows'];
  35.     $bdd_nb_com_display '<p>' $bdd_nb_com ' ' _t('project','name'$suffix '</p>' END_LINE;
  36.     $content '<h1>' _t('project','list''</h1>' END_LINE;
  37.     if ($data != 0{
  38.       // echo $bdd_nb_com_display;    // affichage du nombre d'enregistrements
  39.       $current_link array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue']);
  40.       Display_linkin_page($current_link$bdd_nb_com$debut$pas);
  41.       for($i 0$i count($data)$i++{
  42.         $link_detail array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue']'id' => $data[$i]['project_id']'name' => $data[$i]['project_name']);
  43.         $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']);
  44.         $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']);
  45.         $link_user array('rub' => $GLOBALS['links'][U_L]['user-profile']['linkvalue']'id' => $data[$i]['project_posted_by']'name' => $data[$i]['user_login']);
  46.         $project_name formatText($data[$i]['complete_project_name']'2HTML');
  47.         $project_description formatText($data[$i]['project_description']'2HTML');
  48.         $scale_denomination formatText($data[$i]['scale_denomination']'2HTML');
  49.         $project_posted_on formatText($data[$i]['project_published_date_display']'2HTML');
  50.         $project_posted_by formatText($data[$i]['user_login']'2HTML');
  51.         $project_priority formatText($data[$i]['priority_name']'2HTML');
  52.         $project_theme_id $data[$i]['project_theme_id'];
  53.         if($project_theme_id != 0{
  54.           $project_theme formatText($data[$i]['sdtheme_name']'2HTML');
  55.           $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);
  56.         }
  57.  
  58.         $content .= '<h2>' END_LINE;
  59.         $content .= '<a href="' HrefMaker($link_detail'" title="' formatText($project_name'2ATT''">' $project_name '</a>' END_LINE;
  60.         $content .= '</h2>' END_LINE;
  61.         $content .= '<p class="published_by">' END_LINE;
  62.         $content .= _t('statut','published_on'' ' $project_posted_on ' ';
  63.         $content .= _t('divers','by').' <a href="' HrefMaker($link_user'" title="' $GLOBALS['links'][U_L]['user-profile']['desc'' (' $project_posted_by ')">' $project_posted_by '</a>';
  64.         $content .= '</p>' END_LINE;
  65.          
  66.         $content .= '<div class="chapo">' $project_description '</div>' END_LINE;
  67.         $content .= '<a class="readmore" href="'.HrefMaker($link_detail).'">'._t('btn''read_more').'</a>';
  68.         $content .= '<p class="filter_info">';
  69.         $content .= _t('project','priority'' : ';
  70.         $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;
  71.         $content .= _t('divers','scale'' : ';
  72.         $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;
  73.         if($project_theme_id != 0{
  74.           $content .= ' ' _t('divers','themeref'' : ';
  75.           $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;
  76.         }
  77.         $content .= '</p>'.END_LINE;
  78.         if($i<count($data)-1$content .= '<hr />' END_LINE;
  79.       }
  80.     else {
  81.       $content .= '<p class="info">' _t('divers','nodata''</p>';
  82.     }
  83.  
  84.     echo $content;
  85.   }
  86. }
  87.  
  88. /**
  89.  * DisplayOneProject()
  90.  * Affichage d'un projet en détail
  91.  *
  92.  * @param integer $project_id 
  93.  * @return string $stat status name
  94.  */
  95. if(!function_exists('DisplayOneProject')) {
  96.  
  97.   function DisplayOneProject($project_id)
  98.   {
  99.       
  100.     $data $GLOBALS['sql_object']->DBSelect(SQL_getoneCompleteProject($project_idarray('P''PA')));
  101.     $content '';
  102.     
  103.     if($data == 0error_redirect();
  104.     
  105.     if (count($data!= 1exit;
  106.     else {
  107.       $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']);
  108.       $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']);
  109.       $link_user array('rub' => $GLOBALS['links'][U_L]['user-profile']['linkvalue']'id' => $data[0]['project_posted_by']'name' => $data[0]['user_login']);
  110.       $link_parent array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue']'id' => $data[0]['project_parent_id']'name' => $data[0]['parent_name']);
  111.       $link_self array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue']'id' => $project_id);
  112.       $project_name formatText($data[0]['project_name']'2HTML');
  113.       $project_description linkin_content(formatText($data[0]['project_description']'2HTML'));
  114.       $project_body linkin_content(formatText($data[0]['project_body']'2HTML'));
  115.       $project_parent formatText($data[0]['parent_name']'2HTML');
  116.       $project_scale formatText($data[0]['scale_denomination']'2HTML');
  117.       $project_priority formatText($data[0]['project_priority']'2HTML');
  118.       $project_begin_date formatText(empty_nc($data[0]['project_begin_date_display'])'2HTML');
  119.       $project_estimated_date formatText(empty_nc($data[0]['project_estimated_date_display'])'2HTML');
  120.       $project_end_date formatText(empty_nc($data[0]['project_end_date_display'])'2HTML');
  121.       $project_progression $data[0]['project_completed'];
  122.       $workshop_id formatText(empty_nc($data[0]['project_workshop_id'])'2HTML');
  123.       $workshop_name formatText(empty_nc($data[0]['workshop_denomination'])'2HTML');
  124.       $scale_id $data[0]['project_scale_id'];
  125.       $project_theme_id $data[0]['project_theme_id'];
  126.       if($project_theme_id != 0{
  127.         $project_theme formatText($data[0]['sdtheme_name']'2HTML');
  128.         $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);
  129.       }
  130.  
  131.       $schedule_table getScheduleTable($data[0]['project_begin_date_display']$data[0]['project_estimated_date_display']$data[0]['project_end_date_display']);
  132.  
  133.       $project_posted_on formatText($data[0]['project_published_date_display']'2HTML');
  134.       $project_modify_on formatText($data[0]['project_last_modify_display']'2HTML');
  135.       $project_posted_by formatText($data[0]['user_login']'2HTML');
  136.       $project_status $data[0]['project_statut'];
  137.  
  138.       if(commentEnabled('project')) {
  139.         postCommentAction(array('module'=> ActiveItemKey($GLOBALS['activeitem'])'module_id'=> $project_id));
  140.         $content .= '<div id="anchor-comments">'.END_LINE;
  141.         $content .= getCommentsAnchor(array('module'=> ActiveItemKey($GLOBALS['activeitem'])'module_id'=> $project_id));
  142.         if($project_status == 'P'$content .= getPostCommentAnchor(array('module'=> ActiveItemKey($GLOBALS['activeitem'])'module_id'=> $project_id));
  143.         $content .= '</div>'.END_LINE;
  144.       }
  145.       $content .= '<h1>' $project_name '</h1>' END_LINE;
  146.       $content .= '<p class="published_by">' END_LINE;
  147.       $content .= _t('statut','published_on'' ' $project_posted_on ' ';
  148.       $content .= _t('divers','by').' <a href="' HrefMaker($link_user'" title="' $GLOBALS['links'][U_L]['user-profile']['desc'' (' $project_posted_by ')">' $project_posted_by '</a>';
  149.       if ($project_status == 'PA'{
  150.         $content .= ' (' _t('statut','archived_on'' ' $project_modify_on ')';
  151.       }
  152.       $content .= formatted_permalink($link_self' - ');
  153.       $content .= '</p>' END_LINE;
  154.       if($data[0]['project_parent_id'!= 0{
  155.         $content .= '<div id="parent_project">' END_LINE;
  156.         $content .= _t('project','parent'' : ';
  157.         $content .= '<a href="' HrefMaker($link_parent'" title="' _t('project','parent'' : ' formatText($project_parent'2ATT''" class="filter_info_parent">' $project_parent '</a> ';
  158.         $content .= '</div>' END_LINE;
  159.       }
  160.       $content .= '<div class="chapo">' $project_description '</div>' END_LINE;
  161.       
  162.       $content .= '<div class="schedule">' $schedule_table '</div>' END_LINE;
  163.       $content .= '<div class="progression">'_t('project','progression')' : ' .getProgressbar($project_progression100'%')'</div>' END_LINE;
  164.       
  165.       $content .= '<div class="body">' $project_body '</div>' END_LINE;
  166.       $content .= getProjectChildren($project_id);
  167.       //$content .= getAssociatedIndicators($project_id, $scale_id);
  168.       $content .= getAssociatedIndicatorsValues($project_id$scale_id);
  169.       $content .= getAssociatedWorkshop($workshop_id$workshop_name);
  170.       $content .= '<p class="filter_info">' END_LINE;
  171.       $content .= _t('project','priority'' : ';
  172.       $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;
  173.       $content .= ' ' _t('divers','scale'' : ';
  174.       $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;
  175.       if($project_theme_id != 0{
  176.         $content .= ' ' _t('divers','themeref'' : ';
  177.         $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;
  178.       }
  179.       $content .= '</p>' END_LINE;
  180.     }
  181.     echo $content;
  182.     return GetStatusName($project_status);
  183.   }
  184. }
  185.  
  186. /**
  187.  * GetProjectChildren()
  188.  *
  189.  * @param  $id 
  190.  * @return string 
  191.  */
  192. if(!function_exists('getProjectChildren')) {
  193.  
  194.   function getProjectChildren($id)
  195.   {
  196.     $data $GLOBALS['sql_object']->DBSelect(SQL_getProjectChildren($id));
  197.  
  198.     $content '';
  199.     if (count($data!= && $data[0]!=0{
  200.  
  201.       $content .= '<div id="project_children">'.END_LINE;
  202.       $content .= '<p>'._t('project','sub-projects').' : </p><ul>'.END_LINE;
  203.       for($i 0$i count($data)$i++{
  204.         $link array('rub' => $GLOBALS['links'][U_L]['project']['linkvalue']'id' => $data[$i]['project_id']'name' => $data[$i]['project_name']);
  205.         $name formatText($data[$i]['project_name']'2HTML');
  206.  
  207.         $content .= '<li><a href="' HrefMaker($link'" title="' _t('project','parent'' : ' formatText($name'2ATT''" class="filter_info_parent">' $name '</a></li>' .END_LINE;
  208.       }
  209.       $content .= '</ul></div>'.END_LINE;
  210.     }
  211.  
  212.     return $content;
  213.   }
  214. }
  215.  
  216. /**
  217.  * GetStatusName()
  218.  *
  219.  * @param  $status 
  220.  * @return $stat Status name
  221.  */
  222. if(!function_exists('GetStatusName')) {
  223.  
  224.   function GetStatusName($status)
  225.   {
  226.     switch ($status{
  227.       case 'P':
  228.         $stat 'public';
  229.         break;
  230.       case 'PA':
  231.         $stat 'archives_p';
  232.         break;
  233.       case 'AA':
  234.         $stat 'archives_a';
  235.         break;
  236.       default:
  237.         $stat 'public';
  238.     }
  239.     return $stat;
  240.   }
  241. }
  242.  
  243. /**
  244.  * getScheduleTable()
  245.  *
  246.  * @param string $s_date 
  247.  * @param string $es_date 
  248.  * @param string $e_date 
  249.  * @return string $content
  250.  */
  251. if(!function_exists('getScheduleTable')) {
  252.  
  253.   function getScheduleTable($s_date$es_date$e_date{
  254.  
  255.     $es_date_class 'nothing';
  256.     $e_date_class 'nothing';
  257.  
  258.     if(!isNullDate($es_date)) {
  259.       if(!isNullDate($e_date)) $es_date_class date_compare($e_date$es_date'>''warn' 'good';
  260.       else $es_date_class date_compare(date("Y-m-d")$es_date'>''bad' 'good';
  261.     }
  262.     if(!isNullDate($e_date)) {
  263.       if(!isNullDate($es_date)) $e_date_class date_compare($e_date$es_date'>''bad' 'good';
  264.       else $e_date_class 'good';
  265.     else {
  266.       if(!isNullDate($es_date)) {
  267.         $e_date_class date_compare(date("Y-m-d")$es_date'>''warn' 'nothing';
  268.       }
  269.     }
  270.  
  271.     $content  '<table class="project" summary="">'.END_LINE;
  272.     $content .= '<thead>'.END_LINE;
  273.     $content .= '<tr>'.END_LINE;
  274.     $content .= '<th>'._t('project','begin_date').'</th>'.END_LINE;
  275.     $content .= '<th>'._t('project','estimated_date').'</th>'.END_LINE;
  276.     $content .= '<th>'._t('project','end_date').'</th>'.END_LINE;
  277.     $content .= '</tr>'.END_LINE;
  278.     $content .= '</thead>'.END_LINE;
  279.     $content .= '<tbody>'.END_LINE;
  280.     $content .= '<tr>'.END_LINE;
  281.     $content .= '<td>'.formatText(empty_nc($s_date)).'</td>'.END_LINE;
  282.     $content .= '<td class="'.$es_date_class.'">'.formatText(empty_nc($es_date)).'</td>'.END_LINE;
  283.     $content .= '<td class="'.$e_date_class.'">'.formatText(empty_nc($e_date)).'</td>'.END_LINE;
  284.     $content .= '</tr>'.END_LINE;
  285.     $content .= '</tbody>'.END_LINE;
  286.     $content .= '</table>'.END_LINE;
  287.     return $content;
  288.   }
  289. }
  290.  
  291. /**
  292.  * getAssociatedWorkshop()
  293.  *
  294.  * @param  $id 
  295.  * @return string 
  296.  */
  297. if(!function_exists('getAssociatedWorkshop')) {
  298.  
  299.   function getAssociatedWorkshop($wid$wname)
  300.   {
  301.     $content '';
  302.     if($wid != 0{
  303.       $link array('rub' => $GLOBALS['links'][U_L]['workgroup']['linkvalue']'id' => $wid'name' => $wname);
  304.       $content .= '<div id="project_workshop">'.END_LINE;
  305.       $content .= '<h3>'.ucfirst(_t('project','workshop')).'</h3>'.END_LINE;
  306.       $content .= '<p><a href="' HrefMaker($link'" title="' _t('project','workshop'' : ' formatText($wname'2ATT''">' $wname '</a></p>' .END_LINE;
  307.       $content .= '</div>'.END_LINE;
  308.     }
  309.  
  310.     return $content;
  311.   }
  312. }
  313.  
  314. /**
  315.  * getAssociatedWorkshop()
  316.  *
  317.  * @param  $id 
  318.  * @return string 
  319.  */
  320. if(!function_exists('getAssociatedIndicators')) {
  321.  
  322.   function getAssociatedIndicators($id$scale_id)
  323.   {
  324.     $data $GLOBALS['sql_object']->DBSelect(SQL_getProjectSdi($id));
  325.  
  326.     $content '';
  327.     if (count($data!= && $data[0]!=0{
  328.  
  329.       $content .= '<div id="project_indicators">'.END_LINE;
  330.       $content .= '<h3>'.ucfirst(_t('project','sdi')).'</h3>'.END_LINE;
  331.       $content .= '<ul>'.END_LINE;
  332.       for($i 0$i count($data)$i++{
  333.         $link array('rub' => $GLOBALS['links'][U_L]['dashboard']['linkvalue']'id' => $data[$i]['sdii_id']'parentid' => $scale_id'name' => $data[$i]['sdii_name']);
  334.         $name formatText($data[$i]['sdii_name']'2HTML');
  335.  
  336.         $content .= '<li><a href="' HrefMaker($link'" title="' _t('project','sdi'' : ' formatText($name'2ATT''">' $name '</a></li>' .END_LINE;
  337.       }
  338.       $content .= '</ul></div>'.END_LINE;
  339.     }
  340.  
  341.     return $content;
  342.   }
  343. }
  344.  
  345. /**
  346.  * getAssociatedWorkshop()
  347.  *
  348.  * @param  $id 
  349.  * @return string 
  350.  */
  351. if(!function_exists('getAssociatedIndicatorsValues')) {
  352.  
  353.     function getAssociatedIndicatorsValues($id$cursorcssposition 0)
  354.     {
  355.         
  356.         include_once('../dashboard/display.php');
  357.         include_once('../dashboard/mysql.inc.php');
  358.                 
  359.         $result_sdi $GLOBALS['sql_object']->DBSelect(SQL_getProjectSdiValues($id));
  360.  
  361.         $content '';
  362.         $id_filter1// scale id value 
  363.         
  364.         if (count($result_sdi!= && $result_sdi[0]!=0{
  365.  
  366.             $content .= '<div id="project_indicators">'.END_LINE;
  367.             $content .= '<h3>'.ucfirst(_t('project','sdi')).'</h3>'.END_LINE;
  368.             
  369.             // table header
  370.             $content .= '<table cellspacing="0" cellpadding="5" class="table_dashboard">' END_LINE;
  371.             $content .= '<thead>' END_LINE;
  372.             $content .= '<tr>' END_LINE;
  373.             $content .= '<td style="width:250px">'.mb_ucfirst(_t('dashboard','graphic_value')).'</td>' END_LINE;
  374.             //$content .= '<td>'.mb_ucfirst(_t('dashboard','numeric_value')).'</td>' . END_LINE;
  375.             $content .= '<td>'.mb_ucfirst(_t('dashboard','label_value')).'</td>' END_LINE;
  376.             $content .= '</tr>' END_LINE;
  377.             $content .= '</thead>' END_LINE;
  378.             $content .= '<tbody>' END_LINE;
  379.             
  380.             for ($j 0;$j count($result_sdi);$j++{
  381.             
  382.                 // setting $threshold_value
  383.                 // By default initial value
  384.                 $threshold_value $result_sdi[$j]['sdii_threshold_value'];
  385.                 // if set, we get the latest for the given scale
  386.                 $r $GLOBALS['sql_object'-> DBSelect(SQL_getlastInsertByPublicationDate($result_sdi[$j]['sdii_id']1));
  387.                 if(isset($r[0]['sdiv_value']&& !is_null($r[0]['sdiv_threshold'])) {
  388.                     $threshold_value $r[0]['sdiv_threshold'];
  389.                 }
  390.                 
  391.                 if(CURRENT_APP == 'admin'{
  392.                     $link_det_sdi './index.php?rub=dashboard&todo=det&id='.$result_sdi[$j]['sdii_id'].'&scale_id='.$id_filter;
  393.                         
  394.                 else {
  395.                     $link_det_sdiHrefMaker(array('rub'=> $GLOBALS['links'][U_L]['dashboard']['linkvalue'],'id'=>$result_sdi[$j]['sdii_id']'parentid'=> $id_filter'name' => $result_sdi[$j]['sdii_name']));
  396.                         
  397.                 }
  398.                 $content .= "<tr>" END_LINE;
  399.                 $content .= "<td>";
  400.                 $content .= getViz($GLOBALS['sql_object']$id_filter$result_sdi[$j]$threshold_valuenull$cursorcssposition);
  401.                 $content .= "</td>";
  402.                 $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;
  403.                 $content .= "</tr>" END_LINE;
  404.             
  405.             }
  406.             
  407.             $content .= "</tbody>" END_LINE;
  408.             $content .= "</table>" END_LINE;
  409.             $content .= "</div>" END_LINE;
  410.         }
  411.         
  412.             $js '<script type="text/javascript">
  413.                             $(document).ready(function() {
  414.                                 $(".dashboard-indicator-gauge .cursor").removeAttr("title");
  415.                                 $(".infobox").hover(
  416.                                     function() {
  417.                                         $(this).next().fadeIn("fast");
  418.                                     },
  419.                                     function() {
  420.                                         $(this).next().hide();
  421.                                     }
  422.                                 );
  423.                                 });
  424.                         </script>';
  425.         footerAddInlineJS($js'default'false);
  426.         
  427.  
  428.         return $content;
  429.  
  430.     }
  431. }
  432.  
  433.  
  434. ?>

Documentation generated on Mon, 08 Apr 2013 18:13:48 +0200 by phpDocumentor 1.4.1