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


PHP Sequence::create方法代码示例

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


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

示例1: run

    function run($max_time) {
        global $cfg;

        $i18n = new Internationalization($cfg->get('system_language', 'en_US'));
        $sequences = $i18n->getTemplate('sequence.yaml')->getData();
        foreach ($sequences as $s) {
            Sequence::create($s)->save();
        }
        db_query('UPDATE '.SEQUENCE_TABLE.' SET `next`= '
            .'(SELECT MAX(ticket_id)+1 FROM '.TICKET_TABLE.') '
            .'WHERE `id`=1');

        require_once(INCLUDE_DIR . 'class.list.php');

        $lists = $i18n->getTemplate('list.yaml')->getData();
        foreach ($lists as $l) {
            DynamicList::create($l);
        }

        $statuses = $i18n->getTemplate('ticket_status.yaml')->getData();
        foreach ($statuses as $s) {
            TicketStatus::__create($s);
        }

        // Initialize MYSQL search backend
        MysqlSearchBackend::__init();
    }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:27,代码来源:8f99b8bf-03ff59bf.task.php

示例2: manage

 /**
  * Ajax: GET|POST /sequence/manage
  *
  * Gets a dialog box content or updates data from the content
  *
  * Post-Arguments:
  * seq[<id>][*] - Updated information for existing sequences
  * seq[<new-*>[*] - Information for new sequences
  * seq[<id>][deleted] - If set to true, indicates that the sequence
  *      should be deleted from the database
  *
  * Throws:
  * 403 - Not logged in
  * 422 - Information sent for update of unknown sequence
  */
 function manage()
 {
     global $thisstaff;
     if (!$thisstaff) {
         Http::response(403, 'Login required');
     }
     $sequences = Sequence::objects()->all();
     $info = array('action' => '#sequence/manage');
     $valid = true;
     if ($_POST) {
         foreach ($_POST['seq'] as $id => $info) {
             if (strpos($id, 'new-') === 0) {
                 unset($info['id']);
                 $sequences[] = Sequence::create($info);
             } else {
                 foreach ($sequences as $s) {
                     if ($s->id == $id) {
                         break;
                     }
                     $s = false;
                 }
                 if (!$s) {
                     Http::response(422, $id . ': Invalid or unknown sequence');
                 } elseif ($info['deleted']) {
                     $s->delete();
                     continue;
                 }
                 foreach ($info as $f => $val) {
                     if (isset($s->{$f})) {
                         $s->set($f, $val);
                     } elseif ($f == 'current') {
                         $s->next = $val;
                     }
                 }
                 if (($v = $s->isValid()) !== true) {
                     $msg = sprintf('%s: %s', $s->getName(), $valid);
                     $valid = false;
                 }
             }
         }
         if ($valid) {
             foreach ($sequences as $s) {
                 $s->save();
             }
             Http::response(205, 'All sequences updated');
         }
     }
     include STAFFINC_DIR . 'templates/sequence-manage.tmpl.php';
 }
开发者ID:ayurmedia,项目名称:osTicket-1.8,代码行数:64,代码来源:ajax.sequence.php


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