/**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @return DOMNode
  */
 public function getDisplayNode($node, $template)
 {
     $text_node = $template->createElement('span', array('class' => 'assoc_container'));
     $value = $this->getValue();
     foreach ($value as $k => $v) {
         list($form, $id) = array_pad(explode('|', $k, 2), 2, '');
         $pair_node = $template->createElement('span', array('class' => 'assoc_pair_container'));
         $text_node->appendChild($pair_node);
         $attrs = array('class' => 'assoc_pair_value');
         if ($this->has_auto_list && $form && $id) {
             $elem = 'a';
             $attrs['href'] = 'auto_list/view?form_name=' . $form . '&id=' . $id;
         } else {
             $elem = 'span';
         }
         $pair_node->appendChild($template->createElement($elem, $attrs, $this->getSingleDisplayValue($v)));
     }
     return $text_node;
 }
 /**
  * Creates a drop down list of options.
  * @param I2CE_Template $template
  * @param DOMNode $node -- the node we wish to add the drop down list under
  * @param boolean $show_hidden.  Show the hidden members of the list, defaults to false.
  * @returns mixed DOMNode or an array of DOMNodes to add.
  */
 protected function create_DOMEditable_list($node, $template, $form_node, $show_hidden = false)
 {
     $list = $this->getMapOptions('default', $show_hidden);
     $value = $this->getValue();
     $ele_name = $this->getHTMLName();
     $selectNode = $template->createElement('select', array('name' => $ele_name . '[currency]', 'class' => 'currency'));
     foreach ($list as $d) {
         $attrs = array('value' => $d['value']);
         if ($d['value'] == $value[0]) {
             $attrs['selected'] = 'selected';
         }
         $selectNode->appendChild($template->createElement('option', $attrs, $d['display']));
     }
     $node->appendChild($selectNode);
     if (!array_key_exists(1, $value)) {
         $value[1] = null;
     }
     $element = $template->createElement("input", array("name" => $ele_name . '[value]', "id" => $ele_name, "type" => "text", "value" => $value[1], "class" => "currency"));
     $this->setElement($element);
     $node->appendChild($element);
 }
示例#3
0
 /**
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @param DOMNode $form_node
  */
 public function processDOMNotEditable($node, $template, $form_node)
 {
     $ele_name = $this->getHTMLName();
     $node->appendChild($template->createElement("input", array("name" => $ele_name, "type" => "hidden", "value" => $this->getDBValue())));
     $node->appendChild($this->getDisplayNode($node, $template));
 }
 /**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @return DOMNode
  */
 public function getDisplayNode($node, $template)
 {
     $text_node = $template->createElement('span', array('class' => 'assoc_container'));
     $value = $this->getValue();
     foreach ($value as $k => $v) {
         $pair_node = $template->createElement('span', array('class' => 'assoc_pair_container'));
         $text_node->appendChild($pair_node);
         $pair_node->appendChild($template->createElement('span', array('class' => 'assoc_pair_key'), $k));
         $pair_node->appendChild($template->createElement('span', array('class' => 'assoc_pair_value'), $this->getSingleDisplayValue($v)));
     }
     if ($href = $this->getHref()) {
         $link_node = $template->createElement("a", array("href" => $href));
         $link_node->appendChild($text_node);
         return $link_node;
     } else {
         return $text_node;
     }
 }
 /**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @return DOMNode
  */
 public function getDisplayNode($node, $template)
 {
     $add_node = $template->createElement('span', array('class' => 'mult'));
     if ($href = $this->getHref()) {
         $link_node = $template->createElement("a", array("href" => $href));
         $add_node->append_child($link_node);
     } else {
         $link_node = $add_node;
     }
     $value = $this->getValue();
     $map_text = array();
     foreach ($value as $i => $map_value) {
         $map_text[$i] = I2CE_List::lookup($map_value[1], $map_value[0]);
     }
     $first = true;
     foreach ($map_text as $i => $text) {
         if ($first) {
             $first = false;
         } else {
             $link_node->appendChild($template->createElement("span", array('class' => 'mult_sep'), ','));
         }
         if ($node->hasAttribute('auto_link') && $node->getAttribute('auto_link')) {
             $attrs = array('class' => 'mult_val', 'href' => 'auto_list/view?form_name=' . $value[$i][0] . '&id=' . $value[$i][0] . '|' . $value[$i][1]);
             $link_node->appendChild($template->createElement("a", $attrs, $text));
         } else {
             $link_node->appendChild($template->createElement("span", array('class' => 'mult_val'), $text));
         }
     }
     return $add_node;
 }
 /**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @return DOMNode
  */
 public function getDisplayNode($node, $template)
 {
     $add_node = $template->createElement('span', array('class' => 'mult'));
     if ($href = $this->getHref()) {
         $link_node = $template->createElement("a", array("href" => $href));
         $add_node->append_child($link_node);
     } else {
         $link_node = $add_node;
     }
     $value = $this->getValue();
     $map_list = array();
     foreach ($value as $map_value) {
         $map_list[] = I2CE_List::lookup($map_value[1], $map_value[0]);
     }
     $first = true;
     foreach ($map_list as $text) {
         if ($first) {
             $first = false;
         } else {
             $link_node->appendChild($template->createElement("span", array('class' => 'mult_sep'), ','));
         }
         $link_node->appendChild($template->createElement("span", array('class' => 'mult_val'), $text));
     }
     return $add_node;
 }
 /**
  * Template function to link to the provider associated with this person.
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @param string $link
  */
 public function linkToProvider($node, $template, $link)
 {
     if (!$node instanceof DOMNOde || !$template instanceof I2CE_Template || !$node->parentNode instanceof DOMNode || $template->getUser()->getRole() != "training_provider") {
         $template->removeNode($node);
         return;
     }
     $access = self::getAccessProvider($template->getUser());
     if (count($access) > 0) {
         $a = $template->createElement('a', array('href' => $link . $access[0]));
         $node->parentNode->replaceChild($a, $node);
         while ($node->firstChild instanceof DOMNode) {
             $a->appendChild($node->firstChild);
         }
         return;
     }
     $template->removeNode($node);
 }
 /**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @return DOMNode
  */
 public function getDisplayNode($node, $template)
 {
     $text = $this->getDisplayValue();
     $link = $this->getLink();
     if (!$link || strlen($this->value) == 0) {
         //there is no linked URL to this field so we just display the text
         return $template->createTextNode($text);
     }
     $link_node = $template->createElement('a', array('href' => $link));
     while ($node->hasChildNodes()) {
         $link_node->appendChild($node->firstChild);
     }
     if ($node->hasAttribute('show_text') && (strtolower($node->getAttribute('show_text')) == 'true' || strtolower($node->getAttribute('show_text')) == '!false')) {
         $link_node->appendChild($template->createTextNode($text));
     }
     if (!$node->hasAttribute('show_image') || strtolower($node->getAttribute('show_image')) == 'true' || strtolower($node->getAttribute('show_image')) == '!false') {
         $width = null;
         $height = null;
         if ($node->hasAttribute('height')) {
             $height = $node->getAttribute('height');
             $node->removeAttribute('height');
         }
         if ($node->hasAttribute('width')) {
             $width = $node->getAttribute('width');
             $node->removeAttribute('width');
         }
         $attrs = array("src" => $link, 'alt' => $text, 'class' => 'field_image');
         if (!empty($width)) {
             $attrs['width'] = $width;
         }
         if (!empty($height)) {
             $attrs['height'] = $height;
         }
         $link_node->appendChild($template->createElement('img', $attrs));
     }
     return $link_node;
 }
 /**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node  
  * @param I2CE_Template $template
  * @return DOMNode
  */
 public function getDisplayNode($node, $template)
 {
     if ($this->container instanceof I2CE_Form) {
         $link_node = $template->createElement('a', array("href" => $this->getLink()), $this->getDisplayValue());
         return $link_node;
     } else {
         return $template->createTextNode($this->getDisplayValue());
     }
 }
 /**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @param string $style.  Defaults to 'default'
  * @return DOMNode
  */
 public function _getDisplayNode($node, $template, $style = 'default')
 {
     $text_node = $template->createTextNode($this->_getDisplayValue($style));
     if ($href = $this->getHref()) {
         $link_node = $template->createElement("a", array("href" => $href));
         $link_node->appendChild($text_node);
         return $link_node;
     } else {
         return $text_node;
     }
 }
 /**
  * Template function to see if the user is mapped to a personnel record and if so replace the node with the given link
  *  @param DOMNode $node
  * @param I2CE_Template $template
  * @param string $link
  */
 public function linkToPersonRecord($node, $template, $link)
 {
     if (!$node instanceof DOMNode || !$template instanceof I2CE_Template || !$node->parentNode instanceof DOMNode || ($id = iHRIS_UserMap::getPersonId()) == '|') {
         $template->removeNode($node);
         return;
     }
     $a = $template->createElement('a', array('href' => $link . $id));
     $node->parentNode->replaceChild($a, $node);
     while ($node->firstChild instanceof DOMNode) {
         $a->appendChild($node->firstChild);
     }
 }