本文整理汇总了PHP中Sequence::lookup方法的典型用法代码示例。如果您正苦于以下问题:PHP Sequence::lookup方法的具体用法?PHP Sequence::lookup怎么用?PHP Sequence::lookup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::lookup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: current
/**
* Ajax: GET /sequence/<id>
*
* Fetches the current value of a sequence
*
* Get-Arguments:
* format - (string) format string used to format the current value of
* the sequence.
*
* Returns:
* (string) Current sequence number, optionally formatted
*
* Throws:
* 403 - Not logged in
* 404 - Unknown sequence id
* 422 - Invalid sequence id
*/
function current($id)
{
global $thisstaff;
if (!$thisstaff) {
Http::response(403, 'Login required');
} elseif ($id == 0) {
$sequence = new RandomSequence();
} elseif (!$id || !is_numeric($id)) {
Http::response(422, 'Id is required');
} elseif (!($sequence = Sequence::lookup($id))) {
Http::response(404, 'No such object');
}
return $sequence->current($_GET['format']);
}
示例2: __
<?php
echo __('Default Ticket Number Format');
?>
:
</td>
<td>
<input type="text" name="number_format" value="<?php
echo $config['number_format'];
?>
"/>
<span class="faded"><?php
echo __('e.g.');
?>
<span id="format-example"><?php
if ($config['sequence_id']) {
$seq = Sequence::lookup($config['sequence_id']);
}
if (!isset($seq)) {
$seq = new RandomSequence();
}
echo $seq->current($config['number_format']);
?>
</span></span>
<i class="help-tip icon-question-sign" href="#number_format"></i>
<div class="error"><?php
echo $errors['number_format'];
?>
</div>
</td>
</tr>
<tr><td width="220"><?php
示例3: getNewTicketNumber
function getNewTicketNumber()
{
global $cfg;
if (!$this->hasFlag(self::FLAG_CUSTOM_NUMBERS)) {
return $cfg->getNewTicketNumber();
}
if ($this->ht['sequence_id']) {
$sequence = Sequence::lookup($this->ht['sequence_id']);
}
if (!$sequence) {
$sequence = new RandomSequence();
}
return $sequence->next($this->ht['number_format'] ?: '######', array('Ticket', 'isTicketNumberUnique'));
}
示例4: getDefaultSequence
function getDefaultSequence()
{
if ($this->get('sequence_id')) {
$sequence = Sequence::lookup($this->get('sequence_id'));
}
if (!$sequence) {
$sequence = new RandomSequence();
}
return $sequence;
}
示例5: __
echo __('Format');
?>
:
</td>
<td>
<input type="text" name="number_format" value="<?php
echo $info['number_format'];
?>
"/>
<span class="faded"><?php
echo __('e.g.');
?>
<span id="format-example"><?php
if ($info['custom-numbers']) {
if ($info['sequence_id']) {
$seq = Sequence::lookup($info['sequence_id']);
}
if (!isset($seq)) {
$seq = new RandomSequence();
}
echo $seq->current($info['number_format']);
}
?>
</span></span>
<div class="error"><?php
echo $errors['number_format'];
?>
</div>
</td>
</tr>
<tr>