27/10/2010, 01:22:11
Allez, en utilisant cmsMailer comme au-dessus et surtout en utilisant la table cms_adminlog au lieu de content :
Tout est inclus, tu n'as plus qu'à attacher l'udt aux événements.
Have fun
Code :
global $gCms;
$db =& $gCms->GetDb();
$dateformat = '%x %X';
$result = $db->Execute("SELECT * FROM ".cms_db_prefix()."adminlog ORDER BY timestamp DESC");
$totalrows = 5;
$limit = 5;
$result = $db->SelectLimit('SELECT * from '.cms_db_prefix().'adminlog ORDER BY timestamp DESC', $limit);
$output = '<html><head></head><body>';
if ($result && $result->RecordCount() > 0)
{
$output .= "<table cellspacing=\"0\" class=\"pagetable\">\n";
$output .= '<thead>';
$output .= "<tr>\n";
$output .= "<th>User</th>\n";
$output .= "<th>itemid</th>\n";
$output .= "<th>itemname</th>\n";
$output .= "<th>action</th>\n";
$output .= "<th>date</th>\n";
$output .= "</tr>\n";
$output .= '</thead>';
$output .= '<tbody>';
$currow = "row1";
while ($row = $result->FetchRow()) {
$output .= "<tr class=\"$currow\" onmouseover=\"this.className='".$currow.'hover'."';\" onmouseout=\"this.className='".$currow."';\">\n";
$output .= "<td>".$row["username"]."</td>\n";
$output .= "<td>".($row["item_id"]!=-1?$row["item_id"]:" ")."</td>\n";
$output .= "<td>".$row["item_name"]."</td>\n";
$output .= "<td>".$row["action"]."</td>\n";
$output .= "<td>".strftime($dateformat,$row['timestamp'])."</td>\n";
$output .= "</tr>\n";
($currow == "row1"?$currow="row2":$currow="row1");
}
$output .= '</tbody>';
$output .= '</table>';
}
else {
$output .= '<p class="pageheader">adminlog</p></div>';
$output .= '<p>vide</p>';
}
$output .= '</body></html>';
$cmsmailer =& $gCms->modules['CMSMailer']['object'];
$cmsmailer->AddAddress('adresse@mail');
$cmsmailer->SetFrom('adresse@mail');
$cmsmailer->SetBody($output);
$cmsmailer->IsHTML(true);
$cmsmailer->SetSubject('modification de pages');
$cmsmailer->Send();
Tout est inclus, tu n'as plus qu'à attacher l'udt aux événements.
Have fun