/** * Displays the application output in the canvas. * * @since 1.0 * @access public * @param int The user id that is currently being viewed. */ public function display($groupId = null, $docType = null) { $group = FD::group($groupId); // Only allow group members access here. if (!$group->isMember()) { return $this->redirect($group->getPermalink(false)); } // Load up the explorer library. $explorer = FD::explorer($group->id, SOCIAL_TYPE_GROUP); // Get total number of files that are already uploaded in the group $model = FD::model('Files'); $total = (int) $model->getTotalFiles($group->id, SOCIAL_TYPE_GROUP); $access = $group->getAccess(); $allowUpload = $access->get('files.max') == 0 || $total < $access->get('files.max') ? true : false; $uploadLimit = $access->get('files.maxsize'); $this->set('uploadLimit', $uploadLimit); $this->set('allowUpload', $allowUpload); $this->set('explorer', $explorer); $this->set('group', $group); echo parent::display('groups/default'); }
/** * Service Hook for explorer * * @since 1.3 * @access public * @param string * @return */ public function hook() { // Check for request forgeries FD::checkToken(); // Require the user to be logged in FD::requireLogin(); // Get the event object $uid = $this->input->get('uid', 0, 'int'); $type = $this->input->get('type', '', 'cmd'); // Load up the explorer library $explorer = FD::explorer($uid, $type); // Determine if the viewer can really view items if (!$explorer->hook('canViewItem')) { return $this->view->call(__FUNCTION__); } // Get the hook $hook = $this->input->get('hook', '', 'cmd'); // Get the result $result = $explorer->hook($hook); $exception = FD::exception('Folder retrieval successful', SOCIAL_MSG_SUCCESS); return $this->view->call(__FUNCTION__, $exception, $result); }
public function display($eventId = null, $docType = null) { // Load up the event $event = FD::event($eventId); // Only allow event members access here. if (!$event->getGuest()->isGuest()) { return $this->redirect($event->getPermalink(false)); } // Load up the explorer library. $explorer = FD::explorer($event->id, SOCIAL_TYPE_EVENT); // Get total number of files that are already uploaded in the event $model = FD::model('Files'); $total = (int) $model->getTotalFiles($event->id, SOCIAL_TYPE_EVENT); // Get the access object $access = $event->getAccess(); // Determines if the event exceeded their limits $allowUpload = $access->get('files.max') == 0 || $total < $access->get('files.max') ? true : false; $uploadLimit = $access->get('files.maxsize'); $this->set('uploadLimit', $uploadLimit); $this->set('allowUpload', $allowUpload); $this->set('explorer', $explorer); $this->set('event', $event); echo parent::display('events/default'); }
/** * Renders the file browser * * @since 1.2 * @access public * @param string * @return */ public function browser() { $ajax = FD::ajax(); $uid = JRequest::getInt('uid'); $type = JRequest::getCmd('type'); $url = JRequest::getVar('url'); // Load up the explorer library $explorer = FD::explorer($uid, $type); // We need to determine if the user is allowed to access if (!$explorer->hook('hasReadAccess')) { return $ajax->reject(); } $allowUpload = $explorer->hook('allowUpload'); $maxSize = $explorer->hook('getMaxSize'); $html = $explorer->render($url, array('allowUpload' => $allowUpload, 'uploadLimit' => $maxSize)); return $ajax->resolve($html); }
/** * Renders the file browser * * @since 1.2 * @access public * @param string * @return */ public function browser() { $ajax = FD::ajax(); $uid = JRequest::getInt('uid'); $type = JRequest::getCmd('type'); $url = JRequest::getVar('url'); $controllerName = $this->input->getString('controllerName'); // Load up the explorer library $explorer = FD::explorer($uid, $type); // We need to determine if the user is allowed to access if (!$explorer->hook('hasReadAccess')) { return $ajax->reject(); } $allowUpload = $explorer->hook('allowUpload'); $maxSize = $explorer->hook('getMaxSize'); $options = array('allowUpload' => $allowUpload, 'uploadLimit' => $maxSize); if (!empty($controllerName)) { $options['controllerName'] = $controllerName; } $html = $explorer->render($url, $options); return $ajax->resolve($html); }