Source of file CIOnlineResource.php
Size: 3,109 Bytes - Last Modified: 2021-12-23T10:31:40+00:00
/var/www/docs.ssmods.com/process/src/code/model/CIOnlineResource.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 | <?php /** * * @author Rainer Spittel (rainer at silverstripe dot com) * @package geocatalog * @subpackage model */ class CIOnlineResource extends MDDataObject { /** * Data Structure for ISO19139 MDDistributionInfo * @var array */ public static $db = array( "CIOnlineLinkage" => "Varchar", "CIOnlineProtocol" => "Varchar", "CIOnlineName" => "Varchar", "CIOnlineDescription" => "Varchar", "CIOnlineFunction" => "Varchar" ); /** * Data relationships for MDContact */ public static $has_one = array( "MDMetadata" => "MDMetadata", ); public static $public_protocols = array( 'WWW:LINK-1.0-http--downloaddata', 'WWW:LINK-1.0-http--link' ); /** * Sets the whiltelist array for support protocols. This array will be used * to remove online-resources from the metadata-detail page. * * @param $value Array of protocol values, such as array('WWW:LINK-1.0-http--downloaddata', 'WWW:LINK-1.0-http--link') */ public static function set_public_protocols($value) { self::$public_protocols = $value; } public static function get_public_protocols() { return self::$public_protocols; } /** * Returns the nice, human readable string for the codetype (defined by * the OGC ISO standard). * * @return string */ public function getCIOnlineProtocolNice() { $index = $this->CIOnlineProtocol; $codeTypes = MDCodeTypes::get_online_resource_protocol(); return isset($codeTypes[$index]) ? $codeTypes[$index] : MDCodeTypes::$default_for_null_value; } /** * Returns the nice, human readable string for the online name, truncates * after 70 characters. * * @return string */ public function getCIOnlineNameNice() { $value = $this->CIOnlineName; $varchar = new Varchar(1024); $varchar->setValue($value); return htmlentities($varchar->LimitCharacters(70)); } /** * Returns the nice, human readable string for the codetype (defined by * the OGC ISO standard). * * @return string */ public function getCIOnlineFunctionNice() { $index = $this->CIOnlineFunction; $codeTypes = MDCodeTypes::get_online_resource_function(); return isset($codeTypes[$index]) ? $codeTypes[$index] : MDCodeTypes::$default_for_null_value; } /** * Returns the nice, human readable string for CIOnlineLinkage. * * @return string */ public function getCIOnlineLinkageNice() { $value = $this->CIOnlineLinkage; if (isset($value) && $value != '') { if (strpos($value, "://") === false) { $value = "http://".$value; } } else { $value = MDCodeTypes::$default_for_null_value; } $varchar = new Varchar(1024); $varchar->setValue($value); return htmlentities($varchar->LimitCharacters(70)); } } |