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


PHP Filter::addSupportedMatches方法代码示例

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


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

示例1: db_input

        }
        $sql = 'INSERT INTO `' . TABLE_PREFIX . 'ticket__cdata` SET ' . $fields . ', `ticket_id`=' . db_input($answer->getEntry()->get('object_id')) . ' ON DUPLICATE KEY UPDATE ' . $fields;
        if (!db_query($sql) || !db_affected_rows()) {
            return self::dropDynamicDataView();
        }
    }
}
// Add fields from the standard ticket form to the ticket filterable fields
Filter::addSupportedMatches('Ticket Data', function () {
    $matches = array();
    foreach (TicketForm::getInstance()->getFields() as $f) {
        if (!$f->hasData()) {
            continue;
        }
        $matches['field.' . $f->get('id')] = 'Ticket / ' . $f->getLabel();
        if (($fi = $f->getImpl()) instanceof SelectionField) {
            foreach ($fi->getList()->getProperties() as $p) {
                $matches['field.' . $f->get('id') . '.' . $p->get('id')] = 'Ticket / ' . $f->getLabel() . ' / ' . $p->getLabel();
            }
        }
    }
    return $matches;
}, 30);
// Manage materialized view on custom data updates
Signal::connect('model.created', array('TicketForm', 'updateDynamicDataView'), 'DynamicFormEntryAnswer');
Signal::connect('model.updated', array('TicketForm', 'updateDynamicDataView'), 'DynamicFormEntryAnswer');
// Recreate the dynamic view after new or removed fields to the ticket
// details form
Signal::connect('model.created', array('TicketForm', 'dropDynamicDataView'), 'DynamicFormField', function ($o) {
    return $o->getForm()->get('type') == 'T';
});
开发者ID:ed00m,项目名称:osTicket-1.8,代码行数:31,代码来源:class.dynamic_forms.php

示例2: array

    return $o->getForm()->get('type') == 'T';
});
// If the `name` column is in the dirty list, we would be renaming a
// column. Delete the view instead.
Signal::connect('model.updated', array('TicketForm', 'dropDynamicDataView'), 'DynamicFormField', function ($o, $d) {
    return isset($d['dirty']) && (isset($d['dirty']['name']) || isset($d['dirty']['type']));
});
Filter::addSupportedMatches('Custom Forms', function () {
    $matches = array();
    foreach (DynamicForm::objects()->filter(array('type' => 'G')) as $form) {
        foreach ($form->getFields() as $f) {
            if (!$f->hasData()) {
                continue;
            }
            $matches['field.' . $f->get('id')] = $form->getTitle() . ' / ' . $f->getLabel();
            if (($fi = $f->getImpl()) && $fi->hasSubFields()) {
                foreach ($fi->getSubFields() as $p) {
                    $matches['field.' . $f->get('id') . '.' . $p->get('id')] = $form->getTitle() . ' / ' . $f->getLabel() . ' / ' . $p->getLabel();
                }
            }
        }
    }
    return $matches;
}, 9900);
require_once INCLUDE_DIR . "class.json.php";
class DynamicFormField extends VerySimpleModel
{
    static $meta = array('table' => FORM_FIELD_TABLE, 'ordering' => array('sort'), 'pk' => array('id'), 'joins' => array('form' => array('null' => true, 'constraint' => array('form_id' => 'DynamicForm.id'))));
    var $_field;
    const REQUIRE_NOBODY = 0;
    const REQUIRE_EVERYONE = 1;
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:31,代码来源:class.dynamic_forms.php

示例3: updateSortOrder

        }
        if (!$cfg || $cfg->getTopicSortMode() == 'a') {
            static::updateSortOrder();
        }
        return $rv;
    }
    static function updateSortOrder()
    {
        // Fetch (un)sorted names
        if (!($names = static::getHelpTopics(false, true))) {
            return;
        }
        uasort($names, function ($a, $b) {
            return strcmp($a, $b);
        });
        $update = array_keys($names);
        foreach ($update as $idx => &$id) {
            $id = sprintf("(%s,%s)", db_input($id), db_input($idx + 1));
        }
        if (!count($update)) {
            return;
        }
        // Thanks, http://stackoverflow.com/a/3466
        $sql = sprintf('INSERT INTO `%s` (topic_id,`sort`) VALUES %s
            ON DUPLICATE KEY UPDATE `sort`=VALUES(`sort`)', TOPIC_TABLE, implode(',', $update));
        db_query($sql);
    }
}
// Add fields from the standard ticket form to the ticket filterable fields
Filter::addSupportedMatches('Help Topic', array('topicId' => 'Topic ID'), 100);
开发者ID:ayurmedia,项目名称:osTicket-1.8,代码行数:30,代码来源:class.topic.php

示例4: foreach

                break;
            }
        }
        if (!$form || !($o = static::objects())) {
            return false;
        }
        // Create sample organization.
        if ($orgs = $i18n->getTemplate('organization.yaml')->getData()) {
            foreach ($orgs as $org) {
                Organization::__create($org);
            }
        }
        return $o[0];
    }
}
Filter::addSupportedMatches('Organization Data', function () {
    $matches = array();
    foreach (OrganizationForm::getInstance()->getFields() as $f) {
        if (!$f->hasData()) {
            continue;
        }
        $matches['field.' . $f->get('id')] = __('Organization') . ' / ' . $f->getLabel();
        if (($fi = $f->getImpl()) && $fi->hasSubFields()) {
            foreach ($fi->getSubFields() as $p) {
                $matches['field.' . $f->get('id') . '.' . $p->get('id')] = __('Organization') . ' / ' . $f->getLabel() . ' / ' . $p->getLabel();
            }
        }
    }
    return $matches;
}, 40);
Organization::_inspect();
开发者ID:gizur,项目名称:osticket,代码行数:31,代码来源:class.organization.php


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