$x->addContent('result', mb_strtoupper(md5($_POST['recipient'] . '+' . $_POST['form_id'] . '+n0_$PAM_please!')));
}
- /**
- * @param $args
- * @param cubeAjax $x
- * @throws PHPExcel_Exception
- * @throws PHPExcel_Reader_Exception
- */
- public static function importWSReferences($args, &$x)
- {
- global $core;
-
- new PHPExcel();
-
- $e = explode('.', $_FILES['file']['name']);
- $ext = mb_strtolower(array_pop($e));
-
-// $x->enableXML=false;
-// print_r($_FILES);
-// exit;
-
- if ($ext == 'xlsx') {
- $reader = new PHPExcel_Reader_Excel2007();
- } else if ($ext == 'csv') {
- $reader = new PHPExcel_Reader_CSV();
- $reader->setDelimiter(";");
- }
-
-
- $phpexcel = $reader->load($_FILES['file']['tmp_name']);
- $sheet = $phpexcel->getSheet(0);
- $maxRow = $sheet->getHighestRow(0);
-
- $updated = 0;
-
- $add = [];
-
- for ($i = 1; $i <= $maxRow; $i++) {
- $ref = trim($sheet->getCellByColumnAndRow(0, $i));
- $url = trim($sheet->getCellByColumnAndRow(1, $i)->getOldCalculatedValue());
-
- if ($ref == '') {
- $ref = trim($sheet->getCellByColumnAndRow(0, $i)->getFormattedValue());
- }
- if ($url == '') {
- $url = trim($sheet->getCellByColumnAndRow(1, $i)->getFormattedValue());
- }
-
-
- if ($url == '' || $ref == '') {
- continue;
- }
-
- $fref = self::_formatWsReferenceRef($ref, $_POST['type']);
- $furl = self::_formatWsReferenceUrl($url, $_POST['type']);
- $add[$fref] = $furl;
- }
-
- try {
- $refs = [];
- foreach ($add as $fref => $furl) {
- $refs[] = "'" . $core->con->escape($fref) . "'";
- }
-
- $delete = "DELETE FROM wsref WHERE ref IN(" . implode(',', $refs) . ") AND type='" . $core->con->escape($_POST['type']) . "'";
- $core->con->execute($delete);
- } catch (Exception $e) {
- }
-
- foreach ($add as $fref => $furl) {
- try {
- $c = $core->con->openCursor('wsref');
- $c->type = $_POST['type'];
- $c->ref = $fref;
- $c->url = $furl;
- $c->insert();
- $updated++;
- } catch (Exception $e) {
-
- }
- }
-
- $x->addAlert(sprintf(__('%d liens insérés ou mis à jour'), $updated));
- }
-
- public static function _formatWsReferenceRef($ref, $type)
- {
- if ($type === '10doigts') {
- if (stripos($ref, 'ic') === 0) {
- return 'C' . substr($ref, 2);
- }
- }
- return $ref;
- }
-
- public static function _formatWsReferenceUrl($url, $type)
- {
- return $url;
- }
}
$db->bulle->nom('varchar', 128, false);\r
$db->bulle->catalogue('varchar', 128, false);\r
\r
- // WS Ref\r
-\r
- $db->wsref->type('varchar', 32, false);\r
- $db->wsref->ref('varchar', 32, false);\r
- $db->wsref->url('varchar', 512, false);\r
- $db->wsref->primary('pk_wsref', 'type', 'ref');\r
-\r
// Table google search api\r
$db->google_search_api->request('varchar', 256, false);\r
$db->google_search_api->response('text', 0, false);\r
. 'WHERE p.client_id=e.utilisateur_id '\r
. 'GROUP BY e.type, p.annee_fin');\r
$this->views->createView('signatures', 'SELECT * FROM fluidbook_toolbox.signature');\r
+ $this->views->createView('wsref', 'SELECT * FROM fluidbook_toolbox.fluidbook_reference_url');\r
touch($cache);\r
}\r
\r
public static function importWSReferences()
{
- $options = ['10doigts' => '10 doigts',
- 'ascocelda' => 'Asco & Celda',
- 'wesco' => 'Wesco',
- 'mopec' => 'Mopec',
- 'intex' => 'Intex',
- 'grosfillex' => 'Grosfillex'];
-
- $options = array_flip($options);
- ksort($options);
-
- commonDroits::min(5);
- global $core;
- $res = commonPage::barre();
- $res .= commonPage::tMain();
- $res .= commonPage::bh();
- $res .= '<form action="importWSReferences" method="post" enctype="multipart/form-data">';
- $res .= '<table class="liste">';
- $res .= '<tr><th colspan="2"><strong>' . __('Importer un fichier de références') . '</strong></th></tr>';
- $res .= '<tr><td>' . __("Fichier XLSX") . '<br>(colonne A : référence, colonne B : URL)</td><td><input type="file" name="file" accept=".xlsx,.csv" /></td></tr>';
- $res .= '<tr><td>' . __("Type") . '</td><td>' . form::combo('type', $options) . '</td></tr>';
- $res .= '<tr><td class="right" colspan="2"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Importer les références')) . '</a></td></td>';
- $res .= '</table>';
- $res .= '</form>';
- $res .= commonPage::bf();
-
- $res .= commonPage::bMain();
- return $res;
+// $options = ['10doigts' => '10 doigts',
+// 'ascocelda' => 'Asco & Celda',
+// 'wesco' => 'Wesco',
+// 'mopec' => 'Mopec',
+// 'intex' => 'Intex',
+// 'grosfillex' => 'Grosfillex'];
+//
+// $options = array_flip($options);
+// ksort($options);
+//
+// commonDroits::min(5);
+// global $core;
+// $res = commonPage::barre();
+// $res .= commonPage::tMain();
+// $res .= commonPage::bh();
+// $res .= '<form action="importWSReferences" method="post" enctype="multipart/form-data">';
+// $res .= '<table class="liste">';
+// $res .= '<tr><th colspan="2"><strong>' . __('Importer un fichier de références') . '</strong></th></tr>';
+// $res .= '<tr><td>' . __("Fichier XLSX") . '<br>(colonne A : référence, colonne B : URL)</td><td><input type="file" name="file" accept=".xlsx,.csv" /></td></tr>';
+// $res .= '<tr><td>' . __("Type") . '</td><td>' . form::combo('type', $options) . '</td></tr>';
+// $res .= '<tr><td class="right" colspan="2"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Importer les références')) . '</a></td></td>';
+// $res .= '</table>';
+// $res .= '</form>';
+// $res .= commonPage::bf();
+//
+// $res .= commonPage::bMain();
+// return $res;
+ http::redirect('https://toolbox.fluidbook.com/tools/fluidbookrefurl');
}