Exemplo n.º 1
0
 /**
  * When uploading files - this determines the max size (in bytes) allowed to 
  * download. Specified in the -form.xml file in the validation rule chain.
  */
 public function getUploadMaxSize($name)
 {
     $fields = FormXMLStorage::getFormFields($this->name);
     $rules = $fields["{$name}"]->validation[0]->rule;
     $mrule = findNodeWithAttribute($rules, 'name', 'upload_maxsize');
     if ($mrule == null) {
         return null;
     }
     return $mrule['value'];
 }
Exemplo n.º 2
0
/**
 * Useful function to extract text value from the xml structure for the $node 
 * using requested $lang. If $lang is null then values: Ozone::runData->getLanguage(), 
 * GlobalProperties::$DEFAULT_LANGUAGE are used in that order. If again it does not work
 * the first <text> child node returned.
 * @param SimpleXMLElement $node
 * @return string
 */
function xml_localized_text($node, $lang = null)
{
    if ($node == null) {
        return null;
    }
    $runData = Ozone::$runData;
    if ($lang == null) {
        $lang = $runData->getLanguage();
    }
    $text = findNodeWithAttribute($node->text, "lang", "{$lang}");
    if ($text == null) {
        $text = findNodeWithAttribute($node->text, "lang", GlobalProperties::$DEFAULT_LANGUAGE);
    }
    if ($text == null) {
        $text = $node->text[0];
    }
    return "{$text}";
}