public function addUserForm($grpId)
 {
     $this->loadClass('form', 'htmlelements');
     $objForm = new form('adduser', $this->uri(array('action' => 'editgrp', 'id' => $grpId)));
     //,'htmlelements');
     // Create the selectbox object
     // $this->loadClass('selectbox','htmlelements');
     $objSelectBox = $this->newObject('selectbox', 'htmlelements');
     // Initialise the selectbox.
     $objSelectBox->create($objForm, 'leftList[]', 'Available Users', 'rightList[]', 'Users to add');
     // Populate the selectboxes
     //$objData = &$this->getObject('data');
     $data = $this->getAllUsers();
     $currentUsers = $this->getUsersInGroup($grpId);
     foreach ($data as $i => $user) {
         foreach ($currentUsers as $currentUser) {
             if ($currentUser['auth_user_id'] == $user['auth_user_id']) {
                 unset($data[$i]);
                 break 1;
             }
         }
     }
     $userArr = array();
     foreach ($data as $user) {
         $usr['label'] = $this->objUser->fullName($user['auth_user_id']);
         $usr['value'] = $user['perm_user_id'];
         $userArr[] = $usr;
     }
     $objSelectBox->insertLeftOptions($userArr, 'value', 'label');
     $objSelectBox->insertRightOptions(array());
     // Insert the selectbox into the form object.
     $objForm->addToForm($objSelectBox->show());
     // Get and insert the save and cancel form buttons
     $arrFormButtons = $objSelectBox->getFormButtons();
     $objForm->addToForm(implode(' / ', $arrFormButtons));
     // Show the form
     return $objForm->show();
 }
Example #2
0
 /**
  * Method to set the name of a group.
  *
  * The unique id will not change, only the name field value.
  *
  * @access public
  * @param  string     The      unique ID of an existing group.
  * @param  string     $newName the updated name for this group.
  * @return true|false true if successful, otherwise false.
  */
 public function setName($groupId, $newName)
 {
     $updates = array();
     $updates['name'] = $newName;
     $updates['last_updated_by'] = $this->_objUsers->userId();
     $updates['last_updated'] = $this->now();
     //date("Y:m:d H:i:s");
     return $this->update('id', $groupId, $updates);
 }