Exemplo n.º 1
0
 public function setAuthorId($nick)
 {
     $person = new DbPerson($nick);
     if (!$person->exists()) {
         return;
     }
     $this->authorId = $person->getNumericId();
 }
Exemplo n.º 2
0
function custom_url_rewrite_inbound(&$result, $path, $path_language)
{
    global $person;
    if (preg_match('|^person/(.*)|', $path, $matches)) {
        require_once dirname(__FILE__) . "/../../modules/user/user.module";
        $person = new DbPerson($matches[1]);
        $uid = $person->getUserId();
        if ($uid) {
            $result = 'user/' . $uid . '/person';
        }
    }
}
Exemplo n.º 3
0
 private function getTableHtml()
 {
     global $pager_total_items;
     $filter = $this->build_filter_query();
     $header = array(array('data' => '№'), array('data' => 'Фамилия, имя', 'field' => 'p.surname'), array('data' => 'Турниров', 'field' => 'p.TNumber', 'sort' => 'desc'), array('data' => 'Вопросов', 'field' => 'p.QNumber'), array('data' => 'Сертификация', 'field' => 'p.QNumber'), array('data' => 'Ник на сайте'));
     $sql = "SELECT  p.* from {People} p {$filter['join']} WHERE 1 {$filter['where']} GROUP BY CharId";
     $sql .= tablesort_sql($header);
     $sql = preg_replace('/(p\\.surname\\s+(A|DE)SC)/', '$1, p.name $2SC', $sql);
     $query_count = "SELECT count(DISTINCT CharId) from  {People} p {$filter['join']} WHERE 1 {$filter['where']}";
     $result = pager_query($sql, 50, 0, $query_count, $filter['args']);
     $rows = array();
     $output .= '<p>' . $pager_total_items[0] . ' человек' . $this->suffix($pager_total_items[0]) . '</p>';
     $n = isset($_GET['page']) ? $_GET['page'] * 50 : 0;
     while ($line = db_fetch_object($result)) {
         $n++;
         $person = DbPerson::newFromRow($line);
         $cert = array();
         if ($person->isCertifiedEditor()) {
             $cert[] = 'редактор';
         }
         if ($person->isCertifiedReferee()) {
             $cert[] = 'арбитр';
         }
         $cert = $cert ? implode(', ', $cert) : '&mdash;';
         $nick = $person->getNick() or $nick = '&mdash;';
         $rows[] = array($n, $person->getLink(), $person->getToursNumber(), $person->getQuestionsNumber(), $cert, $nick);
     }
     $output .= theme('table', $header, $rows);
     $output .= theme('pager', NULL, 50, 0);
     return $output;
     /*    $accounts[$account->uid] = '';
         $form['name'][$account->uid] = array('#value' => theme('username', $account));
         $form['status'][$account->uid] =  array('#value' => $status[$account->status]);
         $users_roles = array();
         $roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = %d', $account->uid);
         while ($user_role = db_fetch_object($roles_result)) {
           $users_roles[] = $roles[$user_role->rid];
         }
         asort($users_roles);
         $form['roles'][$account->uid][0] = array('#value' => theme('item_list', $users_roles));
         $form['member_for'][$account->uid] = array('#value' => format_interval(time() - $account->created));
         $form['last_access'][$account->uid] =  array('#value' => $account->access ? t('@time ago', array('@time' => format_interval(time() - $account->access))) : t('never'));
         $form['operations'][$account->uid] = array('#value' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination)));
       }*/
 }