本文整理汇总了PHP中TikiLib::fetchAll方法的典型用法代码示例。如果您正苦于以下问题:PHP TikiLib::fetchAll方法的具体用法?PHP TikiLib::fetchAll怎么用?PHP TikiLib::fetchAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TikiLib
的用法示例。
在下文中一共展示了TikiLib::fetchAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: input
function input()
{
$logs = array();
foreach (TikiLib::lib('logsqry')->listTypes() as $type) {
$logs[] = array("label" => tr(ucwords($type)), "value" => $type);
}
$actions = array(array("label" => tr("All"), "value" => ""));
foreach (TikiLib::lib('logsqry')->listActions() as $action) {
$actions[] = array("label" => tr(ucwords($action)), "value" => $action);
}
$fields = array();
foreach (TikiLib::fetchAll("SHOW COLUMNS FROM tiki_actionlog") as $column) {
$fields[] = array("label" => tr(ucwords($column['Field'])), "value" => $column['Field']);
}
return array("values" => array("logs" => $logs, "actions" => $actions, "fields" => $fields, "grouping" => array(array("label" => tr("None"), "value" => ""), array("label" => tr("Count"), "value" => "count"), array("label" => tr("Count By Date"), "value" => "countByDate"), array("label" => tr("Count By Date Filter Id"), "value" => "countByDateFilterId"), array("label" => tr("Count Users Filter Id"), "value" => "countUsersFilterId"), array("label" => tr("Count Users IP Filter Id"), "value" => "countUsersIPFilterId")), "sort" => array(array("label" => tr("None"), "value" => ""), array("label" => tr("Ascending By Date"), "value" => "asc"), array("label" => tr("Descending By Date"), "value" => "desc"))), "options" => array(array("label" => tr("Logs"), "key" => "logs", "type" => "single", "values" => "logs", "repeats" => false, "options" => array(array("label" => tr("Action"), "key" => "action", "type" => "single", "values" => "actions", "repeats" => false), array("label" => tr("Start"), "key" => "start", "type" => "date", "repeats" => false), array("label" => tr("End"), "key" => "end", "type" => "date", "repeats" => false), array("label" => tr("Fields"), "key" => "fields", "type" => "multi", "values" => "fields", "repeats" => false), array("label" => tr("Grouping"), "key" => "grouping", "type" => "single", "values" => "grouping"), array("label" => tr("Sort"), "key" => "sort", "type" => "single", "values" => "sort"), array("label" => tr("Limit"), "key" => "limit", "type" => "single")))));
}
示例2: newestWikiRevision
static function newestWikiRevision($phrase, $page)
{
$match = -1;
$i = 0;
$page = end(TikiLib::fetchAll("SELECT data, version FROM tiki_pages WHERE pageName = ?", array($page)));
$page['data'] = TikiLib::lib("parser")->parse_data($page['data']);
$match = JisonParser_Phraser_Handler::hasPhrase($page['data'], $phrase) == true ? $page['version'] : -1;
if ($match < 0) {
foreach (TikiLib::fetchAll("SELECT data, version FROM tiki_history WHERE pageName = ? ORDER BY version DESC", array($page)) as $page) {
$match = JisonParser_Phraser_Handler::hasPhrase($page['data'], $phrase) == true ? $page['version'] : -1;
if ($match > -1) {
break;
}
}
}
return (int) $match;
}
示例3: foreach
<?php
// (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: backup.php 44444 2013-01-05 21:24:24Z changi67 $
require_once 'tiki-setup.php';
$access->check_permission('tiki_p_admin');
$backup = "";
foreach (TikiLib::fetchAll('SHOW TABLES') as $table) {
$table = end($table);
$result = TikiLib::fetchAll('SELECT * FROM ' . $table);
$num_fields = count($result);
$backup .= 'DROP TABLE ' . $table . ';';
$createTable = TikiLib::fetchAll('SHOW CREATE TABLE ' . $table);
$backup .= "\n\n" . $createTable[0]['Create Table'] . ";\n\n";
foreach ($result as $row) {
$fields = array();
foreach ($row as $field) {
$field = addslashes($field);
$field = preg_replace("\n", "\\n", $field);
$fields[] = isset($field) ? '"' . $field . '"' : '""';
}
$backup .= 'INSERT INTO ' . $table . ' VALUES(' . implode(",", $fields) . ');' . "\n";
}
$backup .= "\n\n\n";
}
//save file
$handle = fopen('temp/db-backup-' . time() . '-' . md5(implode(',', $tables)) . '.sql', 'w+');
fwrite($handle, $backup);