本文整理汇总了PHP中ilObjFile::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjFile::getTitle方法的具体用法?PHP ilObjFile::getTitle怎么用?PHP ilObjFile::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjFile
的用法示例。
在下文中一共展示了ilObjFile::getTitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
function start()
{
$this->__buildHeader();
$attribs = array("obj_id" => "il_" . IL_INST_ID . "_file_" . $this->file->getId(), "version" => $this->file->getVersion(), "size" => $this->file->getFileSize(), "type" => $this->file->getFileType());
$this->xmlStartTag("File", $attribs);
$this->xmlElement("Filename", null, $this->file->getFileName());
$this->xmlElement("Title", null, $this->file->getTitle());
$this->xmlElement("Description", null, $this->file->getDescription());
$this->xmlElement("Rating", null, (int) $this->file->hasRating());
if ($this->attachFileContents) {
$filename = $this->file->getDirectory($this->file->getVersion()) . "/" . $this->file->getFileName();
if (@is_file($filename)) {
if ($this->attachFileContents == ilFileXMLWriter::$CONTENT_ATTACH_COPY) {
$attribs = array("mode" => "COPY");
copy($filename, $this->target_dir_absolute . "/" . $this->file->getFileName());
$content = $this->target_dir_relative . "/" . $this->file->getFileName();
$this->xmlElement("Content", $attribs, $content);
} elseif ($this->attachFileContents == ilFileXMLWriter::$CONTENT_ATTACH_REST) {
$attribs = array('mode' => "REST");
include_once './Services/WebServices/Rest/classes/class.ilRestFileStorage.php';
$fs = new ilRestFileStorage();
$tmpname = $fs->storeFileForRest(base64_encode(@file_get_contents($filename)));
$this->xmlElement("Content", $attribs, $tmpname);
} else {
$content = @file_get_contents($filename);
$attribs = array("mode" => "PLAIN");
if ($this->attachFileContents == ilFileXMLWriter::$CONTENT_ATTACH_ZLIB_ENCODED) {
$attribs["mode"] = "ZLIB";
$content = @gzcompress($content, 9);
} elseif ($this->attachFileContents == ilFileXMLWriter::$CONTENT_ATTACH_GZIP_ENCODED) {
$attribs["mode"] = "GZIP";
$content = @gzencode($content, 9);
}
$content = base64_encode($content);
$this->xmlElement("Content", $attribs, $content);
}
}
}
include_once "./Services/History/classes/class.ilHistory.php";
$versions = ilHistory::_getEntriesForObject($this->file->getId(), $this->file->getType());
if (count($versions)) {
$this->xmlStartTag("Versions");
foreach ($versions as $version) {
$info_params = $version["info_params"];
list($filename, $history_id) = split(",", $info_params);
$attribs = array("id" => $history_id, "date" => ilUtil::date_mysql2time($version["date"]), "usr_id" => "il_" . IL_INST_ID . "_usr_" . $version["user_id"]);
$this->xmlElement("Version", $attribs);
}
$this->xmlEndTag("Versions");
}
$this->xmlEndTag("File");
$this->__buildFooter();
return true;
}
示例2: sendFile
/**
* send File to User
*/
public function sendFile()
{
global $ilAccess;
//need read access to receive file
if ($ilAccess->checkAccess("read", "", $this->parent_obj->ref_id)) {
$rec_id = $_GET['record_id'];
$record = ilDataCollectionCache::getRecordCache($rec_id);
$field_id = $_GET['field_id'];
$file_obj = new ilObjFile($record->getRecordFieldValue($field_id), false);
if (!$this->recordBelongsToCollection($record, $this->parent_obj->ref_id)) {
return;
}
ilUtil::deliverFile($file_obj->getFile(), $file_obj->getTitle());
}
}
示例3: passThroughFilter
static function passThroughFilter(ilDataCollectionRecord $record, ilDataCollectionField $field, $filter)
{
$pass = false;
$type_id = $field->getDatatypeId();
$value = $record->getRecordFieldValue($field->getId());
switch ($type_id) {
case ilDataCollectionDatatype::INPUTFORMAT_TEXT:
if (!$filter || strpos(strtolower($value), strtolower($filter)) !== false) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_NUMBER:
if ((!$filter['from'] || $value >= $filter['from']) && (!$filter['to'] || $value <= $filter['to'])) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN:
if ($filter == "checked" && $value == 1 || $filter == "not_checked" && $value == 0 || $filter == '' || !$filter) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_DATETIME:
if ((!$filter['from'] || $value >= $filter['from']) && (!$filter['to'] || $value <= $filter['to'])) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_FILE:
if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
$pass = true;
break;
}
$file_obj = new ilObjFile($value, false);
$file_name = $file_obj->getTitle();
if (!$filter || strpos(strtolower($file_name), strtolower($filter)) !== false) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_REFERENCE:
$props = $field->getProperties();
if ($filter && $props[ilDataCollectionField::PROPERTYID_N_REFERENCE] && is_array($value) && in_array($filter, $value)) {
$pass = true;
}
if (!$filter || $filter == $value) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_RATING:
if (!$filter || $filter <= $value['avg']) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_ILIAS_REF:
$obj_id = ilObject::_lookupObjId($value);
if (!$filter || strpos(strtolower(ilObject::_lookupTitle($obj_id)), strtolower($filter)) !== false) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_MOB:
$m_obj = new ilObjMediaObject($value, false);
$file_name = $m_obj->getTitle();
if (!$filter || strpos(strtolower($file_name), strtolower($filter)) !== false) {
$pass = true;
}
break;
}
//for the fields owner and last edit by, we check the name, not the ID
if (($field->getId() == "owner" || $field->getId() == "last_edit_by") && $filter) {
$pass = false;
$user = new ilObjUser($value);
if (strpos($user->getFullname(), $filter) !== false) {
$pass = true;
}
}
return $pass;
}
示例4: parseSortingValue
/**
* @param $value
* @param ilDataCollectionRecordField $record_field
* @param bool|true $link
* @return int|string
*/
public function parseSortingValue($value, ilDataCollectionRecordField $record_field, $link = true)
{
switch ($this->id) {
case self::INPUTFORMAT_DATETIME:
return strtotime($value);
case self::INPUTFORMAT_FILE:
if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
return '';
}
$file_obj = new ilObjFile($value, false);
return $file_obj->getTitle();
case self::INPUTFORMAT_MOB:
$mob = new ilObjMediaObject($value, false);
return $mob->getTitle();
case ilDataCollectionDatatype::INPUTFORMAT_TEXT:
$arr_properties = $record_field->getField()->getProperties();
if ($arr_properties[ilDataCollectionField::PROPERTYID_URL]) {
if ($json = json_decode($value)) {
return $json->title ? $json->title : $json->link;
} else {
return $value;
}
} else {
return $value;
}
default:
return $value;
}
}