コード例 #1
0
ファイル: view.html.php プロジェクト: Lothurm/J3.x
 function display($tpl = null)
 {
     $params = JoaktreeHelper::getJTParams();
     $document =& JFactory::getDocument();
     // set up style sheets and javascript files
     JHTML::stylesheet(JoaktreeHelper::joaktreecss());
     JHTML::stylesheet(JoaktreeHelper::joaktreecss($params->get('theme')));
     // 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'] = JoaktreeHelper::lastUpdateDateTimePerson($this->person->lastUpdateDate);
     // copyright
     $lists['CR'] = JoaktreeHelper::getJoaktreeCR();
     $this->assignRef('personId', $personId);
     $this->assignRef('lists', $lists);
     if ($lists['userAccess']) {
         // set title, meta title
         $document->setTitle($this->person->fullName);
         $document->setMetadata('title', $this->person->fullName);
         // set additional meta tags
         if ($params->get('menu-meta_description')) {
             $document->setDescription($params->get('menu-meta_description'));
         }
         if ($params->get('menu-meta_keywords')) {
             $document->setMetadata('keywords', $params->get('menu-meta_keywords'));
         }
         // robots
         if ($this->person->robots > 0) {
             $document->setMetadata('robots', JoaktreeHelper::stringRobots($this->person->robots));
         } else {
             if ($params->get('robots')) {
                 $document->setMetadata('robots', $params->get('robots'));
             }
         }
     }
     parent::display($tpl);
 }
コード例 #2
0
ファイル: tree.php プロジェクト: Lothurm/J3.x
 public function getArticles($tree_id)
 {
     // general input
     $app = JFactory::getApplication();
     $languageFilter = $app->getLanguageFilter();
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     // get user access info
     $levels = JoaktreeHelper::getUserAccessLevels();
     // initialization
     $retArticles = array();
     $nullDate = $db->getNullDate();
     $date = JFactory::getDate();
     $now = $date->toSql();
     //remove single space after commas in keywords
     $attribs = array();
     $attribs[] = '","';
     $attribs[] = 'REPLACE( a.metakey, ", ", "," )';
     $attribs[] = '","';
     $concat = $query->concatenate($attribs, ',');
     // end concats
     // select from content
     $query->select(' a.id             AS id ');
     $query->select(' a.title          AS title ');
     $query->select(' a.introtext      AS introtext ');
     $query->select(' a.fulltext       AS \'fulltext\' ');
     $query->select(' DATE_FORMAT( a.modified, "%e %b %Y" ) AS modified  ');
     $query->select(' a.attribs        AS attribs ');
     $query->from(' #__content       AS a ');
     $query->where(' a.state           = 1 ');
     $query->where(' a.access         IN ' . $levels . ' ');
     $query->where(' (   a.publish_up   =  ' . $db->Quote($nullDate) . ' ' . '  OR  a.publish_up   <= ' . $db->Quote($now) . ' ' . '  ) ');
     $query->where(' (   a.publish_down =  ' . $db->Quote($nullDate) . ' ' . '  OR  a.publish_down >= ' . $db->Quote($now) . ' ' . '  ) ');
     // Filter by language
     if ($languageFilter) {
         $query->where('a.language in  (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ') ');
     }
     // select from categories
     // join with tree to find matching category
     $query->select(' cc.id            AS cat_id ');
     $query->innerJoin(' #__categories       AS cc ' . ' ON (   cc.id        = a.catid ' . '    AND cc.access    IN ' . $levels . ' ' . '    ) ');
     $query->innerJoin(' #__joaktree_trees   AS jte ' . ' ON (   cc.id        = jte.catid ' . '    AND jte.id       = ' . (int) $tree_id . ' ' . '    ) ');
     $db->setQuery($query);
     $articles = $db->loadObjectList();
     foreach ($articles as $article) {
         // Convert parameter fields to objects for article.
         if (isset($article->attribs)) {
             $registry = new JRegistry();
             $registry->loadString($article->attribs);
             $indIntrotext = (int) $registry->get('show_intro', 1);
             $article->showTitle = (int) $registry->get('show_title', 1);
         } else {
             $indIntrotext = 0;
             $article->showTitle = 1;
         }
         // Are we showing introtext with the article
         if ($indIntrotext == 1) {
             $article->text = $article->introtext . chr(13) . chr(13) . $article->fulltext;
         } elseif (!empty($article->fulltext)) {
             $article->text = $article->fulltext;
         } else {
             $article->text = $article->introtext;
         }
         // formating last update date
         if (!empty($article->modified)) {
             $article->modified = JoaktreeHelper::lastUpdateDateTimePerson($article->modified);
         }
         // check content using the content plugin - if it is available
         $plug = JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'joaktree' . DS . 'joaktree.php';
         // check if plugin file exists - only then we will use it
         if (JFile::exists($plug)) {
             // load the plugin
             JLoader::register('plgContentJoaktree', $plug);
             $params = array();
             plgContentJoaktree::onContentPrepare('com_content', $article, $params);
         }
         $retArticles[] = $article;
     }
     return $retArticles;
 }
コード例 #3
0
ファイル: view.html.php プロジェクト: Lothurm/J3.x
 function display($tpl = null)
 {
     // Load the parameters.
     $model = $this->getModel();
     $this->params = JoaktreeHelper::getJTParams();
     $document =& JFactory::getDocument();
     if ($this->params->get('siteedit', 1)) {
         $canDo = JoaktreeHelper::getActions();
     } else {
         $canDo = null;
     }
     // Find the value for tech
     $technology = $this->get('technology');
     // set up style sheets and javascript files
     JHTML::stylesheet(JoaktreeHelper::joaktreecss());
     JHTML::stylesheet(JoaktreeHelper::joaktreecss($this->params->get('theme')));
     // Set up shadowbox
     JHTML::stylesheet(JoaktreeHelper::shadowboxcss());
     $document->addScript(JoaktreeHelper::shadowboxjs());
     // Set up modal behavior
     JHtml::_('behavior.modal', 'a.modal');
     if ($technology != 'b') {
         // javascript template - no ajax
         // default template includes ajax
         JHTML::stylesheet(JoaktreeHelper::briaskcss());
         $document->addScript(JoaktreeHelper::joaktreejs('mod_briaskISS.js'));
         $document->addScript(JoaktreeHelper::joaktreejs('toggle.js'));
     }
     if ($technology != 'b' and $technology != 'j') {
         // default template includes ajax
         $document->addScript(JoaktreeHelper::joaktreejs('jtajax.js'));
     }
     // Access
     $lists['userAccess'] = $this->get('access');
     $lists['technology'] = $technology;
     $edit = $this->get('action');
     $lists['edit'] = $edit == 'edit' ? true : false;
     // Person
     $this->person = $this->get('person');
     $model->setCookie();
     $Html['lineage'] = $this->showLineage();
     $lists['showAncestors'] = (int) $this->params->get('ancestorchart', 0);
     $lists['showDescendants'] = (int) $this->params->get('descendantchart', 0);
     $lists['numberArticles'] = $this->person->getArticleCount();
     // Pictures
     $Html['pictures'] = $this->showPictures();
     $lists['nextDelay'] = round((int) $this->params->get('nextDelay', 0) / 1000, 3);
     $lists['transDelay'] = round((int) $this->params->get('transDelay', 0) / 1000, 3);
     // Static map
     if ($this->person->map == 1) {
         $Html['staticmap'] = $this->person->getStaticMap();
         $lists['indStaticMap'] = $Html['staticmap'] ? true : false;
     }
     // Interactive map
     if ($this->person->map == 2) {
         $Html['interactivemap'] = $this->person->getInteractiveMap();
         $lists['indInteractiveMap'] = $Html['interactivemap'] ? true : false;
         $lists['pxHeightMap'] = (int) $this->params->get('pxHeight', 0);
     }
     // last update
     $lists['showUpdate '] = $this->params->get('show_update');
     if ($lists['showUpdate '] != 'N') {
         $lists['lastUpdate'] = JoaktreeHelper::lastUpdateDateTimePerson($this->person->lastUpdateDate);
         $lists['showchange'] = (int) $this->params->get('indLogging', 0);
     }
     // copyright
     $lists['CR'] = JoaktreeHelper::getJoaktreeCR();
     //return
     $retObject = new stdClass();
     $retObject->object = 'prsn';
     $retObject->app_id = $this->person->app_id;
     $retObject->object_id = $this->person->id;
     $lists['retId'] = base64_encode(json_encode($retObject));
     // tab behavior
     if ((int) $this->params->get('indTabBehavior') == 1) {
         $lists['action'] = 'onClick';
     } else {
         $lists['action'] = 'onMouseOver';
     }
     $this->assignRef('Html', $Html);
     $this->assignRef('canDo', $canDo);
     $this->assignRef('lists', $lists);
     if ($lists['userAccess']) {
         // set title, meta title
         $title = $this->person->firstName . ' ' . $this->person->familyName;
         $document->setTitle($title);
         $document->setMetadata('title', $title);
         // set additional meta tags
         if ($this->params->get('menu-meta_description')) {
             $document->setDescription($this->params->get('menu-meta_description'));
         }
         if ($this->params->get('menu-meta_keywords')) {
             $document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
         }
         // robots
         if ($this->person->robots > 0) {
             $document->setMetadata('robots', JoaktreeHelper::stringRobots($this->person->robots));
         } else {
             if ($this->params->get('robots')) {
                 $document->setMetadata('robots', $this->params->get('robots'));
             }
         }
     }
     parent::display($tpl);
 }
コード例 #4
0
ファイル: person.php プロジェクト: Lothurm/J3.x
 public function getArticle($id, $app_id, $person_id, $type)
 {
     $articleId = (int) $id;
     $app_id = (int) $app_id;
     $person_id = $this->_db->escape(substr($person_id, 0, (int) JoaktreeHelper::getIdlength()));
     $query = $this->_db->getQuery(true);
     if ($type == 'article') {
         // select from content
         $query->select(' a.id             AS id ');
         $query->select(' a.title          AS title ');
         $query->select(' a.introtext      AS introtext ');
         $query->select(' a.fulltext       AS \'fulltext\' ');
         $query->select(' DATE_FORMAT( a.modified, "%e %b %Y" ) AS modified  ');
         $query->select(' a.attribs        AS attribs ');
         $query->from(' #__content       AS a ');
         $query->where(' a.state           = 1 ');
         $query->where(' a.access         IN ' . $this->_levels . ' ');
         $query->where(' a.id             = ' . $articleId . ' ');
         // Filter by language
         if ($this->languageFilter) {
             $query->where('a.language in  (' . $this->_db->Quote(JFactory::getLanguage()->getTag()) . ',' . $this->_db->Quote('*') . ') ');
         }
         // select from categories
         $query->select(' cc.id            AS cat_id ');
         $query->leftJoin(' #__categories    AS cc ' . ' ON (   cc.id        = a.catid ' . '    AND cc.published = 1 ' . '    AND cc.access    IN ' . $this->_levels . ' ' . '    ) ');
     } else {
         if ($type == 'note') {
             $params = JoaktreeHelper::getJTParams();
             $titleLength = (int) $params->get('notetitlelength', 0);
             // prepare title
             // 1. Trim the title to "titlelength" after first space and remove , (if present)
             $tmp = ' TRIM( TRAILING ' . $this->_db->Quote(',') . ' FROM ' . '       RTRIM( SUBSTRING( IFNULL( jne.value, jpn.value ) ' . '                       , 1 ' . '                       , LOCATE( ' . $this->_db->Quote(' ') . ' ' . '                               , IFNULL( jne.value, jpn.value ) ' . '                               , ' . $titleLength . ' ' . '                               ) ' . '                       ) ' . '            ) ' . '     ) ';
             // 2. Concatenat the trimmed text with ....
             $attribs = array();
             $attribs[] = $tmp;
             $attribs[] = $this->_db->Quote(' ...');
             $concat = $query->concatenate($attribs);
             // end prepare title
             $query->select(' jpn.orderNumber                 AS id ');
             $query->select(' IF( ' . $titleLength . ' = 0 ' . '   , ' . $this->_db->Quote(JText::_('JT_NOTE')) . ' ' . '   , ' . $concat . ' ' . '   )  AS title ');
             $query->select(' IFNULL( jne.value, jpn.value )  AS introtext ');
             $query->select(' NULL                            AS \'fulltext\' ');
             $query->select(' jpn.person_id                   AS cat_id ');
             $query->select(' NULL                            AS modified ');
             $query->from(' #__joaktree_person_notes        AS jpn ');
             $query->leftJoin(' #__joaktree_notes               AS jne ' . ' ON (   jne.app_id = jpn.app_id ' . '    AND jne.id     = jpn.note_id ' . '    ) ');
             $query->where(' jpn.app_id       = ' . $app_id . ' ');
             $query->where(' jpn.person_id    = ' . $this->_db->Quote($person_id) . ' ');
             $query->where(' jpn.orderNumber  = ' . $articleId . ' ');
         }
     }
     $this->_db->setQuery($query);
     $article = $this->_db->loadObject();
     // Convert parameter fields to objects for article.
     if (isset($article->attribs)) {
         $registry = new JRegistry();
         $registry->loadString($article->attribs);
         $indIntrotext = $registry->get('show_intro', '1');
     } else {
         $indIntrotext = '0';
     }
     // Are we showing introtext with the article
     if ($indIntrotext == '1') {
         $article->text = $article->introtext . chr(13) . chr(13) . $article->fulltext;
     } elseif (!empty($article->fulltext)) {
         $article->text = $article->fulltext;
     } else {
         $article->text = $article->introtext;
     }
     // formating last update date
     if (!empty($article->modified)) {
         $article->modified = JoaktreeHelper::lastUpdateDateTimePerson($article->modified);
     }
     if ($type == 'article') {
         // check content using the content plugin - if it is available
         $plug = JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'joaktree' . DS . 'joaktree.php';
         // check if plugin file exists - only then we will use it
         if (JFile::exists($plug)) {
             // load the plugin
             JLoader::register('plgContentJoaktree', $plug);
             $params = array();
             plgContentJoaktree::onContentPrepare('com_content', $article, $params);
         }
     }
     return $article;
 }