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


PHP Editor::AddField方法代码示例

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


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

示例1: Editor

<h1>Upgrade Database</h1>
<p>Currently this page does nothing.  Suggestions or patches to make it do something
useful will be gratefully received.
<br>&nbsp;
</p>
<h2>Upgrading DAViCal Versions</h2>
<p>The <a href="http://wiki.davical.org/w/Update-davical-database">update-davical-database</a> should be run
manually after upgrading the software to a new version of DAViCal.</p>

<p>In due course this program will implement the functionality which is currently contained in that
script, but until then I'm afraid you do need to run it.
EOBODY;
include "classEditor.php";
include "AwlUpgrader.php";
$editor = new Editor(translate('Upgrade Database'));
$editor->AddField('dbhost', "''");
$editor->AddField('dbport', "''");
$editor->AddField('dbname', "'davical'");
$editor->AddField('dbuser', "'davical_dba'");
$editor->AddField('dbpass', "''");
$editor->AddField('app_user', "'davical_app'");
$editor->AddField('apply_patches', "'t'");
$editor->AddField('owner', "davical_dba");
$prompt_dbname = translate('Database Name');
$prompt_dbuser = translate('Database Username');
$prompt_dbpass = translate('Database Password');
$prompt_dbport = translate('Database Port');
$prompt_dbhost = translate('Database Host');
$prompt_app_user = translate('Application DB User');
$prompt_do_patch = translate('Apply DB Patches');
$prompt_owner = translate('Database Owner');
开发者ID:derekyu1437,项目名称:davical,代码行数:31,代码来源:upgrade.php

示例2: 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);
//.........这里部分代码省略.........
开发者ID:derekyu1437,项目名称:davical,代码行数:101,代码来源:principal-edit.php

示例3: getUserByID

param_to_global('collection_name', '{^.+$}');
if (isset($user_no)) {
    $usr = getUserByID($user_no);
}
if (isset($principal_id)) {
    $usr = getPrincipalByID($principal_id);
}
$editor->SetLookup('timezone', 'SELECT \'\', \'*** Unknown ***\' UNION SELECT tz_id, tz_locn FROM time_zone WHERE tz_id = tz_locn AND length(tz_spec) > 100 ORDER BY 1');
$editor->SetLookup('schedule_transp', 'SELECT \'opaque\', \'Opaque\' UNION SELECT \'transp\', \'Transparent\'');
$editor->AddAttribute('timezone', 'id', 'fld_timezone');
$editor->AddAttribute('schedule_transp', 'id', 'fld_schedule_transp');
$editor->AddAttribute('is_calendar', 'id', 'fld_is_calendar');
$editor->AddAttribute('is_addressbook', 'id', 'fld_is_addressbook');
$editor->AddAttribute('is_calendar', 'onclick', 'toggle_enabled(\'fld_is_calendar\',\'=fld_timezone\',\'=fld_schedule_transp\',\'!fld_is_addressbook\',\'=fld_ics_file\');');
$editor->AddAttribute('is_addressbook', 'onclick', 'toggle_enabled(\'fld_is_addressbook\',\'!fld_is_calendar\');');
$editor->AddField('use_default_privs', 'default_privileges IS NULL');
$editor->AddAttribute('use_default_privs', 'id', 'fld_use_default_privs');
$editor->AddAttribute('use_default_privs', 'onclick', 'toggle_visible(\'fld_use_default_privs\',\'!privileges_settings\');');
$editor->AddField('ics_file', "''");
$editor->AddAttribute('ics_file', 'title', translate('Upload a .ics calendar in iCalendar format to initialise or replace this calendar.'));
$editor->AddAttribute('ics_file', 'id', 'fld_ics_file');
$editor->SetWhere('collection_id=' . $id);
$privilege_names = array('read', 'write-properties', 'write-content', 'unlock', 'read-acl', 'read-current-user-privilege-set', 'bind', 'unbind', 'write-acl', 'read-free-busy', 'schedule-deliver-invite', 'schedule-deliver-reply', 'schedule-query-freebusy', 'schedule-send-invite', 'schedule-send-reply', 'schedule-send-freebusy');
$params = array(':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth);
$is_update = $_POST['_editor_action'][$editor->Id] == 'update';
if (isset($collection_name)) {
    $collection_name = trim(str_replace('/', '', $collection_name));
}
if (!$is_update && isset($collection_name) && $collection_name != '' && is_object($usr)) {
    $_POST['dav_name'] = sprintf('/%s/%s/', $usr->username, $collection_name);
    $_POST['parent_container'] = sprintf('/%s/', $usr->username);
开发者ID:rossryan,项目名称:Calico,代码行数:31,代码来源:collection-edit.php


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