示例#1
0
 public function execute()
 {
     $app = new Sp4kAppsAccountApp(new Registry($this->state->toObject()));
     $this->item = $app->getItem();
     $this->id = $this->item->id;
     $this->created = $this->item->created;
     $accountFilter = ['filters' => ['account_id' => $this->id]];
     if ($this->item->id != null) {
         $this->item->parents = Sp4kAppsParentApp::getInstance(new Registry($accountFilter))->getItems();
         foreach ($this->item->parents as &$parent) {
             $juser = JFactory::getuser($parent->juser_id);
             $parent->name = $juser->name;
             $parent->email = $juser->email;
         }
         $this->item->children = Sp4kAppsChildApp::getInstance(new Registry($accountFilter))->getItems();
         foreach ($this->item->children as $child) {
             $this->item->registrations = $this->item->registrations + Sp4kAppsRegistrationApp::getInstance(new Registry(['filters' => ['child_id' => $child->id]]))->getItems();
         }
         $this->item->subscriptions = Sp4kAppsSubscriptionApp::getInstance(new Registry($accountFilter))->getItems();
         $this->item->orders = Sp4kAppsOrderApp::getInstance(new Registry($accountFilter))->getItems();
     }
 }
示例#2
0
 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();
     }
 }
示例#3
0
 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();
 }
示例#4
0
 private function createAcount()
 {
     $this->account = Sp4kAppsAccountApp::getInstance(new Registry())->getItem()->update();
 }
示例#5
0
 private function setAccount()
 {
     $this->account = Sp4kAppsAccountApp::getInstance(new Registry(['id' => $this->parent->account_id]))->getItem();
 }