]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 29 Sep 2009 13:57:45 +0000 (13:57 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 29 Sep 2009 13:57:45 +0000 (13:57 +0000)
inc/extranet/Controlleur/class.extranet.ajax.php
inc/extranet/Controlleur/class.extranet.core.php
inc/extranet/Controlleur/class.extranet.filtre.php
inc/extranet/Controlleur/class.ws.flash.php
inc/extranet/Controlleur/class.ws.url.php
inc/extranet/DAO/class.ws.dao.book.php
inc/extranet/Metier/class.ws.book.php
inc/extranet/Metier/class.ws.parametres.php

index daa8768a358e866292da2ba25d3d010a14eb591d..4f672746dbe4cec51ee01cbfae51484df3d36b24 100644 (file)
@@ -928,7 +928,7 @@ class extranetAjax {
                global $core;\r
                $dao = new wsDAOBook($core->con);\r
                $dao->supprime($args[1]);\r
-               $x->addContent('listeBooks', extranetUrl::listeBooks());\r
+               $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
 \r
        public static function searchBooks($args, &$x)\r
index 42c106d93b92a59622ff9df6fa6acdb55e60ab8f..5cb147f22aa06427a43da66a14140ba371116674 100644 (file)
@@ -32,7 +32,7 @@ class extranetCore extends cubeCore {
                        2 => __('Validé'), 3 => __('Refusé'));\r
                $this->factures_status = array(0 => __('Brouillon'), 1 => __('Attente'),\r
                        2 => __('Payée'), 3 => __('Annulée'), 4 => __('Avoir'));\r
-               $this->books_status = array(0 => __('Prêt'), 1 => __('Téléchargé'), 2 => __('Facturé'));\r
+               $this->books_status = array(-1 => __('Brouillon'), 0 => __('Prêt'), 1 => __('Téléchargé'), 2 => __('Facturé'));\r
                $this->agences = array('Paris', 'Montpellier');\r
        }\r
 \r
@@ -376,7 +376,7 @@ class extranetCore extends cubeCore {
                         . 'GROUP BY u.utilisateur_id');\r
                $this->createView('ws_clients', 'SELECT u.*,e.nom AS rs, e1.nom as facturable '\r
                         . 'FROM ws_utilisateurs u, entreprises e, entreprises e1,ws_utilisateurs u1  '\r
-                        . 'WHERE u.entreprise=e.entreprise_id AND u1.entreprise=e1.entreprise_id AND u.facturable_id=u1.utilisateur_id AND u.grade=0 ');\r
+                        . 'WHERE u.entreprise=e.entreprise_id AND u1.entreprise=e1.entreprise_id AND u.facturable_id=u1.utilisateur_id');\r
                $this->createView('taches_vue', 'SELECT taches.tache_id,taches.nom,taches.categorie,taches.type,taches.budget,taches.projet,taches.taux_journalier, '\r
                         . '(SUM(timereport.heures)/' . JOURNEE . ') AS jours_consommes, ((SUM(timereport.heures)/' . JOURNEE . ')/(taches.budget/taches.taux_journalier))*100 AS progression,(taches.budget/taches.taux_journalier) AS jours_prevus '\r
                         . 'FROM taches LEFT JOIN timereport ON taches.tache_id=timereport.tache_id '\r
@@ -431,7 +431,7 @@ class extranetCore extends cubeCore {
                         . 'WHERE t.projet=p.projet_id '\r
                         . 'GROUP BY t.categorie,p.annee_fin');\r
                $this->createView('books_vue', 'SELECT b.*,b.proprietaire AS proprietaire_id,c.rs AS proprietaire_nom,c.ws_admin,c.facturable_id,c.facturable '\r
-                        . 'FROM books b,ws_clients c WHERE b.proprietaire=c.utilisateur_id');\r
+                        . 'FROM books b, ws_clients c WHERE b.proprietaire=c.utilisateur_id');\r
                // cubeDb::mysqlConvert($this->con);\r
                touch($cache);\r
        }\r
index ea0ab62b07277b183cd5e27fb8d69663e2d3bcd8..b8fed388cabf43ff18097c15582d0afdec504c40 100644 (file)
@@ -13,7 +13,6 @@ class extranetFiltre {
                $this->all = __('Tous');\r
                $this->settings = isset($settings[$varname]) && count($settings[$varname])?$settings[$varname]:null;\r
                $this->getValues();\r
-               fb($this);\r
        }\r
 \r
        protected function getValues()\r
index 2ec796c79f0837ae8f5d6e4798ebfef10dd7eeba..6553873b100064059200a555119874ab8dfafbb4 100644 (file)
@@ -14,8 +14,32 @@ class wsFlash extends cubeFlashGateway {
 \r
        }\r
 \r
-       public function testDocuments(){\r
+       public function testDocuments()\r
+       {\r
+               $toload = $this->xml->addChild('toLoad');\r
+               $alreadyLoaded = $this->xml->addChild('alreadyLoaded');\r
+\r
+               foreach($this->args['fileName'] as $k => $name) {\r
+                       $toload->addChild('file', $name);\r
+               }\r
+       }\r
 \r
+       public function getPagesOfBook()\r
+       {\r
+               global $core;\r
+               $dao = new wsDAOBook($core->con);\r
+               $pages = $dao->getPagesOfBook($this->args['book_id']);\r
+               $p = $this->xml->addChild('pages');\r
+               $docs = array();\r
+               foreach($pages as $page => $info) {\r
+                       $pa = $p->addChild('page');\r
+                       $pa->addAttribute('page', $page);\r
+                       $pa->addAttribute('document_id', $info['document_id']);\r
+                       $pa->addAttribute('document_page', $info['document_page']);\r
+                       $docs[] = $info['document_id'];\r
+               }\r
+               $docs = array_unique($docs);\r
+               $p->addAttribute('documents', implode(',', $docs));\r
        }\r
 }\r
 \r
index d4d228b116edc839a882b79bc8ec1363b4af2a01..2b135635eb3bb892b214d6a73dd94a44ae21e0cc 100644 (file)
@@ -7,7 +7,7 @@ class wsUrl {
                $settings = $core->user->getSettings('books');\r
 \r
                $shortcuts = array();\r
-               $shortcuts[] = '<a href="' . SITE_PATH . 'editebook/new">' . $core->typo->Ajouter(__('Créer une nouvelle publication')) . '</a>';\r
+               $shortcuts[] = '<a href="' . SITE_PATH . 'editbook/new">' . $core->typo->Ajouter(__('Créer une nouvelle publication')) . '</a>';\r
 \r
                $filtres = array();\r
                $filtres[] = new extranetFiltre(__('Status'), 'status_book', $settings['filtres']);\r
@@ -61,7 +61,7 @@ class wsUrl {
                        $res .= '<td class="bouton"><a href="' . SITE_PATH . 'editbook/' . $book->book_id . '">' . cubeMedia::cssRollover($core->typo->Editer('éditer', '', false)) . '</a></td>';\r
                        $res .= '<td class="bouton"><a href="' . SITE_PATH . 'supprimebook/' . $book->book_id . '">' . cubeMedia::cssRollover($core->typo->Stats('stats', '', false)) . '</a></td>';\r
                        $res .= '<td class="bouton"><a href="' . SITE_PATH . 'supprimebook/' . $book->book_id . '">' . cubeMedia::cssRollover($core->typo->Telecharger('télécharger', '', false)) . '</a></td>';\r
-                       $res .= '<td class="bouton"><a href="' . SITE_PATH . 'supprimebook/' . $book->book_id . '">' . cubeMedia::cssRollover($core->typo->Supprimer('suppr.', '', false)) . '</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 ?').'">' . cubeMedia::cssRollover($core->typo->Supprimer('suppr.', '', false)) . '</a></td>';\r
                        $res .= '</tr>';\r
                        $i++;\r
                }\r
@@ -80,6 +80,13 @@ class wsUrl {
        {\r
                global $core;\r
                $book_id = $args[1];\r
+\r
+               if ($book_id == 'new') {\r
+                       $dao = new wsDAOBook($core->con);\r
+                       $book = $dao->creeEmpty($core->user->utilisateur_id);\r
+                       http::redirect(SITE_PATH . 'editbook/' . $book->book_id);\r
+               }\r
+\r
                $step = isset($args[2])?$args[2]:1;\r
 \r
                $shortcuts = array();\r
index e06d149217d416cbedd5222934b75e4266945f67..b8061daad300989d8d3727ea9623daede4f585d9 100644 (file)
@@ -16,7 +16,13 @@ class wsDAOBook extends extranetDAO {
                $book->status = $r->status;\r
                $book->date_status = $r->date_status;\r
                $book->date = $r->date;\r
-               $book->parametres = unserialize($r->parametres);\r
+               $book->pages = array();\r
+\r
+               $p = unserialize($r->parametres);\r
+               if (!$p) {\r
+                       $p = new wsBookParametres();\r
+               }\r
+               $book->parametres = $p;\r
 \r
                return $book;\r
        }\r
@@ -38,6 +44,7 @@ class wsDAOBook extends extranetDAO {
                $book->date_status = TIME;\r
                $book->date = TIME;\r
                $book->parametres = new wsBookParametres();\r
+               $book->pages = array();\r
                return $book;\r
        }\r
 \r
@@ -52,7 +59,7 @@ class wsDAOBook extends extranetDAO {
                if (is_null($book_id)) {\r
                        return $this->cree();\r
                }\r
-\r
+               $sql = 'SELECT * FROM books_vue WHERE book_id=\'' . $this->con->escape($book_id) . '\' LIMIT 1';\r
                $r = $this->con->select('SELECT * FROM books_vue WHERE book_id=\'' . $this->con->escape($book_id) . '\' LIMIT 1');\r
                return $this->singleton($r);\r
        }\r
@@ -71,7 +78,9 @@ class wsDAOBook extends extranetDAO {
                        $c->date = TIME;\r
                        $c->hash = md5(rand(0, 1234567893));\r
                        $c->compteur_visites = 20;\r
+                       $c->parametres = serialize(new wsParametres());\r
                        $book_id = $c->book_id = $this->getNextId();\r
+\r
                        $c->insert();\r
                } else {\r
                        $book_id = $data['book_id'];\r
@@ -81,7 +90,23 @@ class wsDAOBook extends extranetDAO {
                return $this->selectById($book_id);\r
        }\r
 \r
-       public function supprime($devis_id)\r
+       public function creeEmpty($createur)\r
+       {\r
+               $c = $this->con->openCursor('books');\r
+               $c->proprietaire = $createur;\r
+               $c->date = TIME;\r
+               $c->hash = md5(rand(0, 1234567893));\r
+               $c->compteur_visites = 20;\r
+               $c->status = -1;\r
+               $c->date_status = TIME;\r
+               $c->parametres = serialize(new wsParametres());\r
+               $book_id = $c->book_id = $this->getNextId();\r
+               $c->insert();\r
+               fb($book_id);\r
+               return $this->selectById($book_id);\r
+       }\r
+\r
+       public function supprime($book_id)\r
        {\r
                return $this->con->execute('DELETE FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
        }\r
@@ -92,6 +117,16 @@ class wsDAOBook extends extranetDAO {
                return $r->nb;\r
        }\r
 \r
+       public function getPagesOfBook($book_id)\r
+       {\r
+               $pages = array();\r
+               $r = $this->con->select('SELECT * FROM book_pages WHERE book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY book_page');\r
+               while ($r->fetch()) {\r
+                       $pages[$r->book_page] = array('document_id' => $r->document_id, 'document_page' => $r->document_page);\r
+               }\r
+               return $pages;\r
+       }\r
+\r
        public function getListe($orderby = null, $sens = null, $limit = null)\r
        {\r
                if (!is_null($this->q)) {\r
index 8b477a7ea312eaa494949453162ed356be57b1a5..7152a11eb8df68ba3891e8155701ea2631b7e8ef 100644 (file)
@@ -22,6 +22,8 @@ class wsBook extends cubeMetier {
        protected $date;\r
 \r
        protected $parametres;\r
+\r
+       protected $pages;\r
 }\r
 \r
 ?>
\ No newline at end of file
index 3735b4eb57f3c07b7fb119c7619b189a35fdbf35..447ee61ff8707a9a181474edb32b02d2140a7990 100644 (file)
@@ -72,7 +72,8 @@ class wsParametres extends cubeMetier {
                                $value = intval($value);\r
                                break;\r
                        default:\r
-\r
+                               $value = (string)$value;\r
+                               break;\r
                } // switch\r
                $this->datas[$varname] = $value;\r
        }\r