示例#1
0
 function get_nav_children($e)
 {
     $result = array();
     foreach ($e->children() as $e) {
         if (!$e->visible()) {
             continue;
         }
         $class = '';
         if ($e == $this->entity) {
             $class .= 'current ';
             if ($e->has_visible_children()) {
                 $class .= 'ancestor ';
             }
         } else {
             if ($e->is_ancestor_of($this->entity)) {
                 $class .= 'ancestor ';
             }
         }
         if ($e->submitable()) {
             $subm = Authentication::current_user()->status_of_last_submission_to($e);
             $class .= Status::to_css_class($subm) . ' ';
         }
         if (!$e->active()) {
             $class .= 'inactive ';
         }
         $result[] = array('title' => $e->title(), 'url' => $this->nav_script($e) . $e->path(), 'class' => $class);
     }
     return $result;
 }
示例#2
0
 private static function init()
 {
     // current user is always in group
     $user = Authentication::current_user();
     if (!$user) {
         UserGroup::$current = array();
     } else {
         UserGroup::$current = array($user);
     }
     // get from session
     UserGroup::start_session();
     foreach ($_SESSION['usergroup'] as $extra_userid) {
         UserGroup::$current[] = User::by_id($extra_userid);
     }
 }
示例#3
0
 function app_name()
 {
     static $app_name;
     if (!$app_name) {
         $user = Authentication::current_user();
         if ($user && $user->login[0] != 's' && time() / 1000 % 10 == 0) {
             // just for fun
             $app_name = "Twanthena";
         } else {
             $app_name = "Justitia";
         }
     }
     return $app_name;
 }
示例#4
0
<?php

require_once '../lib/bootstrap.inc';
// -----------------------------------------------------------------------------
// Ajax utility: return newest submissions
// -----------------------------------------------------------------------------
if (Authentication::current_user() == false) {
    echo '{"logout":"true"}';
} else {
    if (Authentication::is_admin() and isset($_GET['entity']) and isset($_GET['submissionid'])) {
        try {
            // get entity
            $entity = Entity::get($_GET['entity'], false, true);
            $submissions = $entity->submissions_after($_GET['submissionid']);
            $arr = array();
            foreach ($submissions as $s) {
                $arr[] = $s->submissionid;
            }
            echo '{"new_ids":' . json_encode($arr) . '}';
        } catch (NotFoundException $e) {
            exit;
        }
    } else {
        die("You have no rights to view this submission");
    }
}
示例#5
0
文件: index.php 项目: jlsa/justitia
 function write_overview_item($e)
 {
     if (!$e->visible()) {
         return;
     }
     $class = '';
     if ($e->submitable()) {
         $subm = Authentication::current_user()->status_of_last_submission_to($e);
         $class .= Status::to_css_class($subm) . ' ';
     }
     if (!$e->active()) {
         $class .= 'inactive ';
     }
     $this->write_block_begin($e->title(), 'collapsed linky block ' . $class, 'index.php' . $e->path());
     $this->write_block_end();
 }
示例#6
0
 static function is_admin()
 {
     $user = Authentication::current_user();
     return $user && $user->is_admin;
 }