fetchViewLocation() public method

Fetches the location of a view into a string and returns it. Returns false on failure.
public fetchViewLocation ( string $View = '', boolean | string $ControllerName = false, boolean | string $ApplicationFolder = false, boolean $ThrowError = true, boolean $useController = true ) : string
$View string The name of the view to fetch. If not specified, it will use the value of $this->View. If $this->View is not specified, it will use the value of $this->RequestMethod (which is defined by the dispatcher class).
$ControllerName boolean | string The name of the controller that owns the view if it is not $this. - If the controller name is FALSE then the name of the current controller will be used. - If the controller name is an empty string then the view will be looked for in the base views folder.
$ApplicationFolder boolean | string The name of the application folder that contains the requested controller if it is not $this->ApplicationFolder.
$ThrowError boolean Whether to throw an error.
$useController boolean Whether to attach a controller to the view location. Some plugins have views that should not be looked up in a controller's view directory.
return string The resolved location of the view.
 /**
  * Get the file location of a view.
  *
  * @param string $View
  * @param bool $ControllerName
  * @param bool $ApplicationFolder
  * @param bool $ThrowError
  * @return bool|mixed
  * @throws Exception
  */
 public function fetchViewLocation($View = '', $ControllerName = false, $ApplicationFolder = false, $ThrowError = true)
 {
     if (!$ControllerName) {
         $ControllerName = '';
     }
     return parent::fetchViewLocation($View, $ControllerName, $ApplicationFolder, $ThrowError);
 }
Esempio n. 2
0
 /**
  * Get the file location of a view.
  *
  * @param string $view
  * @param bool $controllerName
  * @param bool $applicationFolder
  * @param bool $throwError
  * @param bool $useController
  * @return bool|mixed
  * @throws Exception
  */
 public function fetchViewLocation($view = '', $controllerName = false, $applicationFolder = false, $throwError = true, $useController = true)
 {
     if (!$controllerName) {
         $controllerName = '';
     }
     return parent::fetchViewLocation($view, $controllerName, $applicationFolder, $throwError, $useController);
 }
Esempio n. 3
0
 /**
  *
  *
  * @param Gdn_Controller $Controller
  * @param string $Type
  * @return void
  */
 protected function attachUploadsToComment($Controller, $Type = 'comment')
 {
     $RawType = ucfirst($Type);
     if (StringEndsWith($Controller->RequestMethod, 'Comment', true) && $Type != 'comment') {
         $Type = 'comment';
         $RawType = 'Comment';
         if (!isset($Controller->Comment)) {
             return;
         }
         $Controller->EventArguments['Comment'] = $Controller->Comment;
     }
     $MediaList = $this->mediaCache();
     if (!is_array($MediaList)) {
         return;
     }
     $Param = $Type == 'comment' ? 'CommentID' : 'DiscussionID';
     $MediaKey = $Type . '/' . val($Param, val($RawType, $Controller->EventArguments));
     if (array_key_exists($MediaKey, $MediaList)) {
         include_once $Controller->fetchViewLocation('fileupload_functions', '', 'plugins/FileUpload');
         $Controller->setData('CommentMediaList', $MediaList[$MediaKey]);
         $Controller->setData('GearImage', $this->getWebResource('images/gear.png'));
         $Controller->setData('Garbage', $this->getWebResource('images/trash.png'));
         $Controller->setData('CanDownload', $this->CanDownload);
         echo $Controller->fetchView($this->getView('link_files.php'));
     }
 }
Esempio n. 4
0
 /**
  * Checks if the user is previewing a theme and, if so, updates the default master view.
  *
  * @param Gdn_Controller $sender
  */
 public function base_beforeFetchMaster_handler($sender)
 {
     $session = Gdn::session();
     if (!$session->isValid()) {
         return;
     }
     if (isMobile()) {
         $theme = htmlspecialchars($session->getPreference('PreviewMobileThemeFolder', ''));
     } else {
         $theme = htmlspecialchars($session->getPreference('PreviewThemeFolder', ''));
     }
     $isDefaultMaster = $sender->MasterView == 'default' || $sender->MasterView == '';
     if ($theme != '' && $isDefaultMaster) {
         $htmlFile = paths(PATH_THEMES, $theme, 'views', 'default.master.tpl');
         if (file_exists($htmlFile)) {
             $sender->EventArguments['MasterViewPath'] = $htmlFile;
         } else {
             // for default theme
             $sender->EventArguments['MasterViewPath'] = $sender->fetchViewLocation('default.master', '', 'dashboard');
         }
     }
 }