本文整理汇总了PHP中Misc::setMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::setMessage方法的具体用法?PHP Misc::setMessage怎么用?PHP Misc::setMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Misc
的用法示例。
在下文中一共展示了Misc::setMessage方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Template_Helper
* 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/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') {
示例2: Template_Helper
* 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/time_tracking.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;
}
$prj_id = isset($_POST['prj_id']) ? (int) $_POST['prj_id'] : (int) $_GET['prj_id'];
$cat = isset($_POST['cat']) ? (string) $_POST['cat'] : null;
$tpl->assign('project', Project::getDetails($prj_id));
if ($cat == 'new') {
$title = $_POST['title'];
$res = Time_Tracking::insertCategory($prj_id, $title);
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the time tracking category was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new time tracking category.'), Misc::MSG_INFO), -2 => array(ev_gettext('Please enter the title for this new time tracking category.'), Misc::MSG_ERROR)));
} elseif ($cat == 'update') {
$title = (string) $_POST['title'];
$prj_id = (int) $_POST['prj_id'];
$id = (int) $_POST['id'];
$res = Time_Tracking::updateCategory($prj_id, $id, $title);
示例3: Template_Helper
/*
* 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/private_key.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_ADMINISTRATOR) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
$cat = isset($_POST['cat']) ? (string) $_POST['cat'] : null;
if ($cat == 'update') {
// regenerate key
try {
Auth::generatePrivateKey();
Misc::setMessage(ev_gettext('Thank you, the private key was regenerated.'));
} catch (Exception $e) {
Misc::setMessage(ev_gettext('Private key regeneration error. Check server error logs.'), Misc::MSG_ERROR);
}
}
$tpl->displayTemplate();
示例4: isset
$new_issue_message = $customer->getNewIssueMessage();
if ($new_issue_message) {
Misc::setMessage($new_issue_message, Misc::MSG_INFO);
}
}
}
$cat = isset($_POST['cat']) ? (string) $_POST['cat'] : (isset($_GET['cat']) ? (string) $_GET['cat'] : null);
if ($cat == 'report') {
$res = Issue::createFromPost();
if ($res != -1) {
// redirect to view issue page
Misc::setMessage(ev_gettext('Your issue was created successfully.'));
Auth::redirect(APP_BASE_URL . 'view.php?id=' . $res);
} else {
// need to show everything again
Misc::setMessage(ev_gettext('There was an error creating your issue.'), Misc::MSG_ERROR);
$tpl->assign('error_msg', '1');
}
}
if ($cat == 'associate') {
$item = isset($_GET['item']) ? (array) $_GET['item'] : null;
if (count($item) > 0) {
$res = Support::getListDetails($item);
$tpl->assign('emails', $res);
$tpl->assign('attached_emails', @implode(',', $item));
if (CRM::hasCustomerIntegration($prj_id)) {
$crm = CRM::getInstance($prj_id);
// also need to guess the contact_id from any attached emails
try {
$info = $crm->getCustomerInfoFromEmails($prj_id, $item);
$tpl->assign(array('customer_id' => $info['customer_id'], 'customer_name' => $info['customer_name'], 'contact_id' => $info['contact_id'], 'contact_name' => $info['contact_name'], 'contacts' => $info['contacts']));
示例5: isset
$tpl->assign('default_actions', $res);
$cat = isset($_POST['cat']) ? (string) $_POST['cat'] : (isset($_GET['cat']) ? (string) $_GET['cat'] : null);
if ($cat == 'insert') {
$res = Notification::subscribeEmail($usr_id, $issue_id, $_POST['email'], $_POST['actions']);
if ($res == 1) {
Misc::setMessage(ev_gettext('Thank you, the email has been subscribed to the issue.'));
}
} elseif ($cat == 'update') {
$res = Notification::update($issue_id, $_POST['id'], $_POST['email']);
if ($res == 1) {
Misc::setMessage(ev_gettext('Thank you, the notification entry was updated successfully.'));
} elseif ($res == -1) {
Misc::setMessage(ev_gettext('An error occurred while trying to update the notification entry.'), Misc::MSG_ERROR);
} elseif ($res == -2) {
Misc::setMessage(ev_gettext('Error: the given email address is not allowed to be added to the notification list.'), Misc::MSG_ERROR);
}
Auth::redirect(APP_RELATIVE_URL . 'notification.php?iss_id=' . $issue_id);
} elseif ($cat == 'edit') {
$res = Notification::getDetails($_GET['id']);
$tpl->assign('info', $res);
} elseif ($cat == 'delete') {
$res = Notification::remove($_POST['items']);
if ($res == 1) {
Misc::setMessage(ev_gettext('Thank you, the items have been deleted.'));
}
}
$tpl->assign('list', Notification::getSubscriberListing($issue_id));
$t = Project::getAddressBook($prj_id, $issue_id);
$tpl->assign('assoc_users', $t);
$tpl->assign('allowed_emails', Project::getAddressBookEmails($prj_id, $issue_id));
$tpl->displayTemplate();
示例6: dirname
// | (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> |
// | Authors: Elan Ruusamäe <glen@delfi.ee> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
Auth::checkAuthentication(APP_COOKIE);
$prj_id = $_POST['current_project'];
$url = $_SERVER['HTTP_REFERER'];
// get the 'remember' setting of the project cookie
$cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE);
Auth::setCurrentProject($prj_id, $cookie['remember']);
Misc::setMessage(ev_gettext('The project has been switched'), Misc::MSG_INFO);
// if url is 'view.php', use 'list.php',
// otherwise autoswitcher will switch back to the project where the issue was :)
if (!$url || stristr($url, 'view.php') !== false) {
$url = APP_RELATIVE_URL . 'list.php';
}
Auth::redirect($url);
示例7: displayErrorMessage
public static function displayErrorMessage($msg)
{
Misc::setMessage($msg, Misc::MSG_ERROR);
$tpl = new Template_Helper();
$tpl->setTemplate('error_message.tpl.html');
$tpl->displayTemplate();
exit;
}
示例8:
$ttc_id = (int) $_POST['category'];
$iss_id = (int) $_POST['issue_id'];
$time_spent = (int) $_POST['time_spent'];
$summary = 'Time entry inserted when closing issue.';
Time_Tracking::addTimeEntry($iss_id, $ttc_id, $time_spent, $date, $summary);
}
if (CRM::hasCustomerIntegration($prj_id) && isset($details['contract'])) {
$crm = CRM::getInstance($prj_id);
$contract = $details['contract'];
if ($contract->hasPerIncident()) {
$contract->updateRedeemedIncidents($issue_id, @$_REQUEST['redeem']);
}
}
$tpl->assign('close_result', $res);
if ($res == 1) {
Misc::setMessage(ev_gettext('Thank you, the issue was closed successfully'));
Misc::displayNotifiedUsers(Notification::getLastNotifiedAddresses($issue_id));
Auth::redirect(APP_RELATIVE_URL . 'view.php?id=' . $issue_id);
}
}
$tpl->assign(array('statuses' => Status::getClosedAssocList($prj_id), 'resolutions' => Resolution::getAssocList(), 'time_categories' => Time_Tracking::getAssocCategories($prj_id), 'notify_list' => Notification::getLastNotifiedAddresses($issue_id), 'custom_fields' => Custom_Field::getListByIssue($prj_id, $issue_id, $usr_id, 'close_form'), 'issue_id' => $issue_id));
if (CRM::hasCustomerIntegration($prj_id) && isset($details['contract'])) {
$crm = CRM::getInstance($prj_id);
$contract = $details['contract'];
if ($contract->hasPerIncident()) {
$details = Issue::getDetails($issue_id);
$tpl->assign(array('redeemed' => $contract->getRedeemedIncidentDetails($issue_id), 'incident_details' => $details['customer']['incident_details']));
}
}
$usr_id = Auth::getUserID();
$user_prefs = Prefs::get($usr_id);
示例9: elseif
exit;
} elseif ($res == 1) {
Misc::setMessage(ev_gettext('Thank you, issue #%1$s was updated successfully.', $issue_id), Misc::MSG_INFO);
}
$notify_list = Notification::getLastNotifiedAddresses($issue_id);
$has_duplicates = Issue::hasDuplicates($_POST['issue_id']);
if ($has_duplicates || count($errors) > 0 || count($notify_list) > 0) {
$update_tpl = new Template_Helper();
$update_tpl->setTemplate('include/update_msg.tpl.html');
$update_tpl->assign('update_result', $res);
$update_tpl->assign('errors', $errors);
$update_tpl->assign('notify_list', $notify_list);
if ($has_duplicates) {
$update_tpl->assign('has_duplicates', 'yes');
}
Misc::setMessage($update_tpl->getTemplateContents(false), Misc::MSG_HTML_BOX);
}
Auth::redirect(APP_RELATIVE_URL . 'view.php?id=' . $issue_id);
exit;
}
$prj_id = Auth::getCurrentProject();
// if currently selected release is in the past, manually add it to list
$releases = Release::getAssocList($prj_id);
if ($details['iss_pre_id'] != 0 && empty($releases[$details['iss_pre_id']])) {
$releases = array($details['iss_pre_id'] => $details['pre_title']) + $releases;
}
if (Workflow::hasWorkflowIntegration($prj_id)) {
$statuses = Workflow::getAllowedStatuses($prj_id, $issue_id);
// if currently selected release is not on list, go ahead and add it.
} else {
$statuses = Status::getAssocStatusList($prj_id, false);
示例10:
$prj_id = $iss_prj_id;
}
$details = Issue::getDetails($issue_id);
if ($details == '') {
Misc::displayErrorMessage(ev_gettext('Error: The issue #%1$s could not be found.', $issue_id));
}
// TRANSLATORS: %1 = issue id
$tpl->assign('issue', $details);
// in the case of a customer user, also need to check if that customer has access to this issue
if (!Issue::canAccess($issue_id, $usr_id)) {
Misc::displayErrorMessage(ev_gettext('Sorry, you do not have the required privileges to view this issue.'));
} else {
// if the issue has a different customer then the currently selected one, switch customers
if (Auth::getCurrentRole() == User::getRoleID('Customer') && Auth::getCurrentCustomerID() != $details['iss_customer_id']) {
Auth::setCurrentCustomerID($details['iss_customer_id']);
Misc::setMessage("Active customer changed to '" . $details['customer']->getName() . '"');
Auth::redirect(APP_RELATIVE_URL . 'view.php?id=' . $issue_id);
}
$associated_projects = @array_keys(Project::getAssocList($usr_id));
if (empty($details) || $details['iss_prj_id'] != $prj_id) {
Misc::displayErrorMessage(ev_gettext('Error: The issue #%1$s could not be found.', $issue_id));
} else {
// now that we can access to the issue, add more verbose HTML <title>
// TRANSLATORS: Page HTML title: %1 = issue id, %2 = issue summary
$tpl->assign('extra_title', ev_gettext('#%1$s - %2$s', $issue_id, $details['iss_summary']));
// check if the requested issue is a part of one of the projects
// associated with this user
if (!@in_array($details['iss_prj_id'], $associated_projects)) {
Misc::displayErrorMessage(ev_gettext('Sorry, you do not have the required privileges to view this issue.'));
} else {
$options = Search::saveSearchParams();
示例11: file_get_contents
$res = null;
if ($cat == 'update_account') {
$preferences = $_POST;
// if the user is trying to upload a new signature, override any changes to the textarea
if (!empty($_FILES['file_signature']['name'])) {
$preferences['email_signature'] = file_get_contents($_FILES['file_signature']['tmp_name']);
}
$res = Prefs::set($usr_id, $preferences);
User::updateSMS($usr_id, @$_POST['sms_email']);
} elseif ($cat == 'update_name') {
$res = User::updateFullName($usr_id);
} elseif ($cat == 'update_email') {
$res = User::updateEmail($usr_id);
} elseif ($cat == 'update_password') {
$res = Auth::updatePassword($usr_id, $_POST['new_password'], $_POST['confirm_password']);
}
if ($res == 1) {
Misc::setMessage(ev_gettext('Your information has been updated'));
} elseif ($res == -1) {
Misc::setMessage(ev_gettext('Sorry, there was an error updating your information'), Misc::MSG_ERROR);
}
$prefs = Prefs::get($usr_id);
$prefs['sms_email'] = User::getSMS($usr_id);
$tpl->assign('user_prefs', $prefs);
$tpl->assign('user_info', User::getDetails($usr_id));
$tpl->assign('assigned_projects', Project::getAssocList($usr_id, false, true));
$tpl->assign('zones', Date_Helper::getTimezoneList());
$tpl->assign('avail_langs', Language::getAvailableLanguages());
$tpl->assign('current_locale', User::getLang($usr_id, true));
$tpl->assign(array('can_update_name' => Auth::canUserUpdateName($usr_id), 'can_update_email' => Auth::canUserUpdateEmail($usr_id), 'can_update_password' => Auth::canUserUpdatePassword($usr_id)));
$tpl->displayTemplate();
示例12: elseif
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$prj_id = Auth::getCurrentProject();
$issue_id = @$_POST['issue_id'] ? $_POST['issue_id'] : $_GET['iss_id'];
$tpl->assign('issue_id', $issue_id);
if (!Access::canViewAuthorizedRepliers($issue_id, Auth::getUserID())) {
$tpl->setTemplate('permission_denied.tpl.html');
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'insert') {
$res = Authorized_Replier::manualInsert($issue_id, $_POST['email']);
if ($res == 1) {
Misc::setMessage(ev_gettext('Thank you, the authorized replier was inserted successfully.'));
} elseif ($res == -1) {
Misc::setMessage(ev_gettext('An error occurred while trying to insert the authorized replier.'), Misc::MSG_ERROR);
} elseif ($res == -2) {
Misc::setMessage(ev_gettext("Users with a role of 'customer' or below are not allowed to be added to the authorized repliers list."), Misc::MSG_ERROR);
}
} elseif (@$_POST['cat'] == 'delete') {
$res = Authorized_Replier::removeRepliers($_POST['items']);
if ($res == 1) {
Misc::setMessage(ev_gettext('Thank you, the authorized replier was deleted successfully.'));
} elseif ($res == -1) {
Misc::setMessage(ev_gettext('An error occurred while trying to delete the authorized replier.'), Misc::MSG_ERROR);
}
}
list(, $repliers) = Authorized_Replier::getAuthorizedRepliers($issue_id);
$tpl->assign('list', $repliers);
$t = Project::getAddressBook($prj_id, $issue_id);
$tpl->assign('assoc_users', $t);
$tpl->displayTemplate();
示例13: elseif
} elseif ($cat == 'post_note') {
// change status
$status = isset($_POST['new_status']) ? (int) $_POST['new_status'] : null;
if ($status) {
$res = Issue::setStatus($issue_id, $status);
if ($res != -1) {
$new_status = Status::getStatusTitle($status);
History::add($issue_id, $usr_id, 'status_changed', "Status changed to '{status}' by {user} when sending a note", array('status' => $new_status, 'user' => User::getFullName($usr_id)));
}
}
$res = Note::insertFromPost($usr_id, $issue_id);
Issue_Field::updateValues($issue_id, 'post_note', @$_REQUEST['issue_field']);
if ($res == -1) {
Misc::setMessage(ev_gettext('An error occurred while trying to run your query'), Misc::MSG_ERROR);
} else {
Misc::setMessage(ev_gettext('Thank you, the internal note was posted successfully.'), Misc::MSG_INFO);
}
$tpl->assign('post_result', $res);
// enter the time tracking entry about this phone support entry
if (!empty($_POST['time_spent'])) {
if (isset($_POST['time_summary']) && !empty($_POST['time_summary'])) {
$summary = (string) $_POST['time_summary'];
} else {
$summary = 'Time entry inserted when sending an internal note.';
}
$date = (array) $_POST['date'];
$ttc_id = (int) $_POST['time_category'];
$time_spent = (int) $_POST['time_spent'];
Time_Tracking::addTimeEntry($issue_id, $ttc_id, $time_spent, $date, $summary);
}
Auth::redirect("post_note.php?cat=post_result&issue_id={$issue_id}&post_result={$res}");