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

Source for file list.php

Documentation is available at list.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage home
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  'Home' module is used into the back-office
  10.  */
  11.  
  12. //////////// Check Inclusion de pages ////////////
  13. if (!class_exists('auth')){
  14.   include_once("../lib/lib_common.php");
  15.   ReloadIndex('admin');
  16. }
  17. ////////////
  18.  
  19. // Comments
  20. if(defined('MOD_COMMENT') && MOD_COMMENT == 1) {
  21.   include_once(override('../comment/display.php'));
  22.   include_once(override('../comment/'.SQL.'.inc.php'));
  23.   include_once('../class/class.comment.php');
  24.   if(COMMENT_MODERATION == 1) {
  25.     $status = array('D');
  26.     $comm = new comment();
  27.     $data = $comm->getAllByModule($status, $sql_object, false, 'date');
  28.     $nb_comments = count($data);
  29.     $html_comments = getMarkup($data, true);
  30.   } else {
  31.     $status = array('P');
  32.     $comm = new comment();
  33.     $data = $comm->getAllByModule($status, $sql_object, 10, 'date');
  34.     $nb_comments = count($data);
  35.     $html_comments = getMarkup($data, false);
  36.   }
  37.   echo getAjaxFunction();
  38. }
  39.  
  40. // workgroups users moderation
  41. if(defined('MOD_WORKSHOP') && MOD_WORKSHOP == 1) {
  42.     include_once(override('../languages/'.U_L.'/lang_workshop.'.CHARSET.'.php'));
  43.     
  44.     $r = $sql_object -> DBSelect(SQL_getWorkgroupsPendingUsers());
  45.  
  46.     if ($r[0]['user_login']=="") $nb_pendingusers=0;
  47.     else $nb_pendingusers = count($r);
  48.  
  49.     $cnt_pending_users = 0;
  50.     $liste_pendingusers = '';
  51.     
  52.     if ($nb_pendingusers != 0) {
  53.         
  54.         for ($i = 0;$i < count($r);$i++) {
  55.             // we display only workgroups current user is in charge of
  56.             if ($l21auth->isWorkgroupOrganiser($l21auth->GetSessionElement('id'), $sql_object, $r[$i]['workshop_id']) || $l21auth->isSuperAdmin()){
  57.                 $cnt_pending_users++;
  58.                 $link_accept = '../workshop/_user.php?action=accept&amp;id='. $r[$i]['workshop_id'].'&amp;u_id='.$r[$i]['user_id'];
  59.                 $link_revoke = '../workshop/_user.php?action=unaccept&amp;id='. $r[$i]['workshop_id'].'&amp;u_id='.$r[$i]['user_id'];
  60.                 // we display user link only if admin
  61.                 if($l21auth->isSuperAdmin()) {
  62.                     $username = '<a href="?rub=user&amp;todo=det&amp;id='.$r[$i]['user_id'].'"  title="' . $GLOBALS['links'][U_L]['user-profile']['desc'].'">'.$r[$i]['user_login'].'</a>';
  63.                 } else {
  64.                     $username = $r[$i]['user_login'];
  65.                 }
  66.                 if(!empty($r[$i]['profile_firstname']) || !empty($r[$i]['profile_lastname'])) {
  67.                     $username .= ' ('.$r[$i]['profile_firstname']. '' . $r[$i]['profile_lastname'] .')';
  68.                 }
  69.                 $username .= ' - <a href="mailto:'.$r[$i]['profile_email'].'">'.$r[$i]['profile_email'].'</a>';
  70. //                 $liste_pendingusers .= "\t<li class=\"li2 to-moderate\">". formatText($username, '2HTML') . "<br />" .sprintf(_t('workshop', 'workshop_join'), formatText('<a href="?rub=workshop&amp;todo=det&amp;id='.$r[$i]['workshop_id'].'">'.$r[$i]['workshop_denomination'].'</a>', '2HTML')). "<a href=\"".$link_accept."\"  title=\""._t('workshop','add_new_user')."\" class=\"ico_add user-action\"><i class=\"icon-ok\"></i><span>" . _t('workshop','del_user') . "</span></a><a href=\"".$link_revoke."\"  title=\""._t('workshop','del_user')."\" class=\"ico_sup user-action\"><i class=\"icon-cancel\"></i><span>" . _t('workshop','del_user') . "</span></a></li>\n\n";
  71.                 $liste_pendingusers .= "\t<li class=\"li2 to-moderate\"><div class=\"iconetab\"><a href=\"".$link_accept."\"  title=\""._t('workshop','add_new_user')."\" class=\"ico_approve user-action\"><i class=\"icon-ok\"></i><span>" . _t('workshop','add_new_user') . "</span></a><a href=\"".$link_revoke."\"  title=\""._t('workshop','del_user')."\" class=\"ico_sup user-action\"><i class=\"icon-cancel\"></i><span>" . _t('workshop','del_user') . "</span></a></div>". formatText($username, '2HTML') . "<br />" .sprintf(_t('workshop', 'workshop_join'), formatText('<a href="?rub=workshop&amp;todo=det&amp;id='.$r[$i]['workshop_id'].'">'.$r[$i]['workshop_denomination'].'</a>', '2HTML')). "</li>\n\n";
  72.             }
  73.         }
  74.         if(empty($liste_pendingusers)) $liste_pendingusers .= "\t<li><div class=\"info\">" ._t('home','noupdate'). "</div></li>\n\n";
  75.         
  76.         // ajax code
  77.         $js = '$("a.user-action").click(function() {
  78.         
  79.         var el = this;
  80.         var url = $(this).attr("href") + "&mode=ajax";
  81.  
  82.         $.ajax({
  83.             type: "GET",
  84.             url: url,
  85.             dataType: "json",
  86.             success: function(data){
  87.                 if(data.status==1) {
  88.                     // we update the user counter
  89.                     $("#cu").text( parseInt($("#cu").text()) - 1);
  90.                     // humane.success = humane.spawn({ addnCls: "humane-jackedup-success"});
  91.                     // humane.success(data.msg);
  92.                     $(el).closest("li").fadeOut();
  93.                 } else {
  94.                     // humane.error = humane.spawn({ addnCls: "humane-jackedup-error"});
  95.                     // humane.error(data.msg);
  96.                 }
  97.             }
  98.         });
  99.             
  100.         return false;
  101.         
  102.         });
  103.         ';
  104.         
  105.         footerAddInlineJS($js);
  106.     } else   $liste_pendingusers .= "\t<li><div class=\"info\">" ._t('home','noupdate'). "</div></li>\n\n";
  107. }
  108.  
  109.  
  110. $result_yp = $sql_object -> DBSelect($req_yp);
  111. if ($result_yp[0]['yellowp_id']=="") $nb_yp=0;
  112. else $nb_yp = count($result_yp);
  113. $link_yp = "index.php?rub=yellowpages&amp;todo=det&amp;id=";
  114. $liste_yp = '';
  115.  
  116. if ($nb_yp<>0) {
  117.   for ($i = 0;$i < count($result_yp);$i++) {
  118.     $liste_yp .= "\t<li class=\"li2\"><a href=\"" . $link_yp . $result_yp[$i]['yellowp_id'] . "\" title=\"" . formatText($result_yp[$i]['yellowp_name'], '2ATT') . "\">" . formatText($result_yp[$i]['yellowp_name'], '2HTML') . "</a></li>\n\n";
  119.   }
  120. }else   $liste_yp .= "\t<li><div class=\"info\">" ._t('home','noupdate'). "</div></li>\n\n";
  121.  
  122.  
  123.  
  124. $result_sdi = $sql_object -> DBSelect($req_sdi);
  125. if ($result_sdi[0]['sdii_id']=="") $nb_dashboard=0;
  126. else $nb_dashboard = count($result_sdi);
  127. $liste_dashboard = '';
  128. $link_dashboard = "index.php?rub=dashboard&amp;todo=det&amp;id=";
  129. if ($nb_dashboard<>0) {
  130.   for ($i = 0;$i < count($result_sdi);$i++) {
  131.     $liste_dashboard .= "\t<li class=\"li2\"><a href=\"" . $link_dashboard . $result_sdi[$i]['sdii_id'] . "&amp;scale_id=" . $result_sdi[$i]['scale_id'] . "\" title=\"" . formatText($result_sdi[$i]['sdii_name'], '2ATT') . "\">" . formatText($result_sdi[$i]['sdii_name'], '2HTML') . "</a> <span class=\"scale\">   (" . formatText($result_sdi[$i]['scale_denomination'], '2HTML') . ") </span></li>\n\n";
  132.   }
  133. }else   $liste_dashboard .= "\t<li><div class=\"info\">" ._t('home','noupdate'). "</div></li>\n\n";
  134.  
  135.  
  136. if (isset($_SESSION['lastcon'])){
  137.     
  138.   $req_user = SQL_getUser($_SESSION['lastcon']);
  139.   $resultu = $sql_object -> DBSelect($req_user);
  140.   
  141.   if ($resultu[0]['user_id']=="") $nb_user=0;
  142.   else $nb_user = count($resultu);
  143.   
  144.   $liste_user = '';
  145.   $link_user = "index.php?rub=user&amp;todo=det&amp;id=";
  146.   
  147.   if ($nb_user<>0) {
  148.     for ($i = 0;$i < count($resultu);$i++) {
  149.       $fullname = '';
  150.       if(!empty($resultu[$i]['profile_firstname']) || $resultu[$i]['profile_lastname']) {
  151.         $fullname = ' - '. $resultu[$i]['profile_firstname'].' '.$resultu[$i]['profile_lastname'];
  152.       }
  153.       $liste_user .= "\t<li class=\"li2\"><a href=\"" . $link_user . $resultu[$i]['user_id'] . "\" title=\"" . formatText($resultu[$i]['user_login'], '2ATT') . "\">" . formatText($resultu[$i]['user_login'], '2HTML')  . "</a>".$fullname."</li>\n\n";
  154.     }
  155.   }else   $liste_user .= "\t<li><div class=\"info\">" ._t('home','noupdate'). "</div></li>\n\n";
  156. }
  157.  
  158. $result_news = $sql_object -> DBSelect($req_news);
  159. $liste_news = '';
  160. if ($result_news[0]['news_id']=="") $nb_news=0;
  161. else $nb_news = count($result_news);
  162. $link_news = "index.php?rub=news&amp;todo=det&amp;id=";
  163. if ($nb_news<>0) {
  164.   for ($i = 0;$i < count($result_news);$i++) {
  165.     $liste_news .= "\t<li class=\"li2\"><a href=\"" . $link_news . $result_news[$i]['news_id'] . "\" title=\"" . formatText($result_news[$i]['news_title'], '2ATT') . "\">" . formatText($result_news[$i]['news_title'], '2HTML') . "</a></li>\n\n";
  166.   }
  167. } else   $liste_news .= "\t<li><div class=\"info\">" ._t('home','noresult'). "</div></li>\n\n";
  168.  
  169.  
  170. $result_publi = $sql_object -> DBSelect($req_publi);
  171. $link_publi = "index.php?rub=publication&amp;todo=det&amp;id=";
  172. if ($result_publi[0]['publi_id']=="") $nb_publi=0;
  173. else $nb_publi = count($result_publi);
  174. if ($nb_publi<>0) $liste_publi = "\t<li class=\"li2\"><a href=\"" . $link_publi . $result_publi[0]['publi_id'] . "\" title=\"" . formatText($result_publi[0]['publi_title'], '2HTML') . "\">" . formatText($result_publi[0]['publi_title'], '2HTML') . "</a></li>\n\n";
  175. else  $liste_publi = "\t<li><div class=\"info\">" ._t('home','noresult'). "</div></li>\n\n";
  176.  
  177. $result_rep = $sql_object -> DBSelect($req_rep);
  178. if ($result_rep[0]['workrep_id']=="") $nb_rep=0;
  179. else $nb_rep = count($result_rep);
  180. $link_rep = "index.php?rub=workshoprep&amp;todo=det&amp;id=";
  181. if ($nb_rep<>0) $liste_rep = "\t<li class=\"li2\"><a href=\"" . $link_rep . $result_rep[0]['workrep_id'] . "\" title=\"" . formatText($result_rep[0]['workrep_title'], '2ATT') . "\">" . formatText($result_rep[0]['workrep_title'], '2HTML') . "</a></li>\n\n";
  182. else  $liste_rep = "\t<li><div class=\"info\">" ._t('home','noresult'). "</div></li>\n\n";
  183.  
  184. $rProjects = $sql_object->DBSelect(SQL_getProjects(), 'OBJECT');
  185. $lProjects = '';
  186. if ($rProjects == 0) $nbProjects=0;
  187. else $nbProjects = count($rProjects);
  188. $link_projects = "index.php?rub=project&amp;todo=det&amp;id=";
  189. if ($nbProjects > 0) {
  190.   for ($i = 0;$i < count($rProjects);$i++) {
  191.     $lProjects .= "\t<li class=\"li2\"><a href=\"" . $link_projects . $rProjects[$i]->project_id . "\" title=\"" . formatText($rProjects[$i]->project_name, '2ATT') . "\">" . formatText($rProjects[$i]->project_name, '2HTML') .' ('. $rProjects[$i]->project_estimated_date_display . ")</a></li>\n\n";
  192.   }
  193. } else   $lProjects .= "\t<li><div class=\"info\">" ._t('home','noresult'). "</div></li>\n\n";
  194.  
  195.  
  196. ?>
  197. <div id="chemin">
  198. <ul>
  199.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home') ?></a>
  200.     </li>
  201. </ul>
  202. </div>
  203. <!--end barre haute -->
  204. <?php
  205. include_once(THEME_ADMIN_PATH."quickicons.php");
  206.  
  207. ?>
  208. <div class="contentcontainer"><?php include_once(override($dir.'/menurub.php', THEME_ADMIN_PATH));
  209.  
  210. ?>
  211. <div id="content"><?php
  212. $listing = '';
  213. $listing .= "<div class=\"scale\">" . _t('home','accueil') . ": <a href=\"mailto:".MAIL_LINEA."\" title=\"".MAIL_LINEA."\">".MAIL_LINEA."</a></div>";
  214. $listing .= "<h2>" . _t('home','resume') . "</h2><br class=\"brendstep\" />";
  215.  
  216.  
  217. if ($l21auth->isSuperAdmin() && defined('MOD_COMMENT') && MOD_COMMENT == 1) {
  218.     if($nb_comments > 0) $class='block';
  219.     else $class='none';
  220.     $c = ($class == 'block') ? 'open' : '';
  221.     
  222.   if(COMMENT_MODERATION == 1) {
  223.     $title = sprintf(_t('home','comment_to_moderate'), '<span id="cc">'.$nb_comments.'</span>');
  224.   } else {
  225.     $title = sprintf(_t('home','comment'), $nb_comments);
  226.   }
  227.   $listing .= "<div class=\"toggle_title\"><a href=\"#\" class=\"". $c ."\">" . $title. "</a></div>";
  228.   $listing .= "<div class=\"contboxgray\" id=\"comments\" style=\"display:".$class.";\">\n";
  229.   if(!empty($html_comments)) $listing .= $html_comments;
  230.   else $listing .= "<div class=\"info\">"._t('home','noresult')."</div>";
  231.   $listing .= "</div>\n";
  232. }
  233.  
  234. if ($l21auth->hasRight('workshop') && defined('MOD_WORKSHOP') && MOD_WORKSHOP == 1) {
  235.     if($cnt_pending_users > 0) $class='block';
  236.     else $class='none';
  237.     $c = ($class == 'block') ? 'open' : '';
  238.     
  239.     $title = sprintf(_t('home','workshop_pending_users'), '<span id="cu">'.$cnt_pending_users.'</span>');
  240.     $listing .= "<div class=\"toggle_title\"><a href=\"#\" class=\"". $c ."\">" . $title . "</a></div>";
  241.     $listing .= "<div class=\"contboxgray\" id=\"workgroup-users\" style=\"display:".$class.";\">\n";
  242.     $listing .= "<ul>\n";
  243.     $listing .= $liste_pendingusers;
  244.     $listing .= "</ul>\n";
  245.     $listing .= "</div>\n";
  246. }
  247.  
  248. if ($l21auth->hasRight('dashboard') && defined('MOD_DASHBOARD') && MOD_DASHBOARD == 1) {
  249.     if($nb_dashboard > 0) $class='block';
  250.     else $class='none';
  251.     $c = ($class == 'block') ? 'open' : '';
  252.     
  253.   $listing .= "<div class=\"toggle_title\"><a href=\"#\" class=\"". $c ."\">" . $nb_dashboard . " " . _t('home','dashboard') . "</a></div>";
  254.   $listing .= "<div class=\"contboxgray\" id=\"general\" style=\"display:".$class.";\">\n";
  255.   $listing .= "<ul>\n";
  256.   $listing .= $liste_dashboard;
  257.   $listing .= "</ul>\n";
  258.   $listing .= "</div>\n";
  259. }
  260.  
  261. if ($l21auth->isSuperAdmin() && defined('MOD_PROJECT') && MOD_PROJECT == 1) {
  262.   $listing .= "<div class=\"toggle_title\"><a href=\"#\">" . _t('home','project') . "</a></div>";
  263.   $listing .= "<div class=\"contboxgray\" id=\"projects\" style=\"display:none;\" >\n";
  264.   $listing .= "<ul>\n";
  265.   $listing .= $lProjects;
  266.   $listing .= "</ul>\n";
  267.   $listing .= "</div>\n";
  268. }
  269.  
  270. if ($l21auth->isSuperAdmin() && defined('MOD_USER') && MOD_USER == 1){
  271.       if($nb_user > 0) $class='block';
  272.       else $class='none';
  273.     $listing .= "<div class=\"toggle_title\"><a href=\"#\" class=\"". $c ."\">" . $nb_user . " " . _t('home','user') . "</a></div>";
  274.     $listing .= "<div class=\"contboxgray\" id=\"user\" style=\"display:".$class.";\">\n";
  275.     $listing .= "<ul>\n";
  276.     $listing .= $liste_user;
  277.     $listing .= "</ul>\n";
  278.     $listing .= "</div>\n";
  279. }
  280.  
  281.  
  282. if ($l21auth->isSuperAdmin() && defined('MOD_YELLOWPAGES') && MOD_YELLOWPAGES == 1){
  283.     if($nb_yp > 0) $class='block';
  284.     else $class='none';
  285.     $c = ($class == 'block') ? 'open' : '';
  286.     
  287.   $listing .= "<div class=\"toggle_title\"><a href=\"#\" class=\"". $c ."\">" . $nb_yp . " " . _t('home','yp') . "</a></div>";
  288.   $listing .= "<div class=\"contboxgray\" id=\"yp\" style=\"display:".$class.";\">\n";
  289.   $listing .= "<ul>\n";
  290.   $listing .= $liste_yp;
  291.   $listing .= "</ul>\n";
  292.   $listing .= "</div>\n";
  293. }
  294. if ($l21auth->hasRight('news') && defined('MOD_NEWS') && MOD_NEWS == 1){
  295.   $listing .= "<h3>" . _t('home','news') . "</h3>";
  296.   $listing .= "<div class=\"contboxgray\">\n";
  297.   $listing .= "<ul>\n";
  298.   $listing .= $liste_news;
  299.   $listing .= "</ul>\n";
  300.   $listing .= "</div>\n";
  301. }
  302. if ($l21auth->hasRight('publication') && defined('MOD_PUBLICATION') && MOD_PUBLICATION == 1) {
  303.   $listing .= "<h3>" . _t('home','publi') . "</h3>";
  304.   $listing .= "<div class=\"contboxgray\">\n";
  305.   $listing .= "<ul>\n";
  306.   $listing .= $liste_publi;
  307.   $listing .= "</ul>\n";
  308.   $listing .= "<div class=\"scale\">" . formatText($result_publi[0]['publi_resume'], '2HTML') . "</div>";
  309.   $listing .= "</div>\n";
  310. }
  311. if ($l21auth->hasRight('workshop') && defined('MOD_WORKSHOP') && MOD_WORKSHOP == 1) {
  312.   $listing .= "<h3>" . _t('home','report') . "</h3>";
  313.   $listing .= "<div class=\"contboxgray\">\n";
  314.   $listing .= "<ul>\n";
  315.   $listing .= $liste_rep;
  316.   $listing .= "</ul>\n";
  317.   $listing .= "<div class=\"scale\">" . formatText($result_rep[0]['workrep_resume'], '2HTML') . "</div>";
  318.   $listing .= "</div>\n";
  319. }
  320.  
  321. echo $listing;
  322.  
  323. ?></div>
  324. <?php include_once(override($dir.'/help.php', THEME_ADMIN_PATH)); ?></div>

Documentation generated on Thu, 20 Mar 2014 16:48:35 +0100 by phpDocumentor 1.4.1