예제 #1
0
 private static function fixNames(array $nodes)
 {
     $uids = array();
     foreach ($nodes as $k => $v) {
         if (null !== $v->uid and !is_object($v->uid)) {
             $uids[] = $v->uid;
         }
         if (null !== $v->node) {
             $uids[] = $v->node;
         }
     }
     if (empty($uids)) {
         $users = array();
     } else {
         $users = Node::find(context::last()->db, array('id' => array_unique($uids)));
     }
     foreach ($nodes as $k => $v) {
         if (null !== $v->uid and !is_object($v->uid) and array_key_exists($v->uid, $users)) {
             $v->uid = $users[$v->uid];
         }
         if (null !== $v->node and array_key_exists($v->node, $users)) {
             $v->node = $users[$v->node];
         }
         $nodes[$k] = $v->getRaw();
     }
     return $nodes;
 }
예제 #2
0
 private function getAllowedTypes()
 {
     $u = context::last()->user;
     if ($this->anonymous) {
         $u = $u->getAnonymous();
     }
     return $u->getAccess(ACL::CREATE);
 }