本文整理匯總了PHP中Flyspray::logEvent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Flyspray::logEvent方法的具體用法?PHP Flyspray::logEvent怎麽用?PHP Flyspray::logEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Flyspray
的用法示例。
在下文中一共展示了Flyspray::logEvent方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: close_task
/**
* Closes a task
* @param integer $task_id
* @param integer $reason
* @param string $comment
* @param bool $mark100
* @access public
* @return bool
* @version 1.0
*/
function close_task($task_id, $reason, $comment, $mark100 = true)
{
global $db, $user, $fs;
$task = Flyspray::GetTaskDetails($task_id);
if (!$user->can_close_task($task)) {
return false;
}
if ($task['is_closed']) {
return false;
}
$db->x->autoExecute('{tasks}', array('date_closed' => time(), 'closed_by' => $user->id, 'closure_comment' => $comment, 'is_closed' => 1, 'resolution_reason' => $reason, 'last_edited_time' => time(), 'last_edited_by' => $user->id, 'percent_complete' => (bool) $mark100 * 100), MDB2_AUTOQUERY_UPDATE, sprintf('task_id = %d', $task_id));
if ($mark100) {
Flyspray::logEvent($task_id, 3, 100, $task['percent_complete'], 'percent_complete');
}
// [RED] Update last changed date
$db->x->execParam('UPDATE {redundant} SET last_changed_time = ?,
last_changed_by_real_name = ?, last_changed_by_user_name = ?,
closed_by_real_name = ?, closed_by_user_name = ?
WHERE task_id = ?', array(time(), $user->infos['real_name'], $user->infos['user_name'], $user->infos['real_name'], $user->infos['user_name'], $task_id));
Notifications::send($task_id, ADDRESS_TASK, NOTIFY_TASK_CLOSED);
Flyspray::logEvent($task_id, 2, $reason, $comment);
// If there's an admin request related to this, close it
$db->x->autoExecute('{admin_requests}', array('resolved_by' => $user->id, 'time_resolved' => time()), MDB2_AUTOQUERY_UPDATE, sprintf('task_id = %d AND request_type = 1', $task_id));
// duplicate
if ($reason == $fs->prefs['resolution_dupe']) {
$look = array('FS#', 'bug ');
foreach ($fs->projects as $project) {
$look[] = preg_quote($project['project_prefix'] . '#', '/');
}
preg_match("/\\b(" . implode('|', $look) . ")(\\d+)\\b/", $comment, $dupe_of);
if (count($dupe_of) >= 2) {
$existing = $db->x->getOne('SELECT count(*) FROM {related} WHERE this_task = ? AND related_task = ? AND related_type = 1', null, array($task_id, $dupe_of[1]));
if (!$existing) {
$db->x->autoExecute('{related}', array('this_task' => $task_id, 'related_task' => $dupe_of[1], 'related_type' => 1));
}
Backend::add_vote($task['opened_by'], $dupe_of[1]);
}
}
return true;
}
示例2: close_task
/**
* Closes a task
* @param integer $task_id
* @param integer $reason
* @param string $comment
* @param bool $mark100
* @access public
* @return bool
* @version 1.0
*/
public static function close_task($task_id, $reason, $comment, $mark100 = true)
{
global $db, $notify, $user, $proj;
$task = Flyspray::GetTaskDetails($task_id);
if (!$user->can_close_task($task)) {
return false;
}
if ($task['is_closed']) {
return false;
}
$db->Query('UPDATE {tasks}
SET date_closed = ?, closed_by = ?, closure_comment = ?,
is_closed = 1, resolution_reason = ?, last_edited_time = ?,
last_edited_by = ?
WHERE task_id = ?', array(time(), $user->id, $comment, $reason, time(), $user->id, $task_id));
if ($mark100) {
$db->Query('UPDATE {tasks} SET percent_complete = 100 WHERE task_id = ?', array($task_id));
Flyspray::logEvent($task_id, 3, 100, $task['percent_complete'], 'percent_complete');
}
$notify->Create(NOTIFY_TASK_CLOSED, $task_id, null, null, NOTIFY_BOTH, $proj->prefs['lang_code']);
Flyspray::logEvent($task_id, 2, $reason, $comment);
// If there's an admin request related to this, close it
$db->Query('UPDATE {admin_requests}
SET resolved_by = ?, time_resolved = ?
WHERE task_id = ? AND request_type = ?', array($user->id, time(), $task_id, 1));
// duplicate
if ($reason == 6) {
preg_match("/\\b(?:FS#|bug )(\\d+)\\b/", $comment, $dupe_of);
if (count($dupe_of) >= 2) {
$existing = $db->Query('SELECT * FROM {related} WHERE this_task = ? AND related_task = ? AND is_duplicate = 1', array($task_id, $dupe_of[1]));
if ($existing && $db->CountRows($existing) == 0) {
$db->Query('INSERT INTO {related} (this_task, related_task, is_duplicate) VALUES(?, ?, 1)', array($task_id, $dupe_of[1]));
}
Backend::add_vote($task['opened_by'], $dupe_of[1]);
}
}
return true;
}
示例3: array
if ($task['project_id'] != $parent['project_id']) {
Flyspray::show_error(L('musthavesameproject'));
break;
}
//finally looks like all the checks are valid so update the supertask_id for the current task
$db->Query('UPDATE {tasks}
SET supertask_id = ?
WHERE task_id = ?', array(Post::val('supertask_id'), Post::val('task_id')));
// If task already had a different parent, the log removal too
if ($task['supertask_id']) {
Flyspray::logEvent($task['supertask_id'], 33, Post::val('task_id'));
Flyspray::logEvent(Post::val('task_id'), 35, $task['supertask_id']);
}
// Log the events in the task history
Flyspray::logEvent(Post::val('supertask_id'), 32, Post::val('task_id'));
Flyspray::logEvent(Post::val('task_id'), 34, Post::val('supertask_id'));
// set success message
$_SESSION['SUCCESS'] = L('supertaskmodified');
break;
case 'notifications.remove':
if (!isset($_POST['message_id'])) {
// Flyspray::show_error(L('summaryanddetails'));
break;
}
if (!is_array($_POST['message_id'])) {
// Flyspray::show_error(L('summaryanddetails'));
break;
}
if (!count($_POST['message_id'])) {
// Nothing to do.
break;
示例4: L
$_SESSION['SUCCESS'] = L('taskmadeprivatemsg');
break;
// ##################
// making a task public
// ##################
// ##################
// making a task public
// ##################
case 'makepublic':
if (!$user->perms('manage_project')) {
break;
}
$db->Query('UPDATE {tasks}
SET mark_private = 0
WHERE task_id = ?', array($task['task_id']));
Flyspray::logEvent($task['task_id'], 3, 0, 1, 'mark_private');
$_SESSION['SUCCESS'] = L('taskmadepublicmsg');
break;
// ##################
// Adding a vote for a task
// ##################
// ##################
// Adding a vote for a task
// ##################
case 'details.addvote':
if (Backend::add_vote($user->id, $task['task_id'])) {
$_SESSION['SUCCESS'] = L('voterecorded');
} else {
Flyspray::show_error(L('votefailed'));
break;
}
示例5: COUNT
break;
}
//Check that the supertask_id is a numeric value
if (!is_integer((int) Post::val('supertask_id'))) {
Flyspray::show_error(L('invalidsupertaskid'));
break;
}
// check that supertask_id is a valid task id
$sql = $db->Query('SELECT COUNT(*) FROM {tasks}
WHERE task_id = ' . Post::val("supertask_id") . ';');
if (!$db->fetchOne($sql)) {
Flyspray::show_error(L('invalidsupertaskid'));
break;
}
// Log the event in the task history
Flyspray::logEvent(Get::val('task_id'), 34, Get::val('subtaskid'));
//finally looks like all the checks are valid so update the supertask_id for the current task
$db->Query('UPDATE {tasks}
SET supertask_id = ?
WHERE task_id = ?', array(Post::val('supertask_id'), Post::val('task_id')));
// set success message
$_SESSION['SUCCESS'] = L('supertaskmodified');
break;
case 'task.bulkupdate':
if (Post::val('updateselectedtasks') == "true") {
//process quick actions
switch (Post::val('bulk_quick_action')) {
case 'bulk_take_ownership':
Backend::assign_to_me(Post::val('user_id'), Post::val('ids'));
break;
case 'bulk_start_watching':
示例6: header
if ($db->countRows($res) < 1) {
header(':', true, 403);
die(L('invalidvalue'));
}
break;
case 'closedby_version':
$res = $db->Query('SELECT * FROM {list_version} WHERE (project_id=0 OR project_id=?) AND show_in_list=1 AND version_id=? AND version_tense=3', array($task['project_id'], $value));
if ($db->countRows($res) < 1) {
header(':', true, 403);
die(L('invalidvalue'));
}
break;
default:
header(':', true, 403);
die(L('invalidField'));
break;
}
$oldvalue = $task[Post::val('name')];
$time = time();
$sql = $db->Query("UPDATE {tasks} SET " . Post::val('name') . " = ?,last_edited_time = ? WHERE task_id = ?", array($value, $time, Post::val('task_id')));
# load $proj again of task with correct project_id for getting active notification types in notification class
$proj = new Project($task['project_id']);
// Log the changed field in task history
Flyspray::logEvent($task['task_id'], 3, $value, $oldvalue, Post::val('name'), $time);
// Get the details of the task we just updated to generate the changed-task message
$new_details_full = Flyspray::GetTaskDetails($task['task_id']);
$changes = Flyspray::compare_tasks($task, $new_details_full);
if (count($changes) > 0) {
$notify = new Notifications();
$notify->Create(NOTIFY_TASK_CHANGED, $task['task_id'], $changes, null, NOTIFY_BOTH, $proj->prefs['lang_code']);
}
示例7: action_requestclose
function action_requestclose($task)
{
global $proj, $user, $db;
if (Post::val('action') == 'requestclose') {
Flyspray::AdminRequest(1, $proj->id, $task['task_id'], $user->id, Post::val('reason_given'));
Flyspray::logEvent($task['task_id'], 20, Post::val('reason_given'));
} else {
Flyspray::AdminRequest(2, $proj->id, $task['task_id'], $user->id, Post::val('reason_given'));
Flyspray::logEvent($task['task_id'], 21, Post::val('reason_given'));
Backend::add_notification($user->id, $task['task_id']);
}
// Now, get the project managers' details for this project
$pms = $db->x->GetCol('SELECT u.user_id
FROM {users} u
LEFT JOIN {users_in_groups} uig ON u.user_id = uig.user_id
LEFT JOIN {groups} g ON uig.group_id = g.group_id
WHERE g.project_id = ? AND g.manage_project = 1', null, $proj->id);
if (count($pms)) {
Notifications::send($pms, ADDRESS_USER, NOTIFY_PM_REQUEST, array('task_id' => $task['task_id']));
}
return array(SUBMIT_OK, L('adminrequestmade'));
}