/** * Page for url "profile/ajax/tree/jobterms". Display a JSon page containing * the sub-branches of a branch in the job terms tree. * @param $page the Platal page * @param $filter filter helps to display only jobterms that are contained in jobs or in mentors * * @param Env::i('jtid') job term id of the parent branch, if none trunk will be used * @param Env::v('attrfunc') the name of a javascript function that will be called when a branch * is chosen * @param Env::v('treeid') tree id that will be given as first argument of attrfunc function * the second argument will be the chosen job term id and the third one the chosen job full name. */ function handler_ajax_tree_job_terms($page, $filter = JobTerms::ALL) { JobTerms::ajaxGetBranch($page, $filter); }
function handler_list($page, $type = null, $idVal = null) { $page->assign('name', $type); $page->assign('with_text_value', true); $page->assign('onchange', "document.forms.recherche.{$type}Txt.value = this.options[this.selectedIndex].text"); // Give the list of all values possible of type and builds a select input for it $ids = null; switch ($type) { case 'binet': $ids = DirEnum::getOptionsIter(DirEnum::BINETS); break; case 'networking_type': $ids = DirEnum::getOptionsIter(DirEnum::NETWORKS); break; case 'country': $ids = DirEnum::getOptionsIter(DirEnum::COUNTRIES); $page->assign('onchange', 'changeAddressComponents(\'' . $type . '\', this.value)'); break; case 'administrative_area_level_1': case 'administrative_area_level_2': case 'locality': $page->assign('onchange', 'changeAddressComponents(\'' . $type . '\', this.value)'); case 'postal_code': $ids = XDB::iterator("SELECT pace1.id, pace1.long_name AS field\n FROM profile_addresses_components_enum AS pace1\n INNER JOIN profile_addresses_components AS pac1 ON (pac1.component_id = pace1.id)\n INNER JOIN profile_addresses_components AS pac2 ON (pac1.pid = pac2.pid AND pac1.jobid = pac2.jobid AND pac1.id = pac2.id\n AND pac1.groupid = pac2.groupid AND pac1.type = pac2.type)\n INNER JOIN profile_addresses_components_enum AS pace2 ON (pac2.component_id = pace2.id AND FIND_IN_SET({?}, pace2.types))\n WHERE pace2.id = {?} AND FIND_IN_SET({?}, pace1.types) AND pac1.type = 'home'\n GROUP BY pace1.long_name", Env::v('previous'), Env::v('value'), $type); break; case 'diploma': if (Env::has('school') && Env::i('school') != 0) { $ids = DirEnum::getOptionsIter(DirEnum::EDUDEGREES, Env::i('school')); } else { $ids = DirEnum::getOptionsIter(DirEnum::EDUDEGREES); } break; case 'groupex': $ids = DirEnum::getOptionsIter(DirEnum::GROUPESX); break; case 'nationalite': $ids = DirEnum::getOptionsIter(DirEnum::NATIONALITIES); break; case 'school': $ids = DirEnum::getOptionsIter(DirEnum::EDUSCHOOLS); $page->assign('onchange', 'changeSchool(this.value)'); break; case 'section': $ids = DirEnum::getOptionsIter(DirEnum::SECTIONS); break; case 'jobterm': if (Env::has('jtid')) { JobTerms::ajaxGetBranch($page, JobTerms::ONLY_JOBS); return; } else { pl_content_headers('text/xml'); echo '<div>'; // global container so that response is valid xml echo '<input name="jobtermTxt" type="text" style="display:none" size="32" />'; echo '<input name="jobterm" type="hidden"/>'; echo '<div class="term_tree"></div>'; // container where to create the tree echo '<script type="text/javascript" src="javascript/jquery.jstree.js"></script>'; echo '<script type="text/javascript" src="javascript/jobtermstree.js"></script>'; echo '<script type="text/javascript">createJobTermsTree(".term_tree", "search/list/jobterm", "search", "searchForJobTerm");</script>'; echo '</div>'; exit; } default: exit; } if (isset($idVal)) { pl_content_headers("text/plain"); echo $ids[$idVal]; exit; } pl_content_headers("text/xml"); $page->changeTpl('include/field.select.tpl', NO_SKIN); $page->assign('list', $ids); }