本文整理汇总了PHP中Editor::GetRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP Editor::GetRecord方法的具体用法?PHP Editor::GetRecord怎么用?PHP Editor::GetRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Editor
的用法示例。
在下文中一共展示了Editor::GetRecord方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: principal_editor
function principal_editor()
{
global $c, $id, $can_write_principal, $session;
$editor = new Editor(translate('Principal'), 'dav_principal');
$editor->SetLookup('date_format_type', "SELECT 'E', 'European' UNION SELECT 'U', 'US Format' UNION SELECT 'I', 'ISO Format'");
$editor->SetLookup('type_id', 'SELECT principal_type_id, principal_type_desc FROM principal_type ORDER BY principal_type_id');
$editor->SetLookup('locale', 'SELECT \'\', \'' . translate("*** Default Locale ***") . '\' UNION SELECT locale, locale_name_locale FROM supported_locales ORDER BY 1 ASC');
$editor->AddAttribute('locale', 'title', translate("The preferred language for this person."));
$editor->AddAttribute('fullname', 'title', translate("The full name for this person, group or other type of principal."));
$editor->SetWhere('principal_id=' . $id);
$editor->AddField('is_admin', 'EXISTS( SELECT 1 FROM role_member WHERE role_no = 1 AND role_member.user_no = dav_principal.user_no )');
$editor->AddAttribute('is_admin', 'title', translate('An "Administrator" user has full rights to the whole DAViCal System'));
$post_values = false;
if (isset($_POST['xxxxusername'])) {
$_POST['xxxxusername'] = trim(str_replace('/', '', $_POST['xxxxusername']));
if ($_POST['xxxxusername'] == '') {
$c->messages[] = i18n("The username must not be blank, and may not contain a slash");
$can_write_principal = false;
}
}
if (isset($_POST['fullname']) && trim($_POST['fullname']) == '') {
$c->messages[] = i18n("The full name must not be blank.");
$can_write_principal = false;
}
if (isset($_POST['email']) && trim($_POST['email']) == '') {
$c->messages[] = i18n("The email address really should not be blank.");
}
$pwstars = '@@@@@@@@@@';
if ($can_write_principal && $editor->IsSubmit()) {
$editor->WhereNewRecord("principal_id=(SELECT CURRVAL('dav_id_seq'))");
if (!$session->AllowedTo('Admin')) {
unset($_POST['admin_role']);
unset($_POST['user_active']);
}
unset($_POST['password']);
if ($_POST['newpass1'] != '' && $_POST['newpass1'] != $pwstars) {
if ($_POST['newpass1'] == $_POST['newpass2']) {
$_POST['password'] = $_POST['newpass1'];
} else {
$c->messages[] = "Password not updated. The supplied passwords do not match.";
}
}
if (isset($_POST['fullname']) && !isset($_POST['displayname'])) {
$_POST['displayname'] = $_POST['fullname'];
}
if (isset($_POST['default_privileges'])) {
$privilege_bitpos = array_flip($privilege_names);
$priv_names = array_keys($_POST['default_privileges']);
$privs = privilege_to_bits($priv_names);
$_POST['default_privileges'] = sprintf('%024s', decbin($privs));
$editor->Assign('default_privileges', $privs_dec);
}
if ($editor->IsCreate()) {
$c->messages[] = i18n("Creating new Principal record.");
} else {
$c->messages[] = i18n("Updating Principal record.");
}
$editor->Write();
if ($_POST['type_id'] != 3 && $editor->IsCreate()) {
/** We only add the default calendar if it isn't a group, and this is a create action */
require_once 'auth-functions.php';
CreateHomeCollections($editor->Value('username'));
}
if ($session->AllowedTo('Admin')) {
if ($_POST['is_admin'] == 'on') {
$sql = 'INSERT INTO role_member (role_no, user_no) SELECT 1, dav_principal.user_no FROM dav_principal WHERE user_no = :user_no AND NOT EXISTS(SELECT 1 FROM role_member rm WHERE rm.role_no = 1 AND rm.user_no = dav_principal.user_no )';
$editor->Assign('is_admin', 't');
} else {
$sql = 'DELETE FROM role_member WHERE role_no = 1 AND user_no = :user_no';
$editor->Assign('is_admin', 'f');
}
$params[':user_no'] = $editor->Value('user_no');
$qry = new AwlQuery($sql, $params);
$qry->Exec('admin-principal-edit');
}
} else {
if (isset($id) && $id > 0) {
$editor->GetRecord();
if ($editor->IsSubmit()) {
$c->messages[] = i18n('You do not have permission to modify this record.');
}
}
}
if ($editor->Available()) {
$c->page_title = $editor->Title(translate('Principal') . ': ' . $editor->Value('fullname'));
} else {
$c->page_title = $editor->Title(translate('Create New Principal'));
$privs = decbin(privilege_to_bits($c->default_privileges));
$editor->Assign('default_privileges', $privs);
$editor->Assign('user_active', 't');
foreach ($c->template_usr as $k => $v) {
$editor->Assign($k, $v);
}
}
if ($post_values) {
$editor->PostToValues();
if (isset($_POST['default_privileges'])) {
$privilege_bitpos = array_flip($privilege_names);
$priv_names = array_keys($_POST['default_privileges']);
$privs = privilege_to_bits($priv_names);
//.........这里部分代码省略.........
示例2: trim
if (isset($_POST['is_calendar']) && $_POST['is_calendar'] == 'on') {
$resourcetypes .= '<urn:ietf:params:xml:ns:caldav:calendar/>';
}
if (isset($_POST['is_addressbook']) && $_POST['is_addressbook'] == 'on') {
$resourcetypes .= '<urn:ietf:params:xml:ns:carddav:addressbook/>';
}
$_POST['resourcetypes'] = $resourcetypes;
if ($editor->IsCreate()) {
$c->messages[] = i18n("Creating new Collection.");
} else {
$c->messages[] = i18n("Updating Collection record.");
}
if (!$editor->Write()) {
$c->messages[] = i18n("Failed to write collection.");
if ($id > 0) {
$editor->GetRecord();
}
} else {
if (isset($_FILES['ics_file']['tmp_name']) && $_FILES['ics_file']['tmp_name'] != '') {
/**
* If the user has uploaded a .ics file as a calendar, we fake this out
* as if it were a "PUT" request against a collection. This is something
* of a hack. It works though :-)
*/
$ics = trim(file_get_contents($_FILES['ics_file']['tmp_name']));
dbg_error_log('collection-edit', ':Write: Loaded %d bytes from %s', strlen($ics), $_FILES['ics_file']['tmp_name']);
include_once 'check_UTF8.php';
if (!check_string($ics)) {
$ics = force_utf8($ics);
}
if (check_string($ics)) {