[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
[840] | 4 | # This file is part of importExport, a plugin for DotClear2. |
---|
[0] | 5 | # |
---|
[840] | 6 | # Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear |
---|
[0] | 7 | # Licensed under the GPL version 2.0 license. |
---|
| 8 | # See LICENSE file or |
---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 10 | # |
---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
| 12 | if (!defined('DC_RC_PATH')) { return; } |
---|
| 13 | |
---|
[840] | 14 | abstract class dcIeModule |
---|
[0] | 15 | { |
---|
| 16 | public $type; |
---|
| 17 | public $id; |
---|
| 18 | public $name; |
---|
| 19 | public $description; |
---|
[2566] | 20 | |
---|
[0] | 21 | protected $import_url; |
---|
| 22 | protected $export_url; |
---|
| 23 | protected $core; |
---|
[2566] | 24 | |
---|
[0] | 25 | public function __construct($core) |
---|
| 26 | { |
---|
| 27 | $this->core =& $core; |
---|
| 28 | $this->setInfo(); |
---|
[2566] | 29 | |
---|
[840] | 30 | if (!in_array($this->type,array('import','export'))) { |
---|
| 31 | throw new Exception(sprintf('Unknow type for module %s',get_class($this))); |
---|
[0] | 32 | } |
---|
[2566] | 33 | |
---|
[0] | 34 | if (!$this->name) { |
---|
| 35 | $this->name = get_class($this); |
---|
| 36 | } |
---|
[2566] | 37 | |
---|
[840] | 38 | $this->id = get_class($this); |
---|
| 39 | $this->url = sprintf('plugin.php?p=importExport&type=%s&module=%s',$this->type,$this->id); |
---|
[0] | 40 | } |
---|
[2566] | 41 | |
---|
[0] | 42 | public function init() |
---|
| 43 | { |
---|
| 44 | } |
---|
[2566] | 45 | |
---|
[840] | 46 | abstract protected function setInfo(); |
---|
[2566] | 47 | |
---|
[0] | 48 | final public function getURL($escape=false) |
---|
| 49 | { |
---|
[840] | 50 | return $escape ? html::escapeHTML($this->url) : $this->url; |
---|
[0] | 51 | } |
---|
[2566] | 52 | |
---|
[840] | 53 | abstract public function process($do); |
---|
[2566] | 54 | |
---|
[840] | 55 | abstract public function gui(); |
---|
[2566] | 56 | |
---|
[0] | 57 | protected function progressBar($percent) |
---|
| 58 | { |
---|
| 59 | $percent = ceil($percent); |
---|
| 60 | if ($percent > 100) { |
---|
| 61 | $percent = 100; |
---|
| 62 | } |
---|
| 63 | return '<div class="ie-progress"><div style="width:'.$percent.'%">'.$percent.' %</div></div>'; |
---|
| 64 | } |
---|
[2566] | 65 | |
---|
[0] | 66 | protected function autoSubmit() |
---|
| 67 | { |
---|
| 68 | return form::hidden(array('autosubmit'),1); |
---|
| 69 | } |
---|
[2566] | 70 | |
---|
[0] | 71 | protected function congratMessage() |
---|
| 72 | { |
---|
| 73 | return |
---|
| 74 | '<h3>'.__('Congratulation!').'</h3>'. |
---|
[1553] | 75 | '<p class="success">'.__('Your blog has been successfully imported. Welcome on Dotclear 2!').'</p>'. |
---|
[2825] | 76 | '<ul><li><strong><a href="'.$this->core->decode('admin.post').'">'.__('Why don\'t you blog this now?').'</a></strong></li>'. |
---|
| 77 | '<li>'.__('or').' <a href="'.$this->core->decode('admin.home').'">'.__('visit your dashboard').'</a></li></ul>'; |
---|
[0] | 78 | } |
---|
| 79 | } |
---|