Пример #1
0
 disabled<?php 
}
?>
>
                <option value=1<?php 
if (\thebuggenie\core\framework\Settings::isSingleProjectTracker()) {
    ?>
 selected<?php 
}
?>
><?php 
echo __('Yes, behave as tracker for a single project');
?>
</option>
                <option value=0<?php 
if (!\thebuggenie\core\framework\Settings::isSingleProjectTracker()) {
    ?>
 selected<?php 
}
?>
><?php 
echo __('No, use regular index page');
?>
</option>
            </select>
            <?php 
echo config_explanation(__('In single project tracker mode, The Bug Genie will display the homepage for the first project as the main page instead of the regular index page') . "<br>" . (count(\thebuggenie\core\entities\Project::getAll()) > 1 ? '<br><b class="more_than_one_project_warning">' . __('More than one project exists. When in "single project" mode, accessing other projects than the first will become harder.') . '</b>' : ''));
?>
        </td>
    </tr>
    <tr>
    ?>
                        <?php 
    echo javascript_link_tag(image_tag('tabmenu_dropdown.png', array('class' => 'menu_dropdown')));
    ?>
                    </div>
                    <div id="project_information_menu" class="tab_menu_dropdown">
                        <?php 
    include_component('project/projectinfolinks', array('submenu' => true));
    ?>
                    </div>
                </li>
            <?php 
}
?>
        <?php 
if (!$tbg_user->isThisGuest() && !framework\Settings::isSingleProjectTracker() && !framework\Context::isProjectContext()) {
    ?>
                <li<?php 
    if ($tbg_response->getPage() == 'dashboard') {
        ?>
 class="selected"<?php 
    }
    ?>
>
                    <div class="menuitem_container">
                        <?php 
    echo link_tag('javascript:void(0);', image_tag('icon_dashboard_small.png') . __('Dashboard'));
    ?>
                        <?php 
    echo javascript_link_tag(image_tag('tabmenu_dropdown.png', array('class' => 'menu_dropdown')));
    ?>
Пример #3
0
 /**
  * Developer dashboard
  *
  * @param \thebuggenie\core\framework\Request $request
  */
 public function runDashboard(framework\Request $request)
 {
     $this->forward403unless(!$this->getUser()->isThisGuest() && $this->getUser()->hasPageAccess('dashboard'));
     if (framework\Settings::isSingleProjectTracker()) {
         if (($projects = entities\Project::getAll()) && ($project = array_shift($projects))) {
             framework\Context::setCurrentProject($project);
         }
     }
     if ($request['dashboard_id']) {
         $dashboard = entities\Dashboard::getB2DBTable()->selectById((int) $request['dashboard_id']);
         if ($dashboard->getType() == entities\Dashboard::TYPE_PROJECT && !$dashboard->getProject()->hasAccess()) {
             unset($dashboard);
         } elseif ($dashboard->getType() == entities\Dashboard::TYPE_USER && $dashboard->getUser()->getID() != framework\Context::getUser()->getID()) {
             unset($dashboard);
         }
     }
     if (!isset($dashboard) || !$dashboard instanceof entities\Dashboard) {
         $dashboard = $this->getUser()->getDefaultDashboard();
     }
     if ($request->isPost()) {
         switch ($request['mode']) {
             case 'add_view':
                 $sort_order = 1;
                 foreach ($dashboard->getViews() as $view) {
                     if ($view->getColumn() == $request['column']) {
                         $sort_order++;
                     }
                 }
                 $view = new entities\DashboardView();
                 $view->setDashboard($dashboard);
                 $view->setType($request['view_type']);
                 $view->setDetail($request['view_subtype']);
                 $view->setColumn($request['column']);
                 $view->setSortOrder($sort_order);
                 $view->save();
                 framework\Context::setCurrentProject($view->getProject());
                 return $this->renderJSON(array('view_content' => $this->getComponentHTML('main/dashboardview', array('view' => $view, 'show' => false)), 'view_id' => $view->getID()));
             case 'remove_view':
                 $deleted = 0;
                 foreach ($dashboard->getViews() as $view) {
                     if ($view->getID() == $request['view_id']) {
                         $deleted = $view->getID();
                         $view->delete();
                     }
                 }
                 return $this->renderJSON(array('deleted_view' => $deleted));
         }
     }
     $this->dashboard = $dashboard;
 }