/** * Perform the main actions of the page. */ protected function action() { $factory = I2CE_FormFactory::instance(); $this->template->setAttribute("class", "active", "menuManage", "a[@href='manage']"); $this->template->appendFileById("menu_manage.html", "ul", "menuManage"); switch ($this->get('action')) { case "review": if (I2CE_ModuleFactory::instance()->isEnabled("ihris-manage-Application")) { $this->template->setAttribute("class", "active", "menuManage", "//li/a[@href='manage?action=review']"); $this->template->addFile("applicant_review.html"); if ($this->get_exists('position')) { $position_data = explode('|', $this->get('position'), 2); $position_id = $position_data[1]; $this->template->setDisplayData("return_link", array("action" => "review")); $this->template->addFile("applicant_review_results.html"); $this->template->setDisplayData("position_name", I2CE_List::lookup($position_id, "position")); $results = iHRIS_Applicant::findApplicants($position_id); if (count($results) > 0) { foreach ($results as $app_id => $app_data) { $this->template->appendFileById("applicant_review_row.html", "li", "app_list"); $this->template->setDisplayData("app_id", array("id" => "person|" . $app_id)); $this->template->setDisplayData("app_name", $app_data['surname'] . ', ' . $app_data['firstname']); //$last_mod = I2CE_Date::fromDB( $app_data['last_modified'] ); //$this->template->setDisplayData( "app_modified", $last_mod->displayDate() ); $this->template->setDisplayData("make_offer", array("parent" => "person|" . $app_id, "position" => $this->get('position'))); } } else { $this->template->appendFileById("applicant_review_no_results.html", "li", "app_list"); } } else { $this->template->addFile("applicant_review_list.html"); $positions = I2CE_Form::listFields("position", array("code", "title"), array('operator' => 'FIELD_LIMIT', 'field' => 'status', 'style' => 'equals', 'data' => array('value' => 'position_status|open'))); $count = 0; foreach ($positions as $id => $data) { $node = $this->template->appendFileById("applicant_review_list_entry.html", "tr", "open_position_list"); if (++$count % 2 == 0) { $node->setAttribute("class", "even"); } $this->template->setDisplayDataImmediate("view_applicant", array("action" => "review", "position" => "position|" . $id), $node); $this->template->setDisplayDataImmediate("position_name", $data['code'] . " - " . $data['title'], $node); } } } else { parent::action(); } break; default: parent::action(); break; } }
/** * Sends any triggers when participants are uploaded * @param I2CE_PageFormCSV $page */ public function trigger_upload_save($page) { if (!$page instanceof I2CE_PageFormCSV) { return; } $module_factory = I2CE_ModuleFactory::instance(); if ($module_factory->isEnabled("UserTriggers")) { $triggers = $module_factory->getClass("UserTriggers"); $instance = $page->getProviderInstance(); $details = I2CE_List::lookup($instance->getId(), $instance->getName()); $triggers->trigger('participant_upload_save', null, 'Participants were uploaded for ' . $details, true, $instance->getNameId()); } else { I2CE::raiseError("Unable to call trigger because UserTriggers isn't enabled!"); } }
/** * Perform the main actions of the page. */ protected function action() { parent::action(); $this->template->addHeaderLink("view.js"); $this->template->appendFileById("menu_view.html", "li", "navBarUL", true); $this->template->setAttribute("class", "active", "menuConfigure", "a[@href='configure']"); $this->template->appendFileById("menu_configure.html", "ul", "menuConfigure"); $this->template->setAttribute("class", "active", "menuLists", "a[@href='lists']"); $factory = I2CE_FormFactory::instance(); $job = $factory->createContainer($this->get('id')); $job->populate(); $this->template->setForm($job); $positions = $job->getPositions(); //print_r( $supervised ); if (count($positions) > 0) { $this->template->appendFileById("view_job_positions.html", "div", "job"); foreach ($positions as $record) { $this->template->appendFileById("view_position_row.html", "tr", "positions"); $this->template->setDisplayData("position", I2CE_List::lookup($record, "position")); $this->template->setDisplayData("add_pos_id", array("id" => "position|" . $record)); } $this->template->setAttribute("class", "even", "positions", "tr[position() mod 2 = 0]"); } }
/** * Returns the value of this field as a human readable format. * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an * entry for this field. * @param boolean $number_format If true, call number_format on the returned value. * @return mixed */ public function getDisplayValue($entry = false, $number_format = false) { if ($entry instanceof I2CE_Entry) { $value = $entry->getValue(); } else { $value = $this->getValue(); } $curr_value = parent::getFromDB($value[0]); $curr_string = I2CE_List::lookup($curr_value[1], $curr_value[0]); $number_value = $value[1]; if ($number_format) { $number_value = number_format($number_value); } return $curr_string . $number_value; }
public function studentModules($node, $template) { //this really should be a fuzzy method in the training exam module if (!($tcField = $this->getField('training_course')) instanceof I2CE_FormField_MAP || !($tcObj = $tcField->getMappedFormObject()) instanceof iHRIS_Training_Course || !($modField = $tcObj->getField('training_course_mod')) instanceof I2CE_FormField_MAP_MULT) { I2CE::raiseError("Could not get training course modules"); return false; } $allowed_ids = $modField->getValue(); $allowed = array(); foreach ($allowed_ids as $allowed_id) { list($form, $id) = $allowed_id; if ($form != 'training_course_mod') { continue; } $dv = I2CE_List::lookup($id, $form); if (!$dv) { contine; } $allowed[$form . '|' . $id] = $dv; } if (!is_array($allowed) || count($allowed) == 0) { if (!($main_node = $template->appendFileByNode('training_course_nomods.html', 'div', $node)) instanceof DOMNode) { return false; } return true; } if (!($main_node = $template->appendFileByNode('training_course_mod_base.html', 'div', $node)) instanceof DOMNode) { return false; } if (!($list_node = $template->getElementById('student_mods', $main_node)) instanceof DOMNode) { return false; } $template->addHeaderLink("editstudent.js"); $width = (int) floor(100 / (count($allowed) + 1)); $rowAttrs = array('style' => 'display:table-row;'); $colAttrs = array('style' => 'display:table-cell;width:' . $width . '%'); $chkAttrs = $colAttrs; $chkAttrs['type'] = 'checkbox'; $list_node->appendChild($headNode = $template->createElement('div', $rowAttrs)); $headNode->appendChild($template->createElement('div', $colAttrs, 'Student')); foreach ($allowed as $all_id => $all_val) { $headNode->appendChild($template->createElement('div', $colAttrs, $all_val)); } $list = $this->getEnrolledStudents(); $ff = I2CE_FormFactory::instance(); foreach ($list as $id => $data) { if (!($pstcObj = $ff->createContainer($data['person_scheduled_training_course'])) instanceof iHRIS_Person_Scheduled_Training_Course || !($modField = $pstcObj->getField('training_course_mod')) instanceof I2CE_FormField_MAP_MULT) { I2CE::raiseError("No training course module"); continue; } $pstcObj->populate(); $list_node->appendChild($rowNode = $template->createElement('div', $rowAttrs)); $sAttrs = $colAttrs; $sAttrs['href'] = 'view?id=' . $id; $colNode = $template->createElement('div', $colAttrs); $colNode->appendChild($template->createElement('a', $sAttrs, $data['firstname'] . ' ' . $data['surname'])); $rowNode->appendChild($colNode); $selected = $modField->getValue(); foreach ($selected as &$sel) { $sel = implode("|", $sel); } unset($set); foreach ($allowed as $all_id => $all_val) { $t_chkAttrs = $chkAttrs; if (in_array($all_id, $selected)) { $t_chkAttrs['checked'] = 'checked'; } $t_chkAttrs['onchange'] = 'toggleStudentModule(this,"' . addslashes($id) . '","' . addslashes($pstcObj->getNameID()) . '","' . addslashes($all_id) . '")'; $colNode = $template->createElement('div', $colAttrs); $colNode->appendChild($template->createElement('input', $t_chkAttrs)); $rowNode->appendChild($colNode); } } return true; }
/** * Generic (internal fuzzy method for) display menu for a limit style * Generic (internal fuzzy method for) processing menu for a particular limit style * @param string $style The style * @param I2CE_FormField $fieldObj the object the fuzzy method was called on * @param I2CE_Template $template. * @param string $prefix * @$vals the values we are processing. * @param string $limit_default limiting information for choosing options. Defaults to 'default' * @returns DOMNode containing the menu for this limit style */ protected function DISPLAY_generic($style, $fieldObj, $template, $prefix = '', $vals = array(), $limit_default = 'default') { if (!$fieldObj instanceof I2CE_FormField || !$template instanceof I2CE_Template) { return; } if (!array_key_exists($style, self::$menudata)) { I2CE::raiseError("Badness on for " . get_class($fieldObj) . " {$style}"); return array(); } if (!is_string($prefix) || strlen($prefix) == 0) { $prefix = ''; } if (strlen($prefix) > 1) { if (!$prefix[strlen($prefix) - 1] != ':') { $prefix .= ':'; } } $find_limit = false; if ($fieldObj instanceof I2CE_FormField_MAPPED) { $limit_template = "limit_mapped_choice_" . $style . ".html"; $find_limit = $template->findTemplate($limit_template, false); $mapped = true; } if (!$find_limit || $find_limit == "") { $mapped = false; $limit_template = "limit_choice_" . $style . ".html"; } $menuNode = $template->loadFile($limit_template); //$template->setDisplayDataImmediate('limit_desc',self::$menudata[$style]['desc'], $menuNode); foreach (self::$menudata[$style]['fields'] as $field) { $node = $template->getElementByName($field, 0, $menuNode); if (!$node instanceof DOMElement) { continue; } if ('select' == $node->tagName) { $name = $node->getAttribute('name'); if ($node->hasAttribute('multiple') && substr($name, -2) != '[]') { $name .= '[]'; } $node->setAttribute('name', $prefix . $name); $selected = array(); if (is_array($vals) && array_key_exists($field, $vals)) { if ($node->hasAttribute('multiple')) { if (is_array($vals[$field])) { $selected = $vals[$field]; } else { $selected = explode(',', $vals[$field]); //hope that the values have no commas in them! } } else { $selected = array($vals[$field]); } } if (!is_array($selected)) { $selected = array(); } if ($field == 'linked_field') { $formObj = $fieldObj->getContainer(); if ($formObj instanceof I2CE_Form) { $fieldNames = $formObj->getFieldNames(); } else { $fieldNames = array(); } $fieldNames[] = 'parent'; foreach ($fieldNames as $fieldName) { if ($fieldName == $field) { continue; } $opt = $template->createElement("option", array("value" => $fieldName), $fieldName); if (in_array($fieldName, $selected)) { $opt->setAttribute("selected", "selected"); } $node->appendChild($opt); } } else { if ($fieldObj instanceof I2CE_FormField_MAPPED && $mapped) { if (!$node->hasAttribute('multiple') && $style == "equals" && $fieldObj->getDisplayedStyle($limit_default) == "tree") { $main = $template->createElement("span"); $name = $node->getAttribute("name"); $node->parentNode->replaceChild($main, $node); $data = $fieldObj->getMapOptions($limit_default, false, false); $tree_selected = null; if (count($selected) == 1 && strpos($selected[0], '|') !== false) { list($select_form, $select_id) = explode('|', $selected[0], 2); $tree_selected = array('value' => $selected[0], 'display' => I2CE_List::lookup($select_id, $select_form)); } $template->addAutoCompleteInputTree($main, $name, "tree:" . $name, $tree_selected, $data, array(), array()); } else { $optionList = $fieldObj->getMapOptions($limit_default); if (!$node->hasAttribute('multiple')) { $select_value = "Select Value"; I2CE::getConfig()->setIfIsSet($select_value, "/modules/field-limits/text/select_value"); $opt = $template->createElement("option", array("value" => ''), $select_value); $node->appendChild($opt); } foreach ($optionList as $data) { $opt = $template->createElement("option", array("value" => $data['value']), $data['display']); if (in_array($data['value'], $selected)) { $opt->setAttribute("selected", "selected"); } $node->appendChild($opt); } } } else { foreach ($selected as $val) { $opt = $template->query("./option[@value='{$val}']", $node); for ($i = 0; $i < $opt->length; $i++) { if ($opt->item($i) instanceof DOMElement) { $opt->item($i)->setAttribute('selected', 'selected'); } } } } } } else { if (is_array($vals)) { $name = $node->getAttribute('name'); $node->setAttribute('name', $prefix . $name); if (!array_key_exists($field, $vals)) { continue; } switch ($node->tagName) { case 'input': $node->setAttribute('value', $vals[$field]); break; case 'textarea': $node->appendChild($template->createTextNode($vals[$field])); break; default: I2CE::raiseError("Do not know how to display {$field}"); return false; } } } } if (count(self::$menudata[$style]['fields']) == 0) { //if there are no values to set, remove the Limit button $node = $template->getElementById('limit_type_menu_button_container', $menuNode); if ($node instanceof DOMNode) { $this->template->removeNode($node); } } return $menuNode; }
/** * */ public function addAllowedConfirmations($node, $template, $person) { if (!$node instanceof DOMElement || !($parent = $node->parentNode) instanceof DOMElement || !$template instanceof I2CE_Template) { return; } $allowedConfirmations = $this->getAllowedConfirmations($person, true); //get the new confirmations if (count($allowedConfirmations) == 0) { return; } $imported = $template->loadFile("add_confirmation.html", "span"); if (!$imported instanceof DOMNode) { I2CE::raiseError("Could not find add_conirmation.html"); return; } if (!($conf = I2CE_FormFactory::instance()->createForm('confirmation')) instanceof iHRIS_Confirmation) { return; } if (!($type = $conf->getField('confirmation_type')) instanceof I2CE_FormField) { continue; } $typeName = $type->getHTMLName(); foreach ($allowedConfirmations as $id => $vals) { if (!($disp = I2CE_List::lookup($id, 'confirmation_type'))) { continue; } $imported_node = $imported->cloneNode(true); if (!($linkNode = $template->getElementById('confirmation_link', $imported_node)) instanceof DOMElement) { continue; } $parent->insertBefore($imported_node, $node); $linkNode->setAttribute('href', "confirmation?" . $typeName . "=" . urlencode("confirmation_type|" . $id) . '&parent='); $template->setDisplayDataImmediate('confirmation_name', $disp, $imported_node); } $parent->removeChild($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; }
/** * Creates a selectable auto-suggest tree view of the options * @param I2CE_Template $template * @param DOMNode $node -- the node that requested this drop down * @param int $show_hidden 0=non-hidden, 1=All, 2=hidden only. Defaults to 0 * @returns mixed DOMNode or an array of DOMNodes to add. */ protected function create_DOMEditable_tree($node, $template, $form_node, $show_hidden = 0) { $ele_name = $this->getHTMLName(); $ele_id = 'tree:' . $ele_name; $tree_options = array(); if ($form_node->hasAttribute('treeOptions')) { $tree_options = $form_node->getAttribute('treeOptions'); $form_node->removeAttribute('treeOptions'); } $delayed = true; //default behavior is delayed load if ($form_node->hasAttribute('delayed')) { $delayed = $form_node->getAttribute('delayed'); $form_node->removeAttribute('delayed'); } $auto_complete_options = array(); if ($form_node->hasAttribute('autoCompleteOptions')) { $auto_complete_options = $form_node->getAttribute('autoCompleteOptions'); $form_node->removeAttribute('autoCompleteOptions'); } $add_limits = $this->getAdditionalLimits($template, $node, $form_node->getAttribute('limit')); $display_style = 'default'; if ($form_node->hasAttribute('display_style')) { $display_style = $form_node->getAttribute('display_style'); } $data = $this->getMapOptions($display_style, $show_hidden, false, $add_limits); $main = $template->createElement('span'); $node->appendChild($main); if ($this->isSetValue()) { $selected = array('value' => $this->getDBValue(), 'display' => I2CE_List::lookup($this->getMappedID(), $this->getMappedForm())); } else { $selected = array(); } $template->addAutoCompleteInputTree($main, $ele_name, $ele_id, $selected, $data, $tree_options, $auto_complete_options, $delayed); $nodes = $template->query('./input[@id="' . $ele_id . '_inputtree_display"]', $main); if ($nodes->length > 0) { $this->setElement($nodes->item(0)); } }
/** * 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; }
/** * The business method if this page is called from the commmand line * @param array $request_remainder the remainder of the request after the page specfication. * @param array $args the array of unix style command line arguments * Arguements are link that in: http://us3.php.net/manual/en/features.commandline.php#78651 * */ protected function actionCommandLine($args, $request_remainder) { if ($this->cli->hasValue('delete')) { $formid = $this->cli->getValue('delete'); } else { $formid = trim($this->cli->ask("Please enter the form and ID of the record you wish to delete. For example person|1000.")); } if (!$formid) { usage("Invalid ID ({$formid})"); } $ff = I2CE_FormFactory::instance(); $linked = array($formid); $first = true; $skips = array(); print_r($linked); while (count($linked) > 0) { reset($linked); $formid = current($linked); array_shift($linked); if (in_array($formid, $skips)) { continue; } $skips[] = $formid; list($form, $id) = explode("|", $formid); $name = ''; $formObj = $ff->createForm($formid); if (!$formObj instanceof I2CE_Form) { continue; } $formObj->populate(); if ($formObj instanceof I2CE_List) { $name = ': ' . I2CE_List::lookup($id, $form); } $main_rec = ''; foreach ($formObj->getFieldNames() as $field) { if (!($fieldObj = $formObj->getField($field)) instanceof I2CE_FormField) { continue; } $main_rec .= "\t{$field} => " . $fieldObj->getDBValue() . "\n"; } if (!$this->cli->simple_prompt("Would you like to delete records related to {$formid}{$name}?", $main_rec)) { continue; } $first = false; $child_forms = array($formid => array()); $formObj = $ff->createForm($formid); if (!$formObj instanceof I2CE_Form) { I2CE::raiseError("Invalid form id {$formid}"); continue; } $this->getLinkedFormIds($formObj, $child_forms[$formid]); $menu = array(); $this->makeMenu($child_forms, $menu); $selected = $this->cli->chooseDependentTreeMenuIndices("Please select child forms related to {$formid} to delete", $menu, array_keys($menu)); $which = array(); foreach ($selected as $sel) { $item = explode("\n", ltrim($menu[$sel], "\t")); if (count($item) < 1) { continue; } $which[] = trim($item[0]); } if (count($which) == 0) { I2CE::raiseError("Nothing selected to delete related to {$formid}"); continue; } if (!$this->cli->simple_prompt("Would you like to delete all the selected forms linked {$formid} as children/grand-children?")) { continue; } $linked = array_unique(array_merge($linked, $this->deleteForms($child_forms, $which))); } }
protected function actionDisplayList_row($list, $listConfig) { $odd = false; if ($listConfig['type']) { $link = 'auto_list?type=' . $listConfig['type']; } else { $link = 'auto_list?form=' . $listConfig['form']; } $imported = $this->template->loadFile("lists_type_row.html", "tr", "lists_body"); if (!$imported instanceof DOMNode) { I2CE::raiseError("Could not find lists_type_row.html"); return false; } $remaped = $this->template->loadFile("lists_type_row_remapped.html", "tr", "lists_body"); if (!$remaped instanceof DOMNode) { $remaped = $imported; } $append = $this->template->getElementById('lists_body'); if (!$append instanceof DOMNode) { I2CE::raiseError("Don't know where to append list rows"); return false; } foreach ($list as $data) { $id = substr($data['value'], strlen($listConfig['form']) + 1); if (in_array($id, $this->remap_ids) && ($remap = I2CE_FormStorage::lookupField($listConfig['form'], $id, 'remap', ''))) { $imported_row = $remaped->cloneNode(true); if ($listConfig['type']) { $url = 'index.php/auto_list?type=' . $listConfig['type']; } else { $url = 'index.php/auto_list?form=' . $listConfig['type']; } $url .= '&id=' . $listConfig['form'] . '|' . $id; $this->template->setDisplayDataImmediate('remapped_link', $url, $imported_row); list($rform, $rid) = array_pad(explode('|', $remap, 2), 2, ''); $this->template->setDisplayDataImmediate('remapped_value', I2CE_List::lookup($rid, $rform), $imported_row); } else { $imported_row = $imported->cloneNode(true); } $this->template->appendNode($imported_row, $append); if ($odd) { $this->template->setNodeAttribute("class", "even", $imported_row); } $odd = !$odd; $this->template->setDisplayDataImmediate("lists_row_link", $link . '&id=' . $data['value'], $imported_row); $this->template->setDisplayDataImmediate("lists_row_name", $data['display'], $imported_row); } return true; }
/** * Perform any extra validation for the license. * @param I2CE_Form $form */ public function validate_form_person_scheduled_training_course_field_training_course_mod($fieldObj) { if (!$fieldObj instanceof I2CE_FormField_MAP_MULT || !($pstcObj = $fieldObj->getContainer()) instanceof iHRIS_Person_Scheduled_Training_Course || $pstcObj->hasAttribute('validate_by_course') && !$pstcObj->getAttribute('validate_by_course') || !($stcField = $pstcObj->getField('scheduled_training_course')) instanceof I2CE_FormField_MAP || !($stcObj = $stcField->getMappedFormObject()) instanceof iHRIS_Scheduled_Training_Course || !($tcField = $stcObj->getField('training_course')) instanceof I2CE_FormField_MAP || !($tcObj = $tcField->getMappedFormObject()) instanceof iHRIS_Training_Course || !($modField = $tcObj->getField('training_course_mod')) instanceof I2CE_FormField_MAP_MULT) { return; } $selected = $fieldObj->getValue(); if (!is_array($selected)) { $selected = array(); } $t_allowed = $modField->getValue(); if (!is_array($t_allowed)) { return; } $allowed = array(); foreach ($t_allowed as $allow) { if (!is_array($allow) || !count($allow) == 2) { continue; } list($allow_form, $allow_id) = $allow; $allowed[] = $allow_id; } $ok = true; $bads = array(); foreach ($selected as $sel) { if (!is_array($sel) || !count($sel) == 2) { continue; } list($sel_form, $sel_id) = $sel; if (in_array($sel_id, $allowed)) { continue; } $bads[] = I2CE_List::lookup($sel_id, 'training_course_mod'); } if (count($bads) > 0) { $fieldObj->setInvalidMessage('bad_mod', '', implode(" ", $bads)); } }
/** * Perform the main actions of the page. */ protected function action() { $factory = I2CE_FormFactory::instance(); if ($this->get_exists('set_status')) { $new_status = $this->get('set_status'); $set_status = $factory->createContainer($this->get('id')); $set_status->statusOnly(); $set_status->setStatus("position_status|" . $new_status); $set_status->save($this->user); $set_status->cleanup(); unset($set_status); } parent::action(); $this->template->addHeaderLink("view.js"); $this->template->appendFileById("menu_view.html", "li", "navBarUL", true); $this->template->setAttribute("class", "active", "menuConfigure", "a[@href='configure']"); $this->template->appendFileById("menu_configure.html", "ul", "menuConfigure"); $this->template->setAttribute("class", "active", "menuLists", "a[@href='lists']"); if (($jobField = $this->position->getField("job")) instanceof I2CE_FormField) { $jobField->setHref("view_job?id="); } if (($supField = $this->position->getField("supervisor")) instanceof I2CE_FormField) { $supField->setHref("view_position?id="); } if ($this->position->status[1] != "closed") { $this->template->appendFileById("view_position_" . $this->position->status[1] . "_link.html", "li", "edit_links"); } $pers_pos_ids = iHRIS_PersonPosition::getIds($this->get('id')); //print_r( $pers_pos_ids ); if (count($pers_pos_ids) > 0 && $pers_pos_ids['record'] != '0') { $this->template->appendFileById("view_position_person.html", "div", "position"); $pers_pos = $factory->createContainer("person_position" . '|' . $pers_pos_ids['record']); $pers_pos->populate(); $this->template->setForm($pers_pos); $person = $factory->createContainer($pers_pos_ids['parent']); $person->populate(); $this->template->setForm($person); } $supervised = $this->position->getSupervised(); //print_r( $supervised ); if (count($supervised) > 0) { $this->template->appendFileById("view_position_supervised.html", "div", "position"); foreach ($supervised as $record) { $this->template->appendFileById("view_position_row.html", "tr", "supervised"); $this->template->setDisplayData("position", I2CE_List::lookup($record, "position")); $this->template->setDisplayData("add_pos_id", array("id" => $record)); } $this->template->setAttribute("class", "even", "supervised", "tr[position() mod 2 = 0]"); } }