Manager personas.
Inheritance: extends LoggedInUsersOnly, use trait Airship\Engine\Bolt\Orderable
Exemple #1
0
 /**
  * @route /
  */
 public function index()
 {
     if ($this->isLoggedIn()) {
         $this->storeLensVar('showmenu', true);
         $author_bp = $this->blueprint('Author');
         $announce_bp = $this->blueprint('Announcements');
         $blog_bp = $this->blueprint('Blog');
         $page_bp = $this->blueprint('CustomPages');
         if (IDE_HACKS) {
             $db = \Airship\get_database();
             $author_bp = new Author($db);
             $announce_bp = new Announcements($db);
             $blog_bp = new Blog($db);
             $page_bp = new CustomPages($db);
         }
         $this->lens('index', ['announcements' => $announce_bp->getForUser($this->getActiveUserId()), 'stats' => ['num_authors' => $author_bp->numAuthors(), 'num_comments' => $blog_bp->numComments(true), 'num_pages' => $page_bp->numCustomPages(true), 'num_posts' => $blog_bp->numPosts(true)], 'title' => \__('Dashboard')]);
     } else {
         $this->storeLensVar('showmenu', false);
         $this->lens('login');
     }
 }
Exemple #2
0
 /**
  * @route ajax/authors_save_photo
  */
 public function saveAuthorsPhoto()
 {
     $auth_bp = $this->blueprint('Author');
     if (IDE_HACKS) {
         $db = \Airship\get_database();
         $auth_bp = new Author($db);
     }
     $authorId = (int) $_POST['author'];
     if (!$this->isSuperUser()) {
         $authors = $auth_bp->getAuthorIdsForUser($this->getActiveUserId());
         if (!\in_array($authorId, $authors)) {
             \Airship\json_response(['status' => 'ERROR', 'message' => \__('You do not have permission to access this author\'s posts.')]);
         }
     }
     if (!\Airship\all_keys_exist(['cabin', 'context', 'author', 'filename'], $_POST)) {
         \Airship\json_response(['keys' => array_keys($_POST), 'status' => 'ERROR', 'message' => 'Insufficient parameters']);
     }
     $result = $auth_bp->savePhotoChoice($authorId, $_POST['context'], $_POST['cabin'], $_POST['filename']);
     if (!$result) {
         \Airship\json_response(['status' => 'ERROR', 'message' => 'Could not save photo choice.', 'photo' => null]);
     }
     \Airship\json_response(['status' => 'OK', 'message' => 'Saved!']);
 }