Exemplo n.º 1
0
 /**
  * Get item properties
  *
  * @return	array		array of property arrays:
  *						"alert" (boolean) => display as an alert property (usually in red)
  *						"property" (string) => property name
  *						"value" (string) => property value
  */
 function getProperties()
 {
     global $lng, $ilUser;
     // BEGIN WebDAV: Get parent properties
     $props = parent::getProperties();
     // END WebDAV: Get parent properties
     // to do: implement extra smaller file info object
     include_once "./Modules/File/classes/class.ilObjFileAccess.php";
     // Display a warning if a file is not a hidden Unix file, and
     // the filename extension is missing
     if (!preg_match('/^\\.|\\.[a-zA-Z0-9]+$/', $this->title)) {
         $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_extension_missing"), 'propertyNameVisible' => false);
     }
     // BEGIN WebDAV: Only display relevant information.
     $props[] = array("alert" => false, "property" => $lng->txt("type"), "value" => ilObjFileAccess::_getFileExtension($this->title), 'propertyNameVisible' => false);
     $fileData = ilObjFileAccess::getListGUIData($this->obj_id);
     if (is_array($fileData)) {
         $props[] = array("alert" => false, "property" => $lng->txt("size"), "value" => ilFormat::formatSize($fileData['size'], 'short'), 'propertyNameVisible' => false);
         $version = $fileData['version'];
         if ($version > 1) {
             // add versions link
             if (parent::checkCommandAccess("write", "versions", $this->ref_id, $this->type)) {
                 $link = $this->getCommandLink("versions");
                 $value = "<a href=\"{$link}\">" . $lng->txt("version") . ": {$version}</a>";
             } else {
                 $value = $lng->txt("version") . ": {$version}";
             }
             $props[] = array("alert" => false, "property" => $lng->txt("version"), "value" => $value, "propertyNameVisible" => false);
         }
         // #6040
         if ($fileData["date"]) {
             $props[] = array("alert" => false, "property" => $lng->txt("last_update"), "value" => ilDatePresentation::formatDate(new ilDateTime($fileData["date"], IL_CAL_DATETIME)), 'propertyNameVisible' => false);
         }
     }
     // END WebDAV: Only display relevant information.
     return $props;
 }