public function onRun() { $this->addAssets(); $user = $this->getUser(); $this->page['options'] = Usermeta::getOptions(); $this->page['user'] = $user; }
/** * Render the registration form. Override the partial "register-form" * in the active theme to customize the registration form */ public function onRegister() { $options = Usermeta::getOptions(); return $this->renderPartial('@modalDisplay', ['title' => Lang::get('dma.friends::lang.userLogin.registerTitle'), 'content' => $this->renderPartial('register-form', ['options' => $options, 'avatars' => $this->getAvatars(), 'terms' => $this->renderPartial('terms-and-conditions.htm')])]); }
/** * @SWG\Definition( * definition="response.profile.options", * type="object", * @SWG\Property( * property="gender", * type="array", * items=@SWG\Schema(type="string") * ), * @SWG\Property( * property="race", * type="array", * items=@SWG\Schema(type="string") * ), * @SWG\Property( * description="Currently hardcode to return only USA states", * property="states", * type="array", * items=@SWG\Schema(ref="#/definitions/state") * ), * @SWG\Property( * property="household_income", * type="array", * items=@SWG\Schema(type="string") * ), * @SWG\Property( * property="education", * type="array", * items=@SWG\Schema(type="string") * ), * @SWG\Property( * property="avatars", * type="array", * items=@SWG\Schema(type="string") * ) * ) * * * @SWG\Get( * path="users/profile-options/{field}", * description="Returns user profile options", * summary="Get profile options", * tags={ "user"}, * * @SWG\Parameter( * description="Return options only for the given field", * in="path", * name="field", * required=false, * type="string", * enum={"gender", "race", "states", "household_income", "education", "avatars"} * ), * * @SWG\Response( * response=200, * description="Successful response", * @SWG\Schema(ref="#/definitions/response.profile.options") * ), * @SWG\Response( * response=500, * description="Unexpected error", * @SWG\Schema(ref="#/definitions/error500") * ), * @SWG\Response( * response=404, * description="Not Found", * @SWG\Schema(ref="#/definitions/error404") * ) * ) */ public function profileOptions($field = null) { $opts = null; // Options from Usermeta $options = Usermeta::getOptions(); // Avatar options as is used in the UserProfile component $options['avatars'] = $this->getThemeAvatarOptions(); if (!is_null($field)) { $fieldOpts = array_get($options, strtolower(trim($field)), null); if (!is_null($fieldOpts)) { $opts = [$field => $fieldOpts]; } else { $message = 'Valid fields are: [ ' . implode(', ', array_keys($options)) . ' ]'; return Response::api()->errorInternalError($message); } } else { $opts = $options; // Return all } return $opts; }