/**
  * View the repository
  *
  */
 function view()
 {
     if ($this->active_repository->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_repository->canView($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $this->addBreadcrumb(str_excerpt(clean($this->active_repository->getName()), 10), mobile_access_module_get_view_url($this->active_repository));
     $this->addBreadcrumb(lang('View'));
     $per_page = 20;
     $page = intval(array_var($_GET, 'page')) > 0 ? array_var($_GET, 'page') : 1;
     list($commits, $pagination) = Commits::paginateByRepository($this->active_repository, $page, $per_page);
     $commits = group_by_date($commits);
     $this->smarty->assign(array('pagination' => $pagination, 'commits' => $commits, 'pagination_url' => assemble_url('mobile_access_view_repository', array('object_id' => $this->active_repository->getId(), 'project_id' => $this->active_project->getId())), 'page_back_url' => assemble_url('mobile_access_view_project', array('project_id' => $this->active_project->getId()))));
 }
 /**
  * View commit history of selected repository
  *
  * @param null
  * @return void
  */
 function history()
 {
     if (!$this->active_repository->canView($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $this->wireframe->addPageAction(lang('Browse repository'), $this->active_repository->getBrowseUrl(), null);
     if ($this->active_repository->canEdit($this->logged_user) || $this->active_repository->getCreatedById() == $this->logged_user->getId()) {
         $this->wireframe->addPageAction(lang('Update'), $this->active_repository->getUpdateUrl(), null, array('id' => 'repository_ajax_update'));
     }
     $per_page = 20;
     $page = intval(array_var($_GET, 'page')) > 0 ? array_var($_GET, 'page') : 1;
     $commits_count_params = array("parent_id = ?", $this->active_repository->getId());
     $filter_by_author = $this->request->get('filter_by_author');
     if (!is_null($filter_by_author)) {
         $commits_count_params['created_by_name'] = $filter_by_author;
     }
     // if
     list($commits, $pagination) = Commits::paginateByRepository($this->active_repository, $page, $per_page, $filter_by_author);
     if (is_foreachable($commits)) {
         foreach ($commits as $commit) {
             $commit->total_paths = count($commit->getPaths());
             $commit->setPaths($this->repository_engine->groupPaths($commit->getPaths()));
         }
         // foreach
         if (!is_null($filter_by_author)) {
             $filter_by_author = array();
             $filter_by_author['user_object'] = $commits['0']->getAuthor();
             $filter_by_author['user_name'] = $commits['0']->getCreatedbyName();
         }
         // if
     }
     // if
     $commits = group_by_date($commits, $this->logged_user);
     $this->smarty->assign(array('filter_by_author' => $filter_by_author, 'commits' => $commits, 'pagination' => $pagination, 'project' => $this->active_project, 'total_commits' => Commits::count($commits_count_params)));
 }