本文整理汇总了PHP中Sequence::objects方法的典型用法代码示例。如果您正苦于以下问题:PHP Sequence::objects方法的具体用法?PHP Sequence::objects怎么用?PHP Sequence::objects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::objects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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';
}
示例2: __
<?php
$selected = 'selected="selected"';
?>
<td>
<select name="sequence_id">
<option value="0" <?php
if ($config['sequence_id'] == 0) {
echo $selected;
}
?>
>— <?php
echo __('Random');
?>
—</option>
<?php
foreach (Sequence::objects() as $s) {
?>
<option value="<?php
echo $s->id;
?>
" <?php
if ($config['sequence_id'] == $s->id) {
echo $selected;
}
?>
><?php
echo $s->name;
?>
</option>
<?php
}