コード例 #1
0
 public function displayStandardHomepage($display_homepage_news)
 {
     $dao = new Admin_Homepage_Dao();
     $current_user = UserManager::instance()->getCurrentUser();
     $project_dao = new UserDao();
     $nb_users = $project_dao->countActiveAndRestrictedUsers();
     $project_dao = new ProjectDao();
     $nb_projects = $project_dao->countActiveProjects();
     $most_secure_url = '';
     if (ForgeConfig::get('sys_https_host')) {
         $most_secure_url = 'https://' . ForgeConfig::get('sys_https_host');
     }
     $login_presenter_builder = new User_LoginPresenterBuilder();
     $login_presenter = $login_presenter_builder->buildForHomepage();
     $headline = $dao->getHeadlineByLanguage($current_user->getLocale());
     $news_bytes_dao = new NewsBytesDao();
     $news = false;
     if ($display_homepage_news && $news_bytes_dao->isThereNewsToDisplayInHomepage()) {
         $news = news_show_latest($GLOBALS['sys_news_group'], 2, true, false, true, 0);
     }
     $awesomeness = file_get_contents($GLOBALS['Language']->getContent('homepage/awesomeness', null, null, '.html'));
     $templates_dir = ForgeConfig::get('codendi_dir') . '/src/templates/homepage/';
     $renderer = TemplateRendererFactory::build()->getRenderer($templates_dir);
     $presenter = new FlamingParrot_HomepagePresenter($headline, $nb_projects, $nb_users, $most_secure_url, $login_presenter, $display_homepage_news, $news, $current_user, $awesomeness);
     $renderer->renderToPage('homepage', $presenter);
 }
コード例 #2
0
 private function getProjectIdForSystemReference($keyword, $value)
 {
     $ref_gid = null;
     $nature = $this->getSystemReferenceNatureByKeyword($keyword);
     switch ($nature) {
         case self::REFERENCE_NATURE_RELEASE:
             $release_factory = new FRSReleaseFactory();
             $release = $release_factory->getFRSReleaseFromDb($value);
             if ($release) {
                 $ref_gid = $release->getProject()->getID();
             }
             break;
         case self::REFERENCE_NATURE_FILE:
             $file_factory = new FRSFileFactory();
             $file = $file_factory->getFRSFileFromDb($value);
             if ($file) {
                 $ref_gid = $file->getGroup()->getID();
             }
             break;
         case self::REFERENCE_NATURE_FORUM:
             $forum_dao = new ForumDao();
             $forum_group_id_row = $forum_dao->searchByGroupForumId($value)->getRow();
             if ($forum_group_id_row) {
                 $ref_gid = $forum_group_id_row['group_id'];
             }
             break;
         case self::REFERENCE_NATURE_FORUMMESSAGE:
             $forum_dao = new ForumDao();
             $message_group_id_row = $forum_dao->getMessageProjectId($value);
             if ($message_group_id_row) {
                 $ref_gid = $message_group_id_row['group_id'];
             }
             break;
         case self::REFERENCE_NATURE_NEWS:
             $news_dao = new NewsBytesDao();
             $news_group_id_row = $news_dao->searchByForumId($value)->getRow();
             if ($news_group_id_row) {
                 $ref_gid = $news_group_id_row['group_id'];
             }
             break;
     }
     return $ref_gid;
 }