Exemplo n.º 1
0
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "custom_fields");
$role_id = Auth::getCurrentRole();
if ($role_id == User::getRoleID('administrator')) {
    $tpl->assign("show_setup_links", true);
    if (@$HTTP_POST_VARS["cat"] == "new") {
        $tpl->assign("result", Custom_Field::insert());
    } elseif (@$HTTP_POST_VARS["cat"] == "update") {
        $tpl->assign("result", Custom_Field::update());
    } elseif (@$HTTP_POST_VARS["cat"] == "delete") {
        Custom_Field::remove();
    } elseif (@$_REQUEST["cat"] == "change_rank") {
        Custom_Field::changeRank();
    }
    if (@$HTTP_GET_VARS["cat"] == "edit") {
        $tpl->assign("info", Custom_Field::getDetails($HTTP_GET_VARS["id"]));
    }
    $excluded_roles = array();
    if (!Customer::hasCustomerIntegration(Auth::getCurrentProject())) {
        $excluded_roles[] = "customer";
    }
    $user_roles = User::getRoles($excluded_roles);
    $user_roles[9] = "Never Display";
    $tpl->assign("list", Custom_Field::getList());
    $tpl->assign("project_list", Project::getAll());
    $tpl->assign("user_roles", $user_roles);
    $tpl->assign("backend_list", Custom_Field::getBackendList());
} else {
    $tpl->assign("show_not_allowed_msg", true);
}
$tpl->displayTemplate();
Exemplo n.º 2
0
    Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
$tpl->assign('project_list', Project::getAll());
if (@$_POST['cat'] == 'new') {
    $res = Custom_Field::insert();
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the custom field was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new custom field.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
    $res = Custom_Field::update();
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the custom field was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the custom field information.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
    $res = Custom_Field::remove();
    Misc::mapMessages($res, array(true => array(ev_gettext('Thank you, the custom field was removed successfully.'), Misc::MSG_INFO), false => array(ev_gettext('An error occurred while trying to remove the custom field information.'), Misc::MSG_ERROR)));
} elseif (@$_REQUEST['cat'] == 'change_rank') {
    Custom_Field::changeRank();
}
if (@$_GET['cat'] == 'edit') {
    $tpl->assign('info', Custom_Field::getDetails($_GET['id']));
}
$excluded_roles = array();
if (!CRM::hasCustomerIntegration(Auth::getCurrentProject())) {
    $excluded_roles[] = 'customer';
}
$user_roles = User::getRoles($excluded_roles);
$user_roles[9] = 'Never Display';
$tpl->assign('list', Custom_Field::getList());
$tpl->assign('project_list', Project::getAll());
$tpl->assign('user_roles', $user_roles);
$tpl->assign('backend_list', Custom_Field::getBackendList());
$tpl->displayTemplate();