Documentation is available at sys_view_installsite.php
1 <?php
2 /**
3 * @author Jan H. Andersen <jha@ipwsystems.dk>
4 * @author Martin R. Larsen <mrl@ipwsystems.dk>
5 * @copyright {@link http://www.ipwsystems.dk/ IPW Systems a.s}
6 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
7 * @package METAjour
8 * @subpackage view
9 * $Id: sys_view_installsite.php,v 1.1 2005/02/16 05:02:53 jan Exp $
10 */
11
12 function copyr($source, $dest) {
13 if (is_file($source)) {
14 return copy($source, $dest);
15 }
16 if (!is_dir($dest)) {
17 mkdir($dest);
18 }
19 $dir = dir($source);
20 while (false !== $entry = $dir->read()) {
21 if ($entry == '.' || $entry == '..') {
22 continue;
23 }
24 if ($dest !== "$source/$entry") {
25 copyr("$source/$entry", "$dest/$entry");
26 }
27 }
28 $dir->close();
29 return true;
30 }
31
32 require_once('basic_view.php');
33 require_once('basic_field.php');
34
35 class sys_view_installsite extends basic_view {
36
37 function loadLanguage() {
38 basic_view::loadLanguage();
39 }
40
41 function titleBar() {
42 return '<div class="metatitle">'.$this->shadowtext('Install default site').'</div>';
43 }
44
45 function viewStart() {
46 return '<div class="metawindow">';
47 }
48
49 function viewEnd() {
50 return '</div>';
51 }
52
53 function beforeForm() {
54 return '<div class="metabox">';
55 }
56
57 function afterForm() {
58 return '</div>';
59 }
60
61 function view() {
62 $result .= $this->viewStart();
63 $result .= $this->titleBar();
64 $result .= $this->beforeForm();
65
66 if ($this->data['step'] == '2') {
67 $obj = owNew('structure');
68 $id = $obj->locateByName('main');
69 if ($id) {
70 $obj->readObject($id);
71 $obj->deleteObject();
72 }
73
74 if ($this->data['instsite'] == 'defaultdanish') {
75 owImportObjects($this->userhandler->getSystemPath().'standard/defaultdanish/');
76 copyr($this->userhandler->getSystemPath().'standard/defaultdanish/img/',
77 $this->userhandler->getViewerPath().'img/');
78 copyr($this->userhandler->getSystemPath().'standard/defaultdanish/filter/',
79 $this->userhandler->getDirFilter());
80 }
81 if ($this->data['instsite'] == 'defaultenglish') {
82 owImportObjects($this->userhandler->getSystemPath().'standard/defaultenglish/');
83 copyr($this->userhandler->getSystemPath().'standard/defaultenglish/img/',
84 $this->userhandler->getViewerPath().'img/');
85 copyr($this->userhandler->getSystemPath().'standard/defaultenglish/filter/',
86 $this->userhandler->getDirFilter());
87 }
88 $result .= '<BR><BR><b>Done!</b>';
89 }
90
91 if ($this->data['step'] != '2') {
92 $result .= '<form name="metaform" method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" style="margin: 0px; padding: 0px;">';
93 $result .= '<input type="hidden" name="_DONTCONVERT_" value="1">';
94 $result .= '<input type="hidden" name="step" value="2">';
95 $result .= $this->returnMePost();
96 $s = '<select name="instsite">
97 <option value="defaultenglish">Default english website</option>
98 <option value="defaultdanish">Default danish website</option>
99 </select>';
100 $result .= $this->makeField('Select site to install',$s);
101 $result .= $this->returnviewpost($this->view);
102 $result .= '<div style="padding-bottom: 14px;">';
103 $result .= '<input id="submit1" name="submit1" type="submit" class="mformsubmit" value="Create">';
104 $result .= '</div>';
105 $result .= '</form>';
106 }
107 $result .= '<br><br><br>';
108 $result .= $this->afterForm();
109 $result .= $this->viewEnd();;
110 return $result;
111 }
112 }
113
114 ?>
Documentation generated on Thu, 9 Jun 2005 06:53:58 +0200 by phpDocumentor 1.2.3