예제 #1
0
 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();
 }
 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
0
								<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
0
 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
0
<?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
0
    ?>
</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
0
						<?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
0
 public function getTabKey()
 {
     return TBGContext::isProjectContext() ? parent::getTabKey() : 'wiki';
 }
 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
0
								</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>
 public function listen_SidebarLinks(TBGEvent $event)
 {
     if (TBGContext::isProjectContext()) {
         TBGActionComponent::includeTemplate('vcs_integration/menustriplinks', array('project' => TBGContext::getCurrentProject(), 'module' => $this));
     }
 }
예제 #12
0
 /**
  * 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
0
 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);
     }
 }
 /**
  * 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
0
				<?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));
    ?>
예제 #16
0
</button>
						<?php 
    }
    ?>
					</h4>
					<?php 
    include_template('publish/attachments', array('article' => $article, 'attachments' => $attachments));
    ?>
				</div>
				<div id="article_comments">
					<h4>
						<?php 
    echo __('Article comments (%count)', array('%count' => TBGComment::countComments($article->getID(), TBGComment::TYPE_ARTICLE)));
    ?>
						<?php 
    if ($tbg_user->canPostComments() && (TBGContext::isProjectContext() && !TBGContext::getCurrentProject()->isArchived() || !TBGContext::isProjectContext())) {
        ?>
							<button id="comment_add_button" class="button button-silver" onclick="TBG.Main.Comment.showPost();"><?php 
        echo __('Post comment');
        ?>
</button>
						<?php 
    }
    ?>
					</h4>
					<?php 
    include_template('main/comments', array('target_id' => $article->getID(), 'mentionable_target_type' => 'article', 'target_type' => TBGComment::TYPE_ARTICLE, 'show_button' => false, 'comment_count_div' => 'article_comment_count', 'forward_url' => make_url('publish_article', array('article_name' => $article->getName()))));
    ?>
				</div>
			<?php 
}
예제 #17
0
][<?php 
        echo $key;
        ?>
][value]" id="filter_<?php 
        echo $filter;
        ?>
_<?php 
        echo $key;
        ?>
">
				<option value="0"> - </option>
				<?php 
        foreach ($filters[$filter]['options'] as $item) {
            ?>
					<?php 
            if (method_exists($item, 'getProject') && (TBGContext::isProjectContext() && $item->getProject()->getID() != TBGContext::getCurrentProject()->getID() || !TBGContext::isProjectContext())) {
                ?>
						<option value="<?php 
                echo $item->getID();
                ?>
"<?php 
                if ($selected_value == $item->getID()) {
                    ?>
 selected<?php 
                }
                ?>
><?php 
                echo $item->getProject()->getName() . '&nbsp;&ndash;&nbsp;' . $item->getName();
                ?>
</option>
					<?php 
예제 #18
0
			<?php 
        }
        ?>
		<?php 
    }
    ?>
		<?php 
    if ($resultcount - $cc > 0) {
        ?>
			<li class="find_more_issues last">
				<span class="informal"><?php 
        echo __('See %num more issues ...', array('%num' => $resultcount - $cc));
        ?>
</span>
				<div class="hidden url"><?php 
        echo TBGContext::isProjectContext() ? make_url('project_issues', array('project_key' => TBGContext::getCurrentProject()->getKey())) : make_url('search');
        ?>
?fs[text][v]=<?php 
        echo $searchterm;
        ?>
&fs[text][o]=<?php 
        echo urlencode('=');
        ?>
</div>
			</li>
		<?php 
    }
    ?>
	<?php 
} else {
    ?>
    ?>
">
					<input type="text" name="articlename" value="<?php 
    echo $quicksearch_title;
    ?>
" style="width: 230px; font-size: 0.9em;" onblur="if ($(this).getValue() == '') { $(this).value = '<?php 
    echo $quicksearch_title;
    ?>
'; $(this).addClassName('faded_out'); }" onfocus="if ($(this).getValue() == '<?php 
    echo $quicksearch_title;
    ?>
') { $(this).clear(); } $(this).removeClassName('faded_out');" class="faded_out">
				</form>
			</div>
			<?php 
    if (count(TBGProject::getAll()) > (int) TBGContext::isProjectContext()) {
        ?>
				<div class="header"><?php 
        echo __('Project wikis');
        ?>
</div>
				<?php 
        foreach (TBGProject::getAll() as $project) {
            ?>
					<?php 
            if (isset($project_url) && $project->getID() == TBGContext::getCurrentProject()->getID()) {
                continue;
            }
            ?>
					<?php 
            echo link_tag(make_url('publish_article', array('article_name' => ucfirst($project->getKey()) . ':MainPage')), $project->getName());
예제 #20
0
	<ShortName><?php 
echo TBGContext::isProjectContext() ? __('%project_name% search', array('%project_name%' => TBGContext::getCurrentProject()->getName())) : __('%site_name% search', array('%site_name%' => TBGSettings::getTBGname()));
?>
</ShortName>
	<LongName><?php 
echo TBGContext::isProjectContext() ? __('%project_name% search', array('%project_name%' => TBGContext::getCurrentProject()->getName())) : __('%site_name% search', array('%site_name%' => TBGSettings::getTBGname()));
?>
</LongName>
	<Description><?php 
echo TBGContext::isProjectContext() ? __('%project_name% search', array('%project_name%' => TBGContext::getCurrentProject()->getName())) : __('%site_name% search', array('%site_name%' => TBGSettings::getTBGname()));
?>
</Description>
	<Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAIgAAACIBB7P0uQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAKISURBVDiNpZNPiE1xFMc%2F5%2F7ufX%2B853nzZh6G%2BYPBaESDovxPilKabEhZsJOFLBRjITuFiAULkqRYsLAxooiEGAzR%2BPcmRmP8mWnejDf3vXfvu8fmjaiRhbM5ncX5dL6n71dUlf8p%2B%2FehslIS8cnsTFRS7%2FuUst94le3mTi6nT%2F8JmFgv06Yv42Zjc3pqQ%2FUikukw99tv8LZj0E1OkmMDPdo6GsACEJFQopozk2Yyta7JZt2aDbif6tm19ShzlkWiTYvZm0zL7r8CQlFaYklWhmNQ1M8MeZ1s2bSNh239LF64lJomqJnDAceRFaMCii4NhWHwCqDAs54T9FlX0bGv6Xj%2BmHQdjK8jWlHNcRGpEBH5BRCRFOBlv8BALwwPQXbI5dabVqzG03TcHSA%2FBJGxEK9iLrAf2CcizSNPXOc4TktvxuscN4FZ8RTYIfB9sG2YvxYuH4aqGiAAYDmQBw4B2Kp6XkR6ReRs1xP1bAfHL0B6CsTGQSEPue9hd%2Fa0RWKnXtrFxr7Zve%2FMtVKp5IhIkbKRDDADOBaK0N2wAF3Ygi7dTBCvsPpOXWjVN59v65Hr03XHGYJYwr4CbATMiA8U6AcuFfN0vW9nfXcnlV6e2rmrgtTX6EXaug5ixgREoogJ%2BV40Gl3iuu5lG0BVAxH5AfQBMcAr5qg1xoQsUyLTlaHjFNnBTH3MC3%2FoH%2FyOgjsfaEZVR2RsB9oSicRJYDNw1hhzXyxexFN8C0dsf8%2B5ZH7eatqADUAjYOT3MImIKV%2BQBmqBfZZleUEQ3AMmWDY%2FAp%2FXwAMgo6reH2FS1VJZig8MA4%2BMMZkgCLoBO%2FDJAT3AR1X1AGS0OJedZgMOECl3gAKQA3wtL%2F4EbzL%2FhCjT%2FIEAAAAASUVORK5CYII%3D</Image>
	<Url type="text/html" template="<?php 
echo TBGContext::isProjectContext() ? make_url('project_issues', array('project_key' => TBGContext::getCurrentProject()->getKey()), false) : make_url('search', array(), false);
?>
?filters[text][operator]=%3A&amp;filters[text][value]={searchTerms}"/>
	<Url type="application/x-suggestions+json" template="<?php 
echo TBGContext::isProjectContext() ? make_url('project_quicksearch', array('project_key' => TBGContext::getCurrentProject()->getKey(), 'format' => 'json'), false) : make_url('quicksearch', array('format' => 'json'), false);
?>
?filters[text][operator]=%3A&amp;filters[text][value]={searchTerms}"/>
	<AdultContent>false</AdultContent>
	<OutputEncoding><?php 
echo TBGContext::getI18n()->getCharset();
?>
</OutputEncoding>
	<Contact>support@thebuggenie.com</Contact>
	<Query role="example" searchTerms="opensearch"/>
	<Attribution>No copyright</Attribution>
	<SyndicationRight>open</SyndicationRight>
</OpenSearchDescription>
예제 #21
0
 /**
  *
  * @param \b2db\Criteria $crit
  * @param array|TBGSearchFilter $filters
  * @param \b2db\Criterion $ctn
  * @return null
  */
 public function addToCriteria($crit, $filters, $ctn = null)
 {
     $filter_key = $this->getFilterKey();
     if (in_array($this['operator'], array('=', '!=', '<=', '>=', '<', '>'))) {
         if ($filter_key == 'text') {
             if ($this['value'] != '') {
                 $searchterm = mb_strpos($this['value'], '%') !== false ? $this['value'] : "%{$this['value']}%";
                 if ($this['operator'] == '=') {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(TBGIssuesTable::TITLE, $searchterm, Criteria::DB_LIKE);
                     }
                     $ctn->addOr(TBGIssuesTable::DESCRIPTION, $searchterm, Criteria::DB_LIKE);
                     $ctn->addOr(TBGIssuesTable::REPRODUCTION_STEPS, $searchterm, Criteria::DB_LIKE);
                     $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
                 } else {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(TBGIssuesTable::TITLE, $searchterm, Criteria::DB_NOT_LIKE);
                     }
                     $ctn->addWhere(TBGIssuesTable::DESCRIPTION, $searchterm, Criteria::DB_NOT_LIKE);
                     $ctn->addWhere(TBGIssuesTable::REPRODUCTION_STEPS, $searchterm, Criteria::DB_NOT_LIKE);
                     $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
                 }
                 return $ctn;
             }
         } elseif (in_array($filter_key, self::getValidSearchFilters())) {
             if ($filter_key == 'subprojects') {
                 if (TBGContext::isProjectContext()) {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(TBGIssuesTable::PROJECT_ID, TBGContext::getCurrentProject()->getID());
                     }
                     if ($this->hasValue()) {
                         foreach ($this->getValues() as $value) {
                             switch ($value) {
                                 case 'all':
                                     $subprojects = TBGProject::getIncludingAllSubprojectsAsArray(TBGContext::getCurrentProject());
                                     foreach ($subprojects as $subproject) {
                                         if ($subproject->getID() == TBGContext::getCurrentProject()->getID()) {
                                             continue;
                                         }
                                         $ctn->addOr(TBGIssuesTable::PROJECT_ID, $subproject->getID());
                                     }
                                     break;
                                 case 'none':
                                 case '':
                                     break;
                                 default:
                                     $ctn->addOr(TBGIssuesTable::PROJECT_ID, (int) $value);
                                     break;
                             }
                         }
                     }
                     return $ctn;
                 }
             } elseif (in_array($filter_key, array('build', 'edition', 'component'))) {
                 switch ($filter_key) {
                     case 'component':
                         $tbl = TBGIssueAffectsComponentTable::getTable();
                         $fk = TBGIssueAffectsComponentTable::ISSUE;
                         break;
                     case 'edition':
                         $tbl = TBGIssueAffectsEditionTable::getTable();
                         $fk = TBGIssueAffectsEditionTable::ISSUE;
                         break;
                     case 'build':
                         $tbl = TBGIssueAffectsBuildTable::getTable();
                         $fk = TBGIssueAffectsBuildTable::ISSUE;
                         break;
                 }
                 $crit->addJoin($tbl, $fk, TBGIssuesTable::ID, array(array($tbl->getB2DBAlias() . '.' . $filter_key, $this->getValues())), \b2db\Criteria::DB_INNER_JOIN);
                 return null;
             } else {
                 if ($filter_key == 'project_id' && in_array('subprojects', $filters)) {
                     return null;
                 }
                 $values = $this->getValues();
                 $num_values = 0;
                 if ($filter_key == 'status') {
                     if ($this->hasValue('open')) {
                         $c = $crit->returnCriterion(TBGIssuesTable::STATE, TBGIssue::STATE_OPEN);
                         $num_values++;
                     }
                     if ($this->hasValue('closed')) {
                         $num_values++;
                         if (isset($c)) {
                             $c->addWhere(TBGIssuesTable::STATE, TBGIssue::STATE_CLOSED);
                         } else {
                             $c = $crit->returnCriterion(TBGIssuesTable::STATE, TBGIssue::STATE_CLOSED);
                         }
                     }
                     if (isset($c)) {
                         if (count($values) == $num_values) {
                             return $c;
                         } else {
                             $crit->addWhere($c);
                         }
                     }
                 }
                 $dbname = TBGIssuesTable::getTable()->getB2DBName();
                 foreach ($values as $value) {
                     $operator = $this['operator'];
                     $or = true;
                     if ($filter_key == 'status' && in_array($value, array('open', 'closed'))) {
                         continue;
                     } else {
                         $field = $dbname . '.' . $filter_key;
                         if ($operator == '!=' || in_array($filter_key, array('posted', 'last_updated'))) {
                             $or = false;
                         }
                     }
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion($field, $value, urldecode($operator));
                     } elseif ($or) {
                         $ctn->addOr($field, $value, urldecode($operator));
                     } else {
                         $ctn->addWhere($field, $value, urldecode($operator));
                     }
                 }
                 return $ctn;
             }
         } elseif (TBGCustomDatatype::doesKeyExist($filter_key)) {
             $customdatatype = TBGCustomDatatype::getByKey($filter_key);
             if (in_array($this->getFilterType(), TBGCustomDatatype::getInternalChoiceFieldsAsArray())) {
                 $tbl = clone TBGIssueCustomFieldsTable::getTable();
                 $crit->addJoin($tbl, TBGIssueCustomFieldsTable::ISSUE_ID, TBGIssuesTable::ID, array(array($tbl->getB2DBAlias() . '.customfields_id', $customdatatype->getID()), array($tbl->getB2DBAlias() . '.customfieldoption_id', $this->getValues())), \b2db\Criteria::DB_INNER_JOIN);
                 return null;
             } else {
                 foreach ($this->getValues() as $value) {
                     if ($customdatatype->hasCustomOptions()) {
                         if ($ctn === null) {
                             $ctn = $crit->returnCriterion(TBGIssueCustomFieldsTable::CUSTOMFIELDS_ID, $customdatatype->getID());
                             $ctn->addWhere(TBGIssueCustomFieldsTable::CUSTOMFIELDOPTION_ID, $value, $this['operator']);
                         } else {
                             $ctn->addOr(TBGIssueCustomFieldsTable::CUSTOMFIELDOPTION_ID, $value, $this['operator']);
                         }
                     } else {
                         if ($ctn === null) {
                             $ctn = $crit->returnCriterion(TBGIssueCustomFieldsTable::CUSTOMFIELDS_ID, $customdatatype->getID());
                             $ctn->addWhere(TBGIssueCustomFieldsTable::OPTION_VALUE, $value, $this['operator']);
                         } else {
                             $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $value, $this['operator']);
                         }
                     }
                 }
                 return $ctn;
             }
         }
     }
 }
예제 #22
0
 public function extractIssues($matches)
 {
     $issue = TBGIssue::getIssueFromLink($matches["issues"]);
     if ($issue instanceof TBGIssue) {
         if (!TBGContext::isProjectContext() || TBGContext::isProjectContext() && $issue->getProjectID() == TBGContext::getCurrentProject()->getID()) {
             $this->foundissues[$issue->getID()] = $issue;
             $this->resultcount++;
         }
     }
 }
예제 #23
0
<?php

$article_name = isset($article_name) ? $article_name : '';
if (!TBGContext::isProjectContext() || TBGContext::isProjectContext() && mb_strtolower($article_name) != mb_strtolower(TBGContext::getCurrentProject()->getKey() . ':mainpage')) {
    if (TBGContext::isProjectContext()) {
        $tbg_response->addBreadcrumb(TBGPublish::getModule()->getMenuTitle(), make_url('publish_article', array('article_name' => TBGContext::getCurrentProject()->getKey() . ':MainPage')), tbg_get_breadcrumblinks('project_summary', TBGContext::getCurrentProject()));
    } else {
        $tbg_response->addBreadcrumb(TBGPublish::getModule()->getMenuTitle(), make_url('publish_article', array('article_name' => 'MainPage')), tbg_get_breadcrumblinks('main_links'));
    }
    $items = explode(':', $article_name);
    $bcpath = array_shift($items);
    if (mb_strtolower($bcpath) == 'category') {
        $tbg_response->addBreadcrumb(__('Categories'));
        if (TBGContext::isProjectContext()) {
            $bcpath .= ":" . array_shift($items);
        }
    } elseif (!TBGContext::isProjectContext() && mb_strtolower($bcpath) != 'mainpage') {
        $tbg_response->addBreadcrumb($bcpath, make_url('publish_article', array('article_name' => $bcpath)));
    }
    foreach ($items as $bc_name) {
        $bcpath .= ":" . $bc_name;
        $tbg_response->addBreadcrumb($bc_name, make_url('publish_article', array('article_name' => $bcpath)));
    }
} else {
    $tbg_response->addBreadcrumb(TBGPublish::getModule()->getMenuTitle(), make_url('publish_article', array('article_name' => TBGContext::getCurrentProject()->getKey() . ':MainPage')), tbg_get_breadcrumblinks('project_summary', TBGContext::getCurrentProject()));
}
예제 #24
0
    if ($issue->isBlocking()) {
        ?>
 blocking<?php 
    }
    ?>
">
			<td style="padding: 3px;">
				<div class="rounded_box iceblue borderless" style="margin: 0 5px 0 0; vertical-align: middle; padding: 1px; text-align: center">
					<div class="votes"><?php 
    echo $issue->getVotes();
    ?>
</div>
				</div>
			</td>
			<td class="result_issue"<?php 
    if (TBGContext::isProjectContext()) {
        ?>
 style="padding-left: 3px;"<?php 
    }
    ?>
>
				<?php 
    echo link_tag(make_url('viewissue', array('project_key' => $issue->getProject()->getKey(), 'issue_no' => $issue->getFormattedIssueNo())), '<span class="issue_no">' . $issue->getFormattedIssueNo(true, true) . '</span> - <span class="issue_title">' . $issue->getTitle() . '</span>', array('class' => 'issue_link'));
    ?>
			</td>
			<td<?php 
    if (!$issue->getStatus() instanceof TBGDatatype) {
        ?>
 class="faded_out"<?php 
    }
    ?>
<li class="searchterm"><?php 
echo $searchterm;
?>
<br><span class="informal"><?php 
echo __('Select this to search the wiki for this term');
?>
</span><span class="url informal"><?php 
echo TBGContext::isProjectContext() ? make_url('publish_find_project_articles', array('project_key' => TBGContext::getCurrentProject()->getKey(), 'articlename' => $searchterm)) : make_url('publish_find_articles', array('articlename' => $searchterm));
?>
</span></li>
		<?php 
        }
        ?>
	<?php 
    }
    ?>
	<?php 
    if (true || $resultcount - $cc > 0) {
        ?>
		<li class="find_more_issues last">
			<span class="informal"><?php 
        echo __('See %num% more articles ...', array('%num%' => $resultcount - $cc));
        ?>
</span>
			<div class="hidden url"><?php 
        echo TBGContext::isProjectContext() ? make_url('publish_find_project_articles', array('project_key' => TBGContext::getCurrentProject()->getKey())) : make_url('publish_find_articles');
        ?>
?articlename=<?php 
        echo $searchterm;
        ?>
</div>
		</li>
	<?php 
    }
} else {
    ?>
	<li class="disabled no_issues_found">
		<?php 
    echo __('No articles found matching your query');
    ?>
	</li>
예제 #27
0
<?php

$children = $main_article->getChildArticles();
$is_parent = in_array($main_article->getID(), $parents);
$is_selected = $main_article->getID() == $article->getID() || $main_article->isRedirect() && $main_article->getRedirectArticleName() == $article->getTitle();
$is_first = $first;
$first = false;
$project_key = TBGContext::isProjectContext() ? TBGContext::getCurrentProject()->getKey() . ':' : '';
//	$article_name = (strpos(mb_strtolower($main_article->getTitle()), 'category:') !== false) ? substr($main_article->getTitle(), 9+mb_strlen($project_key)) : substr($main_article->getTitle(), mb_strlen($project_key));
?>
<li class="<?php 
echo isset($level) && $level >= 1 ? 'child' : 'parent';
?>
 <?php 
if ($is_parent && !$is_selected) {
    echo 'parent';
}
?>
 <?php 
if ($is_selected) {
    echo 'selected';
}
?>
 level_<?php 
echo $level;
?>
" id="article_sidebar_link_<?php 
echo $article->getID();
?>
">
	<?php