Exemple #1
0
	<div class="smfaq-print"><?php 
    echo JHtml::_('link', $print_link, JText::_('COM_SMFAQ_PRINT_VIEW'), array('rel' => 'nofollow', 'target' => '_blank'));
    ?>
</div>
	<div style="clear: both"></div>
<?php 
}
?>

<?php 
// Вывод вопросов
foreach ($this->items as $item) {
    ?>
			<?php 
    if (isset($as_link)) {
        $link = JRoute::_(SmfaqHelperRoute::getQuestionRoute($this->category->id, $item->id));
        ?>
				<div class="question-link">
				<a href="<?php 
        echo $link;
        ?>
"><?php 
        echo $this->escape($item->question);
        ?>
</a>
				</div>
			<?php 
        continue;
        ?>
			<?php 
    }
Exemple #2
0
 * @license		GNU/GPL v.3 see http://www.gnu.org/licenses/gpl.html
 */
// защита от прямого доступа
defined('_JEXEC') or die('@-_-@');
//Created date and author question
$author = $this->params->get('show_created_date') || $this->params->get('show_created_by');
$ans = $this->params->get('show_answer_created_by') || $this->params->get('show_answer_created_date');
$canEdit = $this->user->authorise('core.edit', 'com_smfaq.category.' . $this->item->catid);
?>

<div id="smfaq">
<?php 
if ($this->params->get('show_print', 0)) {
    ?>
	<?php 
    $print_link = JRoute::_(SmfaqHelperRoute::getQuestionRoute($this->item->catid, $this->item->id) . '&tmpl=component&print=1');
    ?>
	<div class="smfaq-print"><?php 
    echo JHtml::_('link', $print_link, JText::_('COM_SMFAQ_PRINT_VIEW'), array('rel' => 'nofollow', 'target' => '_blank'));
    ?>
</div>
	<div style="clear: both"></div>
<?php 
}
?>
<h1 class="single_question"><?php 
echo $this->item->question;
?>
</h1>
<div id="a<?php 
echo $this->item->id;
Exemple #3
0
 /**
  * Smfaq Search method
  *
  * The sql must return the following fields that are used in a common display
  * routine: href, title, section, created, text, browsernav
  * @param string 	Target search string
  * @param string 	mathcing option, exact|any|all
  * @param string 	ordering option, newest|oldest|popular|alpha|category
  * @param mixed 	An array if the search it to be restricted to areas, null if search all
  */
 public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     require_once JPATH_SITE . '/components/com_smfaq/helpers/route.php';
     require_once JPATH_SITE . '/components/com_smfaq/router.php';
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $db = JFactory::getDbo();
     $limit = $this->params->get('search_limit', 50);
     $result_link = $this->params->get('result_link', 1);
     switch ($phrase) {
         case 'exact':
             $text = $db->quote('%' . $text . '%', true);
             $wheres2 = array();
             $wheres2[] = 'a.question LIKE ' . $text;
             $wheres2[] = 'a.answer LIKE ' . $text;
             $wheres2[] = 'a.metakey LIKE ' . $text;
             $wheres2[] = 'a.metadesc LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->quote('%' . $text . '%', true);
                 $wheres2 = array();
                 $wheres2[] = 'a.question LIKE ' . $word;
                 $wheres2[] = 'a.answer LIKE ' . $word;
                 $wheres2[] = 'a.metakey LIKE ' . $word;
                 $wheres2[] = 'a.metadesc LIKE ' . $word;
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     switch ($ordering) {
         case 'oldest':
             $order = 'a.created ASC';
             break;
         case 'alpha':
             $order = 'a.question ASC';
             break;
         case 'category':
             $order = 'c.title ASC, a.question ASC';
             break;
         case 'popular':
         case 'newest':
         default:
             $order = 'a.created DESC';
             break;
     }
     $query = $db->getQuery(true);
     $case_when = ' CASE WHEN ';
     $case_when .= $query->charLength('c.alias');
     $case_when .= ' THEN ';
     $c_id = $query->castAsChar('c.id');
     $case_when .= $query->concatenate(array($c_id, 'c.alias'), ':');
     $case_when .= ' ELSE ';
     $case_when .= $c_id . ' END as catslug';
     $query->select('a.id, a.question AS title, a.answer AS text, a.created, a.metakey, a.metadesc, c.title AS section, ' . $case_when);
     $query->where('(' . $where . ' AND a.published = 1 AND c.published = 1 )');
     $query->from('#__smfaq AS a');
     $query->join('INNER', '#__categories AS c ON c.id=a.catid AND extension=' . $db->quote('com_smfaq'));
     $query->group('a.id,  a.question, a.answer, a.metadesc, a.metakey, a.created, c.title, c.alias, c.id');
     $query->order($order);
     $db->setQuery($query, 0, $limit);
     $list = $db->loadObjectList();
     if ($list) {
         foreach ($list as $key => $item) {
             if ($result_link) {
                 $list[$key]->href = JRoute::_(SmfaqHelperRoute::getQuestionRoute($item->catslug, $item->id));
             } else {
                 $list[$key]->href = JRoute::_(SmfaqHelperRoute::getCategoryRoute($item->catslug) . '&limit=0#p' . $item->id);
             }
             $list[$key]->browsernav = true;
         }
     }
     return $list;
 }