From: vincent@cubedesigners.com Date: Tue, 29 Sep 2009 13:57:45 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=8c1c02fd3966d8034b2e3a64ddb876f8aab52832;p=cubeextranet.git --- diff --git a/inc/extranet/Controlleur/class.extranet.ajax.php b/inc/extranet/Controlleur/class.extranet.ajax.php index daa8768a3..4f672746d 100644 --- a/inc/extranet/Controlleur/class.extranet.ajax.php +++ b/inc/extranet/Controlleur/class.extranet.ajax.php @@ -928,7 +928,7 @@ class extranetAjax { global $core; $dao = new wsDAOBook($core->con); $dao->supprime($args[1]); - $x->addContent('listeBooks', extranetUrl::listeBooks()); + $x->addContent('listeBooks', wsUrl::listeBooks()); } public static function searchBooks($args, &$x) diff --git a/inc/extranet/Controlleur/class.extranet.core.php b/inc/extranet/Controlleur/class.extranet.core.php index 42c106d93..5cb147f22 100644 --- a/inc/extranet/Controlleur/class.extranet.core.php +++ b/inc/extranet/Controlleur/class.extranet.core.php @@ -32,7 +32,7 @@ class extranetCore extends cubeCore { 2 => __('Validé'), 3 => __('Refusé')); $this->factures_status = array(0 => __('Brouillon'), 1 => __('Attente'), 2 => __('Payée'), 3 => __('Annulée'), 4 => __('Avoir')); - $this->books_status = array(0 => __('Prêt'), 1 => __('Téléchargé'), 2 => __('Facturé')); + $this->books_status = array(-1 => __('Brouillon'), 0 => __('Prêt'), 1 => __('Téléchargé'), 2 => __('Facturé')); $this->agences = array('Paris', 'Montpellier'); } @@ -376,7 +376,7 @@ class extranetCore extends cubeCore { . 'GROUP BY u.utilisateur_id'); $this->createView('ws_clients', 'SELECT u.*,e.nom AS rs, e1.nom as facturable ' . 'FROM ws_utilisateurs u, entreprises e, entreprises e1,ws_utilisateurs u1 ' - . 'WHERE u.entreprise=e.entreprise_id AND u1.entreprise=e1.entreprise_id AND u.facturable_id=u1.utilisateur_id AND u.grade=0 '); + . 'WHERE u.entreprise=e.entreprise_id AND u1.entreprise=e1.entreprise_id AND u.facturable_id=u1.utilisateur_id'); $this->createView('taches_vue', 'SELECT taches.tache_id,taches.nom,taches.categorie,taches.type,taches.budget,taches.projet,taches.taux_journalier, ' . '(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 ' . 'FROM taches LEFT JOIN timereport ON taches.tache_id=timereport.tache_id ' @@ -431,7 +431,7 @@ class extranetCore extends cubeCore { . 'WHERE t.projet=p.projet_id ' . 'GROUP BY t.categorie,p.annee_fin'); $this->createView('books_vue', 'SELECT b.*,b.proprietaire AS proprietaire_id,c.rs AS proprietaire_nom,c.ws_admin,c.facturable_id,c.facturable ' - . 'FROM books b,ws_clients c WHERE b.proprietaire=c.utilisateur_id'); + . 'FROM books b, ws_clients c WHERE b.proprietaire=c.utilisateur_id'); // cubeDb::mysqlConvert($this->con); touch($cache); } diff --git a/inc/extranet/Controlleur/class.extranet.filtre.php b/inc/extranet/Controlleur/class.extranet.filtre.php index ea0ab62b0..b8fed388c 100644 --- a/inc/extranet/Controlleur/class.extranet.filtre.php +++ b/inc/extranet/Controlleur/class.extranet.filtre.php @@ -13,7 +13,6 @@ class extranetFiltre { $this->all = __('Tous'); $this->settings = isset($settings[$varname]) && count($settings[$varname])?$settings[$varname]:null; $this->getValues(); - fb($this); } protected function getValues() diff --git a/inc/extranet/Controlleur/class.ws.flash.php b/inc/extranet/Controlleur/class.ws.flash.php index 2ec796c79..6553873b1 100644 --- a/inc/extranet/Controlleur/class.ws.flash.php +++ b/inc/extranet/Controlleur/class.ws.flash.php @@ -14,8 +14,32 @@ class wsFlash extends cubeFlashGateway { } - public function testDocuments(){ + public function testDocuments() + { + $toload = $this->xml->addChild('toLoad'); + $alreadyLoaded = $this->xml->addChild('alreadyLoaded'); + + foreach($this->args['fileName'] as $k => $name) { + $toload->addChild('file', $name); + } + } + public function getPagesOfBook() + { + global $core; + $dao = new wsDAOBook($core->con); + $pages = $dao->getPagesOfBook($this->args['book_id']); + $p = $this->xml->addChild('pages'); + $docs = array(); + foreach($pages as $page => $info) { + $pa = $p->addChild('page'); + $pa->addAttribute('page', $page); + $pa->addAttribute('document_id', $info['document_id']); + $pa->addAttribute('document_page', $info['document_page']); + $docs[] = $info['document_id']; + } + $docs = array_unique($docs); + $p->addAttribute('documents', implode(',', $docs)); } } diff --git a/inc/extranet/Controlleur/class.ws.url.php b/inc/extranet/Controlleur/class.ws.url.php index d4d228b11..2b135635e 100644 --- a/inc/extranet/Controlleur/class.ws.url.php +++ b/inc/extranet/Controlleur/class.ws.url.php @@ -7,7 +7,7 @@ class wsUrl { $settings = $core->user->getSettings('books'); $shortcuts = array(); - $shortcuts[] = '' . $core->typo->Ajouter(__('Créer une nouvelle publication')) . ''; + $shortcuts[] = '' . $core->typo->Ajouter(__('Créer une nouvelle publication')) . ''; $filtres = array(); $filtres[] = new extranetFiltre(__('Status'), 'status_book', $settings['filtres']); @@ -61,7 +61,7 @@ class wsUrl { $res .= '' . cubeMedia::cssRollover($core->typo->Editer('éditer', '', false)) . ''; $res .= '' . cubeMedia::cssRollover($core->typo->Stats('stats', '', false)) . ''; $res .= '' . cubeMedia::cssRollover($core->typo->Telecharger('télécharger', '', false)) . ''; - $res .= '' . cubeMedia::cssRollover($core->typo->Supprimer('suppr.', '', false)) . ''; + $res .= '' . cubeMedia::cssRollover($core->typo->Supprimer('suppr.', '', false)) . ''; $res .= ''; $i++; } @@ -80,6 +80,13 @@ class wsUrl { { global $core; $book_id = $args[1]; + + if ($book_id == 'new') { + $dao = new wsDAOBook($core->con); + $book = $dao->creeEmpty($core->user->utilisateur_id); + http::redirect(SITE_PATH . 'editbook/' . $book->book_id); + } + $step = isset($args[2])?$args[2]:1; $shortcuts = array(); diff --git a/inc/extranet/DAO/class.ws.dao.book.php b/inc/extranet/DAO/class.ws.dao.book.php index e06d14921..b8061daad 100644 --- a/inc/extranet/DAO/class.ws.dao.book.php +++ b/inc/extranet/DAO/class.ws.dao.book.php @@ -16,7 +16,13 @@ class wsDAOBook extends extranetDAO { $book->status = $r->status; $book->date_status = $r->date_status; $book->date = $r->date; - $book->parametres = unserialize($r->parametres); + $book->pages = array(); + + $p = unserialize($r->parametres); + if (!$p) { + $p = new wsBookParametres(); + } + $book->parametres = $p; return $book; } @@ -38,6 +44,7 @@ class wsDAOBook extends extranetDAO { $book->date_status = TIME; $book->date = TIME; $book->parametres = new wsBookParametres(); + $book->pages = array(); return $book; } @@ -52,7 +59,7 @@ class wsDAOBook extends extranetDAO { if (is_null($book_id)) { return $this->cree(); } - + $sql = 'SELECT * FROM books_vue WHERE book_id=\'' . $this->con->escape($book_id) . '\' LIMIT 1'; $r = $this->con->select('SELECT * FROM books_vue WHERE book_id=\'' . $this->con->escape($book_id) . '\' LIMIT 1'); return $this->singleton($r); } @@ -71,7 +78,9 @@ class wsDAOBook extends extranetDAO { $c->date = TIME; $c->hash = md5(rand(0, 1234567893)); $c->compteur_visites = 20; + $c->parametres = serialize(new wsParametres()); $book_id = $c->book_id = $this->getNextId(); + $c->insert(); } else { $book_id = $data['book_id']; @@ -81,7 +90,23 @@ class wsDAOBook extends extranetDAO { return $this->selectById($book_id); } - public function supprime($devis_id) + public function creeEmpty($createur) + { + $c = $this->con->openCursor('books'); + $c->proprietaire = $createur; + $c->date = TIME; + $c->hash = md5(rand(0, 1234567893)); + $c->compteur_visites = 20; + $c->status = -1; + $c->date_status = TIME; + $c->parametres = serialize(new wsParametres()); + $book_id = $c->book_id = $this->getNextId(); + $c->insert(); + fb($book_id); + return $this->selectById($book_id); + } + + public function supprime($book_id) { return $this->con->execute('DELETE FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } @@ -92,6 +117,16 @@ class wsDAOBook extends extranetDAO { return $r->nb; } + public function getPagesOfBook($book_id) + { + $pages = array(); + $r = $this->con->select('SELECT * FROM book_pages WHERE book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY book_page'); + while ($r->fetch()) { + $pages[$r->book_page] = array('document_id' => $r->document_id, 'document_page' => $r->document_page); + } + return $pages; + } + public function getListe($orderby = null, $sens = null, $limit = null) { if (!is_null($this->q)) { diff --git a/inc/extranet/Metier/class.ws.book.php b/inc/extranet/Metier/class.ws.book.php index 8b477a7ea..7152a11eb 100644 --- a/inc/extranet/Metier/class.ws.book.php +++ b/inc/extranet/Metier/class.ws.book.php @@ -22,6 +22,8 @@ class wsBook extends cubeMetier { protected $date; protected $parametres; + + protected $pages; } ?> \ No newline at end of file diff --git a/inc/extranet/Metier/class.ws.parametres.php b/inc/extranet/Metier/class.ws.parametres.php index 3735b4eb5..447ee61ff 100644 --- a/inc/extranet/Metier/class.ws.parametres.php +++ b/inc/extranet/Metier/class.ws.parametres.php @@ -72,7 +72,8 @@ class wsParametres extends cubeMetier { $value = intval($value); break; default: - + $value = (string)$value; + break; } // switch $this->datas[$varname] = $value; }