本文整理汇总了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');
}
示例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;
}
}
示例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();
}