本文整理汇总了PHP中thebuggenie\core\framework\Context::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getRequest方法的具体用法?PHP Context::getRequest怎么用?PHP Context::getRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\framework\Context
的用法示例。
在下文中一共展示了Context::getRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processCommit
//.........这里部分代码省略.........
$user = \thebuggenie\core\entities\tables\Users::getTable()->getByRealname($author);
}
// c)
if (!$user instanceof \thebuggenie\core\entities\User) {
$user = \thebuggenie\core\entities\tables\Users::getTable()->getByBuddyname($author);
}
// d)
if (!$user instanceof \thebuggenie\core\entities\User) {
$user = \thebuggenie\core\entities\tables\Users::getTable()->getByUsername($author);
}
// e)
if (!$user instanceof \thebuggenie\core\entities\User) {
$user = framework\Settings::getDefaultUser();
}
framework\Context::setUser($user);
framework\Settings::forceSettingsReload();
framework\Context::cacheAllPermissions();
$output .= '[VCS ' . $project->getKey() . '] Commit to be logged by user ' . $user->getName() . "\n";
if ($date == null) {
$date = NOW;
}
// Create the commit data
$commit = new Commit();
$commit->setAuthor($user);
$commit->setDate($date);
$commit->setLog($commit_msg);
$commit->setPreviousRevision($old_rev);
$commit->setRevision($new_rev);
$commit->setProject($project);
if ($branch !== null) {
$data = 'branch:' . $branch;
$commit->setMiscData($data);
}
if ($callback !== null) {
$commit = $callback($commit);
}
$commit->save();
$output .= '[VCS ' . $project->getKey() . '] Commit logged with revision ' . $commit->getRevision() . "\n";
// Iterate over affected issues and update them.
foreach ($issues as $issue) {
$inst = new IssueLink();
$inst->setIssue($issue);
$inst->setCommit($commit);
$inst->save();
// Process all commit-message transitions for an issue.
foreach ($transitions[$issue->getFormattedIssueNo()] as $transition) {
if (framework\Settings::get('vcs_workflow_' . $project->getID(), 'vcs_integration') == self::WORKFLOW_ENABLED) {
framework\Context::setUser($user);
framework\Settings::forceSettingsReload();
framework\Context::cacheAllPermissions();
if ($issue->isWorkflowTransitionsAvailable()) {
// Go through the list of possible transitions for an issue. Only
// process transitions that are applicable to issue's workflow.
foreach ($issue->getAvailableWorkflowTransitions() as $possible_transition) {
if (mb_strtolower($possible_transition->getName()) == mb_strtolower($transition[0])) {
$output .= '[VCS ' . $project->getKey() . '] Running transition ' . $transition[0] . ' on issue ' . $issue->getFormattedIssueNo() . "\n";
// String representation of parameters. Used for log message.
$parameters_string = "";
// Iterate over the list of this transition's parameters, and
// set them.
foreach ($transition[1] as $parameter => $value) {
$parameters_string .= "{$parameter}={$value} ";
switch ($parameter) {
case 'resolution':
if (($resolution = \thebuggenie\core\entities\Resolution::getByKeyish($value)) instanceof \thebuggenie\core\entities\Resolution) {
framework\Context::getRequest()->setParameter('resolution_id', $resolution->getID());
}
break;
case 'status':
if (($status = \thebuggenie\core\entities\Status::getByKeyish($value)) instanceof \thebuggenie\core\entities\Status) {
framework\Context::getRequest()->setParameter('status_id', $status->getID());
}
break;
}
}
// Run the transition.
$possible_transition->transitionIssueToOutgoingStepWithoutRequest($issue);
// Log an informative message about the transition.
$output .= '[VCS ' . $project->getKey() . '] Ran transition ' . $possible_transition->getName() . ' with parameters \'' . $parameters_string . '\' on issue ' . $issue->getFormattedIssueNo() . "\n";
}
}
}
}
}
$issue->addSystemComment(framework\Context::getI18n()->__('This issue has been updated with the latest changes from the code repository.<source>%commit_msg</source>', array('%commit_msg' => $commit_msg)), $user->getID());
$output .= '[VCS ' . $project->getKey() . '] Updated issue ' . $issue->getFormattedIssueNo() . "\n";
}
// Create file links
foreach ($files as $afile) {
// index 0 is action, index 1 is file
$inst = new File();
$inst->setAction($afile[0]);
$inst->setFile($afile[1]);
$inst->setCommit($commit);
$inst->save();
$output .= '[VCS ' . $project->getKey() . '] Added with action ' . $afile[0] . ' file ' . $afile[1] . "\n";
}
framework\Event::createNew('vcs_integration', 'new_commit')->trigger(array('commit' => $commit));
return $output;
}
示例2: getCurrentRouteAction
/**
* Returns the current route action
*
* @return string The current route action
*/
public function getCurrentRouteAction()
{
if ($this->current_route_module === null) {
$this->getRouteFromUrl(Context::getRequest()->getParameter('url', null, false));
}
return $this->current_route_action;
}
示例3: loginCheck
/**
* Returns the logged in user, or default user if not logged in
*
* @param \thebuggenie\core\framework\Request $request
* @param \thebuggenie\core\framework\Action $action
*
* @return \thebuggenie\core\entities\User
*/
public static function loginCheck(framework\Request $request, framework\Action $action)
{
try {
$authentication_method = $action->getAuthenticationMethodForAction(framework\Context::getRouting()->getCurrentRouteAction());
$user = null;
$external = false;
switch ($authentication_method) {
case framework\Action::AUTHENTICATION_METHOD_ELEVATED:
case framework\Action::AUTHENTICATION_METHOD_CORE:
$username = $request['tbg3_username'];
$password = $request['tbg3_password'];
if ($authentication_method == framework\Action::AUTHENTICATION_METHOD_ELEVATED) {
$elevated_password = $request['tbg3_elevated_password'];
}
$raw = true;
// If no username and password specified, check if we have a session that exists already
if ($username === null && $password === null) {
if (framework\Context::getRequest()->hasCookie('tbg3_username') && framework\Context::getRequest()->hasCookie('tbg3_password')) {
$username = framework\Context::getRequest()->getCookie('tbg3_username');
$password = framework\Context::getRequest()->getCookie('tbg3_password');
$user = self::getB2DBTable()->getByUsername($username);
if ($authentication_method == framework\Action::AUTHENTICATION_METHOD_ELEVATED) {
$elevated_password = framework\Context::getRequest()->getCookie('tbg3_elevated_password');
if ($user instanceof User && !$user->hasPasswordHash($password)) {
$user = null;
} else {
if ($user instanceof User && !$user->hasPasswordHash($elevated_password)) {
framework\Context::setUser($user);
framework\Context::getRouting()->setCurrentRouteName('elevated_login_page');
throw new framework\exceptions\ElevatedLoginException('reenter');
}
}
} else {
if ($user instanceof User && !$user->hasPasswordHash($password)) {
$user = null;
}
}
if (!$user instanceof User) {
framework\Context::logout();
throw new \Exception('No such login');
}
}
}
// If we have authentication details, validate them
if (framework\Settings::isUsingExternalAuthenticationBackend() && $username !== null && $password !== null) {
$external = true;
framework\Logging::log('Authenticating with backend: ' . framework\Settings::getAuthenticationBackend(), 'auth', framework\Logging::LEVEL_INFO);
try {
$mod = framework\Context::getModule(framework\Settings::getAuthenticationBackend());
if ($mod->getType() !== Module::MODULE_AUTH) {
framework\Logging::log('Auth module is not the right type', 'auth', framework\Logging::LEVEL_FATAL);
}
if (framework\Context::getRequest()->hasCookie('tbg3_username') && framework\Context::getRequest()->hasCookie('tbg3_password')) {
$user = $mod->verifyLogin($username, $password);
} else {
$user = $mod->doLogin($username, $password);
}
if (!$user instanceof User) {
// Invalid
framework\Context::logout();
throw new \Exception('No such login');
//framework\Context::getResponse()->headerRedirect(framework\Context::getRouting()->generate('login'));
}
} catch (\Exception $e) {
throw $e;
}
} elseif (framework\Settings::isUsingExternalAuthenticationBackend()) {
$external = true;
framework\Logging::log('Authenticating without credentials with backend: ' . framework\Settings::getAuthenticationBackend(), 'auth', framework\Logging::LEVEL_INFO);
try {
$mod = framework\Context::getModule(framework\Settings::getAuthenticationBackend());
if ($mod->getType() !== Module::MODULE_AUTH) {
framework\Logging::log('Auth module is not the right type', 'auth', framework\Logging::LEVEL_FATAL);
}
$user = $mod->doAutoLogin();
if ($user == false) {
// Invalid
framework\Context::logout();
throw new \Exception('No such login');
//framework\Context::getResponse()->headerRedirect(framework\Context::getRouting()->generate('login'));
} else {
if ($user == true) {
$user = null;
}
}
} catch (\Exception $e) {
throw $e;
}
} elseif ($username !== null && $password !== null && !$user instanceof User) {
$external = false;
framework\Logging::log('Using internal authentication', 'auth', framework\Logging::LEVEL_INFO);
$user = self::getB2DBTable()->getByUsername($username);
//.........这里部分代码省略.........
示例4: runAddCommitGitorious
public function runAddCommitGitorious(framework\Request $request)
{
framework\Context::getResponse()->setContentType('text/plain');
framework\Context::getResponse()->renderHeaders();
$passkey = framework\Context::getRequest()->getParameter('passkey');
$project_id = framework\Context::getRequest()->getParameter('project_id');
$project = Project::getB2DBTable()->selectByID($project_id);
// Validate access
if (!$project) {
echo 'Error: The project with the ID ' . $project_id . ' does not exist';
exit;
}
if (framework\Settings::get('access_method_' . $project->getID(), 'vcs_integration') == Vcs_integration::ACCESS_DIRECT) {
echo 'Error: This project uses the CLI access method, and so access via HTTP has been disabled';
exit;
}
if (framework\Settings::get('access_passkey_' . $project->getID(), 'vcs_integration') != $passkey) {
echo 'Error: The passkey specified does not match the passkey specified for this project';
exit;
}
// Validate data
$data = html_entity_decode(framework\Context::getRequest()->getParameter('payload', null, false));
if (empty($data) || $data == null) {
die('Error: No payload was provided');
}
$entries = json_decode($data);
if ($entries == null) {
die('Error: The payload could not be decoded');
}
$entries = json_decode($data);
$previous = $entries->before;
// Branch is stored in the ref
$ref = $entries->ref;
$parts = explode('/', $ref);
if (count($parts) == 3) {
$branch = $parts[2];
} else {
$branch = null;
}
// Parse each commit individually
foreach (array_reverse($entries->commits) as $commit) {
$email = $commit->author->email;
$author = $commit->author->name;
$new_rev = $commit->id;
$old_rev = $previous;
$commit_msg = $commit->message;
$time = strtotime($commit->timestamp);
// Add commit
echo Vcs_integration::processCommit($project, $commit_msg, $old_rev, $previous, $time, "", $author, $branch);
$previous = $new_rev;
exit;
}
}
示例5: getPredefinedFilters
public static function getPredefinedFilters($type, \thebuggenie\core\entities\SavedSearch $search)
{
$filters = array();
switch ($type) {
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES:
$filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
$filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => framework\Context::getCurrentProject()->getID()), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES_INCLUDING_SUBPROJECTS:
$filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
$filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => framework\Context::getCurrentProject()->getID()), $search);
$filters['subprojects'] = self::createFilter('subprojects', array('operator' => '=', 'value' => 'all'), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_CLOSED_ISSUES:
$filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'closed'), $search);
$filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => framework\Context::getCurrentProject()->getID()), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_CLOSED_ISSUES_INCLUDING_SUBPROJECTS:
$filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'closed'), $search);
$filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => framework\Context::getCurrentProject()->getID()), $search);
$filters['subprojects'] = self::createFilter('subprojects', array('operator' => '=', 'value' => 'all'), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_WISHLIST:
$filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
$filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => framework\Context::getCurrentProject()->getID()), $search);
$types = array();
foreach (framework\Context::getCurrentProject()->getIssuetypeScheme()->getIssuetypes() as $issuetype) {
if (in_array($issuetype->getIcon(), array('feature_request', 'enhancement'))) {
$types[] = $issuetype->getID();
}
}
if (count($types)) {
$filters['issuetype'] = self::createFilter('issuetype', array('operator' => '=', 'value' => join(',', $types)));
}
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_REPORTED_LAST_NUMBEROF_TIMEUNITS:
$filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => framework\Context::getCurrentProject()->getID()), $search);
$units = framework\Context::getRequest()->getParameter('units');
switch (framework\Context::getRequest()->getParameter('time_unit')) {
case 'seconds':
$time_unit = NOW - $units;
break;
case 'minutes':
$time_unit = NOW - 60 * $units;
break;
case 'hours':
$time_unit = NOW - 60 * 60 * $units;
break;
case 'days':
$time_unit = NOW - 86400 * $units;
break;
case 'weeks':
$time_unit = NOW - 86400 * 7 * $units;
break;
case 'months':
$time_unit = NOW - 86400 * 30 * $units;
break;
case 'years':
$time_unit = NOW - 86400 * 365 * $units;
break;
default:
$time_unit = NOW - 86400 * 30;
}
$filters['posted'] = self::createFilter('posted', array('operator' => '>=', 'value' => $time_unit), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_REPORTED_THIS_MONTH:
$filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => framework\Context::getCurrentProject()->getID()), $search);
$filters['posted'] = self::createFilter('posted', array('operator' => '>=', 'value' => mktime(date('H'), date('i'), date('s'), date('n'), 1)), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_MILESTONE_TODO:
$filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
$filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => framework\Context::getCurrentProject()->getID()), $search);
$filters['milestone'] = self::createFilter('milestone', array('operator' => '!=', 'value' => 0), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_MOST_VOTED:
$filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => framework\Context::getCurrentProject()->getID()), $search);
$filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
$filters['votes_total'] = self::createFilter('votes_total', array('operator' => '>=', 'value' => '1'), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_MY_REPORTED_ISSUES:
$filters['posted_by'] = self::createFilter('posted_by', array('operator' => '=', 'value' => framework\Context::getUser()->getID()), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_MY_ASSIGNED_OPEN_ISSUES:
$filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
$filters['assignee_user'] = self::createFilter('assignee_user', array('operator' => '=', 'value' => framework\Context::getUser()->getID()), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_TEAM_ASSIGNED_OPEN_ISSUES:
$filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
$teams = array();
foreach (framework\Context::getUser()->getTeams() as $team_id => $team) {
$teams[] = $team_id;
}
$filters['assignee_team'] = self::createFilter('assignee_team', array('operator' => '=', 'value' => join(',', $teams)), $search);
break;
case \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_MY_OWNED_OPEN_ISSUES:
$filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
$filters['owner_user'] = self::createFilter('owner_user', array('operator' => '=', 'value' => framework\Context::getUser()->getID()), $search);
break;
}
return $filters;
//.........这里部分代码省略.........
示例6: componentExtralinks
public function componentExtralinks()
{
switch (true) {
case framework\Context::getRequest()->hasParameter('quicksearch'):
$searchfor = framework\Context::getRequest()->getParameter('searchfor');
$project_key = framework\Context::getCurrentProject() instanceof entities\Project ? framework\Context::getCurrentProject()->getKey() : 0;
$this->csv_url = framework\Context::getRouting()->generate('project_issues', array('project_key' => $project_key, 'quicksearch' => 'true', 'format' => 'csv')) . '?searchfor=' . $searchfor;
$this->rss_url = framework\Context::getRouting()->generate('project_issues', array('project_key' => $project_key, 'quicksearch' => 'true', 'format' => 'rss')) . '?searchfor=' . $searchfor;
break;
case framework\Context::getRequest()->hasParameter('predefined_search'):
$searchno = framework\Context::getRequest()->getParameter('predefined_search');
$project_key = framework\Context::getCurrentProject() instanceof entities\Project ? framework\Context::getCurrentProject()->getKey() : 0;
$url = framework\Context::getCurrentProject() instanceof entities\Project ? 'project_issues' : 'search';
$this->csv_url = framework\Context::getRouting()->generate($url, array('project_key' => $project_key, 'predefined_search' => $searchno, 'search' => '1', 'format' => 'csv'));
$this->rss_url = framework\Context::getRouting()->generate($url, array('project_key' => $project_key, 'predefined_search' => $searchno, 'search' => '1', 'format' => 'rss'));
break;
default:
preg_match('/((?<=\\/)issues).+$/i', framework\Context::getRequest()->getQueryString(), $get);
if (!isset($get[0])) {
preg_match('/((?<=url=)issues).+$/i', framework\Context::getRequest()->getQueryString(), $get);
}
if (isset($get[0])) {
if (framework\Context::isProjectContext()) {
$this->csv_url = framework\Context::getRouting()->generate('project_issues', array('project_key' => framework\Context::getCurrentProject()->getKey(), 'format' => 'csv')) . '/' . $get[0];
$this->rss_url = framework\Context::getRouting()->generate('project_issues', array('project_key' => framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')) . '?' . $get[0];
} else {
$this->csv_url = framework\Context::getRouting()->generate('search', array('format' => 'csv')) . '/' . $get[0];
$this->rss_url = framework\Context::getRouting()->generate('search', array('format' => 'rss')) . '?' . $get[0];
}
}
break;
}
$i18n = framework\Context::getI18n();
$this->columns = array('title' => $i18n->__('Issue title'), 'issuetype' => $i18n->__('Issue type'), 'assigned_to' => $i18n->__('Assigned to'), 'status' => $i18n->__('Status'), 'resolution' => $i18n->__('Resolution'), 'category' => $i18n->__('Category'), 'severity' => $i18n->__('Severity'), 'percent_complete' => $i18n->__('% completed'), 'reproducability' => $i18n->__('Reproducability'), 'priority' => $i18n->__('Priority'), 'components' => $i18n->__('Component(s)'), 'milestone' => $i18n->__('Milestone'), 'estimated_time' => $i18n->__('Estimate'), 'spent_time' => $i18n->__('Time spent'), 'last_updated' => $i18n->__('Last updated time'), 'comments' => $i18n->__('Number of comments'));
}
示例7: componentSpecialWhatLinksHere
public function componentSpecialWhatLinksHere()
{
$this->linked_article_name = framework\Context::getRequest()->getParameter('linked_article_name');
$this->articles = Articles::getTable()->getAllByLinksToArticleName($this->linked_article_name);
}
示例8: componentAddDashboardView
public function componentAddDashboardView()
{
$request = framework\Context::getRequest();
$this->dashboard = entities\Dashboard::getB2DBTable()->selectById($request['dashboard_id']);
$this->column = $request['column'];
$this->views = entities\DashboardView::getAvailableViews($this->dashboard->getType());
$this->savedsearches = tables\SavedSearches::getTable()->getAllSavedSearchesByUserIDAndPossiblyProjectID(framework\Context::getUser()->getID(), $this->dashboard->getProject() instanceof entities\Project ? $this->dashboard->getProject()->getID() : 0);
}
示例9: getTeams
/**
* Returns an array of teams which the current user is a member of
*
* @return array|Team
*/
public function getTeams()
{
$this->_populateTeams();
$teams = $this->_teams['assigned'];
if (framework\Context::isProjectContext()) {
$project = framework\Context::getCurrentProject();
} else {
if (framework\Context::getRequest()->hasParameter('issue_id')) {
$issue = Issue::getB2DBTable()->selectById(framework\Context::getRequest()->getParameter('issue_id'));
if ($issue instanceof Issue && $issue->getProject() instanceof Project) {
$project = $issue->getProject();
}
}
}
if (isset($project)) {
$project_assigned_teams = $project->getAssignedTeams();
foreach ($teams as $team_id => $team) {
if (!array_key_exists($team_id, $project_assigned_teams)) {
unset($teams[$team_id]);
}
}
}
return $teams;
}
示例10: componentResults_view
public function componentResults_view()
{
if ($this->view->getType() == entities\DashboardView::VIEW_PREDEFINED_SEARCH) {
$request = framework\Context::getRequest();
$request->setParameter('predefined_search', $this->view->getDetail());
$search = entities\SavedSearch::getFromRequest($request);
} elseif ($this->view->getType() == entities\DashboardView::VIEW_SAVED_SEARCH) {
$search = tables\SavedSearches::getTable()->selectById($this->view->getDetail());
}
$this->issues = $search->getIssues();
$this->resultcount = $search->getTotalNumberOfIssues();
}
示例11: runSaveAuthentication
public function runSaveAuthentication(framework\Request $request)
{
if (framework\Context::getRequest()->isPost()) {
$this->forward403unless($this->access_level == framework\Settings::ACCESS_FULL);
$settings = array(framework\Settings::SETTING_AUTH_BACKEND, 'register_message', 'forgot_message', 'changepw_message', 'changedetails_message');
foreach ($settings as $setting) {
if (framework\Context::getRequest()->getParameter($setting) !== null) {
$value = framework\Context::getRequest()->getParameter($setting);
framework\Settings::saveSetting($setting, $value);
}
}
}
}
示例12: componentBuild
public function componentBuild()
{
if (!isset($this->build)) {
$this->build = new entities\Build();
$this->build->setProject(framework\Context::getCurrentProject());
$this->build->setName(framework\Context::getI18n()->__('%project_name version 0.0.0', array('%project_name' => $this->project->getName())));
if (framework\Context::getRequest()->getParameter('edition_id') && ($edition = entities\Edition::getB2DBTable()->selectById(framework\Context::getRequest()->getParameter('edition_id')))) {
$this->build->setEdition($edition);
}
}
}
示例13: listen_get_backdrop_partial
/**
* @Listener(module='core', identifier='get_backdrop_partial')
* @param \thebuggenie\core\framework\Event $event
*/
public function listen_get_backdrop_partial(framework\Event $event)
{
$request = framework\Context::getRequest();
$options = array();
switch ($event->getSubject()) {
case 'agileboard':
$template_name = 'agile/editagileboard';
$board = $request['board_id'] ? entities\tables\AgileBoards::getTable()->selectById($request['board_id']) : new entities\AgileBoard();
if (!$board->getID()) {
$board->setAutogeneratedSearch(\thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES);
$board->setTaskIssuetype(framework\Settings::get('issuetype_task'));
$board->setEpicIssuetype(framework\Settings::get('issuetype_epic'));
$board->setIsPrivate($request->getParameter('is_private', true));
$board->setProject($request['project_id']);
}
$options['board'] = $board;
break;
case 'milestone_finish':
$template_name = 'agile/milestonefinish';
$options['project'] = \thebuggenie\core\entities\tables\Projects::getTable()->selectById($request['project_id']);
$options['board'] = entities\tables\AgileBoards::getTable()->selectById($request['board_id']);
$options['milestone'] = \thebuggenie\core\entities\tables\Milestones::getTable()->selectById($request['milestone_id']);
if (!$options['milestone']->hasReachedDate()) {
$options['milestone']->setReachedDate(time());
}
break;
case 'agilemilestone':
$template_name = 'agile/milestone';
$options['project'] = \thebuggenie\core\entities\tables\Projects::getTable()->selectById($request['project_id']);
$options['board'] = entities\tables\AgileBoards::getTable()->selectById($request['board_id']);
if ($request->hasParameter('milestone_id')) {
$options['milestone'] = \thebuggenie\core\entities\tables\Milestones::getTable()->selectById($request['milestone_id']);
}
break;
default:
return;
}
foreach ($options as $key => $value) {
$event->addToReturnList($value, $key);
}
$event->setReturnValue($template_name);
$event->setProcessed();
}
示例14: hasTranslatedTemplate
public function hasTranslatedTemplate($template, $is_component = false)
{
if (mb_strpos($template, '/')) {
$templateinfo = explode('/', $template);
$module = $templateinfo[0];
$templatefile = $is_component ? '_' . $templateinfo[1] . '.inc.php' : $templateinfo[1] . '.' . Context::getRequest()->getRequestedFormat() . '.php';
} else {
$module = Context::getRouting()->getCurrentRouteModule();
$templatefile = $is_component ? '_' . $template . '.inc.php' : $template . '.' . Context::getRequest()->getRequestedFormat() . '.php';
}
if (file_exists(THEBUGGENIE_MODULES_PATH . $module . DS . 'i18n' . DS . $this->_language . DS . 'templates' . DS . $templatefile)) {
return THEBUGGENIE_MODULES_PATH . $module . DS . 'i18n' . DS . $this->_language . DS . 'templates' . DS . $templatefile;
} elseif (file_exists(THEBUGGENIE_PATH . 'i18n' . DS . $this->getCurrentLanguage() . DS . 'templates' . DS . $module . DS . $templatefile)) {
return THEBUGGENIE_PATH . 'i18n' . DS . $this->getCurrentLanguage() . DS . 'templates' . DS . $module . DS . $templatefile;
}
return false;
}
示例15: _saveMilestoneDetails
/**
* @param framework\Request $request
* @param null $milestone
* @return null|\thebuggenie\core\entities\Milestone
* @throws \Exception
*/
protected function _saveMilestoneDetails(framework\Request $request, $milestone = null)
{
if (!$request['name']) {
throw new \Exception($this->getI18n()->__('You must provide a valid milestone name'));
}
if ($milestone === null) {
$milestone = new \thebuggenie\core\entities\Milestone();
}
$milestone->setName($request['name']);
$milestone->setProject($this->selected_project);
$milestone->setStarting((bool) $request['is_starting']);
$milestone->setScheduled((bool) $request['is_scheduled']);
$milestone->setDescription($request['description']);
$milestone->setVisibleRoadmap($request['visibility_roadmap']);
$milestone->setVisibleIssues($request['visibility_issues']);
$milestone->setType($request->getParameter('milestone_type', \thebuggenie\core\entities\Milestone::TYPE_REGULAR));
if ($request->hasParameter('sch_month') && $request->hasParameter('sch_day') && $request->hasParameter('sch_year')) {
$scheduled_date = mktime(23, 59, 59, framework\Context::getRequest()->getParameter('sch_month'), framework\Context::getRequest()->getParameter('sch_day'), framework\Context::getRequest()->getParameter('sch_year'));
$milestone->setScheduledDate($scheduled_date);
} else {
$milestone->setScheduledDate(0);
}
if ($request->hasParameter('starting_month') && $request->hasParameter('starting_day') && $request->hasParameter('starting_year')) {
$starting_date = mktime(0, 0, 1, framework\Context::getRequest()->getParameter('starting_month'), framework\Context::getRequest()->getParameter('starting_day'), framework\Context::getRequest()->getParameter('starting_year'));
$milestone->setStartingDate($starting_date);
} else {
$milestone->setStartingDate(0);
}
$milestone->save();
return $milestone;
}