<?php
/**
 * Workshop module
 * 
 * Default module index file
 * 
 * @package linea21\modules\workshop
 * @author $Author$ - linea21 <info@linea21.com>
 * @version $Id$ 
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */

//////////// Check Droits utilisateur ////////////
if (!$l21auth->hasRight('workshop') && !$l21auth->isSuperAdmin())
	ReloadIndex('admin');
////////////

include_once($dir."/".SQL.".inc.php");
include_once('../class/class.workshop.php');
include_once('../class/class.workshop_report.php');
include_once('../class/class.calendar.php');
include_once('../class/class.workshop_com.php');


function afflinkbar($todo, $id, $lang){
    
    $folder = getWorkgroupSmartFolder($id, true);

	($todo == 'det' || $todo == 'mod') ? $det_active = 'active' : $det_active ='';
	($todo == 'list_cal' || $todo == 'mod_cal' || $todo == 'add_cal' || $todo == 'sup_cal') ? $cal_active = 'active' : $cal_active ='';
	($todo == 'list_com' || $todo == 'mod_com' || $todo == 'add_com' || $todo == 'det_com' || $todo == 'mod_com' || $todo == 'sup_com') ? $forum_active = 'active' : $forum_active ='';
	
  $link_details="<a href=\"index.php?rub=workshop&amp;todo=det&amp;id=".$id."\" title=\""._t('workshop','det')."\" class=\"".$det_active."\">"._t('workshop','det')."</a>";
  $link_cal="<a href=\"index.php?rub=workshop&amp;todo=list_cal&amp;id=".$id."\" title=\""._t('workshop','list_cal')."\" class=\"".$cal_active."\">"._t('workshop','list_cal')."</a>";
  $link_com="<a href=\"index.php?rub=workshop&amp;todo=list_com&amp;id=".$id."\" title=\""._t('workshop','list_com')."\" class=\"".$forum_active."\">"._t('workshop','list_com')."</a>";
  $link_doc='<a id="browse_files" href="../library/access.php?langCode='.U_L.'&amp;expandedFolder=workgroups/'.$folder.'/" title="'. _t('filemanager','browse').'">'._t('workshop','list_doc').'</a>';
  $liste=$link_details . $link_cal . $link_com . $link_doc;
  echo "<div class=\"mod_link\">";
  echo $liste;
  echo "</div><br class=\"brendstep\" />";

}

$todopage=$dir."/";
switch ($todo)
{
  case 'add':
    $todopage.="add.php";
    break;
  case 'mod':
    $todopage.="mod.php";
    break;
  case 'mod_p':
    $todopage.="modpass.php";
    break;
  case 'sup':
    $todopage.="sup.php";
    break;
  case 'list':
    $todopage.="list.php";
    break;
  case 'det':
    $todopage.="det.php";
    break;
  case 'sup_u':
    $todopage.="sup_u.php";
    break;
  case 'add_u':
    $todopage.="add_u.php";
    break;
  case 'add_cal':
    $todopage.="add_cal.php";
    break;
  case 'sup_cal':
    $todopage.="sup_cal.php";
    break;
  case 'mod_cal':
    $todopage.="mod_cal.php";
    break;
  case 'list_cal':
    $todopage.="list_cal.php";
    break;
  case 'list_com':
    $todopage.="list_com.php";
    break;
  case 'det_com':
    $todopage.="det_com.php";
    break;
  case 'sup_com':
    $todopage.="sup_com.php";
    break;
  case 'lock_com':
    $todopage.="lock_com.php";
    break;
  case 'mod_com':
    $todopage.="mod_com.php";
    break;
  case 'add_com':
    $todopage.="add_com.php";
    break;
  default:
    $todopage.="list.php";
}
include_once(override($todopage, THEME_ADMIN_PATH));
?>
<script>
	$(document).ready(function(){
		var cboxOptions = { iframe:true, width: '80%', height: '80%', maxWidth: '85%', maxHeight: '85%' }
		$('#browse_files').colorbox(cboxOptions);
		$(window).resize(function(){ $.colorbox.resize({ width: window.innerWidth > parseInt(cboxOptions.maxWidth) ? cboxOptions.maxWidth : cboxOptions.width, height: window.innerHeight > parseInt(cboxOptions.maxHeight) ? cboxOptions.maxHeight : cboxOptions.height }); });
	});
 </script>