Exemplo n.º 1
0
 static function baseHref($href = '')
 {
     $href = HTML::href($href, false);
     $output = '<base href="' . $href . '">';
     $output .= "\n";
     return $output;
 }
Exemplo n.º 2
0
 static function open($action = '', $name = '', $method = '', $validate = true, $properties = '', $image_path = 'images/', $css_path = 'css/rte.css')
 {
     $output = '';
     $action = HTML::href($action);
     if (DevValue::isNull($method)) {
         $method = 'post';
     }
     $output .= '<form enctype="multipart/form-data" method="' . $method . '" ' . ($name != '' ? 'name="' . $name . '"' : '') . ' ' . ($action != '' ? 'action="' . $action . '"' : '') . ' ' . $properties . '>';
     $output .= "\r";
     /*
     $output .= '
     <script language="JavaScript" type="text/javascript">
     	<!--
     	function submitForm() {
     		//make sure hidden and iframe values are in sync before submitting form
     		//to sync only 1 rte, use updateRTE(rte)
     		//to sync all rtes, use updateRTEs
     		//updateRTE(\'rte1\');
     		updateRTEs();
     		
     		//change the following line to true to submit form
     		return true;
     	}
     	
     	//Usage: initRTE(imagesPath, includesPath, cssFile, genXHTML)
     	initRTE("' . $image_path . '", "", "", true);
     	//-->
     </script>
     <style type="text/css">
         @import url("'.$css_path.'");
         .rteImage {margin: 0px;}
     </style>
     ';
     */
     if ($validate) {
     }
     return $output;
 }
Exemplo n.º 3
0
 public function field($var, $content = null, $formatted = null)
 {
     if ($formatted) {
         $content = HTML::format($content);
     }
     if (is_string($var)) {
         if (!$content) {
             throw new InvalidArgumentException('Cannot assign empty value.');
         }
         if (DevValue::isNotNull($formatted) && !is_bool($formatted)) {
             throw new InvalidArgumentException('Formatted argument expects boolean');
         }
         return parent::field($var, $content);
     } elseif (is_object($var) || DevArray::isAssoc($var)) {
         if (!$formatted) {
             $formatted = $content;
         }
         foreach ($var as $a => $b) {
             $this->field($a, $b, $formatted);
         }
     } else {
         throw new InvalidArgumentException('Invalid property');
     }
 }
Exemplo n.º 4
0
 public function listDir($table = false, $href = null, $query_r = null)
 {
     $output = '';
     $href = HTML::href($href, false);
     $extensions = $this->filter();
     $dir = $this->path();
     if (!$this->allowedDir($dir)) {
         $this->status("Location is outside of allowed path.");
         return false;
     }
     $filter = count($this->config('filters')) > 0 ? '/{' . implode(',*', $this->config('filters')) . '}' : '/*';
     $files = glob($this->path() . $filter, GLOB_BRACE);
     // $files = scandir($this->path());
     // sort($files);
     if ($table) {
         $output = HTML::table($files, '', $href, $query_r, '#c0c0c0', '', 1, 1, $dir, $dir);
     } else {
         $output = $files;
     }
     $this->status('Success');
     return $output;
 }
Exemplo n.º 5
0
 public function render()
 {
     $header = $this->config('headers');
     $trunc = $this->config('truncate');
     $file_dir = $this->config('document_dir');
     $cols = $this->config('columns');
     $link_style = $this->config('link_style');
     // $href = $this->config('href');
     // $fields = $this->config('fields');
     $query_r = $this->config('query');
     $content_r = $this->content();
     extract($this->_config);
     $hori = 0;
     $output = '<table class="dev_table"' . ($header === false ? '' : ' id="anyid"') . '>';
     $bg = false;
     $href = HTML::href($href);
     $count = 0;
     $new_row = 1;
     foreach ($content_r as $row) {
         $fields = $fields != '' && $fields >= 0 && $fields < count($row) ? $fields : count($row);
         if ($count == 0) {
             if ($header !== false) {
                 $header = is_array($header) && count($header) == count($row) ? $header : $row;
                 if (DevArray::isAssoc($header)) {
                     $header = array_keys($header);
                 }
                 $output .= '<tr>';
                 $i = 0;
                 foreach ($header as $a) {
                     if ($i == 0 && $link_style != 1 && $link_style !== 0) {
                         $output .= '<th>';
                         $output .= '';
                         $output .= "</th>";
                     }
                     if ($i > 0) {
                         $output .= '<th>';
                         $output .= $a;
                         $output .= "</th>";
                     }
                     $i++;
                     if ($i > $fields) {
                         break;
                     }
                 }
                 $output .= "</tr>\n";
             }
         }
         //manage columns
         if ($hori == 0) {
             $output .= '<tr>';
         }
         $i = 0;
         foreach ($row as $a => $b) {
             if ($i > 0 || $header === false && $link_style != 1) {
                 if (!($icon != '' && $fields == 2 && $i == 2)) {
                     $output .= '<td>';
                 }
                 if (($i == 1 || $icon != '' && ($i = 2)) && $link_style == 1) {
                     $output .= '<a class="contentBox" href="' . $href . '?' . $varname . '=' . $value . (DevArray::isAssoc($query_r) ? '&' . http_build_query($query_r) : '') . '">';
                 }
                 if (!$show_image || $trunc != '') {
                     $data = HTML::format($b, '', $trunc);
                 } else {
                     $data = $b;
                 }
                 if ($i != 1) {
                     $data = HTML::file($data, $file_dir);
                 }
                 if ($icon != '' && $i == 1) {
                     $data = HTML::image($data == '' ? $icon : $data, $img_dir, '', '50', '', '', '', '', '', $icon) . ($fields == 1 ? "<br />" . $data : '');
                 } elseif ($show_image) {
                     $data = HTML::image($data, $img_dir, $data, '100', '', true, '', false);
                 }
                 $output .= $data;
                 if ($i == 1 && $link_style == 1) {
                     $output .= "</a>";
                 }
                 if (!($icon != '' && $fields == 2 && $i == 1)) {
                     $output .= "</td>";
                 }
             } elseif ($i == 0) {
                 if ($link_style == 2) {
                     $output .= '<td>';
                     $output .= Form::open($href) . Form::field('hidden', $a, '', $b) . Form::field('submit', 'submit', '', 'Go');
                     if (DevArray::isAssoc($query_r)) {
                         foreach ($query_r as $c => $d) {
                             $output .= Form::feld('hidden', $c, '', $d);
                         }
                     }
                     $output .= Form::close();
                     $output .= "</td>";
                 } elseif ($link_style == 3) {
                     $output .= '<td>';
                     $output .= Form::field('checkbox', $a . '[]', '', $b);
                     if (DevArray::isAssoc($query_r)) {
                         foreach ($query_r as $c => $d) {
                             $output .= Form::field('hidden', $c, '', $d);
                         }
                     }
                     $output .= "</td>";
                 } else {
                     $varname = $a;
                     $value = $b;
                 }
             }
             $i++;
             if ($i > $fields) {
                 break;
             }
         }
         $output .= "\n";
         if ($hori < $cols) {
             $hori++;
         } else {
             $output .= "</tr>\n";
             $hori = 0;
         }
         $count++;
     }
     if ($hori != 0) {
         $output .= "</tr>\n";
     }
     $output .= "</table>\n";
     return $output;
 }