ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilWikiUserHTMLExport Class Reference

Class manages user html export. More...

+ Collaboration diagram for ilWikiUserHTMLExport:

Public Member Functions

 __construct (ilObjWiki $a_wiki, ilDB $a_db, ilObjUser $a_user)
 Construct. More...
 
 updateStatus ($a_progress, $a_status)
 Update status. More...
 
 getProgress ()
 Get Progress. More...
 
 initUserHTMLExport ()
 Init user html export. More...
 
 startUserHTMLExport ()
 Start user html export. More...
 
 deliverFile ()
 Deliver file. More...
 

Data Fields

const PROCESS_OTHER_USER = 0
 
const PROCESS_STARTED = 1
 
const PROCESS_UPTODATE = 2
 
const NOT_RUNNING = 0
 
const RUNNING = 1
 

Protected Member Functions

 read ()
 Read. More...
 
 getProcess ()
 Get process. More...
 

Protected Attributes

 $data
 
 $db
 
 $wiki
 
 $user
 
 $log
 

Detailed Description

Class manages user html export.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 12 of file class.ilWikiUserHTMLExport.php.

Constructor & Destructor Documentation

◆ __construct()

ilWikiUserHTMLExport::__construct ( ilObjWiki  $a_wiki,
ilDB  $a_db,
ilObjUser  $a_user 
)

Construct.

Parameters

return

Definition at line 50 of file class.ilWikiUserHTMLExport.php.

51 {
52 $this->db = $a_db;
53 $this->wiki = $a_wiki;
54 $this->user = $a_user;
55 $this->read();
56 $this->log = ilLoggerFactory::getLogger('wiki');
57 }
static getLogger($a_component_id)
Get component logger.

References ilLoggerFactory\getLogger(), and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ deliverFile()

ilWikiUserHTMLExport::deliverFile ( )

Deliver file.

Definition at line 203 of file class.ilWikiUserHTMLExport.php.

204 {
205 $this->log->debug("deliver");
206 include_once("./Modules/Wiki/classes/class.ilWikiHTMLExport.php");
207 $exp = new ilWikiHTMLExport($this->wiki);
208 $exp->setMode(ilWikiHTMLExport::MODE_USER);
209 $file = $exp->getUserExportFile();
210 $this->log->debug("file: ".$file);
211 ilUtil::deliverFile($file, pathinfo($file, PATHINFO_BASENAME));
212 }
print $file
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
Wiki HTML exporter class.

References $file, ilUtil\deliverFile(), and ilWikiHTMLExport\MODE_USER.

+ Here is the call graph for this function:

◆ getProcess()

ilWikiUserHTMLExport::getProcess ( )
protected

Get process.

Parameters

return

Definition at line 82 of file class.ilWikiUserHTMLExport.php.

83 {
84 $this->log->debug("getProcess");
85 $last_change = ilPageObject::getLastChangeByParent("wpg", $this->wiki->getId());
86
87 $this->db->lockTables(
88 array(
89 0 => array('name' => 'wiki_user_html_export', 'type' => ilDB::LOCK_WRITE)));
90 $this->read();
91 $ts = ilUtil::now();
92
93 if ($this->data["start_ts"] != "" &&
94 $this->data["start_ts"] > $last_change)
95 {
96
97 $this->db->unlockTables();
99 }
100
101 if (!isset($this->data["wiki_id"]))
102 {
103 $this->db->manipulate("INSERT INTO wiki_user_html_export ".
104 "(wiki_id, usr_id, progress, start_ts, status) VALUES (".
105 $this->db->quote($this->wiki->getId(), "integer").",".
106 $this->db->quote($this->user->getId(), "integer").",".
107 $this->db->quote(0, "integer").",".
108 $this->db->quote($ts, "timestamp").",".
109 $this->db->quote(self::RUNNING, "integer").
110 ")");
111 }
112 else
113 {
114 $this->db->manipulate("UPDATE wiki_user_html_export SET ".
115 " start_ts = ".$this->db->quote($ts, "timestamp").",".
116 " usr_id = ".$this->db->quote($this->user->getId(), "integer").",".
117 " progress = ".$this->db->quote(0, "integer").",".
118 " status = ".$this->db->quote(self::RUNNING, "integer").
119 " WHERE status = ".$this->db->quote(self::NOT_RUNNING, "integer").
120 " AND wiki_id = ".$this->db->quote($this->wiki->getId(), "integer")
121 );
122 }
123 $this->read();
124 $this->db->unlockTables();
125
126 if ($this->data["start_ts"] == $ts && $this->data["usr_id"] == $this->user->getId())
127 {
128 // we started the process
130 }
131
132 // process was already running
134 }
const LOCK_WRITE
Definition: class.ilDB.php:30
static getLastChangeByParent($a_parent_type, $a_parent_id, $a_lang="")
Get all pages for parent object.
static now()
Return current timestamp in Y-m-d H:i:s format.

References ilPageObject\getLastChangeByParent(), ilDB\LOCK_WRITE, ilUtil\now(), PROCESS_OTHER_USER, PROCESS_STARTED, PROCESS_UPTODATE, and read().

Referenced by initUserHTMLExport().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProgress()

ilWikiUserHTMLExport::getProgress ( )

Get Progress.

Parameters

return

Definition at line 160 of file class.ilWikiUserHTMLExport.php.

161 {
162 $set = $this->db->query("SELECT progress, status FROM wiki_user_html_export ".
163 " WHERE wiki_id = ".$this->db->quote($this->wiki->getId(), "integer")
164 );
165 $rec = $this->db->fetchAssoc($set);
166
167 return array("progress" => (int) $rec["progress"], "status" => (int) $rec["status"]);
168 }

◆ initUserHTMLExport()

ilWikiUserHTMLExport::initUserHTMLExport ( )

Init user html export.

Parameters

return

Definition at line 177 of file class.ilWikiUserHTMLExport.php.

178 {
179 // get process, if not already running or export is up-to-date, return corresponding status
180 echo $this->getProcess();
181 exit;
182 }
exit
Definition: login.php:54

References exit, and getProcess().

+ Here is the call graph for this function:

◆ read()

ilWikiUserHTMLExport::read ( )
protected

Read.

Parameters

return

Definition at line 65 of file class.ilWikiUserHTMLExport.php.

66 {
67 $set = $this->db->query("SELECT * FROM wiki_user_html_export ".
68 " WHERE wiki_id = ".$this->db->quote($this->wiki->getId(), "integer")
69 );
70 if (!$this->data = $this->db->fetchAssoc($set))
71 {
72 $this->data = array();
73 }
74 }

Referenced by __construct(), getProcess(), and updateStatus().

+ Here is the caller graph for this function:

◆ startUserHTMLExport()

ilWikiUserHTMLExport::startUserHTMLExport ( )

Start user html export.

Definition at line 187 of file class.ilWikiUserHTMLExport.php.

188 {
189 ignore_user_abort(true);
190 // do the export
191 include_once("./Modules/Wiki/classes/class.ilWikiHTMLExport.php");
192 $exp = new ilWikiHTMLExport($this->wiki);
193 $exp->setMode(ilWikiHTMLExport::MODE_USER);
194 $exp->buildExportFile();
195 // reset user export status
196 $this->updateStatus(100, self::NOT_RUNNING);
197 exit;
198 }
updateStatus($a_progress, $a_status)
Update status.

References exit, ilWikiHTMLExport\MODE_USER, and updateStatus().

+ Here is the call graph for this function:

◆ updateStatus()

ilWikiUserHTMLExport::updateStatus (   $a_progress,
  $a_status 
)

Update status.

Parameters

return

Definition at line 142 of file class.ilWikiUserHTMLExport.php.

143 {
144 $this->db->manipulate("UPDATE wiki_user_html_export SET ".
145 " progress = ".$this->db->quote((int) $a_progress, "integer").",".
146 " status = ".$this->db->quote((int) $a_status, "integer").
147 " WHERE wiki_id = ".$this->db->quote($this->wiki->getId(), "integer").
148 " AND usr_id = ".$this->db->quote($this->user->getId(), "integer")
149 );
150
151 $this->read();
152 }

References read().

Referenced by startUserHTMLExport().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $data

ilWikiUserHTMLExport::$data
protected

Definition at line 22 of file class.ilWikiUserHTMLExport.php.

◆ $db

ilWikiUserHTMLExport::$db
protected

Definition at line 27 of file class.ilWikiUserHTMLExport.php.

◆ $log

ilWikiUserHTMLExport::$log
protected

Definition at line 42 of file class.ilWikiUserHTMLExport.php.

◆ $user

ilWikiUserHTMLExport::$user
protected

Definition at line 37 of file class.ilWikiUserHTMLExport.php.

◆ $wiki

ilWikiUserHTMLExport::$wiki
protected

Definition at line 32 of file class.ilWikiUserHTMLExport.php.

◆ NOT_RUNNING

const ilWikiUserHTMLExport::NOT_RUNNING = 0

Definition at line 19 of file class.ilWikiUserHTMLExport.php.

◆ PROCESS_OTHER_USER

const ilWikiUserHTMLExport::PROCESS_OTHER_USER = 0

Definition at line 14 of file class.ilWikiUserHTMLExport.php.

Referenced by getProcess().

◆ PROCESS_STARTED

const ilWikiUserHTMLExport::PROCESS_STARTED = 1

Definition at line 15 of file class.ilWikiUserHTMLExport.php.

Referenced by getProcess().

◆ PROCESS_UPTODATE

const ilWikiUserHTMLExport::PROCESS_UPTODATE = 2

Definition at line 16 of file class.ilWikiUserHTMLExport.php.

Referenced by getProcess().

◆ RUNNING

const ilWikiUserHTMLExport::RUNNING = 1

The documentation for this class was generated from the following file: