public function execute()
 {
     $count = 10;
     $offset = waRequest::post('offset', 0, waRequest::TYPE_INT);
     $comment_model = new photosCommentModel();
     $comments = $comment_model->getList(array('author' => true, 'crop' => true, 'reply_to' => true), $offset, $count);
     $this->view->assign('comments_author', photosCommentModel::getAuthorInfo(wa()->getUser()->getId()));
     $this->view->assign('comments', $comments);
     $this->view->assign('contact_rights', wa()->getUser()->getRights('contacts', 'backend'));
     // get and send to view sidebar counters for updating
     $plugin = wa()->getPlugin('comments');
     $plugin->sidebarCounters();
 }
コード例 #2
0
 public function frontendPhoto($photo)
 {
     $this->view = $this->view();
     $photo_model = new photosPhotoModel();
     $photo_id = $photo['id'];
     if ($parent_id = $photo_model->getStackParentId($photo)) {
         $photo_id = $parent_id;
     }
     $comments = $this->comment()->getFullTree($photo_id, array('author' => true));
     $storage = wa()->getStorage();
     $adapters = array();
     $current_auth = null;
     $current_auth_source = null;
     $user = wa()->getUser();
     if ($user->isAuth()) {
         $comment_author = photosCommentModel::getAuthorInfo($user->getId(), photosCommentModel::BIG_AUTHOR_PHOTO_SIZE);
         $storage->del('auth_user_data');
         $this->view->assign('comment_author', $comment_author);
     } else {
         $current_auth = $storage->read('auth_user_data');
         $adapters = wa()->getAuthAdapters();
         if (!$adapters && $current_auth) {
             $current_auth = null;
             $storage->del('auth_user_data');
         }
         $current_auth_source = $current_auth ? $current_auth['source'] : null;
         $this->view->assign('comment_author', null);
     }
     $app_url = wa()->getAppStaticUrl();
     $this->view->assign('current_auth_source', $current_auth_source);
     $this->view->assign('current_auth', $current_auth);
     $this->view->assign('auth_adapters', $adapters);
     $this->view->assign('require_authorization', $this->getSettings('require_authorization'));
     $this->view->assign('comments', $comments);
     $this->view->assign('photo_id', $photo_id);
     return array('bottom' => $this->view()->fetch($this->path . '/templates/FrontendPhoto.html'));
 }