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


PHP FileSet::save方法代码示例

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


在下文中一共展示了FileSet::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
				return $file_set;
			}			
		}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:40,代码来源:file_set.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');
     $file_set->fsOverrideGlobalPermissions = $this->post('fsOverrideGlobalPermissions') == 1 ? 1 : 0;
     $file_set->save();
     $file_set->resetPermissions();
     if ($file_set->fsOverrideGlobalPermissions == 1) {
         $p = $this->post();
         $fh = Loader::controller('/dashboard/files/access');
         $fh->setFileSetPermissions($file_set, $p);
     }
     $this->set('message', t('Changes Saved'));
     $this->view();
 }
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:28,代码来源:sets.php


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