コード例 #1
0
ファイル: joaktreestart.php プロジェクト: Lothurm/J3.x
 private function _buildQuery()
 {
     $params = JoaktreeHelper::getJTParams();
     //JComponentHelper::getParams('com_joaktree') ;
     $abbreviation = (int) $params->get('abbreviation', 0);
     $levels = JoaktreeHelper::getUserAccessLevels();
     $displayAccess = JoaktreeHelper::getDisplayAccess();
     if ($abbreviation == null or $abbreviation <= 0) {
         // no abbreviation of names
         $displayFamilyName = JoaktreeHelper::getConcatenatedDutchFamilyName(false);
     } else {
         // abbreviation on n characters, where n = $abbreviation
         $displayFamilyName = 'SUBSTR( ' . JoaktreeHelper::getConcatenatedDutchFamilyName(false) . ' ' . '      , 1 ' . '      , ' . $abbreviation . ' ' . '      )';
     }
     $query = $this->_db->getQuery(true);
     $query->select(' COUNT(' . $displayFamilyName . ') AS nameCount ');
     $query->select(' ' . $displayFamilyName . ' AS familyName ');
     $query->from(' #__joaktree_tree_persons jtp ');
     $query->innerJoin(' #__joaktree_trees        jte ' . ' ON (   jte.app_id = jtp.app_id ' . '    AND jte.id     = jtp.tree_id ' . '    ) ');
     $query->innerJoin(' #__joaktree_persons      jpn ' . ' ON (   jpn.app_id = jtp.app_id ' . '    AND jpn.id     = jtp.person_id ' . '    ) ');
     $query->innerJoin(JoaktreeHelper::getJoinAdminPersons(false));
     // Get the WHERE clauses for the query
     $wheres = $this->_buildContentWhere();
     foreach ($wheres as $where) {
         $query->where(' ' . $where . ' ');
     }
     // GROUP BY
     $query->group(' ' . $displayFamilyName . ' ');
     return $query;
 }