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


PHP DatabaseManager::getQuery方法代码示例

本文整理汇总了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;
 }
开发者ID:niavok,项目名称:perroquet-website,代码行数:7,代码来源:LoginManager.php

示例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;
 }
开发者ID:niavok,项目名称:perroquet-website,代码行数:32,代码来源:browse.php

示例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;
 }
开发者ID:niavok,项目名称:perroquet-website,代码行数:51,代码来源:user_list.php

示例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;
 }
开发者ID:niavok,项目名称:perroquet-website,代码行数:48,代码来源:propose_list.php


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