Example #1
0
 public function Check($value)
 {
     $isArray = is_array($value);
     $this->error = '';
     if ($this->trimValue && !$isArray) {
         $value = String::Trim($value);
     }
     if ($value === '' || $isArray && count($value) == 0) {
         $this->error = self::Missing;
     }
     return $this->error == '';
 }
Example #2
0
 /**
  * The form value as submitted
  * @param string $name The field name
  * @param boolean $trim If false, no string trimming is performed
  * @return string Returns the submitted field value 
  */
 protected function Value($name, $trim = true)
 {
     $value = Request::MethodData($this->Method(), $name);
     if ($trim) {
         return String::Trim($value);
     }
     return $value;
 }
Example #3
0
 private function SaveAreas()
 {
     $names = explode(',', $this->Value('Areas'));
     $prev = null;
     foreach ($names as $name) {
         $name = String::Trim($name);
         if (!$this->AreaNameExists($name)) {
             $area = new Area();
             $area->SetPrevious($prev);
             $area->SetLayout($this->layout);
             $area->SetName($name);
             $area->Save();
             $prev = $area;
         }
     }
 }
Example #4
0
 /**
  * Gets the value by pure name
  * @param string $name The name without prefix
  * @return string Returns the value
  */
 private function Value($name)
 {
     $value = Request::PostData($this->prefix . $name);
     return String::Trim($value);
 }
Example #5
0
 /**
  * 
  * @return string
  * @throws \LogicException Raises an error if no different redirect page is found
  */
 private function NextUrl()
 {
     $nextUrl = String::Trim(Request::GetData('nextUrl'));
     if ($nextUrl) {
         return $nextUrl;
     }
     $nextPageUrl = $this->login->GetNextUrl();
     if ($nextPageUrl) {
         return FrontendRouter::Url($nextPageUrl);
     }
     return '';
 }