Example #1
0
 function Problem_DrawProblems()
 {
     $manage = $this->IsContestJudge();
     if (!$manage) {
         return;
     }
     $delete = $this->GetAllowed('PROBLEMS.DELETE');
     $edit = $this->GetAllowed('PROBLEMS.EDIT');
     $rejudge = $this->GetAllowed('PROBLEMS.REJUDGE');
     $list = $this->problemsContainer->GetList(stripslashes($_GET['filter']));
     $n = count($list);
     if ($n == 0) {
         $this->CPrintLn('<span class="contentSub2">' . 'Нет задач для редактирования или просмотра.</span>');
         $this->CPrintLn($this->Template('problems.filter.form'));
         return;
     }
     $problemsPerPage = opt_get('WT_problems_per_page');
     if (!$problemsPerPage) {
         $problemsPerPage = 15;
     }
     $page = $i = 0;
     $pages = new CVCPagintation();
     content_url_var_push_global('filter');
     $pages->Init('PAGES', 'pageid=pageid;bottomPages=false;skiponcepage=true;');
     $last = ceil($n / $problemsPerPage);
     if ($_GET['pageid'] < 0) {
         $pageid = 0;
     } else {
         if ($_GET['pageid'] >= $last) {
             $_GET['pageid'] = $last - 1;
         }
     }
     while ($i < $n) {
         $c = 0;
         $arr = array();
         $first = $list[$i];
         while ($c < $problemsPerPage && $i < $n) {
             $arr[] = $list[$i];
             $c++;
             $i++;
         }
         $last = $list[$i - 1];
         if ($page == $_GET['pageid'] || $page == 0 && $_GET['pageid'] == '') {
             $src = $this->Template('problems.list.page', array('lib' => $this, 'data' => $arr, 'page' => $page, 'perpage' => $problemsPerPage, 'acc.manage' => $manage, 'acc.delete' => $delete, 'acc.edit' => $edit, 'acc.rejudge' => $rejudge));
         } else {
             $src = '';
         }
         $pages->AppendPage($src, htmlspecialchars($first['name']) . ($last['name'] ? ' .. ' . htmlspecialchars($last['name']) : ''));
         $page++;
     }
     $this->CPrintLn($pages->OuterHTML());
     $this->CPrintLn($this->Template('problems.filter.form'));
 }
Example #2
0
?>
  <script language="JavaScript" type="text/javascript">
    function update () {
      var group=getElementById ('showGroup').value;
      nav ('.?group='+group);
    }
  </script>
<?php 
if (count($list) > 0) {
    global $page, $group;
    $perPage = opt_get('user_count');
    if ($perPage <= 0) {
        $perpage = 10;
    }
    $pages = new CVCPagintation();
    $pages->Init('', ($group != '' ? 'urlprefix=?group\\=' . $group . ';' : '') . 'bottomPages=false;skiponcepage=true;');
    $i = 0;
    $n = count($list);
    if ($page != '') {
        $pageid = '&page=' . $page;
    }
    while ($i < $n) {
        $c = 0;
        $pageSrc = '<table class="list">' . "\n";
        $pageSrc .= '<tr class="h"><th class="n first">№</th><th width="20%">Логин</th><th width="20%">Имя</th><th width="20%">E-Mail</th><th>Уровень доступа</th><th width="48" class="last">&nbsp;</th></tr>' . "\n";
        while ($c < $perPage && $i < $n) {
            $it = $list[$i];
            $d = !user_is_system($it['id']);
            $pageSrc .= '<tr' . ($i == $n - 1 || $c == $perPage - 1 ? ' class="last"' : '') . '><td class="n">' . ($i + 1) . '.</td>' . '<td><a href=".?action=edit&id=' . $it['id'] . '&' . get_filters() . $pageid . '">' . $it['login'] . '</a></td>' . '<td>' . $it['name'] . '</td><td><a href="mailto:' . $it['email'] . '" title="Отправить письмо">' . $it['email'] . '</a></td>' . '<td>' . security_access_title($it['access']) . '</td>' . '<td align="right">' . stencil_ibtnav('edit.gif', '?action=edit&id=' . $it['id'] . '&' . get_filters() . $pageid, 'Изменить элемент') . stencil_ibtnav($d ? 'cross.gif' : 'cross_d.gif', $d ? '?action=delete&id=' . $it['id'] . '&' . get_filters() . $pageid : '', 'Удалить этот элемент', 'Удалить этот элемент?') . '</td></tr>' . "\n";
            $c++;
            $i++;