/** * Save a collection * * @return string */ private function _savecollection() { // Check for request forgeries Request::checkToken(); if (User::isGuest()) { return $this->_login(); } if (!$this->params->get('access-edit-collection') || !$this->params->get('access-create-collection')) { $this->setError(Lang::txt('PLG_GROUPS_COLLECTIONS_NOT_AUTH')); return $this->_collections(); } // Incoming $fields = Request::getVar('fields', array(), 'post', 'none', 2); $fields['id'] = intval($fields['id']); // Bind new content $row = new \Components\Collections\Models\Collection(); if (!$row->bind($fields)) { $this->setError($row->getError()); return $this->_editcollection($row); } // Store new content if (!$row->store()) { $this->setError($row->getError()); return $this->_editcollection($row); } $row->item()->tag(trim(Request::getVar('tags', ''))); // Redirect to collection App::redirect(Route::url('index.php?option=' . $this->option . '&cn=' . $this->group->get('cn') . '&active=' . $this->_name . '&scope=' . $row->get('alias'))); }
/** * Save a collection * * @return string */ private function _savecollection() { // Check for request forgeries Request::checkToken(); if (User::isGuest()) { return $this->_login(); } if (!$this->params->get('access-edit-collection') || !$this->params->get('access-create-collection')) { $this->setError(Lang::txt('PLG_GROUPS_COLLECTIONS_NOT_AUTH')); return $this->_collections(); } // Incoming $fields = Request::getVar('fields', array(), 'post', 'none', 2); $fields['id'] = intval($fields['id']); // Bind new content $collection = new \Components\Collections\Models\Collection(); if (!$collection->bind($fields)) { $this->setError($collection->getError()); return $this->_editcollection($collection); } if ($collection->get('access') != 0 && $collection->get('access') != 4) { $collection->set('access', 0); } // Store new content if (!$collection->store()) { $this->setError($collection->getError()); return $this->_editcollection($collection); } $url = Route::url('index.php?option=' . $this->option . '&cn=' . $this->group->get('cn') . '&active=' . $this->_name . '&scope=' . $collection->get('alias')); // Record the activity $recipients = array(['group', $this->group->get('gidNumber')], ['collection', $collection->get('id')], ['user', $collection->get('created_by')]); $recipients[] = ['user', $collection->get('created_by')]; foreach ($this->group->get('managers') as $recipient) { $recipients[] = ['user', $recipient]; } Event::trigger('system.logActivity', ['activity' => ['action' => $fields['id'] ? 'updated' : 'created', 'scope' => 'collections.collection', 'scope_id' => $collection->get('id'), 'description' => Lang::txt('PLG_GROUPS_COLLECTIONS_ACTIVITY_COLLECTION_' . ($fields['id'] ? 'UPDATED' : 'CREATED'), '<a href="' . $url . '">' . $collection->get('title') . '</a>'), 'details' => array('title' => $collection->get('title'), 'id' => $collection->get('id'), 'url' => $url)], 'recipients' => $recipients]); // Redirect to collection App::redirect($url); }
/** * Save a collection * * @return string */ private function _savecollection() { // Check for request forgeries Request::checkToken(); // Login check if (User::isGuest()) { return $this->_login(); } // Access check if (!$this->params->get('access-edit-collection') || !$this->params->get('access-create-collection')) { $this->setError(Lang::txt('PLG_MEMBERS_' . strtoupper($this->_name) . '_NOT_AUTHORIZED')); return $this->_collections(); } // Incoming $fields = Request::getVar('fields', array(), 'post', 'none', 2); $fields['id'] = intval($fields['id']); // Bind new content $row = new \Components\Collections\Models\Collection(); if (!$row->bind($fields)) { $this->setError($row->getError()); return $this->_editcollection($row); } if ($row->get('access') != 0 && $row->get('access') != 4) { $row->set('access', 0); } // Store new content if (!$row->store()) { $this->setError($row->getError()); return $this->_editcollection($row); } // Redirect to collection App::redirect(Route::url($this->member->getLink() . '&active=' . $this->_name . '&task=all')); }
<input type="hidden" name="collection_id" value="<?php echo $this->filters['collection_id']; ?> " /> </fieldset> <table class="adminlist"> <thead> <?php if ($this->filters['collection_id']) { ?> <tr> <th colspan="6"> <?php $collection = new \Components\Collections\Models\Collection($this->filters['collection_id']); ?> (<?php echo $this->escape(stripslashes($collection->get('alias'))); ?> ) <?php echo $this->escape(stripslashes($collection->get('title'))); ?> </th> </tr> <?php } ?> <tr> <th scope="col"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php
/** * Remove all user blog entries for the given user ID * * Method is called after user data is deleted from the database * * @param array $user Holds the user data * @param boolean $success True if user was succesfully stored in the database * @param string $msg Message * @return boolean */ public function onMemberAfterDelete($user, $success, $msg) { if (!$success) { return false; } $userId = \Hubzero\Utility\Arr::getValue($user, 'id', 0, 'int'); if ($userId) { try { include_once PATH_CORE . DS . 'components' . DS . 'com_collections' . DS . 'models' . DS . 'archive.php'; $db = App::get('db'); $model = new \Components\Collections\Tables\Collection($db); $entries = $model->find('list', array('created_by' => $userId)); foreach ($entries as $entry) { $entry = new \Components\Collections\Models\Collection($entry); if (!$entry->delete()) { throw new Exception($entry->getError()); } } } catch (Exception $e) { return false; } } return true; }