Ejemplo n.º 1
0
 /**
  * Build the list of tabs (at the top of the window)
  *
  * @return string
  */
 protected function buildPages()
 {
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $pages[] = array('label' => 'Questions', 'url' => $this->view->url(array('controller' => 'index'), null, true), 'current' => !($this instanceof QFrame_Controller_Admin || $this instanceof CompareController), 'external' => false);
     if ($this->_user !== null && $this->_user->hasAccess('administer')) {
         $pages[] = array('label' => 'Administration', 'url' => $this->view->url(array('controller' => 'admin'), null, true), 'current' => $this instanceof QFrame_Controller_Admin, 'external' => false);
     }
     if ($this->_user !== null && $this->_user->hasAccess('compare')) {
         $pages[] = array('label' => 'Compare', 'url' => $this->view->url(array('controller' => 'compare'), null, true), 'current' => $this instanceof CompareController, 'external' => false);
     }
     if (isset(QFrame_Config::instance()->help_url)) {
         $pages[] = array('label' => 'Online Help', 'url' => QFrame_Config::instance()->help_url, 'current' => false, 'external' => true);
     }
     return $pages;
 }
Ejemplo n.º 2
0
 public function testGettingAutoAdmin()
 {
     $user = new DbUserModel(array('autoAdmin' => true));
     $page = new PageModel(array('pageID' => 1, 'depth' => 'page'));
     $this->assertTrue($user->hasAccess('admin'));
     $this->assertTrue($user->hasAnyAccess($page));
 }
Ejemplo n.º 3
0
 /**
  * Output a lock icon which also serves as a link to unlock a page (if the user has permission
  * to do this)
  *
  * @param  Array       menu item array for this lock
  * @param  DbUserModel user that is currently logged in
  * @return string
  */
 public function lockIcon($menu, DbUserModel $user)
 {
     if ($menu['locked']) {
         $user = new DbUserModel(array('dbUserID' => $menu['locked'], 'depth' => 'dbUser'));
         $title = "Currently locked by '{$this->h($user->dbUserFullName)}'.";
         if ($user->hasAccess('edit', $menu['page']) || $user->hasAccess('approve', $menu['page'])) {
             $title .= ' Click to unlock.';
             $html = $this->view->linkTo('#', $this->view->imageTag('icons/ffffff/lock_small.png', array('id' => $this->view->url(array('action' => 'unlock', 'id' => $menu['page']->pageID)), 'class' => 'inline lock tooltip', 'tooltip' => $title)));
         } else {
             $html = $this->view->imageTag('icons/ffffff/lock_small.png', array('class' => 'inline', 'title' => $title));
         }
     } else {
         $html = '';
     }
     return $html;
 }