[ Index ]
 

Code source de Claroline 188

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/claroline/learnPath/ -> learningPathAdmin.php (source)

   1  <?php // $Id: learningPathAdmin.php,v 1.61.2.1 2007/07/04 08:09:30 seb Exp $
   2  /**
   3   * CLAROLINE
   4   *
   5   * @version 1.8 $Revision: 1.61.2.1 $
   6   *
   7   * @copyright (c) 2001-2007 Universite catholique de Louvain (UCL)
   8   *
   9   * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
  10   *
  11   * @author Piraux Sébastien <pir@cerdecam.be>
  12   * @author Lederer Guillaume <led@cerdecam.be>
  13   *
  14   * @package CLLNP
  15   *
  16   *  DESCRIPTION:
  17   *  ***********
  18   *
  19   *  This file is available only if is course admin
  20   *
  21   *  It allow course admin to :
  22   *  - change learning path name
  23   *  - change learning path comment
  24   *  - links to
  25   *    - create empty module
  26   *    - use document as module
  27   *    - use exercice as module
  28   *    - re-use a module of the same course
  29   *    - import (upload) a module
  30   *    - use a module from another course
  31   *  - remove modules from learning path (it doesn't delete it ! )
  32   *  - change locking , visibility, order
  33   *  - access to config page of modules in this learning path
  34   */
  35  
  36  /*======================================
  37         CLAROLINE MAIN
  38    ======================================*/
  39  
  40  $tlabelReq = 'CLLNP';
  41  require  '../inc/claro_init_global.inc.php';
  42  
  43  if ( ! claro_is_in_a_course() || ! claro_is_course_allowed() ) claro_disp_auth_form(true);
  44  
  45  $htmlHeadXtra[] =
  46              "<script>
  47              function confirmation (txt)
  48              {
  49                  if (confirm(txt))
  50                      {return true;}
  51                  else
  52                      {return false;}
  53              }
  54              </script>";
  55  
  56  $interbredcrump[]= array ("url"=> get_module_url('CLLNP') . '/learningPathList.php', "name"=> get_lang('Learning path list'));
  57  
  58  $nameTools = get_lang('Learning path');
  59  $_SERVER['QUERY_STRING'] =''; // used forthe breadcrumb
  60                                // when one need to add a parameter after the filename
  61  
  62  // use viewMode
  63  claro_set_display_mode_available(true);
  64  
  65  // permissions
  66  $is_allowedToEdit = claro_is_allowed_to_edit();
  67  
  68  //lib of document tool
  69  include get_path('incRepositorySys') . '/lib/fileDisplay.lib.php';
  70  
  71  // tables names
  72  
  73  // TODO use claro_sql_get_main_tbl()
  74  $TABLELEARNPATH         = claro_get_current_course_data('dbNameGlu') . "lp_learnPath";
  75  $TABLEMODULE            = claro_get_current_course_data('dbNameGlu') . "lp_module";
  76  $TABLELEARNPATHMODULE   = claro_get_current_course_data('dbNameGlu') . "lp_rel_learnPath_module";
  77  $TABLEASSET             = claro_get_current_course_data('dbNameGlu') . "lp_asset";
  78  $TABLEUSERMODULEPROGRESS= claro_get_current_course_data('dbNameGlu') . "lp_user_module_progress";
  79  
  80  if (!isset($dialogBox)) $dialogBox = "";
  81  
  82  //lib of this tool
  83  include get_path('incRepositorySys') . '/lib/learnPath.lib.inc.php';
  84  
  85  // $_SESSION
  86  
  87  if ( isset($_GET['path_id']) && $_GET['path_id'] > 0 )
  88  {
  89        $_SESSION['path_id'] = (int) $_GET['path_id'];
  90  }
  91  
  92  // get user out of here if he is not allowed to edit
  93  if ( !$is_allowedToEdit )
  94  {
  95      if ( isset($_SESSION['path_id']) )
  96      {
  97          header("Location: ./learningPath.php?path_id=".$_SESSION['path_id']);
  98      }
  99      else
 100      {
 101          header("Location: ./learningPathList.php");
 102      }
 103      exit();
 104  }
 105  
 106  // main page
 107  
 108  //####################################################################################\\
 109  //################################# COMMANDS #########################################\\
 110  //####################################################################################\\
 111  
 112  $cmd = ( isset($_REQUEST['cmd']) )? $_REQUEST['cmd'] : '';
 113  
 114  switch($cmd)
 115  {
 116      // MODULE DELETE
 117      case "delModule" :
 118          //--- BUILD ARBORESCENCE OF MODULES IN LEARNING PATH
 119          $sql = "SELECT M.*, LPM.*
 120                  FROM `".$TABLEMODULE."` AS M, `".$TABLELEARNPATHMODULE."` AS LPM
 121                  WHERE M.`module_id` = LPM.`module_id`
 122                  AND LPM.`learnPath_id` = ". (int)$_SESSION['path_id']."
 123                  ORDER BY LPM.`rank` ASC";
 124          $result = claro_sql_query($sql);
 125  
 126          $extendedList = array();
 127          while ($list = mysql_fetch_array($result, MYSQL_ASSOC))
 128          {
 129              $extendedList[] = $list;
 130          }
 131  
 132          //-- delete module cmdid and his children if it is a label
 133          // get the modules tree ( cmdid module and all its children)
 134          $temp[0] = get_module_tree( build_element_list($extendedList, 'parent', 'learnPath_module_id'), $_REQUEST['cmdid'] , 'learnPath_module_id');
 135          // delete the tree
 136          delete_module_tree($temp);
 137  
 138          break;
 139  
 140      // VISIBILITY COMMAND
 141      case "mkVisibl" :
 142      case "mkInvisibl" :
 143          $cmd == "mkVisibl" ? $visibility = 'SHOW' : $visibility = 'HIDE';
 144          //--- BUILD ARBORESCENCE OF MODULES IN LEARNING PATH
 145          $sql = "SELECT M.*, LPM.*
 146                  FROM `".$TABLEMODULE."` AS M, `".$TABLELEARNPATHMODULE."` AS LPM
 147                  WHERE M.`module_id` = LPM.`module_id`
 148                  AND LPM.`learnPath_id` = ". (int)$_SESSION['path_id'] ."
 149                  ORDER BY LPM.`rank` ASC";
 150          $result = claro_sql_query($sql);
 151  
 152          $extendedList = array();
 153          while ($list = mysql_fetch_array($result, MYSQL_ASSOC))
 154          {
 155            $extendedList[] = $list;
 156          }
 157  
 158          //-- set the visibility for module cmdid and his children if it is a label
 159          // get the modules tree ( cmdid module and all its children)
 160          $temp[0] = get_module_tree( build_element_list($extendedList, 'parent', 'learnPath_module_id'), $_REQUEST['cmdid'] );
 161          // change the visibility according to the new father visibility
 162          set_module_tree_visibility( $temp, $visibility);
 163  
 164          break;
 165  
 166      // ACCESSIBILITY COMMAND
 167      case "mkBlock" :
 168      case "mkUnblock" :
 169          $cmd == "mkBlock" ? $blocking = 'CLOSE' : $blocking = 'OPEN';
 170          $sql = "UPDATE `".$TABLELEARNPATHMODULE."`
 171                  SET `lock` = '$blocking'
 172                  WHERE `learnPath_module_id` = ". (int)$_REQUEST['cmdid']."
 173                  AND `lock` != '$blocking'";
 174          $query = claro_sql_query ($sql);
 175          break;
 176  
 177      // ORDER COMMAND
 178      case "changePos" :
 179          // changePos form sent
 180          if( isset($_POST["newPos"]) && $_POST["newPos"] != "")
 181          {
 182              // get order of parent module
 183              $sql = "SELECT *
 184                      FROM `".$TABLELEARNPATHMODULE."`
 185                      WHERE `learnPath_module_id` = ". (int)$_REQUEST['cmdid'];
 186              $temp = claro_sql_query_fetch_all($sql);
 187              $movedModule = $temp[0];
 188  
 189              // if origin and target are the same ... cancel operation
 190              if ($movedModule['learnPath_module_id'] == $_POST['newPos'])
 191              {
 192                  $dialogBox .= get_lang('Wrong operation');
 193              }
 194              else
 195              {
 196                  //--
 197                  // select max order
 198                  // get the max rank of the children of the new parent of this module
 199                  $sql = "SELECT MAX(`rank`)
 200                          FROM `".$TABLELEARNPATHMODULE."`
 201                          WHERE `parent` = ". (int)$_POST['newPos'];
 202  
 203                  $result = claro_sql_query($sql);
 204  
 205                  list($orderMax) = mysql_fetch_row($result);
 206                  $order = $orderMax + 1;
 207  
 208                  // change parent module reference in the moved module and set order (added to the end of target group)
 209                  $sql = "UPDATE `".$TABLELEARNPATHMODULE."`
 210                          SET `parent` = ". (int)$_POST['newPos'].",
 211                              `rank` = " . (int)$order . "
 212                          WHERE `learnPath_module_id` = ". (int)$_REQUEST['cmdid'];
 213                  $query = claro_sql_query($sql);
 214                  $dialogBox .= get_lang('Module moved');
 215              }
 216  
 217          }
 218          else  // create form requested
 219          {
 220              // create elementList
 221              $sql = "SELECT M.*, LPM.*
 222                      FROM `".$TABLEMODULE."` AS M, `".$TABLELEARNPATHMODULE."` AS LPM
 223                      WHERE M.`module_id` = LPM.`module_id`
 224                        AND LPM.`learnPath_id` = ". (int)$_SESSION['path_id']."
 225                        AND M.`contentType` = \"".CTLABEL_."\"
 226                      ORDER BY LPM.`rank` ASC";
 227              $result = claro_sql_query($sql);
 228              $i=0;
 229              $extendedList = array();
 230              while ($list = mysql_fetch_array($result))
 231              {
 232                  // this array will display target for the "move" command
 233                  // so don't add the module itself build_element_list will ignore all childre so that
 234                  // children of the moved module won't be shown, a parent cannot be a child of its own children
 235                  if ( $list['learnPath_module_id'] != $_REQUEST['cmdid'] ) $extendedList[] = $list;
 236              }
 237  
 238              // build the array that will be used by the claro_build_nested_select_menu function
 239              $elementList = array();
 240              $elementList = build_element_list($extendedList, 'parent', 'learnPath_module_id');
 241  
 242              $topElement['name'] = get_lang('Root');
 243              $topElement['value'] = 0;    // value is required by claro_nested_build_select_menu
 244              if (!is_array($elementList)) $elementList = array();
 245              array_unshift($elementList,$topElement);
 246  
 247              // get infos about the moved module
 248              $sql = "SELECT M.`name`
 249                      FROM `".$TABLELEARNPATHMODULE."` AS LPM,
 250                           `".$TABLEMODULE."` AS M
 251                      WHERE LPM.`module_id` = M.`module_id`
 252                        AND LPM.`learnPath_module_id` = ". (int)$_REQUEST['cmdid'];
 253              $temp = claro_sql_query_fetch_all($sql);
 254              $moduleInfos = $temp[0];
 255  
 256              $displayChangePosForm = true; // the form code comes after name and comment boxes section
 257          }
 258          break;
 259  
 260      case "moveUp" :
 261          $thisLPMId = $_REQUEST['cmdid'];
 262          $sortDirection = "DESC";
 263          break;
 264  
 265      case "moveDown" :
 266          $thisLPMId = $_REQUEST['cmdid'];
 267          $sortDirection = "ASC";
 268          break;
 269  
 270      case "createLabel" :
 271          // create form sent
 272          if( isset($_REQUEST["newLabel"]) && trim($_REQUEST["newLabel"]) != "")
 273          {
 274              // determine the default order of this Learning path ( a new label is a root child)
 275              $sql = "SELECT MAX(`rank`)
 276                      FROM `".$TABLELEARNPATHMODULE."`
 277                      WHERE `parent` = 0";
 278              $result = claro_sql_query($sql);
 279  
 280              list($orderMax) = mysql_fetch_row($result);
 281              $order = $orderMax + 1;
 282  
 283              // create new module
 284              $sql = "INSERT INTO `".$TABLEMODULE."`
 285                     (`name`, `comment`, `contentType`, `launch_data`)
 286                     VALUES ('". addslashes($_POST['newLabel']) ."','', '".CTLABEL_."', '')";
 287              $query = claro_sql_query($sql);
 288  
 289              // request ID of the last inserted row (module_id in $TABLEMODULE) to add it in $TABLELEARNPATHMODULE
 290              $thisInsertedModuleId = claro_sql_insert_id();
 291  
 292              // create new learning path module
 293              $sql = "INSERT INTO `".$TABLELEARNPATHMODULE."`
 294                     (`learnPath_id`, `module_id`, `specificComment`, `rank`, `parent`)
 295                     VALUES ('". (int)$_SESSION['path_id']."', '". (int)$thisInsertedModuleId."','', " . (int)$order . ", 0)";
 296              $query = claro_sql_query($sql);
 297          }
 298          else  // create form requested
 299          {
 300              $displayCreateLabelForm = true; // the form code comes after name and comment boxes section
 301          }
 302          break;
 303  
 304       default:
 305          break;
 306  
 307  }
 308  
 309  // IF ORDER COMMAND RECEIVED
 310  // CHANGE ORDER
 311  
 312  if (isset($sortDirection) && $sortDirection)
 313  {
 314  
 315      // get list of modules with same parent as the moved module
 316      $sql = "SELECT LPM.`learnPath_module_id`, LPM.`rank`
 317              FROM (`".$TABLELEARNPATHMODULE."` AS LPM, `".$TABLELEARNPATH."` AS LP)
 318                LEFT JOIN `".$TABLELEARNPATHMODULE."` AS LPM2 ON LPM2.`parent` = LPM.`parent`
 319              WHERE LPM2.`learnPath_module_id` = ". (int)$thisLPMId."
 320                AND LPM.`learnPath_id` = LP.`learnPath_id`
 321                AND LP.`learnPath_id` = ". (int)$_SESSION['path_id']."
 322              ORDER BY LPM.`rank` $sortDirection";
 323  
 324      $listModules  = claro_sql_query_fetch_all($sql);
 325  
 326      // LP = learningPath
 327      foreach( $listModules as $module)
 328      {
 329          // STEP 2 : FOUND THE NEXT ANNOUNCEMENT ID AND ORDER.
 330          //          COMMIT ORDER SWAP ON THE DB
 331  
 332          if (isset($thisLPMOrderFound)&& $thisLPMOrderFound == true)
 333          {
 334  
 335              $nextLPMId = $module['learnPath_module_id'];
 336              $nextLPMOrder =  $module['rank'];
 337  
 338              $sql = "UPDATE `".$TABLELEARNPATHMODULE."`
 339                      SET `rank` = \"" . (int)$nextLPMOrder . "\"
 340                      WHERE `learnPath_module_id` =  \"" . (int)$thisLPMId . "\"";
 341              claro_sql_query($sql);
 342  
 343              $sql = "UPDATE `".$TABLELEARNPATHMODULE."`
 344                      SET `rank` = \"" . (int)$thisLPMOrder . "\"
 345                      WHERE `learnPath_module_id` =  \"" . (int)$nextLPMId . "\"";
 346              claro_sql_query($sql);
 347  
 348              break;
 349          }
 350  
 351          // STEP 1 : FIND THE ORDER OF THE ANNOUNCEMENT
 352          if ($module['learnPath_module_id'] == $thisLPMId)
 353          {
 354              $thisLPMOrder = $module['rank'];
 355              $thisLPMOrderFound = true;
 356          }
 357      }
 358  }
 359  // select details of learning path to display
 360  
 361  $sql = "SELECT *
 362          FROM `".$TABLELEARNPATH."`
 363          WHERE `learnPath_id` = ". (int)$_SESSION['path_id'];
 364  $query = claro_sql_query($sql);
 365  $LPDetails = mysql_fetch_array($query);
 366  
 367  /*================================================================
 368                        DISPLAY
 369    ================================================================*/
 370  
 371  //header
 372  include get_path('incRepositorySys') . '/claro_init_header.inc.php';
 373  
 374  // display title
 375  echo claro_html_tool_title($nameTools);
 376  
 377  //####################################################################################\\
 378  //############################ LEARNING PATH NAME BOX ################################\\
 379  //####################################################################################\\
 380  
 381  if ( $cmd == "updateName" )
 382  {
 383      nameBox(LEARNINGPATH_, UPDATE_);
 384  }
 385  else
 386  {
 387      nameBox(LEARNINGPATH_, DISPLAY_);
 388  }
 389  
 390  //####################################################################################\\
 391  //############################ LEARNING PATH COMMENT BOX #############################\\
 392  //####################################################################################\\
 393  
 394  if ( $cmd == "updatecomment" )
 395  {
 396      commentBox(LEARNINGPATH_, UPDATE_);
 397  }
 398  elseif ($cmd == "delcomment" )
 399  {
 400      commentBox(LEARNINGPATH_, DELETE_);
 401  }
 402  else
 403  {
 404      commentBox(LEARNINGPATH_, DISPLAY_);
 405  }
 406  
 407  //####################################################################################\\
 408  //############################ create label && change pos forms  #####################\\
 409  //####################################################################################\\
 410  
 411  if (isset($displayCreateLabelForm) && $displayCreateLabelForm)
 412  {
 413      $dialogBox = "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">
 414                   " . claro_form_relay_context() . "
 415                    <h4><label for=\"newLabel\">".get_lang('Create a new label / title in this learning path')."</label></h4>
 416                    <input type=\"text\" name=\"newLabel\" id=\"newLabel\" maxlength=\"255\" />
 417                    <input type=\"hidden\" name=\"cmd\" value=\"createLabel\" />
 418                    <input type=\"submit\" value=\"".get_lang('Ok')."\" />
 419                    </form>";
 420  }
 421  if (isset($displayChangePosForm) && $displayChangePosForm)
 422  {
 423      $dialogBox = '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'
 424      .            claro_form_relay_context()
 425      .            '<h4>' . get_lang('Move')." ' ".$moduleInfos['name']." ' ".get_lang('To')."</h4>";
 426      // build select input - $elementList has been declared in the previous big cmd case
 427      $dialogBox .= claro_build_nested_select_menu("newPos",$elementList);
 428      $dialogBox .= "<input type=\"hidden\" name=\"cmd\" value=\"changePos\" />
 429                     <input type=\"hidden\" name=\"cmdid\" value=\"".$_REQUEST['cmdid']."\" />
 430                     <input type=\"submit\" value=\"".get_lang('Ok')."\" />
 431                     </form>";
 432  }
 433  
 434  //####################################################################################\\
 435  //############################### DIALOG BOX SECTION #################################\\
 436  //####################################################################################\\
 437  
 438  if (isset($dialogBox) && $dialogBox!="")
 439  {
 440      echo claro_html_message_box($dialogBox);
 441  }
 442  
 443  //####################################################################################\\
 444  //######################### LEARNING PATH COURSEADMIN LINKS ##########################\\
 445  //####################################################################################\\
 446  
 447  $cmdMenu[] = claro_html_cmd_link('insertMyDoc.php'. claro_url_relay_context('?'), get_lang('Add a document'));
 448  $cmdMenu[] = claro_html_cmd_link('insertMyExercise.php'. claro_url_relay_context('?'), get_lang('Add an exercise'));
 449  $cmdMenu[] = claro_html_cmd_link('insertMyModule.php' . claro_url_relay_context('?'), get_lang('Add a module of this course'));
 450  $cmdMenu[] = claro_html_cmd_link($_SERVER['PHP_SELF'] . '?cmd=createLabel'. claro_url_relay_context('&amp;'), get_lang('Create label'));
 451  
 452  echo '<p>'
 453  .    claro_html_menu_horizontal($cmdMenu)
 454  .    '</p>'
 455  ;
 456  
 457  //####################################################################################\\
 458  //######################### LEARNING PATH LIST CONTENT ###############################\\
 459  //####################################################################################\\
 460  
 461  //--- BUILD ARBORESCENCE OF MODULES IN LEARNING PATH
 462  // TODO  do not  use *
 463  $sql = "SELECT M.*, LPM.*, A.`path`
 464          FROM (`".$TABLEMODULE."` AS M,
 465               `".$TABLELEARNPATHMODULE."` AS LPM)
 466          LEFT JOIN `".$TABLEASSET."` AS A ON M.`startAsset_id` = A.`asset_id`
 467          WHERE M.`module_id` = LPM.`module_id`
 468            AND LPM.`learnPath_id` = ". (int)$_SESSION['path_id']."
 469          ORDER BY LPM.`rank` ASC";
 470  
 471  $result = claro_sql_query($sql);
 472  
 473  $extendedList = array();
 474  while ($list = mysql_fetch_array($result, MYSQL_ASSOC))
 475  {
 476      $extendedList[] = $list;
 477  }
 478  
 479  // build the array of modules
 480  // build_element_list return a multi-level array, where children is an array with all nested modules
 481  // build_display_element_list return an 1-level array where children is the deep of the module
 482  
 483  $flatElementList = build_display_element_list(build_element_list($extendedList, 'parent', 'learnPath_module_id'));
 484  
 485  $iterator = 1;
 486  $atleastOne = false;
 487  $i = 0;
 488  
 489  // look for maxDeep
 490  $maxDeep = 1; // used to compute colspan of <td> cells
 491  for ($i=0 ; $i < sizeof($flatElementList) ; $i++)
 492  {
 493      if ($flatElementList[$i]['children'] > $maxDeep) $maxDeep = $flatElementList[$i]['children'] ;
 494  }
 495  
 496  //####################################################################################\\
 497  //######################### LEARNING PATH LIST HEADER ################################\\
 498  //####################################################################################\\
 499  
 500  ?>
 501    <table class="claroTable emphaseLine" width="100%" border="0" cellspacing="2">
 502         <thead>
 503           <tr class="headerX" align="center" valign="top">
 504             <th colspan="<?php echo $maxDeep+1 ?>"><?php echo get_lang('Module'); ?></th>
 505             <th><?php echo get_lang('Modify'); ?></th>
 506             <th><?php echo get_lang('Remove'); ?></th>
 507             <th><?php echo get_lang('Block'); ?></th>
 508             <th><?php echo get_lang('Visibility'); ?></th>
 509             <th><?php echo get_lang('Move'); ?></th>
 510             <th colspan="2"><?php echo get_lang('Order'); ?></th>
 511            </tr>
 512       </thead>
 513       <tbody>
 514  <?php
 515  
 516  //####################################################################################\\
 517  //######################### LEARNING PATH LIST DISPLAY ###############################\\
 518  //####################################################################################\\
 519  
 520  foreach ($flatElementList as $module)
 521  {
 522      //-------------visibility-----------------------------
 523      if ( $module['visibility'] == 'HIDE' )
 524      {
 525          if ($is_allowedToEdit)
 526          {
 527              $style=" class=\"invisible\"";
 528          }
 529          else
 530          {
 531              continue; // skip the display of this file
 532          }
 533      }
 534      else
 535      {
 536          $style="";
 537      }
 538  
 539      $spacingString = "";
 540  
 541      for($i = 0; $i < $module['children']; $i++)
 542             $spacingString .= "<td width='5'>&nbsp;</td>";
 543  
 544      $colspan = $maxDeep - $module['children']+1;
 545  
 546      echo "<tr align=\"center\"".$style.">\n".$spacingString."<td colspan=\"".$colspan."\" align=\"left\">";
 547  
 548      if ($module['contentType'] == CTLABEL_) // chapter head
 549      {
 550          echo "<b>".htmlspecialchars($module['name'])."</b>\n";
 551      }
 552      else // module
 553      {
 554          if($module['contentType'] == CTEXERCISE_ )
 555              $moduleImg = "quiz.gif";
 556          else
 557              $moduleImg = choose_image(basename($module['path']));
 558  
 559          $contentType_alt = selectAlt($module['contentType']);
 560          echo "<a href=\"module.php?module_id=".$module['module_id']."\">"
 561              . "<img src=\"" . get_path('imgRepositoryWeb') . "".$moduleImg."\" alt=\"".$contentType_alt."\" border=\"0\">"
 562              . htmlspecialchars($module['name'])
 563              . "</a>";
 564      }
 565      echo "</td>"; // end of td of module name
 566  
 567      // Modify command / go to other page
 568      echo "<td>
 569            <a href=\"module.php?module_id=".$module['module_id']."\">".
 570           "<img src=\"" . get_path('imgRepositoryWeb') . "edit.gif\" border=0 alt=\"".get_lang('Modify')."\" />".
 571           "</a>
 572           </td>";
 573  
 574      // DELETE ROW
 575  
 576     //in case of SCORM module, the pop-up window to confirm must be different as the action will be different on the server
 577      echo "<td>
 578            <a href=\"".$_SERVER['PHP_SELF']."?cmd=delModule&cmdid=".$module['learnPath_module_id']."\" ".
 579           "onClick=\"return confirmation('".clean_str_for_javascript(get_lang('Are you sure you want to remove the following module from the learning path : ')." ".$module['name'])." ? ";
 580  
 581      if ($module['contentType'] == CTSCORM_)
 582          echo clean_str_for_javascript(get_lang('SCORM conformant modules are definitively removed from server when deleted in their learning path.')) ;
 583      elseif ( $module['contentType'] == CTLABEL_ )
 584          echo clean_str_for_javascript(get_lang('By deleting a label you will delete all modules or label it contains.'));
 585      else
 586          echo clean_str_for_javascript(get_lang('The module will still be available in the pool of modules.'));
 587  
 588      echo   "');\"
 589      ><img src=\"" . get_path('imgRepositoryWeb') . "delete.gif\" border=0 alt=\"".get_lang('Remove')."\"></a>
 590         </td>";
 591  
 592      // LOCK
 593      echo    "<td>";
 594  
 595      if ( $module['contentType'] == CTLABEL_)
 596      {
 597          echo "&nbsp;";
 598      }
 599      elseif ( $module['lock'] == 'OPEN')
 600      {
 601          echo "<a href=\"",$_SERVER['PHP_SELF'],"?cmd=mkBlock&cmdid=".$module['learnPath_module_id']."\">".
 602               "<img src=\"" . get_path('imgRepositoryWeb') . "unblock.gif\" alt=\"" . get_lang('Block') . "\" border=0>".
 603               "</a>";
 604      }
 605      elseif( $module['lock'] == 'CLOSE')
 606      {
 607          echo "<a href=\"",$_SERVER['PHP_SELF'],"?cmd=mkUnblock&cmdid=".$module['learnPath_module_id']."\">".
 608               "<img src=\"" . get_path('imgRepositoryWeb') . "block.gif\" alt=\"" . get_lang('Unblock') . "\" border=0>".
 609               "</a>";
 610      }
 611      echo "</td>";
 612  
 613      // VISIBILITY
 614      echo "<td>";
 615  
 616      if ( $module['visibility'] == 'HIDE')
 617      {
 618          echo "<a href=\"",$_SERVER['PHP_SELF'],"?cmd=mkVisibl&cmdid=".$module['module_id']."\">".
 619               "<img src=\"" . get_path('imgRepositoryWeb') . "invisible.gif\" alt=\"" . get_lang('Make visible') . "\" border=\"0\">".
 620               "</a>";
 621      }
 622      else
 623      {
 624          if( $module['lock'] == 'CLOSE' )
 625          {
 626              $onclick = "onClick=\"return confirmation('".clean_str_for_javascript(get_block('blockConfirmBlockingModuleMadeInvisible'))."');\"";
 627          }
 628          else
 629          {
 630              $onclick = "";
 631          }
 632          echo "<a href=\"",$_SERVER['PHP_SELF'],"?cmd=mkInvisibl&cmdid=".$module['module_id']."\" ",$onclick, " >".
 633               "<img src=\"" . get_path('imgRepositoryWeb') . "visible.gif\" alt=\"" . get_lang('Make invisible') . "\" border=0>".
 634               "</a>";
 635      }
 636  
 637      echo "</td>";
 638  
 639      // ORDER COMMANDS
 640      // DISPLAY CATEGORY MOVE COMMAND
 641      echo "<td>".
 642           "<a href=\"",$_SERVER['PHP_SELF'],"?cmd=changePos&cmdid=".$module['learnPath_module_id']."\">".
 643           "<img src=\"" . get_path('imgRepositoryWeb') . "move.gif\" alt=\"" . get_lang('Move'). "\" border=0>".
 644           "</a>".
 645           "</td>";
 646  
 647      // DISPLAY MOVE UP COMMAND only if it is not the top learning path
 648      if ($module['up'])
 649      {
 650          echo "<td>".
 651               "<a href=\"",$_SERVER['PHP_SELF'],"?cmd=moveUp&cmdid=".$module['learnPath_module_id']."\">".
 652               "<img src=\"" . get_path('imgRepositoryWeb') . "up.gif\" alt=\"" . get_lang('Move up') . "\" border=0>".
 653               "</a>".
 654               "</td>";
 655      }
 656      else
 657      {
 658          echo "<td>&nbsp;</td>";
 659      }
 660  
 661      // DISPLAY MOVE DOWN COMMAND only if it is not the bottom learning path
 662      if ($module['down'])
 663      {
 664          echo "<td>".
 665               "<a href=\"",$_SERVER['PHP_SELF'],"?cmd=moveDown&cmdid=".$module['learnPath_module_id']."\">".
 666               "<img src=\"" . get_path('imgRepositoryWeb') . "down.gif\" alt=\"" . get_lang('Move down') . "\" border=0>".
 667               "</a>".
 668               "</td>";
 669      }
 670      else
 671      {
 672          echo "<td>&nbsp;</td>";
 673      }
 674  
 675      echo "\n</tr>\n";
 676      $iterator++;
 677      $atleastOne = true;
 678  }
 679  
 680  echo "</tbody>";
 681  
 682  echo "<tfoot>";
 683  
 684  if ($atleastOne == false)
 685  {
 686      echo "<tr><td align=\"center\" colspan=\"7\">".get_lang('No module')."</td></tr>";
 687  }
 688  
 689  echo "</tfoot>";
 690  
 691  //display table footer
 692  echo "</table>";
 693  
 694  // footer
 695  include get_path('incRepositorySys') . '/claro_init_footer.inc.php';
 696  ?>


Généré le : Thu Nov 29 14:38:42 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics