View the public status page of a given project, if enabled.
@param $projectId
@return string
@throws \b8\Exception\HttpException\NotFoundException
357251
public function view($projectId)
    {
        $project = $this->projectStore->getById($projectId);

        if (empty($project)) {
            throw new NotFoundException('Project with id: ' . $projectId . ' not found');
        }

        if (!$project->getAllowPublicStatus()) {
            throw new NotFoundException('Project with id: ' . $projectId . ' not found');
        }

        $builds = $this->getLatestBuilds($projectId);

        if (count($builds)) {
            $this->view->latest = $builds[0];
        }

        $this->view->builds = $builds;
        $this->view->project = $project;

        return $this->view->render();
    }
468017
public function getRevisionById($revisionId)
    {
        $revision = $this->revisions->get($revisionId);

        if ($revision !== null) {
            return $revision; //We get here when rendering an unpublished page version
        }

        foreach ($this->revisions as $revision) {
            if ($revision->getRevisionId() === $revisionId) {
                return $revision; //We get here when publishing a new page version
            }
        }

        return null;
    }
969942
public function getLastBuildByStatus($projectId = null, $status = Build::STATUS_SUCCESS)
    {
        $query = 'SELECT * FROM build WHERE project_id = :pid AND status = :status ORDER BY id DESC LIMIT 1';
        $stmt = Database::getConnection('read')->prepare($query);
        $stmt->bindValue(':pid', $projectId);
        $stmt->bindValue(':status', $status);

        if ($stmt->execute()) {
            if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) {
                return new Build($data);
            }
        } else {
            return array();
        }
    }
528960
public function isPublic($status = null)
    {
        $this->is_public = $status !== null ? $status : $this->is_public;
        return $this->is_public ;
    }
44872
def get_project(self, project_id):
        
        try:
            return self._projects[project_id]
        except KeyError:
            raise aiohttp.web.HTTPNotFound(text="Project ID {} doesn't exist".format(project_id))
203046
public function getStatus($opportunityStatusId): OpportunityStatus
    {
        @trigger_error(sprintf('The %s() method is deprecated since version 0.8. Use get() instead.', __METHOD__), E_USER_DEPRECATED);

        return $this->get($opportunityStatusId);
    }
895773
public function getStatus($id = null)
    {
        if ($this->isSuccess()) {
            if (!$id) {
                $result = $this->getResult();
                return $result[0]['status'];
            }

            foreach ($this->getResult() as $row) {
                if ($row['id'] == $id) {
                    return $row['status'];
                }
            }
        }

        return false;
    }
149596
public function updateProject(int $projectId, string $name): bool
    {
        if ('' === $name || ! $this->validateId($projectId)) {
            return false;
        }

        $data   = $this->prepareRequestData(['name' => $name]);
        $result = $this->post('projects/' . $projectId, $data);

        return 204 === $result->getStatusCode();
    }
171542
public function actionView($id)
    {
        $user = $this->findModel(Yii::$app->user->id);
        /** @var DatabaseNotification $notification */
        if (($notification = $user->getNotifications()->andWhere(['id' => $id])->one()) != null) {
            $notification->setRead();
            return $notification;
        } else {
            throw new NotFoundHttpException("Notification not found: $id");
        }
    }
1090378
public function view($projectId)
    {
        $branch = $this->getParam('branch', '');
        $project = $this->projectStore->getById($projectId);

        if (empty($project)) {
            throw new NotFoundException(Lang::get('project_x_not_found', $projectId));
        }

        $per_page = 10;
        $page     = $this->getParam('p', 1);
        $builds   = $this->getLatestBuildsHtml($projectId, urldecode($branch), (($page - 1) * $per_page));
        $pages    = $builds[1] == 0 ? 1 : ceil($builds[1] / $per_page);

        if ($page > $pages) {
            $response = new b8\Http\Response\RedirectResponse();
            $response->setHeader('Location', PHPCI_URL.'project/view/'.$projectId);
            return $response;
        }

        $this->view->builds   = $builds[0];
        $this->view->total    = $builds[1];
        $this->view->project  = $project;
        $this->view->branch   = urldecode($branch);
        $this->view->branches = $this->projectStore->getKnownBranches($projectId);
        $this->view->page     = $page;
        $this->view->pages    = $pages;

        $this->layout->title = $project->getTitle();
        $this->layout->subtitle = $this->view->branch;

        return $this->view->render();
    }
844990
protected function changePageStatus($id, $status)
    {
        $object = $this->admin->getObject($id);

        if (!$object) {
            throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
        }

        if (false === $this->admin->isGranted('EDIT', $object)) {
            throw new AccessDeniedException();
        }

        $this->admin->setSubject($object);

        $form = $this->admin->getForm();

        $object->setStatus($status);

        // persist if the form was valid and if in preview mode the preview was approved
        $this->admin->update($object);

        $this->get('session')->getFlashBag()->add('sonata_flash_success', $this->translate('flash_status_success'));

        return $this->redirect($this->admin->generateObjectUrl('edit', $object));
    }
627942
public function getStatus()
    {
        if (isset($this->_statuses[(int) $this->status])) {
            return $this->_statuses[(int) $this->status];
        }
        throw new \Exception('Status "' . $this->status . '" not found for Page with id ' . $this->id . '.');
    }
450347
public function getBuildBranches($projectId)
    {
        $query = 'SELECT DISTINCT `branch` FROM `build` WHERE `project_id` = :project_id';
        $stmt = Database::getConnection('read')->prepare($query);
        $stmt->bindValue(':project_id', $projectId);

        if ($stmt->execute()) {
            $res = $stmt->fetchAll(\PDO::FETCH_COLUMN);
            return $res;
        } else {
            return array();
        }
    }
802979
public function show($id)
    {
        $project = $this->client->get(sprintf('projects/%d.json', $id));

        return new Project($this->response($project));
    }
904367
public function svn($projectId)
    {
        $project = $this->fetchProject($projectId, 'svn');
        $branch = $this->getParam('branch', $project->getBranch());
        $commit = $this->getParam('commit');
        $commitMessage = $this->getParam('message');
        $committer = $this->getParam('committer');

        return $this->createBuild($project, $commit, $branch, $committer, $commitMessage);
    }
513278
public function getSendAllStatus($messageId)
    {
        $result = $this->httpRaw(self::WECHAT_SEND_ALL_STATUS, [
            'msgid' => $messageId
        ], [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['msg_status']) ? $result : false;
    }
330792
protected function locateProject($id)
    {
        $url = $this->accountsEndpoint . 'projects/' . rawurlencode($id);
        try {
            $result = $this->simpleGet($url);
        }
        catch (BadResponseException $e) {
            $response = $e->getResponse();
            // @todo Remove 400 from this array when the API is more liberal in validating project IDs.
            $ignoredErrorCodes = [400, 403, 404];
            if ($response && in_array($response->getStatusCode(), $ignoredErrorCodes)) {
                return false;
            }
            throw ApiResponseException::create($e->getRequest(), $e->getResponse(), $e->getPrevious());
        }

        return isset($result['endpoint']) ? $result['endpoint'] : false;
    }