Example #1
0
 /**
  *@return string
  *@desc Return the Path Suggested from XMLNuke Context. This path uses the FilenameType enum.
  */
 public function PathSuggested()
 {
     switch ($this->_filenameLocation) {
         case ForceFilenameLocation::PathFromRoot:
             $path = $this->_context->SharedRootPath();
             break;
         case ForceFilenameLocation::UseWhereExists:
             // Test:
             // - If File in PrivatePath exists (this is the first option!!)
             // - If file in SharedPath exists (this is the second option!!)
             // - Otherwise references
             $path = null;
             $pvtPath = $this->PrivatePath();
             $pathAlt = null;
             if (!is_array($pvtPath)) {
                 $pvtPath = array($pvtPath);
             }
             foreach ($pvtPath as $pathSuggested) {
                 if (FileUtil::Exists($pathSuggested . $this->FullQualifiedName())) {
                     return $pathSuggested;
                 }
                 if ($pathAlt == null) {
                     $pathAlt = $pathSuggested;
                 }
             }
             if (empty($path) && FileUtil::Exists($this->SharedPath() . $this->FullQualifiedName())) {
                 $path = $this->SharedPath();
             } else {
                 $path = $pathAlt;
             }
             break;
         case ForceFilenameLocation::PrivatePath:
             $pathTmp = $this->PrivatePath();
             if (is_array($pathTmp)) {
                 $path = array_shift($pathTmp);
             } else {
                 $path = $pathTmp;
             }
             break;
         case ForceFilenameLocation::SharedPath:
             $path = $this->SharedPath();
             //				Debug::PrintValue("Shared: ".$path);
             break;
         case ForceFilenameLocation::DefinePath:
             $path = $this->_path;
             //				Debug::PrintValue("Define: ".$path);
             break;
     }
     return $path;
 }