dmBridge PHP API
DMPasswordField.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 DMPasswordField extends DMAbstractFormField implements DMFormField {
00016 
00021    public function getHTMLTag() {
00022       $dxml = new DMDOMDocument("1.0", "utf-8");
00023       $dxml->loadXML("<div/>");
00024 
00025       $class = "dmFormField";
00026       if (!$this->isValid() && $this->isUserData()) {
00027          $msg = $this->getValidationMessage();
00028          $dxml->documentElement->appendChild($dxml->createTextNode($msg));
00029          $class .= " dmInvalid";
00030       }
00031       $dxml->documentElement->setAttribute("class", $class);
00032 
00033       $input = $dxml->createElement("input");
00034       $input->setAttribute("type", "password");
00035       $input->setAttribute("name", $this->getHTMLName());
00036       if ($this->getMaxLength()) {
00037          $input->setAttribute("maxlength", $this->getMaxLength());
00038       }
00039       if (!$this->isEnabled()) {
00040          $input->setAttribute("disabled", "disabled");
00041       }
00042       foreach ($this->getAttributes() as $k => $v) {
00043          $input->setAttribute($k, $v);
00044       }
00045       $dxml->documentElement->appendChild($input);
00046       return $dxml->saveHTML($dxml->documentElement);
00047    }
00048 
00049 }
00050 
 All Data Structures Functions Variables