Esempio n. 1
0
 /**
  * Set a configuration element
  *
  * @param  string 
  * @param  mixed 
  * @return void
  */
 public function set($name, $value)
 {
     parent::set($name, $value);
     //Only calculate the limit and offset if we have a total
     if ($this->total) {
         $this->limit = (int) max($this->limit, 1);
         $this->offset = (int) max($this->offset, 0);
         if ($this->limit > $this->total) {
             $this->offset = 0;
         }
         if (!$this->limit) {
             $this->offset = 0;
             $this->limit = $this->total;
         }
         $this->count = (int) ceil($this->total / $this->limit);
         if ($this->offset > $this->total) {
             $this->offset = ($this->count - 1) * $this->limit;
         }
         $this->current = (int) floor($this->offset / $this->limit) + 1;
     }
 }
Esempio n. 2
0
 /**
  * Set the identity key
  *
  * @param mixed $value
  * @return KModelContext
  */
 public function setIdentityKey($value)
 {
     return KObjectConfig::set('identity_key', $value);
 }
Esempio n. 3
0
 /**
  * Set the view data
  *
  * @param array $data
  * @return KViewContext
  */
 public function setData($data)
 {
     return KObjectConfig::set('data', $data);
 }
Esempio n. 4
0
 /**
  * Set the controller action
  *
  * @param string $action
  * @return KControllerContext
  */
 public function setAction($action)
 {
     return KObjectConfig::set('action', $action);
 }
 /**
  * Sets the time limit
  *
  * @param KObjectConfig|array $state
  * @return $this
  */
 public function setState($state)
 {
     return KObjectConfig::set('state', $state);
 }
Esempio n. 6
0
 /**
  * Set the view layout
  *
  * @param string $layout
  * @return KViewContextTemplate
  */
 public function setLayout($layout)
 {
     return KObjectConfig::set('layout', $layout);
 }
Esempio n. 7
0
 /**
  * Set a command property or attribute
  *
  * If an event property exists the property will be set, otherwise an attribute will be added.
  *
  * @param  string $name
  * @param  mixed  $value
  * @return KCommand
  */
 public final function set($name, $value)
 {
     $method = 'set' . ucfirst($name);
     if (!method_exists($this, $method)) {
         parent::set($name, $value);
     } else {
         $this->{$method}($value);
     }
     return $this;
 }
Esempio n. 8
0
 /**
  * Set the exception
  *
  * @param Exception $exception
  */
 public function setException(Exception $exception)
 {
     return KObjectConfig::set('exception', $exception);
 }
Esempio n. 9
0
 /**
  * Get the number of affected rows
  *
  * @param integer $affected
  * @return KDatabaseContext
  */
 public function setAffected($affected)
 {
     return KObjectConfig::set('affected', $affected);
 }
Esempio n. 10
0
 /**
  * Set a configuration item
  *
  * @param  string $name
  * @param  mixed  $value
  * @return void
  */
 public function set($name, $value)
 {
     if (is_array($value)) {
         $value = new KObjectConfig($value);
     }
     parent::set($name, $value);
 }