Esempio n. 1
0
 /**
  * @param string $classes
  *
  * @return AbstractHtmlElement
  */
 public function addCssClasses($classes)
 {
     $addedClasses = ' ';
     if ($this->attributes->exists('class')) {
         $addedClasses .= Type::string($this->attributes->get('class'));
     }
     $this->attributes->add(['class' => $classes . $addedClasses]);
     return $this;
 }
Esempio n. 2
0
 /**
  * @param string $name
  * @param string $password
  * @return Result
  */
 public function login($name, $password)
 {
     $result = new Result();
     $name = Type::string($name);
     $password = Type::string($password);
     if ($this->isLoggedIn()) {
         $result->addValue($this->session->get('user_id'));
         return $result;
     }
     $user = $this->users->getUserByLoginData($name, $password);
     if ($user) {
         $this->session->set('user_id', $user->getId());
         $result->addValue($user->getId());
     } else {
         $result->addError(L10n::msgReplace('%s is a invalid user or wrong password.', $name));
     }
     return $result;
 }
Esempio n. 3
0
 /**
  * @param string $name
  * @param string $value
  *
  * @return string
  */
 private function renderField($name, $value)
 {
     if (trim($value) !== '') {
         if (Type::isInt($name)) {
             return " {$value}";
         } else {
             return " {$name}=\"{$value}\"";
         }
     }
     return '';
 }
Esempio n. 4
0
 /**
  * @param int $status
  *
  * @return Response
  */
 public function setStatus($status)
 {
     $this->status = Type::int($status);
     return $this;
 }