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


PHP Stack::decode_bool方法代码示例

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


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

示例1: stack_load_card

 public function stack_load_card($card_id)
 {
     $stmt = $this->file_db->prepare('SELECT card.bkgnd_id, bkgnd.bkgnd_name, bkgnd.cant_delete, bkgnd.dont_search, ' . 'bkgnd.bkgnd_data, card.card_data, card_name, card_seq, card.object_data, ' . 'bkgnd.object_data, card.cant_delete, card.dont_search, card.marked, card.card_art, bkgnd.bkgnd_art ' . 'FROM card JOIN bkgnd ON card.bkgnd_id=bkgnd.bkgnd_id WHERE card_id=?');
     Stack::sl_ok($stmt, $this->file_db, 'Loading Card (1)');
     Stack::sl_ok($stmt->execute(array(intval($card_id))), $this->file_db, 'Loading Card (2)');
     $row = $stmt->fetch(PDO::FETCH_NUM);
     if ($row === false) {
         return null;
     }
     $card['card_id'] = intval($card_id);
     $card['card_name'] = $row[6];
     $card['card_seq'] = $row[7] / 10;
     $card['card_cant_delete'] = Stack::decode_bool($row[10]);
     $card['card_dont_search'] = Stack::decode_bool($row[11]);
     $card['card_marked'] = Stack::decode_bool($row[12]);
     $data = json_decode($row[5], true);
     $card['card_script'] = Stack::nvl($data['card_script'], array('content' => '', 'selection' => 0));
     $card['card_has_art'] = Stack::nvl($data['card_has_art'], false);
     $card['data'] = '';
     if (isset($data['data'])) {
         $card['data'] = $data['data'];
     }
     $card['card_art'] = null;
     if (isset($row[13]) && $row[13] !== '' && $row[13] !== null) {
         $card['card_art'] = $row[13];
     }
     //if (isset($data['content']))
     //	$card['content'] = $data['content'];
     $card['card_object_data'] = $row[8];
     $card['bkgnd_id'] = $row[0];
     $card['bkgnd_name'] = $row[1];
     $card['bkgnd_cant_delete'] = Stack::decode_bool($row[2]);
     $card['bkgnd_dont_search'] = Stack::decode_bool($row[3]);
     $data = json_decode($row[4], true);
     $card['bkgnd_script'] = Stack::nvl($data['bkgnd_script'], array('content' => '', 'selection' => 0));
     $card['bkgnd_has_art'] = Stack::nvl($data['bkgnd_has_art'], false);
     $card['bkgnd_art'] = null;
     if (isset($row[14]) && $row[14] !== '' && $row[14] !== null) {
         $card['bkgnd_art'] = $row[14];
     }
     $card['bkgnd_object_data'] = $row[9];
     $card['stack_count'] = Stack::stack_get_count_cards(null);
     $card['bkgnd_count'] = Stack::stack_get_count_cards($card['bkgnd_id']);
     return $card;
 }
开发者ID:Happy-Ferret,项目名称:cinsimp-web,代码行数:45,代码来源:stack.php

示例2: stack_delete_card

 public function stack_delete_card($card_id)
 {
     $this->_check_mutability();
     $next_card_id = null;
     $this->file_db->beginTransaction();
     /* request some information about the card; bkgnd ID, sequence and cant_delete flags */
     $stmt = $this->file_db->prepare('SELECT card.bkgnd_id, card.seq, card.cant_delete, bkgnd.cant_delete ' . 'FROM card JOIN bkgnd ON card.bkgnd_id=bkgnd.id WHERE card.id=?');
     $stmt->execute(array(intval($card_id)));
     $row = $stmt->fetch(PDO::FETCH_NUM);
     $bkgnd_id = intval($row[0]);
     $existing_seq = intval($row[1]);
     $card_cant_delete = Stack::decode_bool($row[2]);
     $bkgnd_cant_delete = Stack::decode_bool($row[3]);
     if ($card_cant_delete) {
         CinsImpError::general('Cannot delete protected card');
     }
     /* count the number of cards in the same background;
     		if this is the last card, the background must be deleted too */
     $stmt = $this->file_db->prepare('SELECT COUNT(*) FROM card WHERE bkgnd_id=?');
     $stmt->execute(array(intval($bkgnd_id)));
     $row = $stmt->fetch(PDO::FETCH_NUM);
     $bkgnd_count = intval($row[0]);
     $cleanup_bkgnd = $bkgnd_count == 1;
     if ($cleanup_bkgnd && $bkgnd_cant_delete) {
         CinsImpError::general('Cannot delete last card of protected background');
     }
     /* count the number of cards in the stack;
     		if this is the last card, it cannot be deleted (last card in stack) */
     $stmt = $this->file_db->prepare('SELECT COUNT(*) FROM card');
     $stmt->execute();
     $row = $stmt->fetch(PDO::FETCH_NUM);
     $stack_count = intval($row[0]);
     if ($stack_count == 1) {
         CinsImpError::general('Cannot delete last card of stack');
     }
     /* delete the actual card */
     $stmt = $this->file_db->prepare('DELETE FROM card WHERE id=?');
     $stmt->execute(array(intval($card_id)));
     $stmt = $this->file_db->prepare('DELETE FROM card_data WHERE card_id=?');
     $stmt->execute(array(intval($card_id)));
     $stmt = $this->file_db->prepare('DELETE FROM button WHERE layer_id=?');
     $stmt->execute(array(-intval($card_id)));
     $stmt = $this->file_db->prepare('DELETE FROM field WHERE layer_id=?');
     $stmt->execute(array(-intval($card_id)));
     /* close the gap */
     $stmt = $this->file_db->prepare('UPDATE card SET seq = seq - 1 WHERE seq > ?');
     $stmt->execute(array(intval($existing_seq)));
     /* delete the background if required */
     if ($cleanup_bkgnd) {
         $stmt = $this->file_db->prepare('DELETE FROM bkgnd WHERE id=?');
         $stmt->execute(array($bkgnd_id));
         $stmt = $this->file_db->prepare('DELETE FROM button WHERE layer_id=?');
         $stmt->execute(array($bkgnd_id));
         $stmt = $this->file_db->prepare('DELETE FROM field WHERE layer_id=?');
         $stmt->execute(array($bkgnd_id));
     }
     /* select the card preceeding that which was deleted */
     $stmt = $this->file_db->prepare('SELECT id FROM card WHERE seq=?');
     $stmt->execute(array(intval($existing_seq)));
     $row = $stmt->fetch(PDO::FETCH_NUM);
     if ($row) {
         $next_card_id = intval($row[0]);
     } else {
         $stmt = $this->file_db->prepare('SELECT id FROM card WHERE seq = 1');
         $stmt->execute();
         $row = $stmt->fetch(PDO::FETCH_NUM);
         $next_card_id = intval($row[0]);
     }
     $this->file_db->commit();
     return $next_card_id;
 }
开发者ID:jhawcroft,项目名称:cinsimp-web,代码行数:71,代码来源:stack.php


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