예제 #1
0
파일: Plugin.php 프로젝트: pageer/sabre-dav
 /**
  * Draws a table row for a property
  *
  * @param string $name
  * @param mixed $value
  * @return string
  */
 private function drawPropertyRow($name, $value)
 {
     $html = new HtmlOutputHelper($this->server->getBaseUri(), $this->server->xml->namespaceMap);
     return "<tr><th>" . $html->xmlName($name) . "</th><td>" . $this->drawPropertyValue($html, $value) . "</td></tr>";
 }
예제 #2
0
 /**
  * Generate html representation for this value.
  *
  * The html output is 100% trusted, and no effort is being made to sanitize
  * it. It's up to the implementor to sanitize user provided values.
  *
  * The output must be in UTF-8.
  *
  * The baseUri parameter is a url to the root of the application, and can
  * be used to construct local links.
  *
  * @param HtmlOutputHelper $html
  * @return string
  */
 function toHtml(HtmlOutputHelper $html)
 {
     $traverse = function ($privName, $priv) use(&$traverse, $html) {
         echo "<li>";
         echo $html->xmlName($privName);
         if (isset($priv['abstract']) && $priv['abstract']) {
             echo " <i>(abstract)</i>";
         }
         if (isset($priv['description'])) {
             echo " " . $html->h($priv['description']);
         }
         if (isset($priv['aggregates'])) {
             echo "\n<ul>\n";
             foreach ($priv['aggregates'] as $subPrivName => $subPriv) {
                 $traverse($subPrivName, $subPriv);
             }
             echo "</ul>";
         }
         echo "</li>\n";
     };
     ob_start();
     echo "<ul class=\"tree\">";
     $traverse('{DAV:}all', ['aggregates' => $this->getValue()]);
     echo "</ul>\n";
     return ob_get_clean();
 }
예제 #3
0
파일: Acl.php 프로젝트: nikosv/openeclass
    /**
     * Generate html representation for this value.
     *
     * The html output is 100% trusted, and no effort is being made to sanitize
     * it. It's up to the implementor to sanitize user provided values.
     *
     * The output must be in UTF-8.
     *
     * The baseUri parameter is a url to the root of the application, and can
     * be used to construct local links.
     *
     * @param HtmlOutputHelper $html
     * @return string
     */
    function toHtml(HtmlOutputHelper $html) {

        ob_start();
        echo "<table>";
        echo "<tr><th>Principal</th><th>Privilege</th><th></th></tr>";
        foreach ($this->privileges as $privilege) {

            echo '<tr>';
            // if it starts with a {, it's a special principal
            if ($privilege['principal'][0] === '{') {
                echo '<td>', $html->xmlName($privilege['principal']), '</td>';
            } else {
                echo '<td>', $html->link($privilege['principal']), '</td>';
            }
            echo '<td>', $html->xmlName($privilege['privilege']), '</td>';
            echo '<td>';
            if (!empty($privilege['protected'])) echo '(protected)';
            echo '</td>';
            echo '</tr>';

        }
        echo "</table>";
        return ob_get_clean();

    }