You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

104 lines
3.0 KiB

<?php
/**
* @package Widgets
*
* @file Wall.php
* This file is part of MOVIM.
*
* @brief The configuration form
*
* @author Timothée Jaussoin <edhelas_at_gmail_dot_com>
*
* @version 1.0
* @date 28 October 2010
*
* Copyright (C)2010 MOVIM project
*
* See COPYING for licensing information.
*/
class ConfigData extends WidgetBase
{
function WidgetLoad()
{
$this->addcss('configdata.css');
}
function ajaxClearRosterLink() {
$rd = new \modl\RosterLinkDAO();
$rd->clearRosterLink();
$this->refresh();
}
function ajaxClearMessage() {
$md = new \modl\MessageDAO();
$md->clearMessage();
$this->refresh();
}
function ajaxClearPost() {
$pd = new \modl\PostDAO();
$pd->clearPost();
$this->refresh();
}
function refresh() {
$html = $this->prepareConfigData();
RPC::call('movim_fill', 'configdata', RPC::cdata($html));
RPC::commit();
}
function prepareConfigData() {
$cd = new \modl\ContactDAO();
$stats = $cd->getStatistics();
$clearrosterlink = $this->genCallAjax('ajaxClearRosterLink');
$clearmessage = $this->genCallAjax('ajaxClearMessage');
$clearpost = $this->genCallAjax('ajaxClearPost');
$html = '
<form enctype="multipart/form-data" method="post" action="index.php" name="general">
<fieldset>
<legend>'.t('Cache').'</legend>
<div class="clear"></div>
<div class="element thin">
<label for="name">'.t('Post'). ' - '.$stats['Post'].'</label><br />
<a
type="button"
name="email"
class="button icon back"
onclick="'.$clearpost.'">'.t('Clear').'</a>
</div>
<div class="element thin">
<label for="name">'.t('Messages'). ' - '.$stats['Message'].'</label><br />
<a
type="button"
name="email"
class="button icon back"
onclick="'.$clearmessage.'">'.t('Clear').'</a>
</div>
<div class="element thin">
<label for="name">'.t('Contacts'). ' - '.$stats['RosterLink'].'</label><br />
<a
type="button"
class="button icon back"
onclick="'.$clearrosterlink.'">'.t('Clear').'</a>
</div>
</fieldset>
</form>';
return $html;
}
function build()
{
?>
<div class="tabelem" title="<?php echo t('Data'); ?>" id="configdata" >
<?php echo $this->prepareConfigData(); ?>
</div>
<?php
}
}