コード例 #1
0
ファイル: faq.php プロジェクト: juliogallardo1326/proc
$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();
コード例 #2
0
ファイル: faq.php プロジェクト: korusdipl/eventum
$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();