Code Search for Developers
 
 
  

official_update_titles_teachers.php from pointcarre at Krugle


Show official_update_titles_teachers.php syntax highlighted

<?php // $Id: official_update_titles_teachers.php 396 2006-09-18 09:30:43Z evie_em $ 
/*
==============================================================================
	Dokeos - elearning and course management software
	Pointcarre - variant of Dokeos

	Copyright (c) Roan Embrechts (Vrije Universiteit Brussel, VUB)

	For a full list of contributors, see "credits.txt".
	The full license can be read in "license.txt".

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	See the GNU General Public License for more details.
	
	http://pointcarre.sourceforge.net/
	http://www.dokeos.com/
==============================================================================
*/
/**
============================================================================== 
* Curriculum administration tool
* 
* @package dokeos.admin.curriculum
* @author Roan Embrechts
============================================================================== 
*/
	
/*
============================================================================== 
		INIT SECTION
============================================================================== 
*/ 

// name of the language file which needs to be included 
// 'inc.php' is automatically appended to the file name 
$langFile = "admin"; 

// global settings initialisation 
// also provides access to main api (inc/lib/main_api.lib.php)
include("../inc/claro_init_global.inc.php"); 
api_protect_admin_script();

/*
-----------------------------------------------------------
	Constants
-----------------------------------------------------------
*/ 

define("VUB", "VUB");
define("CHECK_TITLES", "check_titles");
define("CHECK_TEACHER_RIGHTS","check_teacher_rights");

/*
-----------------------------------------------------------
	Included libraries
-----------------------------------------------------------
*/ 
require_once(api_get_library_path()."/course.lib.php");
require_once('../curriculum/curriculum_database.lib.php');
require_once('../curriculum/curriculum_logic.lib.php');

/*
-----------------------------------------------------------
	Header
-----------------------------------------------------------
*/

//extra entries in breadcrumb
$interbredcrump[]=array("url" => $rootAdminWeb,"name" => get_lang("AdministrationTools"));

$nameTools = "VUB cursustitels updaten"; // title of the page (should come from the language file) 

include(api_get_include_path()."/claro_init_header.inc.php");

	
/*
============================================================================== 
		DATABASE AND LOGIC FUNCTIONS
============================================================================== 
*/ 
	
/**
*/
function check_titles_to_update()
{
	global $PHP_SELF;
	
	$course_list = Database::get_course_list();
	
	$count = 0;
	foreach($course_list as $course)
	{
		//print_r($course);
		
		$tool_table = Database::get_course_tool_list_table($course["db_name"]);
		$visual_course_code = $course["visual_code"];
		$dokeos_course_code = $course["code"];
		
		//cut first three characters
		$vub_start = substr($visual_course_code, 0, 3);
		$vub_oocode = substr($visual_course_code, 3, strlen($visual_course_code));
		
		$dokeos_course_title =  $course["title"];
		
		//only work with VUB courses
		if ($vub_start == VUB)
		{
			$aiv_course_title = CurriculumDatabase::get_official_course_title($vub_oocode);
			$official_course_title = $aiv_course_title;
			if ($official_course_title == "") continue;
			
			if ($dokeos_course_title != $aiv_course_title)
			{
				$count++;
				$message .= $visual_course_code . " (system code $dokeos_course_code) <br/>";
				$message .= "Dokeos title: " . $dokeos_course_title . "<br/>";
				$message .= "AIV title: " . $aiv_course_title . "<br/>";
			
				//$message .= "<a href=" .  $PHP_SELF . "?update_one_title=true&dokeos_course_code=".$dokeos_course_code.">Update title</a><br/><br/>";
				$message .= "<em>Titel aangepast.</em>";
				
				update_one_title($dokeos_course_code);
			}
		}
	}
	
	echo "<p>Er zijn $count cursussen met gewijzigde titels.</p>";
	echo '<p>' . $message . '</p>';
}

function update_one_title($dokeos_course_code)
{
	$course_info = Database::get_course_info($dokeos_course_code);
	$visual_course_code = $course_info["visual_code"];
	$vub_start = substr($visual_course_code, 0, 3);
	$vub_oocode = substr($visual_course_code, 3, strlen($visual_course_code));
	
	$dokeos_course_title =  $course_info["title"];

	//only work with official courses, these start with "VUB"
	if ($vub_start == VUB)
	{
		$official_course_title = CurriculumDatabase::get_official_course_title($vub_oocode);
		
		if ($dokeos_course_title != $official_course_title)
		{
			$message .= "Updating course " . $visual_course_code . " <br/>";
			$message .= "from <i>" . $dokeos_course_title . "</i> ";
			$message .= "to <i>" . $official_course_title . "</i><br/>";
			
			if (isset($official_course_title) && $official_course_title != "")
			{
				$official_course_title = addslashes($official_course_title);
				Database::update_course_title($dokeos_course_code, $official_course_title);
			}
		}
	}

	echo '<p>' . $message . '</p>';
}

/*
============================================================================== 
		DISPLAY FUNCTIONS
============================================================================== 
*/ 

function display_main_options()
{
	echo "The current academic year is set to " . CurriculumLogic::get_current_academic_year() . ".<br/>";
	$message = "Deze pagina doet twee zaken: (a) vergelijkt de titels van offici&euml;le VUB cursussen in Dokeos met hun titels in de AIV databank,"
	. " en (b) kijkt na of de offici&euml;le titularissen wel cursusbeheerdersrechten hebben in hun cursussen.<br/>"
	. "<a href=\"$PHP_SELF?action=".CHECK_TITLES."\">Klik hier om te zoeken naar te updaten titels.</a><br/>"
	. "<a href=\"$PHP_SELF?action=".CHECK_TEACHER_RIGHTS."\">Klik hier om te zoeken naar te updaten titularissen.</a>"
	;
	echo "<p>" . $message . "</p>";
}
	
/*
============================================================================== 
		MAIN CODE
============================================================================== 
*/ 

$action = $_GET["action"];
$update_one_title = $_GET["update_one_title"];
$dokeos_course_code = $_GET["dokeos_course_code"];
$minimum = $_REQUEST["min"];
$maximum = $_REQUEST["max"];

api_display_tool_title($nameTools);

display_main_options();

if ( isset($update_one_title) && ($update_one_title) )
{
	update_one_title($dokeos_course_code);
	check_titles_to_update();
}

if ( $action == CHECK_TITLES )
{
	check_titles_to_update();
}
else if ( $action == CHECK_TEACHER_RIGHTS)
{
	CurriculumLogic::display_and_update_teacher_course_status_list();
}


/*
============================================================================== 
		FOOTER 
============================================================================== 
*/ 

include(api_get_include_path()."/claro_init_footer.inc.php");
?>



See more files for this project here

pointcarre

Pointcarre - a learning management system based on the Dokeos community releases. No fork, but containing locally developed extensions, features not (yet) in the standard release, integrated plugins...

Project homepage: http://sourceforge.net/projects/pointcarre
Programming language(s): PHP
License: other

  nightly_update/
    nightly_update.php
  class_add.php
  class_edit.php
  class_information.php
  class_list.php
  configure_homepage.php
  course_add.php
  course_category.php
  course_create_content.php
  course_edit.php
  course_information.php
  course_list.php
  course_virtual.php
  curriculum_complete_update.php
  exemple.csv
  exemple.xml
  index.php
  languages.php
  manage_course_tools.php
  manage_official_classes.php
  manage_official_communities.php
  manage_official_personnel.php
  manage_official_students.php
  manage_official_teachers.php
  manage_special_options.php
  official_update_titles_teachers.php
  settings.php
  statistics.php
  subscribe_class2course.php
  subscribe_user2class.php
  subscribe_user2course.php
  system_announcements.php
  user_add.php
  user_edit.php
  user_export.php
  user_import.php
  user_information.php
  user_list.php
  veco_manage_official_data.php