/** * @throws \Cunity\Core\Exception * @throws \Exception */ public function __construct() { parent::__construct(); $this->registerScript("register", "registration"); $this->registerCss("register", "style"); $this->registerCunityPlugin("bootstrap-datepicker", ["css/bootstrap-datepicker.css", "js/bootstrap-datepicker.js"]); $profileFields = new ProfileFields(); $this->assign('profileFields', $profileFields->getRegistrationFields()); $this->assign('success', false); }
/** * @param $form */ private function insert($form) { switch ($form) { case 'profilefields': $object = new ProfileFields(); $newId = $object->insert($_REQUEST); $possibleValues = explode(',', $_REQUEST['possiblevalues']); $sorting = 1; foreach ($possibleValues as $_value) { $value = new ProfileFieldsValues(); $value->insert(['value' => $_value, 'profilefield_id' => $newId]); $sorting++; } break; default: break; } /** @var Table $object */ $this->sendResponse(); }
private function updateProfileFields() { $view = new \Cunity\Profile\View\ProfileEdit(); /** @noinspection PhpUndefinedMethodInspection */ $user = $this->user->getTable()->get($_SESSION['user']->userid); /** @var User $user */ $profile = $user->toArray(["userid", "username", "email", "firstname", "lastname", "registered", "pimg", "timg", "palbumid", "talbumid"]); $table = new Db\Table\Privacy(); $privacy = $table->getPrivacy(); $table = new NotificationSettings(); $notificationSettings = $table->getSettings(); $profileFields = new ProfileFields(); $view->assign('profileFields', $profileFields->getAll()); $view->assign("profile", array_merge($profile, ["privacy" => $privacy, 'notificationSettings' => $notificationSettings])); $view->render(); }
/** * @throws \Exception */ private function loadData() { $langIterator = new \DirectoryIterator("modules/Core/languages"); $designIterator = new \DirectoryIterator("../style"); foreach ($designIterator as $design) { if ($design->isDir() && $design->isReadable() && !$design->isDot()) { $this->assignments['availableDesigns'][] = [$design->getBasename(), file_get_contents($design->getRealPath() . DIRECTORY_SEPARATOR . "name.txt")]; } } foreach ($langIterator as $lang) { if ($lang->isReadable() && $lang->getExtension() == "csv") { $this->assignments['availableLanguages'][] = $lang->getBasename('.csv'); } } $profileFields = new ProfileFields(); $this->assignments['profileFields'] = $profileFields->getAll(); $this->assignments['fieldTypes'] = ProfileFields::$types; $this->assignments["config"] = Cunity::get("config"); }