本文整理汇总了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();
}
示例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';
}