Dokeos PHP Cross Reference Learning Management Systems

Source: /main/metadata/update_indexabletext.php - 75 lines - 2507 bytes - Summary - Text - Print

   1  <?php /*                        <!-- Dokeos metadata/udate_indexableText.php -->
   2                                                               <!-- 2005/03/16 -->
   3  
   4  <!-- Copyright (C) 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php -->
   5  
   6  */
   7  
   8  /**
   9  ==============================================================================
  10  *    Dokeos Metadata: update indexabletext for all eid_type records
  11  *
  12  *    @package dokeos.metadata
  13  ==============================================================================
  14  */
  15  
  16  
  17  // PRELIMS -------------------------------------------------------------------->
  18  
  19  require ('md_funcs.php');
  20  
  21  getpar('EID_TYPE', 'Entry Type');  // e.g. 'Document' or 'Scorm'
  22  define('TPLEN', strlen(EID_TYPE) + 1);
  23  
  24  require('md_' . strtolower(EID_TYPE) . '.php');
  25  
  26  // name of the language file that needs to be included
  27  $language_file = 'md_' . strtolower(EID_TYPE);
  28  include ('../inc/global.inc.php');
  29  $this_section=SECTION_COURSES;
  30  
  31  $nameTools = get_lang('Tool');
  32  
  33  ($nameTools && get_lang('Sorry')) or give_up(
  34      'Language file ' . $language_file . " doesn't define 'Tool' and 'Sorry'");
  35  
  36  $_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry'));
  37  
  38  $is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit();
  39  if (!$is_allowed_to_edit) give_up(get_lang('Denied'));
  40  
  41  $mdStore = new mdstore($is_allowed_to_edit);  // create table if needed
  42  $mdObj = new mdobject($_course, 0);
  43  
  44  require(api_get_path(LIBRARY_PATH) . 'xmd.lib.php');
  45  require(api_get_path(LIBRARY_PATH) . 'xht.lib.php');
  46  
  47  $xhtDoc = $mdObj->mdo_define_htt();
  48  
  49  $mdObj->mdo_add_breadcrump_nav();  // see 'md_' . EID_TYPE . '.php'
  50  Display::display_header($nameTools);
  51  
  52  // OPERATIONS ----------------------------------------------------------------->
  53  
  54  echo '<h3>', htmlspecialchars(EID_TYPE, ENT_QUOTES, $charset), '</h3>', "\n";
  55  
  56  $result = $mdStore->mds_get_many('eid,mdxmltext', "eid LIKE '" . EID_TYPE . ".%'");
  57  echo get_lang('TotalMDEs'), $total = Database::num_rows($result), "<br><br>\n";
  58  
  59  if ($total > 100) set_time_limit((int) ($total / 10));
  60  
  61  while ($row = Database::fetch_array($result))
  62  {
  63      $eid = $row['eid']; $xmltext = $row['mdxmltext'];
  64      $xhtDoc->xht_xmldoc = new xmddoc(explode("\n", $xmltext));
  65  
  66      $mdStore->mds_put($eid,
  67          $xhtDoc->xht_fill_template('INDEXABLETEXT'), 'indexabletext');
  68  
  69      echo htmlspecialchars($eid, ENT_QUOTES, $charset), ' ';
  70  }
  71  
  72  echo '<h5>', htmlspecialchars(EID_TYPE, ENT_QUOTES, $charset), '</h5>', "\n";
  73  
  74  Display::display_footer();
  75  ?>

title

Description

title

Description

title

Description

title

title

Body