dmBridge PHP API
DMTextareaField.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 
00015 class DMTextareaField extends DMAbstractFormField implements DMFormField {
00016 
00018    private $rows;
00020    private $columns;
00021 
00022 
00027    public function getNumColumns() {
00028       return $this->columns;
00029    }
00030 
00035    public function setNumColumns($int) {
00036       $this->columns = (int) $int;
00037    }
00038 
00043    public function getNumRows() {
00044       return $this->rows;
00045    }
00046 
00051    public function setNumRows($int) {
00052       $this->rows = (int) $int;
00053    }
00054 
00059    public function getHTMLTag() {
00060       $dxml = new DMDOMDocument("1.0", "utf-8");
00061       $dxml->loadXML("<div/>");
00062 
00063       $class = "dmFormField";
00064       if (!$this->isValid() && $this->isUserData()) {
00065          $msg = $this->getValidationMessage();
00066          $dxml->documentElement->appendChild($dxml->createTextNode($msg));
00067          $class .= " dmInvalid";
00068       }
00069       $dxml->documentElement->setAttribute("class", $class);
00070 
00071       $ta = $dxml->createElement("textarea");
00072       $ta->setAttribute("name", $this->getHTMLName());
00073       $ta->setAttribute("rows", $this->getNumRows());
00074       $ta->setAttribute("cols", $this->getNumColumns());
00075       $ta->nodeValue = DMString::websafe($this->getValue());
00076       if (!$this->isEnabled()) {
00077          $ta->setAttribute("disabled", "disabled");
00078       }
00079       foreach ($this->getAttributes() as $k => $v) {
00080          $ta->setAttribute($k, $v);
00081       }
00082       $dxml->documentElement->appendChild($ta);
00083       return $dxml->saveHTML($dxml->documentElement);
00084    }
00085 
00086 }
00087 
 All Data Structures Functions Variables