case "docs": #$doc_links ="<a href=\"doc/javadoc\" target=\"_blank\">Javadocs</a><br>"; #$doc_links .="<a href=\"doc/phpdoc\" target=\"_blank\">PHPdocs</a>"; #$template->setVariable("TITLE", "Dokumentation zur Software dieses Projektes"); $template->setVariable("CONTENT", Documentation::getContent($template)); break; case "screenshots": $browsertitle = $_SESSION['translate']->it('SCREENSHOT_BROWSER_TITLE'); $browseralt = $_SESSION['translate']->it('SCREENSHOT_BROWSER_ALT'); $projectstitle = $_SESSION['translate']->it('SCREENSHOT_PROJECTS_TITLE'); $projectsalt = $_SESSION['translate']->it('SCREENSHOT_PROJECTS_ALT'); $html = "<b>{$projectstitle}</b><br><img src=\"images\\Projects_Shot.jpg\" alt=\"{$projectsalt}\"><br><br>"; $html .= "<b>{$browsertitle}</b><br><img src=\"images\\Browser_Shot.jpg\" alt=\"{$browseralt}\">"; $template->setVariable("CONTENT", $html); break; case "faq": $template->setVariable("TITLE", $_SESSION['translate']->it('FAQs')); $template->setVariable("CONTENT", FAQ::getContent($template)); break; case "hall_of_fame": $template->setVariable("TITLE", $_SESSION['translate']->it('HALL_OF_FAME_TITLE')); $template->setVariable("CONTENT", $_SESSION['translate']->it('HALL_OF_FAME_CONTENT')); break; default: //Welcome-Message $template->setVariable("TITLE", $_SESSION['translate']->it('MAIN_PAGE_TITLE')); $template->setVariable("CONTENT", $_SESSION['translate']->it('MAIN_PAGE_CONTENT')); } /* end switch */ $template->parse(); $content = $template->show();
function __construct($end_switch = false) { CORE::summon(__FILE__); if ($end_switch) { self::$endClass = __CLASS__ . "_BACKEND"; } else { self::$endClass = __CLASS__ . "_FRONTEND"; } new self::$endClass(); }
/** * Avoids creating new categories if not found in the root taxonomy * It will get the right CategoryID link, or leave the FAQ without categories. */ public static function getCategoryByName(&$obj, $val, $record) { $val = trim($val); $root = FAQ::getRootCategory(); if (!$root || !$root->exists()) { return null; } $category = $root->getChildDeep(array('Name' => trim($val))); if ($category && $category->exists()) { $obj->CategoryID = $category->ID; $obj->write(); } }
/** * Adds FAQ fields to the index */ public function init() { // Add classes $this->addClass('FAQ'); // Add fields $this->addFulltextField('Question'); $this->addFulltextField('Answer'); $this->addFulltextField('Keywords'); // category filter $this->addFilterField('Category.ID'); // Add field boosting $this->setFieldBoosting('FAQ_Question', FAQ::config()->question_boost); $this->setFieldBoosting('FAQ_Answer', FAQ::config()->answer_boost); $this->setFieldBoosting('FAQ_Keywords', FAQ::config()->keywords_boost); }
function faq($id, $format = 'html') { //XXX: user ajax->getThisStaff() (nolint) global $thisstaff; include_once INCLUDE_DIR . 'class.faq.php'; if (!($faq = FAQ::lookup($id))) { return null; } //TODO: $f*g->getJSON() for json format. (nolint) $resp = sprintf('<div style="width:650px;"> <strong>%s</strong><p>%s</p> <div class="faded">Last updated %s</div> <hr> <a href="faq.php?id=%d">View</a> | <a href="faq.php?id=%d">Attachments (%s)</a>', $faq->getQuestion(), Format::safe_html($faq->getAnswer()), Format::db_daydatetime($faq->getUpdateDate()), $faq->getId(), $faq->getId(), $faq->getNumAttachments()); if ($thisstaff && $thisstaff->canManageFAQ()) { $resp .= sprintf(' | <a href="faq.php?id=%d&a=edit">Edit</a>', $faq->getId()); } $resp .= '</div>'; return $resp; }
<?php require_once '../../bootstrap.php'; $user = new User(); // checks if user is logged in and is a administrator if (!$user->isLoggedIn() || !$user->isAdmin()) { // user is no admin or not logged in exit; } $faq = new FAQ(); // Add FAQ entry if (isset($_POST['new_faq_question']) && strlen($_POST['new_faq_question']) < 255 && isset($_POST['new_faq_answer'])) { $question = strip_tags($_POST['new_faq_question']); $answer = strip_tags($_POST['new_faq_answer']); if ($faq->addFAQ($question, $answer)) { echo json_encode(true); exit; } } // Delete FAQ entry if (isset($_POST['faq_id']) && is_numeric($_POST['faq_id']) && isset($_POST['faq_delete']) && $_POST['faq_delete'] == "1") { $faq_id = intval($_POST['faq_id']); if ($faq->deleteFAQ($faq_id)) { echo json_encode(true); exit; } } // Edit FAQ entry if (isset($_POST['faq_question']) && strlen($_POST['faq_question']) < 255 && isset($_POST['faq_answer']) && isset($_POST['faq_id']) && is_numeric($_POST['faq_id'])) { $faq_id = intval($_POST['faq_id']); $question = strip_tags($_POST['faq_question']);
$tpl->assign("result", FAQ::update()); } elseif (@$HTTP_POST_VARS["cat"] == "delete") { FAQ::remove(); } elseif (!empty($HTTP_GET_VARS['prj_id'])) { $tpl->assign("info", array('faq_prj_id' => $HTTP_GET_VARS['prj_id'])); $backend_uses_support_levels = Customer::doesBackendUseSupportLevels($HTTP_GET_VARS['prj_id']); $tpl->assign("backend_uses_support_levels", $backend_uses_support_levels); if ($backend_uses_support_levels) { $tpl->assign("support_levels", Customer::getSupportLevelAssocList($HTTP_GET_VARS['prj_id'])); } } if (@$HTTP_GET_VARS["cat"] == "edit") { $info = FAQ::getDetails($HTTP_GET_VARS["id"]); if (!empty($HTTP_GET_VARS['prj_id'])) { $info['faq_prj_id'] = $HTTP_GET_VARS['prj_id']; } $backend_uses_support_levels = Customer::doesBackendUseSupportLevels($info['faq_prj_id']); $tpl->assign("backend_uses_support_levels", $backend_uses_support_levels); if ($backend_uses_support_levels) { $tpl->assign("support_levels", Customer::getSupportLevelAssocList($info['faq_prj_id'])); } $tpl->assign("info", $info); } elseif (@$HTTP_GET_VARS["cat"] == "change_rank") { FAQ::changeRank($HTTP_GET_VARS['id'], $HTTP_GET_VARS['rank']); } $tpl->assign("list", FAQ::getList()); $tpl->assign("project_list", Project::getAll()); } else { $tpl->assign("show_not_allowed_msg", true); } $tpl->displayTemplate();
<?php if (!defined('OSTCLIENTINC')) { die('Access Denied'); } if ($_REQUEST['q'] || $_REQUEST['cid'] || $_REQUEST['topicId']) { //Search $faqs = FAQ::allPublic()->annotate(array('attachment_count' => SqlAggregate::COUNT('attachments'), 'topic_count' => SqlAggregate::COUNT('topics')))->order_by('question'); if ($_REQUEST['cid']) { $faqs->filter(array('category_id' => $_REQUEST['cid'])); } if ($_REQUEST['topicId']) { $faqs->filter(array('topics__topic_id' => $_REQUEST['topicId'])); } if ($_REQUEST['q']) { $faqs->filter(Q::ANY(array('question__contains' => $_REQUEST['q'], 'answer__contains' => $_REQUEST['q'], 'keywords__contains' => $_REQUEST['q'], 'category__name__contains' => $_REQUEST['q'], 'category__description__contains' => $_REQUEST['q']))); } include CLIENTINC_DIR . 'kb-search.inc.php'; } else { //Category Listing. include CLIENTINC_DIR . 'kb-categories.inc.php'; }
<?php /********************************************************************* kb.inc.php File included on every knowledgebase file. Peter Rotich <*****@*****.**> Copyright (c) 2006-2013 osTicket http://www.osticket.com Released under the GNU General Public License WITHOUT ANY WARRANTY. See LICENSE.TXT for details. vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ require_once '../client.inc.php'; require_once INCLUDE_DIR . 'class.faq.php'; /* Bail out if knowledgebase is disabled or if we have no public-published FAQs. */ if (!$cfg || !$cfg->isKnowledgebaseEnabled() || !FAQ::countPublishedFAQs()) { header('Location: ../'); exit; } $nav = new UserNav($thisclient, 'kb');
/** * Method used to quickly change the ranking of a faq entry * from the administration screen. * * @access public * @param integer $faq_id The faq entry ID * @param string $rank_type Whether we should change the entry down or up (options are 'asc' or 'desc') * @return boolean */ function changeRank($faq_id, $rank_type) { // check if the current rank is not already the first or last one $ranking = FAQ::_getRanking(); $ranks = array_values($ranking); $ids = array_keys($ranking); $last = end($ids); $first = reset($ids); if ($rank_type == 'asc' && $faq_id == $first || $rank_type == 'desc' && $faq_id == $last) { return false; } if ($rank_type == 'asc') { $diff = -1; } else { $diff = 1; } $new_rank = $ranking[$faq_id] + $diff; if (in_array($new_rank, $ranks)) { // switch the rankings here... $index = array_search($new_rank, $ranks); $replaced_faq_id = $ids[$index]; $stmt = "UPDATE\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "faq\n SET\n faq_rank=" . $ranking[$faq_id] . "\n WHERE\n faq_id=" . $replaced_faq_id; $GLOBALS["db_api"]->dbh->query($stmt); } $stmt = "UPDATE\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "faq\n SET\n faq_rank=" . $new_rank . "\n WHERE\n faq_id=" . $faq_id; $GLOBALS["db_api"]->dbh->query($stmt); return true; }
function save($id, $vars, &$errors, $validation = false) { //Cleanup. $vars['question'] = Format::striptags(trim($vars['question'])); //validate if ($id && $id != $vars['id']) { $errors['err'] = __('Internal error. Try again'); } if (!$vars['question']) { $errors['question'] = __('Question required'); } elseif (($qid = self::findIdByQuestion($vars['question'])) && $qid != $id) { $errors['question'] = __('Question already exists'); } if (!$vars['category_id'] || !($category = Category::lookup($vars['category_id']))) { $errors['category_id'] = __('Category is required'); } if (!$vars['answer']) { $errors['answer'] = __('FAQ answer is required'); } if ($errors || $validation) { return !$errors; } //save $sql = ' updated=NOW() ' . ', question=' . db_input($vars['question']) . ', answer=' . db_input(Format::sanitize($vars['answer'], false)) . ', category_id=' . db_input($vars['category_id']) . ', ispublished=' . db_input(isset($vars['ispublished']) ? $vars['ispublished'] : 0) . ', notes=' . db_input(Format::sanitize($vars['notes'])); if ($id) { $sql = 'UPDATE ' . FAQ_TABLE . ' SET ' . $sql . ' WHERE faq_id=' . db_input($id); if (db_query($sql)) { return true; } $errors['err'] = sprintf(__('Unable to update %s.'), __('this FAQ article')); } else { $sql = 'INSERT INTO ' . FAQ_TABLE . ' SET ' . $sql . ',created=NOW()'; if (db_query($sql) && ($id = db_insert_id())) { Signal::send('model.created', FAQ::lookup($id)); return $id; } $errors['err'] = sprintf(__('Unable to create %s.'), __('this FAQ article')) . ' ' . __('Internal error occurred'); } return false; }
<?php include 'admin_header.php'; $view = new View(); $user = new User(); $faq = new FAQ(); $faq_array = $faq->getFAQ(); ?> <!-- content wrapper --> <div class="container-full"> <!-- page row --> <div class="row"> <!-- sidebar --> <div class="col-sm-2 sidebar-wrapper"> <ul class="sidebar-nav"> <li class="sidebar-brand"> <a href="#"> Admin </a> </li> <!-- shows the categories as list elements --> <?php $view->showAdminMenu(); ?> </ul> </div> <!-- /.sidebar --> <!-- content -->
FAQs Clients' interface.. Peter Rotich <*****@*****.**> Copyright (c) 2006-2013 osTicket http://www.osticket.com Released under the GNU General Public License WITHOUT ANY WARRANTY. See LICENSE.TXT for details. vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ require 'kb.inc.php'; require_once INCLUDE_DIR . 'class.faq.php'; $faq = $category = null; if ($_REQUEST['id'] && !($faq = FAQ::lookup($_REQUEST['id']))) { $errors['err'] = sprintf(__('%s: Unknown or invalid'), __('FAQ article')); } if (!$faq && $_REQUEST['cid'] && !($category = Category::lookup($_REQUEST['cid']))) { $errors['err'] = sprintf(__('%s: Unknown or invalid'), __('FAQ category')); } $inc = 'knowledgebase.inc.php'; //FAQs landing page. if ($faq && $faq->isPublished()) { $inc = 'faq.inc.php'; } elseif ($category && $category->isPublic() && $_REQUEST['a'] != 'search') { $inc = 'faq-category.inc.php'; } require_once CLIENTINC_DIR . 'header.inc.php'; require_once CLIENTINC_DIR . $inc; require_once CLIENTINC_DIR . 'footer.inc.php';
**********************************************************************/ require 'staff.inc.php'; require_once INCLUDE_DIR . 'class.faq.php'; $faq = $category = null; if ($_REQUEST['id'] && !($faq = FAQ::lookup($_REQUEST['id']))) { $errors['err'] = 'Unknown or invalid FAQ'; } if ($_REQUEST['cid'] && !$faq && !($category = Category::lookup($_REQUEST['cid']))) { $errors['err'] = 'Unknown or invalid FAQ category'; } if ($_POST) { $errors = array(); switch (strtolower($_POST['do'])) { case 'create': case 'add': if ($faq = FAQ::add($_POST, $errors)) { $msg = 'FAQ added successfully'; // Delete draft for this new faq Draft::deleteForNamespace('faq', $thisstaff->getId()); } elseif (!$errors['err']) { $errors['err'] = 'Unable to add FAQ. Try again!'; } break; case 'update': case 'edit': if (!$faq) { $errors['err'] = 'Invalid or unknown FAQ'; } elseif ($faq->update($_POST, $errors)) { $msg = 'FAQ updated successfully'; $_REQUEST['a'] = null; //Go back to view
<?php require_once './classes/FAQ.php'; $faq = new FAQ(); $id = $_POST['id']; $list = $faq->get_faq_by_category_id($id); echo $list;
/** * Expose variables to the template. */ public function SelectorCategories() { $baseCategories = array(FAQ::getRootCategory()); $categories = $this->getCategoriesForTemplate($baseCategories); return $categories; }
if (@$_POST['cat'] == 'new') { $res = FAQ::insert(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the FAQ entry was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the FAQ entry.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this FAQ entry.'), Misc::MSG_ERROR), -3 => array(ev_gettext('Please enter the message for this FAQ entry.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { $res = FAQ::update(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the FAQ entry was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the FAQ entry information.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this FAQ entry.'), Misc::MSG_ERROR), -3 => array(ev_gettext('Please enter the message for this FAQ entry.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { FAQ::remove(); } elseif (!empty($_GET['prj_id'])) { $tpl->assign('info', array('faq_prj_id' => $_GET['prj_id'])); if (CRM::hasCustomerIntegration($_GET['prj_id'])) { $crm = CRM::getInstance($_GET['prj_id']); $tpl->assign('support_levels', $crm->getSupportLevelAssocList()); } } if (@$_GET['cat'] == 'edit') { $info = FAQ::getDetails($_GET['id']); if (!empty($_GET['prj_id'])) { $info['faq_prj_id'] = $_GET['prj_id']; } if (CRM::hasCustomerIntegration($info['faq_prj_id'])) { $crm = CRM::getInstance($info['faq_prj_id']); $tpl->assign('support_levels', $crm->getSupportLevelAssocList()); } $tpl->assign('info', $info); } elseif (@$_GET['cat'] == 'change_rank') { FAQ::changeRank($_GET['id'], $_GET['rank']); } $tpl->assign('list', FAQ::getList()); $tpl->assign('project_list', Project::getAll()); $tpl->displayTemplate();
<a href="view.php" class="green button"> <?php echo __('Check Ticket Status'); ?> </a> </div> </div> </div> </div> </div> </div> <?php } ?> <div class="content"><?php $faqs = FAQ::getFeatured()->select_related('category')->limit(5); if ($faqs->all()) { ?> <section><div class="header"><?php echo __('Featured Questions'); ?> </div> <?php foreach ($faqs as $F) { ?> <div><a href="<?php echo ROOT_PATH; ?> kb/faq.php?id=<?php echo urlencode($F->getId()); ?>
/** * Cooperates with the cron system to automatically find content that is * not index in the _search table and add it to the index. */ function IndexOldStuff() { $class = get_class(); $auto_create = function ($db_error) use($class) { if ($db_error != 1146) { // Perform the standard error handling return true; } // Create the search table automatically $class::__init(); }; // THREADS ---------------------------------- $sql = "SELECT A1.`id`, A1.`title`, A1.`body`, A1.`format` FROM `" . TICKET_THREAD_TABLE . "` A1\n LEFT JOIN `" . TABLE_PREFIX . "_search` A2 ON (A1.`id` = A2.`object_id` AND A2.`object_type`='H')\n WHERE A2.`object_id` IS NULL AND (A1.poster <> 'SYSTEM')\n AND (LENGTH(A1.`title`) + LENGTH(A1.`body`) > 0)\n ORDER BY A1.`id` DESC"; if (!($res = db_query_unbuffered($sql, $auto_create))) { return false; } while ($row = db_fetch_row($res)) { $body = ThreadBody::fromFormattedText($row[2], $row[3]); $body = $body->getSearchable(); $title = Format::searchable($row[1]); if (!$body && !$title) { continue; } $record = array('H', $row[0], $title, $body); if (!$this->__index($record)) { return; } } // TICKETS ---------------------------------- $sql = "SELECT A1.`ticket_id` FROM `" . TICKET_TABLE . "` A1\n LEFT JOIN `" . TABLE_PREFIX . "_search` A2 ON (A1.`ticket_id` = A2.`object_id` AND A2.`object_type`='T')\n WHERE A2.`object_id` IS NULL\n ORDER BY A1.`ticket_id` DESC"; if (!($res = db_query_unbuffered($sql, $auto_create))) { return false; } while ($row = db_fetch_row($res)) { $ticket = Ticket::lookup($row[0]); $cdata = $ticket->loadDynamicData(); $content = array(); foreach ($cdata as $k => $a) { if ($k != 'subject' && ($v = $a->getSearchable())) { $content[] = $v; } } $record = array('T', $ticket->getId(), Format::searchable($ticket->getNumber() . ' ' . $ticket->getSubject()), implode("\n", $content)); if (!$this->__index($record)) { return; } } // USERS ------------------------------------ $sql = "SELECT A1.`id` FROM `" . USER_TABLE . "` A1\n LEFT JOIN `" . TABLE_PREFIX . "_search` A2 ON (A1.`id` = A2.`object_id` AND A2.`object_type`='U')\n WHERE A2.`object_id` IS NULL\n ORDER BY A1.`id` DESC"; if (!($res = db_query_unbuffered($sql, $auto_create))) { return false; } while ($row = db_fetch_row($res)) { $user = User::lookup($row[0]); $cdata = $user->getDynamicData(); $content = array(); foreach ($user->emails as $e) { $content[] = $e->address; } foreach ($cdata as $e) { foreach ($e->getAnswers() as $a) { if ($c = $a->getSearchable()) { $content[] = $c; } } } $record = array('U', $user->getId(), Format::searchable($user->getFullName()), trim(implode("\n", $content))); if (!$this->__index($record)) { return; } } // ORGANIZATIONS ---------------------------- $sql = "SELECT A1.`id` FROM `" . ORGANIZATION_TABLE . "` A1\n LEFT JOIN `" . TABLE_PREFIX . "_search` A2 ON (A1.`id` = A2.`object_id` AND A2.`object_type`='O')\n WHERE A2.`object_id` IS NULL\n ORDER BY A1.`id` DESC"; if (!($res = db_query_unbuffered($sql, $auto_create))) { return false; } while ($row = db_fetch_row($res)) { $org = Organization::lookup($row[0]); $cdata = $org->getDynamicData(); $content = array(); foreach ($cdata as $e) { foreach ($e->getAnswers() as $a) { if ($c = $a->getSearchable()) { $content[] = $c; } } } $record = array('O', $org->getId(), Format::searchable($org->getName()), trim(implode("\n", $content))); if (!$this->__index($record)) { return null; } } // KNOWLEDGEBASE ---------------------------- require_once INCLUDE_DIR . 'class.faq.php'; $sql = "SELECT A1.`faq_id` FROM `" . FAQ_TABLE . "` A1\n LEFT JOIN `" . TABLE_PREFIX . "_search` A2 ON (A1.`faq_id` = A2.`object_id` AND A2.`object_type`='K')\n WHERE A2.`object_id` IS NULL\n ORDER BY A1.`faq_id` DESC"; if (!($res = db_query_unbuffered($sql, $auto_create))) { return false; } while ($row = db_fetch_row($res)) { $faq = FAQ::lookup($row[0]); $q = $faq->getQuestion(); if ($k = $faq->getKeywords()) { $q = $k . ' ' . $q; } $record = array('K', $faq->getId(), Format::searchable($q), $faq->getSearchableAnswer()); if (!$this->__index($record)) { return; } } // FILES ------------------------------------ // Flush non-full batch of records $this->__index(null, true); if (!$this->_reindexed) { // Stop rebuilding the index $this->getConfig()->set('reindex', 0); } }
function lookup($id) { return $id && is_numeric($id) && ($obj = new FAQ($id)) && $obj->getId() == $id ? $obj : null; }
<?php /********************************************************************************* ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 * ("License"); You may not use this file except in compliance with the License * The Original Code is: vtiger CRM Open Source * The Initial Developer of the Original Code is vtiger. * Portions created by vtiger are Copyright (C) vtiger. * All Rights Reserved. * ********************************************************************************/ require_once "modules/Faq/Faq.php"; $focus = new FAQ(); //Map the vtiger_fields like ticket column => vtiger_faq column where ticket column is the troubletikcets vtiger_field name & vtiger_faq - column_fields $ticket_faq_mapping_fields = array('title' => 'question', 'product_id' => 'product_id', 'description' => 'faq_answer'); $sql = " select ticketid, title, product_id,vtiger_crmentity.description, solution,vtiger_troubletickets.status, category from vtiger_troubletickets inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_troubletickets.ticketid where ticketid=?"; $res = $adb->pquery($sql, array($_REQUEST['record'])); //set all the ticket values to FAQ foreach ($ticket_faq_mapping_fields as $ticket_column => $faq_column) { $focus->column_fields[$faq_column] = $adb->query_result($res, 0, $ticket_column); } $focus->save("Faq"); if ($focus->id != '') { $description = $adb->query_result($res, 0, 'description'); $solution = $adb->query_result($res, 0, 'solution'); //Add the solution of the ticket with the FAQ answer $answer = $description; if ($solution != '') { $answer .= "\r\n\r\n" . $app_strings['LBL_SOLUTION'] . ":\r\n" . $solution; } //Retrive the ticket comments from the vtiger_ticketcomments vtiger_table and added into the vtiger_faq answer
<?php include 'header.php'; $faq_handler = new FAQ(); $view = new View(); $faq = $faq_handler->getFAQ(); ?> <!-- content wrapper --> <div class="container-full"> <!-- page row --> <div class="row"> <!-- sidebar --> <div class="col-sm-2 sidebar-wrapper"> <ul class="sidebar-nav"> <li class="sidebar-brand"> <a href="#"> Categories </a> </li> <!-- shows the categories as list elements --> <?php $view->showCategories(); ?> </ul> </div> <!-- /.sidebar --> <!-- content --> <div class="col-sm-10">
,0,{onUpdate: function(response,root){ faq.listFAQ({target:'div_list'}); } });" /></td> </tr> <?php } ?> </table> <?php $html = ob_get_contents(); ob_end_clean(); return $html; } } $faq = new FAQ(); require "tpl/inc/head.php"; $ajax = new PHPLiveX(); $ajax->AjaxifyObjects(array("faq")); $ajax->Run("tpl/phplivex.js"); // Must be called inside the 'html' or 'body' tags ?> <body> <style> #right-col table td{ padding: 5px 0 5px 0px; color:#333333;} </style> <div id="page"> <?php require "tpl/inc/header.php"; ?>
function isKnowledgebaseEnabled() { global $thisclient; if ($this->get('restrict_kb', false) && (!$thisclient || $thisclient->isGuest())) { return false; } require_once INCLUDE_DIR . 'class.faq.php'; return $this->get('enable_kb') && FAQ::countPublishedFAQs(); }
$prj_id = Auth::getCurrentProject(); if (!CRM::hasCustomerIntegration($prj_id)) { // show all FAQ entries $support_level_ids = array(); } else { $crm = CRM::getInstance($prj_id); if (Auth::getCurrentRole() != User::getRoleID('Customer')) { // show all FAQ entries $support_level_ids = array(); } else { $customer_id = User::getCustomerID(Auth::getUserID()); $contact = Auth::getCurrentContact(); $support_level_ids = array(); // TODOCRM: only active contracts? foreach ($contact->getContracts() as $contract) { $support_level_ids[] = $contract->getSupportLevel()->getLevelID(); } } } $tpl->assign('faqs', FAQ::getListBySupportLevel($support_level_ids)); if (!empty($_GET['id'])) { $t = FAQ::getDetails($_GET['id']); // check if this customer should have access to this FAQ entry or not if (count($support_level_ids) > 0 && count(array_intersect($support_level_ids, $t['support_levels'])) < 1) { $tpl->assign('faq', -1); } else { $t['faq_created_date'] = Date_Helper::getFormattedDate($t['faq_created_date']); $tpl->assign('faq', $t); } } $tpl->displayTemplate();
<div class="container topheader"> <div class="row"> <div class="span8"> <h2><strong><?php echo $category->getLocalName(); ?> </strong></h2> <p> <?php echo Format::safe_html($category->getLocalDescriptionWithImages()); ?> </p> <hr> <div class="panel panel-default faqlist"> <?php $faqs = FAQ::objects()->filter(array('category' => $category))->exclude(array('ispublished' => FAQ::VISIBILITY_PRIVATE))->annotate(array('has_attachments' => SqlAggregate::COUNT(SqlCase::N()->when(array('attachments__inline' => 0), 1)->otherwise(null))))->order_by('-ispublished', 'question'); if ($faqs->exists(true)) { echo ' <div class="panel-heading"> <h2 class="panel-title">' . __('Frequently Asked Questions') . '</h2> </div> <div class="panel-body"> <div id="faq"> <ol>'; foreach ($faqs as $F) { $attachments = $F->has_attachments ? '<span class="Icon file"></span>' : ''; echo sprintf(' <li><a href="faq.php?id=%d" >%s %s</a></li>', $F->getId(), Format::htmlchars($F->question), $attachments); } echo ' </ol> </div>
$usr_id = Auth::getUserID(); $prj_id = Auth::getCurrentProject(); if (!Customer::hasCustomerIntegration($prj_id)) { // show all FAQ entries $support_level_id = -1; } else { if (!Customer::doesBackendUseSupportLevels($prj_id)) { // show all FAQ entries $support_level_id = -1; } else { if (Auth::getCurrentRole() != User::getRoleID('Customer')) { // show all FAQ entries $support_level_id = -1; } else { $customer_id = User::getCustomerID(Auth::getUserID()); $support_level_id = Customer::getSupportLevelID($prj_id, $customer_id); } } } $tpl->assign("faqs", FAQ::getListBySupportLevel($support_level_id)); if (!empty($HTTP_GET_VARS["id"])) { $t = FAQ::getDetails($HTTP_GET_VARS['id']); // check if this customer should have access to this FAQ entry or not if ($support_level_id != -1 && !in_array($support_level_id, $t['support_levels'])) { $tpl->assign('faq', -1); } else { $t['faq_created_date'] = Date_API::getFormattedDate($t["faq_created_date"]); $tpl->assign("faq", $t); } } $tpl->displayTemplate();
function isKnowledgebaseEnabled() { require_once INCLUDE_DIR . 'class.faq.php'; return $this->config['enable_kb'] && FAQ::countPublishedFAQs(); }
<?php require_once './classes/FAQ.php'; $faq = new FAQ(); $list = $faq->get_faq_page(); echo $list;