[svn r21995] minor-logic changes-add documentation

skala
Isaac Flores 16 years ago
parent a6f4dea005
commit 60695a62b7
  1. 48
      main/admin/admin.class.php
  2. 23
      main/admin/languages.php

@ -117,11 +117,11 @@ class AdminManager {
return false;
}
}
/**
* Delete sub-language
* @param Integer The parent id
* @return void()
*/
/**
* Delete sub-language
* @param Integer The parent id
* @return void()
*/
public static function removed_sub_language ($parent_id) {
$tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$sql='DELETE FROM '.$tbl_admin_languages.' WHERE parent_id="'.Database::escape_string($parent_id).'"';
@ -129,6 +129,8 @@ class AdminManager {
}
/**
* check if language exist by id
* @param Integer The language id
* @return Boolean
*/
public static function check_if_exist_language_by_id ($language_id) {
$tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
@ -147,8 +149,10 @@ class AdminManager {
/**
* Get name of language by id
* @param Integer The language id
* @return String The original name of language
*/
function get_name_of_language_by_id ($language_id) {
public static function get_name_of_language_by_id ($language_id) {
$tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$sql='SELECT original_name FROM '.$tbl_admin_languages.' WHERE id="'.Database::escape_string($language_id).'"';
$rs=Database::query($sql,__FILE__,__LINE__);
@ -159,5 +163,37 @@ class AdminManager {
}
}
/**
* Verified if language is sub-language
* @param Integer The language id
* @return Boolean
*/
public static function check_if_language_is_sub_language ($language_id) {
$tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$sql='SELECT count(*) AS count FROM '.$tbl_admin_languages.' WHERE id="'.$language_id.'" AND NOT ISNULL(parent_id)';
$rs=Database::query($sql,__FILE__,__LINE__);
if (Database::num_rows($rs)>0 && Database::result($rs,'0','count')==1) {
return true;
} else {
return false;
}
}
/**
* Verified if language is father of an sub-language
* @param Integer The language id
* @return Boolean
*/
public static function check_if_language_is_father ($language_id) {
$tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$sql='SELECT count(*) AS count FROM '.$tbl_admin_languages.' WHERE parent_id="'.$language_id.'" AND NOT ISNULL(parent_id);';
$rs=Database::query($sql,__FILE__,__LINE__);
if (Database::num_rows($rs)>0 && Database::result($rs,'0','count')==1) {
return true;
} else {
return false;
}
}
}
?>

@ -1,4 +1,4 @@
<?php // $Id: languages.php 21974 2009-07-10 16:01:42Z iflorespaz $
<?php // $Id: languages.php 21995 2009-07-12 04:44:15Z iflorespaz $
/* For licensing terms, see /dokeos_license.txt */
/**
==============================================================================
@ -27,6 +27,7 @@ $cidReset = true;
// include global script
require_once '../inc/global.inc.php';
require_once 'admin.class.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
@ -41,26 +42,10 @@ $tbl_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT)
*/
//Add function
function check_if_language_is_sub_language ($language_id) {
$tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$sql='SELECT count(*) AS count FROM '.$tbl_admin_languages.' WHERE id="'.$language_id.'" AND NOT ISNULL(parent_id)';
$rs=Database::query($sql,__FILE__,__LINE__);
if (Database::num_rows($rs)>0 && Database::result($rs,'0','count')==1) {
return true;
} else {
return false;
}
return AdminManager::check_if_language_is_sub_language($language_id);
}
function check_if_language_is_father ($language_id) {
$tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$sql='SELECT count(*) AS count FROM '.$tbl_admin_languages.' WHERE parent_id="'.$language_id.'" AND NOT ISNULL(parent_id);';
$rs=Database::query($sql,__FILE__,__LINE__);
if (Database::num_rows($rs)>0 && Database::result($rs,'0','count')==1) {
return true;
} else {
return false;
}
return AdminManager::check_if_language_is_father($language_id);
}
// we change the availability
if ($_GET['action'] == 'makeunavailable')

Loading…
Cancel
Save