本文整理汇总了PHP中thebuggenie\core\framework\Context::performAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::performAction方法的具体用法?PHP Context::performAction怎么用?PHP Context::performAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\framework\Context
的用法示例。
在下文中一共展示了Context::performAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runMilestone
/**
* Milestone actions
*
* @Route(url="/:project_key/milestone/:milestone_id/actions/*", name='project_milestone')
*
* @param \thebuggenie\core\framework\Request $request
*/
public function runMilestone(framework\Request $request)
{
$milestone_id = $request['milestone_id'] ? $request['milestone_id'] : null;
$milestone = new \thebuggenie\core\entities\Milestone($milestone_id);
$action_option = str_replace($this->selected_project->getKey() . '/milestone/' . $request['milestone_id'] . '/', '', $request['url']);
try {
if (!($this->getUser()->canAddScrumSprints($this->selected_project) || $this->getUser()->canManageProjectReleases($this->selected_project) && $this->getUser()->canManageProject($this->selected_project))) {
throw new \Exception($this->getI18n()->__("You don't have access to modify milestones"));
}
switch (true) {
case $request->isDelete():
$milestone->delete();
$no_milestone = new \thebuggenie\core\entities\Milestone(0);
$no_milestone->setProject($milestone->getProject());
return $this->renderJSON(array('issue_count' => $no_milestone->countIssues(), 'hours' => $no_milestone->getHoursEstimated(), 'points' => $no_milestone->getPointsEstimated()));
case $request->isPost():
$this->_saveMilestoneDetails($request, $milestone);
if ($request->hasParameter('issues') && $request['include_selected_issues']) {
\thebuggenie\core\entities\tables\Issues::getTable()->assignMilestoneIDbyIssueIDs($milestone->getID(), $request['issues']);
}
$event = \thebuggenie\core\framework\Event::createNew('project', 'runMilestone::post', $milestone);
$event->triggerUntilProcessed();
if ($event->isProcessed()) {
$component = $event->getReturnValue();
} else {
$component = $this->getComponentHTML('project/milestonebox', array('milestone' => $milestone, 'include_counts' => true));
}
$message = framework\Context::getI18n()->__('Milestone saved');
return $this->renderJSON(array('message' => $message, 'component' => $component, 'milestone_id' => $milestone->getID()));
case $action_option == 'details':
\thebuggenie\core\framework\Context::performAction(new \thebuggenie\core\modules\project\controllers\Main(), 'project', 'MilestoneDetails');
return true;
default:
return $this->forward($this->getRouting()->generate('project_roadmap', array('project_key' => $this->selected_project->getKey())));
}
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $e->getMessage()));
}
}
示例2: runIssueEditTimeSpent
public function runIssueEditTimeSpent(framework\Request $request)
{
try {
\thebuggenie\core\framework\Context::performAction(new \thebuggenie\core\modules\main\controllers\Main(), 'main', 'IssueEditTimeSpent');
} catch (\Exception $e) {
ob_get_clean();
return $this->renderJSON(array('edited' => 'error', 'error' => $e->getMessage()));
}
ob_get_clean();
$this->return_data = array('edited' => 'ok');
}