コード例 #1
0
 /**
  * 
  */
 public function toString()
 {
     $doc = new MMutableString();
     $doc->appendLine(S("<?xml version=\"1.0\"?>"));
     $doc->appendLine(parent::toString());
     return $doc;
 }
コード例 #2
0
ファイル: MView.php プロジェクト: jaderfeijo/mangoSystemLib
 /**
  * 
  */
 public function toString()
 {
     $str = new MMutableString();
     foreach ($this->subviews()->toArray() as $view) {
         if (!$this->subviews()->isLastObject($view)) {
             $str->appendLine($view->toString());
         } else {
             $str->appendString($view->toString());
         }
     }
     return $str;
 }
コード例 #3
0
 /**
  * 
  *
  * @return MString
  */
 public function toString()
 {
     if ($this->element()) {
         $markup = new MMutableString();
         $indentString = MString::stringWithRepeatingString(S(" "), $this->indentLevel());
         $properties = new MMutableArray();
         foreach ($this->properties()->allKeys()->toArray() as $name) {
             $value = $this->properties()->objectForKey($name);
             $properties->addObject(Sf("%s=\"%s\"", $name, $value));
         }
         if ($properties->count() > 0) {
             $markup->appendFormat("%s<%s %s", $indentString, $this->element(), $properties->componentsJoinedByString(S(" ")));
         } else {
             $markup->appendFormat("%s<%s", $indentString, $this->element());
         }
         if ($this->text()) {
             $markup->appendFormat(">%s</%s>", $this->text()->stringByEncodingHTMLEntities(), $this->element());
         } else {
             if ($this->subviews()->count() > 0) {
                 $markup->appendLine(S(">"));
                 $markup->appendLine(parent::toString());
                 $markup->appendString(Sf("%s</%s>", $indentString, $this->element()));
             } else {
                 $markup->appendString(S("/>"));
             }
         }
         if ($this->shouldAppendEmptyLine()) {
             $markup->appendLine();
         }
         return $markup;
     } else {
         return parent::toString();
     }
 }
コード例 #4
0
 /**
  * @internal
  *
  * @return MString
  */
 protected function createTableQuery(MString $tableName, MArray $fields, MString $primaryKey = null)
 {
     $tableQuery = new MMutableString();
     $tableQuery->appendLine(Sf("CREATE TABLE `%s` (", $tableName));
     $tableQuery->appendString($fields->componentsJoinedByString(S(",\n")));
     if (!empty($primaryKey)) {
         $tableQuery->appendFormat(",\nPRIMARY KEY (`%s`)", $primaryKey);
     }
     $tableQuery->appendLine(S("\n);"));
     $tableQuery->appendLine(S(""));
     return $tableQuery;
 }