本文整理汇总了PHP中FileSet::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP FileSet::getByID方法的具体用法?PHP FileSet::getByID怎么用?PHP FileSet::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSet
的用法示例。
在下文中一共展示了FileSet::getByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($itemsToGet = 0, $offset = 0) {
$r = parent::get($itemsToGet, $offset);
foreach($r as $row) {
$fs = FileSet::getByID($row['fsID']);
if (is_object($fs)) {
$this->sets[] = $fs;
}
}
return $this->sets;
}
示例2: view_detail
public function view_detail($fsID, $action = false) {
Loader::model('file_set');
$fs = FileSet::getByID($fsID);
$ph = Loader::controller('/dashboard/system/permissions/files');
$this->set('ph', $ph);
$this->set('fs', $fs);
if ($action == 'file_set_updated') {
$this->set('message', t('File set updated successfully.'));
}
$this->view();
}
示例3: view
public function view()
{
$fs = FileSet::getByID($this->fsID);
$fileList = new FileList();
$fileList->filterBySet($fs);
$fileList->filterByType(FileType::T_IMAGE);
$fileList->sortByFileSetDisplayOrder();
$images = $fileList->get(1000, 0);
$this->set('images', $images);
$this->set('picture', $this->getPicture());
}
示例4: loadFileSet
function loadFileSet(){
if (intval($this->fsID) < 1) {
return false;
}
Loader::helper('concrete/file');
Loader::model('file_attributes');
Loader::library('file/types');
Loader::model('file_list');
Loader::model('file_set');
$ak = FileAttributeKey::getByHandle('height');
$fs = FileSet::getByID($this->fsID);
$fileList = new FileList();
$fileList->filterBySet($fs);
$fileList->filterByType(FileType::T_IMAGE);
$fileList->sortByFileSetDisplayOrder();
$files = $fileList->get(1000,0);
$image = array();
$image['duration'] = $this->duration;
$image['fadeDuration'] = $this->fadeDuration;
$image['groupSet'] = 0;
$image['url'] = '';
$images = array();
$maxHeight = 0;
foreach ($files as $f) {
$fp = new Permissions($f);
if(!$fp->canViewFile()) { continue; }
$image['fID'] = $f->getFileID();
$image['fileName'] = $f->getFileName();
$image['fullFilePath'] = $f->getPath();
$image['url'] = $f->getRelativePath();
// find the max height of all the images so slideshow doesn't bounce around while rotating
$vo = $f->getAttributeValueObject($ak);
if (is_object($vo)) {
$image['imgHeight'] = $vo->getValue('height');
}
if ($maxHeight == 0 || $image['imgHeight'] > $maxHeight) {
$maxHeight = $image['imgHeight'];
}
$images[] = $image;
}
$this->images = $images;
}
示例5: getUnsortedPermittedFilesetImages
public static function getUnsortedPermittedFilesetImages($fsID)
{
Loader::model('file_set');
Loader::model('file_list');
$fsHasDisplayOrder = version_compare(APP_VERSION, '5.4.1', '>=');
$fs = FileSet::getByID($fsID);
$fl = new FileList();
$fl->filterBySet($fs);
$fl->filterByType(FileType::T_IMAGE);
if ($fsHasDisplayOrder) {
$fl->sortByFileSetDisplayOrder();
}
$all_files = $fl->get();
$permitted_files = array();
foreach ($all_files as $f) {
$fp = new Permissions($f);
if ($fp->canRead()) {
$permitted_files[] = $f;
}
}
return $permitted_files;
}
示例6: getPermittedFilesetImages
public static function getPermittedFilesetImages($fsID, $use_file_props_for_title_and_caption = false)
{
Loader::model('file_set');
Loader::model('file_list');
$fsHasDisplayOrder = version_compare(APP_VERSION, '5.4.1', '>=');
$fs = FileSet::getByID($fsID);
$fl = new FileList();
$fl->filterBySet($fs);
$fl->filterByType(FileType::T_IMAGE);
if ($fsHasDisplayOrder) {
$fl->sortByFileSetDisplayOrder();
}
$all_files = $fl->get();
$permitted_files = array();
foreach ($all_files as $f) {
$fp = new Permissions($f);
if ($fp->canRead()) {
$fv = $f->getRecentVersion();
$permitted_files[$f->fID] = array('file' => $f, 'fID' => $f->fID, 'position' => $fsHasDisplayOrder ? $f->fsDisplayOrder : 0, 'title' => $use_file_props_for_title_and_caption ? $fv->getTitle() : '', 'caption' => $use_file_props_for_title_and_caption ? $fv->getDescription() : '');
}
}
return $permitted_files;
}
示例7: migrateFileSetPermissions
protected function migrateFileSetPermissions()
{
$db = Loader::db();
$tables = $db->MetaTables();
if (!in_array('FileSetPermissions', $tables)) {
return false;
}
// permissions
$fpe = FileUploaderPermissionAccessEntity::getOrCreate();
$permissionMap = array('canRead' => array(PermissionKey::getByHandle('view_file_set_file')), 'canSearch' => array(PermissionKey::getByHandle('search_file_set')), 'canWrite' => array(PermissionKey::getByHandle('edit_file_set_file_properties'), PermissionKey::getByHandle('edit_file_set_file_contents'), PermissionKey::getByHandle('copy_file_set_files'), PermissionKey::getByHandle('delete_file_set_files')), 'canAdmin' => array(PermissionKey::getByHandle('edit_file_set_permissions'), PermissionKey::getByHandle('delete_file_set')));
$r = $db->Execute('select * from FileSetPermissions order by fsID asc');
while ($row = $r->FetchRow()) {
$pe = $this->migrateAccessEntity($row);
if (!$pe) {
continue;
}
if ($row['fsID'] > 0) {
$fs = FileSet::getByID($row['fsID']);
} else {
$fs = FileSet::getGlobal();
}
$permissions = $this->getFileSetPermissionsArray($row);
if (is_object($fs)) {
foreach ($permissions as $p => $accessType) {
if ($accessType == self::ACCESS_TYPE_MINE) {
$_pe = $fpe;
} else {
$_pe = $pe;
}
$permissionsToApply = $permissionMap[$p];
foreach ($permissionsToApply as $pko) {
$pko->setPermissionObject($fs);
$pt = $pko->getPermissionAssignmentObject();
$pa = $pko->getPermissionAccessObject();
if (!is_object($pa)) {
$pa = PermissionAccess::create($pko);
} else {
if ($pa->isPermissionAccessInUse()) {
$pa = $pa->duplicate();
}
}
$pa->addListItem($_pe, false, FileSetPermissionKey::ACCESS_TYPE_INCLUDE);
$pt->assignPermissionAccess($pa);
}
}
}
}
}
示例8: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
Loader::model("file_set");
if ($_REQUEST['fsID'] > 0) {
$fs = FileSet::getByID($_REQUEST['fsID']);
} else {
$fs = FileSet::getGlobal();
}
$fsp = new Permissions($fs);
if ($fsp->canEditFileSetPermissions()) {
Loader::element('permission/details/file_set', array("fileset" => $fs));
}
示例9: createAndGetSet
/**
* Creats a new fileset if set doesn't exists
*
* If we find a multiple groups with the same properties,
* we return an array containing each group
* @param string $fs_name
* @param int $fs_type
* @param int $fs_uid
* @return Mixed
*
* Dev Note: This will create duplicate sets with the same name if a set exists owned by another user!!!
*/
public static function createAndGetSet($fs_name, $fs_type, $fs_uid = false)
{
if (!$fs_uid) {
$u = new User();
$fs_uid = $u->uID;
}
$file_set = new FileSet();
$criteria = array($fs_name, $fs_type, $fs_uid);
$matched_sets = $file_set->Find('fsName=? AND fsType=? and uID=?', $criteria);
if (1 === count($matched_sets)) {
return $matched_sets[0];
} else {
if (1 < count($matched_sets)) {
return $matched_sets;
} else {
//AS: Adodb Active record is complaining a ?/value array mismatch unless
//we explicatly set the primary key ID field to null
$file_set->fsID = null;
$file_set->fsName = $fs_name;
$file_set->fsOverrideGlobalPermissions = 0;
$file_set->fsType = $fs_type;
$file_set->uID = $fs_uid;
$file_set->save();
$db = Loader::db();
$fsID = $db->Insert_Id();
$fs = FileSet::getByID($fsID);
Events::fire('on_file_set_add', $fs);
return $fs;
}
}
}
示例10: getFileSets
public function getFileSets() {
$db = Loader::db();
$fsIDs = $db->Execute("select fsID from FileSetFiles where fID = ?", array($this->getFileID()));
$filesets = array();
while ($row = $fsIDs->FetchRow()) {
$filesets[] = FileSet::getByID($row['fsID']);
}
return $filesets;
}
示例11: defined
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
$ih = Loader::helper('image');
$fs = FileSet::getByID($file_set);
$fsname = $fs->fsName;
?>
<?php
if ($enableTitle) {
echo '<h4>' . $fsname . '</h4>';
}
?>
<?php
if ($images !== false) {
?>
<ul class="clearing-thumbs" data-clearing>
<?php
foreach ($images as $image) {
$thumbnail = $ih->getThumbnail($image, $thumbnailWidth, $thumbnailHeight, true);
?>
<li>
<a class="th" title="<?php
echo $image->getTitle();
?>
" href="<?php
echo $image->getRelativePath();
?>
">
<img data-caption="<?php
示例12: view_detail
public function view_detail($fsID, $action = false)
{
Loader::model('file_set');
$fs = FileSet::getByID($fsID);
$ph = Loader::controller('/dashboard/files/access');
$this->set('ph', $ph);
$this->set('fs', $fs);
switch ($action) {
case 'file_set_order_saved':
$this->set('message', t('File set order updated.'));
break;
}
$this->view();
}
示例13: setupFilePermissions
protected function setupFilePermissions()
{
$u = new User();
if ($this->permissionLevel == false || $u->isSuperUser()) {
return false;
}
$accessEntities = $u->getUserAccessEntityObjects();
foreach ($accessEntities as $pae) {
$peIDs[] = $pae->getAccessEntityID();
}
$db = Loader::db();
// figure out which sets can read files in, not read files in, and read only my files in.
$fsIDs = $db->GetCol('select fsID from FileSets where fsOverrideGlobalPermissions = 1');
$viewableSets = array(-1);
$nonviewableSets = array(-1);
$myviewableSets = array(-1);
$owpae = FileUploaderPermissionAccessEntity::getOrCreate();
if (count($fsIDs) > 0) {
$pk = PermissionKey::getByHandle($this->permissionLevel);
foreach ($fsIDs as $fsID) {
$fs = FileSet::getByID($fsID);
$pk->setPermissionObject($fs);
$list = $pk->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities);
$list = PermissionDuration::filterByActive($list);
if (count($list) > 0) {
foreach ($list as $l) {
$pae = $l->getAccessEntityObject();
if ($pae->getAccessEntityID() == $owpae->getAccessEntityID()) {
$myviewableSets[] = $fs->getFileSetID();
} else {
if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
$viewableSets[] = $fs->getFileSetID();
}
if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) {
$nonviewableSets[] = $fs->getFileSetID();
}
}
}
} else {
$nonviewableSets[] = $fs->getFileSetID();
}
}
}
$fs = FileSet::getGlobal();
$fk = PermissionKey::getByHandle('search_file_set');
$fk->setPermissionObject($fs);
$accessEntities[] = $owpae;
$list = $fk->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
$pae = $l->getAccessEntityObject();
if ($pae->getAccessEntityID() == $owpae->getAccessEntityID()) {
$valid = 'mine';
} else {
if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
$valid = PermissionKey::ACCESS_TYPE_INCLUDE;
}
if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) {
$valid = PermissionKey::ACCESS_TYPE_EXCLUDE;
}
}
}
$uID = $u->isRegistered() ? $u->getUserID() : 0;
// This excludes all files found in sets where I may only read mine, and I did not upload the file
$this->filter(false, '(f.uID = ' . $uID . ' or (select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $myviewableSets) . ')) = 0)');
if ($valid == 'mine') {
// this means that we're only allowed to read files we've uploaded (unless, of course, those files are in previously covered sets)
$this->filter(false, '(f.uID = ' . $uID . ' or (select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $viewableSets) . ')) > 0)');
}
// this excludes all file that are found in sets that I can't find
$this->filter(false, '((select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $nonviewableSets) . ')) = 0)');
$uID = $u->isRegistered() ? $u->getUserID() : 0;
// This excludes all files found in sets where I may only read mine, and I did not upload the file
$this->filter(false, '(f.uID = ' . $uID . ' or (select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $myviewableSets) . ')) = 0)');
$db = Loader::db();
$vpvPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = \'view_file\'');
if ($this->permissionLevel == 'search_file_set') {
$vpPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = \'view_file_in_file_manager\'');
} else {
$vpPKID = $vpvPKID;
}
$pdIDs = $db->GetCol("select distinct pdID from FilePermissionAssignments fpa inner join PermissionAccessList pal on fpa.paID = pal.paID where pkID in (?, ?) and pdID > 0", array($vpPKID, $vpvPKID));
$activePDIDs = array();
if (count($pdIDs) > 0) {
// then we iterate through all of them and find any that are active RIGHT NOW
foreach ($pdIDs as $pdID) {
$pd = PermissionDuration::getByID($pdID);
if ($pd->isActive()) {
$activePDIDs[] = $pd->getPermissionDurationID();
}
}
}
$activePDIDs[] = 0;
// exclude files where its overridden but I don't have the ability to read
$this->filter(false, "(f.fOverrideSetPermissions = 0 or (select count(fID) from FilePermissionAssignments fpa inner join PermissionAccessList fpal on fpa.paID = fpal.paID where fpa.fID = f.fID and fpal.accessType = " . PermissionKey::ACCESS_TYPE_INCLUDE . " and fpal.pdID in (" . implode(',', $activePDIDs) . ") and fpal.peID in (" . implode(',', $peIDs) . ") and (if(fpal.peID = " . $owpae->getAccessEntityID() . " and f.uID <> " . $uID . ", false, true)) and (fpa.pkID = " . $vpPKID . ")) > 0)");
// exclude detail files where read is excluded
$this->filter(false, "f.fID not in (select ff.fID from Files ff inner join FilePermissionAssignments fpaExclude on ff.fID = fpaExclude.fID inner join PermissionAccessList palExclude on fpaExclude.paID = palExclude.paID where fOverrideSetPermissions = 1 and palExclude.accessType = " . PermissionKey::ACCESS_TYPE_EXCLUDE . " and palExclude.pdID in (" . implode(',', $activePDIDs) . ")\n\t\t\tand palExclude.peID in (" . implode(',', $peIDs) . ") and fpaExclude.pkID in (" . $vpPKID . "," . $vpvPKID . "))");
}
示例14: getFileSets
public function getFileSets() {
$db = Loader::db();
Loader::model('file_set');
$fsIDs = $db->Execute("select fsID from FileSetFiles where fID = ?", array($this->getFileID()));
$filesets = array();
foreach($fsIDs as $fsID) {
$filesets[] = FileSet::getByID($fsID);
}
return $filesets;
}
示例15: getBuildFileSets
protected function getBuildFileSets()
{
Loader::model('file_set');
Loader::model('file_list');
$pl = new MootoolsPluginList();
$rows = array();
$fsets = $this->getLoadFileSet();
foreach ($fsets as $key => $fsID) {
$fs = FileSet::getByID($fsID);
$name = $fs->getFileSetName();
$files = $pl->getMootoolsPluginFiles($fs);
$rows[$name] = $files;
}
return $rows;
}