コード例 #1
0
ファイル: view.raw.php プロジェクト: Lothurm/J3.x
 function display($tpl = null)
 {
     $params = JoaktreeHelper::getJTParams();
     // Access
     $lists['userAccess'] = $this->get('access');
     $lists['treeId'] = $this->get('treeId');
     $lists['technology'] = $this->get('technology');
     // Person + generations
     $personId = array();
     $this->person = $this->get('person');
     $personId[] = $this->person->id . '|1';
     $lists['ancestorLevel'] = $params->get('ancestorlevel', 1);
     $lists['startGenNum'] = 1;
     $lists['endGenNum'] = $lists['ancestorLevel'] + 4;
     $lists['app_id'] = $this->person->app_id;
     // show dates
     $lists['showDates'] = $params->get('ancestordates', 0);
     // last update
     $lists['lastUpdate'] = JText::_('JT_LASTUPDATED') . ': ' . JoaktreeHelper::convertDateTime($this->person->lastUpdateDate);
     // copyright
     $lists['CR'] = JoaktreeHelper::getJoaktreeCR();
     $this->assignRef('personId', $personId);
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }
コード例 #2
0
ファイル: todaymanyyearsago.php プロジェクト: Lothurm/J3.x
 public function getList($moduleId)
 {
     $moduleId = (int) $moduleId;
     $params = $this->getModuleParams($moduleId);
     $periodType = $params->get('periodType');
     $limit = (int) $params->get('searchlimit', 10);
     $userAccessLevels = JoaktreeHelper::getUserAccessLevels();
     $personStatus = $params->get('personStatus', 0);
     $showTitle = $params->get('showHeading', 1);
     $today = getdate();
     if ($params->get('freeChoice')) {
         // only when user is allowed to enter a day/month we are checking these values.
         $day = JoaktreeHelper::getDay();
         $month = JoaktreeHelper::getMonth();
     }
     // for titles we want to know if we have day and/or months from the front end
     $indUI = !isset($day) && !isset($month) || $day == 0 && $month == 0 ? false : true;
     // if day and/or month is not set, we use today's info
     $day = !isset($day) || $day == 0 ? $today['mday'] : $day;
     $month = !isset($month) || $month == 0 ? $today['mon'] : $month;
     if ($showTitle == 1) {
         if (!$indUI) {
             // nothing from front end -> use standard titles
             switch ($periodType) {
                 case 2:
                     // continue
                 // continue
                 case 3:
                     $this->_title = JText::_('JTMOD_TMYA_HEADING_THISMONTH');
                     break;
                 case 4:
                     // continue
                 // continue
                 case 5:
                     $this->_title = JText::_('JTMOD_TMYA_HEADING_THISWEEK');
                     break;
                 case 0:
                     // continue
                 // continue
                 case 1:
                     // continue
                 // continue
                 default:
                     $this->_title = JText::_('JTMOD_TMYA_HEADING_TODAY');
                     break;
             }
         } else {
             // use information from front end
             switch ($periodType) {
                 case 2:
                     // continue
                 // continue
                 case 3:
                     $this->_title = JText::_($this->getMonthName($month));
                     break;
                 case 4:
                     // continue
                 // continue
                 case 5:
                     // continue
                 // continue
                 case 0:
                     // continue
                 // continue
                 case 1:
                     // continue
                 // continue
                 default:
                     $this->_title = $day . ' ' . JText::_($this->getMonthName($month));
                     break;
             }
         }
     } else {
         $this->_title = null;
     }
     switch ($periodType) {
         case 2:
             // continue
         // continue
         case 3:
             $this->_buttonText = JText::_('JTMOD_TMYA_HEADING_THISMONTH');
             break;
         case 4:
             // continue
         // continue
         case 5:
             $this->_buttonText = JText::_('JTMOD_TMYA_HEADING_THISWEEK');
             break;
         case 0:
             // continue
         // continue
         case 1:
             // continue
         // continue
         default:
             $this->_buttonText = JText::_('JTMOD_TMYA_HEADING_TODAY');
             break;
     }
     $result = array();
     $displayAccess = JoaktreeHelper::getDisplayAccess();
     $userAccess = JoaktreeHelper::getUserAccess();
     $where = $this->_buildContentWhere($day, $month, $today['year']);
     $order = $this->_buildOrderBy();
     // retrieve person events
     $query = '( SELECT  CONCAT_WS(' . $this->_db->quote(' ') . ' ' . '                   , jpn.firstName ' . '                   , jpn.namePreposition ' . '                   , jpn.familyName ' . '                   )               AS name ' . ',         jet.app_id               AS appId ' . ',         jet.person_id            AS personId ' . ',         jan.default_tree_id      AS treeId ' . ',			IF ( ( jet.code = ' . $this->_db->Quote('EVEN') . ' ) ' . '             , IFNULL( jet.type, jet.code ) ' . '             , jet.code ' . '             )                     AS code ' . ',         jet.eventdate ' . ',         DATE_FORMAT(STR_TO_DATE(eventdate, "%d %M %Y"), "%m%d") AS sortingdate ' . ',         SUBSTR( RTRIM(jet.eventdate), -4 ) AS eventyear ' . ',         jpn.familyName           AS familyName ' . 'FROM      #__joaktree_person_events     jet ' . 'JOIN      #__joaktree_persons           jpn ' . 'ON        (   jpn.app_id = jet.app_id ' . '          AND jpn.id     = jet.person_id ' . '          ) ' . 'JOIN      #__joaktree_admin_persons     jan ' . 'ON        (   jan.app_id    = jpn.app_id ' . '          AND jan.id        = jpn.id ' . '          AND jan.published = true ' . ($personStatus == 0 ? 'AND jan.living = false ' : ' ') . ($personStatus == 1 ? 'AND jan.living = true ' : ' ') . '          AND (  (jan.living = false AND ' . $displayAccess['NAMEname']->notLiving . ' = 2 ) ' . '              OR (jan.living = true  AND ' . $displayAccess['NAMEname']->living . '    = 2 ) ' . '              ) ' . '          ) ' . 'JOIN      #__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 ' . $userAccessLevels . ' ' . '          ) ' . 'JOIN      #__joaktree_display_settings  jds ' . 'ON        (   jds.code = jet.code ' . '          AND jds.level = ' . $this->_db->quote('person') . ' ' . '          AND jds.published = true ' . '          AND (  (jan.living = false AND jds.access       IN ' . $userAccessLevels . ') ' . '              OR (jan.living = true  AND jds.accessLiving IN ' . $userAccessLevels . ') ' . '              ) ' . '          ) ' . $where . ' ) ' . 'UNION ' . '( SELECT  CONCAT_WS(' . $this->_db->quote(' + ') . ' ' . '                   , CONCAT_WS(' . $this->_db->quote(' ') . ' ' . '                              , jpn1.firstName ' . '                              , jpn1.namePreposition ' . '                              , jpn1.familyName ' . '                              ) ' . '                   , CONCAT_WS(' . $this->_db->quote(' ') . ' ' . '                              , jpn2.firstName ' . '                              , jpn2.namePreposition ' . '                              , jpn2.familyName ' . '                              ) ' . '                   )               AS name ' . ',         jet.app_id               AS appId ' . ',         jet.person_id_1          AS personId ' . ',         jan1.default_tree_id     AS treeId ' . ',			IF ( ( jet.code = ' . $this->_db->Quote('EVEN') . ' ) ' . '             , IFNULL( jet.type, jet.code ) ' . '             , jet.code ' . '             )                     AS code ' . ',         jet.eventdate ' . ',         DATE_FORMAT(STR_TO_DATE(eventdate, "%d %M %Y"), "%m%d") AS sortingdate ' . ',         SUBSTR( RTRIM(jet.eventdate), -4 ) AS eventyear ' . ',         jpn1.familyName          AS familyName ' . 'FROM      #__joaktree_relation_events   jet ' . 'JOIN      #__joaktree_persons           jpn1 ' . 'ON        (   jpn1.app_id = jet.app_id ' . '          AND jpn1.id     = jet.person_id_1 ' . '          ) ' . 'JOIN      #__joaktree_admin_persons     jan1 ' . 'ON        (   jan1.app_id    = jpn1.app_id ' . '          AND jan1.id        = jpn1.id ' . '          AND jan1.published = true ' . ($personStatus == 0 ? 'AND jan1.living = false ' : ' ') . ($personStatus == 1 ? 'AND jan1.living = true ' : ' ') . '          AND (  (jan1.living = false AND ' . $displayAccess['NAMEname']->notLiving . ' = 2 ) ' . '              OR (jan1.living = true  AND ' . $displayAccess['NAMEname']->living . '    = 2 ) ' . '              ) ' . '          ) ' . 'JOIN      #__joaktree_trees             jte1 ' . 'ON        (   jte1.app_id    = jan1.app_id ' . '          AND jte1.id        = jan1.default_tree_id ' . '          AND jte1.published = true ' . '          AND jte1.access    IN ' . $userAccessLevels . ' ' . '          ) ' . 'JOIN      #__joaktree_persons           jpn2 ' . 'ON        (   jpn2.app_id = jet.app_id ' . '          AND jpn2.id     = jet.person_id_2 ' . '          ) ' . 'JOIN      #__joaktree_admin_persons     jan2 ' . 'ON        (   jan2.app_id    = jpn2.app_id ' . '          AND jan2.id        = jpn2.id ' . '          AND jan2.published = true ' . ($personStatus == 0 ? 'AND jan2.living = false ' : ' ') . ($personStatus == 1 ? 'AND jan2.living = true ' : ' ') . '          AND (  (jan2.living = false AND ' . $displayAccess['NAMEname']->notLiving . ' = 2 ) ' . '              OR (jan2.living = true  AND ' . $displayAccess['NAMEname']->living . '    = 2 ) ' . '              ) ' . '          ) ' . 'JOIN      #__joaktree_trees             jte2 ' . 'ON        (   jte2.app_id    = jan2.app_id ' . '          AND jte2.id        = jan2.default_tree_id ' . '          AND jte2.published = true ' . '          AND jte2.access    IN ' . $userAccessLevels . ' ' . '          ) ' . 'JOIN      #__joaktree_display_settings  jds ' . 'ON        (   jds.code = jet.code ' . '          AND jds.level = ' . $this->_db->quote('relation') . ' ' . '          AND jds.published = true ' . '          AND (  (   jan1.living = false ' . '                 AND jan2.living = false ' . '                 AND jds.access  IN ' . $userAccessLevels . ' ' . '                 ) ' . '              OR (   (  jan1.living = true ' . '                     OR jan2.living = true ' . '                     ) ' . '                 AND jds.accessLiving IN ' . $userAccessLevels . ' ' . '                 ) ' . '              ) ' . '          ) ' . $where . ' ) ' . $order . ' ';
     $this->_db->setQuery($query, 0, $limit);
     $temp = $this->_db->loadObjectList();
     if (count($temp)) {
         // get menuId & technology
         $menus = JoaktreeHelper::getMenus('joaktree');
         $technology = JoaktreeHelper::getTechnology();
         $linkBase = 'index.php?option=com_joaktree&view=joaktree&tech=' . $technology . '';
         $robot = $technology == 'a' ? '' : 'rel="noindex, nofollow"';
         foreach ($temp as $row) {
             $menuItemId = $menus[$row->treeId];
             $row->route = JRoute::_($linkBase . '&Itemid=' . $menuItemId . '&treeId=' . $row->treeId . '&personId=' . $row->appId . '!' . $row->personId);
             $row->robot = $robot;
             $row->yearsago = $today['year'] - (int) $row->eventyear;
             $tmp = ucwords(strtolower($row->eventdate));
             $row->eventday = substr(JoaktreeHelper::convertDateTime($tmp), 0, -4);
             $row->eventdate = JoaktreeHelper::displayDate($row->eventdate);
             $row->code = JText::_($row->code);
             $result[] = $row;
         }
     }
     unset($temp);
     return $result;
 }
コード例 #3
0
ファイル: helper.php プロジェクト: Lothurm/J3.x
 function lastUpdateDateTimePerson($dateTime)
 {
     static $_lastUpdateDateTimePerson;
     if (!isset($_lastUpdateDateTimePerson)) {
         // Load the parameters.
         $params = self::getJTParams();
         $showUpdate = $params->get('show_update');
         if ($showUpdate == 'N' or $dateTime == null) {
             $_lastUpdateDateTimePerson = null;
         } else {
             $_lastUpdateDateTimePerson = JText::_('JT_LASTUPDATED') . ': ' . JoaktreeHelper::convertDateTime($dateTime);
         }
     }
     return $_lastUpdateDateTimePerson;
 }