function __construct() { if ($this->provider === null) { $this->provider = new SQLContactsProvider(); } $this->relationsManager = RelationsManager::getInstance(); $this->impressionsManager = ImpressionsManager::getInstance(); }
private function __construct() { $this->tablesManager = TablesManager::getInstance(); $this->fieldsManager = FieldsManager::getInstance(); $this->metaManager = MetaManager::getInstance(); $this->relationsManager = RelationsManager::getInstance(); $this->itemsManager = ItemsManager::getInstance(); $this->commentsManager = CommentsManager::getInstance(); $this->tablesMeta = []; }
public static function getRecentsContacts($params) { $myProcManager = ProcManager::getInstance(); $currentUserId = $myProcManager->getCurrentProcess()->getLoginContext()->getEyeosUser()->getId(); $myRelationManager = RelationsManager::getInstance(); $lastRelationIds = $myRelationManager->getLastRelationsId($currentUserId, $params); $results = array(); $peopleController = PeopleController::getInstance(); foreach ($lastRelationIds as $resultId) { $result = $peopleController->getContact($currentUserId, $resultId); if ($result->getRelation()->getSourceId() != $currentUserId) { $contactId = $result->getRelation()->getSourceId(); } else { $contactId = $result->getRelation()->getTargetId(); } $state = $result->getRelation()->getState(); $lists = array(); $listsName = array(); $tagsPerImpression = ImpressionsManager::getInstance()->getTagsPerImpression($result->getImpression()); foreach ($tagsPerImpression as $tagPerImpression) { $lists[] = $tagPerImpression->getTagId(); $listsName[] = $peopleController->getTagName($tagPerImpression->getTagId()); } $otherUser = UMManager::getInstance()->getUserById($contactId); $meta = MetaManager::getInstance()->retrieveMeta($otherUser)->getAll(); $results[] = array('id' => $contactId, 'nickname' => $otherUser->getName(), 'lists' => $lists, 'listsName' => $listsName, 'state' => $state, 'meta' => $meta); } return $results; }
/** * Функция обновляет список связей с другими таблицами для данной * @param $table имя таблицы */ public function updateRelationList($table) { $node = $this->load($table); if ($node->dry()) { return false; } $relations = RelationsManager::getInstance()->getRelations($table); unset($this->tables[$table]); $node->relations = json_encode($relations); $node->save(); }
public static function getInstance() { if (self::$Instance === null) { self::$Instance = new RelationsManager(); } return self::$Instance; }
public static function searchPeople($params) { //Buscar en Provider con consulta rollo LIKE etc... $peopleController = PeopleController::getInstance(); $resultsSearch = $peopleController->searchContacts($params); $myProcManager = ProcManager::getInstance(); $currentUserId = $myProcManager->getCurrentProcess()->getLoginContext()->getEyeosUser()->getId(); //$peopleController = new PeopleController(); $results = array(); foreach ($resultsSearch as $result) { if ($result != $currentUserId) { // I don't want to search myself try { $user = UMManager::getInstance()->getUserById($result); } catch (Exception $e) { continue; } $settings = MetaManager::getInstance()->retrieveMeta($user); $nameOfUser = $user->getName(); $realName = $nameOfUser; $description = 'No description'; $pathImage = 'index.php?extern=images/48x48/apps/system-users.png'; if ($settings != null) { if ($settings->get('eyeos.user.firstname') != null && $settings->get('eyeos.user.lastname') != null) { $realName = $settings->get('eyeos.user.firstname') . ' ' . $settings->get('eyeos.user.lastname'); } if ($settings->get('eyeos.user.currentlife.city') != null) { $description = $settings->get('eyeos.user.currentlife.city'); } } $myRelationManager = RelationsManager::getInstance(); $relation = $myRelationManager->getRelation($result, $currentUserId); $state = $relation != null ? $relation->getState() : null; $results[] = array('userId' => $result, 'description' => $nameOfUser, 'realName' => $realName, 'state' => $state); } } return $results; }
/** * Return the contacts in the cache */ public static function getAllContacts($params) { $myProcManager = ProcManager::getInstance(); $currentUserId = $myProcManager->getCurrentProcess()->getLoginContext()->getEyeosUser()->getId(); $peopleController = PeopleController::getInstance(); $contacts = $peopleController->getAllContacts($currentUserId); $contacts = array_merge($contacts, $peopleController->getAllContactsInPending($currentUserId)); $results = array(); foreach ($contacts as $contact) { // Retrieve List information $lists = array(); $listsName = array(); $date = 0; $myRelationManager = RelationsManager::getInstance(); $relation = $contact->getRelation(); $state = $relation != null ? $relation->getState() : null; if ($state == 'accepted') { $tagsPerImpression = ImpressionsManager::getInstance()->getTagsPerImpression($contact->getImpression()); foreach ($tagsPerImpression as $tagPerImpression) { $lists[] = $tagPerImpression->getTagId(); $listsName[] = $peopleController->getTagName($tagPerImpression->getTagId()); } } $date = $contact->getRelation()->getLastModification(); //retrieve information about the meta if ($contact->getRelation()->getSourceId() != $currentUserId) { $contactId = $contact->getRelation()->getSourceId(); $confirmable = true; } else { $contactId = $contact->getRelation()->getTargetId(); $confirmable = false; } $myContact = UMManager::getInstance()->getUserById($contactId); $metaObject = MetaManager::getInstance()->retrieveMeta($myContact); if ($metaObject == null) { $meta = array(); } else { $meta = $metaObject->getAll(); } $manager = new CometManager(); $connected = $manager->isUserConnected($contactId); $results[] = array('id' => $contactId, 'nickname' => $myContact->getName(), 'state' => $state, 'confirmable' => $confirmable, 'lists' => $lists, 'listsName' => $listsName, 'meta' => $meta, 'relationDate' => $date, 'connected' => $connected); } return $results; }