Пример #1
0
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.project.php";
include_once APP_INC_PATH . "class.faq.php";
include_once APP_INC_PATH . "class.customer.php";
$tpl = new Template_API();
$tpl->setTemplate("manage/index.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "faq");
$role_id = Auth::getCurrentRole();
if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) {
    if ($role_id == User::getRoleID('administrator')) {
        $tpl->assign("show_setup_links", true);
    }
    if (@$HTTP_POST_VARS["cat"] == "new") {
        $tpl->assign("result", FAQ::insert());
    } elseif (@$HTTP_POST_VARS["cat"] == "update") {
        $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'])) {
Пример #2
0
 * For the full copyright and license information,
 * please see the COPYING and AUTHORS files
 * that were distributed with this source code.
 */
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/faq.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
    Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
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']);