public static function find($alias) { if (!is_string($alias)) { throw new InvalidArgumentException("Alias must be a string. " . gettype($alias) . " given."); } $found = []; $parentAlias = str_replace('.*', '', $alias); foreach (self::$_aliases as $aliasPath => $path) { if (Text::startsWith($aliasPath, $parentAlias)) { $cleanAlias = substr_replace($aliasPath, '', 0, strlen($parentAlias) + 1); if (strlen($cleanAlias) > 0 && strpos($cleanAlias, '.') === false) { $found[] = $path; } } } return $found; }
public function actionChangepassword($id) { $auth = Mindy::app()->auth; if ($auth->isGuest) { $this->r->redirect(Mindy::app()->homeUrl); } $model = User::objects()->filter(['pk' => $id])->get(); if ($model === null) { $this->error(404); } $admin = new UserAdmin(); $this->addBreadcrumb(Text::mbUcfirst($admin->getVerboseName()), Mindy::app()->urlManager->reverse('admin:list', ['module' => User::getModuleName(), 'adminClass' => $admin->classNameShort()])); $this->addBreadcrumb((string) $model, Mindy::app()->urlManager->reverse('admin:update', ['module' => User::getModuleName(), 'adminClass' => $admin->classNameShort(), 'id' => $id])); $this->addBreadcrumb(UserModule::t('Change password')); $form = new ChangePasswordForm(['model' => $model]); if ($this->r->isPost && $form->populate($_POST)->isValid() && $form->save()) { $this->r->flash->success(UserModule::t('Password changed')); $this->r->http->refresh(); } echo $this->render('admin/changepassword.html', ['model' => $model, 'form' => $form]); }
/** * Configures an object with the initial property values. * @param object $object the object to be configured * @param array $properties the property initial values given in terms of name-value pairs. * @return object the object itself */ public static function configure($object, $properties, $autoCamelCase = false) { foreach ($properties as $name => $value) { if ($autoCamelCase) { $name = Text::toCamelCase($name); } $object->{$name} = $value; } return $object; }
public function getVerboseNameList() { return Text::mbUcfirst($this->getVerboseName()); }