/** * Befüllt den Record Pfaden * * @param string $sPath * @return tx_mklib_model_Dam */ public function fillPath($sPath = false) { // Pathname immer setzen! if (!$this->hasFilePath()) { if (tx_rnbase_util_TYPO3::isTYPO60OrHigher()) { $this->setFilePathName($this->getUrl()); } else { $this->setFilePathName($this->getFilePath() . $this->getFileName()); } } tx_rnbase::load('tx_mklib_util_File'); // webpath setzen if ((!$sPath || $sPath == 'webpath') && !$this->hasFileWebpath()) { $this->setFileWebpath(tx_mklib_util_File::getWebPath($this->getFilePathName())); } // serverpath setzen if ((!$sPath || $sPath == 'serverpath') && !$this->hasFileServerpath()) { $this->setFileServerpath(tx_mklib_util_File::getServerPath($this->getFilePathName())); } // relpath setzen if ((!$sPath || $sPath == 'relpath') && !$this->hasFileRelpath()) { $this->setFileRelpath(tx_mklib_util_File::getRelPath($this->getFilePathName())); } return $this; }
/** * This method checks any additional data that is relevant to the specific task * If the task class is not relevant, the method is expected to return true * * @param array $submittedData: reference to the array containing the data submitted by the user * @param tx_scheduler_Module $parentObject: reference to the calling object (Scheduler's BE module) * @return boolean True if validation was ok (or selected class is not relevant), false otherwise */ public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject) { $bError = false; foreach ($this->getAdditionalFieldConfig() as $sKey => $aOptions) { $mValue =& $submittedData[$sKey]; // bei einer checkbox ist der value immer 'on'! if ($aOptions['type'] && $mValue === 'on') { $mValue = 1; } $bMessage = false; // Die Einzelnen validatoren anwenden. if (!$bMessage) { foreach (t3lib_div::trimExplode(',', $aOptions['eval']) as $sEval) { $sLabelKey = ($aOptions['label'] ? $aOptions['label'] : $sKey) . '_eval_' . $sEval; switch ($sEval) { case 'required': $bMessage = empty($mValue); break; case 'trim': $mValue = trim($mValue); break; case 'int': $bMessage = !is_numeric($mValue); if (!$bMessage) { $mValue = intval($mValue); } break; case 'date': $mValue = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $mValue); break; case 'email': //wir unterstützen kommaseparierte listen von email andressen if (!empty($mValue)) { $aEmails = explode(',', $mValue); $bMessage = false; foreach ($aEmails as $sEmail) { if (!t3lib_div::validEmail($sEmail)) { $bMessage = true; } } } break; case 'folder': tx_rnbase::load('tx_mklib_util_File'); $sPath = tx_mklib_util_File::getServerPath($mValue); $bMessage = !@is_dir($sPath); if (!$bMessage) { $mValue = $sPath; } break; case 'file': tx_rnbase::load('tx_mklib_util_File'); $sPath = tx_mklib_util_File::getServerPath($mValue); $bMessage = !@file_exists($sPath); if (!$bMessage) { $mValue = $sPath; } break; case 'url': $bMessage = !t3lib_div::isValidUrl($mValue); break; default: // wir prüfen auf eine eigene validator methode in der Kindklasse. // in eval muss validateLifetime stehen, damit folgende methode aufgerufen wird. // protected function validateLifetime($mValue){ return true; } // @TODO: clasname::method prüfen!? if (method_exists($this, $sEval)) { $ret = $this->{$sEval}($mValue, $submittedData); if (is_string($ret)) { $bMessage = $sMessage = $ret; } } } // wir generieren nur eine meldung pro feld! if ($bMessage) { break; } } } // wurde eine fehlermeldung erzeugt? if ($bMessage) { $sMessage = $sMessage ? $sMessage : $GLOBALS['LANG']->sL($sLabelKey); $sMessage = $sMessage ? $sMessage : ucfirst($sKey) . ' has to eval ' . $sEval . '.'; $parentObject->addMessage($sMessage, t3lib_FlashMessage::ERROR); $bError = true; continue; } } return !$bError; }
/** * * @return multitype:multitype:string multitype:Ambigous <string, string, unknown> */ public function getFiles() { return array(array(tx_mklib_util_File::getServerPath(''), FALSE), array(tx_mklib_util_File::getServerPath('EXT:mklib/tests'), FALSE), array(tx_mklib_util_File::getServerPath('EXT:mklib/tests/phpunit.xml'), TRUE)); }