本文整理汇总了PHP中TBGContext::isProjectContext方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGContext::isProjectContext方法的具体用法?PHP TBGContext::isProjectContext怎么用?PHP TBGContext::isProjectContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGContext
的用法示例。
在下文中一共展示了TBGContext::isProjectContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: componentLeftmenu
public function componentLeftmenu()
{
$this->show_article_options = (bool) ($this->article instanceof TBGWikiArticle);
$this->links_target_id = TBGContext::isProjectContext() ? TBGContext::getCurrentProject()->getID() : 0;
$this->links = TBGPublish::getModule()->getMenuItems($this->links_target_id);
$this->user_drafts = TBGPublish::getModule()->getUserDrafts();
}
示例2: componentPagination
public function componentPagination()
{
$this->currentpage = ceil($this->offset / $this->ipp) + 1;
$this->pagecount = ceil($this->resultcount / $this->ipp);
$parameters = array();
foreach ($this->filters as $key => $filter) {
if (is_array($filter)) {
foreach ($filter as $subkey => $subfilter) {
if (is_array($subfilter)) {
foreach ($subfilter as $subsubkey => $subsubfilter) {
$parameters[] = "filters[{$key}][{$subkey}][{$subsubkey}]=" . urlencode($subsubfilter);
}
} else {
$parameters[] = "filters[{$key}][{$subkey}]=" . urlencode($subfilter);
}
}
} else {
$parameters[] = "filters[{$key}]=" . urlencode($filter);
}
}
$parameters[] = 'template=' . $this->templatename;
$parameters[] = 'template_parameter=' . $this->template_parameter;
$parameters[] = 'searchterm=' . $this->searchterm;
$parameters[] = 'groupby=' . $this->groupby;
$parameters[] = 'grouporder=' . $this->grouporder;
$parameters[] = 'issues_per_page=' . $this->ipp;
$route = TBGContext::isProjectContext() ? TBGContext::getRouting()->generate('project_search_paginated', array('project_key' => TBGContext::getCurrentProject()->getKey())) : TBGContext::getRouting()->generate('search_paginated');
$this->route = $route;
$this->parameters = join('&', $parameters);
}
示例3: array
<input type="checkbox" name="update_issue[<?php
echo $issue->getID();
?>
]" value="<?php
echo $issue->getID();
?>
">
<?php
}
?>
</td>
<?php
}
?>
<?php
if (!TBGContext::isProjectContext() && $show_project == true) {
?>
<td style="padding-left: 5px;"><?php
echo link_tag(make_url('project_issues', array('project_key' => $issue->getProject()->getKey())), $issue->getProject()->getName());
?>
</td>
<?php
}
?>
<td class="sc_issuetype"<?php
if (!in_array('issuetype', $visible_columns)) {
?>
style="display: none;"<?php
}
?>
>
示例4: componentExtralinks
public function componentExtralinks()
{
switch (true) {
case TBGContext::getRequest()->hasParameter('quicksearch'):
$searchfor = TBGContext::getRequest()->getParameter('searchfor');
$project_key = TBGContext::getCurrentProject() instanceof TBGProject ? TBGContext::getCurrentProject()->getKey() : 0;
$this->csv_url = TBGContext::getRouting()->generate('project_issues', array('project_key' => $project_key, 'quicksearch' => 'true', 'format' => 'csv')) . '?searchfor=' . $searchfor;
$this->rss_url = TBGContext::getRouting()->generate('project_issues', array('project_key' => $project_key, 'quicksearch' => 'true', 'format' => 'rss')) . '?searchfor=' . $searchfor;
break;
case TBGContext::getRequest()->hasParameter('predefined_search'):
$searchno = TBGContext::getRequest()->getParameter('predefined_search');
$project_key = TBGContext::getCurrentProject() instanceof TBGProject ? TBGContext::getCurrentProject()->getKey() : 0;
$url = TBGContext::getCurrentProject() instanceof TBGProject ? 'project_issues' : 'search';
$this->csv_url = TBGContext::getRouting()->generate($url, array('project_key' => $project_key, 'predefined_search' => $searchno, 'search' => '1', 'format' => 'csv'));
$this->rss_url = TBGContext::getRouting()->generate($url, array('project_key' => $project_key, 'predefined_search' => $searchno, 'search' => '1', 'format' => 'rss'));
break;
default:
preg_match('/((?<=\\/)issues).+$/i', TBGContext::getRequest()->getQueryString(), $get);
if (!isset($get[0])) {
preg_match('/((?<=url=)issues).+$/i', TBGContext::getRequest()->getQueryString(), $get);
}
if (isset($get[0])) {
if (TBGContext::isProjectContext()) {
$this->csv_url = TBGContext::getRouting()->generate('project_issues', array('project_key' => TBGContext::getCurrentProject()->getKey(), 'format' => 'csv')) . '/' . $get[0];
$this->rss_url = TBGContext::getRouting()->generate('project_issues', array('project_key' => TBGContext::getCurrentProject()->getKey(), 'format' => 'rss')) . '?' . $get[0];
} else {
$this->csv_url = TBGContext::getRouting()->generate('search', array('format' => 'csv')) . '/' . $get[0];
$this->rss_url = TBGContext::getRouting()->generate('search', array('format' => 'rss')) . '?' . $get[0];
}
}
break;
}
$i18n = TBGContext::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'));
}
示例5: javascript_link_tag
<?php
if ($role instanceof TBGRole) {
?>
<li class="greybox" style="padding: 3px 5px; margin-bottom: 5px;" id="role_<?php
echo $role->getID();
?>
_container">
<div class="button-group" style="float: right; margin-right: -3px; margin-top: -1px;">
<?php
echo javascript_link_tag(__('Details'), array('onclick' => "TBG.Config.Roles.getPermissions('" . make_url('configure_role', array('role_id' => $role->getID(), 'mode' => 'list_permissions')) . "', 'role_{$role->getID()}_permissions_list');", 'class' => 'button button-silver'));
?>
<?php
if (!TBGContext::isProjectContext() || !$role->isSystemRole()) {
?>
<?php
echo javascript_link_tag(__('Edit'), array('onclick' => "TBG.Config.Roles.getPermissionsEdit('" . make_url('configure_role', array('role_id' => $role->getID(), 'mode' => 'edit')) . "', 'role_{$role->getID()}_permissions_edit');", 'class' => 'button button-silver'));
?>
<button class="button button-silver" onclick="TBG.Main.Helpers.Dialog.show('<?php
echo __('Delete this role?');
?>
', '<?php
echo __('Do you really want to delete this role?') . '<br>' . __('Users assigned via this role will be unassigned, and depending on other roles their project permissions may be reset.') . '<br><b>' . __('This action cannot be reverted') . '</b>';
?>
', {yes: {click: function() {TBG.Config.Roles.remove('<?php
echo make_url('configure_role', array('role_id' => $role->getID(), 'mode' => 'delete'));
?>
', <?php
print $role->getID();
?>
);}}, no: {click: TBG.Main.Helpers.Dialog.dismiss}});"><?php
示例6: link_tag
?>
</div>
<?php
echo link_tag(make_url('my_reported_issues'), image_tag('icon_savedsearch.png') . __('Issues reported by me'));
?>
<?php
echo link_tag(make_url('my_assigned_issues'), image_tag('icon_savedsearch.png') . __('Open issues assigned to me'));
?>
<?php
echo link_tag(make_url('my_teams_assigned_issues'), image_tag('icon_savedsearch.png') . __('Open issues assigned to my teams'));
?>
<?php
foreach ($tbg_user->getStarredIssues() as $issue) {
?>
<?php
if (!TBGContext::isProjectContext() || $issue->getProject()->getID() != TBGContext::getCurrentProject()->getID()) {
continue;
}
?>
<?php
$link_text = image_tag('star_small.png');
if ($issue->isBlocking()) {
$link_text .= image_tag('icon_important.png', array('style' => 'margin-right: 5px;', 'title' => __('This issue is blocking the next release')));
}
$link_text .= $issue->getIssueType()->getName() . ' ' . $issue->getFormattedIssueNo(true) . '<br>';
$link_text .= strlen($issue->getTitle()) > 43 ? substr($issue->getTitle(), 0, 40) . '...' : $issue->getTitle();
$classes = $issue->isClosed() ? 'issue_closed' : '';
?>
<?php
echo link_tag(make_url('viewissue', array('project_key' => $issue->getProject()->getKey(), 'issue_no' => $issue->getFormattedIssueNo())), $link_text, array('class' => $classes));
?>
示例7: link_tag
<?php
echo link_tag(make_url('client_dashboard', array('client_id' => $client->getID())), image_tag('tab_clients.png') . $client->getName());
?>
<?php
}
?>
</div>
</li>
<?php
}
?>
<?php
TBGEvent::createNew('core', 'menustrip_item_links', null, array('selected_tab' => $tbg_response->getPage()))->trigger();
?>
</ul>
<?php
if (TBGContext::isProjectContext() && !TBGContext::getCurrentProject()->isArchived() && !TBGContext::getCurrentProject()->isLocked() && ($tbg_user->canReportIssues() || $tbg_user->canReportIssues(TBGContext::getCurrentProject()->getID()))) {
?>
<div class="reportissue_button_container">
<?php
echo javascript_link_tag(image_tag('icon-mono-add.png') . __('Report an issue'), array('onclick' => "TBG.Main.Helpers.Backdrop.show('" . make_url('get_partial_for_backdrop', array('key' => 'reportissue', 'project_id' => TBGContext::getCurrentProject()->getId())) . "');", 'class' => 'button button-lightblue'));
?>
</div>
<?php
}
?>
<?php
TBGEvent::createNew('core', 'before_header_userinfo')->trigger();
?>
</nav>
示例8: getTabKey
public function getTabKey()
{
return TBGContext::isProjectContext() ? parent::getTabKey() : 'wiki';
}
示例9: listen_sidebar_links
public function listen_sidebar_links(TBGEvent $event)
{
if (TBGContext::isProjectContext()) {
TBGActionComponent::includeTemplate('vcs_integration/menustriplinks', array('project' => TBGContext::getCurrentProject(), 'module' => $this, 'submenu' => $event->getParameter('submenu')));
}
}
示例10: __
</div>
</div>
</div>
<?php
if ($a_savedsearch->getDescription() != '') {
?>
<div style="clear: both; padding: 0 0 10px 3px;"><?php
echo $a_savedsearch->getDescription();
?>
</div>
<?php
}
?>
</li>
<?php
}
?>
<?php
} else {
?>
<li class="no_items" style="font-size: 1em;" id="no_public_saved_searches"><?php
echo TBGContext::isProjectContext() ? __("There are no saved searches for this project") : __("There are no public saved searches");
?>
</li>
<?php
}
?>
</ul>
</div>
</td>
示例11: listen_SidebarLinks
public function listen_SidebarLinks(TBGEvent $event)
{
if (TBGContext::isProjectContext()) {
TBGActionComponent::includeTemplate('vcs_integration/menustriplinks', array('project' => TBGContext::getCurrentProject(), 'module' => $this));
}
}
示例12: getIssueFromLink
/**
* Returns a TBGIssue from an issue no
*
* @param string $issue_no An integer or issue number
*
* @return TBGIssue
*/
public static function getIssueFromLink($issue_no)
{
$theIssue = null;
$issue_no = strtolower($issue_no);
if (strpos($issue_no, ' ') !== false) {
$issue_no = substr($issue_no, strrpos($issue_no, ' ') + 1);
}
if (substr($issue_no, 0, 1) == '#') {
$issue_no = substr($issue_no, 1);
}
if (is_numeric($issue_no)) {
try {
if (!TBGContext::isProjectContext()) {
return null;
}
if (TBGContext::getCurrentProject()->usePrefix()) {
return null;
}
if ($row = TBGIssuesTable::getTable()->getByProjectIDAndIssueNo(TBGContext::getCurrentProject()->getID(), $issue_no)) {
$theIssue = TBGContext::factory()->TBGIssue($row->get(TBGIssuesTable::ID), $row);
}
} catch (Exception $e) {
return null;
}
} else {
$issue_no = explode('-', strtoupper($issue_no));
TBGLogging::log('exploding');
if (count($issue_no) == 2 && ($row = TBGIssuesTable::getTable()->getByPrefixAndIssueNo($issue_no[0], $issue_no[1]))) {
$theIssue = TBGContext::factory()->TBGIssue($row->get(TBGIssuesTable::ID), $row);
if (!$theIssue->getProject()->usePrefix()) {
return null;
}
}
TBGLogging::log('exploding done');
}
return $theIssue instanceof TBGIssue ? $theIssue : null;
}
示例13: _setupGenericFilters
protected function _setupGenericFilters()
{
if (!isset($this->_filters['issuetype'])) {
$this->_filters['issuetype'] = TBGSearchFilter::createFilter('issuetype', array(), $this);
}
if (!isset($this->_filters['status'])) {
$this->_filters['status'] = TBGSearchFilter::createFilter('status', array(), $this);
}
if (!isset($this->_filters['category'])) {
$this->_filters['category'] = TBGSearchFilter::createFilter('category', array(), $this);
}
if (!TBGContext::isProjectContext() && !isset($this->_filters['project_id'])) {
$this->_filters['project_id'] = TBGSearchFilter::createFilter('project_id', array(), $this);
}
}
示例14: __construct
/**
* Setup the parser object
*
* @param string $text The text to be parsed
* @param boolean $use_toc[optional] Whether to use a TOC if found
* @param string $toc_base_id[optional] Base id to use for the TOC element
*/
public function __construct($text, $use_toc = false, $toc_base_id = null)
{
$this->text = str_replace("\r\n", "\n", $text);
$this->use_toc = $use_toc;
$this->toc_base_id = $toc_base_id;
if (TBGContext::isProjectContext()) {
$this->namespace = TBGContext::getCurrentProject()->getKey();
}
if (!TBGContext::isCLI()) {
TBGContext::loadLibrary('ui');
}
}
示例15: javascript_link_tag
<?php
echo javascript_link_tag(image_tag('icon_edit.png'), array('class' => 'button button-silver button-icon', 'onclick' => "TBG.Main.Menu.toggleEditMode('{$target_type}', '{$target_id}', '" . make_url('save_menu_order', array('target_type' => $target_type, 'target_id' => $target_id)) . "');", 'title' => __('Toggle menu edit mode')));
?>
<?php
echo javascript_link_tag(image_tag('action_add_link.png'), array('class' => 'button button-silver button-icon', 'onclick' => "\$('attach_link_{$target_type}_{$target_id}').toggle();", 'title' => __('Add an item to the menu')));
?>
</div>
<?php
}
?>
<?php
echo $title;
?>
</div>
<?php
if ($tbg_user->canEditMainMenu() && (TBGContext::isProjectContext() && !TBGContext::getCurrentProject()->isArchived() || !TBGContext::isProjectContext())) {
?>
<div class="rounded_box lightgrey shadowed" id="attach_link_<?php
echo $target_type;
?>
_<?php
echo $target_id;
?>
" style="position: absolute; width: 300px; z-index: 10001; margin: -1px 0 5px 5px; display: none; top: 0; left: 305px;">
<div class="header_div" style="margin: 0 0 5px 0;"><?php
echo __('Add a link');
?>
:</div>
<form action="<?php
echo make_url('attach_link', array('target_type' => $target_type, 'target_id' => $target_id));
?>