本文整理汇总了PHP中thebuggenie\core\entities\Issue::convertFancyStringToTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::convertFancyStringToTime方法的具体用法?PHP Issue::convertFancyStringToTime怎么用?PHP Issue::convertFancyStringToTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\entities\Issue
的用法示例。
在下文中一共展示了Issue::convertFancyStringToTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editOrAdd
public function editOrAdd(Issue $issue, User $user, $data = array())
{
if (!$this->getID()) {
if ($data['timespent_manual']) {
$times = Issue::convertFancyStringToTime($data['timespent_manual'], $issue);
} else {
$times = \thebuggenie\core\entities\common\Timeable::getZeroedUnitsWithPoints();
$times[$data['timespent_specified_type']] = $data['timespent_specified_value'];
}
$this->setIssue($issue);
$this->setUser($user);
} else {
$times = array('points' => $data['points'], 'minutes' => $data['minutes'], 'hours' => $data['hours'], 'days' => $data['days'], 'weeks' => $data['weeks'], 'months' => $data['months']);
$edited_at = $data['edited_at'];
$this->setEditedAt(mktime(0, 0, 1, $edited_at['month'], $edited_at['day'], $edited_at['year']));
}
$times['hours'] *= 100;
$this->setSpentPoints($times['points']);
$this->setSpentMinutes($times['minutes']);
$this->setSpentHours($times['hours']);
$this->setSpentDays($times['days']);
$this->setSpentWeeks($times['weeks']);
$this->setSpentMonths($times['months']);
$this->setActivityType($data['timespent_activitytype']);
$this->setComment($data['timespent_comment']);
$this->save();
$this->getIssue()->saveSpentTime();
}
示例2: perform
//.........这里部分代码省略.........
case self::ACTION_CLEAR_REPRODUCABILITY:
$issue->setReproducability(null);
break;
case self::ACTION_SET_REPRODUCABILITY:
if ($this->getTargetValue()) {
$issue->setReproducability(Reproducability::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setReproducability($request['reproducability_id']);
}
break;
case self::ACTION_CLEAR_ASSIGNEE:
$issue->clearAssignee();
break;
case self::ACTION_ASSIGN_ISSUE:
if ($this->getTargetValue()) {
$target_details = explode('_', $this->_target_value);
if ($target_details[0] == 'user') {
$assignee = \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $target_details[1]);
} else {
$assignee = Team::getB2DBTable()->selectById((int) $target_details[1]);
}
$issue->setAssignee($assignee);
} else {
$assignee = null;
switch ($request['assignee_type']) {
case 'user':
$assignee = \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $request['assignee_id']);
break;
case 'team':
$assignee = Team::getB2DBTable()->selectById((int) $request['assignee_id']);
break;
}
if ((bool) $request->getParameter('assignee_teamup', false) && $assignee instanceof \thebuggenie\core\entities\User && $assignee->getID() != framework\Context::getUser()->getID()) {
$team = new \thebuggenie\core\entities\Team();
$team->setName($assignee->getBuddyname() . ' & ' . framework\Context::getUser()->getBuddyname());
$team->setOndemand(true);
$team->save();
$team->addMember($assignee);
$team->addMember(framework\Context::getUser());
$assignee = $team;
}
$issue->setAssignee($assignee);
}
break;
case self::ACTION_USER_START_WORKING:
$issue->clearUserWorkingOnIssue();
if ($issue->getAssignee() instanceof \thebuggenie\core\entities\Team && $issue->getAssignee()->isOndemand()) {
$members = $issue->getAssignee()->getMembers();
$issue->startWorkingOnIssue(array_shift($members));
} elseif ($issue->getAssignee() instanceof \thebuggenie\core\entities\User) {
$issue->startWorkingOnIssue($issue->getAssignee());
}
break;
case self::ACTION_USER_STOP_WORKING:
if ($request->getParameter('did', 'nothing') == 'nothing') {
$issue->clearUserWorkingOnIssue();
} elseif ($request->getParameter('did', 'nothing') == 'this') {
$times = array();
if ($request['timespent_manual']) {
$times = Issue::convertFancyStringToTime($request['timespent_manual']);
} elseif ($request['timespent_specified_type']) {
$times = array('points' => 0, 'hours' => 0, 'days' => 0, 'weeks' => 0, 'months' => 0);
$times[$request['timespent_specified_type']] = $request['timespent_specified_value'];
}
if (array_sum($times) > 0) {
$times['hours'] *= 100;
$spenttime = new \thebuggenie\core\entities\IssueSpentTime();
$spenttime->setIssue($issue);
$spenttime->setUser(framework\Context::getUser());
$spenttime->setSpentPoints($times['points']);
$spenttime->setSpentHours($times['hours']);
$spenttime->setSpentDays($times['days']);
$spenttime->setSpentWeeks($times['weeks']);
$spenttime->setSpentMonths($times['months']);
$spenttime->setActivityType($request['timespent_activitytype']);
$spenttime->setComment($request['timespent_comment']);
$spenttime->save();
}
$issue->clearUserWorkingOnIssue();
} else {
$issue->stopWorkingOnIssue();
}
break;
default:
if (strpos($this->_action_type, self::CUSTOMFIELD_CLEAR_PREFIX) === 0) {
$customkey = substr($this->_action_type, strlen(self::CUSTOMFIELD_CLEAR_PREFIX));
$issue->setCustomField($customkey, null);
} elseif (strpos($this->_action_type, self::CUSTOMFIELD_SET_PREFIX) === 0) {
$customkey = substr($this->_action_type, strlen(self::CUSTOMFIELD_SET_PREFIX));
if ($this->getTargetValue()) {
$issue->setCustomField($customkey, $this->getTargetValue());
} else {
$issue->setCustomField($customkey, $request[$customkey . '_id']);
}
} else {
$event = new \thebuggenie\core\framework\Event('core', 'WorkflowTransitionAction::perform', $issue, array('request' => $request));
$event->triggerUntilProcessed();
}
}
}
示例3: runIssueEditTimeSpent
public function runIssueEditTimeSpent(framework\Request $request)
{
$entry_id = $request['entry_id'];
$spenttime = $entry_id ? tables\IssueSpentTimes::getTable()->selectById($entry_id) : new entities\IssueSpentTime();
if ($issue_id = $request['issue_id']) {
try {
$issue = entities\Issue::getB2DBTable()->selectById($issue_id);
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderText('fail');
}
} else {
$this->getResponse()->setHttpStatus(400);
return $this->renderText('no issue');
}
if (!$spenttime->getID()) {
if ($request['timespent_manual']) {
$times = entities\Issue::convertFancyStringToTime($request['timespent_manual']);
} else {
$times = array('points' => 0, 'hours' => 0, 'days' => 0, 'weeks' => 0, 'months' => 0);
$times[$request['timespent_specified_type']] = $request['timespent_specified_value'];
}
$spenttime->setIssue($issue);
$spenttime->setUser($this->getUser());
} else {
$times = array('points' => $request['points'], 'hours' => $request['hours'], 'days' => $request['days'], 'weeks' => $request['weeks'], 'months' => $request['months']);
$edited_at = $request['edited_at'];
$spenttime->setEditedAt(mktime(0, 0, 1, $edited_at['month'], $edited_at['day'], $edited_at['year']));
}
$times['hours'] *= 100;
$spenttime->setSpentPoints($times['points']);
$spenttime->setSpentHours($times['hours']);
$spenttime->setSpentDays($times['days']);
$spenttime->setSpentWeeks($times['weeks']);
$spenttime->setSpentMonths($times['months']);
$spenttime->setActivityType($request['timespent_activitytype']);
$spenttime->setComment($request['timespent_comment']);
$spenttime->save();
$spenttime->getIssue()->saveSpentTime();
$timesum = array_sum($spenttime->getIssue()->getSpentTime());
return $this->renderJSON(array('edited' => 'ok', 'issue_id' => $issue_id, 'timesum' => $timesum, 'spenttime' => entities\Issue::getFormattedTime($spenttime->getIssue()->getSpentTime()), 'percentbar' => $this->getComponentHTML('main/percentbar', array('percent' => $issue->getEstimatedPercentCompleted(), 'height' => 3)), 'timeentries' => $this->getComponentHTML('main/issuespenttimes', array('issue' => $spenttime->getIssue()))));
}