예제 #1
0
 public function __toString()
 {
     $pairs = new ArrayList("string");
     foreach ($this as $key => $value) {
         $pairs->add("{$key}:{$value}");
     }
     return "{" . $pairs->join(",") . "}";
 }
예제 #2
0
 public function doRender($rowIndex = null)
 {
     $context = parent::$settings->getContextPath();
     $view = $this->getConvertedValue($this->view, $rowIndex);
     $value = $this->getConvertedValue($this->value, $rowIndex);
     $params = new ArrayList("string");
     foreach ($this->getChildrenOfType("Param") as $param) {
         $paramVal = $this->getConvertedValue($param->getValue(), $rowIndex);
         $params->add(strval($paramVal));
     }
     $url = $view;
     if (!$params->isEmpty()) {
         $url .= ViewForward::URL_DELIMITER . $params->join("/")->getPrimitive();
     }
     $selPrefix = empty($this->selectedPrefix) ? $url : $this->selectedPrefix;
     $cl = empty($this->class) ? "" : " " . $this->class;
     return "<a selectedPrefix=\"{$selPrefix}\" class=\"RenderLink{$cl}\" href=\"{$context}/{$url}\">{$value}{$this->renderChildren(array(), array("Param"), $rowIndex)}</a>";
 }
예제 #3
0
 private function renderRows($cols)
 {
     $rows = $this->getRows();
     $result = "";
     $nbRows = count($rows);
     if (!empty($this->rows)) {
         $nbRows = min($nbRows, $this->rows);
     }
     for ($i = 0; $i < $nbRows; $i++) {
         $page = isset($this->rows) ? floor($i / $this->rows) + 1 : 1;
         $result .= "<tr class=\"page p{$page}\">";
         $nbCols = count($cols);
         for ($j = 0; $j < $nbCols; $j++) {
             $col = $cols[$j];
             if (!$col->shouldBeRendered($i)) {
                 continue;
             }
             $class = $this->getCurrentColumnClass($j);
             $colClass = $col->getClass();
             $classes = new ArrayList();
             if (!empty($class)) {
                 $classes->add($class);
             }
             if (!empty($colClass)) {
                 $classes->add($colClass);
             }
             $classAttr = $classes->isEmpty() ? "" : " class=\"" . $classes->join(",") . "\"";
             $result .= "<td{$classAttr}>" . $col->render($i) . "</td>";
         }
         $result .= "</tr>";
     }
     return $result;
 }
예제 #4
0
}
// IList::offsetSet()
echo "Adding Jack using []\n";
$list[] = $jack;
try {
    echo "Adding foo using []\n";
    $list[] = $foo;
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
// (array) IList
echo "(array):\n";
Debug::dump((array) $list);
// extension method
echo "join() via extension method:\n";
Debug::dump($list->join(', '));
// undeclared method
try {
    echo "undeclared method:\n";
    $list->test();
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
// IList::insertAt()
echo "Adding Larry using insertAt()\n";
Debug::dump($list->insertAt(0, $larry));
echo "Adding Larry using insertAt()\n";
Debug::dump($list->insertAt(4, $larry));
try {
    echo "Adding Larry using insertAt()\n";
    Debug::dump($list->insertAt(6, $larry));