当前位置: 首页>>代码示例>>PHP>>正文


PHP FileSet类代码示例

本文整理汇总了PHP中FileSet的典型用法代码示例。如果您正苦于以下问题:PHP FileSet类的具体用法?PHP FileSet怎么用?PHP FileSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FileSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: do_add

 public function do_add()
 {
     extract($this->getHelperObjects());
     Loader::model('file_set');
     if (!$validation_token->validate("file_sets_add")) {
         $this->set('error', array($validation_token->getErrorMessage()));
         return;
     }
     if (!trim($this->post('file_set_name'))) {
         $this->set('error', array(t('Please Enter a Name')));
         return;
     }
     $setName = trim($this->post('file_set_name'));
     if (preg_match('/[<>;{}?"`]/i', $setName)) {
         $this->set('error', array(t('File Set Name cannot contain the characters: %s', Loader::helper('text')->entities('<>;{}?"`'))));
         return;
     }
     //print('<pre>');print_r(get_included_files());print('</pre>');
     $u = new User();
     $file_set = new FileSet();
     //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 = $setName;
     $file_set->fsType = FileSet::TYPE_PUBLIC;
     $file_set->uID = $u->getUserID();
     $file_set->fsOverrideGlobalPermissions = $this->post('fsOverrideGlobalPermissions') == 1 ? 1 : 0;
     $file_set->save();
     $this->redirect('/dashboard/files/sets', 'file_set_added');
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:30,代码来源:add_set.php

示例2: schemaConfiguration

 protected function schemaConfiguration(Task $task)
 {
     // Adds schema(s) to task
     foreach ($this->schemas as $pair) {
         $fileSet = new FileSet();
         $fileSet->setDir($pair[0]);
         $fileSet->setIncludes($pair[1]);
         $task->addSchemaFileset($fileSet);
     }
     // Sets up output dir, for class, SQL or conf output
     $task->setOutputDirectory(new PhingFile($this->outputDir));
 }
开发者ID:halfer,项目名称:Meshing,代码行数:12,代码来源:SchemaTask.php

示例3: file_sets_edit

	public function file_sets_edit(){
		extract($this->getHelperObjects());
		Loader::model('file_set');
		//do my editing
		if (!$validation_token->validate("file_sets_edit")) {			
			$this->set('error', array($validation_token->getErrorMessage()));
			$this->view();
			return;
		}
		
		if(!$this->post('fsID')){
			$this->set('error', array(t('Invalid ID')));
			$this->view();			
		}

		$file_set = new FileSet();
		$file_set->Load('fsID = ?', $this->post('fsID'));		
		$file_set->fsName = $this->post('file_set_name');
		$copyPermissionsFromBase = false;
		if ($file_set->fsOverrideGlobalPermissions == 0 && $this->post('fsOverrideGlobalPermissions') == 1) {
			// we are checking the checkbox for the first time
			$copyPermissionsFromBase = true;
		}		
		if ($file_set->fsOverrideGlobalPermissions) {
			$permissions = PermissionKey::getList('file_set');
			foreach($permissions as $pk) {
				$pk->setPermissionObject($file_set);
				$pt = $pk->getPermissionAssignmentObject();
				$paID = $_POST['pkID'][$pk->getPermissionKeyID()];
				$pt->clearPermissionAssignment();
				if ($paID > 0) {
					$pa = PermissionAccess::getByID($paID, $pk);
					if (is_object($pa)) {
						$pt->assignPermissionAccess($pa);
					}			
				}		
			}			
		}
		$file_set->fsOverrideGlobalPermissions = ($this->post('fsOverrideGlobalPermissions') == 1) ? 1 : 0;
		$file_set->save();
		
		parse_str($this->post('fsDisplayOrder'));
		$file_set->updateFileSetDisplayOrder($fID);

		if ($file_set->fsOverrideGlobalPermissions == 0) {
			$file_set->resetPermissions();		
		} 		
		if ($copyPermissionsFromBase) {
			$file_set->acquireBaseFileSetPermissions();
		}

		$this->redirect("/dashboard/files/sets", 'view_detail', $this->post('fsID'), 'file_set_updated');
	}
开发者ID:nveid,项目名称:concrete5,代码行数:53,代码来源:sets.php

示例4: save

 public function save()
 {
     if (Loader::helper('validation/token')->validate('save_permissions')) {
         $fs = FileSet::getGlobal();
         $tp = new TaskPermission();
         if ($tp->canAccessTaskPermissions()) {
             $permissions = PermissionKey::getList('file_set');
             foreach ($permissions as $pk) {
                 $pk->setPermissionObject($fs);
                 $paID = $_POST['pkID'][$pk->getPermissionKeyID()];
                 $pt = $pk->getPermissionAssignmentObject();
                 $pt->clearPermissionAssignment();
                 if ($paID > 0) {
                     $pa = PermissionAccess::getByID($paID, $pk);
                     if (is_object($pa)) {
                         $pt->assignPermissionAccess($pa);
                     }
                 }
             }
             $this->redirect('/dashboard/system/permissions/files', 'updated');
         }
     } else {
         $this->error->add(Loader::helper("validation/token")->getErrorMessage());
     }
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:25,代码来源:files.php

示例5: on_start

 public function on_start()
 {
     Events::extend('on_file_add', function ($f, $fv) {
         $setless_fs = FileSet::getByName('Setless');
         $setless_fs->addFileToSet($f);
     });
     Events::extend('on_file_added_to_set', function ($fID, $fv) {
         $setless_fs = FileSet::getByName('Setless');
         $file = File::getByID($fID);
         $file_sets = $file->getFileSets();
         $file_set_ids = array();
         foreach ($file_sets as $file_set) {
             $file_set_ids[] = $file_set->fsID;
         }
         // If file is in multiple sets and setless is one of them, remove from setless
         if (count($file_set_ids) >= 2 && in_array($setless_fs->fsID, $file_set_ids)) {
             $setless_fs->removeFileFromSet($file);
         }
     });
     Events::extend('on_file_removed_from_set', function ($fID, $fv) {
         $setless_fs = FileSet::getByName('Setless');
         $file = File::getByID($fID);
         $file_sets = $file->getFileSets();
         // If file is no longer in any sets, add to setless
         if (count($file_sets) == 0) {
             $setless_fs->addFileToSet($file);
         }
     });
 }
开发者ID:bluefractals,项目名称:mr_setless_files,代码行数:29,代码来源:controller.php

示例6: addFilesForProduct

 public static function addFilesForProduct(array $files, StoreProduct $product)
 {
     self::removeFilesForProduct($product);
     //add new ones.
     if (!empty($files['dffID'])) {
         foreach ($files['dffID'] as $fileID) {
             if (!empty($fileID) && $fileID > 0) {
                 self::add($product->getProductID(), $fileID);
                 $fileObj = \File::getByID($fileID);
                 $fs = \FileSet::getByName("Digital Downloads");
                 $fs->addFileToSet($fileObj);
                 $fileObj->resetPermissions(1);
                 $pk = \Concrete\Core\Permission\Key\FileKey::getByHandle('view_file');
                 $pk->setPermissionObject($fileObj);
                 $pao = $pk->getPermissionAssignmentObject();
                 $groupEntity = \Concrete\Core\Permission\Access\Entity\GroupEntity::getOrCreate(\Group::getByID(GUEST_GROUP_ID));
                 $pa = $pk->getPermissionAccessObject();
                 if ($pa) {
                     $pa->removeListItem($groupEntity);
                     $pao->assignPermissionAccess($pa);
                 }
             }
         }
     }
 }
开发者ID:vividweb,项目名称:vivid_store,代码行数:25,代码来源:ProductFile.php

示例7: main

 /**
  * Reads the corresponding actions and templates of the cronk (if any) from cronk.xml
  * and creates two references "cronkTemplate" and "cronkAction" which can be used to access these files
  */
 public function main()
 {
     $templates = array();
     $actionPath = "";
     $action = null;
     $module = null;
     $cronkName = $this->project->getUserProperty("cronkName");
     // Setup and load the DOM of the cronk
     $DOM = new DOMDocument("1.0", "UTF-8");
     $DOM->load($this->getFile());
     $DOMSearcher = new DOMXPath($DOM);
     $DOMSearcher->registerNamespace("default", "http://agavi.org/agavi/1.0/config");
     $DOMSearcher->registerNamespace("ae", "http://agavi.org/agavi/config/global/envelope/1.0");
     $cronkTemplates = $DOMSearcher->query("//ae:parameter[@name='" . $cronkName . "']//ae:parameter[@name='template']");
     if ($cronkTemplates->length > 0) {
         foreach ($cronkTemplates as $template) {
             $templates[] = $template->nodeValue;
         }
     }
     // fetch action and module
     $action = $DOMSearcher->query("//ae:parameter[@name='" . $cronkName . "']//ae:parameter[@name='action']")->item(0);
     $module = $DOMSearcher->query("//ae:parameter[@name='" . $cronkName . "']//ae:parameter[@name='module']")->item(0);
     $actionName = str_replace(".", "/", $action->nodeValue);
     // add agavi action,validation, view and templates
     $cronkFS = new FileSet();
     $cronkFS->setDir($this->project->getUserProperty("PATH_Icinga") . "/app/modules/" . $module->nodeValue);
     $cronkIncludes = "actions/" . $actionName . "Action.class.php";
     $cronkIncludes .= ",templates/" . $actionName . "*.class.php";
     $cronkIncludes .= ",validate/" . $actionName . ".xml";
     $cronkIncludes .= ",views/" . $actionName . "*.class.php";
     $cronkFS->setIncludes($cronkIncludes);
     // add templates
     $templateFs = new FileSet();
     $templateFs->setDir($this->project->getUserProperty("PATH_Icinga") . "/app/modules/Cronks/data/xml/");
     $includes = "";
     $first = true;
     foreach ($templates as $template) {
         $includes .= ($first ? '' : ',') . $template . ".xml";
     }
     // export to phing
     $templateFs->setIncludes($includes);
     $this->project->addReference("cronkTemplates", $templateFs);
     $this->project->addReference("cronkAction", $cronkFS);
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:48,代码来源:cronkMetaExtractorTask.php

示例8: setPermissionObject

 public function setPermissionObject(FileSet $fs)
 {
     $this->permissionObject = $fs;
     if ($fs->overrideGlobalPermissions()) {
         $this->permissionObjectToCheck = $fs;
     } else {
         $fs = FileSet::getGlobal();
         $this->permissionObjectToCheck = $fs;
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:10,代码来源:file_set.php

示例9: __construct

 public function __construct()
 {
     $fp = new Permissions(\FileSet::getGlobal());
     $tp = new Permissions();
     $this->assets = ResponseAssetGroup::get();
     $this->token = Core::make("token")->generate('editor');
     $this->setAllowFileManager($fp->canAccessFileManager());
     $this->setAllowSitemap($tp->canAccessSitemap());
     $this->pluginManager = new PluginManager();
     $this->pluginManager->selectMultiple(\Package::getByHandle('community_ckeditor')->getConfig()->get('plugins', array()));
 }
开发者ID:MrKarlDilkington,项目名称:Concrete5-CKEditor,代码行数:11,代码来源:CKEditor.php

示例10: 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());
 }
开发者ID:robchenski,项目名称:ids,代码行数:11,代码来源:controller.php

示例11: 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;
	
	}
开发者ID:nveid,项目名称:concrete5,代码行数:49,代码来源:slideshow.php

示例12: filterBySet

	public function filterBySet($fs) {
		if ($fs != false) {
			$this->filteredFileSetIDs[] = intval($fs->getFileSetID());
		} else {
			$s1 = FileSet::getMySets();
			$sets = array();
			foreach($s1 as $fs) {
				$sets[] = $fs->getFileSetID();
			}
			if (count($sets) == 0) {
				return false;
			}
			$db = Loader::db();
			$setStr = implode(',', $sets);
			$this->addToQuery("left join FileSetFiles fsfex on fsfex.fID = f.fID");
			$this->filter(false, '(fsfex.fID is null or (select count(fID) from FileSetFiles where fID = fsfex.fID and fsID in (' . $setStr . ')) = 0)');
		}
	}
开发者ID:notzen,项目名称:concrete5,代码行数:18,代码来源:file_list.php

示例13: setPermissionObject

 public function setPermissionObject(File $f)
 {
     $this->permissionObject = $f;
     if ($f->overrideFileSetPermissions()) {
         $this->permissionObjectToCheck = $f;
     } else {
         $sets = $f->getFileSets();
         $permsets = array();
         foreach ($sets as $fs) {
             if ($fs->overrideGlobalPermissions()) {
                 $permsets[] = $fs;
             }
         }
         if (count($permsets) > 0) {
             $this->permissionObjectToCheck = $permsets;
         } else {
             $fs = FileSet::getGlobal();
             $this->permissionObjectToCheck = $fs;
         }
     }
 }
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:21,代码来源:file.php

示例14: 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;
 }
开发者ID:madmarker,项目名称:creatureslab,代码行数:22,代码来源:sortable_fancybox_gallery.php

示例15: 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;
 }
开发者ID:robchenski,项目名称:ids,代码行数:23,代码来源:deluxe_image_gallery.php


注:本文中的FileSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。