public function userExists($username, $batch) { $ui = UserInfo::getByUserName($username); if (is_object($ui)) { return true; } return false; }
public function getMatchedTargetItem(Batch $batch, ItemInterface $item) { $user = UserInfo::getByUserName($item->getIdentifier()); if (is_object($user)) { $targetItem = new TargetItem($this); $targetItem->setItemId($user->getUserID()); $targetItem->setItemName($user->getUserDisplayName()); return $targetItem; } }
protected function getAssignments(AccessEntity $entity) { $class = $this->getClass($entity); $ui = UserInfo::getByUserName($entity->getUserName()); return $class::getOrCreate($ui); }
public function import(\SimpleXMLElement $sx) { if (isset($sx->pages)) { $nodes = array(); $i = 0; foreach ($sx->pages->page as $p) { $p->originalPos = $i; $nodes[] = $p; ++$i; } usort($nodes, array('static', 'setupPageNodeOrder')); $siteTree = null; if (isset($this->home)) { $home = $this->home; $siteTree = $this->home->getSiteTreeObject(); } else { $home = Page::getByID(HOME_CID, 'RECENT'); } foreach ($nodes as $px) { $pkg = static::getPackageObject($px['package']); $data = array(); $user = (string) $px['user']; if ($user != '') { $ui = UserInfo::getByUserName($user); if (is_object($ui)) { $data['uID'] = $ui->getUserID(); } else { $data['uID'] = USER_SUPER_ID; } } $cDatePublic = (string) $px['public-date']; if ($cDatePublic) { $data['cDatePublic'] = $cDatePublic; } $data['pkgID'] = 0; if (is_object($pkg)) { $data['pkgID'] = $pkg->getPackageID(); } $args = array(); $ct = Type::getByHandle($px['pagetype']); $template = Template::getByHandle($px['template']); if ($px['path'] != '') { // not home page $page = Page::getByPath($px['path'], 'RECENT', $siteTree); if (!is_object($page) || $page->isError()) { $lastSlash = strrpos((string) $px['path'], '/'); $parentPath = substr((string) $px['path'], 0, $lastSlash); $data['cHandle'] = substr((string) $px['path'], $lastSlash + 1); if (!$parentPath) { $parent = $home; } else { $parent = Page::getByPath($parentPath, 'RECENT', $siteTree); } $page = $parent->add($ct, $data); } } else { $page = $home; } $args['cName'] = $px['name']; $args['cDescription'] = $px['description']; if (is_object($ct)) { $args['ptID'] = $ct->getPageTypeID(); } $args['pTemplateID'] = $template->getPageTemplateID(); $page->update($args); } } }