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


PHP R::getCell方法代码示例

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


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

示例1: show_Data

 public function show_Data()
 {
     $this->output('cash', $this->user->cash);
     $this->output('xp', $this->user->xp);
     $this->output('level', $this->user->level);
     $this->output('players_online', R::getCell('SELECT COUNT(id) FROM session WHERE expires > ?', array(time())));
 }
开发者ID:agrafix,项目名称:managerslife,代码行数:7,代码来源:Ajax_User.class.php

示例2: clean

 public static function clean($f3, $filename)
 {
     $total_filesize = R::getCell('select sum(filesize) as total_filesize from cache');
     $cache_total_filesize_limit = $f3->get("UPLOAD.cache_total_size_limit");
     $cache_total_filesize_limit = PFH_File_helper::convert_filesize_in_bytes($cache_total_filesize_limit);
     if ($total_filesize > $cache_total_filesize_limit) {
         $caches = R::find("cache", "ORDER BY datetime");
         $count = count($caches);
         // 只有一個不刪除
         //if ($count < 2) {
         //    return;
         //}
         foreach ($caches as $key => $cache) {
             //不刪除最後一個
             //if ($key > $count - 1) {
             //    return;
             //}
             if ($cache->path === $filename) {
                 continue;
             }
             //throw new Exception("$key $cache->path");
             //echo $cache->path . "<br />";
             if (is_file($cache->path)) {
                 unlink($cache->path);
             }
             $total_filesize = $total_filesize - $cache->filesize;
             R::trash($cache);
             if ($total_filesize < $cache_total_filesize_limit) {
                 break;
             }
         }
     }
 }
开发者ID:rivalinx,项目名称:php-file-host,代码行数:33,代码来源:PFH_Archive_cache.php

示例3: testRebuilder

 /**
  * Test SQLite table rebuilding.
  * 
  * @return void
  */
 public function testRebuilder()
 {
     $toolbox = R::$toolbox;
     $adapter = $toolbox->getDatabaseAdapter();
     $writer = $toolbox->getWriter();
     $redbean = $toolbox->getRedBean();
     $pdo = $adapter->getDatabase();
     R::dependencies(array('page' => array('book')));
     $book = R::dispense('book');
     $page = R::dispense('page');
     $book->ownPage[] = $page;
     $id = R::store($book);
     $book = R::load('book', $id);
     asrt(count($book->ownPage), 1);
     asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 1);
     R::trash($book);
     asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 0);
     $book = R::dispense('book');
     $page = R::dispense('page');
     $book->ownPage[] = $page;
     $id = R::store($book);
     $book = R::load('book', $id);
     asrt(count($book->ownPage), 1);
     asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 1);
     $book->added = 2;
     R::store($book);
     $book->added = 'added';
     R::store($book);
     R::trash($book);
     asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 0);
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:36,代码来源:Rebuild.php

示例4: getUserLeaderboardCount

 public static function getUserLeaderboardCount($type)
 {
     $sql = self::makeUserLeaderboardCountSqlQuery($type);
     $count = R::getCell($sql);
     if ($count === null || is_array($count) && count($count) == 0) {
         $count = 0;
     }
     return $count;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:9,代码来源:GamePointUtil.php

示例5: init

 public function init()
 {
     parent::init();
     // only works if you are in casino
     $ct = R::getCell('SELECT map FROM map_position WHERE user_id = ?', array($this->user->getID()));
     if ($ct != "casino") {
         Framework::redir("game/index");
         exit;
     }
 }
开发者ID:agrafix,项目名称:managerslife,代码行数:10,代码来源:Game_Poker.class.php

示例6: player_count

    public function player_count()
    {
        return R::getCell('SELECT
			count(poker_player.id)
		FROM
			poker_player, poker_round, poker_player_poker_round
		WHERE
			poker_round.id = ? AND
			poker_player_poker_round.poker_round_id = poker_round.id AND
			poker_player_poker_round.poker_player_id = poker_player.id', array($this->bean->getID()));
    }
开发者ID:agrafix,项目名称:managerslife,代码行数:11,代码来源:Model_Poker_round.class.php

示例7: init

    public function init()
    {
        parent::init();
        $id = $_POST["id"];
        // check if npc is valid
        if (!is_numeric($id) || $id <= 0) {
            $this->error('Invalid ' . $this->_type . '-ID');
        }
        $this->npc = R::load($this->_type, $id);
        if ($this->npc->getID() != $id) {
            $this->error($this->_type . ' doesnt exist!');
        }
        // check if npc has right type
        if ($this->npc->type != $this->myType) {
            $this->error("This " . $this->_type . " is not of " . $this->myType);
        }
        // check if user is nearby
        $userPos = R::findOne('map_position', ' user_id = ?', array($this->user->getID()));
        $dist = sqrt(pow($this->npc->x - $userPos->x, 2) + pow($this->npc->y - $userPos->y, 2));
        if ($dist > 3 || $this->npc->map != $userPos->map) {
            $this->error('Du bist zu weit entfehrt!');
        }
        // check if quest availible
        $this->myNPCQuest = R::relatedOne($this->user, 'quests_npc', ' complete_time = 0 AND (startnpc_id = ? OR stopnpc_id = ?)', array($this->npc->getID(), $this->npc->getID()));
        if ($this->myNPCQuest != null) {
            if ($this->myNPCQuest->startnpc_id == $this->npc->getID()) {
                if ($this->myNPCQuest->accepted == 0) {
                    $this->myNPCQuestRole = 'startnpc';
                    $startnpc = $this->npc->name;
                    $stopnpc = R::getCell('SELECT `name` FROM map_npc WHERE id = ?', array($this->myNPCQuest->stopnpc_id));
                }
            } else {
                if ($this->myNPCQuest->accepted == 1) {
                    $this->myNPCQuestRole = 'stopnpc';
                    $stopnpc = $this->npc->name;
                    $startnpc = R::getCell('SELECT `name` FROM map_npc WHERE id = ?', array($this->myNPCQuest->startnpc_id));
                }
            }
            if ($this->myNPCQuestRole != 'none') {
                $all = Config::getConfig('npc_quests');
                $this->myNPCQuestData = $all[$this->myNPCQuest->quest_id][$this->myNPCQuestRole];
                $this->myNPCQuestData["text"] = str_replace(array('{startnpc}', '{stopnpc}'), array($startnpc, $stopnpc), $this->myNPCQuestData["text"]);
                foreach ($this->myNPCQuestData["items"] as $k => $v) {
                    $this->myNPCQuestData["items"][$k]["param"] = str_replace(array('{startnpc}', '{stopnpc}'), array($startnpc, $stopnpc), $v["param"]);
                }
                if ($this->_controllerFunc == 'Interact') {
                    $this->output('quest', '<br /> <br />
					<b>Quest:</b> ' . htmlspecialchars($this->myNPCQuestData["text"]) . ' <br />
					<a href="#questing">' . ($this->myNPCQuestRole == 'startnpc' ? 'annehmen' : 'abschließen') . '</a>');
                }
            }
        }
    }
开发者ID:agrafix,项目名称:managerslife,代码行数:53,代码来源:Controller_AjaxGameNPC.class.php

示例8: show_Main

 public function show_Main()
 {
     $usersPerPage = 20;
     $totalUsers = R::getCell('SELECT count(id) FROM user');
     $pages = ceil($totalUsers / $usersPerPage);
     $currentPage = is_numeric($this->get(1)) && $this->get(1) > 0 && $this->get(1) <= $pages ? $this->get(1) : 1;
     $players = array();
     $dbP = R::find('user', ' 1=1 ORDER BY xp DESC LIMIT ?,?', array(($currentPage - 1) * $usersPerPage, $usersPerPage));
     $i = $usersPerPage * ($currentPage - 1) + 1;
     foreach ($dbP as $p) {
         $players[] = array("rank" => $i, "username" => $p->username, "level" => $p->level, "xp" => formatCash($p->xp), "premium" => $p->hasPremium());
         $i++;
     }
     Framework::TPL()->assign('players', $players);
     Framework::TPL()->assign('currentPage', $currentPage);
     Framework::TPL()->assign('pages', $pages);
 }
开发者ID:agrafix,项目名称:managerslife,代码行数:17,代码来源:Game_Ranking.class.php

示例9: sendAnswer

 public static function sendAnswer($uid, $qno, $answer, $optional)
 {
     $id = R::getCell('select id from answer where uid = ? and qno = ? order by id desc limit 1', [$uid, $qno]);
     if (empty($id)) {
         $ans = R::dispense('answer');
         $ans->uid = $uid;
         $ans->datetime = new DateTime();
         $ans->qno = $qno;
         $ans->answer = $answer;
         $ans->optional = $optional;
         return R::store($ans);
     } else {
         $ans = R::load('answer', $id);
         $ans->answer = $answer;
         $ans->optional = $optional;
         return R::store($ans);
     }
 }
开发者ID:Anuchap,项目名称:AdSurvey,代码行数:18,代码来源:db.php

示例10: optimize

 /**
  * Optimize table column types, based on hints
  * @param string  $table   name of the table
  * @param string  $columnName name of the column
  * @param string  $datatype
  */
 public static function optimize($table, $columnName, $datatype, $length = null)
 {
     try {
         $databaseColumnType = DatabaseCompatibilityUtil::mapHintTypeIntoDatabaseColumnType($datatype, $length);
         if (isset(self::$optimizedTableColumns[$table])) {
             $fields = self::$optimizedTableColumns[$table];
             // It is possible that field is created outside optimizer, so in this case reload fields from database
             if (!in_array($columnName, array_keys($fields))) {
                 $fields = R::$writer->getColumns($table);
             }
         } else {
             $fields = R::$writer->getColumns($table);
         }
         if (in_array($columnName, array_keys($fields))) {
             $columnType = $fields[$columnName];
             if (strtolower($columnType) != strtolower($databaseColumnType)) {
                 if (strtolower($datatype) == 'string' && isset($length) && $length > 0) {
                     $maxLength = R::getCell("SELECT MAX(LENGTH({$columnName})) FROM {$table}");
                     if ($maxLength <= $length) {
                         R::exec("alter table {$table} change {$columnName} {$columnName} " . $databaseColumnType);
                     }
                 } else {
                     R::exec("alter table {$table} change {$columnName} {$columnName} " . $databaseColumnType);
                 }
             }
         } else {
             R::exec("alter table {$table} add {$columnName} " . $databaseColumnType);
         }
     } catch (RedBean_Exception_SQL $e) {
         //42S02 - Table does not exist.
         if (!in_array($e->getSQLState(), array('42S02'))) {
             throw $e;
         } else {
             R::$writer->createTable($table);
             R::exec("alter table {$table} add {$columnName} " . $databaseColumnType);
         }
     }
     if (isset($fields)) {
         self::$optimizedTableColumns[$table] = $fields;
     } else {
         self::$optimizedTableColumns[$table] = R::$writer->getColumns($table);
     }
     self::$optimizedTableColumns[$table][$columnName] = $databaseColumnType;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:50,代码来源:RedBeanColumnTypeOptimizer.php

示例11: testSavingNewParentAccountSavesCorrectly

 public function testSavingNewParentAccountSavesCorrectly()
 {
     $oldMetadata = Account::getMetadata();
     $newMetadata = $oldMetadata;
     $newMetadata['Account']['rules'][] = array('type', 'default', 'value' => 'Customer');
     Account::setMetadata($newMetadata);
     $account = new Account();
     $account->name = 'Account';
     $account->type->value = 'Customer';
     $account->account = $account;
     $saved = $account->save();
     $this->assertTrue($saved);
     $account->account = null;
     $saved = $account->save();
     $this->assertTrue($saved);
     $count = R::getCell('select count(*) from account');
     $this->assertEquals(1, $count);
     Account::setMetadata($oldMetadata);
     $this->assertTrue($account->delete());
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:20,代码来源:AccountTest.php

示例12: show_Main

 public function show_Main()
 {
     if ($this->get(1) == "login") {
         Framework::TPL()->assign('first_login', true);
     } else {
         Framework::TPL()->assign('first_login', false);
     }
     $session_expired = false;
     if ($this->get(1) == "session_expired") {
         $session_expired = true;
     }
     Framework::TPL()->assign('session_expired', $session_expired);
     $count = R::getCell('select count(id) from user');
     Framework::TPL()->assign("playercount", $count);
     // assign news
     $news = array();
     $dbNews = R::find('homepage_posts', ' 1=1 ORDER BY id DESC LIMIT 3');
     foreach ($dbNews as $n) {
         $author = R::relatedOne($n, 'user');
         $news[] = array('id' => $n->id, 'title' => $n->title, 'author' => $author->username, 'time' => $n->time);
     }
     Framework::TPL()->assign("news", $news);
 }
开发者ID:agrafix,项目名称:managerslife,代码行数:23,代码来源:Site_Index.class.php

示例13: date

    ?>
		    <div class="uiv2-form-row">
		    	<span class="uiv2-form-label">Registered on</span>
		        <span class="uiv2-form-label" style="text-align: left; ">
		        	<?php 
    echo date('d-m-Y', strtotime($user["date_of_registration"]));
    ?>
</span>
		    </div>
		    		<?php 
}
?>
		</fieldset>
		<?php 
$sql = "select count(*) from userservices where userid=?";
$services_count = R::getCell($sql, array($id));
if ($services_count > 0) {
    ?>
		<h2>Services offered</h2>

		<?php 
    $sql = "select distinct c.id as id, category from categories c " . "join services s on c.id = s.category_id " . "join userservices us on s.id = us.serviceid " . "where userid=?";
    $categories = R::getAll($sql, array($id));
    foreach ($categories as $category) {
        ?>
		<fieldset>
			<div class="legend"><?php 
        echo $category["category"];
        ?>
</div>
			<div style="padding: 20px;">
开发者ID:vinod-co,项目名称:projects,代码行数:31,代码来源:view_one_profile_for_approve_decline.php

示例14: header

    header('Content-type:text/json;charset=utf-8');
    echo json_encode(['result' => 'failed', 'error' => 'db error kayako', 'details' => $e->getMessage()]);
    die;
}
R::close();
// Save frequent people
R::addDatabase('supportsr', $GLOBALS['db_supportsr_url'], $GLOBALS['db_supportsr_user'], $GLOBALS['db_supportsr_pass']);
R::selectDatabase('supportsr');
if (!R::testConnection()) {
    exit('DB failed' . PHP_EOL);
}
R::freeze(true);
try {
    R::begin();
    foreach ($people_array as $people) {
        $person_old = R::getCell(' SELECT id ' . '   FROM supportsr.esr_frequent_people ' . '  WHERE name = :name ' . '    AND paper_number = :p_number ', [':name' => $people->pname, ':p_number' => $people->pidval]);
        if (empty($person_old) || $person_old == "") {
            $person_new = R::getRedBean()->dispense('esr_frequent_people');
            $person_new->name = $people->pname;
            $person_new->paper_type = $people->ptype == '身份证' ? '身份证/Id card' : ($people->ptype == '台胞证' ? '台胞证/Efficiency certificate' : ($people->ptype == '护照' ? '护照/Passport' : ($people->ptype == '港澳通行证' ? '港澳通行证/Hong Kong-Macau passport' : ($people->ptype == '驾驶证' ? '驾驶证/Driving license' : ''))));
            $person_new->paper_number = $people->pidval;
            $person_new->comid = $user['organizationname'] . '|*|' . $user['userorganizationid'];
            $person_new_id = R::store($person_new);
        }
    }
    R::commit();
} catch (Exception $e) {
    header('Content-type:text/json;charset=utf-8');
    echo json_encode(['result' => 'failed', 'error' => 'db error kayako', 'details' => $e->getMessage()]);
    R::rollback();
    die;
开发者ID:adexbn,项目名称:gds_wechat,代码行数:31,代码来源:request_create_equip_in.php

示例15: COUNT

}
if (empty($staff_rate_score) || $staff_rate_score == NULL) {
    $staff_rate_score = 4.0;
}
if (!empty($staff_id) && is_numeric($staff_id)) {
    try {
        $staff_experience_count = R::getCell(' SELECT ' . '     COUNT(DISTINCT p.ticketid) ' . ' FROM ' . '     kayako_fusion.swticketposts p ' . ' WHERE ' . '     p.staffid = :staff_id ', [':staff_id' => $staff_id]);
        _log(json_encode(['staff_experience_count' => $staff_experience_count]));
    } catch (Exception $e) {
        header('Content-type:text/json;charset=utf-8');
        echo json_encode(['result' => 'failed', 'error' => 'db error portal', 'details' => $e->getMessage()]);
        die;
    }
} else {
    try {
        $staff_experience_count = R::getCell('     SELECT COUNT(*) AS experience_count' . '       FROM supportsr.esr_ticketworkorder_interface p' . ' INNER JOIN supportsr.esr_ticketworkorder_interface pp' . '         ON p.wo_assignee = pp.wo_assignee' . '        AND p.wo_category = pp.wo_category' . '      WHERE p.kayako_ticket_id = :ticket_id', [':ticket_id' => $ticket_id]);
        _log(json_encode(['staff_experience_count' => $staff_experience_count]));
    } catch (Exception $e) {
        header('Content-type:text/json;charset=utf-8');
        echo json_encode(['result' => 'failed', 'error' => 'db error portal', 'details' => $e->getMessage()]);
        die;
    }
}
R::close();
// Merge
$staff_skills['rate_score'] = $staff_rate_score;
$staff_skills['experience_count'] = $staff_experience_count;
// Return
header('Content-type:text/json;charset=utf-8');
echo json_encode(['result' => 'true', 'staff' => $staff_skills], JSON_UNESCAPED_UNICODE);
die;
开发者ID:adexbn,项目名称:gds_wechat,代码行数:31,代码来源:staff_skill.php


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