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


PHP Editor::Assign方法代码示例

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


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

示例1: ticket_row_editor

function ticket_row_editor()
{
    global $c, $id, $editor, $can_write_principal, $privilege_names;
    $ticketrow = new Editor("Tickets", "access_ticket");
    $ticketrow->SetSubmitName('ticketrow');
    if ($can_write_principal && $ticketrow->IsSubmit()) {
        $username = $editor->Value('username');
        $ugly_path = $_POST['target'];
        if ($ugly_path == '/' . $username || $ugly_path == '/' . $username . '/') {
            $target_collection = $id;
        } else {
            $username_len = strlen($username) + 2;
            $sql = "SELECT collection_id FROM collection WHERE dav_name = :exact_name";
            $sql .= " AND substring(dav_name FROM 1 FOR {$username_len}) = '/{$username}/'";
            $params = array(':exact_name' => $ugly_path);
            if (!preg_match('#/$#', $ugly_path)) {
                $sql .= " OR dav_name = :truncated_name OR dav_name = :trailing_slash_name";
                $params[':truncated_name'] = preg_replace('#[^/]*$#', '', $ugly_path);
                $params[':trailing_slash_name'] = $ugly_path . "/";
            }
            $sql .= " ORDER BY LENGTH(dav_name) DESC LIMIT 1";
            $qry = new AwlQuery($sql, $params);
            if ($qry->Exec() && $qry->rows() > 0) {
                $row = $qry->Fetch();
                $target_collection = $row->collection_id;
            } else {
                $c->messages[] = translate('Can only add tickets for existing collection paths which you own');
                return $ticketrow;
            }
        }
        $_POST['dav_owner_id'] = $id;
        $_POST['target_collection_id'] = $target_collection;
        $ticket_id = check_by_regex($_POST['ticket_id'], '/[A-Za-z0-9]+/');
        $ticketrow->SetWhere('dav_owner_id=' . $id . ' AND ticket_id=' . AwlQuery::quote($ticket_id));
        if (isset($_POST['ticket_privileges'])) {
            $privilege_bitpos = array_flip($privilege_names);
            $priv_names = array_keys($_POST['ticket_privileges']);
            $privs_dec = privilege_to_bits($priv_names);
            $_POST['privileges'] = sprintf('%024s', decbin($privs_dec));
            $ticketrow->Assign('privileges', $privs_dec);
        }
        $c->messages[] = translate('Creating new ticket granting privileges to this Principal');
        $ticketrow->Write();
    }
    return $ticketrow;
}
开发者ID:derekyu1437,项目名称:davical,代码行数:46,代码来源:principal-edit.php

示例2: Editor

 $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']);
     } elseif (isset($_GET['delete_grant'])) {
         $qry = new AwlQuery("DELETE FROM grants WHERE by_collection=:grantor_id AND to_principal = :to_principal", array(':grantor_id' => $id, ':to_principal' => intval($_GET['delete_grant'])));
         $qry->Exec('collection-edit');
     }
 }
 function edit_grant_row($row_data)
 {
     global $grantrow, $id, $privilege_xlate, $privilege_names;
     global $btn_all, $btn_all_title, $btn_rw, $btn_rw_title, $btn_read, $btn_read_title;
     global $btn_fb, $btn_fb_title, $btn_sd, $btn_sd_title, $btn_ss, $btn_ss_title;
     $submit_label = translate('Grant');
     if ($row_data->to_principal > -1) {
开发者ID:rossryan,项目名称:Calico,代码行数:31,代码来源:collection-edit.php


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