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


PHP Sequence::objects方法代码示例

本文整理汇总了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';
 }
开发者ID:ayurmedia,项目名称:osTicket-1.8,代码行数:64,代码来源:ajax.sequence.php

示例2: __

<?php 
$selected = 'selected="selected"';
?>
            <td>
                <select name="sequence_id">
                <option value="0" <?php 
if ($config['sequence_id'] == 0) {
    echo $selected;
}
?>
>&mdash; <?php 
echo __('Random');
?>
 &mdash;</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 
}
开发者ID:jmangarret,项目名称:ostickets,代码行数:31,代码来源:settings-tickets.inc.php


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