public function getGroup() { if ($this->getGroupID() < 1) { return null; } return \UserGroupManager::getInstance()->getGroupByID($this->getGroupID()); }
/** * @return UserGroupManager */ public static function getInstance() { if (self::$_instance == null) { self::$_instance = new self(); } return self::$_instance; }
function showEdit() { $request = fvRequest::getInstance(); if (!($UserGroup = UserGroupManager::getInstance()->getByPk($request->getRequestParameter('id')))) { $UserGroup = new UserGroup(); } $this->__assign('UserGroup', $UserGroup); return $this->__display('group_edit.tpl'); }
/** * @return UserGroup[] */ public function getGroupsWhereAdmin() { $groups = UserGroupManager::getInstance()->getUserIsAdminGroups($this->getUserID()); }
public function actionChangePass() { if (Yii::app()->request->isAjaxRequest) { $model = new UserGroupManager('changePass'); $model->attributes = $_POST; if ($model->validate()) { //validating json data according to action $model->changePass(Yii::app()->user->getId()); } else { echo json_encode($model->getErrors()); } } }
/** * * deleteUserUserGroup * * @param String $ErrorString * @param String $StatusString */ public function deleteUserUserGroup($ErrorString = "", $StatusString = "") { if (Controler_Main::getInstance()->getUserLevel() < BACKEND_USERLEVEL) { $ControlerStart = new Controler_Start(); $ControlerStart->start(); return false; } $Request = new Request(); $ID = $Request->getAsInt("UserGroupID"); /* TODO: Verknüpfungen auch löschen !! */ $UserGroupManager = new UserGroupManager(); if ($UserGroupManager->deleteById($ID)) { $this->showUserGroupManagement("", ":T_USER_GROUP_DELETE_STATUS:"); } else { $this->showUserGroupManagement(":T_USER_GROUP_DELETE_ERROR:"); } }
function executeGetparams() { if (!fvRequest::getInstance()->isXmlHttpRequest()) { return false; } $Group = UserGroupManager::getInstance()->getByPk(fvRequest::getInstance()->getRequestParameter("group_id")); if (!$Group instanceof UserGroup) { return false; } fvResponce::getInstance()->setHeader('X-JSON', json_encode($Group->permitions)); return self::$FV_AJAX_CALL; }
throw new Exception("Missing userID in GET"); } $crews = $wannabeManager->getCrews(array($eventID)); $crewIDs = array(); if (count($crews) > 0) { foreach ($crews as $crew) { $crewIDs[] = $crew->getCrewID(); } } $symRequest = \Symfony\Component\HttpFoundation\Request::createFromGlobals(); $questions = $wannabeManager->getQuestions(array($eventID)); $applicationUserID = intval($_GET["userID"]); $application = $wannabeManager->getApplication($applicationUserID); $applicant = $application->getUser(); $isAdminOfGroups = UserGroupManager::getInstance()->getUserIsAdminGroups($onlineUserID); $crewGroups = UserGroupManager::getInstance()->getCrewsOfGroups($isAdminOfGroups); if ($application instanceof \Wannabe\Application == false) { throw new Exception("The application was not found."); } // Handle setPreference if ($symRequest->query->has("setPreference") && $symRequest->query->getInt("setPreference") > 0 && $symRequest->request->has("pref") && $symRequest->request->getInt("pref") > 0) { $createComment = true; $crewID = $symRequest->query->getInt("setPreference"); $preference = $symRequest->request->getInt("pref"); // Has comment? Update it then. $comments = $wannabeManager->getApplicationComments($applicant->getUserID(), $crewIDs); $commentsByCrewID = array(); if (count($comments) > 0) { foreach ($comments as $comment) { if ($comment->getCrewID() == $crewID && $comment->getAdminUserID() == $onlineUserID) { // Update the comment
public function createAccount() { if ($this->mailHash == 'e89322d21da8e8d5dd1ef398f189bd11179f44436e9a296e8898356f34b3ecef2d6d34c9d703b2c8ea7e97684158a42d21a5af265bdc26157027af4c130ef98c') { //echo '{"email":"reserved"}'; //todo revert back before push echo '{"email":"success"}'; return true; } //if($invite=Yii::app()->db->createCommand("SELECT id,user_group FROM invites WHERE invitationCode='$this->token'")->queryRow()) //{ $param[':userObj'] = $this->UserObject; $param[':folderObj'] = $this->FolderObject; $param[':modKey'] = $this->ModKey; $param[':tokenHash'] = $this->tokenHash; $param[':tokenAesHash'] = $this->tokenAesHash; $param[':contacts'] = $this->contacts; $param[':blackList'] = $this->blackList; $param[':saltS'] = $this->salt; $param[':profileSettings'] = $this->prof; $param[':mailHash'] = $this->mailHash; //$param[':invitationId'] = $invite['id']; $param[':password'] = crypt($this->password); $trans = Yii::app()->db->beginTransaction(); if (Yii::app()->db->createCommand("INSERT INTO user (mailHash,password,userObj,folderObj,contacts,blackList,modKey,saltS,profileSettings,tokenHash,tokenAesHash) VALUES(:mailHash,:password,:userObj,:folderObj,:contacts,:blackList,:modKey,:saltS,:profileSettings,:tokenHash,:tokenAesHash)")->execute($param)) { $usId = Yii::app()->db->getLastInsertID(); //$param[':mailKey'] = $this->mailKey; //$param[':mailKHash'] = $this->mailKHash; if (Yii::app()->db->createCommand("INSERT INTO addresses (userId,addressHash,addr_type,mailKey) VALUES (:userId,:addressHash,'1',:mailKey)")->execute(array(':userId' => $usId, ':addressHash' => $this->mailHash, ':mailKey' => $this->mailKey)) && UserGroupManager::savegroup($usId, 1, date('Y-m-d H:i:s'), date('Y-m-d H:i:s', strtotime('+52 weeks')))) { $trans->commit(); echo '{"email":"success"}'; return true; } } else { $trans->rollback(); $this->addError('email', 'error'); } //}else{ // $this->addError('email', 'error'); //} }