public function hasProjectsAvailable() { return $this->getMaxProjects() ? Project::getProjectsCount() < $this->getMaxProjects() : true; }
/** * Delete a project * * @param framework\Request $request The request object */ public function runDeleteProject(framework\Request $request) { $i18n = framework\Context::getI18n(); if ($this->access_level == framework\Settings::ACCESS_FULL) { try { $theProject = entities\Project::getB2DBTable()->selectByID($request['project_id']); $theProject->setDeleted(); $theProject->save(); return $this->renderJSON(array('title' => $i18n->__('The project was deleted'), 'total_count' => entities\Project::getProjectsCount(), 'more_available' => framework\Context::getScope()->hasProjectsAvailable())); } catch (\Exception $e) { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('error' => $i18n->__('An error occured') . ': ' . $e->getMessage())); } } $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array("error" => $i18n->__("You don't have access to remove projects"))); }
<div style="width: 730px;"> <h3><?php echo __('Configure projects'); ?> </h3> <div class="content faded_out"> <p> <?php echo __('More information about projects, editions, builds and components is available from the %wiki_help_section.', array('%wiki_help_section' => link_tag(make_url('publish_article', array('article_name' => 'Category:Help')), '<b>' . __('Wiki help section') . '</b>'))); ?> <?php if (\thebuggenie\core\framework\Context::getScope()->getMaxProjects()) { ?> <div class="faded_out dark" style="margin: 12px 0;"> <?php echo __('This instance is using %num of max %max projects', array('%num' => '<b id="current_project_num_count">' . \thebuggenie\core\entities\Project::getProjectsCount() . '</b>', '%max' => '<b>' . \thebuggenie\core\framework\Context::getScope()->getMaxProjects() . '</b>')); ?> </div> <?php } ?> </p> </div> <?php if ($access_level == \thebuggenie\core\framework\Settings::ACCESS_FULL) { ?> <div class="lightyellowbox" style="padding: 5px; margin: 10px 0;<?php if (!\thebuggenie\core\framework\Context::getScope()->hasProjectsAvailable()) { ?> display: none;<?php }