示例#1
0
文件: task.php 项目: utopszkij/lmp
 public function renderView()
 {
     if ($this->view) {
         $this->view->render();
     }
 }
 /**
  * 
  *
  * @return void
  */
 public function setView(MView $view)
 {
     $this->view = $view;
     $this->addResponseHeader(S("Content-Type"), $view->contentType());
 }
 /**
  * 
  *
  * @return MPlainTextView
  */
 public function __construct(MString $text)
 {
     parent::__construct();
     $this->text = $text;
 }
 /**
  * 
  *
  * @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();
     }
 }
示例#5
0
文件: view.php 项目: vanie3/appland
 public function __construct()
 {
     parent::__construct();
 }