]> _ Git - cubeextranet.git/commitdiff
cleanup tools | wip #1181 @0:20
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 1 Mar 2017 11:13:02 +0000 (11:13 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 1 Mar 2017 11:13:02 +0000 (11:13 +0000)
inc/commons/class.common.tools.php

index 215a8df4568b41204c1217238c4e8ab4319aea8c..00133fb7e550bf1e597fbfeebf6f808018fa7879 100644 (file)
@@ -24,6 +24,8 @@ class commonTools {
 
        public static function des() {
                global $core;
+               commonDroits::min(2);
+
                $ue = array_diff(cubeCountry::getUECountries(), array('FR'));
 
                $countries = "'" . implode("','", $ue) . "'";
@@ -197,7 +199,7 @@ class commonTools {
                $url = $_GET['u'];
                $hash = sha1($url);
 
-               $onlyplayer = isset($_GET['onlyplayer']) && $onlyplayer;
+               $onlyplayer = isset($_GET['onlyplayer']);
 
                if (!$onlyplayer) {
                        $web = '/tube/' . $hash . '/';
@@ -321,134 +323,6 @@ class commonTools {
                return $res;
        }
 
-       public static function exportClients($args) {
-               global $core;
-
-               $types = array('Cubedesigners' => 'cube', 'Tous les contacts (Clients de revendeurs inclus)' => 'all');
-               $typeexp = array('Entreprises' => 'entreprises', 'Utilisateurs' => 'users');
-
-               $res = commonPage::barre();
-               $res .= commonPage::tMain();
-               $res .= commonPage::bh();
-               $res .= '<form action="' . SITE_PATH . 'tools / exportClientsXLS" method="post" class="notajax">';
-               $res .= '<table class="liste">';
-               $res .= '<tr><th colspan="3"><strong>' . __('Exporter la base clients') . '</strong></th></tr>';
-               $res .= '<tr><td>' . __('Type de client') . '</td><td>' . form::combo('type', $types) . '</td></td>';
-               $res .= '<tr class="odd"><td class="right" colspan="2"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Exporter')) . '</a></td></td>';
-               $res .= '</table>';
-               $res .= '</form>';
-               $res .= '</div>';
-               $res .= commonPage::bf();
-               $res .= commonPage::bMain();
-               return $res;
-       }
-
-       public static function exportClientsXLS($args) {
-               global $core;
-
-               $sql = 'SELECT * FROM entreprises_ws';
-               if ($_POST['type'] == 'cube') {
-                       $sql .= " WHERE revendeur = 'Cubedesigners'";
-               }
-
-               $r = $core->con->select($sql);
-               $entreprises = array();
-               $rows = $r->rows();
-               foreach ($rows as $r) {
-
-                       $entreprises[$r['entreprise_id']] = $r;
-                       $entreprises[$r['entreprise_id']]['utilisateurs'] = array();
-               }
-
-               $r = $core->con->select('SELECT * FROM utilisateurs_entreprise WHERE entreprise IN(' . implode(',', array_keys($entreprises)) . ')');
-               $rows = $r->rows();
-               foreach ($rows as $r) {
-                       $entreprises[$r['entreprise']]['utilisateurs'][$r['utilisateur_id']] = $r;
-               }
-
-               $xls = new PHPExcel();
-               $s1 = $xls->getActiveSheet();
-               $s1->setTitle('Entreprises');
-               self::exportClientsXLSEntreprises($s1, $entreprises);
-
-               $s2 = $xls->createSheet();
-               $s2->setTitle('Utilisateurs');
-               self::exportClientsXLSUsers($s2, $entreprises);
-
-               ob_end_clean();
-               files::$mimeType['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
-               cubeHTTP::forceDownload('clients.xlsx', false);
-
-               $xls->setActiveSheetIndex(0);
-               $writer = new PHPExcel_Writer_Excel2007($xls);
-               $writer->save('php://output');
-               exit;
-       }
-
-       /**
-        *
-        * @param PHPExcel_Worksheet $s
-        * @param type $e
-        */
-       public static function exportClientsXLSEntreprises(&$s, $e) {
-               $j = 2;
-               $w = 3;
-               foreach ($e as $id => $datas) {
-                       $mainAddress = self::_address($datas['nom'], $datas['adresse'], $datas['code_postal'], $datas['ville'], $datas['pays']);
-                       $otherAddress = array();
-                       foreach ($datas['utilisateurs'] as $u) {
-                               $a = self::_address($datas['nom'], $u['adresse'], $u['code_postal'], $u['ville'], $u['pays']);
-                               if ($a != $mainAddress && !in_array($a, $otherAddress)) {
-                                       $otherAddress[] = $a;
-                               }
-                       }
-
-                       $s->getCellByColumnAndRow(0, $j)->setValue($id);
-                       $s->getCellByColumnAndRow(1, $j)->setValue($datas['nom']);
-                       $s->getCellByColumnAndRow(2, $j)->setValue($mainAddress);
-                       $i = 3;
-                       foreach ($otherAddress as $o) {
-                               $s->getCellByColumnAndRow($i, $j)->setValue($o);
-                               $i++;
-                       }
-                       $j++;
-                       $w = max($w, $i);
-               }
-
-               $h = $j;
-
-               $s->getCellByColumnAndRow(0, 1)->setValue('#');
-               $s->getCellByColumnAndRow(1, 1)->setValue('Raison sociale');
-               $s->getCellByColumnAndRow(2, 1)->setValue('Adresse principale');
-               $s->getCellByColumnAndRow(3, 1)->setValue('Autres adresses');
-
-               for ($i = 0; $i <= $w; $i++) {
-                       for ($j = 0; $j <= $h; $j++) {
-                               $style = $s->getStyleByColumnAndRow($i, $j);
-                               $style->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER)->setWrapText(true);
-                       }
-                       if ($i == 0) {
-                               $s->getColumnDimensionByColumn($i)->setAutoSize();
-                       } elseif ($i == 1) {
-                               $s->getColumnDimensionByColumn($i)->setWidth(20);
-                       } else {
-                               $s->getColumnDimensionByColumn($i)->setWidth(30);
-                       }
-               }
-       }
-
-       protected static function _address($nom, $adresse, $code_postal, $ville, $pays) {
-               return trim(trim($nom) . "\r\n" . trim($adresse) . "\r\n" . trim($code_postal . " " . $ville) . "\r\n" . cubeCountry::getCountryName($pays, 'fr_FR'));
-       }
-
-       /**
-        *
-        * @param PHPExcel_Worksheet $s
-        * @param type $e
-        */
-       public static function exportClientsXLSUsers(&$s, $e) {
-
-       }
 
        public static function favicon($args) {
                global $core;
@@ -709,11 +583,6 @@ class commonTools {
                exit;
        }
 
-       public static function css() {
-
-       }
-
-
        public static function csr() {
                commonDroits::min(1);
                global $core;