本文整理汇总了PHP中DatabaseManager::getQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseManager::getQuery方法的具体用法?PHP DatabaseManager::getQuery怎么用?PHP DatabaseManager::getQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager::getQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAdministrator
static function isAdministrator()
{
$login = sqlite_escape_string(LoginManager::getLogin());
$results = DatabaseManager::getQuery("SELECT * FROM users WHERE openid='{$login}';");
$user = $results->fetchArray();
return $user && $user['admin'] == 1;
}
示例2: generateContent
function generateContent()
{
$content = '
<h1>' . _('Exercises list') . '</h1>
';
$results = DatabaseManager::getQuery("SELECT * FROM exercises ");
$content .= '<table>
<thead>
<th>' . _('Name') . '</th>
<th>' . _('Description') . '</th>
<th>' . _('Language') . '</th>
<th>' . _('Word count') . '</th>
<th>' . _('Action') . '</th>
</thead>
<tbody>
';
while ($result = $results->fetchArray()) {
$content .= '<tr>';
$content .= '<td>' . $result['name'] . '</td>';
$content .= '<td>' . $result['description'] . '</td>';
$content .= '<td>' . $result['language'] . '</td>';
$content .= '<td>' . $result['word_count'] . '</td>';
$content .= '<td>
<a href="' . RessourceManager::getInnerUrl('exercises/show') . '?id=' . $result['id'] . '">' . _('Details') . '</a><br/>
<a href="' . $result['file'] . '">' . _('Download') . '</a>
</td>';
$content .= '</tr>';
}
$content .= '<tbody></table>';
return $content;
}
示例3: displayContent
function displayContent()
{
$content = '';
$content .= '
<h2>' . _('Administrators') . '</h2>';
$results = DatabaseManager::getQuery("SELECT * FROM users WHERE admin=1 ");
$content .= '<table>
<thead>
<th>' . _('OpenID') . '</th>
<th>' . _('Name') . '</th>
<th>' . _('Email') . '</th>
<th>' . _('Admin rights') . '</th>
<th>' . _('Delete') . '</th>
</thead>
<tbody>
';
while ($result = $results->fetchArray()) {
$content .= '<tr>';
$content .= '<td>' . $result['openid'] . '</td>';
$content .= '<td>' . $result['name'] . '</td>';
$content .= '<td>' . $result['email'] . '</td>';
$content .= '<td><a href="' . RessourceManager::getInnerUrl('admin/user_list') . '?remove_rights=' . $result['openid'] . '">' . _('Remove') . '</a></td>';
$content .= '<td><a href="' . RessourceManager::getInnerUrl('admin/user_list') . '?delete=' . $result['openid'] . '">' . _('Delete') . '</a></td>';
$content .= '</tr>';
}
$content .= '<tbody></table>';
$content .= '
<h2>' . _('Users') . '</h2>';
$results = DatabaseManager::getQuery("SELECT * FROM users WHERE admin=0 ");
$content .= '<table>
<thead>
<th>' . _('OpenID') . '</th>
<th>' . _('Name') . '</th>
<th>' . _('Email') . '</th>
<th>' . _('Admin rights') . '</th>
<th>' . _('Delete') . '</th>
</thead>
<tbody>
';
while ($result = $results->fetchArray()) {
$content .= '<tr>';
$content .= '<td>' . $result['openid'] . '</td>';
$content .= '<td>' . $result['name'] . '</td>';
$content .= '<td>' . $result['email'] . '</td>';
$content .= '<td><a href="' . RessourceManager::getInnerUrl('admin/user_list') . '?add_rights=' . $result['openid'] . '">' . _('Add') . '</a></td>';
$content .= '<td><a href="' . RessourceManager::getInnerUrl('admin/user_list') . '?delete=' . $result['openid'] . '">' . _('Delete') . '</a></td>';
$content .= '</tr>';
}
$content .= '<tbody></table>';
return $content;
}
示例4: displayContent
function displayContent()
{
$content = '';
$content .= '
<h2>' . _('Current propositions') . '</h2>';
$user = LoginManager::getLogin();
$results = DatabaseManager::getQuery("SELECT * FROM proposed_exercises WHERE (state='waiting' OR state='processing')");
while ($result = $results->fetchArray()) {
$content .= '<div class="subblock" ><ul>';
$content .= '<li>' . _('Name: ') . $result['name'] . '</li>';
$content .= '<li>' . _('Description: ') . $result['description'] . '</li>';
$content .= '<li>' . _('Links: ') . $result['links'] . '</li>';
$content .= '<li>' . _('Proposer: ') . $result['user'] . '</li>';
$state = $result['state'];
$stateStr = _('Unknown state');
if ($state == 'waiting') {
$stateStr = _('Waiting for processing');
} elseif ($state == 'processing') {
$stateStr = _('Processing');
} elseif ($state == 'accepted') {
$stateStr = _('Accepted');
}
$content .= '<li>' . _('State: ') . $stateStr . '</li>';
$content .= '</ul></div>';
}
$content .= '
<h2>' . _('Old propositions') . '</h2>';
$results = DatabaseManager::getQuery("SELECT * FROM proposed_exercises WHERE not (state='waiting' OR state='processing')");
while ($result = $results->fetchArray()) {
$content .= '<div class="subblock" ><ul>';
$content .= '<li>' . _('Name: ') . $result['name'] . '</li>';
$content .= '<li>' . _('Description: ') . $result['description'] . '</li>';
$content .= '<li>' . _('Links: ') . $result['links'] . '</li>';
$content .= '<li>' . _('Proposer: ') . $result['user'] . '</li>';
$state = $result['state'];
$stateStr = _('Unknown state');
if ($state == 'waiting') {
$stateStr = _('Waiting for processing');
} elseif ($state == 'processing') {
$stateStr = _('Processing');
} elseif ($state == 'accepted') {
$stateStr = _('Accepted');
}
$content .= '<li>' . _('State: ') . $stateStr . '</li>';
$content .= '</ul></div>';
}
return $content;
}