Ejemplo n.º 1
0
 /**
  * Check variables before they are set
  * @param string $name
  * @param string $value
  * @throws \Jazzee\Exception
  */
 public function setVar($name, $value)
 {
     switch ($name) {
         case 'lorDeadline':
             if (!empty($value)) {
                 if (!($value = \strtotime($value))) {
                     throw new \Jazzee\Exception("{$value} is not a valid date for lorDeadline");
                 }
                 $value = \date('Y-m-d H:i:s', $value);
             }
             break;
         case 'lorWaitDays':
             if (!empty($value)) {
                 $value = (int) $value;
                 if ($value < 0 or $value > 100) {
                     throw new \Jazzee\Exception("lorWaitDays should be between 0 and 100.  {$value} is not.");
                 }
             }
             break;
         case 'lorDeadlineEnforced':
             break;
         case 'recommenderEmailText':
             break;
         default:
             throw new \Jazzee\Exception($name . ' is not a valid variable on this page.');
     }
     parent::setVar($name, $value);
 }
Ejemplo n.º 2
0
 /**
  * Check variables before they are set
  * @param string $name
  * @param string $value
  * @throws \Jazzee\Exception
  */
 public function setVar($name, $value)
 {
     switch ($name) {
         case 'displaySortElement':
             if (!empty($value)) {
                 if (!($element = $this->_applicationPage->getPage()->getElementById($value))) {
                     throw new \Jazzee\Exception("displaySortElement must be a valid element ID for the page.  {$value} is not.");
                 }
                 $value = $element->getId();
             }
             break;
     }
     parent::setVar($name, $value);
 }