1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65:
<?php
defined("ICMS_ROOT_PATH") or die("ImpressCMS root path not defined");
class icms_data_urllink_Object extends icms_ipf_Object {
public function __construct() {
$this->quickInitVar("urllinkid", XOBJ_DTYPE_INT, TRUE);
$this->quickInitVar("mid", XOBJ_DTYPE_INT, TRUE);
$this->quickInitVar("caption", XOBJ_DTYPE_TXTBOX, FALSE);
$this->quickInitVar("description", XOBJ_DTYPE_TXTBOX, FALSE);
$this->quickInitVar("url", XOBJ_DTYPE_TXTBOX, FALSE);
$this->quickInitVar("target", XOBJ_DTYPE_TXTBOX, TRUE);
$this->setControl("target", array("options" => array("_self" => _CO_ICMS_URLLINK_SELF,
"_blank" => _CO_ICMS_URLLINK_BLANK)));
}
public function getVar($key, $format = "e"){
if (substr($key, 0, 4) == "url_") {
return parent::getVar("url", $format);
} elseif (substr($key, 0, 4) == "mid_") {
return parent::getVar("mid", $format);
} elseif(substr($key, 0, 8) == "caption_") {
return parent::getVar("caption", $format);
} elseif(substr($key, 0, 5) == "desc_") {
return parent::getVar("description", $format);
} else {
return parent::getVar($key, $format);
}
}
public function render() {
$ret = "<a href='" . $this->getVar("url") . "' target='" . $this->getVar("target") . "' ";
$ret .= "title='" . $this->getVar("description") . "'>";
$ret .= $this->getVar("caption") . "</a>";
return $ret;
}
}