dmBridge PHP API
DMLanguage.php
00001 <?php
00002 #
00003 # dmBridge: a data access framework for CONTENTdm(R)
00004 #
00005 # Copyright © 2009, 2010, 2011 Board of Regents of the Nevada System of Higher
00006 # Education, on behalf of the University of Nevada, Las Vegas
00007 #
00008 
00013 class DMLanguage {
00014 
00016    private static $languages = array();
00017 
00019    private $iso6391code;
00021    private $iso6392code;
00023    private $iso6393code;
00025    private $native_name;
00026 
00030    public static function getAll() {
00031       if (!count(self::$languages)) {
00032          $pathname = dirname(__FILE__) . "/../../includes/languages.xml";
00033          $langs_xml = new DOMDocument("1.0", "utf-8");
00034          $langs_xml->load($pathname);
00035 
00036          foreach ($langs_xml->getElementsByTagName("language") as $langNode) {
00037             $lang = new DMLanguage();
00038             $lang->setNativeName(
00039                $langNode->getElementsByTagName("nativeName")->item(0)->nodeValue);
00040             $lang->setISO6391Code(
00041                   $langNode->getElementsByTagName("ISO639-1")->item(0)->nodeValue);
00042             $lang->setISO6392Code(
00043                   $langNode->getElementsByTagName("ISO639-2")->item(0)->nodeValue);
00044             $lang->setISO6393Code(
00045                   $langNode->getElementsByTagName("ISO639-3")->item(0)->nodeValue);
00046             self::$languages[] = $lang;
00047          }
00048       }
00049       return self::$languages;
00050    }
00051 
00055    public function __toString() {
00056       return $this->getNativeName();
00057    }
00058 
00062    public function getISO6391Code() {
00063       return $this->iso6391code;
00064    }
00065 
00069    public function setISO6391Code($code) {
00070       $this->iso6391code = $code;
00071    }
00072 
00076    public function getISO6392Code() {
00077       return $this->iso6392code;
00078    }
00079 
00083    public function setISO6392Code($code) {
00084       $this->iso6392code = $code;
00085    }
00086 
00090    public function getISO6393Code() {
00091       return $this->iso6393code;
00092    }
00093 
00097    public function setISO6393Code($code) {
00098       $this->iso6393code = $code;
00099    }
00100 
00104    public function getNativeName() {
00105       return $this->native_name;
00106    }
00107 
00111    public function setNativeName($name) {
00112       $this->native_name = $name;
00113    }
00114 
00115 }
 All Data Structures Functions Variables