本文整理汇总了PHP中Jobs::getJobName方法的典型用法代码示例。如果您正苦于以下问题:PHP Jobs::getJobName方法的具体用法?PHP Jobs::getJobName怎么用?PHP Jobs::getJobName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jobs
的用法示例。
在下文中一共展示了Jobs::getJobName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
*
*/
public function execute()
{
$extProjId = Config::getInstance()->getValue(Config::id_externalTasksProject);
$issueList = $this->inputIssueSel->getIssueList();
$team = TeamCache::getInstance()->getTeam($this->teamid);
$teamMembers = $team->getMembers();
$jobs = new Jobs();
$realStartTimestamp = $this->endTimestamp;
// note: inverted intentionnaly
$realEndTimestamp = $this->startTimestamp;
// note: inverted intentionnaly
$loadPerJobs = array();
foreach ($issueList as $issue) {
if ($extProjId == $issue->getProjectId()) {
continue;
}
$issueTimetracks = $issue->getTimeTracks(NULL, $this->startTimestamp, $this->endTimestamp);
foreach ($issueTimetracks as $tt) {
// check if user in team
if (!array_key_exists($tt->getUserId(), $teamMembers)) {
continue;
}
// find real date range
if (NULL == $realStartTimestamp || $tt->getDate() < $realStartTimestamp) {
$realStartTimestamp = $tt->getDate();
}
if (NULL == $realEndTimestamp || $tt->getDate() > $realEndTimestamp) {
$realEndTimestamp = $tt->getDate();
}
if ($issue->isProjManagement(array($this->teamid))) {
$jobid = '999_Management';
if (!array_key_exists($jobid, $loadPerJobs)) {
// create job if not exist in jobList
$loadPerJobs[$jobid] = array('name' => T_('Management'), 'color' => 'A3A3A3', 'nbDays' => floatval($tt->getDuration()));
} else {
$loadPerJobs[$jobid]['nbDays'] += floatval($tt->getDuration());
}
} else {
if ($team->isSideTasksProject($issue->getProjectId())) {
// TODO check category (detail all sidetasks categories)
$jobid = '999_SideTasks';
if (!array_key_exists($jobid, $loadPerJobs)) {
// create job if not exist in jobList
$loadPerJobs[$jobid] = array('name' => T_('SideTasks'), 'color' => 'C2C2C2', 'nbDays' => floatval($tt->getDuration()));
} else {
$loadPerJobs[$jobid]['nbDays'] += floatval($tt->getDuration());
}
} else {
$jobid = $tt->getJobId();
if (!array_key_exists($jobid, $loadPerJobs)) {
// create job if not exist in jobList
$loadPerJobs[$jobid] = array('name' => htmlentities($jobs->getJobName($jobid), ENT_QUOTES | ENT_HTML401, "UTF-8"), 'color' => $jobs->getJobColor($jobid), 'nbDays' => floatval($tt->getDuration()));
} else {
$loadPerJobs[$jobid]['nbDays'] += floatval($tt->getDuration());
}
}
}
}
}
//self::$logger->error("date range: ".date('Y-m-d', $this->startTimestamp).'-'.date('Y-m-d', $this->endTimestamp));
//self::$logger->error("real date range: ".date('Y-m-d', $realStartTimestamp).'-'.date('Y-m-d', $realEndTimestamp));
// array sort to put sideTasks categories at the bottom
ksort($loadPerJobs);
$this->execData = array('loadPerJobs' => $loadPerJobs, 'realStartTimestamp' => $realStartTimestamp, 'realEndTimestamp' => $realEndTimestamp);
return $this->execData;
}
示例2: getJobDetails
/**
* Get info (color & name) for the jobs found in timetracks
* @param TimeTrack[] $timeTracks
* @return mixed[]
*/
private function getJobDetails(array $timeTracks)
{
$jobs = new Jobs();
$jobDetails = array();
foreach ($timeTracks as $tt) {
$jobid = $tt->getJobId();
if (!array_key_exists($jobid, $jobDetails)) {
$jobDetails[$jobid] = array("jobColor" => $jobs->getJobColor($jobid), "jobName" => $jobs->getJobName($jobid));
}
}
return $jobDetails;
}
示例3: getWeekTask
//.........这里部分代码省略.........
$description = Tools::mantisIssueURL($bugid, NULL, TRUE) . ' ' . $bugid . ' : ' . $summary;
$projectId = -1;
}
foreach ($jobList as $jobid => $dayList) {
// if no backlog set, display a '?' to allow Backlog edition
if (is_numeric($backlog)) {
$formattedBacklog = $backlog;
// prepare json data for the BacklogDialogbox
$jsonIssueInfo = self::getUpdateBacklogJsonData($bugid, $jobid, $teamid, $userid);
} else {
#if (($team->isSideTasksProject($issue->projectId)) ||
# ($team->isNoStatsProject($issue->projectId))) {
// do not allow to edit sideTasks Backlog
$formattedBacklog = '';
$jsonIssueInfo = '';
#} else {
# $formattedBacklog = '?';
#}
//
}
$dayTasks = "";
for ($i = 1; $i <= 7; $i++) {
$title = NULL;
$bgColor = NULL;
if ($i <= 5) {
$h = $holidays->isHoliday($weekDates[$i]);
if ($h) {
$bgColor = $h->color;
#$bgColor = Holidays::$defaultColor;
$title = $h->description;
}
} else {
$bgColor = Holidays::$defaultColor;
}
$day = 0;
if (array_key_exists($i, $dayList)) {
$day = $dayList[$i];
}
$dayTasks[] = array('bgColor' => $bgColor, 'title' => $title, 'day' => $day);
$totalElapsed[$weekDates[$i]]['elapsed'] += $day;
}
/*
$deadline = $issue->getDeadLine();
if (!is_null($deadline) || (0 != $deadline)) {
$formatedDate = Tools::formatDate(T_("%Y-%m-%d"), $deadline);
}
*/
try {
$project = ProjectCache::getInstance()->getProject($projectId);
} catch (Exception $e) {
$project = null;
}
if ($project != null) {
if (!$project->isSideTasksProject(array($teamid)) && !$project->isExternalTasksProject()) {
// TODO does $issue belong to current team's project ? what if not ?
$tooltipAttr = $issue->getTooltipItems($teamid, $userid);
$infoTooltip = Tools::imgWithTooltip('images/b_info.png', $tooltipAttr);
} else {
$infoTooltip = '';
}
} else {
$infoTooltip = '';
}
// prepare json data for the IssueNoteDialogbox
if ($project != null) {
if (!$project->isSideTasksProject(array($teamid)) && !$project->isExternalTasksProject()) {
$issueNote = IssueNote::getTimesheetNote($issue->getId());
if (!is_null($issueNote)) {
$issueNoteId = $issueNote->getId();
$user = UserCache::getInstance()->getUser($issueNote->getReporterId());
$rawNote = $issueNote->getText();
$note = trim(IssueNote::removeAllReadByTags($rawNote));
// used for the tooltip NOT the dialoBox
$tooltipAttr = array('reporter' => $user->getRealname(), 'date' => date('Y-m-d H:i:s', $issueNote->getLastModified()), 'Note' => $note);
$readByList = $issueNote->getReadByList(TRUE);
if (0 != count($readByList)) {
$tooltipAttr['Read by'] = implode(', ', array_keys($readByList));
}
$noteTooltip = Tools::imgWithTooltip('images/b_note.png', $tooltipAttr, NULL, 'js-add-note-link', ' style="cursor: pointer;" data-bugId="' . $issueNote->getBugId() . '"');
} else {
$issueNoteId = 0;
$noteTooltip = Tools::imgWithTooltip('images/b_note_grey.png', T_('Click to add a note'), NULL, 'js-add-note-link', ' style="cursor: pointer;" data-bugId="' . $issue->getId() . '"');
}
} else {
$noteTooltip = '';
}
} else {
$noteTooltip = '';
}
// if project not declared in current team, then
// user cannot add a timetrack by clicking in the weekTasks table
// Note: (this would generate an error on addTimetrack)
$team = TeamCache::getInstance()->getTeam($teamid);
$isTeamProject = !is_null($team->getProjectType($projectId));
$weekTasks[$bugid . "_" . $jobid] = array('bugid' => $bugid, 'description' => $description, 'formattedBacklog' => $formattedBacklog, 'jobid' => $jobid, 'jobName' => $jobs->getJobName($jobid), 'dayTasks' => $dayTasks, 'infoTooltip' => $infoTooltip, 'summary' => addslashes(htmlspecialchars($summary)), 'updateBacklogJsonData' => $jsonIssueInfo, 'issueNoteId' => $issueNoteId, 'noteTooltip' => $noteTooltip, 'isTeamProject' => $isTeamProject);
}
}
return array("weekTasks" => $weekTasks, "totalElapsed" => $totalElapsed);
}
示例4: execute
/**
*
*/
public function execute()
{
$my_endTimestamp = mktime(23, 59, 59, date('m', $this->endTimestamp), date('d', $this->endTimestamp), date('Y', $this->endTimestamp));
// candidate teams
$teamList = Team::getTeams(true);
if (!array_key_exists($this->displayedTeam, $teamList)) {
$teamIds = array_keys($teamList);
if (count($teamIds) > 0) {
$this->displayedTeam = $teamIds[0];
} else {
$this->displayedTeam = 0;
}
}
// get timetracks
$timetracks = array();
if (0 != $this->displayedTeam) {
$members = TeamCache::getInstance()->getTeam($this->displayedTeam)->getActiveMembers();
if (!empty($members)) {
$memberIdList = array_keys($members);
$formatedMembers = implode(', ', $memberIdList);
$query = "SELECT * FROM `codev_timetracking_table` " . "WHERE date >= {$this->startTimestamp} AND date <= {$my_endTimestamp} " . "AND userid IN ({$formatedMembers})" . "ORDER BY date;";
$result = SqlWrapper::getInstance()->sql_query($query);
if (!$result) {
echo "<span style='color:red'>ERROR: Query FAILED</span>";
exit;
}
$jobs = new Jobs();
while ($row = SqlWrapper::getInstance()->sql_fetch_object($result)) {
$tt = TimeTrackCache::getInstance()->getTimeTrack($row->id, $row);
$user = UserCache::getInstance()->getUser($tt->getUserId());
$issue = IssueCache::getInstance()->getIssue($tt->getIssueId());
if (!is_null($tt->getCommitterId())) {
$committer = UserCache::getInstance()->getUser($tt->getCommitterId());
$committer_name = $committer->getName();
$commit_date = date('Y-m-d H:i:s', $tt->getCommitDate());
} else {
$committer_name = '';
// this info does not exist before v1.0.4
$commit_date = '';
}
$timetracks[$row->id] = array('user' => $user->getName(), 'date' => date('Y-m-d', $tt->getDate()), 'job' => $jobs->getJobName($tt->getJobId()), 'duration' => $tt->getDuration(), 'committer' => $committer_name, 'commit_date' => $commit_date, 'task_id' => $issue->getId(), 'task_extRef' => $issue->getTcId(), 'task_summary' => $issue->getSummary());
}
}
}
$this->execData = array('teamList' => $teamList, 'startTimestamp' => $this->startTimestamp, 'endTimestamp' => $this->endTimestamp, 'timetracks' => $timetracks);
return $this->execData;
}
示例5: getTimetrackingTuples
/**
* display Timetracking Tuples
* @param int $userid
* @param TimeTracking $timeTracking
* @return mixed[]
*/
private function getTimetrackingTuples($userid, TimeTracking $timeTracking)
{
// Display previous entries
$query = "SELECT id, bugid, jobid, date, duration" . " FROM `codev_timetracking_table`" . " WHERE userid = {$userid}" . " AND date >= " . $timeTracking->getStartTimestamp() . " ORDER BY date";
$result = SqlWrapper::getInstance()->sql_query($query) or die("Query failed: {$query}");
$jobs = new Jobs();
$timetrackingTuples = array();
while ($row = SqlWrapper::getInstance()->sql_fetch_object($result)) {
// get information on this bug
try {
$issue = IssueCache::getInstance()->getIssue($row->bugid);
// get general information
$jobName = $jobs->getJobName($row->jobid);
$formatedDate = Tools::formatDate("%Y-%m-%d", $row->date);
$cosmeticDate = Tools::formatDate("%Y-%m-%d - %A", $row->date);
$formatedJobName = str_replace("'", "\\'", $jobName);
$formatedSummary = str_replace("'", "\\'", $issue->getSummary());
$formatedSummary = str_replace('"', "\\'", $formatedSummary);
$formatedSummary = htmlspecialchars(preg_replace('![\\t\\r\\n]+!', ' ', $formatedSummary));
//$totalEstim = $issue->effortEstim + $issue->effortAdd;
$timetrackingTuples[$row->id] = array('timestamp' => $row->date, 'date' => $formatedDate, 'formatedId' => $issue->getFormattedIds(), 'duration' => $row->duration, 'formatedJobName' => $formatedJobName, 'summary' => $formatedSummary, 'cosmeticDate' => $cosmeticDate, 'mantisURL' => Tools::mantisIssueURL($row->bugid, NULL, true), 'issueURL' => Tools::issueInfoURL($row->bugid), 'issueId' => $issue->getTcId(), 'projectName' => $issue->getProjectName(), 'issueSummary' => htmlspecialchars(preg_replace('![\\t\\r\\n]+!', ' ', $issue->getSummary())), 'jobName' => $jobName, 'categoryName' => $issue->getCategoryName(), 'currentStatusName' => $issue->getCurrentStatusName());
} catch (Exception $e) {
$summary = T_('Error: Task not found in Mantis DB !');
$timetrackingTuples[$row->id] = array('formatedId' => $row->bugid, 'duration' => $row->duration, 'summary' => $summary, 'mantisURL' => '', 'issueURL' => $row->bugid, 'issueId' => '!', 'projectName' => '!', 'issueSummary' => '<span class="error_font">' . $summary . '</span>', 'categoryName' => '!', 'currentStatusName' => '!');
}
}
$currentTimeTrackingTuples = array();
$futureTimeTrackingTuples = array();
foreach ($timetrackingTuples as $trackId => $timeTrackingTuple) {
if ($timeTrackingTuple['timestamp'] <= $timeTracking->getEndTimestamp()) {
$currentTimeTrackingTuples[$trackId] = $timeTrackingTuple;
} else {
$futureTimeTrackingTuples[$trackId] = $timeTrackingTuple;
}
unset($timeTrackingTuple['timestamp']);
}
return array("current" => $currentTimeTrackingTuples, "future" => $futureTimeTrackingTuples);
}