Example #1
0
// | Authors: João Prado Maia <*****@*****.**>                             |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/field_display.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign('type', 'field_display');
$prj_id = @$_GET['prj_id'];
$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 (count(@$_POST['fields']) > 0) {
    $res = Project::updateFieldDisplaySettings($prj_id, $_POST['fields']);
    $tpl->assign('result', $res);
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the information was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the information.'), Misc::MSG_ERROR)));
}
$fields = Project::getDisplayFields();
$excluded_roles = array('viewer');
if (!CRM::hasCustomerIntegration($prj_id)) {
    $excluded_roles[] = 'customer';
}
$user_roles = User::getRoles($excluded_roles);
$user_roles[9] = 'Never Display';
$tpl->assign('prj_id', $prj_id);
$tpl->assign('fields', $fields);
$tpl->assign('user_roles', $user_roles);
$tpl->assign('display_settings', Project::getFieldDisplaySettings($prj_id));
$tpl->displayTemplate();
Example #2
0
include_once APP_INC_PATH . "class.user.php";
include_once APP_INC_PATH . "class.status.php";
include_once APP_INC_PATH . "class.workflow.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("manage/index.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "field_display");
$prj_id = @$HTTP_GET_VARS["prj_id"];
$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 (count(@$HTTP_POST_VARS["min_role"]) > 0) {
        $tpl->assign("result", Project::updateFieldDisplaySettings($prj_id, $HTTP_POST_VARS["min_role"]));
    }
    $fields = Project::getDisplayFields();
    $excluded_roles = array("viewer");
    if (!Customer::hasCustomerIntegration($prj_id)) {
        $excluded_roles[] = "customer";
    }
    $user_roles = User::getRoles($excluded_roles);
    $user_roles[9] = "Never Display";
    $tpl->assign("prj_id", $prj_id);
    $tpl->assign("fields", $fields);
    $tpl->assign("user_roles", $user_roles);
    $tpl->assign("display_settings", Project::getFieldDisplaySettings($prj_id));
} else {
    $tpl->assign("show_not_allowed_msg", true);
}