Exemplo n.º 1
0
 public function setDataFromSubmit(IDataSrc $aDataSrc)
 {
     if ($this->arrUploadedFile = $aDataSrc->get($this->formName())) {
     }
     // 删除文件
     if ($aOriginFile = $this->value() and ($this->arrUploadedFile or $aDataSrc->get($this->id() . '_delete'))) {
         if ($aOriginFile->delete()) {
             parent::setValue(null);
             new Message(Message::notice, '删除文件:%s', array($this->aAchiveStrategy->restoreOriginalFilename($aOriginFile)));
         } else {
             new Message(Message::error, '删除文件失败:%s', array($this->aAchiveStrategy->restoreOriginalFilename($aOriginFile)));
         }
     }
     // move file, and setValue
     if ($this->arrUploadedFile && file_exists($this->arrUploadedFile['tmp_name'])) {
         $this->setValue($this->moveToStoreFolder());
     }
 }
Exemplo n.º 2
0
 public function setDataFromSubmit(IDataSrc $aDataSrc)
 {
     $this->setValueFromString($aDataSrc->get($this->formName()));
 }
Exemplo n.º 3
0
 public static function isUserRequest(IDataSrc $aRequest)
 {
     return $aRequest->bool(self::DATANAME_USERCALL);
 }
Exemplo n.º 4
0
 public static function compare(IDataSrc $aDataSrc, $otherDataSrc)
 {
     if ($otherDataSrc instanceof IDataSrc) {
         foreach ($otherDataSrc->nameIterator() as $sName) {
             $value =& $otherDataSrc->getRef($sName);
             $thisValue =& $aDataSrc->getRef($sName);
             if (is_object($value)) {
                 if ($thisValue !== $value) {
                     return false;
                 }
             } else {
                 if ($thisValue != $value) {
                     return false;
                 }
             }
         }
     } else {
         if (is_string($otherDataSrc)) {
             parse_str($otherDataSrc, $otherDataSrc);
         } else {
             if (!is_array($otherDataSrc)) {
                 return false;
             }
         }
         foreach ($otherDataSrc as $name => &$value) {
             $thisValue =& $aDataSrc->getRef($name);
             if (is_object($value)) {
                 if ($thisValue !== $value) {
                     return false;
                 }
             } else {
                 if ($thisValue != $value) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
Exemplo n.º 5
0
 public function setDataFromSubmit(IDataSrc $aDataSrc)
 {
     $data = $aDataSrc->get($this->formName());
     if ($data == null) {
         return;
     } else {
         $this->setValue($data);
     }
 }