Skip to content
Snippets Groups Projects
Commit daa1efad authored by pbarroca's avatar pbarroca
Browse files

Suggestions d'achat: Ajout de la ligne d'info dans la page d'accueil admin

parent befef7a3
No related merge requests found
......@@ -18,23 +18,17 @@
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//////////////////////////////////////////////////////////////////////////////////////////
// OPAC3 - Moderation avis - tags
//////////////////////////////////////////////////////////////////////////////////////////
class Class_Moderer {
private $_session = null; // Session
private $sql;
private $_moderation_avis;
public function __construct()
{
public function __construct() {
$this->_session = Zend_Registry::get('session');
$this->sql = Zend_Registry::get('sql');
}
//----------------------------------
// Avis CMS
//----------------------------------
public function getAllAvisCmsAModerer($abon_ou_bib = 0) {
$sqlStmt = sprintf("Select * from cms_avis Where STATUT=0 AND ABON_OU_BIB=%d order by DATE_AVIS DESC",
$abon_ou_bib);
......@@ -42,97 +36,85 @@ class Class_Moderer {
}
//----------------------------------
// Membre non valid
//----------------------------------
public function modererUserNonValid($action,$id_user)
{
if($action=="2") sqlExecute("delete from bib_admin_users_non_valid where ID_USER=$id_user");
}
//----------------------------------------------------------
// Ecrire moderation pour 1 avis cms (validation ou suppression)
//----------------------------------------------------------
public function modererAvisCms($action,$id_user,$id_news)
{
if($action=="1")
sqlExecute("update cms_avis set STATUT=1 where ID_USER=$id_user and ID_CMS=$id_news");
elseif($action=="2")
sqlExecute("delete from cms_avis where ID_USER=$id_user and ID_CMS=$id_news");
public function modererUserNonValid($action, $id_user) {
if ('2' == $action)
sqlExecute('delete from bib_admin_users_non_valid where ID_USER=' . $id_user);
}
$avis = $this->sql->fetchAll("select * from cms_avis where ID_USER=$id_user and ID_CMS=$id_news");
if($avis[0]["STATUT"] == 1) {
$role_level=fetchOne("select ROLE_LEVEL from bib_admin_users where ID_USER=$id_user");
if($role_level < 3)
$abon_ou_bib=0;
else
$abon_ou_bib=1;
public function modererAvisCms($action, $id_user, $id_news) {
if ('1' == $action)
sqlExecute('update cms_avis set STATUT=1 where ID_USER=' . $id_user .' and ID_CMS=' . $id_news);
elseif ('2' == $action)
sqlExecute('delete from cms_avis where ID_USER=' . $id_user . ' and ID_CMS=' . $id_news);
$class_avis=new Class_Avis();
$class_avis->maj_note_cms($id_news,$abon_ou_bib);
$avis = $this->sql->fetchAll('select * from cms_avis where ID_USER=' . $id_user . ' and ID_CMS='. $id_news);
if (1 == $avis[0]['STATUT']) {
$role_level = fetchOne('select ROLE_LEVEL from bib_admin_users where ID_USER=' . $id_user);
$class_avis = new Class_Avis();
$class_avis->maj_note_cms($id_news, (($role_level < 3) ? 0 : 1));
}
}
//----------------------------------
// TAGS a modérer
//----------------------------------
public function getAllTagsAModerer()
{
$liste=fetchAll("select * from codif_tags where a_moderer > ''");
public function getAllTagsAModerer() {
$liste = fetchAll("select * from codif_tags where a_moderer > ''");
if (empty($liste))
return array();
foreach($liste as $tag)
{
$notices=explode(";",$tag["a_moderer"]);
foreach($notices as $id_notice)
{
if(!$id_notice) continue;
$r["id_tag"]=$tag["id_tag"];
$r["libelle"]=$tag["libelle"];
$r["id_notice"]=$id_notice;
$tags[]=$r;
foreach ($liste as $tag) {
$notices = explode(';', $tag['a_moderer']);
foreach ($notices as $id_notice) {
if (!$id_notice)
continue;
$r['id_tag'] = $tag['id_tag'];
$r['libelle'] = $tag['libelle'];
$r['id_notice'] = $id_notice;
$tags[] = $r;
}
}
return $tags;
}
//----------------------------------------------------------
// Ecrire moderation pour 1 tag (validation ou suppression)
//----------------------------------------------------------
public function modererTag($action,$id_tag,$id_notice) {
$cls_tag= new Class_TagNotice();
if($action=="1") $cls_tag->validerTagNotice($id_tag,$id_notice);
elseif($action=="2") $cls_tag->supprimerTagNotice($id_tag,$id_notice);
else return false;
public function modererTag($action, $id_tag, $id_notice) {
$cls_tag = new Class_TagNotice();
if ('1' == $action) {
$cls_tag->validerTagNotice($id_tag, $id_notice);
return;
}
if ('2' == $action) {
$cls_tag->supprimerTagNotice($id_tag, $id_notice);
return;
}
return false;
}
public function getModerationStats() {
$translate = Zend_Registry::get('translate');
if (!isset($this->_moderation_stats)) {
$moderations = array();
$moderations['avis_notices'] = array(
'label' => $translate->_('Avis sur les notices'),
'url' => BASE_URL.'/admin/modo/avisnotice',
'count' => fetchOne("select count(*) from notices_avis where STATUT=0"));
$moderations['avis_articles'] = array(
'label' => $translate->_('Avis sur les articles'),
'url' => BASE_URL.'/admin/modo/aviscms',
'count' => fetchOne("select count(*) from cms_avis where STATUT=0"));
$moderations['tags_notices'] = array(
'label' => $translate->_('Tags sur les notices'),
'url' => BASE_URL.'/admin/modo/tagnotice',
'count' => fetchOne("select count(*) from codif_tags where a_moderer > ''"));
$moderations['demandes_inscription'] = array(
'label' => $translate->_("Demandes d'inscription"),
'url' => BASE_URL.'/admin/modo/membreview',
'count' => fetchOne("select count(*) from bib_admin_users_non_valid"));
$moderations = ['avis_notices' => ['label' => $translate->_('Avis sur les notices'),
'url' => BASE_URL . '/admin/modo/avisnotice',
'count' => fetchOne('select count(*) from notices_avis where STATUT = 0')],
'avis_articles' => ['label' => $translate->_('Avis sur les articles'),
'url' => BASE_URL . '/admin/modo/aviscms',
'count' => fetchOne('select count(*) from cms_avis where STATUT = 0')],
'tags_notices' => ['label' => $translate->_('Tags sur les notices'),
'url' => BASE_URL . '/admin/modo/tagnotice',
'count' => fetchOne('select count(*) from codif_tags where a_moderer > \'\'')],
'demandes_inscription' => ['label' => $translate->_('Demandes d\'inscription'),
'url' => BASE_URL . '/admin/modo/membreview',
'count' => fetchOne('select count(*) from bib_admin_users_non_valid')],
'suggestions_achat' => ['label' => $translate->_('Suggestions d\'achat'),
'url' => BASE_URL . '/admin/suggestion-achat',
'count' => Class_SuggestionAchat::count()]
];
$this->_moderation_stats = $moderations;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment