diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Users.php b/lib/Alchemy/Phrasea/Controller/Admin/Users.php index 0dbf8812a0..f9c61b22d0 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Users.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Users.php @@ -78,12 +78,12 @@ class Users implements ControllerProviderInterface { $rights = new UserHelper\Edit($app['Core'], $app['request']); $rights->apply_rights(); - + if ($app['request']->get('template')) { $rights->apply_template(); } - + $rights->apply_infos(); $datas = array('error' => false); @@ -176,7 +176,72 @@ class Users implements ControllerProviderInterface } ); - $controllers->post('/apply_template/', function(Application $app) + $controllers->post('/search/export/', function() use ($app) + { + $request = $app['request']; + $users = new module_admin_route_users($request); + $template = 'admin/users.html'; + + $twig = new supertwig(); + $twig->addFilter(array('floor' => 'floor')); + $twig->addFilter(array('getDate' => 'phraseadate::getDate')); + + $results = $users->export($request); + + $userTable = array( + array( + 'ID', + 'Login', + 'Last Name', + 'First Name', + 'E-Mail', + 'Created', + 'Updated', + 'Address', + 'City', + 'Zip', + 'Country', + 'Phone', + 'Fax', + 'Job', + 'Company', + 'Position' + ) + ); + + foreach ($results as $user) + { + /* @var $user \User_Adapter */ + $userTable[] = array( + $user->get_id(), + $user->get_login(), + $user->get_lastname(), + $user->get_firstname(), + $user->get_email(), + $user->get_creation_date()->format(DATE_ATOM), + $user->get_modification_date()->format(DATE_ATOM), + $user->get_address(), + $user->get_city(), + $user->get_zipcode(), + $user->get_country(), + $user->get_tel(), + $user->get_fax(), + $user->get_job(), + $user->get_company(), + $user->get_position() + ); + } + + $CSVDatas = format::arr_to_csv($userTable); + + $response = new Response($CSVDatas, 200, array('Content-Type' => 'text/plain')); + $response->headers->set('Content-Disposition', 'attachment; filename=export.txt'); + + return $response; + } + ); + + $controllers->post('/apply_template/', function() use ($app) { $users = UserHelper\Manage($app['Core'], $app['request']); diff --git a/lib/Alchemy/Phrasea/Helper/User/Manage.php b/lib/Alchemy/Phrasea/Helper/User/Manage.php index 014f8de8c1..1bf1411819 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Manage.php +++ b/lib/Alchemy/Phrasea/Helper/User/Manage.php @@ -39,7 +39,52 @@ class Manage extends \Alchemy\Phrasea\Helper\Helper */ protected $usr_id; - public function search() + public function __construct(Symfony\Component\HttpFoundation\Request $request) + { + $this->request = $request; + + + return $this; + } + + public function export(Symfony\Component\HttpFoundation\Request $request) + { + $appbox = appbox::get_instance(); + $session = $appbox->get_session(); + + $offset_start = (int) $request->get('offset_start'); + $offset_start = $offset_start < 0 ? 0 : $offset_start; + + $this->query_parms = array( + 'inactives' => $request->get('inactives') + , 'like_field' => $request->get('like_field') + , 'like_value' => $request->get('like_value') + , 'sbas_id' => $request->get('sbas_id') + , 'base_id' => $request->get('base_id') + , 'srt' => $request->get("srt", User_Query::SORT_CREATIONDATE) + , 'ord' => $request->get("ord", User_Query::ORD_DESC) + , 'offset_start' => 0 + ); + + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $query = new User_Query($appbox); + + if (is_array($this->query_parms['base_id'])) + $query->on_base_ids($this->query_parms['base_id']); + elseif (is_array($this->query_parms['sbas_id'])) + $query->on_sbas_ids($this->query_parms['sbas_id']); + + $this->results = $query->sort_by($this->query_parms["srt"], $this->query_parms["ord"]) + ->like($this->query_parms['like_field'], $this->query_parms['like_value']) + ->get_inactives($this->query_parms['inactives']) + ->include_templates(false) + ->on_bases_where_i_am($user->ACL(), array('canadmin')) + ->execute(); + + return $this->results->get_results(); + } + + public function search(Symfony\Component\HttpFoundation\Request $request) { $appbox = \appbox::get_instance(); diff --git a/lib/classes/appbox.class.php b/lib/classes/appbox.class.php index 521cd861b7..be84581203 100644 --- a/lib/classes/appbox.class.php +++ b/lib/classes/appbox.class.php @@ -218,8 +218,10 @@ class appbox extends base { $sqlupd = "UPDATE bas SET ord = :ordre WHERE base_id = :base_id"; $stmt = $this->get_connection()->prepare($sqlupd); - $stmt->execute(array(':ordre' => $ord, ':base_id' => $collection->get_base_id())); + $stmt->execute(array(':ordre' => $ordre, ':base_id' => $collection->get_base_id())); $stmt->closeCursor(); + + $collection->get_databox()->delete_data_from_cache(\databox::CACHE_COLLECTIONS); return $this; } diff --git a/lib/classes/collection.class.php b/lib/classes/collection.class.php index 474cdbf29a..8acf39bdcb 100644 --- a/lib/classes/collection.class.php +++ b/lib/classes/collection.class.php @@ -609,7 +609,7 @@ class collection implements cache_cacheableInterface $registry = registry::get_instance(); if (is_file($registry->get('GV_RootPath') . 'config/wm/' . $base_id)) - self::$_watermarks['base_id'] = ''; + self::$_watermarks['base_id'] = ''; } return isset(self::$_watermarks['base_id']) ? self::$_watermarks['base_id'] : ''; @@ -622,7 +622,7 @@ class collection implements cache_cacheableInterface $registry = registry::get_instance(); if (is_file($registry->get('GV_RootPath') . 'config/presentation/' . $base_id)) - self::$_presentations['base_id'] = ''; + self::$_presentations['base_id'] = ''; } return isset(self::$_presentations['base_id']) ? self::$_presentations['base_id'] : ''; @@ -635,7 +635,7 @@ class collection implements cache_cacheableInterface $registry = registry::get_instance(); if (is_file($registry->get('GV_RootPath') . 'config/stamp/' . $base_id)) - self::$_stamps['base_id'] = ''; + self::$_stamps['base_id'] = ''; } return isset(self::$_stamps['base_id']) ? self::$_stamps['base_id'] : ''; diff --git a/lib/classes/deprecated/push.api.php b/lib/classes/deprecated/push.api.php index 8f5c4de444..3b3d10c680 100644 --- a/lib/classes/deprecated/push.api.php +++ b/lib/classes/deprecated/push.api.php @@ -843,8 +843,8 @@ function sqlFromFilters($usr, $filters) foreach ($filters->countries as $country) { $c['country' . $n] = $country; + $n++; } - $n++; $precise.=" AND usr.pays IN (:" . implode(", :", array_keys($c)) . ")"; $params = array_merge($params, $c); } @@ -855,8 +855,8 @@ function sqlFromFilters($usr, $filters) foreach ($filters->activite as $activite) { $c['activite' . $n] = $activite; + $n++; } - $n++; $precise.=" AND usr.activite IN (:" . implode(", :", array_keys($c)) . ")"; $params = array_merge($params, $c); } @@ -867,8 +867,8 @@ function sqlFromFilters($usr, $filters) foreach ($filters->fonction as $fonction) { $c['fonction' . $n] = $fonction; + $n++; } - $n++; $precise.=" AND usr.fonction IN (:" . implode(", :", array_keys($c)) . ")"; $params = array_merge($params, $c); } @@ -879,8 +879,8 @@ function sqlFromFilters($usr, $filters) foreach ($filters->societe as $societe) { $c['societe' . $n] = $societe; + $n++; } - $n++; $precise.=" AND usr.societe IN (:" . implode(", :", array_keys($c)) . ")"; $params = array_merge($params, $c); } @@ -891,8 +891,8 @@ function sqlFromFilters($usr, $filters) foreach ($filters->template as $template) { $c['template' . $n] = $template; + $n++; } - $n++; $precise.=" AND usr.lastModel IN (:" . implode(", :", array_keys($c)) . ")"; $params = array_merge($params, $c); } diff --git a/lib/classes/mail.class.php b/lib/classes/mail.class.php index ab04900fad..d4d02f9acc 100644 --- a/lib/classes/mail.class.php +++ b/lib/classes/mail.class.php @@ -206,6 +206,7 @@ class mail $body = eregi_replace("[\]", '', $body); + $body .= "
\n"._('Si le lien n\'est pas cliquable, copiez-collez le dans votre navigateur.')."
\n"; $body .= "



\n\n\n\n"; $body .= '
' . _('phraseanet::signature automatique des notifications par mail, infos a l\'url suivante') . "
\n"; $body .= '
' . $registry->get('GV_ServerName') . "
\n"; diff --git a/lib/classes/metadata/description/XMPiptcCore/CountryCode.class.php b/lib/classes/metadata/description/XMPiptcCore/CountryCode.class.php new file mode 100644 index 0000000000..c6c1f3658a --- /dev/null +++ b/lib/classes/metadata/description/XMPiptcCore/CountryCode.class.php @@ -0,0 +1,27 @@ + + +
+ + + + {% for sbas_id in parm.sbas_id %} + + {% endfor %} + {% for base_id in parm.base_id %} + + {% endfor %} + + + + +
+
{{users.get_total}} resultats @@ -268,7 +285,21 @@ $('#users_page_form select[name="per_page"]').bind('change', function(){ $(this).closest('form').submit(); }); + }); + + function importlist() + { + var myObj = new Object(); + myObj.myOpener = self; + window.showModalDialog ('/admin/import0.php?rand='+Math.random(),myObj, 'dialogWidth:550px;dialogHeight:330px;center:yes;help:no;status:no;scrollbars:no' ); + + } + function exportlist() + { + $('#export_form').submit(); + } + {% endblock %} \ No newline at end of file diff --git a/www/prod/jquery.edit.js b/www/prod/jquery.edit.js index 6de42d93e3..d2cfe33545 100644 --- a/www/prod/jquery.edit.js +++ b/www/prod/jquery.edit.js @@ -1796,14 +1796,15 @@ function preset_delete(preset_id, li) "act":"DELETE", "presetid":preset_id }; - $.getJSON( - "/xmlhttp/editing_presets.j.php", - p, - function(data, textStatus) - { - li.remove(); + $.ajax({ + type: 'POST', + url: "/xmlhttp/editing_presets.j.php", + data: p, + dataType: 'json', + success: function(data, textStatus){ + li.remove(); } - ); + }); } function preset_load(preset_id) @@ -1812,6 +1813,7 @@ function preset_load(preset_id) "act":"LOAD", "presetid":preset_id }; + $.getJSON( "/xmlhttp/editing_presets.j.php", p, @@ -2224,15 +2226,17 @@ function startThisEditing(sbas_id,what,regbasprid,ssel) x += ""; p["f"] = x; - $.getJSON( - "/xmlhttp/editing_presets.j.php", - p, - function(data, textStatus) + $.ajax({ + type: 'POST', + url: "/xmlhttp/editing_presets.j.php", + data: p, + dataType: 'json', + success: function(data, textStatus) { preset_paint(data); $("#Edit_copyPreset_dlg").dialog("close"); } - ); + }); }; buttons[language.annuler] = function() {