/** * Shop Admins can view * @param Member $member * @return Boolean */ function canView($member = null) { if (Permission::checkMember($member, Config::inst()->get("EcommerceRole", "admin_permission_code"))) { return true; } return parent::canView($member); }
/** * Check if the user can view the forum. */ function canView($member = null) { if (!$member) { $member = Member::currentUser(); } return parent::canView($member) || $this->canModerate($member); }
/** * Render Page Version * * @param void * @return null */ function version() { if (!instance_of($this->active_page, 'Page')) { $this->httpError(HTTP_ERR_NOT_FOUND, null, true, $this->request->isApiCall()); } // if if (!$this->active_page->canView($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall()); } // if $version = PageVersions::findByPage($this->active_page, $this->request->get('version')); if (!instance_of($version, 'PageVersion')) { $this->httpError(HTTP_ERR_NOT_FOUND, null, true, $this->request->isApiCall()); } // if $this->addBreadcrumb($this->active_page->getName(), mobile_access_module_get_view_url($this->active_page)); $this->addBreadcrumb(lang('Version #:version', array('version' => $version->getVersion()))); $this->smarty->assign(array('page_back_url' => mobile_access_module_get_view_url($this->active_page), 'version' => $version)); }
/** * {@inheritdoc} */ public function canView($member = null) { $member = $this->getMember($member); if (!parent::canView($member)) { return false; } if ($this->canEdit($member)) { return true; } /** * @var SS_Datetime $publishDate */ $publishDate = $this->dbObject('PublishDate'); if (!$publishDate->exists()) { return false; } return !$publishDate->InFuture(); }
/** * {@inheritdoc} */ public function canView($member = null) { $member = $this->getMember($member); if (!parent::canView($member)) { return false; } /** * @var SS_Datetime $publishDate */ $publishDate = $this->dbObject('PublishDate'); // Show past posts if (!$publishDate->exists() || !$publishDate->InFuture()) { return true; } // Anyone that can edit this page can view it return $this->canEdit($member); }
/** * View specific page * * @param void * @return null */ function view() { //BOF:mod 20120814 $redirect_to_page_id = ''; switch ($this->active_page->getId()) { case '22836': $redirect_to_page_id = '26019'; break; case '21394': $redirect_to_page_id = '26136'; break; case '21400': $redirect_to_page_id = '26137'; break; case '21401': $redirect_to_page_id = '26138'; break; case '24845': $redirect_to_page_id = '26139'; break; case '24859': $redirect_to_page_id = '26140'; break; case '24867': $redirect_to_page_id = '26141'; break; case '25498': $redirect_to_page_id = '26142'; break; } if (!empty($redirect_to_page_id)) { $this->redirectToUrl(assemble_url('project_page', array('project_id' => TASK_LIST_PROJECT_ID, 'page_id' => $redirect_to_page_id))); } //EOF:mod 20120814 if ($this->active_page->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND, null, true, $this->request->isApiCall()); } // if if (!$this->active_page->canView($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall()); } // if if ($this->request->isApiCall()) { $this->serveData($this->active_page, 'page', array('describe_comments' => true, 'describe_tasks' => true, 'describe_attachments' => true, 'describe_subpages' => true, 'describe_revisions' => true)); } else { ProjectObjectViews::log($this->active_page, $this->logged_user); $page = (int) $this->request->get('page'); if ($page < 1) { $page = 1; } // if $show_all = $this->request->get('show_all'); if (!empty($show_all) && $show_all == '1' && !isset($_GET['comment_id'])) { $comments = null; $pagination = null; } else { $show_all = ''; list($comments, $pagination) = $this->active_page->paginateComments($page, $this->active_page->comments_per_page, $this->logged_user->getVisibility()); } $comments_only_mode = $this->request->get('comments_only_mode'); if ($comments_only_mode) { $this->smarty->assign(array('_object_comments_comments' => $comments, 'pagination' => $pagination, '_counter' => ($page - 1) * $this->active_page->comments_per_page)); echo $this->smarty->fetch(get_template_path('_object_comments_ajax', 'comments', RESOURCES_MODULE)); exit; } $scroll_to_comment = $this->request->get('comment_id'); /*if (!empty($scroll_to_comment)){ for($i=0; $i<count($comments); $i++){ if ($comments[$i]->getId()==$scroll_to_comment){ $scroll_to_comment = ''; break; } } }*/ $dID = $_GET['dID']; if (!empty($dID)) { $this->active_page->changeDepartmentTo($dID); } $pID = $_GET['pID']; if (!empty($pID)) { $this->active_page->setMilestoneId($pID); $this->active_page->save(); $this->active_page->changeDepartmentTo(ProjectObject::getDepartmentId($pID)); } $this->smarty->assign(array('parent' => $this->active_page->getParent(), 'subpages' => $this->active_page->getSubpages($this->logged_user->getVisibility()), 'versions' => $this->active_page->getVersions(), 'comments' => $comments, 'pagination' => $pagination, 'subscribers' => $this->active_page->getSubscribers(), 'current_user_id' => $this->logged_user->getId(), 'object_id' => $this->active_page->getId(), 'scroll_to_comment' => $scroll_to_comment, 'show_all' => $show_all)); } // if }
/** * Checks the publish date to see if the blog post has actually been published. * * @param $member Member|null * * @return boolean **/ public function canView($member = null) { if (!parent::canView($member)) { return false; } if ($this->PublishDate) { $publishDate = $this->dbObject("PublishDate"); if ($publishDate->InFuture() && !Permission::checkMember($member, "VIEW_DRAFT_CONTENT")) { return false; } } return true; }
/** * Can this user view the thread. * * @return bool */ function canView() { return parent::canView() || $this->isAdmin(); }
/** * {@inheritdoc} */ public function canView($member = null) { if (!parent::canView($member)) { return false; } if ($this->PublishDate) { /** * @var SS_Datetime $publishDate */ $publishDate = $this->dbObject('PublishDate'); if ($publishDate->InFuture() && !Permission::checkMember($member, 'VIEW_DRAFT_CONTENT')) { return false; } } return true; }