예제 #1
0
파일: Ajax.php 프로젝트: hakimam/ArkeoGIS
 public static function databases($params)
 {
     if (!\mod\user\Main::userIsLoggedIn()) {
         return "not logged";
     }
     $l = \mod\lang\Main::getCurrentLang();
     $lang = $l == 'fr_FR' ? 'fr' : 'de';
     $langext = $l == 'fr_FR' ? '' : '_de';
     $pagination = false;
     if (isset($_REQUEST["page"])) {
         $pagination = true;
         $page = intval($_REQUEST["page"]);
         $perpage = intval($_REQUEST["perpage"]);
     }
     // this variables Omnigrid will send only if serverSort option is true
     $sorton = isset($_REQUEST["sorton"]) ? $_REQUEST["sorton"] : '';
     $sortby = isset($_REQUEST["sortby"]) ? $_REQUEST["sortby"] : '';
     if ($sorton == 'declared_modification_str') {
         $sorton = 'declared_modification';
     }
     if ($sorton == 'published_str') {
         $sorton = 'published';
     }
     if (!in_array($sorton, array('issn', 'name', 'author', 'type', 'declared_modification', 'lines', 'sites', 'period_start', 'period_end', 'scale_resolution', 'status', 'description', 'geographical_limit'))) {
         $sorton = 'issn';
     }
     if (!in_array($sortby, array('ASC', 'DESC'))) {
         $sortby = 'ASC';
     }
     $n = ($page - 1) * $perpage;
     $q = 'SELECT count(1) FROM "ark_database"';
     $total = \core\Core::$db->fetchOne($q, []);
     $limit = "";
     $scaleTranslations = array('site' => 'Site', 'watershed' => 'Bassin versant', 'micro-region' => 'Micro-région', 'region' => 'Région', 'country' => 'Pays', 'europe' => 'Europe');
     if ($pagination) {
         $limit = "OFFSET {$n} LIMIT {$perpage}";
     }
     $q = 'SELECT da_id as id, da_issn as issn, da_name as name, da_description' . $langext . ' as description, u.full_name as author, da_type as type, to_char(da_declared_modification, \'DD/MM/YYYY\') as declared_modification_str, da_declared_modification as declared_modification, da_lines as lines, da_sites as sites, (SELECT pe_name_' . $lang . ' FROM ark_period WHERE pe_id = da_period_start) as period_start, (SELECT pe_name_' . $lang . ' FROM ark_period WHERE pe_id = da_period_end) as period_end, da_scale_resolution as scale_resolution, da_geographical_limit' . $langext . ' as geographical_limit, da_published as published FROM ark_database d LEFT JOIN ch_user u ON d.da_owner_id = u.uid ORDER BY ' . $sorton . ' ' . $sortby . ' ' . $limit;
     $ret = \core\Core::$db->fetchAll($q, []);
     $outp = array();
     foreach ($ret as $r) {
         $r['type'] = \mod\lang\Main::ch_t('arkeogis', $r['type']);
         if (isset($scaleTranslations[$r['scale_resolution']])) {
             $r['scale_resolution'] = \mod\lang\Main::ch_t('arkeogis', $scaleTranslations[$r['scale_resolution']]);
         }
         $r['published_str'] = $r['published'] == 't' ? '<img src="/mod/arkeogis/img/status-ok.png" alt="" />' : '<img src="/mod/arkeogis/img/status-pending.png" alt="" />';
         array_push($outp, $r);
     }
     $ret = array("page" => $page, "total" => $total, "data" => $outp);
     return $ret;
 }
예제 #2
0
 public static function load_strings()
 {
     $lang = \mod\lang\Main::getCurrentLang();
     $lang = substr($lang, 0, 2);
     $menus = array();
     $menus['db'] = self::idtok(\core\Core::$db->fetchAll("select da_id as id, da_name as name from ark_database order by da_id"));
     $menus['period'] = self::idtok(\core\Core::$db->fetchAll("select pe_id as id, pe_name_{$lang} as name from ark_period order by pe_id"));
     $menus['production'] = self::idtok(\core\Core::$db->fetchAll("select pr_id as id, pr_name_{$lang} as name from ark_production order by pr_id"));
     $menus['realestate'] = self::idtok(\core\Core::$db->fetchAll("select re_id as id, re_name_{$lang} as name from ark_realestate order by re_id"));
     $menus['furniture'] = self::idtok(\core\Core::$db->fetchAll("select fu_id as id, fu_name_{$lang} as name from ark_furniture order by fu_id"));
     $menus['landscape'] = self::idtok(\core\Core::$db->fetchAll("select la_id as id, la_name_{$lang} as name from ark_landscape order by la_id"));
     $menus['knowledge'] = array('unknown' => \mod\lang\Main::ch_t('arkeogis', "Non renseigné"), 'literature' => \mod\lang\Main::ch_t('arkeogis', "Littérature, prospecté"), 'surveyed' => \mod\lang\Main::ch_t('arkeogis', "Sondé"), 'excavated' => \mod\lang\Main::ch_t('arkeogis', "Fouillé"));
     $menus['occupation'] = array('unknown' => \mod\lang\Main::ch_t('arkeogis', "Non renseigné"), 'uniq' => \mod\lang\Main::ch_t('arkeogis', "Unique"), 'continuous' => \mod\lang\Main::ch_t('arkeogis', "Continue"), 'multiple' => \mod\lang\Main::ch_t('arkeogis', "Multiple"));
     return $menus;
 }
예제 #3
0
파일: Main.php 프로젝트: hakimam/ArkeoGIS
 public static function hook_mod_arkeogis_import($hookname, $userdata, $urlmatches)
 {
     if (\mod\user\Main::userHasRight('Manage personal database') || \mod\user\Main::userHasRight('Manage all databases')) {
         $page = new \mod\webpage\Main();
         $lang = \mod\lang\Main::getCurrentLang();
         $page->smarty->assign('lang', $lang);
         $page->setLayout('arkeogis/import');
         $page->display();
     }
 }