本文整理汇总了PHP中Editor::SetLookup方法的典型用法代码示例。如果您正苦于以下问题:PHP Editor::SetLookup方法的具体用法?PHP Editor::SetLookup怎么用?PHP Editor::SetLookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Editor
的用法示例。
在下文中一共展示了Editor::SetLookup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: grant_row_editor
function grant_row_editor()
{
global $c, $id, $editor, $can_write_principal, $privilege_names;
$grantrow = new Editor("Grants", "grants");
$grantrow->SetSubmitName('savegrantrow');
$edit_grant_clause = '';
if (isset($_GET['edit_grant'])) {
$edit_grant_clause = ' AND to_principal != ' . intval($_GET['edit_grant']);
}
$grantrow->SetLookup('to_principal', 'SELECT principal_id, displayname FROM dav_principal WHERE principal_id NOT IN (SELECT to_principal FROM grants WHERE by_principal = ' . $id . $edit_grant_clause . ') ORDER BY fullname');
if ($can_write_principal) {
if ($grantrow->IsSubmit()) {
if ($grantrow->IsUpdate()) {
$c->messages[] = translate('Updating grants by this Principal');
} else {
$c->messages[] = translate('Granting new privileges from this Principal');
}
$_POST['by_principal'] = $id;
$to_principal = intval($_POST['to_principal']);
$orig_to_id = intval($_POST['orig_to_id']);
$grantrow->SetWhere('by_principal=' . $id . ' AND to_principal=' . $orig_to_id);
if (isset($_POST['grant_privileges'])) {
$privilege_bitpos = array_flip($privilege_names);
$priv_names = array_keys($_POST['grant_privileges']);
$privs_dec = privilege_to_bits($priv_names);
$_POST['privileges'] = sprintf('%024s', decbin($privs_dec));
$grantrow->Assign('privileges', $privs_dec);
}
$grantrow->Write();
unset($_GET['to_principal']);
} elseif (isset($_GET['delete_grant'])) {
$qry = new AwlQuery("DELETE FROM grants WHERE by_principal=:grantor_id AND to_principal = :to_principal", array(':grantor_id' => $id, ':to_principal' => intval($_GET['delete_grant'])));
$qry->Exec('principal-edit');
$c->messages[] = translate('Deleted a grant from this Principal');
}
}
return $grantrow;
}
示例2: Editor
</form>
<script language="javascript">
toggle_enabled('fld_is_calendar','=fld_timezone','=fld_schedule_transp','!fld_is_addressbook','=fld_ics_file');
toggle_enabled('fld_is_addressbook','!fld_is_calendar');
toggle_visible('fld_use_default_privs','!privileges_settings');
</script>
EOTEMPLATE;
$editor->SetTemplate($template);
$page_elements[] = $editor;
if ($editor->Available()) {
$c->stylesheets[] = 'css/browse.css';
$c->scripts[] = 'js/browse.js';
$grantrow = new Editor("Grants", "grants");
$grantrow->SetSubmitName('savegrantrow');
$grantrow->SetLookup('to_principal', 'SELECT principal_id, displayname FROM dav_principal WHERE principal_id NOT IN (SELECT member_id FROM group_member WHERE group_id = ' . $id . ') ORDER BY displayname');
if ($can_write_collection) {
if ($grantrow->IsSubmit()) {
$_POST['by_collection'] = $id;
$to_principal = intval($_POST['to_principal']);
$orig_to_id = intval($_POST['orig_to_id']);
$grantrow->SetWhere("by_collection=" . $id . " AND to_principal={$orig_to_id}");
if (isset($_POST['grant_privileges'])) {
$privilege_bitpos = array_flip($privilege_names);
$priv_names = array_keys($_POST['grant_privileges']);
$privs = privilege_to_bits($priv_names);
$_POST['privileges'] = sprintf('%024s', decbin($privs));
$grantrow->Assign('privileges', $privs_dec);
}
$grantrow->Write();
unset($_GET['to_principal']);