exit;
}
+ public static function ipGlobal($error = "")
+ {
+ global $core;
+
+ commonDroits::min(1);
+
+ if (is_array($error)) {
+ $errorMessage = '';
+ } else {
+ $errorMessage = $error;
+ }
+
+ $res = commonPage::barre();
+ $res .= commonPage::tMain();
+ $res .= commonPage::bh();
+ $res .= '<form action="' . SITE_PATH . 'tools/buildIpGlobal" method="post" class="notajax" enctype="multipart/form-data">';
+ $res .= '<table class="liste">';
+ $res .= '<tr><th><strong>' . __('Générer une bibliothèque IPGlobal') . '</strong></th></tr>';
+ $res .= '<tr><td>Veuillez charger les données de la bibliothèque (Un fichier zip contenant le fichier data.xml et les images) | Télécharger <a href="/ipglobal/ipglobal-template.zip"> un modèle</a> | <a href="/ipglobal/ipglobal-latest.zip">le dernier chargé</a> </td></tr>';
+ $res .= '<tr class="odd"><td><input type="file" name="file" /><span style="color:#c00">' . $errorMessage . '</span></td></tr>';
+ $res .= '<tr class=""><td><label><input type="checkbox" name="valid" value="ok" /> ' . __("C'est validé !") . ' (' . sprintf(__('Cela sera mis en ligne à l\'%sadresse finale%s'), '<a href="https://hosting.fluidbook.com/ipglobal/library/">', '</a>') . ')</label></td></tr>';
+ $res .= '<tr><td class="right"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Genérer la bibliothèque')) . '</a></td></td>';
+ $res .= '</table>';
+ $res .= '</form>';
+ $res .= '</div>';
+ $res .= commonPage::bf();
+ $res .= commonPage::bMain();
+ return $res;
+ }
+
+ public static function buildIpGlobal()
+ {
+
+ commonDroits::min(1);
+ if (!count($_FILES) || !isset($_FILES['file']) || $_FILES['file']['error'] > 0) {
+ return self::ipGlobal(__('Erreur lors du chargement du fichier'));
+ }
+ $valid = isset($_POST['valid']) && $_POST['valid'] === 'ok';
+
+ copy($_FILES['file']['tmp_name'], ROOT . '/ipglobal/ipglobal-latest.zip');
+
+ // Update git repository
+ $repos = ROOT . '/../ipglobal-library/';
+
+ `cd $repos;git reset --hard;git pull`;
+
+ // Handle zip upload
+ $uploaded = new ZipArchive();
+ $uploaded->open($_FILES['file']['tmp_name']);
+ $data = simplexml_load_string(str_replace('&', '&', $uploaded->getFromName('data.xml')));
+ if (!$data) {
+ return self::ipGlobal(__('Erreur lors de l\'analyse du fichier XML'));
+ }
+
+ // Generate the html
+ $html = '';
+ foreach ($data->xpath('/ipglobal/library') as $library) {
+ $id = (string)$library->id;
+ $title = (string)$library->title;
+ $html .= '<section class="block ' . $id . '">';
+ $html .= '<div class="content">';
+ if ($title !== '') {
+ $html .= '<h2 id="' . $id . '">' . $title . '</h2>';
+ }
+
+ foreach ($library->shelf as $shelf) {
+ $html .= '<div class="brochures">';
+ $id = (string)$shelf->id;
+ $title = (string)$shelf->title;
+ if ($title !== '') {
+ $html .= '<h3>' . $title . '</h3>';
+ }
+ $image = (string)$shelf->image;
+ $imagecontent = $uploaded->getFromName($image);
+ if ($imagecontent) {
+ file_put_contents($repos . '/images/' . $image, $imagecontent);
+ }
+ $html .= '<img src="images/' . $image . '" alt="' . $title . '" id="image-' . $id . '" usemap="#map-' . $id . '">';
+ $html .= '<map name="map-' . $id . '">' . $shelf->map->asXML() . '</map>';
+ $html .= '</div>';
+ }
+ $html .= '</div>';
+ $html .= '</section>';
+ }
+ // Replace the html in the source
+ file_put_contents($repos . '/index.html', str_replace('<library />', $html, file_get_contents($repos . '/index.html')));
+
+ // Copy files to the server
+ if ($valid) {
+ $dir = 'library';
+ } else {
+ $dir = 'library_' . date('Ymd');
+ }
+ $dest = '/mnt/sshfs/fluidbook/data/fluidbook/hosting/ipglobal/' . $dir;
+ if ($valid) {
+ // IF valid checkbox, we make a backup
+ $old = $dest . '_old_' . date('Ymd');
+ `mv $dest $old`;
+ } else {
+ // We just remove the dest
+ if (file_exists($dest)) {
+ `rm -rf $dest`;
+ }
+ }
+ // Create the dest dir
+ mkdir($dest, 0777, true);
+ $papath = implode(PATH_SEPARATOR, array('/usr/bin', getenv('PATH')));
+ putenv($papath);
+ // Run the command to build the library
+ $cmd = "export PATH=$papath;echo \$PATH;cd $repos;yarn install 2>&1;yarn alien 2>&1;cp -r ./dist/* $dest/ 2>&1";
+ $output = shell_exec($cmd);
+ // Display error if no index.html
+ if (!file_exists($dest . '/index.html')) {
+ echo $cmd . ':' . $output;
+ exit;
+ }
+ // Redirect to the library
+ header('Location: https://hosting.fluidbook.com/ipglobal/' . $dir . '/');
+
+ /*
+ * <section class="block project-brochures">
+ <div class="content">
+ <h2 id="project-brochures">Project Brochures</h2>
+ <div class="brochures">
+ <h3>UK Projects</h3>
+
+ <!-- ### IMAGE MAP EDITOR: http://image-map.weebly.com/ ### -->
+
+ <img src="images/brochures-uk.jpg" alt="UK projects" style="margin-top: -38px" usemap="#brochures_uk">
+ <map name="brochures_uk">
+ <area shape="circle" coords="226, 121, 25" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-UK-Birmingham-Bishton-Fletcher-Building/" target="_blank" alt="Bishton Fletcher Building (EN)" />
+ <area shape="circle" coords="226, 186, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-CH-Birmingham-Bishton-Fletcher-Building/" target="_blank" alt="Bishton Fletcher Building (CN)" />
+ <area shape="circle" coords="498, 185, 23" href="https://hosting.fluidbook.com/IP-GLOBAL-CH-Manchester-Crossbank/#/page/1" target="_blank" alt="Crossbank (CN)" />
+ <area shape="circle" coords="498, 120, 24" href="https://hosting.fluidbook.com/IP-GLOBAL-UK-Manchester-Crossbank/" target="_blank" alt="Crossbank (EN)" />
+ <area shape="circle" coords="1070, 187, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Kent-Street-Residence-CH/m/" target="_blank" alt="Kent Street Residence (CN)" />
+ <area shape="circle" coords="1070, 121, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Kent-Street-Residence/m" target="_blank" alt="Kent Street Residence (EN)" />
+ <area shape="circle" coords="208, 548, 23" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Lucent-Square-CH/m/" target="_blank" alt="Lucent Square Leeds (CN)" />
+ <area shape="circle" coords="208, 483, 23" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Lucent-Square/m/" target="_blank" alt="Lucent Square Leeds (EN)" />
+ <area shape="rect" coords="979, 765, 1146, 1053" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Woolwich-Wellington_v2/m/" target="_blank" alt="Wellington Quarter London" />
+ <area shape="rect" coords="762, 399, 922, 695" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-The-Loom/m/" target="_blank" alt="The Loom" />
+ <area shape="rect" coords="979, 402, 1145, 690" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Leeds-Centenary-house/m/" target="_blank" alt="Centenary House" />
+ <area shape="rect" coords="10, 760, 179, 1047" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-THE-CURVE-II-At-Park-Central/m/" target="_blank" alt="The Curve II" />
+ <area shape="circle" coords="424, 837, 25" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-THE-CURVE-At-Park-Central/" target="_blank" alt="The Curve (EN)" />
+ <area shape="circle" coords="425, 902, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-THE-CURVE-At-Park-Central-CH/m/" target="_blank" alt="The Curve (CN)" />
+ <area shape="rect" coords="469, 762, 632, 1051" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-River-Wandle-Apartments/m/" target="_blank" alt="River Wandle" />
+ <area shape="rect" coords="692, 829, 930, 1047" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Horizon/m/" target="_blank" alt="Horizon" />
+ <area shape="circle" coords="452, 483, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Trafford-Wharf/m/" target="_blank" alt="No.1 Trafford Wharf (EN)" />
+ <area shape="circle" coords="451, 549, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Trafford-Wharf-CH/m/" target="_blank" alt="No.1 Trafford Wharf (CN)" />
+ <area shape="circle" coords="699, 484, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Liverpool-Quay-Central/m/" target="_blank" alt="Quay Central (EN)" />
+ <area shape="circle" coords="699, 549, 25" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Liverpool-Quay-Central-CH/m/" target="_blank" alt="Quay Central (CN)" />
+ <area shape="circle" coords="784, 121, 23" href="https://hosting.fluidbook.com/IP-GLOBAL-UK-Manchester-The-Cartwright/m/" target="_blank" alt="The Cartwright (EN)" />
+ <area shape="circle" coords="785, 186, 23" href="https://hosting.fluidbook.com/IP-GLOBAL-CH-Manchester-The-Cartwright/" target="_blank" alt="The Cartwright (CN)" />
+ </map>
+
+ </div>
+ <div class="brochures">
+ <h3>Portuguese Projects</h3>
+ <img src="images/brochures-portugal.jpg" usemap="#brochures_portugal">
+ <map name="brochures_portugal">
+ <area shape="circle" coords="403, 180, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-CH-Porto-Alvaro/" target="_blank" alt="Alvaro Porto (CN)" />
+ <area shape="circle" coords="403, 115, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-PT-Porto-Alvaro/" target="_blank" alt="Alvaro Porto (EN)" />
+ <area shape="rect" coords="490, 33, 656, 321" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-PT-Lisbon-The-Carvalho/" target="_blank" alt="The Carvalho Lisbon" />
+ <area shape="circle" coords="916, 115, 24" href="https://hosting.fluidbook.com/IP-GLOBAL-PT-Lisbon-Bela-Vista/" target="_blank" alt="Bela Vista Lisbon (EN)" />
+ <area shape="circle" coords="916, 180, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-CH-Lisbon-Bela-Vista/" target="_blank" alt="Bela Vista Lisbon (CN)" />
+ </map>
+ </div>
+ <div class="brochures">
+ <h3>Irish Projects</h3>
+ <img src="images/brochures-ireland.jpg" usemap="#brochures_ireland">
+ <map name="brochures_ireland">
+ <area shape="circle" coords="688, 115, 25" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Ireland-Dublin-William-Beckett-House/" target="_blank" alt="William Beckett House (EN)" />
+ <area shape="circle" coords="688, 180, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Ireland-Dublin-William-Beckett-House-CH/m/" target="_blank" alt="William Beckett House (CN)" />
+ </map>
+ </div>
+ <div class="brochures">
+ <h3>German Projects</h3>
+ <img src="images/brochures-germany.jpg" usemap="#brochures_germany">
+ <map name="brochures_germany">
+ <area shape="rect" coords="4, 3, 176, 323" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Germany-Leipzig-Ruststrasse-4/" target="_blank" alt="Ruststrasse 4 Leipzig" />
+ <area shape="rect" coords="622, 358, 785, 642" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Berlin-Koda/m/" target="_blank" alt="Köda Berlin" />
+ <area shape="rect" coords="885, 362, 1044, 645" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-THE-Galleries/m/" target="_blank" alt="The Galleries" />
+ <area shape="rect" coords="367, 357, 531, 646" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Berlin-RiverGardens/m/" target="_blank" alt="River Gardens Berlin" />
+ <area shape="circle" coords="281, 439, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Konstanzer/m/" target="_blank" alt="Konstanzer Berlin (EN)" />
+ <area shape="circle" coords="281, 505, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Konstanzer-CH/m/" target="_blank" alt="Konstanzer Berlin (CN)" />
+ <area shape="circle" coords="1124, 114, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Gartenhaus/m/" target="_blank" alt="Gartenhaus Berlin (EN)" />
+ <area shape="circle" coords="1124, 179, 23" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Gartenhaus-CH/m/" target="_blank" alt="Gartenhaus Berlin (CN)" />
+ <area shape="circle" coords="897, 114, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Germany-Berlin-Eden-West/m/" target="_blank" alt="Eden West Berlin (EN)" />
+ <area shape="circle" coords="897, 180, 25" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-China-Berlin-Eden-West/m/" target="_blank" alt="Eden West Berlin (CN)" />
+ <area shape="circle" coords="665, 114, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Germany-Berlin-Einbecker-47/m/" target="_blank" alt="Einbecker 47 Berlin (EN)" />
+ <area shape="circle" coords="665, 178, 24" href="https://hosting.fluidbook.com/IP-GLOBAL-Germany-Berlin-Einbecker-47-CH/m/" target="_blank" alt="Einbecker 47 Berlin (CN)" />
+ <area shape="circle" coords="433, 114, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Germany-Berlin-Beautique-Apartments/" target="_blank" alt="Beautique Apartments Berlin (EN)" />
+ <area shape="circle" coords="433, 178, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-CH-Germany-Berlin-Beautique-Apartments/" target="_blank" alt="Beautique Apartments Berlin (CN)" />
+ </map>
+ </div>
+ </div>
+ </section>
+ <!--
+ <section class="block track-records">
+ <div class="content">
+ <h2 id="track-records">Track Records</h2>
+ <img src="images/brochures-track-records.jpg" usemap="#track_records">
+ <map name="track_records">
+ <area shape="rect" coords="340, 2, 515, 286" target="_blank" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Berlin-portfolio-analysis-2014-2016/m/" alt="Berlin Portfolio Analysis"/>
+ <area shape="circle" coords="843, 46, 24" target="_blank" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-London-portfolio-analysis/m/" alt="London Portfolio (EN)"/>
+ <area shape="circle" coords="843, 109, 22" target="_blank" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-London-portfolio-analysis-CH/m/" alt="London Portfolio (CN)"/>
+ <area shape="circle" coords="843, 170, 22" target="_blank" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-London-portfolio-analysis-AR/m/" alt="London Portfolio (AR)"/>
+ </map>
+ </div>
+ </section>
+ -->
+ <section class="block investor-guide bg-grey">
+ <div class="content">
+ <h2 id="investor-guides">Investor Guide Series</h2>
+ <img src="images/brochures-investor-guide.jpg" usemap="#investor_guides">
+ <map name="investor_guides">
+ <area shape="circle" coords="297, 168, 25" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-CH-GREO-2020/" target="_blank" alt="Global Real Estate Outlook 2020 (CN)" />
+ <area shape="circle" coords="297, 104, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-GREO-2020/" target="_blank" alt="Global Real Estate Outlook 2020 (EN)" />
+ <area shape="circle" coords="579, 167, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-CH-Investing-in-property-Portugal/" target="_blank" alt="Portugal (CN)" />
+ <area shape="circle" coords="579, 103, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Investing-in-property-Portugal/m/" target="_blank" alt="Portugal (EN)" />
+ <area shape="rect" coords="880, 378, 1058, 659" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Global-investor-sentiment-survey-2018/m" target="_blank" alt="Global investor sentiment survey 2018" />
+ <area shape="circle" coords="808, 527, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Investing-in-property-ENGLAND-AND-WALES-v2-CH/" target="_blank" alt="England & Wales (CN)" />
+ <area shape="circle" coords="808, 462, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Investing-in-property-ENGLAND-AND-WALES/m/" target="_blank" alt="England & Wales (EN)" />
+ <area shape="rect" coords="380, 371, 539, 656" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Investment-guide-Chicago/m/" target="_blank" alt="Chicago" />
+ <area shape="circle" coords="291, 520, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Investment-guide-CROSSRAIL-CH/m/" target="_blank" alt="Crossrail Update (CN)" />
+ <area shape="circle" coords="291, 456, 24" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Investing-in-property-CROSSRAIL_update/m/" target="_blank" alt="Crossrail Update (EN)" />
+ <area shape="rect" coords="893, 23, 1050, 306" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Investing-in-property-CROSSRAIL/m/" target="_blank" alt="Crossrail" />
+ <area shape="rect" coords="669, 23, 829, 306" href="https://hosting.fluidbook.com/ipglobal/IP-GLOBAL-Investing-in-property-BERLIN/m/" target="_blank" alt="Berlin" />
+ </map>
+ </div>
+ </section>
+ */
+ }
+
}