本文整理汇总了PHP中Status::getDetails方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::getDetails方法的具体用法?PHP Status::getDetails怎么用?PHP Status::getDetails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::getDetails方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Method to update the details of a specific issue.
*
* @param integer $issue_id The issue ID
* @return integer 1 if the update worked, -1 or -2 otherwise
*/
public static function update($issue_id)
{
$issue_id = (int) $issue_id;
$usr_id = Auth::getUserID();
$prj_id = self::getProjectID($issue_id);
$workflow = Workflow::preIssueUpdated($prj_id, $issue_id, $usr_id, $_POST);
if ($workflow !== true) {
return $workflow;
}
// get all of the 'current' information of this issue
$current = self::getDetails($issue_id);
$associated_issues = isset($_POST['associated_issues']) ? explode(',', $_POST['associated_issues']) : array();
self::updateAssociatedIssuesRelations($issue_id, $associated_issues);
$assignments_changed = false;
if (@$_POST['keep_assignments'] == 'no') {
// only change the issue-user associations if there really were any changes
$old_assignees = array_merge($current['assigned_users'], $current['assigned_inactive_users']);
if (!empty($_POST['assignments'])) {
$new_assignees = @$_POST['assignments'];
} else {
$new_assignees = array();
}
$assignment_notifications = array();
// remove people from the assignment list, if appropriate
foreach ($old_assignees as $assignee) {
if (!in_array($assignee, $new_assignees)) {
self::deleteUserAssociation($issue_id, $assignee);
$assignments_changed = true;
}
}
// add people to the assignment list, if appropriate
foreach ($new_assignees as $assignee) {
if (!in_array($assignee, $old_assignees)) {
self::addUserAssociation($usr_id, $issue_id, $assignee);
Notification::subscribeUser($usr_id, $issue_id, $assignee, Notification::getDefaultActions($issue_id, User::getEmail($assignee), 'issue_update'), true);
$assignment_notifications[] = $assignee;
$assignments_changed = true;
}
}
if (count($assignment_notifications) > 0) {
Notification::notifyNewAssignment($assignment_notifications, $issue_id);
}
}
if (empty($_POST['estimated_dev_time'])) {
$_POST['estimated_dev_time'] = 0;
}
$params = array('iss_updated_date' => Date_Helper::getCurrentDateGMT(), 'iss_last_public_action_date' => Date_Helper::getCurrentDateGMT(), 'iss_last_public_action_type' => 'updated', 'iss_sta_id' => $_POST['status'], 'iss_summary' => $_POST['summary'], 'iss_description' => $_POST['description']);
if (isset($_POST['release'])) {
$params['iss_pre_id'] = $_POST['release'];
}
if (isset($_POST['percentage_complete'])) {
$params['iss_percent_complete'] = $_POST['percentage_complete'];
}
if (isset($_POST['group'])) {
$params['iss_grp_id'] = $_POST['group'];
}
if (isset($_POST['estimated_dev_time'])) {
$params['iss_dev_time'] = $_POST['estimated_dev_time'];
}
if (isset($_POST['trigger_reminders'])) {
$params['iss_trigger_reminders'] = $_POST['trigger_reminders'];
}
if (isset($_POST['resolution'])) {
$params['iss_res_id'] = $_POST['resolution'];
}
if (!empty($_POST['category'])) {
$params['iss_prc_id'] = $_POST['category'];
}
if (@$_POST['keep'] == 'no') {
$params['iss_pre_id'] = $_POST['release'];
}
if (!empty($_POST['expected_resolution_date'])) {
$params['iss_expected_resolution_date'] = $_POST['expected_resolution_date'];
} else {
$params['iss_expected_resolution_date'] = null;
}
if (isset($_POST['private'])) {
$params['iss_private'] = $_POST['private'];
}
if (isset($_POST['priority'])) {
$params['iss_pri_id'] = $_POST['priority'];
}
if (isset($_POST['severity'])) {
$params['iss_sev_id'] = $_POST['severity'];
}
if (isset($_POST['scheduled_release'])) {
$params['iss_pre_id'] = $_POST['scheduled_release'];
}
$stmt = 'UPDATE {{%issue}} SET ' . DB_Helper::buildSet($params) . ' WHERE iss_id=?';
$params[] = $issue_id;
try {
DB_Helper::getInstance()->query($stmt, $params);
} catch (DbException $e) {
return -1;
//.........这里部分代码省略.........
示例2: StatsChart
/**
* Plot various stats charts
*
* @param string $plotType
* @param bool $hide_closed
* @return bool return false if no data is available
*/
public function StatsChart($plotType, $hide_closed)
{
// don't bother if user has no access
$prj_id = Auth::getCurrentProject();
if (Auth::getCurrentRole() <= User::getRoleID('Reporter') && Project::getSegregateReporters($prj_id)) {
return false;
}
$colors = array();
switch ($plotType) {
case 'status':
$data = Stats::getAssocStatus($hide_closed);
$graph_title = ev_gettext('Issues by Status');
// use same colors as defined for statuses
foreach ($data as $sta_title => $trash) {
$sta_id = Status::getStatusID($sta_title);
$status_details = Status::getDetails($sta_id);
$colors[] = $status_details['sta_color'];
}
break;
case 'release':
$data = Stats::getAssocRelease($hide_closed);
$graph_title = ev_gettext('Issues by Release');
break;
case 'priority':
$data = Stats::getAssocPriority($hide_closed);
$graph_title = ev_gettext('Issues by Priority');
break;
case 'user':
$data = Stats::getAssocUser($hide_closed);
$graph_title = ev_gettext('Issues by Assignment');
break;
case 'category':
$data = Stats::getAssocCategory($hide_closed);
$graph_title = ev_gettext('Issues by Category');
break;
default:
return false;
}
// check the values coming from the database and if they are all empty, then
// output a pre-generated 'No Data Available' picture
if (!Stats::hasData($data)) {
return false;
}
$plot = $this->create(360, 200);
$plot->SetImageBorderType('plain');
$plot->SetTitle($graph_title);
$plot->SetPlotType('pie');
$plot->SetDataType('text-data-single');
if ($colors) {
$plot->SetDataColors($colors);
}
$legend = $dataValue = array();
foreach ($data as $label => $count) {
$legend[] = $label . ' (' . $count . ')';
$dataValue[] = array($label, $count);
}
$plot->SetDataValues($dataValue);
foreach ($legend as $label) {
$plot->SetLegend($label);
}
return $plot->DrawGraph();
}
示例3: Template_API
include_once "../config.inc.php";
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.project.php";
include_once APP_INC_PATH . "class.status.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", "statuses");
$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 (@$HTTP_POST_VARS["cat"] == "new") {
$tpl->assign("result", Status::insert());
} elseif (@$HTTP_POST_VARS["cat"] == "update") {
$tpl->assign("result", Status::update());
} elseif (@$HTTP_POST_VARS["cat"] == "delete") {
Status::remove();
}
if (@$HTTP_GET_VARS["cat"] == "edit") {
$tpl->assign("info", Status::getDetails($HTTP_GET_VARS["id"]));
}
$tpl->assign("list", Status::getList());
$tpl->assign("project_list", Project::getAll());
} else {
$tpl->assign("show_not_allowed_msg", true);
}
$tpl->displayTemplate();
示例4: 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();
示例5: update
/**
* Method used to update the details of a specific issue.
*
* @access public
* @param integer $issue_id The issue ID
* @return integer 1 if the update worked, -1 or -2 otherwise
*/
function update($issue_id)
{
global $HTTP_POST_VARS;
$issue_id = Misc::escapeInteger($issue_id);
$usr_id = Auth::getUserID();
$prj_id = Issue::getProjectID($issue_id);
// get all of the 'current' information of this issue
$current = Issue::getDetails($issue_id);
// update the issue associations
$association_diff = Misc::arrayDiff($current['associated_issues'], @$HTTP_POST_VARS['associated_issues']);
if (count($association_diff) > 0) {
// go through the new assocations, if association already exists, skip it
$associations_to_remove = $current['associated_issues'];
if (count(@$HTTP_POST_VARS['associated_issues']) > 0) {
foreach ($HTTP_POST_VARS['associated_issues'] as $index => $associated_id) {
if (!in_array($associated_id, $current['associated_issues'])) {
Issue::addAssociation($issue_id, $associated_id, $usr_id);
} else {
// already assigned, remove this user from list of users to remove
unset($associations_to_remove[array_search($associated_id, $associations_to_remove)]);
}
}
}
if (count($associations_to_remove) > 0) {
foreach ($associations_to_remove as $associated_id) {
Issue::deleteAssociation($issue_id, $associated_id);
}
}
}
if (!empty($HTTP_POST_VARS['expected_resolution_date']['Year']) && !empty($HTTP_POST_VARS['expected_resolution_date']['Month']) && !empty($HTTP_POST_VARS['expected_resolution_date']['Day'])) {
$HTTP_POST_VARS['expected_resolution_date'] = sprintf('%s-%s-%s', $HTTP_POST_VARS['expected_resolution_date']['Year'], $HTTP_POST_VARS['expected_resolution_date']['Month'], $HTTP_POST_VARS['expected_resolution_date']['Day']);
} else {
$HTTP_POST_VARS['expected_resolution_date'] = '';
}
$assignments_changed = false;
if (@$HTTP_POST_VARS["keep_assignments"] == "no") {
// only change the issue-user associations if there really were any changes
$old_assignees = array_merge($current['assigned_users'], $current['assigned_inactive_users']);
if (!empty($HTTP_POST_VARS['assignments'])) {
$new_assignees = @$HTTP_POST_VARS['assignments'];
} else {
$new_assignees = array();
}
$assignment_notifications = array();
// remove people from the assignment list, if appropriate
foreach ($old_assignees as $assignee) {
if (!in_array($assignee, $new_assignees)) {
Issue::deleteUserAssociation($issue_id, $assignee);
$assignments_changed = true;
}
}
// add people to the assignment list, if appropriate
foreach ($new_assignees as $assignee) {
if (!in_array($assignee, $old_assignees)) {
Issue::addUserAssociation($usr_id, $issue_id, $assignee);
Notification::subscribeUser($usr_id, $issue_id, $assignee, Notification::getDefaultActions(), TRUE);
$assignment_notifications[] = $assignee;
$assignments_changed = true;
}
}
if (count($assignment_notifications) > 0) {
Notification::notifyNewAssignment($assignment_notifications, $issue_id);
}
}
if (empty($HTTP_POST_VARS["estimated_dev_time"])) {
$HTTP_POST_VARS["estimated_dev_time"] = 0;
}
$stmt = "UPDATE\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n SET\n iss_updated_date='" . Date_API::getCurrentDateGMT() . "',\n iss_last_public_action_date='" . Date_API::getCurrentDateGMT() . "',\n iss_last_public_action_type='updated',";
if (!empty($HTTP_POST_VARS["category"])) {
$stmt .= "iss_prc_id=" . Misc::escapeInteger($HTTP_POST_VARS["category"]) . ",";
}
if (@$HTTP_POST_VARS["keep"] == "no") {
$stmt .= "iss_pre_id=" . Misc::escapeInteger($HTTP_POST_VARS["release"]) . ",";
}
if (!empty($HTTP_POST_VARS['expected_resolution_date'])) {
$stmt .= "iss_expected_resolution_date='" . Misc::escapeString($HTTP_POST_VARS['expected_resolution_date']) . "',";
} else {
$stmt .= "iss_expected_resolution_date=null,";
}
$stmt .= "\n iss_pre_id=" . Misc::escapeInteger($HTTP_POST_VARS["release"]) . ",\n iss_pri_id=" . Misc::escapeInteger($HTTP_POST_VARS["priority"]) . ",\n iss_sta_id=" . Misc::escapeInteger($HTTP_POST_VARS["status"]) . ",\n iss_res_id=" . Misc::escapeInteger($HTTP_POST_VARS["resolution"]) . ",\n iss_summary='" . Misc::escapeString($HTTP_POST_VARS["summary"]) . "',\n iss_description='" . Misc::escapeString($HTTP_POST_VARS["description"]) . "',\n iss_dev_time='" . Misc::escapeString($HTTP_POST_VARS["estimated_dev_time"]) . "',\n iss_percent_complete= '" . Misc::escapeString($HTTP_POST_VARS["percent_complete"]) . "',\n iss_trigger_reminders=" . Misc::escapeInteger($HTTP_POST_VARS["trigger_reminders"]) . ",\n iss_grp_id ='" . Misc::escapeInteger($HTTP_POST_VARS["group"]) . "'";
if (isset($HTTP_POST_VARS['private'])) {
$stmt .= ",\n iss_private = " . Misc::escapeInteger($HTTP_POST_VARS['private']);
}
$stmt .= "\n WHERE\n iss_id={$issue_id}";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
} else {
// add change to the history (only for changes on specific fields?)
$updated_fields = array();
if ($current["iss_expected_resolution_date"] != $HTTP_POST_VARS['expected_resolution_date']) {
$updated_fields["Expected Resolution Date"] = History::formatChanges($current["iss_expected_resolution_date"], $HTTP_POST_VARS['expected_resolution_date']);
//.........这里部分代码省略.........