本文整理匯總了PHP中Misc::mapMessages方法的典型用法代碼示例。如果您正苦於以下問題:PHP Misc::mapMessages方法的具體用法?PHP Misc::mapMessages怎麽用?PHP Misc::mapMessages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Misc
的用法示例。
在下文中一共展示了Misc::mapMessages方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: dirname
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
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();
示例2: Template_Helper
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/link_filters.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 = Link_Filter::insert();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the link filter was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new link filter.'), Misc::MSG_INFO)));
} elseif (@$_POST['cat'] == 'update') {
$res = Link_Filter::update();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the link filter was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the link filter.'), Misc::MSG_INFO)));
} elseif (@$_POST['cat'] == 'delete') {
$res = Link_Filter::remove();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the link filter was deleted successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to delete the link filter.'), Misc::MSG_INFO)));
}
if (@$_GET['cat'] == 'edit') {
$info = Link_Filter::getDetails($_GET['id']);
$tpl->assign('info', $info);
}
$user_roles = User::getRoles();
$tpl->assign('list', Link_Filter::getList());
$tpl->assign('project_list', Project::getAll());
$tpl->assign('user_roles', $user_roles);
$tpl->displayTemplate();
示例3: Template_Helper
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* 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/monitor.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_REPORTER) {
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 (!empty($_POST['cat']) && $_POST['cat'] == 'update') {
$setup = array('diskcheck' => $_POST['diskcheck'], 'paths' => $_POST['paths'], 'ircbot' => $_POST['ircbot']);
$res = Setup::save(array('monitor' => $setup));
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the setup information was saved successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext("ERROR: The system doesn't have the appropriate permissions to create the configuration file in the setup directory (%s). " . 'Please contact your local system administrator and ask for write privileges on the provided path.', APP_CONFIG_PATH), Misc::MSG_NOTE_BOX), -2 => array(ev_gettext("ERROR: The system doesn't have the appropriate permissions to update the configuration file in the setup directory (%s). " . 'Please contact your local system administrator and ask for write privileges on the provided filename.', APP_SETUP_FILE), Misc::MSG_NOTE_BOX)));
}
$tpl->assign(array('enable_disable', array('enabled' => ev_gettext('Enabled'), 'disabled' => ev_gettext('Disabled')), 'setup' => Setup::get()));
$tpl->displayTemplate();
示例4: array
$role_id = Auth::getCurrentRole();
if ($role_id < User::getRoleID('administrator')) {
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 = Status::insertCustomization($_POST['project'], $_POST['status'], $_POST['date_field'], $_POST['label']);
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the customization was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new customization.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this new customization'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
$res = Status::updateCustomization($_POST['id'], $_POST['project'], $_POST['status'], $_POST['date_field'], $_POST['label']);
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the customization was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the customization information.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this customization.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
$res = Status::removeCustomization(@$_POST['items']);
Misc::mapMessages($res, array(true => array(ev_gettext('Thank you, the customization was deleted successfully.'), Misc::MSG_INFO), false => array(ev_gettext('An error occurred while trying to delete the customization information.'), Misc::MSG_ERROR)));
}
if (@$_GET['cat'] == 'edit') {
$details = Status::getCustomizationDetails($_GET['id']);
$tpl->assign(array('info' => $details, 'project_id' => $details['psd_prj_id'], 'status_list' => Status::getAssocStatusList($details['psd_prj_id'], true)));
}
$display_customer_fields = false;
@($prj_id = $_POST['prj_id'] ? $_POST['prj_id'] : $_GET['prj_id']);
if (!empty($prj_id)) {
$tpl->assign('status_list', Status::getAssocStatusList($prj_id, true));
$tpl->assign('project_id', $prj_id);
$display_customer_fields = CRM::hasCustomerIntegration($prj_id);
}
$tpl->assign('date_fields', Issue::getDateFieldsAssocList($display_customer_fields));
$tpl->assign('project_list', Project::getAll());
$tpl->assign('list', Status::getCustomizationList());
示例5: Template_Helper
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/products.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
Misc::setMessage('Sorry, you are not allowed to access this page.', Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'new') {
$res = Product::insert($_POST['title'], $_POST['version_howto'], $_POST['rank'], @$_POST['removed'], @$_POST['email']);
Misc::mapMessages($res, array(1 => array('Thank you, the product was added successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to add the product.', Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
$res = Product::update($_POST['id'], $_POST['title'], $_POST['version_howto'], $_POST['rank'], @$_POST['removed'], @$_POST['email']);
Misc::mapMessages($res, array(1 => array('Thank you, the product was updated successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to update the product.', Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
Product::remove($_POST['items']);
}
if (@$_GET['cat'] == 'edit') {
$info = Product::getDetails($_GET['id']);
$tpl->assign('info', $info);
$user_options = User::getActiveAssocList(Auth::getCurrentProject(), User::ROLE_CUSTOMER, false, $_GET['id']);
} else {
$user_options = User::getActiveAssocList(Auth::getCurrentProject(), User::ROLE_CUSTOMER, true);
}
$tpl->assign('list', Product::getList());
$tpl->assign('project_list', Project::getAll());
$tpl->displayTemplate();
示例6: array
$role_id = Auth::getCurrentRole();
if ($role_id < User::getRoleID('administrator')) {
Misc::setMessage('Sorry, you are not allowed to access this page.', Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'update') {
$setup = LDAP_Auth_Backend::loadSetup();
$setup['host'] = $_POST['host'];
$setup['port'] = $_POST['port'];
$setup['binddn'] = $_POST['binddn'];
$setup['bindpw'] = $_POST['bindpw'];
$setup['basedn'] = $_POST['basedn'];
$setup['userdn'] = $_POST['userdn'];
$setup['user_filter'] = $_POST['user_filter'];
$setup['customer_id_attribute'] = $_POST['customer_id_attribute'];
$setup['contact_id_attribute'] = $_POST['contact_id_attribute'];
$setup['create_users'] = $_POST['create_users'];
$setup['default_role'] = $_POST['default_role'];
$res = LDAP_Auth_Backend::saveSetup($setup);
Misc::mapMessages($res, array(1 => array('Thank you, the setup information was saved successfully.', Misc::MSG_INFO), -1 => array("ERROR: The system doesn't have the appropriate permissions to create the configuration file\n in the setup directory (" . APP_CONFIG_PATH . '). Please contact your local system
administrator and ask for write privileges on the provided path.', Misc::MSG_HTML_BOX), -2 => array("ERROR: The system doesn't have the appropriate permissions to update the configuration file\n in the setup directory (" . APP_CONFIG_PATH . '/ldap.php). Please contact your local system
administrator and ask for write privileges on the provided filename.', Misc::MSG_HTML_BOX)));
$tpl->assign('result', $res);
}
$options = LDAP_Auth_Backend::loadSetup(true);
$tpl->assign('setup', $options);
$tpl->assign('project_list', Project::getAll());
$tpl->assign('project_roles', array(0 => 'No Access') + User::getRoles());
$tpl->assign('user_roles', User::getRoles(array('Customer')));
$tpl->displayTemplate();
示例7: dirname
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/statuses.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
$role_id = Auth::getCurrentRole();
if ($role_id < User::getRoleID('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 = Status::insert();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the status was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the status.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this status.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
$res = Status::update();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the status was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the status.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this status.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
Status::remove();
}
if (@$_GET['cat'] == 'edit') {
$tpl->assign('info', Status::getDetails($_GET['id']));
}
$tpl->assign('list', Status::getList());
$tpl->assign('project_list', Project::getAll());
$tpl->displayTemplate();
示例8: dirname
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../../init.php';
$prj_id = $_REQUEST['prj_id'];
$tpl = new Template_Helper();
$tpl->setTemplate('manage/column_display.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
$role_id = Auth::getCurrentRole();
if ($role_id < User::getRoleID('manager')) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'save') {
$res = Display_Column::save();
$tpl->assign('result', $res);
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, columns to display was saved successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to save columns to display.'), Misc::MSG_ERROR)));
}
$page = 'list_issues';
$available = Display_Column::getAllColumns($page);
$selected = Display_Column::getSelectedColumns($prj_id, $page);
// re-order available array to match rank
$available_ordered = array();
foreach ($selected as $field_name => $field_info) {
$available_ordered[$field_name] = $available[$field_name];
unset($available[$field_name]);
}
if (count($available) > 0) {
$available_ordered += $available;
}
$excluded_roles = array();
if (!CRM::hasCustomerIntegration($prj_id)) {
示例9: dirname
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: Dave Anderson <dave@anderson.net.nz> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/email_alias.tpl.html');
Auth::checkAuthentication(APP_COOKIE, null, true);
$role_id = Auth::getCurrentRole();
if ($role_id < User::getRoleID('manager')) {
$tpl->setTemplate('permission_denied.tpl.html');
$tpl->displayTemplate();
exit;
}
$usr_id = $_REQUEST['id'];
if (@$_POST['cat'] == 'save') {
$res = User::addAlias($usr_id, trim($_POST['alias']));
Misc::mapMessages($res, array(true => array(ev_gettext('Thank you, the alias was added successfully.'), Misc::MSG_INFO), false => array(ev_gettext('An error occurred while trying to add the alias.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'remove') {
foreach ($_POST['item'] as $aliastmp) {
$res = User::removeAlias($usr_id, $aliastmp);
}
Misc::mapMessages($res, array(true => array(ev_gettext('Thank you, the alias was removed successfully.'), Misc::MSG_INFO), false => array(ev_gettext('An error occurred while trying to remove the alias.'), Misc::MSG_ERROR)));
}
$tpl->assign('list', User::getAliases($usr_id));
$tpl->assign('username', User::getFullName($usr_id));
$tpl->assign('id', $usr_id);
$tpl->displayTemplate();
示例10: dirname
// | Copyright (c) 2008 - 2010 Sun Microsystem Inc. |
// | Copyright (c) 2011 - 2013 Eventum Team. |
// | |
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('duplicate.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
if (@$_POST['cat'] == 'mark') {
Misc::mapMessages(Issue::markAsDuplicate($_POST['issue_id']), array(1 => array(ev_gettext('Thank you, the issue was marked as a duplicate successfully'), Misc::MSG_INFO), -1 => array(ev_gettext('Sorry, an error happened while trying to run your query.'), Misc::MSG_ERROR)));
Auth::redirect(APP_RELATIVE_URL . 'view.php?id=' . $_POST['issue_id']);
}
$tpl->displayTemplate();
示例11: dirname
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: Bryan Alsdorf <bryan@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
// This page handles marking an issue as 'redeeming' an incident.
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$prj_id = Auth::getCurrentProject();
$issue_id = $_REQUEST['iss_id'];
$usr_id = Auth::getUserID();
if (!Issue::canAccess($issue_id, $usr_id) || Auth::getCurrentRole() <= User::getRoleID('Customer')) {
$tpl->setTemplate('permission_denied.tpl.html');
$tpl->displayTemplate();
exit;
}
$tpl = new Template_Helper();
$tpl->setTemplate('redeem_incident.tpl.html');
$crm = CRM::getInstance($prj_id);
$contract = $crm->getContract(Issue::getContractID($issue_id));
if (!empty($_REQUEST['submit'])) {
// update counts
$res = $contract->updateRedeemedIncidents($issue_id, @$_REQUEST['redeem']);
$tpl->assign('res', $res);
Misc::mapMessages($res, array(1 => array('Thank you, the issue was successfully marked.', Misc::MSG_INFO), -1 => array('There was an error marking this issue as redeemed', Misc::MSG_ERROR), -2 => array('This issue already has been marked as redeemed', Misc::MSG_ERROR)));
}
$details = $contract->getDetails();
$tpl->assign(array('issue_id' => $issue_id, 'redeemed' => $contract->getRedeemedIncidentDetails($issue_id), 'incident_details' => $details['incident_details']));
$tpl->displayTemplate();
示例12: dirname
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('signup.tpl.html');
// log anonymous users out so they can use the signup form
if (Auth::hasValidCookie(APP_COOKIE) && Auth::isAnonUser()) {
Auth::logout();
}
if (@$_POST['cat'] == 'signup') {
$setup = Setup::load();
$res = User::createVisitorAccount($setup['accounts_role'], $setup['accounts_projects']);
$tpl->assign('signup_result', $res);
Misc::mapMessages($res, array(1 => array('Thank you, your account creation request was processed successfully. For security reasons a confirmation email was sent to the provided email address with instructions on how to confirm your request and activate your account.', Misc::MSG_INFO), -1 => array('Error: An error occurred while trying to run your query.', Misc::MSG_ERROR), -2 => array('Error: The email address specified is already associated with an user in the system.', Misc::MSG_ERROR)));
}
$tpl->displayTemplate();
示例13: Template_Helper
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* 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/email_accounts.tpl.html');
Auth::checkAuthentication();
$tpl->assign('all_projects', Project::getAll());
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_REPORTER) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'new') {
Misc::mapMessages(Email_Account::insert(), array(1 => array(ev_gettext('Thank you, the email account was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new account.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
Misc::mapMessages(Email_Account::update(), array(1 => array(ev_gettext('Thank you, the email account was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the account information.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
Misc::mapMessages(Email_Account::remove(), array(1 => array(ev_gettext('Thank you, the email account was deleted successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to delete the account information.'), Misc::MSG_ERROR)));
}
if (@$_GET['cat'] == 'edit') {
$tpl->assign('info', Email_Account::getDetails($_GET['id']));
}
$tpl->assign('list', Email_Account::getList());
$tpl->displayTemplate();
示例14: Template_Helper
* 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/projects.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') {
Misc::mapMessages(Project::insert(), array(1 => array(ev_gettext('Thank you, the project was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new project.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this new project.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
Misc::mapMessages(Project::update(), array(1 => array(ev_gettext('Thank you, the project was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the project information.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this project.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
Misc::mapMessages(Project::remove(), array(1 => array(ev_gettext('Thank you, the project was deleted successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to delete the project.'), Misc::MSG_ERROR)));
}
$tpl->assign('active_projects', Project::getAssocList(Auth::getUserID(), true));
if (@$_GET['cat'] == 'edit') {
$tpl->assign('info', Project::getDetails($_GET['id']));
}
$tpl->assign('list', Project::getList());
$tpl->assign('user_options', User::getActiveAssocList());
$tpl->assign('status_options', Status::getAssocList());
$tpl->assign('customer_backends', CRM::getBackendList());
$tpl->assign('workflow_backends', Workflow::getBackendList());
$tpl->displayTemplate();
示例15: Template_Helper
* 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/severities.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
Misc::setMessage('Sorry, you are not allowed to access this page.', Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
@($prj_id = $_POST['prj_id'] ? $_POST['prj_id'] : $_GET['prj_id']);
$tpl->assign('project', Project::getDetails($prj_id));
if (@$_POST['cat'] == 'new') {
$res = Severity::insert($prj_id, $_POST['title'], $_POST['description'], $_POST['rank']);
Misc::mapMessages($res, array(1 => array('Thank you, the severity was added successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to add the severity.', Misc::MSG_ERROR), -2 => array('Please enter the title for this new severity.', Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
$res = Severity::update($_POST['id'], $_POST['title'], $_POST['description'], $_POST['rank']);
Misc::mapMessages($res, array(1 => array('Thank you, the severity was added successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to add the severity.', Misc::MSG_ERROR), -2 => array('Please enter the title for this new severity.', Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
Severity::remove($_POST['items']);
}
if (@$_GET['cat'] == 'edit') {
$tpl->assign('info', Severity::getDetails($_GET['id']));
} elseif (@$_GET['cat'] == 'change_rank') {
Severity::changeRank($prj_id, $_GET['id'], $_GET['rank']);
}
$tpl->assign('list', Severity::getList($prj_id));
$tpl->displayTemplate();