本文整理汇总了PHP中OOMedia::getMediaById方法的典型用法代码示例。如果您正苦于以下问题:PHP OOMedia::getMediaById方法的具体用法?PHP OOMedia::getMediaById怎么用?PHP OOMedia::getMediaById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OOMedia
的用法示例。
在下文中一共展示了OOMedia::getMediaById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFiles
/**
* @access public
*/
function getFiles()
{
if ($this->_files === null) {
$this->_files = array();
$qry = 'SELECT file_id FROM ' . OOMedia::_getTableName() . ' WHERE category_id = ' . $this->getId();
$sql = new rex_sql();
$sql->setQuery($qry);
$result = $sql->getArray();
if (is_array($result)) {
foreach ($result as $line) {
$this->_files[] =& OOMedia::getMediaById($line['file_id']);
}
}
}
return $this->_files;
}
示例2: rex_register_extension_point
<input class="rex-form-submit" type="submit" value="' . $I18N->msg('pool_search') . '" />
</p>
</div>
</noscript>';
}
$cat_out .= ' </div>
</fieldset>
</form>
</div>
';
// ----- EXTENSION POINT
$cat_out = rex_register_extension_point('MEDIA_LIST_TOOLBAR', $cat_out, array('subpage' => $subpage, 'category_id' => $rex_file_category));
// *************************************** Subpage: Detail
if ($subpage == 'detail' && rex_post('btn_delete', 'string')) {
// TODO: getMediaById() deprecated, daher getMediaByFileName() nutzen
$media = OOMedia::getMediaById($file_id);
if ($media) {
$file_name = $media->getFileName();
if ($PERMALL || $REX['USER']->hasPerm('media[' . $media->getCategoryId() . ']')) {
$uses = $media->isInUse();
if ($uses === false) {
if ($media->delete() !== FALSE) {
$info = $I18N->msg('pool_file_deleted');
} else {
$warning = $I18N->msg('pool_file_delete_error_1', $file_name);
}
$subpage = "";
} else {
$warning = array();
$warning[] = '<strong>' . $I18N->msg('pool_file_delete_error_1', $file_name) . ' ' . $I18N->msg('pool_file_delete_error_2') . '</strong><br />';
foreach ($uses as $use) {
示例3: getMediaByFileName
/**
* @access public
*/
function getMediaByFileName($name)
{
$query = 'SELECT file_id FROM ' . OOMedia::_getTableName() . ' WHERE filename = "' . $name . '"';
$sql = new rex_sql();
$result = $sql->getArray($query);
if (is_array($result)) {
foreach ($result as $line) {
return OOMedia::getMediaById($line['file_id']);
}
}
return null;
}
示例4: searchMediaByFileName
/**
* @access public
*/
function searchMediaByFileName($name)
{
$query = 'SELECT file_id FROM ' . OOMedia::_getTableName() . ' WHERE filename = "' . addslashes($name) . '"';
$sql = new sql();
$result = $sql->get_array($query);
$media = array();
foreach ($result as $line) {
$media[] = OOMedia::getMediaById($line['file_id']);
}
return $media;
}