$utilisateur_id++;\r
}\r
}\r
+\r
+ $lastuid = 1;\r
+\r
+ for($i = 4;$i >= 1;$i--) {\r
+ $c = $core->con->openCursor('entreprises');\r
+ $c->nom = 'Entreprise Test - Grade ' . $i;\r
+ $c->ws_grade = $i;\r
+ $c->ws_admin = $lastuid;\r
+ $c->entreprise_id = $entreprise_id;\r
+ $c->pays = 'FR';\r
+ $c->insert();\r
+\r
+ $c = $core->con->openCursor('utilisateurs');\r
+ $c->prenom = 'Utilisateur Test';\r
+ $c->nom = 'Grade ' . $i;\r
+ $c->email = 'grade' . $i . "@fluidbook.com";\r
+ $c->password = 'atacama';\r
+ $c->utilisateur_id = $utilisateur_id;\r
+ $c->entreprise = $entreprise_id;\r
+\r
+ $c->lang = 'fr';\r
+ $c->insert();\r
+\r
+ $lastuid = $utilisateur_id;\r
+\r
+ $entreprise_id++;\r
+ $utilisateur_id++;\r
+ }\r
// Mets à jour les utilisateurs reliés à l'extranet\r
$r = $core->con->select('SELECT * FROM ws.user WHERE extranet!=0');\r
while ($r->fetch()) {\r
}\r
// Set cubedesigners AS admin\r
$core->con->execute('UPDATE entreprises SET ws_grade=5, ws_admin=1 WHERE entreprise_id=7');\r
-\r
// Some entreprises are themeselves revendeurs. It's not normal\r
$core->con->execute('UPDATE entreprises e SET ws_admin=1 WHERE ws_admin IN (SELECT utilisateur_id FROM utilisateurs u WHERE e.entreprise_id=u.entreprise)');\r
} else {\r
$parametres = new wsBookParametres(new stdClass());\r
$r->signature = $signatures[$r->tid];\r
$parametres->fromRecord($r);\r
- $parametres->fromXML(simplexml_load_string('<extras>' . $r->extras . '</extras>'));\r
+\r
+ $xml = @simplexml_load_string('<extras>' . $r->extras . '</extras>');\r
+ if ($xml !== false) {\r
+ $parametres->fromXML($xml);\r
+ } else {\r
+ fb('error on extras (Fluidbook # ' . $r->bid);\r
+ }\r
$c->parametres = serialize($parametres);\r
$c->insert();\r
}\r
// Importe les pages des fluidbooks\r
- $r = $core->con->select('SELECT * FROM ws.book_pages ORDER BY bid,bpid');\r
+ $r = $core->con->select('SELECT bid,did FROM ws.book_pages GROUP BY did');\r
while ($r->fetch()) {\r
if (!isset($docs[$r->did])) {\r
$c = $core->con->openCursor('documents');\r
$c->insert();\r
$docs[$r->did] = true;\r
}\r
-\r
- $c = $core->con->openCursor('book_pages');\r
- $c->book_id = $r->bid;\r
- $c->document_id = $r->did;\r
- $c->book_page = $r->bpid;\r
- $c->document_page = $r->dpid;\r
- $c->insert();\r
}\r
+\r
+ $core->con->execute('INSERT INTO book_pages (book_id,book_page,document_id,document_page) SELECT bid,bpid,did,dpid FROM ws.book_pages');\r
}\r
\r
foreach($tables as $t) {\r
}\r
}\r
\r
+ public static function dashboard($error = true)\r
+ {\r
+ if (MODE == 'extranet') {\r
+ $grade = 1;\r
+ } elseif (MODE == 'ws') {\r
+ $grade = 5;\r
+ }\r
+ return commonDroits::min($grade, $error);\r
+ }\r
+\r
public static function recherche($page)\r
{\r
global $core;\r
foreach($onglets as $titre => $url) {\r
// Si cet onglet correspond à la page active, on le place actif\r
$active = ($args[0] == $url)?' class="active"':'';\r
- $res.='<a href="' . SITE_PATH . $url . '">'.cubeMedia::cssRollover($core->typo->Onglet($titre,'',false)).'</a>';\r
+ $res .= '<a href="' . SITE_PATH . $url . '">' . cubeMedia::cssRollover($core->typo->Onglet($titre, '', false)) . '</a>';\r
}\r
$res .= '</div>';\r
return $res;\r
}\r
}\r
if ($hasRealFilters) {\r
- $res .= '<div class="efface_filtres"><a href="#" class="ajax" id="efface_filtres" rel="' . $action . '/efface">' . __('Effacer les filtres') . '</a><br /><a href="#" class="popup" rel="formDashboard/' . $dashboard . '">' . __('Ajouter à mon tableau de bord') . '</a></div>';\r
+ $res .= '<div class="efface_filtres"><a href="#" class="ajax" id="efface_filtres" rel="' . $action . '/efface">' . __('Effacer les filtres') . '</a>';\r
+ if (commonDroits::dashboard(false)) {\r
+ $res .= '<br /><a href="#" class="popup" rel="formDashboard/' . $dashboard . '">' . __('Ajouter à mon tableau de bord') . '</a>';\r
+ }\r
+ $res .= '</div>';\r
}\r
$res .= '</form>';\r
}\r
return $res;\r
}\r
\r
- public static function bf($max=false)\r
+ public static function bf($max = false)\r
{\r
$res = '</div></td><td class="b-e"></td>';\r
$res .= '</tr>';\r
$res .= '<tr class="b-footer">';\r
$res .= '<td class="b-sw"></td><td class="b-s">';\r
- if($max){\r
- $res.=cubeMedia::spacer(960,1);\r
+ if ($max) {\r
+ $res .= cubeMedia::spacer(960, 1);\r
}\r
- $res.='</td><td class="b-se"></td>';\r
+ $res .= '</td><td class="b-se"></td>';\r
$res .= '</tr>';\r
$res .= '</table>';\r
return $res;\r
$res .= '<tr><td>' . __('Numéro de mobile') . ' : </td><td>' . $utilisateur->mobile . '</td></tr>';\r
$res .= '<tr><td>' . __('Numéro de fax') . ' : </td><td>' . $utilisateur->fax . '</td></tr>';\r
$res .= '<tr><td>' . __('Numéro de TVA intracommunautaire') . ' : </td><td>' . $utilisateur->tva_intra . '</td></tr>';\r
- $res .= '<tr><td colspan="2"><em>' . __('Si les informations ci-dessus sont incomplètes ou erronées, veuillez nous<br />en informer en nous écrivant à ') . '<a href="mailto:contact@cubedesigners.com">contact@cubedesigners.com</a></em></td></tr>';\r
+ $res .= '<tr><td colspan="2"><em>' . __('Si les informations ci-dessus sont incomplètes ou erronées, veuillez nous<br />en informer en nous écrivant à ') . '<a href="mailto:'.FROM_EMAIL.'">'.FROM_EMAIL.'</a></em></td></tr>';\r
}\r
\r
return $res;\r
\r
public static function dashboard($args)\r
{\r
+ commonDroits::dashboard();\r
+\r
cubePage::ui('Sortable');\r
$res = commonPage::barre();\r
$res .= commonPage::tMain('dash');\r
\r
public static function listeDashboard($args)\r
{\r
+ commonDroits::dashboard();\r
global $core;\r
$r = $core->con->select('SELECT * FROM dashboard WHERE equipier=\'' . $core->user->utilisateur_id . '\' AND site=\'' . MODE . '\' ORDER BY sort');\r
$res = '';\r
\r
public static function displayDashboard($r)\r
{\r
+ commonDroits::dashboard();\r
global $core;\r
$res = '<div class="caption">' . $core->typo->OngletBlanc($r->nom);\r
\r
\r
public static function getDashboardSettings($s)\r
{\r
+ commonDroits::dashboard();\r
$s = unserialize($s);\r
if (isset($s['filtres']['annee'])) {\r
$s['filtres']['annee'] = range(2006, date('Y'), 1);\r
\r
public static function formDashboard($args)\r
{\r
+ commonDroits::dashboard();\r
global $core;\r
$rub = $args[1];\r
$dashboard_id = isset($args[2])?$args[2]:'new';\r
define('GA', 'UA-4339912-5');\r
define('TITLE', 'Fuidbook Workshop');\r
\r
- define('FROM_EMAIL', 'workshop@fluidbook.com');\r
+ define('FROM_EMAIL', 'contact@fluidbook.com');\r
define('FROM_NAME', 'Fluidbook Workshop');\r
define('EMAIL_SUBJECT', 'Fluidbook Workshop');\r
define('TEAM_EMAIL', 'team@fluidbook.com');\r
define('GA', 'UA-4339912-4');\r
define('TITLE', 'Extranet Cubedesigners');\r
\r
- define('FROM_EMAIL', 'extranet@cubedesigners.com');\r
+ define('FROM_EMAIL', 'contact@cubedesigners.com');\r
define('FROM_NAME', 'Extranet Cubedesigners');\r
define('EMAIL_SUBJECT', 'Extranet Cubedesigners');\r
define('TEAM_EMAIL', 'team@cubedesigners.com');\r
<?php\r
class wsDroits {\r
+ public static $creation = array(2, 4, 5);\r
+ public static $revendeur = 3;\r
+ public static $admin = 5;\r
+\r
public static function navigation()\r
{\r
global $core;\r
return $nav;\r
}\r
\r
+ public static function getRights()\r
+ {\r
+ $res = new stdClass();\r
+ $res->creation = self::creation(false);\r
+ $res->revendeur = self::revendeur(false);\r
+ $res->admin = self::admin(false);\r
+ return $res;\r
+ }\r
+\r
+ public static function creation($error = false)\r
+ {\r
+ return self::gradeIn(self::$creation, $error);\r
+ }\r
+\r
+ public static function revendeur($error = false)\r
+ {\r
+ return commonDroits::min(self::$revendeur, $error);\r
+ }\r
+\r
+ public static function admin($error = false)\r
+ {\r
+ return commonDroits::min(self::$admin, $error);\r
+ }\r
+\r
+ protected static function gradeIn($list, $error = false)\r
+ {\r
+ global $core;\r
+ if (!in_array($core->user->grade, $list)) {\r
+ if ($error) {\r
+ commonDroits::error();\r
+ }\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+\r
public static function getSignatures()\r
{\r
global $core;\r
$settings = $core->user->getSettings('books');\r
\r
$shortcuts = array();\r
- $shortcuts[] = '<a href="#" class="popup" rel="newBookForm">' . $core->typo->Ajouter(__('Créer une nouvelle publication')) . '</a>';\r
+ if (wsDroits::creation()) {\r
+ $shortcuts[] = '<a href="#" class="popup" rel="newBookForm">' . $core->typo->Ajouter(__('Créer une nouvelle publication')) . '</a>';\r
+ }\r
\r
$filtres = array();\r
$filtres[] = new commonFiltre(__('Status'), 'status_book', $settings['filtres']);\r
cubePage::truePopup();\r
cubePage::autocomplete();\r
\r
+ $creation = wsDroits::creation();\r
+\r
commonDroits::min(1);\r
$settings = is_null($settings)?$core->user->getSettings('books'):$settings;\r
$change = is_null($dashboard)?'Books':'Dashboard/' . $dashboard;\r
$i = 0;\r
\r
$btVoir = cubeMedia::cssRollover($core->typo->Voir('voir', '', false));\r
- $btEdit = cubeMedia::cssRollover($core->typo->Editer('éditer', '', false));\r
+ if ($creation) {\r
+ $btEdit = cubeMedia::cssRollover($core->typo->Editer('éditer', '', false));\r
+ }\r
$btStats = cubeMedia::cssRollover($core->typo->Stats('stats', '', false));\r
$btDownload = cubeMedia::cssRollover($core->typo->Telecharger('télécharger', '', false));\r
- $btDel = cubeMedia::cssRollover($core->typo->Supprimer('suppr.', '', false));\r
+ if ($creation) {\r
+ $btDel = cubeMedia::cssRollover($core->typo->Supprimer('suppr.', '', false));\r
+ }\r
\r
foreach($liste as $id => $book) {\r
$odd = cubeMath::isOdd($i)?' class="odd"':'';\r
$res .= '<td>' ./* $f .*/ '</td>';\r
$res .= '<td>' . $core->books_status[$book->status] . '</td>';\r
$res .= '<td class="bouton"><a class="popupFS" rev="viewer_' . $book->book_id . '" href="' . SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash . '/">' . $btVoir . '</a></td>';\r
- $res .= '<td class="bouton"><a class="popupFS" rev="editor_' . $book->book_id . '" href="' . SITE_PATH . 'editor/' . $book->book_id . '">' . $btEdit . '</a></td>';\r
+ if ($creation) {\r
+ $res .= '<td class="bouton"><a class="popupFS" rev="editor_' . $book->book_id . '" href="' . SITE_PATH . 'editor/' . $book->book_id . '">' . $btEdit . '</a></td>';\r
+ }\r
$res .= '<td class="bouton"><a href="' . SITE_PATH . 'stats/' . $book->book_id . '">' . $btStats . '</a></td>';\r
$res .= '<td class="bouton"><a href="' . SITE_PATH . 'supprimebook/' . $book->book_id . '">' . $btDownload . '</a></td>';\r
- $res .= '<td class="bouton"><a href="#" rel="supprimeBook/' . $book->book_id . '" class="ajax" title="' . __('Êtes-vous certain de vouloir supprimer cette publication ?') . '">' . $btDel . '</a></td>';\r
+ if ($creation) {\r
+ $res .= '<td class="bouton"><a href="#" rel="supprimeBook/' . $book->book_id . '" class="ajax" title="' . __('Êtes-vous certain de vouloir supprimer cette publication ?') . '">' . $btDel . '</a></td>';\r
+ }\r
$res .= '</tr>';\r
$i++;\r
}\r