本文整理汇总了PHP中thebuggenie\core\entities\Project类的典型用法代码示例。如果您正苦于以下问题:PHP Project类的具体用法?PHP Project怎么用?PHP Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runListProjects
public function runListProjects(framework\Request $request)
{
$projects = entities\Project::getAll();
$return_array = array();
foreach ($projects as $project) {
$return_array[$project->getKey()] = $project->getName();
}
$this->projects = $return_array;
}
示例2: preExecute
/**
* Pre-execute function
*
* @param \thebuggenie\core\framework\Request $request
*/
public function preExecute(framework\Request $request, $action)
{
$this->article = null;
$this->article_name = $request->getRawParameter('article_name');
$this->article_id = (int) $request['article_id'];
$this->special = false;
if (!is_null($this->article_name) && mb_strpos($this->article_name, ':') !== false) {
$this->article_name = $this->_getArticleNameDetails($this->article_name);
} else {
try {
if ($project_key = $request['project_key']) {
$this->selected_project = \thebuggenie\core\entities\Project::getByKey($project_key);
} elseif ($project_id = (int) $request['project_id']) {
$this->selected_project = \thebuggenie\core\entities\tables\Projects::getTable()->selectById($project_id);
}
} catch (\Exception $e) {
}
}
if (!$this->special) {
if ($this->article_id) {
$this->article = Articles::getTable()->selectById($this->article_id);
} elseif ($this->article_name) {
$this->article = Articles::getTable()->getArticleByName($this->article_name);
}
if (!$this->article instanceof Article) {
$this->article = new Article();
if ($this->article_name) {
$this->article->setName($this->article_name);
} elseif ($request->hasParameter('parent_article_name')) {
$parent_article_name = $request->getRawParameter('parent_article_name');
$this->article->setParentArticle(Articles::getTable()->getArticleByName($parent_article_name));
$this->_getArticleNameDetails($parent_article_name);
if ($this->article->getParentArticle() instanceof Article) {
if ($this->article->getParentArticle()->getArticleType() == Article::TYPE_WIKI) {
$this->article->setName($this->article->getParentArticle()->getName() . ':');
}
$this->article->setArticleType($this->article->getParentArticle()->getArticleType());
}
}
$this->article->setContentSyntax($this->getUser()->getPreferredWikiSyntax(true));
}
}
if ($this->selected_project instanceof \thebuggenie\core\entities\Project) {
if (!$this->selected_project->hasAccess()) {
$this->forward403();
} else {
framework\Context::setCurrentProject($this->selected_project);
}
}
}
示例3: preExecute
/**
* Pre-execute function
*
* @param framework\Request $request
* @param string $action
*/
public function preExecute(framework\Request $request, $action)
{
try {
if ($project_id = $request['project_id']) {
$this->selected_project = entities\Project::getB2DBTable()->selectById($project_id);
} elseif ($project_key = $request['project_key']) {
$this->selected_project = entities\Project::getByKey($project_key);
}
} catch (\Exception $e) {
}
if (!$this->selected_project instanceof entities\Project) {
return $this->return404(framework\Context::getI18n()->__('This project does not exist'));
}
framework\Context::setCurrentProject($this->selected_project);
$this->project_key = $this->selected_project->getKey();
}
示例4: componentArchivedProjects
public function componentArchivedProjects()
{
if (!isset($this->target)) {
$this->projects = entities\Project::getAllRootProjects(true);
$this->project_count = count($this->projects);
} elseif ($this->target == 'team') {
$this->team = entities\Team::getB2DBTable()->selectById($this->id);
$projects = array();
foreach (entities\Project::getAllByOwner($this->team) as $project) {
$projects[$project->getID()] = $project;
}
foreach (entities\Project::getAllByLeader($this->team) as $project) {
$projects[$project->getID()] = $project;
}
foreach (entities\Project::getAllByQaResponsible($this->team) as $project) {
$projects[$project->getID()] = $project;
}
foreach ($this->team->getAssociatedProjects() as $project_id => $project) {
$projects[$project_id] = $project;
}
$final_projects = array();
foreach ($projects as $project) {
if ($project->isArchived()) {
$final_projects[] = $project;
}
}
$this->projects = $final_projects;
} elseif ($this->target == 'client') {
$this->client = entities\Client::getB2DBTable()->selectById($this->id);
$projects = entities\Project::getAllByClientID($this->client->getID());
$final_projects = array();
foreach ($projects as $project) {
if (!$project->isArchived()) {
$final_projects[] = $project;
}
}
$this->projects = $final_projects;
} elseif ($this->target == 'project') {
$this->parent = entities\Project::getB2DBTable()->selectById($this->id);
$this->projects = $this->parent->getChildren(true);
}
$this->project_count = count($this->projects);
}
示例5: runSaveIncomingAccount
/**
* Save incoming email account
*
* @Route(url="/mailing/:project_key/incoming_account/*", name="save_incoming_account")
* @param \thebuggenie\core\framework\Request $request
* @return type
*/
public function runSaveIncomingAccount(framework\Request $request)
{
$project = null;
if ($project_key = $request['project_key']) {
try {
$project = \thebuggenie\core\entities\Project::getByKey($project_key);
} catch (\Exception $e) {
}
}
if ($project instanceof \thebuggenie\core\entities\Project) {
try {
$account_id = $request['account_id'];
$account = $account_id ? new \thebuggenie\modules\mailing\entities\IncomingEmailAccount($account_id) : new \thebuggenie\modules\mailing\entities\IncomingEmailAccount();
$account->setIssuetype((int) $request['issuetype']);
$account->setProject($project);
$account->setPort((int) $request['port']);
$account->setName($request['name']);
$account->setFoldername($request['folder']);
$account->setKeepEmails($request['keepemail']);
$account->setServer($request['servername']);
$account->setUsername($request['username']);
$account->setPassword($request['password']);
$account->setSSL((bool) $request['ssl']);
$account->setIgnoreCertificateValidation((bool) $request['ignore_certificate_validation']);
$account->setUsePlaintextAuthentication((bool) $request['plaintext_authentication']);
$account->setServerType((int) $request['account_type']);
$account->save();
if (!$account_id) {
return $this->renderComponent('mailing/incomingemailaccount', array('project' => $project, 'account' => $account));
} else {
return $this->renderJSON(array('name' => $account->getName()));
}
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $this->getI18n()->__('This is not a valid mailing account')));
}
} else {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $this->getI18n()->__('This is not a valid project')));
}
}
示例6: preExecute
/**
* The currently selected project in actions where there is one
*
* @access protected
* @property entities\Project $selected_project
*/
public function preExecute(framework\Request $request, $action)
{
try {
// Default to JSON if nothing is specified.
$newFormat = $request->getParameter('format', 'json');
$this->getResponse()->setTemplate(mb_strtolower($action) . '.' . $newFormat . '.php');
$this->getResponse()->setupResponseContentType($newFormat);
if ($project_key = $request['project_key']) {
$this->selected_project = entities\Project::getByKey($project_key);
} elseif ($project_id = (int) $request['project_id']) {
$this->selected_project = entities\Project::getB2DBTable()->selectByID($project_id);
}
if ($this->selected_project instanceof entities\Project) {
framework\Context::setCurrentProject($this->selected_project);
}
$this->render_detail = !isset($request['nodetail']);
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(500);
return $this->renderJSON(array('error' => 'An exception occurred: ' . $e));
}
}
示例7: populateBreadcrumbs
public static function populateBreadcrumbs()
{
$childbreadcrumbs = array();
if (self::$_selected_project instanceof Project) {
$t = self::$_selected_project;
$hierarchy_breadcrumbs = array();
$projects_processed = array();
while ($t instanceof Project) {
if (array_key_exists($t->getKey(), $projects_processed)) {
// We have a cyclic dependency! Oh no!
// If this happens, throw an exception
throw new \Exception(self::geti18n()->__('A loop has been found in the project heirarchy. Go to project configuration, and alter the subproject setting for this project so that this project is not a subproject of one which is a subproject of this one.'));
}
$projects_processed[$t->getKey()] = $t;
$itemsubmenulinks = self::getResponse()->getPredefinedBreadcrumbLinks('project_summary', $t);
if ($t->hasChildren()) {
$itemsubmenulinks[] = array('separator' => true);
foreach ($t->getChildren() as $child) {
if (!$child->hasAccess()) {
continue;
}
$itemsubmenulinks[] = array('url' => self::getRouting()->generate('project_dashboard', array('project_key' => $child->getKey())), 'title' => $child->getName());
}
}
$hierarchy_breadcrumbs[] = array($t, $itemsubmenulinks);
if ($t->hasParent()) {
$parent = $t->getParent();
$t = $t->getParent();
} else {
$t = null;
}
}
if (self::$_selected_project->hasClient()) {
self::setCurrentClient(self::$_selected_project->getClient());
}
if (mb_strtolower(Settings::getSiteHeaderName()) != mb_strtolower(self::$_selected_project->getName()) || self::isClientContext()) {
self::getResponse()->addBreadcrumb(Settings::getSiteHeaderName(), self::getRouting()->generate('home'), self::getResponse()->getPredefinedBreadcrumbLinks('main_links', self::$_selected_project));
if (self::isClientContext()) {
self::getResponse()->addBreadcrumb(self::getCurrentClient()->getName(), self::getRouting()->generate('client_dashboard', array('client_id' => self::getCurrentClient()->getID())), self::getResponse()->getPredefinedBreadcrumbLinks('client_list'));
}
}
// Add root breadcrumb first, so reverse order
$hierarchy_breadcrumbs = array_reverse($hierarchy_breadcrumbs);
foreach ($hierarchy_breadcrumbs as $breadcrumb) {
$class = null;
if ($breadcrumb[0]->getKey() == self::getCurrentProject()->getKey()) {
$class = 'selected_project';
}
self::getResponse()->addBreadcrumb($breadcrumb[0]->getName(), self::getRouting()->generate('project_dashboard', array('project_key' => $breadcrumb[0]->getKey())), $breadcrumb[1], $class);
}
} else {
self::getResponse()->addBreadcrumb(Settings::getSiteHeaderName(), self::getRouting()->generate('home'), self::getResponse()->getPredefinedBreadcrumbLinks('main_links'));
}
}
示例8: addToCriteria
/**
*
* @param \b2db\Criteria $crit
* @param array|\thebuggenie\core\entities\SearchFilter $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']}%";
$issue_no = Issue::extractIssueNoFromNumber($this['value']);
if ($this['operator'] == '=') {
if ($ctn === null) {
$ctn = $crit->returnCriterion(tables\Issues::TITLE, $searchterm, Criteria::DB_LIKE);
}
$ctn->addOr(tables\Issues::DESCRIPTION, $searchterm, Criteria::DB_LIKE);
$ctn->addOr(tables\Issues::REPRODUCTION_STEPS, $searchterm, Criteria::DB_LIKE);
$ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
if (is_numeric($issue_no)) {
$ctn->addOr(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
}
$ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
if (is_numeric($issue_no)) {
$ctn->addOr(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
}
// $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
} else {
if ($ctn === null) {
$ctn = $crit->returnCriterion(tables\Issues::TITLE, $searchterm, Criteria::DB_NOT_LIKE);
}
$ctn->addWhere(tables\Issues::DESCRIPTION, $searchterm, Criteria::DB_NOT_LIKE);
$ctn->addWhere(tables\Issues::REPRODUCTION_STEPS, $searchterm, Criteria::DB_NOT_LIKE);
$ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
if (is_numeric($issue_no)) {
$ctn->addWhere(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
}
$ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
if (is_numeric($issue_no)) {
$ctn->addWhere(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
}
// $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
}
return $ctn;
}
} elseif (in_array($filter_key, self::getValidSearchFilters())) {
if ($filter_key == 'subprojects') {
if (framework\Context::isProjectContext()) {
if ($ctn === null) {
$ctn = $crit->returnCriterion(tables\Issues::PROJECT_ID, framework\Context::getCurrentProject()->getID());
}
if ($this->hasValue()) {
foreach ($this->getValues() as $value) {
switch ($value) {
case 'all':
$subprojects = Project::getIncludingAllSubprojectsAsArray(framework\Context::getCurrentProject());
foreach ($subprojects as $subproject) {
if ($subproject->getID() == framework\Context::getCurrentProject()->getID()) {
continue;
}
$ctn->addOr(tables\Issues::PROJECT_ID, $subproject->getID());
}
break;
case 'none':
case '':
break;
default:
$ctn->addOr(tables\Issues::PROJECT_ID, (int) $value);
break;
}
}
}
return $ctn;
}
} elseif (in_array($filter_key, array('build', 'edition', 'component'))) {
switch ($filter_key) {
case 'component':
$tbl = tables\IssueAffectsComponent::getTable();
$fk = tables\IssueAffectsComponent::ISSUE;
break;
case 'edition':
$tbl = tables\IssueAffectsEdition::getTable();
$fk = tables\IssueAffectsEdition::ISSUE;
break;
case 'build':
$tbl = tables\IssueAffectsBuild::getTable();
$fk = tables\IssueAffectsBuild::ISSUE;
break;
}
$crit->addJoin($tbl, $fk, tables\Issues::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;
//.........这里部分代码省略.........
示例9: setLockedFromProject
/**
* Specify whether or not this item is locked / locked to category based on project new issues lock type
*
* @param Project $project
*/
public function setLockedFromProject(Project $project)
{
switch ($project->getIssuesLockType()) {
case Project::ISSUES_LOCK_TYPE_PUBLIC_CATEGORY:
$this->setLocked(false);
$this->setLockedCategory(true);
break;
case Project::ISSUES_LOCK_TYPE_PUBLIC:
$this->setLocked(false);
$this->setLockedCategory(false);
break;
case Project::ISSUES_LOCK_TYPE_RESTRICTED:
$this->setLocked(true);
$this->setLockedCategory(false);
break;
}
}
示例10: __
">
<input type="search" name="articlename" placeholder="<?php
echo $quicksearch_title;
?>
">
</form>
</div>
<?php
if (count(\thebuggenie\core\entities\Project::getAll()) > (int) \thebuggenie\core\framework\Context::isProjectContext()) {
?>
<div class="header"><?php
echo __('Project wikis');
?>
</div>
<?php
foreach (\thebuggenie\core\entities\Project::getAll() as $project) {
?>
<?php
if (!$project->hasAccess() || isset($project_url) && $project->getID() == \thebuggenie\core\framework\Context::getCurrentProject()->getID()) {
continue;
}
?>
<?php
if (!$project->hasWikiURL()) {
?>
<?php
echo link_tag(make_url('publish_article', array('article_name' => ucfirst($project->getKey()) . ':MainPage')), $project->getName());
?>
<?php
} else {
?>
示例11: getIncomingEmailAccountsForProject
public function getIncomingEmailAccountsForProject(Project $project)
{
return IncomingEmailAccount::getAllByProjectID($project->getID());
}
示例12: canAssignScrumUserStories
/**
* Return if the user can assign scrum user stories
*
* @param \thebuggenie\core\entities\Project $project
*
* @return boolean
*/
public function canAssignScrumUserStories(\thebuggenie\core\entities\Project $project)
{
if ($project->isArchived()) {
return false;
}
if ($this->canSaveConfiguration(framework\Settings::CONFIGURATION_SECTION_PROJECTS)) {
return true;
}
if ($project->getOwner() instanceof User && $project->getOwner()->getID() == $this->getID()) {
return true;
}
$retval = $this->hasPermission('canassignscrumuserstoriestosprints', $project->getID());
$retval = $retval !== null ? $retval : $this->hasPermission('candoscrumplanning', $project->getID());
$retval = $retval !== null ? $retval : $this->hasPermission('canassignscrumuserstoriestosprints', 0);
$retval = $retval !== null ? $retval : $this->hasPermission('candoscrumplanning', 0);
return (bool) ($retval !== null) ? $retval : false;
}
示例13: hasProjectsAvailable
public function hasProjectsAvailable()
{
return $this->getMaxProjects() ? Project::getProjectsCount() < $this->getMaxProjects() : true;
}
示例14: getProject
/**
* Return the associated project if any
*
* @return Project
*/
public function getProject()
{
return $this->getItemdata() ? \thebuggenie\core\entities\Project::getB2DBTable()->selectById((int) $this->getItemdata()) : null;
}
示例15: runDeleteClient
public function runDeleteClient(framework\Request $request)
{
try {
try {
$client = entities\Client::getB2DBTable()->selectById($request['client_id']);
} catch (\Exception $e) {
}
if (!$client instanceof entities\Client) {
throw new \Exception($this->getI18n()->__("You cannot delete this client"));
}
if (entities\Project::getAllByClientID($client->getID()) !== null) {
foreach (entities\Project::getAllByClientID($client->getID()) as $project) {
$project->setClient(null);
$project->save();
}
}
$client->delete();
return $this->renderJSON(array('success' => true, 'message' => $this->getI18n()->__('The client was deleted')));
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $e->getMessage()));
}
}