Пример #1
0
 /**
  * Process the form
  *
  * Also resets the session stage counter on POST driven form to avoid
  * multiple calls.
  */
 public function process()
 {
     $this->_form->freeze();
     if ($this->action == TIP_FORM_ACTION_DELETE || $this->action == TIP_FORM_ACTION_CUSTOM) {
         // GET driven form: this action could be called more than once
         $this->_processRow($this->_defaults);
     } else {
         // POST driven form: called only once
         HTTP_Session2::set($this->id . '.stage', null);
         $this->_form->process(array(&$this, '_processRow'));
     }
     if (strpos($this->referer, '-lastid-') !== false || strpos($this->follower, '-lastid-') !== false) {
         // Deprecated use of '-lastid-', kept for compatibility
         $data =& $this->master->getProperty('data');
         $primary_key = $data->getProperty('primary_key');
         $lastid = @$this->_row[$primary_key];
         $this->referer = str_replace('-lastid-', $lastid, $this->referer);
         $this->follower = str_replace('-lastid-', $lastid, $this->follower);
     } elseif (is_null($this->_row)) {
         // Operation failed, no expansion possible: provide fallbacks
         if (strpos($this->referer, '{') !== false) {
             $this->referer = TIP::getRefererUri();
         }
         if (strpos($this->follower, '{') !== false) {
             $this->follower = TIP::getRefererUri();
         }
     } else {
         // New field expansion
         foreach ($this->_row as $key => &$value) {
             $id = '{' . $key . '}';
             $this->referer = str_replace($id, $value, $this->referer);
             $this->follower = str_replace($id, $value, $this->follower);
         }
     }
 }