コード例 #1
0
ファイル: task.php プロジェクト: ercanozkaya/com_jedi
 public function save()
 {
     parent::save();
     /**
      * FIXME It's not possible to send an empty list to remove all assignees
      */
     if (is_array($this->assignees)) {
         $table = KFactory::get('admin::com.jedi.table.tasks2members');
         $query = $table->getDatabase()->getQuery()->where('jedi_task_id', '=', $this->id);
         $rowset = $table->select($query);
         $old = array();
         $new = array_map('intval', $this->assignees);
         foreach ($rowset as $row) {
             $old[] = (int) $row->jedi_member_id;
             if (!in_array($row->jedi_member_id, $new)) {
                 $row->delete();
             }
         }
         $row = KFactory::get('admin::com.jedi.row.tasks2members');
         foreach (array_diff($new, $old) as $assignee) {
             $row->reset();
             $row->jedi_member_id = $assignee;
             $row->jedi_task_id = $this->id;
             $row->save();
         }
     }
     return $this;
 }
コード例 #2
0
ファイル: thumbnail.php プロジェクト: raeldc/com_learn
	public function save()
	{
		if ($source = $this->source) {
			if (!is_file($source->fullpath) || !$source->isImage()) {
				return false;
			}

			$image = PhpThumbFactory::create($source->fullpath)
				->setOptions(array('jpegQuality' => 50))
				->adaptiveResize($this->_thumbnail_size, $this->_thumbnail_size);

			ob_start();

			echo $image->getImageAsString();

			$str = ob_get_clean();
			$str = sprintf('data:%s;base64,%s', $source->mimetype, base64_encode($str));

			$this->setData(array(
				'files_container_id' => $source->container->id,
				'folder' => '/'.$source->relative_folder,
				'filename' => $source->name,
				'thumbnail' => $str
			));
		}

		return parent::save();
	}
コード例 #3
0
 public function save()
 {
     if ($this->isNew()) {
         $this->created_by = null;
     }
     return parent::save();
 }
コード例 #4
0
ファイル: document.php プロジェクト: kosmosby/medicine-prof
 public function save()
 {
     $this->storage_path = trim($this->storage_path);
     $translator = $this->getService('translator')->getTranslator($this->getIdentifier());
     if (!in_array($this->storage_type, array('file', 'remote')) && ($this->isModified('storage_type') || $this->isNew())) {
         $this->setStatusMessage($translator->translate('Storage type is not available'));
         $this->setStatus(KDatabase::STATUS_FAILED);
         return false;
     }
     if (empty($this->docman_category_id)) {
         if ($this->isNew()) {
             $this->setStatusMessage($translator->translate('Category cannot be empty'));
             $this->setStatus(KDatabase::STATUS_FAILED);
             return false;
         } else {
             unset($this->docman_category_id);
             unset($this->_modified['docman_category_id']);
         }
     }
     if ($this->isNew() && !empty($this->params) && empty($this->params['icon']) && $this->storage_type === 'file') {
         $icon = $this->getIconForExtension($this->extension);
         if (empty($icon)) {
             $icon = 'default';
         }
         $this->params['icon'] = $icon . '.png';
     }
     return parent::save();
 }
コード例 #5
0
 public function save()
 {
     $source = $_FILES["file"];
     if ($source["tmp_name"]) {
         $str = $this->generateThumbnail();
         $this->setData(array('thumbnail' => $str));
     }
     $result = parent::save();
     if ($this->tags) {
         // Save selected tags to relation table 'businesses_tags'
         foreach ($this->tags as $key => $value) {
             $relation = $this->getService('com://admin/businesses.database.row.businesses_tags');
             $relation->businesses_business_id = $this->id;
             $relation->businesses_tag_id = $value;
             if (!$relation->load()) {
                 $relation->save();
             }
         }
         // Get all relation records for the selected business
         foreach ($this->getService('com://admin/businesses.model.businesses_tags')->businesses_business_id($this->id)->getList() as $key => $value) {
             // Remove all tags that are no longer selected
             if (!in_array($value->businesses_tag_id, $this->tags)) {
                 $this->getService('com://admin/businesses.model.businesses_tags')->businesses_business_id($this->id)->businesses_tag_id($value->businesses_tag_id)->getItem()->delete();
             }
         }
     }
     return $result;
 }
コード例 #6
0
 public function save()
 {
     $source = $_FILES["file"];
     if ($source["tmp_name"]) {
         $str = $this->generateThumbnail();
         $this->setData(array('thumbnail' => $str));
     }
     return parent::save();
 }
コード例 #7
0
 /**
  * @return bool|void
  */
 public function save()
 {
     if (!$this->load() && !$this->getOriginal()->original) {
         $this->original = 1;
         $this->translated = 1;
     }
     $this->lang = substr(JFactory::getLanguage()->getTag(), 0, 2);
     parent::save();
 }
コード例 #8
0
 public function save()
 {
     if ($source = $this->source) {
         if (!$source->isNew()) {
             $str = $source->thumbnail_string ? $source->thumbnail_string : $this->generateThumbnail();
             $this->setData(array('files_container_id' => $source->container->id, 'folder' => $source->folder, 'filename' => $source->name, 'thumbnail' => $str));
         } else {
             return false;
         }
     }
     return parent::save();
 }
コード例 #9
0
ファイル: activity.php プロジェクト: kosmosby/medicine-prof
 public function save()
 {
     if (!in_array($this->application, array('admin', 'site'))) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage('Invalid application value');
         return false;
     }
     if (!in_array($this->type, array('com'))) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage('Invalid type value');
         return false;
     }
     if (!$this->status) {
         // Attempt to provide a default status.
         switch ($this->action) {
             case 'add':
                 $status = KDatabase::STATUS_CREATED;
                 break;
             case 'edit':
                 $status = KDatabase::STATUS_UPDATED;
                 break;
             case 'delete':
                 $status = KDatabase::STATUS_DELETED;
                 break;
             default:
                 $status = null;
         }
         if ($status) {
             $this->status = $status;
         }
     }
     foreach ($this->_required as $column) {
         if (empty($this->{$column})) {
             $this->setStatus(KDatabase::STATUS_FAILED);
             $this->setStatusMessage('Missing required data');
             return false;
         }
     }
     if ($this->isModified('metadata') && !is_null($this->metadata)) {
         // Encode meta data.
         $metadata = json_encode($this->metadata);
         if ($metadata === false) {
             $this->setStatus(KDatabase::STATUS_FAILED);
             $this->setStatusMessage('Unable to encode meta data');
             return false;
         }
         $this->metadata = $metadata;
     }
     return parent::save();
 }
コード例 #10
0
 public function save()
 {
     $return = parent::save();
     if ($return && $this->row && $this->table) {
         $relation = $this->getService('com://admin/attachments.database.row.relation');
         $relation->attachments_attachment_id = $this->id;
         $relation->table = $this->table;
         $relation->row = $this->row;
         if (!$relation->load()) {
             $relation->save();
         }
     }
     return $return;
 }
コード例 #11
0
 public function save()
 {
     $modified = $this->getModified();
     if ($result = parent::save()) {
         if (in_array('start_date', $modified) || in_array('end_date', $modified)) {
             // Remove all the days for this event
             foreach ($this->getService('com://admin/calendar.model.days')->event($this->id)->getList() as $value) {
                 $this->getService('com://admin/calendar.model.days')->id($value->id)->getItem()->delete();
             }
             $days = date('Ymd', strtotime($this->end_date)) - date('Ymd', strtotime($this->start_date));
             $nextday = $this->start_date;
             $i = '0';
             while ($days >= $i) {
                 $row = $this->getService('com://admin/calendar.database.row.day');
                 // Set $day based on the $ier
                 if ($i == '0') {
                     $day = $this->start_date;
                 } elseif ($i == $days) {
                     $day = $this->end_date;
                 } else {
                     $day = strtotime('+1 day', strtotime($day));
                     $day = date('Y-m-d', $day);
                 }
                 // Set $level based on the first day of the event or when the event spreads across multiple weeks
                 if ($i == '0') {
                     $level = $this->getService('com://admin/calendar.model.days')->month(date('m', strtotime($day)))->day(date('d', strtotime($day)))->sort('level')->getList()->top()->level;
                     $level = $level + 1;
                 } elseif (date('W', strtotime($previousDay)) != date('W', strtotime($day))) {
                     $level = $this->getService('com://admin/calendar.model.days')->month(date('m', strtotime($day)))->day(date('d', strtotime($day)))->sort('level')->getList()->top()->level;
                     $level = $level + 1;
                 }
                 $row->calendar_event_id = $this->id;
                 $row->date = strtotime($day);
                 $row->year = date('Y', strtotime($day));
                 $row->month = date('m', strtotime($day));
                 $row->day = date('d', strtotime($day));
                 $row->hour = date('H', strtotime($day));
                 $row->minute = date('i', strtotime($day));
                 $row->second = date('s', strtotime($day));
                 $row->week = date('W', strtotime($day));
                 $row->level = $level;
                 $row->save();
                 $previousDay = $day;
                 $i++;
             }
         }
     }
     return $result;
 }
コード例 #12
0
ファイル: container.php プロジェクト: raeldc/nooku-server
 public function save()
 {
     $is_new = $this->isNew();
     if ($is_new && $this->container) {
         $container = $this->getService('com://admin/files.model.containers')->slug($this->container)->getItem();
         if ($container->isNew()) {
             $this->setStatus(KDatabase::STATUS_FAILED);
             $this->setStatusMessage(JText::_('Invalid container'));
         }
         $this->path = rtrim($container->path_value . $this->_data['path'], '/');
         $obj = $container->getParameters()->getData();
         unset($obj->container);
         $this->parameters = json_encode($obj);
     }
     $result = parent::save();
     return $result;
 }
コード例 #13
0
 public function save()
 {
     //Set the introtext and the full text
     $text = str_replace('<br>', '<br />', $this->text);
     $pattern = '#<hr\\s+id=("|\')system-readmore("|\')\\s*\\/*>#i';
     if (preg_match($pattern, $text)) {
         list($introtext, $fulltext) = preg_split($pattern, $text, 2);
         $this->introtext = trim($introtext);
         $this->fulltext = trim($fulltext);
     } else {
         $this->introtext = trim($text);
         $this->fulltext = '';
     }
     $modified = $this->_modified;
     $result = parent::save();
     return $result;
 }
コード例 #14
0
 public function save()
 {
     //Set the section_id based on the category_id
     if (isset($this->_modified['category_id'])) {
         if ($this->category_id != 0) {
             $this->_data['section_id'] = $this->getService('com://admin/categories.model.categories')->set('id', $this->category_id)->getItem()->section_id;
         } else {
             $this->_data['section_id'] = 0;
         }
     }
     //Set the introtext and the full text
     $text = str_replace('<br>', '<br />', $this->text);
     $pattern = '#<hr\\s+id=("|\')system-readmore("|\')\\s*\\/*>#i';
     if (preg_match($pattern, $text)) {
         list($introtext, $fulltext) = preg_split($pattern, $text, 2);
         $this->introtext = trim($introtext);
         $this->fulltext = trim($fulltext);
     } else {
         $this->introtext = trim($text);
         $this->fulltext = '';
     }
     //Validate the title
     if (empty($this->title)) {
         $this->_status = KDatabase::STATUS_FAILED;
         $this->_status_message = JText::_('Article must have a title');
         return false;
     }
     $modified = $this->_modified;
     $result = parent::save();
     //Set the featured
     if (isset($modified['featured'])) {
         $featured = $this->getService('com://admin/articles.database.row.featured');
         $featured->id = $this->id;
         if ($this->featured) {
             if (!$featured->load()) {
                 $featured->save();
             }
         } else {
             if ($featured->load()) {
                 $featured->delete();
             }
         }
     }
     return $result;
 }
コード例 #15
0
ファイル: thumbnail.php プロジェクト: raeldc/nooku-server
 public function save()
 {
     if ($source = $this->source) {
         if (is_file($source->fullpath) && $source->isImage()) {
             //Load the library
             $this->getService('koowa:loader')->loadIdentifier('com://admin/files.helper.phpthumb.phpthumb');
             //Creat the thumb
             $image = PhpThumbFactory::create($source->fullpath)->setOptions(array('jpegQuality' => 50))->adaptiveResize($this->_thumbnail_size, $this->_thumbnail_size);
             ob_start();
             echo $image->getImageAsString();
             $str = ob_get_clean();
             $str = sprintf('data:%s;base64,%s', $source->mimetype, base64_encode($str));
             $this->setData(array('files_container_id' => $source->container->id, 'folder' => '/' . $source->relative_folder, 'filename' => $source->name, 'thumbnail' => $str));
         } else {
             return false;
         }
     }
     return parent::save();
 }
コード例 #16
0
 /**
  * Saves the row to the database.
  *
  * This performs an update on all children rows when the path changes.
  *
  * @return KDatabaseRowAbstract
  */
 public function saves()
 {
     if (!empty($this->id)) {
         $id = $this->id;
         $table = KFactory::get($this->getTable());
         $query = $table->getDatabase()->getQuery();
         $query->where('path', 'like', '%' . $id . '%');
         $path = $this->path;
         $path = $path ? $path . '/' . $id : $id;
         foreach ($table->select($query) as $row) {
             $parts = explode($id, $row->path);
             $part = isset($parts[1]) ? $parts[1] : null;
             $row->path = $path . $part;
             $row->save();
         }
     }
     parent::save();
     return $this;
 }
コード例 #17
0
ファイル: user.php プロジェクト: kedweber/com_profile
 /**
  * Saves the row to the database. And saves a Joomla User.
  *
  * This performs an intelligent insert/update and reloads the properties
  * with fresh data from the table on success.
  *
  * @return boolean	If successfull return TRUE, otherwise FALSE
  */
 public function save()
 {
     $user = JUser::getInstance();
     if (isset($this->_modified['password'])) {
         $data = array('id' => $this->id, 'name' => $this->name, 'username' => $this->username, 'email' => $this->email, 'groups' => $this->groups);
         if ($this->password !== '' && $this->password_verify !== '') {
             $data['password'] = $this->password;
             $data['password2'] = $this->password_verify;
         }
         $user->id = $this->id;
         $user->bind($data);
         if ($this->isNew() && empty($this->password)) {
             JFactory::getApplication()->redirect(KRequest::referrer(), 'No password.', 'error');
         }
         if (!$user->save()) {
             JFactory::getApplication()->redirect(KRequest::referrer(), 'Error while saving Joomla user.', 'error');
         }
     }
     if ($this->isNew()) {
         $this->setData(array('id' => $user->id, 'profile_user_id' => $user->id));
     }
     parent::save();
 }
コード例 #18
0
ファイル: module.php プロジェクト: raeldc/com_learn
	/**
	 * Saves the row to the database.
	 *
	 * This performs an intelligent insert/update and reloads the properties
	 * with fresh data from the table on success.
	 *
	 * @return boolean	If successfull return TRUE, otherwise FALSE
	 */
	public function save()
	{
		$modified	= $this->getModified();
		$result		= parent::save();

		if(in_array('pages', $modified)) 
		{
		    $table = KFactory::get('com://admin/extensions.database.table.menus');
		
		    //Clean up existing assignemnts
		    $table->select(array('moduleid' => $this->id))->delete();

		    if(is_array($this->pages)) 
		    {
                foreach($this->pages as $page)
			    {
				    $table
					    ->select(null, KDatabase::FETCH_ROW)
					    ->setData(array(
							'moduleid'	=> $this->id,
							'menuid'	=> $page
				    	))
					    ->save();
			    }

		    } 
		    elseif($this->pages == 'all') 
		    {
                $table
				    ->select(null, KDatabase::FETCH_ROW)
				    ->setData(array(
						'moduleid'	=> $this->id,
						'menuid'	=> 0
			    	))
				    ->save();
		    }
		}
													
		return $result;
    }
コード例 #19
0
 /**
  * Puts the node into the tree before saving the row. 
  *
  * @return boolean  If successfull return TRUE, otherwise FALSE
  */
 public function save()
 {
     // If there is no instruction to move the node, proceed to saving as usual
     if (!isset($this->_data['tree_location'])) {
         return parent::save();
     }
     $target = $this->getTable()->select($this->_data['target_id'], KDatabase::FETCH_ROW);
     $parent = null;
     // Lock the table
     //$this->getTable()->lock();
     // This switch statement is for avoiding repeating code in the next switch statements
     switch ($this->_data['tree_location']) {
         case 'before':
         case 'after':
             // Don't allow ROOT to have siblings
             if (!$target->level) {
                 throw new KDatabaseRowException('ROOT can not have siblings');
             }
             $parent = $target->parent;
             break;
         case 'firstchild':
         case 'lastchild':
             $parent = $target->id;
             break;
     }
     if ($this->_new) {
         switch ($this->_data['tree_location']) {
             case 'before':
                 $this->_insertBeforeSibling($target);
                 break;
             case 'after':
                 $this->_insertAfterSibling($target);
                 break;
             case 'firstchild':
                 $this->_insertAsFirstChild($target);
                 break;
             case 'lastchild':
                 $this->_insertAsLastChild($target);
                 break;
         }
     } else {
         // Check the instruction from tree_location where the node should be moved
         switch ($this->_data['tree_location']) {
             case 'before':
                 $this->_moveBeforeSibling($target);
                 break;
             case 'after':
                 $this->_moveAfterSibling($target);
                 break;
             case 'firstchild':
                 $this->_moveAsFirstChild($target);
                 break;
             case 'lastchild':
                 $this->_moveAsLastChild($target);
                 break;
         }
     }
     // Change the parent only if tree location was specified
     if (!is_null($parent)) {
         $this->parent = $parent;
     }
     // Unset tree_location after moving or inserting. This avoids problems with sluggable behavior.
     unset($this->_data['tree_location']);
     $result = parent::save();
     //$this->getTable()->unlock();
     return $result;
 }
コード例 #20
0
ファイル: user.php プロジェクト: raeldc/nooku-server
 public function save()
 {
     jimport('joomla.user.helper');
     // Load the old row if editing an existing user.
     if (!$this->_new) {
         $old_row = $this->getService('com://admin/users.database.table.users')->select($this->id, KDatabase::FETCH_ROW);
     }
     $user = JFactory::getUser();
     // Validate received data.
     if (($this->_new || isset($this->_modified['name'])) && trim($this->name) == '') {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_('Please enter a name!'));
         return false;
     }
     if (($this->_new || isset($this->_modified['username'])) && trim($this->username) == '') {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_('Please enter a username!'));
         return false;
     }
     if (($this->_new || isset($this->_modified['username'])) && preg_match('#[<>"\'%;()&]#i', $this->username) || strlen(utf8_decode($this->username)) < 2) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_('Please enter a valid username. No spaces, at least 2 characters ' . 'and must contain <strong>only</strong> letters and numbers.'));
         return false;
     }
     if (isset($this->_modified['username'])) {
         $query = $this->getTable()->getDatabase()->getQuery()->where('username', '=', $this->username)->where('id', '<>', (int) $this->id);
         $total = $this->getService('com://admin/users.database.table.users')->count($query);
         if ($total) {
             $this->setStatus(KDatabase::STATUS_FAILED);
             $this->setStatusMessage(JText::_('This username is already in use.'));
             return false;
         }
     }
     if (($this->_new || isset($this->_modified['email'])) && trim($this->email) == '' || !$this->getService('koowa:filter.email')->validate($this->email)) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_('Please enter a valid e-mail address.'));
         return false;
     }
     if (isset($this->_modified['email'])) {
         $query = $this->getTable()->getDatabase()->getQuery()->where('email', '=', $this->email)->where('id', '<>', (int) $this->id);
         $total = $this->getService('com://admin/users.database.table.users')->count($query);
         if ($total) {
             $this->setStatus(KDatabase::STATUS_FAILED);
             $this->setStatusMessage(JText::_('This e-mail address is already registered.'));
             return false;
         }
     }
     /*
      * If username field is an email it has to be the same with email field.
      * This removes the possibilitiy that a user can get locked out of her account
      * if someone else uses that username as the email field.
      */
     if (KService::get('koowa:filter.email')->validate($this->username) === true && $this->username !== $this->email) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_('Your e-mail and username should match if you want to use an e-mail address as your username.'));
         return false;
     }
     // Don't allow users to block themselves.
     if (isset($this->_modified['enabled']) && !$this->_new && $user->id == $this->id && !$this->enabled) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_("You can't block yourself!"));
         return false;
     }
     // Don't allow to save a user without a group.
     if (($this->_new || isset($this->_modified['users_group_id'])) && !$this->users_group_id) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_("You can't create a user without a user group."));
         return false;
     }
     // Don't allow users below super administrator to edit a super administrator.
     if (!$this->_new && isset($this->_modified['users_group_id']) && $old_row->users_group_id == 25 && $user->gid != 25) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_("You can't edit a super administrator account."));
         return false;
     }
     // Don't allow users below super administrator to create an administrators.
     if (isset($this->_modified['users_group_id']) && $this->users_group_id == 24 && !($user->gid == 25 || $user->id == $this->id && $user->gid == 24)) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_("You can't create a user with this user group level. " . "Only super administrators have this ability."));
         return false;
     }
     // Don't allow users below super administrator to create a super administrator.
     if (isset($this->_modified['users_group_id']) && $this->users_group_id == 25 && $user->gid != 25) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_("You can't create a user with this user group level. " . "Only super administrators have this ability."));
         return false;
     }
     // Don't allow users to change the user level of the last active super administrator.
     if (isset($this->_modifid['users_group_id']) && $old_row->users_group_id != 25) {
         $query = $this->getTable()->getDatabase()->getQuery()->where('users_group_id', '=', 25)->where('enabled', '=', 1);
         $total = $this->getService('com://admin/users.database.table.users')->count($query);
         if ($total <= 1) {
             $this->setStatus(KDatabase::STATUS_FAILED);
             $this->setStatusMessage(JText::_("You can't change this user's group because " . "the user is the only active super administrator for your site."));
             return false;
         }
     }
     // Check if passwords match.
     if (isset($this->_modified['password']) && $this->password != $this->password_verify) {
         $this->setStatus(KDatabase::STATUS_FAILED);
         $this->setStatusMessage(JText::_("Passwords don't match!"));
         return false;
     }
     // Generate a random password if empty and the record is new.
     if ($this->_new && !$this->password) {
         $this->password = $this->getService('com://admin/users.helper.password')->getRandom();
         $this->password_verify = $this->password;
     }
     if (isset($this->_modified['password']) && $this->password) {
         // Encrypt password.
         $salt = $this->getService('com://admin/users.helper.password')->getRandom(32);
         $password = $this->getService('com://admin/users.helper.password')->getCrypted($this->password, $salt);
         $this->password = $password . ':' . $salt;
     } else {
         $this->password = $old_row->password;
         unset($this->_modified['password']);
     }
     if ($this->_new) {
         $this->registered_on = gmdate('Y-m-d H:i:s', time());
     }
     $query = $this->getTable()->getDatabase()->getQuery()->select('name')->where('id', '=', $this->users_group_id);
     $this->group_name = $this->getService('com://admin/users.database.table.groups')->select($query, KDatabase::FETCH_FIELD);
     // Set parameters.
     if (isset($this->_modified['params'])) {
         $params = new JParameter('');
         $params->bind($this->_data['params']);
         $this->params = $params->toString();
         if (!$this->_new && $this->_data['params'] == $old_row->params->toString()) {
             unset($this->_modified['params']);
         }
     }
     // Need to reverse the value of 'enabled', because the mapped column is 'block'.
     if ($this->_new || isset($this->_modified['enabled'])) {
         $this->enabled = $this->enabled ? 0 : 1;
     }
     if (!parent::save()) {
         return false;
     }
     // Syncronize ACL.
     if ($this->_status == KDatabase::STATUS_CREATED) {
         $aro = $this->getService('com://admin/groups.database.row.aro')->setData(array('section_value' => 'users', 'value' => $this->id, 'name' => $this->name));
         $aro->save();
         $this->getService('com://admin/groups.database.row.arosgroup')->setData(array('group_id' => $this->users_group_id, 'aro_id' => $aro->id))->save();
     } else {
         if (isset($this->_modified['name']) || isset($this->_modified['users_group_id'])) {
             $aro = $this->getService('com://admin/groups.database.table.aros')->select(array('value' => $this->id), KDatabase::FETCH_ROW);
             if (isset($this->_modified['name'])) {
                 $aro->name = $this->name;
                 $aro->save();
             }
             if (isset($this->_modified['users_group_id'])) {
                 $this->getService('com://admin/groups.database.table.arosgroups')->select(array('aro_id' => $aro->id), KDatabase::FETCH_ROW)->delete();
                 $this->getService('com://admin/groups.database.table.arosgroups')->select(null, KDatabase::FETCH_ROW)->setData(array('group_id' => $this->users_group_id, 'aro_id' => $aro->id))->save();
             }
         }
     }
     return true;
 }