From f0ab933a78da13f89342a3eb422eec5c7eaf0acd Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 9 Dec 2014 15:23:16 +0000 Subject: [PATCH] --- inc/commons/DAO/class.common.dao.equipier.php | 90 ++-- .../class.extranet.page.chiffres.php | 145 +++++- .../Controlleur/class.extranet.tools.php | 219 +++++++++ .../Controlleur/class.extranet.url.php | 9 +- inc/extranet/Controlleur/url/_common.php | 10 + .../url/class.extranet.url.client.php | 278 ++++++++++++ .../url/class.extranet.url.devis.php | 335 ++++++++++++++ .../url/class.extranet.url.facture.php | 427 ++++++++++++++++++ .../url/class.extranet.url.projet.php | 353 +++++++++++++++ .../url/class.extranet.url.timereport.php | 133 ++++++ .../Metier/class.extranet.entreprise.php | 1 + .../Metier/class.extranet.tache.normale.php | 1 + 12 files changed, 1947 insertions(+), 54 deletions(-) create mode 100644 inc/extranet/Controlleur/class.extranet.tools.php create mode 100644 inc/extranet/Controlleur/url/_common.php create mode 100644 inc/extranet/Controlleur/url/class.extranet.url.client.php create mode 100644 inc/extranet/Controlleur/url/class.extranet.url.devis.php create mode 100644 inc/extranet/Controlleur/url/class.extranet.url.facture.php create mode 100644 inc/extranet/Controlleur/url/class.extranet.url.projet.php create mode 100644 inc/extranet/Controlleur/url/class.extranet.url.timereport.php diff --git a/inc/commons/DAO/class.common.dao.equipier.php b/inc/commons/DAO/class.common.dao.equipier.php index e68773bb5..b9ea72fb8 100644 --- a/inc/commons/DAO/class.common.dao.equipier.php +++ b/inc/commons/DAO/class.common.dao.equipier.php @@ -1,47 +1,45 @@ -utilisateur_id = $r->utilisateur_id; - $utilisateur->agence = $r->agence; - return parent::singleton($r); - } - - public function cree($utilisateur = null) - { - $utilisateur = new commonEquipier(); - $utilisateur->agence = 'Paris'; - $utilisateur->grade = 1; - return parent::cree($utilisateur); - } - - public function selectById($equipier_id,$table='equipiers') - { - $r = $this->con->select('SELECT * FROM '.$table.' WHERE utilisateur_id=' . $this->core->con->escape($equipier_id) . ' LIMIT 1'); - return $this->singleton($r); - } - - public function selectAll(){ - $r=$this->con->select('SELECT * FROM equipiers'); - return $this->factory($r); - } - - public function getListe($q = null, $orderby = null, $sens = null, $limit = null, $search_id = true) - { - global $core; - - $sql = $this->getQueryList('equipiers', $q, $orderby, $sens, $limit,false); - - $r = $this->con->select($sql); - return $this->factory($r); - } - - public function count() - { - $r = $this->con->select('SELECT COUNT(*) AS nb FROM equipiers'); - return $r->nb; - } -} - +utilisateur_id = $r->utilisateur_id; + $utilisateur->agence = $r->agence; + return parent::singleton($r); + } + + public function cree($utilisateur = null) { + $utilisateur = new commonEquipier(); + $utilisateur->agence = 'Paris'; + $utilisateur->grade = 1; + return parent::cree($utilisateur); + } + + public function selectById($equipier_id, $table = 'equipiers') { + $r = $this->con->select('SELECT * FROM ' . $table . ' WHERE utilisateur_id=' . $this->core->con->escape($equipier_id) . ' LIMIT 1'); + return $this->singleton($r); + } + + public function selectAll() { + $r = $this->con->select('SELECT * FROM equipiers'); + return $this->factory($r); + } + + public function getListe($q = null, $orderby = null, $sens = null, $limit = null, $search_id = true) { + global $core; + + $sql = $this->getQueryList('equipiers', $q, $orderby, $sens, $limit, 'enabled = 1'); + + $r = $this->con->select($sql); + return $this->factory($r); + } + + public function count() { + $r = $this->con->select('SELECT COUNT(*) AS nb FROM equipiers'); + return $r->nb; + } + +} + ?> \ No newline at end of file diff --git a/inc/extranet/Controlleur/class.extranet.page.chiffres.php b/inc/extranet/Controlleur/class.extranet.page.chiffres.php index 033d1f007..1326d546c 100644 --- a/inc/extranet/Controlleur/class.extranet.page.chiffres.php +++ b/inc/extranet/Controlleur/class.extranet.page.chiffres.php @@ -64,6 +64,8 @@ class extranetPageChiffres { $res.=self::caMensuel(); $res .= self::caCategorie($chiffres, $total); $res .= self::caWorkRate($chiffres, $total); + $res .= self::caSegments($chiffres, $total); + $res .= self::caSegmentsHf($chiffres, $total); return $res; } @@ -310,6 +312,8 @@ class extranetPageChiffres { $res .= commonPage::bf(); return $res; } + + public static function caCategoriesChart($a, $datas, $type, $width, $height, $max = 7) { global $core; @@ -338,7 +342,7 @@ class extranetPageChiffres { public static function caChart($chiffres, $encours) { global $core; - $title = __("*Evolution du chiffre d'affaire"); + $title = __("Evolution du chiffre d'affaire"); $chart = new cubeGoogleCharts('bvs', 940, 200); $chart->setTitle($title); $max = 0; @@ -364,6 +368,141 @@ class extranetPageChiffres { $chart->addData($cae); return $chart->display($title); } + + public static function caSegments($chiffres, $total){ + global $core; + return self::_caSegment('SELECT * FROM chiffres_types ORDER BY annee,type',__("CA par type de client")); + } + + + public static function caSegmentsHf($chiffres, $total){ + global $core; + return self::_caSegment('SELECT * FROM chiffres_types_hf ORDER BY annee,type',__("CA par type de client").'
('.__('Hors Fluidbook').')'); + } + + public static function caSegmentChart($a, $datas, $type, $width, $height, $max = 7) { + global $core; + $title = sprintf(__('Répartition pour %d'), $a); + $chart = new cubeGoogleCharts($type, $width, $height); + $chart->setTitle($title); + + $total = array_sum($datas); + $i = 1; + $others = 0; + + $types=$core->client_type; + $types[3]='TPE / PME'; + + foreach ($datas as $c => $ca) { + if($c==0){ + continue; + } + if ($i <= $max) { + $chart->addData($ca, null, $types[$c]); + $i++; + } else { + $others += $ca; + } + } + if ($others > 0) { + $chart->addData($others, null, __('Autres')); + } + + return $chart->display($title); + } + + protected static function _caSegment($req,$title){ + global $core; + $r = $core->con->select($req); + $segments=array(); + while($r->fetch()){ + $annees[]=$r->annee; + $segments[$r->type][$r->annee]=$r->ca; + } + + $chiffresa=array(); + $chiffreta=array(); + foreach($segments as $type=>$tab){ + + if($type==1){ + $type=3; + } + foreach($tab as $a=>$ca){ + if(!isset($chiffresa[$a])){ + $chiffresa[$a]=array(); + $chiffreta[$a]=0; + } + if(!isset($chiffresa[$a][$type])){ + $chiffresa[$a][$type]=0; + } + $chiffresa[$a][$type]+=$ca; + $chiffreta[$a]+=$ca; + } + + } + + $annees=array_unique($annees); + sort($annees); + + + $res = commonPage::bh(); + $res .= ''; + + $res .= ''; + + $res .= ''; + foreach ($annees as $annee) { + $total_annee[$annee] = 0; + $res .= ''; + } + $res .= ''; + $res .= ''; + $i = 0; + foreach ($segments as $type => $tab) { + $odd = (cubeMath::isOdd($i)) ? ' class="odd"' : ''; + $res .= ''; + $res .= ''; + + $total_type = 0; + + foreach ($annees as $annee) { + if (isset($tab[$annee])) { + $ca = self::format($tab[$annee], true); + $part=round(($tab[$annee]/$chiffreta[$annee])*100).'%'; + $col = $ca . ' (' . $part . ')'; + $total_type += $tab[$annee]; + $total_annee[$annee] += $tab[$annee]; + } else { + $part = '-'; + $col = '-'; + } + $res .= ''; + } + + $res .= ''; + $res .= ''; + $i++; + } + $res .= ''; + foreach ($annees as $annee) { + if (isset($total_annee[$annee])) { + $c = $total_consomme_annee[$annee]; + $p = $total_prevu_annee[$annee]; + $res .= ''; + } + } + + $res .= ''; + $res .= ''; + $res .= '
'; + $a = date('Y') - 1; + $res .= self::caSegmentChart($a, $chiffresa[$a], 'p3', 440, 150); + $a++; + $res .= self::caSegmentChart($a, $chiffresa[$a], 'p3', 500, 200); + $res .= '
' . $title . '' . $annee . '' . __('Total') . '
' . $core->client_type[$type] . '' . $col . '' . self::format($total_type, true).'
' . __('Total') . '' . self::format($total_annee[$annee], true) .'' . ''.'
'; + $res .= commonPage::bf(); + return $res; + } public static function caWorkRate($chiffres, $total) { global $core; @@ -451,6 +590,4 @@ class extranetPageChiffres { return $res; } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/inc/extranet/Controlleur/class.extranet.tools.php b/inc/extranet/Controlleur/class.extranet.tools.php new file mode 100644 index 000000000..b54ad27da --- /dev/null +++ b/inc/extranet/Controlleur/class.extranet.tools.php @@ -0,0 +1,219 @@ +'; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.='
' . __('Décoder une URL') . ' (' . __('de la forme') . ' : http%3A%2F%2Fwww )
Collez l\'url à décoder
Url décodée
'; + $res.=''; + $res .= ''; + $res .= commonPage::bf(); + $res .= commonPage::bMain(); + return $res; + } + + public static function tube($args) { + global $css, $js; + + $css = array(); + $js[] = JS_PATH . '/tube.js'; + $js[] = JS_PATH . '/modernizr.js'; + + $url = $_GET['u']; + $hash = sha1($url); + + $web = '/tube/' . $hash . '/'; + $dir = ROOT . $web; + if (!file_exists($dir)) { + + mkdir($dir, 0777, true); + $ext = files::getExtension($url); + $original = $dir . 'video.' . $ext; + copy($url, $original); + + require_once ROOT . '/inc/ws/Util/class.ws.tools.php'; + wsTools::encodeWebVideos($original); + } + + + $loop = isset($_GET['loop']) ? $_GET['loop'] : 0; + $autoplay = isset($_GET['autoplay']) ? $_GET['autoplay'] : 0; + $controls = isset($_GET['controls']) ? $_GET['controls'] : 1; + + $fv = array('video' => $url, + 'autoPlay' => $autoplay == 1, + 'controls' => $controls == 1, + 'loop' => $loop == 1); + + if (file_exists($dir . 'video.jpg')) { + $poster = $web . 'video.jpg'; + $fv['poster'] = 'http://' . $_SERVER['HTTP_HOST'] . $poster; + } + + $res = ''; + + $alt = '