本文整理匯總了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;
}