protected function execute() { if ($this->state->get('paging', false)) { $limit = $this->state->get('limit'); $filters = $this->state->get('filters'); $count = $this->state->get('count', false); $appState = new Joomla\Registry\Registry(['limit' => $limit, 'count' => $count, 'filters' => $filters, 'joins' => $this->state->get('joins', false)]); /** @var Sp4kAppsAccountApp $registrationApp */ $app = Sp4kAppsAccountApp::getInstance($appState); $appCollection = $app->getCollection(); $this->count = $appCollection->count; $this->items = $appCollection->items; foreach ($this->items as &$item) { $item->parents = Sp4kAppsParentApp::getInstance(new Registry(['filters' => ['account_id' => $item->id], 'keys' => false]))->getItems(); } } else { $this->items = Sp4kAppsAccountApp::getInstance(new Joomla\Registry\Registry($this->state->toObject()))->getItems(); } }
public function update() { if (!isset($this->item->account_id)) { $account = Sp4kAppsAccountApp::getInstance(new Registry(['created' => time()]))->getItem()->update(); $this->item->account_id = $account->id; } if ($this->item->juser_id == null || $this->item->juser_id == 0) { if (isset($this->item->email) && $this->item->email != '' && trim($this->item->f_name . ' ' . $this->item->l_name) != '' && !JUserHelper::getUserId($this->item->email)) { $this->item->juser_id = $this->addJoomlaUser(strtolower($this->item->email), $this->item->f_name . ' ' . $this->item->l_name, strtolower($this->item->email), JUserHelper::genRandomPassword()); } else { $this->item->juser_id = 0; } } if ($this->state->get('children', false)) { foreach ($this->state->get('children') as $child) { $childAppItem = Sp4kAppsChildApp::getInstance(new Registry($child))->getItem(); $childAppItem->account_id = $account->id; $childAppItem->update(); } } $this->item->update(); }
private function createAcount() { $this->account = Sp4kAppsAccountApp::getInstance(new Registry())->getItem()->update(); }
private function setAccount() { $this->account = Sp4kAppsAccountApp::getInstance(new Registry(['id' => $this->parent->account_id]))->getItem(); }