private function _buildQuery() { $query = $this->_db->getQuery(true); $query->select(' jmp.id '); $query->select(' jmp.name '); $query->select(' jmp.period_start '); $query->select(' jmp.period_end '); $query->select(' jmp.app_id '); $query->select(' japp.title AS appTitle '); $query->select(' CASE jmp.service ' . ' WHEN ' . $this->_db->quote('staticmap') . ' ' . ' THEN ' . $this->_db->quote(JText::_('JTMAP_TYPE_STATIC')) . ' ' . ' WHEN ' . $this->_db->quote('interactivemap') . ' ' . ' THEN ' . $this->_db->quote(JText::_('JTMAP_TYPE_INTERACTIVE')) . ' ' . ' ELSE ' . $this->_db->quote(JText::_('JTMAP_TYPE_STATIC')) . ' ' . ' END AS service '); $query->select(' CASE jmp.selection ' . ' WHEN ' . $this->_db->quote('application') . ' ' . ' THEN ' . $this->_db->quote(JText::_('JTMAP_SELECTION_APP')) . ' ' . ' WHEN ' . $this->_db->quote('tree') . ' ' . ' THEN ' . $this->_db->quote(JText::_('JTMAP_SELECTION_TREE')) . ' ' . ' WHEN ' . $this->_db->quote('location') . ' ' . ' THEN ' . $this->_db->quote(JText::_('JTMAP_SELECTION_LOCATION')) . ' ' . ' WHEN ' . $this->_db->quote('person') . ' ' . ' THEN ' . $this->_db->quote(JText::_('JTMAP_SELECTION_PERSON')) . ' ' . ' WHEN ' . $this->_db->quote('persons') . ' ' . ' THEN ' . $this->_db->quote(JText::_('JTMAP_SELECTION_PERSONS')) . ' ' . ' WHEN ' . $this->_db->quote('name') . ' ' . ' THEN ' . $this->_db->quote(JText::_('JTMAP_SELECTION_NAME')) . ' ' . ' ELSE ' . $this->_db->quote(JText::_('JTMAP_SELECTION_APP')) . ' ' . ' END AS selection '); $query->select(' CASE jmp.selection ' . ' WHEN ' . $this->_db->quote('application') . ' ' . ' THEN japp.title ' . ' WHEN ' . $this->_db->quote('tree') . ' ' . ' THEN jte.name ' . ' WHEN ' . $this->_db->quote('location') . ' ' . ' THEN jmp.subject ' . ' WHEN ' . $this->_db->quote('person') . ' ' . ' THEN ' . JoaktreeHelper::getConcatenatedFullName() . ' ' . ' ELSE jmp.subject ' . ' END AS subject '); $query->from(' #__joaktree_maps jmp '); $query->innerJoin(' #__joaktree_applications japp ' . ' ON ( japp.id = jmp.app_id ) '); $query->leftJoin(' #__joaktree_trees jte ' . ' ON ( jte.id = jmp.tree_id ) '); $query->leftJoin(' #__joaktree_persons jpn ' . ' ON ( jpn.app_id = jmp.app_id ' . ' AND jpn.id = jmp.person_id ' . ' ) '); // WHERE, GROUP BY and ORDER BY clauses for the query $wheres = $this->_buildContentWhere(); foreach ($wheres as $where) { $query->where(' ' . $where . ' '); } $query->order(' ' . $this->_buildContentOrderBy() . ' '); return $query; }
private function getPerson() { $query = $this->_db->getQuery(true); $query->select(JoaktreeHelper::getConcatenatedFullName(false) . ' AS name '); $query->from(' #__joaktree_persons jpn '); $query->where(' jpn.app_id = ' . $this->params['app_id'] . ' '); $query->where(' jpn.id = ' . $this->_db->quote($this->params['person_id']) . ' '); $this->_db->setQuery($query); $result = $this->_db->loadObject(); return $result; }
/** * Method to get the field options. * * @return array The field option objects. * @since 11.1 */ protected function getOptions() { // Possible actions are: addparent, addchild, addpartner // Initialize variables. $appId = JoaktreeHelper::getApplicationId(); $action = JoaktreeHelper::getAction(); $personId = JoaktreeHelper::getRelationId(); // Initialize variables. $options = array(); $db = JFactory::getDBO(); $query = $db->getQuery(true); switch ($action) { case "addparent": // family for adding parents // select all parents of the person, and for every parent its family-id $query->select(' jrn.family_id '); $query->select(' jrn.person_id_2 AS pid2 '); $query->from(' #__joaktree_relations jrn '); $query->where(' jrn.app_id = ' . $appId . ' '); $query->where(' jrn.person_id_1 = ' . $db->quote($personId) . ' '); $query->where(' jrn.type IN (' . $db->quote('father') . ', ' . $db->quote('mother') . ') '); $query->select(JoaktreeHelper::getConcatenatedFullName() . ' AS fullName '); $query->innerJoin(' #__joaktree_persons jpn ' . ' ON ( jpn.app_id = jrn.app_id ' . ' AND jpn.id = jrn.person_id_2 ' . ' ) '); $query->innerJoin(JoaktreeHelper::getJoinAdminPersons()); break; case "addchild": // family for adding children // select all partners of the person, and for every partner its family-id $query->select(' jrn.family_id '); $query->select(' IF( (jrn.person_id_1 = ' . $db->quote($personId) . ') ' . ' , jrn.person_id_2 ' . ' , jrn.person_id_1 ' . ' ) AS pid2 '); $query->from(' #__joaktree_relations jrn '); $query->where(' jrn.app_id = ' . $appId . ' '); $query->where(' ( jrn.person_id_1 = ' . $db->quote($personId) . ' ' . ' OR jrn.person_id_2 = ' . $db->quote($personId) . ' ' . ' ) '); $query->where(' jrn.type = ' . $db->quote('partner') . ' '); $query->select(JoaktreeHelper::getConcatenatedFullName() . ' AS fullName '); $query->innerJoin(' #__joaktree_persons jpn ' . ' ON ( jpn.app_id = jrn.app_id ' . ' AND ( jpn.id = jrn.person_id_1 ' . ' OR jpn.id = jrn.person_id_2 ' . ' ) ' . ' AND jpn.id != ' . $db->quote($personId) . ' ' . ' ) '); $query->innerJoin(JoaktreeHelper::getJoinAdminPersons()); break; default: // continue break; } if ($action == 'addparent' || $action == 'addchild') { // Set the query and get the result list. $db->setQuery($query); $items = $db->loadObjectlist(); // Check for an error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); return $options; } // Build the field options. if (!empty($items)) { foreach ($items as $item) { $options[] = JHtml::_('select.option', $item->pid2 . '!' . $item->family_id, $item->fullName); } } } if ($action == 'addpartner' || $action == 'addchild') { // select family-id of single parent families. // new partner or new child may be added to this family $query->clear(); $query->select(' DISTINCT jrn.family_id '); $query->from(' #__joaktree_relations jrn '); $query->where(' jrn.app_id = ' . $appId . ' '); $query->where(' jrn.person_id_2 = ' . $db->quote($personId) . ' '); $query->where(' jrn.type IN (' . $db->quote('father') . ', ' . $db->quote('mother') . ') '); $query->where(' NOT EXISTS ' . ' ( SELECT 1 ' . ' FROM #__joaktree_relations jrn2 ' . ' WHERE jrn2.app_id = jrn.app_id ' . ' AND jrn2.family_id = jrn.family_id ' . ' AND jrn2.type = ' . $db->quote('partner') . ' ' . ' ) '); $query->select(' GROUP_CONCAT(jpn.firstName SEPARATOR ' . $db->quote(', ') . ') AS names '); $query->innerJoin(' #__joaktree_persons jpn ' . ' ON ( jpn.app_id = jrn.app_id ' . ' AND jpn.id = jrn.person_id_1 ' . ' ) '); $query->innerJoin(JoaktreeHelper::getJoinAdminPersons()); $db->setQuery($query); $familyId = $db->loadObject(); } // if familyId is unknown (either in case of addparent, of with no result for the last query // the familyId is set to be '0'. The option is added to the list. switch ($action) { case "addparent": $options[] = JHtml::_('select.option', '0!0', JText::_('JT_NEWFAMILY1')); break; case "addchild": $familyId = is_object($familyId) && $familyId->family_id ? $familyId->family_id : '0'; $options[] = JHtml::_('select.option', '0!' . $familyId, JText::_('JT_NEWFAMILY3')); break; case "addpartner": if (is_object($familyId) && $familyId->family_id) { $options[] = JHtml::_('select.option', '0!' . $familyId->family_id, $familyId->names); } // finally we add the option for a new partner / new family $options[] = JHtml::_('select.option', '0!0', JText::_('JT_NEWFAMILY2')); break; default: // continue break; } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
public function getPersonName() { $personId = JoaktreeHelper::getPersonId(false, true); $appId = JoaktreeHelper::getApplicationId(false, true); if (empty($appId) || empty($personId)) { $retObj = $this->getReturnObject(); if (is_object($retObj) && $retObj->object == 'prsn') { $appId = $retObj->app_id; $personId = $retObj->object_id; } } if (!empty($appId) && !empty($personId)) { $displayAccess = JoaktreeHelper::getDisplayAccess(); $db = $this->getDbo(); $query = $db->getQuery(true); $query->select(JoaktreeHelper::getConcatenatedFullName() . ' AS fullName '); $query->from(' #__joaktree_persons jpn '); $query->where(' jpn.app_id = ' . (int) $appId . ' '); $query->where(' jpn.id = ' . $db->quote($personId) . ' '); $query->innerJoin(JoaktreeHelper::getJoinAdminPersons(true)); $db->setQuery($query); $name = $db->loadResult(); if ($error = $db->getErrorMsg()) { throw new JException($error); } } return isset($name) ? $name : null; }
private function getPartnerSet($number1, $appId, $personId) { $db = JFactory::getDBO(); $number2 = $number1 == '1' ? '2' : '1'; $query = $db->getQuery(true); // select relationship $query->select(' jrn.family_id '); $query->select(' jrn.person_id_' . $number2 . ' AS relation_id '); $query->from(' #__joaktree_relations jrn '); $query->where(' jrn.app_id = ' . $appId . ' '); $query->where(' jrn.person_id_' . $number1 . ' = ' . $db->quote($personId) . ' '); $query->where(' jrn.type = ' . $db->quote('partner') . ' '); // select name partner $query->select(JoaktreeHelper::getConcatenatedFullName() . ' AS fullName '); $query->innerJoin(' #__joaktree_persons jpn ' . ' ON ( jpn.app_id = jrn.app_id ' . ' AND jpn.id = jrn.person_id_' . $number2 . ' ' . ' ) '); // select from admin persons $query->innerJoin(JoaktreeHelper::getJoinAdminPersons()); $db->setQuery($query); $partners = $db->loadAssocList(); return $partners; }
public static function getList($numberInList) { // get cookie $params = JComponentHelper::getParams('com_joaktree'); $indCookie = $params->get('indCookies', false); if (!$indCookie) { return false; } // array to return $person = array(); // we fetch the cookie $cookie = new JInputCookie(); $tmp = $cookie->get('jt_last_persons', '', 'string'); // prepare the array if ($tmp) { $cookieList = (array) json_decode(base64_decode($tmp)); } else { $cookieList = array(); } if (count($cookieList)) { $db = JFactory::getDBO(); $query = $db->getQuery(true); // get user access info $levels = JoaktreeHelper::getUserAccessLevels(); // set up maximum number of items $maxItem = count($cookieList) > $numberInList ? $numberInList : count($cookieList); // get menuId & technology $menus = JoaktreeHelper::getMenus('joaktree'); $linkBase = 'index.php?option=com_joaktree&view=joaktree'; for ($i = 0; $i < $maxItem; $i++) { $query->clear(); // item is a string separated by !: app_id, person_id, tree_id; $elements = explode('!', array_shift($cookieList)); // retrieve person $app_id = array_shift($elements); $person_id = array_shift($elements); $tree_id = array_shift($elements); if (!empty($app_id) && !empty($person_id) && !empty($tree_id)) { $query->select(JoaktreeHelper::getConcatenatedFullName() . ' AS fullName '); $query->from(' #__joaktree_persons jpn '); $query->where(' jpn.app_id = ' . $app_id . ' '); $query->where(' jpn.id = ' . $db->Quote($person_id) . ' '); // join with admin persons $query->innerJoin(JoaktreeHelper::getJoinAdminPersons(true)); // join with trees $query->innerJoin(' #__joaktree_tree_persons jtp ' . ' ON ( jtp.app_id = jpn.app_id ' . ' AND jtp.person_id = jpn.id ' . ' AND jtp.tree_id = ' . $tree_id . ' ' . ' ) '); $query->innerJoin(' #__joaktree_trees jte ' . ' ON ( jte.app_id = jtp.app_id ' . ' AND jte.id = jtp.tree_id ' . ' AND jte.published = true ' . ' AND jte.access IN ' . $levels . ' ' . ' ) '); // fetch from database $db->setQuery($query); $tmpPerson = $db->loadObject(); if ($tree_id && isset($menus[$tree_id])) { $menuItemId = $menus[$tree_id]; $tmpPerson->route = JRoute::_($linkBase . '&Itemid=' . $menuItemId . '&treeId=' . $tree_id . '&personId=' . $app_id . '!' . $person_id); $tmpPerson->robot = ''; } else { $tmpPerson->route = 0; $tmpPerson->robot = ''; } if (!empty($tmpPerson->fullName)) { $person[] = $tmpPerson; } unset($tmpPerson); } } } return $person; }
function __construct($id, $type = 'basic') { $this->_db =& JFactory::getDBO(); $app = JFactory::getApplication(); // get parameters $params = JoaktreeHelper::getJTParams(); $patronymSetting = (int) $params->get('patronym'); $patronymString = $params->get('patronymSeparation'); // get user access info $this->_levels = JoaktreeHelper::getUserAccessLevels(); $displayAccess = JoaktreeHelper::getDisplayAccess(); // basic or full $indFull = $type != 'basic' && $type != 'ancestor'; // retrieve person from database $query = $this->_db->getQuery(true); // select from persons $query->select(' jpn.app_id AS app_id '); $query->select(' jpn.id AS id '); // names if ($indFull) { $query->select(JoaktreeHelper::getSelectFirstName() . ' AS firstName '); $query->select(JoaktreeHelper::getSelectPatronym() . ' AS patronym '); $query->select(JoaktreeHelper::getConcatenatedFamilyName() . ' AS familyName '); $query->select(' jpn.namePreposition '); $query->select(' jpn.prefix '); $query->select(' jpn.suffix '); $query->select(' jpn.familyName AS rawFamilyName '); } else { $query->select(JoaktreeHelper::getConcatenatedFullName() . ' AS fullName '); } $query->select(' jpn.sex AS sex '); $query->select(' jpn.indHasParent '); $query->select(' jpn.indHasPartner '); $query->select(' jpn.indHasChild '); $query->select(' DATE_FORMAT( jpn.lastUpdateTimeStamp, "%e %b %Y" ) ' . ' AS lastUpdateDate '); if ($indFull) { $query->select(' IF( ( (jan.living = false AND ' . $displayAccess['NOTEperson']->notLiving . ' > 0 ) ' . ' OR (jan.living = true AND ' . $displayAccess['NOTEperson']->living . ' > 0 ) ' . ' ) ' . ' , jpn.indNote ' . ' , false ' . ' ) AS indNote '); $query->select(' IF( ( (jan.living = false AND ' . $displayAccess['SOURperson']->notLiving . ' > 0 ) ' . ' OR (jan.living = true AND ' . $displayAccess['SOURperson']->living . ' > 0 ) ' . ' ) ' . ' , jpn.indCitation ' . ' , false ' . ' ) AS indCitation '); } $query->from(' #__joaktree_persons jpn '); $query->where(' jpn.app_id = ' . $id['app_id'] . ' '); $query->where(' jpn.id = ' . $this->_db->Quote($id['person_id']) . ' '); // select from admin persons $query->select(' jan.living AS living '); $query->select(' jan.published AS published '); $query->select(' jan.page AS page '); $query->select(' jan.map AS map '); $query->select(' IF( ISNULL( NULLIF( jan.default_tree_id, 0) ) ' . ' , false ' . ' , jan.page ' . ' ) AS indHasPage '); $query->select(' IF( ( (jan.living = false AND ' . $displayAccess['NAMEname']->notLiving . ' > 0 ) ' . ' OR (jan.living = true AND ' . $displayAccess['NAMEname']->living . ' > 0 ) ' . ' ) ' . ' , true ' . ' , false ' . ' ) AS indNameDisplay '); $query->select(' IF((jan.robots > 0), jan.robots, jte.robots ) AS robots '); if ($indFull) { $query->select(' IF( (jan.living = true AND ' . $displayAccess['NAMEname']->living . ' = 1 ) ' . ' , true ' . ' , false ' . ' ) AS indAltName '); $query->select(' IF( (jan.living = true AND ' . $displayAccess['NOTEperson']->living . ' = 1 ) ' . ' , true ' . ' , false ' . ' ) AS indAltNote '); $query->select(' IF( (jan.living = true AND ' . $displayAccess['SOURperson']->living . ' = 1 ) ' . ' , true ' . ' , false ' . ' ) AS indAltSource '); } $query->innerJoin(JoaktreeHelper::getJoinAdminPersons(true)); if ($indFull) { // select from tree x persons $query->select(' jtp.tree_id AS tree_id '); $query->select(' jtp.lineage '); $query->innerJoin(' #__joaktree_tree_persons jtp ' . ' ON ( jtp.app_id = jpn.app_id ' . ' AND jtp.person_id = jpn.id ' . ' AND jtp.tree_id = ' . $id['tree_id'] . ' ' . ' ) '); $query->innerJoin(' #__joaktree_trees jte ' . ' ON ( jte.app_id = jtp.app_id ' . ' AND jte.id = jtp.tree_id ' . ' AND jte.published = true ' . ' AND jte.access IN ' . $this->_levels . ' ' . ' ) '); } else { // select from default tree $query->select(' jte.id AS tree_id '); $query->leftJoin(' #__joaktree_trees jte ' . ' ON ( jte.app_id = jan.app_id ' . ' AND jte.id = jan.default_tree_id ' . ' AND jte.published = true ' . ' AND jte.access IN ' . $this->_levels . ' ' . ' ) '); } // select birth and death dates for ancestors if ($type == 'ancestor') { // select from birth $query->select(' MIN( IF( (jan.living = true AND ' . $displayAccess['BIRTperson']->living . ' = 1 ) ' . ' , NULL ' . ' , birth.eventDate ' . ' ) ' . ' ) AS birthDate '); $query->leftJoin(' #__joaktree_person_events birth ' . ' ON ( birth.app_id = jpn.app_id ' . ' AND birth.person_id = jpn.id ' . ' AND birth.code = ' . $this->_db->Quote('BIRT') . ' ' . ' AND ( (jan.living = false AND ' . $displayAccess['BIRTperson']->notLiving . ' > 0 ) ' . ' OR (jan.living = true AND ' . $displayAccess['BIRTperson']->living . ' > 0 ) ' . ' ) ' . ' ) '); // select from death $query->select(' MIN( IF( (jan.living = true AND ' . $displayAccess['DEATperson']->living . ' = 1 ) ' . ' , NULL ' . ' , death.eventDate ' . ' ) ' . ' ) AS deathDate '); $query->leftJoin(' #__joaktree_person_events death ' . ' ON ( death.app_id = jpn.app_id ' . ' AND death.person_id = jpn.id ' . ' AND death.code = ' . $this->_db->Quote('DEAT') . ' ' . ' AND ( (jan.living = false AND ' . $displayAccess['DEATperson']->notLiving . ' > 0 ) ' . ' OR (jan.living = true AND ' . $displayAccess['DEATperson']->living . ' > 0 ) ' . ' ) ' . ' ) '); $query->group(' jpn.app_id '); $query->group(' jpn.id '); $query->group(JoaktreeHelper::getConcatenatedFullName()); $query->group(' jpn.sex '); $query->group(' jpn.indHasParent '); $query->group(' jpn.indHasPartner '); $query->group(' jpn.indHasChild '); $query->group(' DATE_FORMAT( jpn.lastUpdateTimeStamp, "%e %b %Y" ) '); // select from admin persons $query->group(' jan.living '); $query->group(' jan.published '); $query->group(' jan.page '); $query->group(' jan.map '); $query->group(' IF( ISNULL( NULLIF( jan.default_tree_id, 0) ) ' . ' , false ' . ' , jan.page ' . ' ) '); $query->group(' IF( ( (jan.living = false AND ' . $displayAccess['NAMEname']->notLiving . ' > 0 ) ' . ' OR (jan.living = true AND ' . $displayAccess['NAMEname']->living . ' > 0 ) ' . ' ) ' . ' , true ' . ' , false ' . ' ) '); $query->group(' IF((jan.robots > 0), jan.robots, jte.robots ) '); $query->group(' jte.id '); } $this->_db->setQuery($query); $person = $this->_db->loadAssoc(); // Check for a error. if ($error = $this->_db->getErrorMsg()) { throw new JException($error); } if (!$person && $indFull) { $query->clear(); // select from persons $query->select(' jpn.app_id AS app_id '); $query->select(' jpn.id AS id '); $query->select(JoaktreeHelper::getSelectFirstName() . ' AS firstName '); $query->select(JoaktreeHelper::getSelectPatronym() . ' AS patronym '); $query->select(JoaktreeHelper::getConcatenatedFamilyName() . ' AS familyName '); $query->select(' jpn.namePreposition '); $query->select(' jpn.prefix '); $query->select(' jpn.suffix '); $query->select(' jpn.familyName AS rawFamilyName '); $query->select(' jpn.sex AS sex '); $query->select(' jpn.indHasParent '); $query->select(' jpn.indHasPartner '); $query->select(' jpn.indHasChild '); $query->select(' IF( ( (jan.living = false AND ' . $displayAccess['NOTEperson']->notLiving . ' > 0 ) ' . ' OR (jan.living = true AND ' . $displayAccess['NOTEperson']->living . ' > 0 ) ' . ' ) ' . ' , jpn.indNote ' . ' , false ' . ' ) AS indNote '); $query->select(' IF( ( (jan.living = false AND ' . $displayAccess['SOURperson']->notLiving . ' > 0 ) ' . ' OR (jan.living = true AND ' . $displayAccess['SOURperson']->living . ' > 0 ) ' . ' ) ' . ' , jpn.indCitation ' . ' , false ' . ' ) AS indCitation '); $query->select(' DATE_FORMAT( jpn.lastUpdateTimeStamp, "%e %b %Y" ) ' . ' AS lastUpdateDate '); $query->from(' #__joaktree_persons jpn '); $query->where(' jpn.app_id = ' . $id['app_id'] . ' '); $query->where(' jpn.id = ' . $this->_db->Quote($id['person_id']) . ' '); $query->where(' NOT EXISTS ' . ' ( SELECT 1 ' . ' FROM #__joaktree_tree_persons jtp2 ' . ' WHERE jtp2.app_id = jpn.app_id ' . ' AND jtp2.person_id = jpn.id ' . ' AND jtp2.tree_id = ' . $id['tree_id'] . ' ' . ' ) '); // select from tree x persons $query->select(' IFNULL( jan.default_tree_id ' . ' , ' . $id['tree_id'] . ' ' . ' ) AS tree_id '); // select from admin persons $query->select(' jan.living AS living '); $query->select(' jan.published AS published '); $query->select(' jan.page AS page '); $query->select(' jan.map AS map '); $query->select(' IF( ISNULL( NULLIF( jan.default_tree_id, 0) ) ' . ' , false ' . ' , jan.page ' . ' ) AS indHasPage '); $query->select(' IF( ( (jan.living = false AND ' . $displayAccess['NAMEname']->notLiving . ' > 0 ) ' . ' OR (jan.living = true AND ' . $displayAccess['NAMEname']->living . ' > 0 ) ' . ' ) ' . ' , true ' . ' , false ' . ' ) AS indNameDisplay '); $query->select(' IF( (jan.living = true AND ' . $displayAccess['NAMEname']->living . ' = 1 ) ' . ' , true ' . ' , false ' . ' ) AS indAltName '); $query->select(' IF( (jan.living = true AND ' . $displayAccess['NOTEperson']->living . ' = 1 ) ' . ' , true ' . ' , false ' . ' ) AS indAltNote '); $query->select(' IF( (jan.living = true AND ' . $displayAccess['SOURperson']->living . ' = 1 ) ' . ' , true ' . ' , false ' . ' ) AS indAltSource '); $query->innerJoin(JoaktreeHelper::getJoinAdminPersons(true)); // robots $query->select(' IF((jan.robots > 0), jan.robots, jte.robots ) AS robots '); $query->leftJoin(' #__joaktree_trees jte ' . ' ON ( jte.app_id = jan.app_id ' . ' AND jte.id = IFNULL( jan.default_tree_id ' . ' , ' . $id['tree_id'] . ' ' . ' ) ' . ' AND jte.published = true ' . ' AND jte.access IN ' . $this->_levels . ' ' . ' ) '); $this->_db->setQuery($query); $person = $this->_db->loadAssoc(); // Check for a error. if ($error = $this->_db->getErrorMsg()) { throw new JException($error); } } $this->app_id = $person['app_id']; $this->id = $person['id']; $this->tree_id = $person['tree_id']; $this->sex = $person['sex']; $this->indHasParent = $person['indHasParent']; $this->indHasPartner = $person['indHasPartner']; $this->indHasChild = $person['indHasChild']; $this->lastUpdateDate = $person['lastUpdateDate']; $this->living = $person['living']; $this->published = $person['published']; $this->page = $person['page']; $this->map = $person['map']; $this->indHasPage = $person['indHasPage']; $this->indNameDisplay = $person['indNameDisplay']; $this->robots = $person['robots']; // names if ($indFull) { // when patronyms are shown, there are concatenated to the first name $this->firstName = $person['firstName']; $this->patronym = $person['patronym']; if ($patronymSetting == 0 or $this->patronym == null) { $this->firstNamePatronym = $this->firstName; } else { $this->firstNamePatronym = $this->firstName . ' ' . $patronymString . $person['patronym'] . $patronymString; } $this->familyName = $person['familyName']; $this->prefix = $person['prefix']; $this->suffix = $person['suffix']; $this->namePreposition = $person['namePreposition']; $this->rawFamilyName = $person['rawFamilyName']; $this->indNote = $person['indNote']; $this->indCitation = $person['indCitation']; $this->indAltName = $person['indAltName']; $this->indAltNote = $person['indAltNote']; $this->indAltSource = $person['indAltSource']; $this->lineage = isset($person['lineage']) ? trim($person['lineage']) : null; } else { $this->fullName = $person['fullName']; } if ($type == 'ancestor') { $this->birthDate = JoaktreeHelper::displayDate($person['birthDate']); $this->deathDate = JoaktreeHelper::displayDate($person['deathDate']); } $this->secondParent_id = null; $this->family_id = null; $this->relationtype = null; $this->orderNr = null; $this->languageFilter = $app->getLanguageFilter(); if (isset($person['tree_id']) && $person['tree_id']) { $menus = $this->getMenus(); $this->menuItemId = $menus[$person['tree_id']]; } if (!isset($this->menuItemId)) { $menu = $app->getMenu(); $item = $menu->getActive(); $this->menuItemId = $item->id; } }