public function hasProjectsAvailable() { return $this->getMaxProjects() ? TBGProject::getProjectsCount() < $this->getMaxProjects() : true; }
/** * Delete a project * * @param TBGRequest $request The request object */ public function runDeleteProject(TBGRequest $request) { $i18n = TBGContext::getI18n(); if ($this->access_level == TBGSettings::ACCESS_FULL) { try { $theProject = TBGContext::factory()->TBGProject($request->getParameter('project_id')); $theProject->setDeleted(); $theProject->save(); return $this->renderJSON(array('failed' => false, 'title' => $i18n->__('The project was deleted'), 'total_count' => TBGProject::getProjectsCount(), 'more_available' => TBGContext::getScope()->hasProjectsAvailable())); } catch (Exception $e) { return $this->renderJSON(array('failed' => true, 'error' => $i18n->__('An error occured') . ': ' . $e->getMessage())); } } return $this->renderJSON(array('failed' => true, "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 (TBGContext::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">' . TBGProject::getProjectsCount() . '</b>', '%max' => '<b>' . TBGContext::getScope()->getMaxProjects() . '</b>')); ?> </div> <?php } ?> </p> </div> <?php if ($access_level == TBGSettings::ACCESS_FULL) { ?> <div class="lightyellowbox" style="padding: 5px; margin: 10px 0;<?php if (!TBGContext::getScope()->hasProjectsAvailable()) { ?> display: none;<?php }