/** * Load the HTML templates for this page. * @return boolean */ protected function loadHTMLTemplates() { parent::loadHTMLTemplates(); $this->template->addHeaderLink('make_offer_position.js'); $this->template->addHeaderLink('tabStyles.css'); $hide_tab = $this->isConfirm() ? 'position_tab' : ''; if ($this->post_exists('position_option') && $this->post('position_option') == 'create') { $js = "window.addEvent('domready', function() { setupPositionNode( 'create_position', 'select_position', '{$hide_tab}' ); } );"; } else { $js = "window.addEvent('domready', function() { setupPositionNode( 'select_position', 'create_position', '{$hide_tab}' ); } );"; } $this->template->addHeaderLink('mootools-core.js'); $this->template->addHeaderText($js, "script", true); return true; }
protected function loadHTMLTemplates() { parent::loadHTMLTemplates(); /* need to set new_person_position and then person here to make sure defaults are OK. Otherwise need form_person_base.html and button_confirm.html to be different */ $this->template->setForm($this->new_person_position); $this->template->setForm($this->person); $forms = array('current_person_position' => $this->new_person_position, 'current_person_position' => $this->current_person_position, 'new_position' => $this->new_position, 'current_position' => $this->current_position, 'new_salary' => $this->new_salary, 'current_salary' => $this->current_salary); foreach ($forms as $class => $form) { if (!$form instanceof I2CE_Form) { I2CE::raiseMessage("{$class} isn't available"); continue; } foreach ($this->template->query("//*[@class='form:{$class}']") as $node) { $this->template->setForm($form, $node); } } foreach (array('id', 'parent') as $key) { if ($this->request_exists($key) && $this->request($key)) { $this->template->setDisplayData($key, $this->request($key)); } } }
/** * Load the HTML template files for editing and confirming the index information. */ protected function loadHTMLTemplates() { parent::loadHTMLTemplates(); if (!$this->isPost() || $this->creatingNewUser()) { $postfix = ''; $access = get_class(I2CE::getUserAccess()); if ($access && ($pos = strpos($access, 'I2CE_UserAccess_')) !== false) { $postfix = substr($access, 15); } $node = $this->template->loadFile("user_form{$postfix}.html", 'table'); if (!$node instanceof DOMNode) { return true; } if (!($usernodes = $this->template->getElementById('form', $node)) instanceof DOMNode) { return true; } if (!($trNode = $this->template->getElementById('user_fields')) instanceof DOMNode) { return true; } while ($usernodes->hasChildNodes()) { $trNode->appendChild($usernodes->firstChild); } $this->template->setAttribute('display_style', 'user_map', null, "//span[@name='user:role']", $node); } if ($this->creatingNewUser()) { $this->template->removeNodeById('existing_user'); $this->template->removeNodeById('list_fields'); } else { if ($this->getPrimary()->getField('username')->isValid() || $this->isPost()) { //a user name is set, $this->template->removeNodeById('create_user'); $this->template->removeNodeById('create_user_fields'); } } if ($this->isPost()) { if (!$this->request_exists('user_choice') || !$this->request('user_choice') == 'new') { $val = 'existing'; } else { $val = 'new'; } foreach ($this->template->query('//input[@name="user_choice" and @type="radio"]') as $n) { if ($n->getAttribute('value') != $val) { $this->template->removeNode($n); continue; } $n->removeAttribute('checked'); $n->setAttribute('type', 'hidden'); } } else { if ($this->getPrimary()->getField('username')->isValid()) { foreach ($this->template->query('//input[@name="user_choice" and @type="radio"]') as $n) { if ($n->getAttribute('value') != 'existing') { $this->template->removeNode($n); continue; } $n->removeAttribute('checked'); $n->setAttribute('type', 'hidden'); } } } return true; }